_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q8200
train
function( options, callback ) { var self = this var url = '/ratings/rest/v1/json/flight/' + options.carrier + '/' + options.flightNumber var extensions = [] if( Array.isArray( options.extendedOptions ) ) { extensions = extensions.concat( options.extendedOptions ) } return this._clientR...
javascript
{ "resource": "" }
q8201
train
function( options, callback ) { debug( 'route', options ) var self = this var year = options.date.getFullYear() var month = options.date.getMonth() + 1 var day = options.date.getDate() var direction = /^dep/i.test( options.direction ) ? 'dep' : 'arr' var url = 'flightstatus/rest/v2...
javascript
{ "resource": "" }
q8202
randomId
train
function randomId () { const res = new Array(32) const alphabet = 'ABCDEF0123456789' for (let i = 0; i < 32; i++) { res[i] = alphabet[Math.floor(Math.random() * 16)] } return res.join('') }
javascript
{ "resource": "" }
q8203
signIn
train
function signIn (selection) { return dom.create('div').class('sign-in') .add(dom.create('input').class('username-input')) .add(dom.create('input').class('password-input')) .add(dom.create('button').class('sign-in-button').text('Sign in')) }
javascript
{ "resource": "" }
q8204
isEntity
train
function isEntity (d) { return isText(d.type) && Array.isArray(d.params) && Array.isArray(d.content) }
javascript
{ "resource": "" }
q8205
inspect
train
function inspect(stringsOrOpts, ...values) { if (Array.isArray(stringsOrOpts)) { return DEFAULT_INSPECT(stringsOrOpts, ...values); } return inspector(stringsOrOpts); }
javascript
{ "resource": "" }
q8206
noisyRule
train
function noisyRule(context, parser, onError) { parser.on('startTag', (name, attrs, selfClosing, location) => { onError({ rule: name, message: getAttribute(attrs, 'message') || '', location, }); }); }
javascript
{ "resource": "" }
q8207
execute
train
function execute(argv) { const opts = Options.parse(argv); if (opts.version) { /* eslint-disable global-require */ console.log(`v${ require('../package.json').version }`); return Promise.resolve(0); } if (opts.help || !opts._.length) { console.log(Options.generateHelp()); return Promise.re...
javascript
{ "resource": "" }
q8208
compareAscending
train
function compareAscending(a, b) { var ai = a.index, bi = b.index; a = a.criteria; b = b.criteria; // ensure a stable sort in V8 and other engines // http://code.google.com/p/v8/issues/detail?id=90 if (a !== b) { if (a > b || typeof a == 'undefined') { re...
javascript
{ "resource": "" }
q8209
createBound
train
function createBound(func, thisArg, partialArgs, indicator) { var isFunc = isFunction(func), isPartial = !partialArgs, key = thisArg; // juggle arguments if (isPartial) { var rightIndicator = indicator; partialArgs = thisArg; } else if (!isFunc) { ...
javascript
{ "resource": "" }
q8210
findKey
train
function findKey(object, callback, thisArg) { var result; callback = lodash.createCallback(callback, thisArg); forOwn(object, function(value, key, object) { if (callback(value, key, object)) { result = key; return false; } }); return result; }
javascript
{ "resource": "" }
q8211
reduceRight
train
function reduceRight(collection, callback, accumulator, thisArg) { var iterable = collection, length = collection ? collection.length : 0, noaccum = arguments.length < 3; if (typeof length != 'number') { var props = keys(collection); length = props.length; } ...
javascript
{ "resource": "" }
q8212
findIndex
train
function findIndex(array, callback, thisArg) { var index = -1, length = array ? array.length : 0; callback = lodash.createCallback(callback, thisArg); while (++index < length) { if (callback(array[index], index, array)) { return index; } } return -1; ...
javascript
{ "resource": "" }
q8213
unzip
train
function unzip(array) { var index = -1, length = array ? array.length : 0, tupleLength = length ? max(pluck(array, 'length')) : 0, result = Array(tupleLength); while (++index < length) { var tupleIndex = -1, tuple = array[index]; while (++tupleInde...
javascript
{ "resource": "" }
q8214
bind
train
function bind(func, thisArg) { // use `Function#bind` if it exists and is fast // (in V8 `Function#bind` is slower except when partially applied) return support.fastBind || (nativeBind && arguments.length > 2) ? nativeBind.call.apply(nativeBind, arguments) : createBound(func, thisArg, ...
javascript
{ "resource": "" }
q8215
bindAll
train
function bindAll(object) { var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object), index = -1, length = funcs.length; while (++index < length) { var key = funcs[index]; object[key] = bind(object[key], object); ...
javascript
{ "resource": "" }
q8216
defer
train
function defer(func) { var args = nativeSlice.call(arguments, 1); return setTimeout(function() { func.apply(undefined, args); }, 1); }
javascript
{ "resource": "" }
q8217
memoize
train
function memoize(func, resolver) { var cache = {}; return function() { var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]); return hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = func.apply(this, arguments)); }; }
javascript
{ "resource": "" }
q8218
wrap
train
function wrap(value, wrapper) { return function() { var args = [value]; push.apply(args, arguments); return wrapper.apply(this, args); }; }
javascript
{ "resource": "" }
q8219
train
function( obj ) { _each( slice.call( arguments, 1), function( source ) { var prop; for ( prop in source ) { if ( source[prop] !== void 0 ) { obj[ prop ] = source[ prop ]; } } }); return obj; }
javascript
{ "resource": "" }
q8220
string_starts_with
train
function string_starts_with(str, what) { return (str.substr(0, what.length) === what) ? true : false; }
javascript
{ "resource": "" }
q8221
create_constructor
train
function create_constructor(type_name) { if(Object.prototype.hasOwnProperty.call(constructors, type_name)) { return constructors[type_name]; } if(!( Object.prototype.hasOwnProperty.call(_schema.definitions, type_name) && is.def(_schema.definitions[type_name]) )) { throw new TypeError("No definition for " ...
javascript
{ "resource": "" }
q8222
post_user_defines
train
function post_user_defines(context) { if(Object.prototype.hasOwnProperty.call(_user_defined_methods, type_name)) { _user_defined_methods[type_name].call(context, Type, context); } }
javascript
{ "resource": "" }
q8223
setEnabledSources
train
function setEnabledSources(config) { for (let source in config) { setSourceEnabled(source, config[source]); } haveSourcesBeenSelected = true; }
javascript
{ "resource": "" }
q8224
convertParamValues
train
function convertParamValues(parsedSql, values) { var ret = []; _.each(parsedSql.params, function(param) { if( !_.has(values, param.name) ) { throw new Error("No value found for parameter: " + param.name); } ret.push(values[param.name]); }); return ret; }
javascript
{ "resource": "" }
q8225
train
function(links) { this.dependencies = _buildDependencies(links); this.tasks = graph.tsort(this.dependencies).reverse(); this.index = 0; }
javascript
{ "resource": "" }
q8226
train
function (tagName, tagAttributes) { if (this._done) { return; } this._openElementStack.push(tagName); try { this._errorIfUnexpectedTag(tagName); for (var attributeName in tagAttributes) { var attributeValue = tagAttributes[attributeName]; this._errorIfUnexpectedAttr...
javascript
{ "resource": "" }
q8227
LRUItem
train
function LRUItem(key, value) { this.key = key; this.value = value; this.next = null; this.prev = null; }
javascript
{ "resource": "" }
q8228
ScriptError
train
function ScriptError(code, op, ip) { if (!(this instanceof ScriptError)) return new ScriptError(code, op, ip); Error.call(this); this.type = 'ScriptError'; this.code = code; this.message = code; this.op = -1; this.ip = -1; if (typeof op === 'string') { this.message = op; } else if (op) { ...
javascript
{ "resource": "" }
q8229
Network
train
function Network(options) { if (!(this instanceof Network)) return new Network(options); assert(!Network[options.type], 'Cannot create two networks.'); this.type = options.type; this.seeds = options.seeds; this.magic = options.magic; this.port = options.port; this.checkpointMap = options.checkpointM...
javascript
{ "resource": "" }
q8230
overwriteKeys
train
function overwriteKeys(baseObject, overrideObject, createNew) { if (!baseObject) { baseObject = {}; } if (createNew) { baseObject = JSON.parse(JSON.stringify(baseObject)); } Object.keys(overrideObject).forEach(function(key) { if (isObjectAndNotArray(baseObject[key]) && isObjectAndNotArray(override...
javascript
{ "resource": "" }
q8231
ShouldPlayerStand
train
function ShouldPlayerStand(playerCards, dealerCard, handValue, handCount, options) { var shouldStand = false; if (handValue.soft) { // Don't stand until you hit 18 if (handValue.total > 18) { shouldStand = true; } else if (handValue.total == 18) {...
javascript
{ "resource": "" }
q8232
Pool
train
function Pool(options) { if (!(this instanceof Pool)) return new Pool(options); AsyncObject.call(this); this.options = new PoolOptions(options); this.network = this.options.network; this.logger = this.options.logger.context('net'); this.chain = this.options.chain; this.mempool = this.options.mempoo...
javascript
{ "resource": "" }
q8233
TXMeta
train
function TXMeta(options) { if (!(this instanceof TXMeta)) return new TXMeta(options); this.tx = new TX(); this.mtime = util.now(); this.height = -1; this.block = null; this.time = 0; this.index = -1; if (options) this.fromOptions(options); }
javascript
{ "resource": "" }
q8234
PaymentACK
train
function PaymentACK(options) { if (!(this instanceof PaymentACK)) return new PaymentACK(options); this.payment = new Payment(); this.memo = null; if (options) this.fromOptions(options); }
javascript
{ "resource": "" }
q8235
hash256
train
function hash256(data) { const out = Buffer.allocUnsafe(32); ctx.init(); ctx.update(data); ctx._finish(out); ctx.init(); ctx.update(out); ctx._finish(out); return out; }
javascript
{ "resource": "" }
q8236
hmac
train
function hmac(data, key) { mctx.init(key); mctx.update(data); return mctx.finish(); }
javascript
{ "resource": "" }
q8237
polymod
train
function polymod(pre) { const b = pre >>> 25; return ((pre & 0x1ffffff) << 5) ^ (-((b >> 0) & 1) & 0x3b6a57b2) ^ (-((b >> 1) & 1) & 0x26508e6d) ^ (-((b >> 2) & 1) & 0x1ea119fa) ^ (-((b >> 3) & 1) & 0x3d4233dd) ^ (-((b >> 4) & 1) & 0x2a1462b3); }
javascript
{ "resource": "" }
q8238
serialize
train
function serialize(hrp, data) { let chk = 1; let i; for (i = 0; i < hrp.length; i++) { const ch = hrp.charCodeAt(i); if ((ch >> 5) === 0) throw new Error('Invalid bech32 character.'); chk = polymod(chk) ^ (ch >> 5); } if (i + 7 + data.length > 90) throw new Error('Invalid bech32 data...
javascript
{ "resource": "" }
q8239
deserialize
train
function deserialize(str) { let dlen = 0; if (str.length < 8 || str.length > 90) throw new Error('Invalid bech32 string length.'); while (dlen < str.length && str[(str.length - 1) - dlen] !== '1') dlen++; const hlen = str.length - (1 + dlen); if (hlen < 1 || dlen < 6) throw new Error('Invalid ...
javascript
{ "resource": "" }
q8240
convert
train
function convert(data, output, frombits, tobits, pad, off) { const maxv = (1 << tobits) - 1; let acc = 0; let bits = 0; let j = 0; if (pad !== -1) output[j++] = pad; for (let i = off; i < data.length; i++) { const value = data[i]; if ((value >> frombits) !== 0) throw new Error('Invalid ...
javascript
{ "resource": "" }
q8241
encode
train
function encode(hrp, version, hash) { const output = POOL65; if (version < 0 || version > 16) throw new Error('Invalid bech32 version.'); if (hash.length < 2 || hash.length > 40) throw new Error('Invalid bech32 data length.'); const data = convert(hash, output, 8, 5, version, 0); return serialize(...
javascript
{ "resource": "" }
q8242
decode
train
function decode(str) { const [hrp, data] = deserialize(str); if (data.length === 0 || data.length > 65) throw new Error('Invalid bech32 data length.'); if (data[0] > 16) throw new Error('Invalid bech32 version.'); const version = data[0]; const output = data; const hash = convert(data, output, 5,...
javascript
{ "resource": "" }
q8243
NetAddress
train
function NetAddress(options) { if (!(this instanceof NetAddress)) return new NetAddress(options); this.host = '0.0.0.0'; this.port = 0; this.services = 0; this.time = 0; this.hostname = '0.0.0.0:0'; this.raw = IP.ZERO_IP; if (options) this.fromOptions(options); }
javascript
{ "resource": "" }
q8244
train
function(err, commandName, config, resultFunction) { //max Number in javascript is 9,007,199,254,740,992. At 10,000 requests per second, that is 28,561 years until we get an overflow on messageId messageId += 1; messageStack[messageId] = resultFunction; //tell the parent process to run t...
javascript
{ "resource": "" }
q8245
murmur3
train
function murmur3(data, seed) { const tail = data.length - (data.length % 4); const c1 = 0xcc9e2d51; const c2 = 0x1b873593; let h1 = seed; let k1; for (let i = 0; i < tail; i += 4) { k1 = (data[i + 3] << 24) | (data[i + 2] << 16) | (data[i + 1] << 8) | data[i]; k1 = mul32(k1, c1); ...
javascript
{ "resource": "" }
q8246
Chain
train
function Chain(options) { if (!(this instanceof Chain)) return new Chain(options); AsyncObject.call(this); this.options = new ChainOptions(options); this.network = this.options.network; this.logger = this.options.logger.context('chain'); this.workers = this.options.workers; this.db = new ChainDB(t...
javascript
{ "resource": "" }
q8247
DeploymentState
train
function DeploymentState() { if (!(this instanceof DeploymentState)) return new DeploymentState(); this.flags = Script.flags.MANDATORY_VERIFY_FLAGS; this.flags &= ~Script.flags.VERIFY_P2SH; this.lockFlags = common.lockFlags.MANDATORY_LOCKTIME_FLAGS; this.bip34 = false; this.bip91 = false; this.bip148...
javascript
{ "resource": "" }
q8248
createVirtualLessFileFromBowerJson
train
function createVirtualLessFileFromBowerJson(bowerJsonPath) { return new PromiseConstructor(function(fullfill, reject) { bowerJson.read(bowerJsonPath, { validate: false }, function(err, bowerJsonData) { if (err) { return reject(err); } if (!bowerJsonData.main) { err = bowerJsonPat...
javascript
{ "resource": "" }
q8249
train
function (cb) { sails.log.verbose('Loading app Gulpfile...'); // Start task depending on environment if(sails.config.environment === 'production'){ return this.runTask('prod', cb); } this.runTask('default', cb); }
javascript
{ "resource": "" }
q8250
_sanitize
train
function _sanitize (chunk) { if (chunk && typeof chunk === 'object' && chunk.toString) { chunk = chunk.toString(); } if (typeof chunk === 'string') { chunk = chunk.replace(/^[\s\n]*/, ''); chunk = chunk.replace(/[\s\n]*$/, ''); } return chunk; }
javascript
{ "resource": "" }
q8251
background
train
function background(options) { options = options || {}; // ReSharper disable once UnusedParameter return function (config) { var values = []; [ 'attachment', 'clip', 'color', 'image', 'origin', 'position', 'r...
javascript
{ "resource": "" }
q8252
PingPacket
train
function PingPacket(nonce) { if (!(this instanceof PingPacket)) return new PingPacket(nonce); Packet.call(this); this.nonce = nonce || null; }
javascript
{ "resource": "" }
q8253
PongPacket
train
function PongPacket(nonce) { if (!(this instanceof PongPacket)) return new PongPacket(nonce); Packet.call(this); this.nonce = nonce || encoding.ZERO_U64; }
javascript
{ "resource": "" }
q8254
GetBlocksPacket
train
function GetBlocksPacket(locator, stop) { if (!(this instanceof GetBlocksPacket)) return new GetBlocksPacket(locator, stop); Packet.call(this); this.version = common.PROTOCOL_VERSION; this.locator = locator || []; this.stop = stop || null; }
javascript
{ "resource": "" }
q8255
GetHeadersPacket
train
function GetHeadersPacket(locator, stop) { if (!(this instanceof GetHeadersPacket)) return new GetHeadersPacket(locator, stop); GetBlocksPacket.call(this, locator, stop); }
javascript
{ "resource": "" }
q8256
BlockPacket
train
function BlockPacket(block, witness) { if (!(this instanceof BlockPacket)) return new BlockPacket(block, witness); Packet.call(this); this.block = block || new MemBlock(); this.witness = witness || false; }
javascript
{ "resource": "" }
q8257
TXPacket
train
function TXPacket(tx, witness) { if (!(this instanceof TXPacket)) return new TXPacket(tx, witness); Packet.call(this); this.tx = tx || new TX(); this.witness = witness || false; }
javascript
{ "resource": "" }
q8258
FilterLoadPacket
train
function FilterLoadPacket(filter) { if (!(this instanceof FilterLoadPacket)) return new FilterLoadPacket(filter); Packet.call(this); this.filter = filter || new Bloom(); }
javascript
{ "resource": "" }
q8259
FilterAddPacket
train
function FilterAddPacket(data) { if (!(this instanceof FilterAddPacket)) return new FilterAddPacket(data); Packet.call(this); this.data = data || DUMMY; }
javascript
{ "resource": "" }
q8260
MerkleBlockPacket
train
function MerkleBlockPacket(block) { if (!(this instanceof MerkleBlockPacket)) return new MerkleBlockPacket(block); Packet.call(this); this.block = block || new MerkleBlock(); }
javascript
{ "resource": "" }
q8261
SendCmpctPacket
train
function SendCmpctPacket(mode, version) { if (!(this instanceof SendCmpctPacket)) return new SendCmpctPacket(mode, version); Packet.call(this); this.mode = mode || 0; this.version = version || 1; }
javascript
{ "resource": "" }
q8262
CmpctBlockPacket
train
function CmpctBlockPacket(block, witness) { if (!(this instanceof CmpctBlockPacket)) return new CmpctBlockPacket(block, witness); Packet.call(this); this.block = block || new bip152.CompactBlock(); this.witness = witness || false; }
javascript
{ "resource": "" }
q8263
GetBlockTxnPacket
train
function GetBlockTxnPacket(request) { if (!(this instanceof GetBlockTxnPacket)) return new GetBlockTxnPacket(request); Packet.call(this); this.request = request || new bip152.TXRequest(); }
javascript
{ "resource": "" }
q8264
BlockTxnPacket
train
function BlockTxnPacket(response, witness) { if (!(this instanceof BlockTxnPacket)) return new BlockTxnPacket(response, witness); Packet.call(this); this.response = response || new bip152.TXResponse(); this.witness = witness || false; }
javascript
{ "resource": "" }
q8265
EncinitPacket
train
function EncinitPacket(publicKey, cipher) { if (!(this instanceof EncinitPacket)) return new EncinitPacket(publicKey, cipher); Packet.call(this); this.publicKey = publicKey || encoding.ZERO_KEY; this.cipher = cipher || 0; }
javascript
{ "resource": "" }
q8266
EncackPacket
train
function EncackPacket(publicKey) { if (!(this instanceof EncackPacket)) return new EncackPacket(publicKey); Packet.call(this); this.publicKey = publicKey || encoding.ZERO_KEY; }
javascript
{ "resource": "" }
q8267
AuthChallengePacket
train
function AuthChallengePacket(hash) { if (!(this instanceof AuthChallengePacket)) return new AuthChallengePacket(hash); Packet.call(this); this.hash = hash || encoding.ZERO_HASH; }
javascript
{ "resource": "" }
q8268
AuthReplyPacket
train
function AuthReplyPacket(signature) { if (!(this instanceof AuthReplyPacket)) return new AuthReplyPacket(signature); Packet.call(this); this.signature = signature || encoding.ZERO_SIG64; }
javascript
{ "resource": "" }
q8269
AuthProposePacket
train
function AuthProposePacket(hash) { if (!(this instanceof AuthProposePacket)) return new AuthProposePacket(hash); Packet.call(this); this.hash = hash || encoding.ZERO_HASH; }
javascript
{ "resource": "" }
q8270
UnknownPacket
train
function UnknownPacket(cmd, data) { if (!(this instanceof UnknownPacket)) return new UnknownPacket(cmd, data); Packet.call(this); this.cmd = cmd; this.data = data; }
javascript
{ "resource": "" }
q8271
SigCache
train
function SigCache(size) { if (!(this instanceof SigCache)) return new SigCache(size); if (size == null) size = 10000; assert(util.isU32(size)); this.size = size; this.keys = []; this.valid = new Map(); }
javascript
{ "resource": "" }
q8272
SigCacheEntry
train
function SigCacheEntry(sig, key) { this.sig = Buffer.from(sig); this.key = Buffer.from(key); }
javascript
{ "resource": "" }
q8273
sanitize
train
function sanitize (fn) { return function (/* path, ...middleware */) { var middleware = [] var startindex = 0 var endindex = arguments.length var path var options if (typeof arguments[0] === 'string') { path = arguments[0] startindex = 1 } if (typeof arguments[arguments.l...
javascript
{ "resource": "" }
q8274
RBT
train
function RBT(compare, unique) { if (!(this instanceof RBT)) return new RBT(compare, unique); assert(typeof compare === 'function'); this.root = SENTINEL; this.compare = compare; this.unique = unique || false; }
javascript
{ "resource": "" }
q8275
RBTSentinel
train
function RBTSentinel() { this.key = null; this.value = null; this.color = BLACK; this.parent = null; this.left = null; this.right = null; }
javascript
{ "resource": "" }
q8276
train
function (playerCards, dealerCard, handValue, handCount, dealerCheckedBlackjack, options) { // If exactComposition isn't set, no override if (options.strategyComplexity != "exactComposition") { return null; } // Now look at strategies based on game options ...
javascript
{ "resource": "" }
q8277
globcmd
train
function globcmd(globstr) { var dir = arguments.length <= 1 || arguments[1] === undefined ? process.cwd() : arguments[1]; return new Promise(function (resolve, reject) { if (!globstr || !globstr.length) { return reject(new Error('No glob string given.')); } // Use glob to read the files in the d...
javascript
{ "resource": "" }
q8278
init
train
function init(options, callback) { if (!options.clientId) { throw new Error('client id not specified'); } core.setClientId(options.clientId); if (options.nw) { if (options.nw === true) { core.log('NW.js 0.13 is experimental.'); gui.setGUIType('nw13'); } else { gui.setGUIType(...
javascript
{ "resource": "" }
q8279
mine
train
function mine(data, target, min, max) { let nonce = min; data.writeUInt32LE(nonce, 76, true); // The heart and soul of the miner: match the target. while (nonce <= max) { // Hash and test against the next target. // if (rcmp(digest.hash256(data), target) <= 0) // cfc // if (rcmp(powHash(data), tar...
javascript
{ "resource": "" }
q8280
Payment
train
function Payment(options) { if (!(this instanceof Payment)) return new Payment(options); this.merchantData = null; this.transactions = []; this.refundTo = []; this.memo = null; if (options) this.fromOptions(options); }
javascript
{ "resource": "" }
q8281
isNodeIgnored
train
function isNodeIgnored(node) { const parent = node.parent; if (!parent) { // Root was reached. return false; } if (parent.some((child) => (child.type === 'comment' && PATTERN_IGNORE.test(child.text)))) { // Instruction to ignore the node was detected. return true; }...
javascript
{ "resource": "" }
q8282
train
function ( contour, indices ) { var n = contour.length; if ( n < 3 ) return null; var result = [], verts = [], vertIndices = []; /* we want a counter-clockwise polygon in verts */ var u, v, w; if ( area( contour ) > 0.0 ) { for ( v = 0; v < n; v ++ ) verts[ v ] = v; } else { for ( v =...
javascript
{ "resource": "" }
q8283
parseNode
train
function parseNode(line) { current = { is : 'NODE', type : 'NODE', id : line.substr(10, 10).trim().toLowerCase(), initialStorage : line.substr(20, 10).trim(), areaCapfactor : line.substr(30, 10).trim(), endingStorage : line.substr(40, 10).trim() }; }
javascript
{ "resource": "" }
q8284
URI
train
function URI(options) { if (!(this instanceof URI)) return new URI(options); this.address = new Address(); this.amount = -1; this.label = null; this.message = null; this.request = null; if (options) this.fromOptions(options); }
javascript
{ "resource": "" }
q8285
TX
train
function TX(options) { if (!(this instanceof TX)) return new TX(options); this.version = 1; this.inputs = []; this.outputs = []; this.locktime = 0; this.mutable = false; this._hash = null; this._hhash = null; this._whash = null; this._raw = null; this._size = -1; this._witness = -1; th...
javascript
{ "resource": "" }
q8286
MappedLock
train
function MappedLock() { if (!(this instanceof MappedLock)) return MappedLock.create(); this.jobs = new Map(); this.busy = new Set(); this.destroyed = false; }
javascript
{ "resource": "" }
q8287
decode
train
function decode (param) { try { return decodeURIComponent(param) } catch (_) { var err = new Error('Failed to decode param "' + param + '"') err.status = 400 throw err } }
javascript
{ "resource": "" }
q8288
ChainEntry
train
function ChainEntry(options) { if (!(this instanceof ChainEntry)) return new ChainEntry(options); this.hash = encoding.NULL_HASH; this.version = 1; this.prevBlock = encoding.NULL_HASH; this.merkleRoot = encoding.NULL_HASH; this.time = 0; this.bits = 0; this.nonce = 0; this.height = 0; this.chai...
javascript
{ "resource": "" }
q8289
PaymentRequest
train
function PaymentRequest(options) { if (!(this instanceof PaymentRequest)) return new PaymentRequest(options); this.version = -1; this.pkiType = null; this.pkiData = null; this.paymentDetails = new PaymentDetails(); this.signature = null; if (options) this.fromOptions(options); }
javascript
{ "resource": "" }
q8290
VerifyError
train
function VerifyError(msg, code, reason, score, malleated) { Error.call(this); assert(typeof code === 'string'); assert(typeof reason === 'string'); assert(score >= 0); this.type = 'VerifyError'; this.message = ''; this.code = code; this.reason = reason; this.score = score; this.hash = msg.hash('he...
javascript
{ "resource": "" }
q8291
Pagelet
train
function Pagelet(bigpipe) { if (!(this instanceof Pagelet)) return new Pagelet(bigpipe); var self = this; // // Create one single Fortress instance that orchestrates all iframe based client // code. This sandbox variable should never be exposed to the outside world in // order to prevent leaking. // t...
javascript
{ "resource": "" }
q8292
shout
train
function shout(name) { pagelet.bigpipe.emit.apply(pagelet.bigpipe, [ name.join(':'), pagelet ].concat(Array.prototype.slice.call(arguments, 1))); return pagelet; }
javascript
{ "resource": "" }
q8293
train
function(buffer) { var inputSize = buffer.length; // Holds an array that represents the count of various characters. var charCount = []; // Loop through the bytes and increase charCount. for (var a = 0; a < inputSize; a++) { var temp = buffer.readUInt8(a); ...
javascript
{ "resource": "" }
q8294
calculateChiSquareProbability
train
function calculateChiSquareProbability(x, df) { if (x <= 0.0 || df < 1) return 1.0; var a = 0.5 * x; if (df > 1) var y = calculateExponent(-a); var s = 2.0 * calculateNormalZProbability(-Math.sqrt(x)); if (df > 2) { x = 0.5 * (df - 1.0); var z = 0.5; ...
javascript
{ "resource": "" }
q8295
calculateNormalZProbability
train
function calculateNormalZProbability(z) { if (z == 0.0) { var x = 0.0; } else { var y = 0.5 * Math.abs(z); // Here comes the magic. if (y >= Z_MAX * 0.5) { x = 1.0; } else if (y < 1.0) { var w = y * y; x = ...
javascript
{ "resource": "" }
q8296
Child
train
function Child(file) { if (!(this instanceof Child)) return new Child(file); EventEmitter.call(this); bindExit(); children.add(this); this.init(file); }
javascript
{ "resource": "" }
q8297
bindExit
train
function bindExit() { if (exitBound) return; exitBound = true; listenExit(() => { for (const child of children) child.destroy(); }); }
javascript
{ "resource": "" }
q8298
listenExit
train
function listenExit(handler) { const onSighup = () => { process.exit(1 | 0x80); }; const onSigint = () => { process.exit(2 | 0x80); }; const onSigterm = () => { process.exit(15 | 0x80); }; const onError = (err) => { if (err && err.stack) console.error(String(err.stack)); else ...
javascript
{ "resource": "" }
q8299
parsePalette
train
function parsePalette (palette) { var vars = { camelCased : {}, paramCased : {} }; Object.keys(palette).forEach(function (key) { var hex = color(palette[key]).hexString(); vars.camelCased[cameled(key)] = hex; vars.paramCased[dashed(key)] = hex; }); return vars; }
javascript
{ "resource": "" }