id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
36,800
WorldMobileCoin/wmcc-core
src/wmcc/uri.js
URI
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
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); }
[ "function", "URI", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "URI", ")", ")", "return", "new", "URI", "(", "options", ")", ";", "this", ".", "address", "=", "new", "Address", "(", ")", ";", "this", ".", "amount", "=", "...
Represents a WMCC URI. @alias module:wmcc.URI @constructor @param {Object|String} options @property {Address} address @property {Amount} amount @property {String|null} label @property {String|null} message @property {String|null} request
[ "Represents", "a", "WMCC", "URI", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/wmcc/uri.js#L30-L42
36,801
WorldMobileCoin/wmcc-core
src/primitives/tx.js
TX
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
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...
[ "function", "TX", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "TX", ")", ")", "return", "new", "TX", "(", "options", ")", ";", "this", ".", "version", "=", "1", ";", "this", ".", "inputs", "=", "[", "]", ";", "this", "....
A static transaction object. @alias module:primitives.TX @constructor @param {Object} options - Transaction fields. @property {Number} version - Transaction version. Note that WMCC_Core reads versions as unsigned even though they are signed at the protocol level. This value will never be negative. @property {Number} fl...
[ "A", "static", "transaction", "object", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/primitives/tx.js#L49-L75
36,802
WorldMobileCoin/wmcc-core
src/utils/mappedlock.js
MappedLock
function MappedLock() { if (!(this instanceof MappedLock)) return MappedLock.create(); this.jobs = new Map(); this.busy = new Set(); this.destroyed = false; }
javascript
function MappedLock() { if (!(this instanceof MappedLock)) return MappedLock.create(); this.jobs = new Map(); this.busy = new Set(); this.destroyed = false; }
[ "function", "MappedLock", "(", ")", "{", "if", "(", "!", "(", "this", "instanceof", "MappedLock", ")", ")", "return", "MappedLock", ".", "create", "(", ")", ";", "this", ".", "jobs", "=", "new", "Map", "(", ")", ";", "this", ".", "busy", "=", "new"...
Represents a mutex lock for locking asynchronous object methods. Locks methods according to passed-in key. @alias module:utils.MappedLock @constructor
[ "Represents", "a", "mutex", "lock", "for", "locking", "asynchronous", "object", "methods", ".", "Locks", "methods", "according", "to", "passed", "-", "in", "key", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/mappedlock.js#L23-L30
36,803
blakeembrey/kroute
lib/layer.js
decode
function decode (param) { try { return decodeURIComponent(param) } catch (_) { var err = new Error('Failed to decode param "' + param + '"') err.status = 400 throw err } }
javascript
function decode (param) { try { return decodeURIComponent(param) } catch (_) { var err = new Error('Failed to decode param "' + param + '"') err.status = 400 throw err } }
[ "function", "decode", "(", "param", ")", "{", "try", "{", "return", "decodeURIComponent", "(", "param", ")", "}", "catch", "(", "_", ")", "{", "var", "err", "=", "new", "Error", "(", "'Failed to decode param \"'", "+", "param", "+", "'\"'", ")", "err", ...
URI decode a string. @param {String} param @return {String}
[ "URI", "decode", "a", "string", "." ]
b39f76fb6402e257a8b4d6b26b6511d16fa22871
https://github.com/blakeembrey/kroute/blob/b39f76fb6402e257a8b4d6b26b6511d16fa22871/lib/layer.js#L9-L17
36,804
WorldMobileCoin/wmcc-core
src/blockchain/chainentry.js
ChainEntry
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
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...
[ "function", "ChainEntry", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "ChainEntry", ")", ")", "return", "new", "ChainEntry", "(", "options", ")", ";", "this", ".", "hash", "=", "encoding", ".", "NULL_HASH", ";", "this", ".", "v...
Represents an entry in the chain. Unlike other bitcoin fullnodes, we store the chainwork _with_ the entry in order to avoid reading the entire chain index on boot and recalculating the chainworks. @alias module:blockchain.ChainEntry @constructor @param {Object?} options @property {Hash} hash @property {Number} version ...
[ "Represents", "an", "entry", "in", "the", "chain", ".", "Unlike", "other", "bitcoin", "fullnodes", "we", "store", "the", "chainwork", "_with_", "the", "entry", "in", "order", "to", "avoid", "reading", "the", "entire", "chain", "index", "on", "boot", "and", ...
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/blockchain/chainentry.js#L50-L66
36,805
WorldMobileCoin/wmcc-core
src/bip70/paymentrequest.js
PaymentRequest
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
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); }
[ "function", "PaymentRequest", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "PaymentRequest", ")", ")", "return", "new", "PaymentRequest", "(", "options", ")", ";", "this", ".", "version", "=", "-", "1", ";", "this", ".", "pkiType"...
Represents a BIP70 payment request. @alias module:bip70.PaymentRequest @constructor @param {Object?} options @property {Number} version @property {String|null} pkiType @property {Buffer|null} pkiData @property {PaymentDetails} paymentDetails @property {Buffer|null} signature
[ "Represents", "a", "BIP70", "payment", "request", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/bip70/paymentrequest.js#L34-L46
36,806
WorldMobileCoin/wmcc-core
src/protocol/errors.js
VerifyError
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
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...
[ "function", "VerifyError", "(", "msg", ",", "code", ",", "reason", ",", "score", ",", "malleated", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "assert", "(", "typeof", "code", "===", "'string'", ")", ";", "assert", "(", "typeof", "reason", ...
An error thrown during verification. Can be either a mempool transaction validation error or a blockchain block verification error. Ultimately used to send `reject` packets to peers. @constructor @extends Error @param {Block|TX} msg @param {String} code - Reject packet code. @param {String} reason - Reject packet reaso...
[ "An", "error", "thrown", "during", "verification", ".", "Can", "be", "either", "a", "mempool", "transaction", "validation", "error", "or", "a", "blockchain", "block", "verification", "error", ".", "Ultimately", "used", "to", "send", "reject", "packets", "to", ...
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/protocol/errors.js#L41-L61
36,807
bigpipe/bigpipe.js
pagelet.js
Pagelet
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
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...
[ "function", "Pagelet", "(", "bigpipe", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Pagelet", ")", ")", "return", "new", "Pagelet", "(", "bigpipe", ")", ";", "var", "self", "=", "this", ";", "//", "// Create one single Fortress instance that orchestra...
Representation of a single pagelet. @constructor @param {BigPipe} bigpipe The BigPipe instance that was created. @api public
[ "Representation", "of", "a", "single", "pagelet", "." ]
80fe2630d363ed2b69f85d28792a9095a4167e3b
https://github.com/bigpipe/bigpipe.js/blob/80fe2630d363ed2b69f85d28792a9095a4167e3b/pagelet.js#L27-L47
36,808
bigpipe/bigpipe.js
pagelet.js
shout
function shout(name) { pagelet.bigpipe.emit.apply(pagelet.bigpipe, [ name.join(':'), pagelet ].concat(Array.prototype.slice.call(arguments, 1))); return pagelet; }
javascript
function shout(name) { pagelet.bigpipe.emit.apply(pagelet.bigpipe, [ name.join(':'), pagelet ].concat(Array.prototype.slice.call(arguments, 1))); return pagelet; }
[ "function", "shout", "(", "name", ")", "{", "pagelet", ".", "bigpipe", ".", "emit", ".", "apply", "(", "pagelet", ".", "bigpipe", ",", "[", "name", ".", "join", "(", "':'", ")", ",", "pagelet", "]", ".", "concat", "(", "Array", ".", "prototype", "....
Broadcast the event with namespaced name. @param {String} name Event name. @returns {Pagelet} @api private
[ "Broadcast", "the", "event", "with", "namespaced", "name", "." ]
80fe2630d363ed2b69f85d28792a9095a4167e3b
https://github.com/bigpipe/bigpipe.js/blob/80fe2630d363ed2b69f85d28792a9095a4167e3b/pagelet.js#L203-L210
36,809
kaisellgren/ChiSquare
lib/chi-square.js
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
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); ...
[ "function", "(", "buffer", ")", "{", "var", "inputSize", "=", "buffer", ".", "length", ";", "// Holds an array that represents the count of various characters.\r", "var", "charCount", "=", "[", "]", ";", "// Loop through the bytes and increase charCount.\r", "for", "(", "...
Calculates a Chi-square distribution over a sequence of bytes within the Buffer. The result is a float representing the probability of how frequently a truly random sequence of bytes would exceed the calculated value. Ideally this float should have a value of 0.5. If so, the given Buffer contained random data. @param...
[ "Calculates", "a", "Chi", "-", "square", "distribution", "over", "a", "sequence", "of", "bytes", "within", "the", "Buffer", ".", "The", "result", "is", "a", "float", "representing", "the", "probability", "of", "how", "frequently", "a", "truly", "random", "se...
2e7aa905f0f44a2d4be85ceb8e9e3863dc51c4b7
https://github.com/kaisellgren/ChiSquare/blob/2e7aa905f0f44a2d4be85ceb8e9e3863dc51c4b7/lib/chi-square.js#L18-L49
36,810
kaisellgren/ChiSquare
lib/chi-square.js
calculateChiSquareProbability
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
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; ...
[ "function", "calculateChiSquareProbability", "(", "x", ",", "df", ")", "{", "if", "(", "x", "<=", "0.0", "||", "df", "<", "1", ")", "return", "1.0", ";", "var", "a", "=", "0.5", "*", "x", ";", "if", "(", "df", ">", "1", ")", "var", "y", "=", ...
Calculates the probability for the results of the Chi-square test. @param {Number} x Chi-square value. @param {Number} df Degrees of freedom. @return {Number}
[ "Calculates", "the", "probability", "for", "the", "results", "of", "the", "Chi", "-", "square", "test", "." ]
2e7aa905f0f44a2d4be85ceb8e9e3863dc51c4b7
https://github.com/kaisellgren/ChiSquare/blob/2e7aa905f0f44a2d4be85ceb8e9e3863dc51c4b7/lib/chi-square.js#L69-L111
36,811
kaisellgren/ChiSquare
lib/chi-square.js
calculateNormalZProbability
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
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 = ...
[ "function", "calculateNormalZProbability", "(", "z", ")", "{", "if", "(", "z", "==", "0.0", ")", "{", "var", "x", "=", "0.0", ";", "}", "else", "{", "var", "y", "=", "0.5", "*", "Math", ".", "abs", "(", "z", ")", ";", "// Here comes the magic.\r", ...
Calculates the probability for the normal z. @param {Number} z @return {Number}
[ "Calculates", "the", "probability", "for", "the", "normal", "z", "." ]
2e7aa905f0f44a2d4be85ceb8e9e3863dc51c4b7
https://github.com/kaisellgren/ChiSquare/blob/2e7aa905f0f44a2d4be85ceb8e9e3863dc51c4b7/lib/chi-square.js#L119-L166
36,812
WorldMobileCoin/wmcc-core
src/workers/child.js
Child
function Child(file) { if (!(this instanceof Child)) return new Child(file); EventEmitter.call(this); bindExit(); children.add(this); this.init(file); }
javascript
function Child(file) { if (!(this instanceof Child)) return new Child(file); EventEmitter.call(this); bindExit(); children.add(this); this.init(file); }
[ "function", "Child", "(", "file", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Child", ")", ")", "return", "new", "Child", "(", "file", ")", ";", "EventEmitter", ".", "call", "(", "this", ")", ";", "bindExit", "(", ")", ";", "children", "....
Represents a child process. @alias module:workers.Child @constructor @param {String} file
[ "Represents", "a", "child", "process", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/workers/child.js#L27-L37
36,813
WorldMobileCoin/wmcc-core
src/workers/child.js
bindExit
function bindExit() { if (exitBound) return; exitBound = true; listenExit(() => { for (const child of children) child.destroy(); }); }
javascript
function bindExit() { if (exitBound) return; exitBound = true; listenExit(() => { for (const child of children) child.destroy(); }); }
[ "function", "bindExit", "(", ")", "{", "if", "(", "exitBound", ")", "return", ";", "exitBound", "=", "true", ";", "listenExit", "(", "(", ")", "=>", "{", "for", "(", "const", "child", "of", "children", ")", "child", ".", "destroy", "(", ")", ";", "...
Cleanup all child processes. @private
[ "Cleanup", "all", "child", "processes", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/workers/child.js#L118-L128
36,814
WorldMobileCoin/wmcc-core
src/workers/child.js
listenExit
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
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 ...
[ "function", "listenExit", "(", "handler", ")", "{", "const", "onSighup", "=", "(", ")", "=>", "{", "process", ".", "exit", "(", "1", "|", "0x80", ")", ";", "}", ";", "const", "onSigint", "=", "(", ")", "=>", "{", "process", ".", "exit", "(", "2",...
Listen for exit. @param {Function} handler @private
[ "Listen", "for", "exit", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/workers/child.js#L136-L188
36,815
zaim/webcolors
gulpfile.js
parsePalette
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
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; }
[ "function", "parsePalette", "(", "palette", ")", "{", "var", "vars", "=", "{", "camelCased", ":", "{", "}", ",", "paramCased", ":", "{", "}", "}", ";", "Object", ".", "keys", "(", "palette", ")", ".", "forEach", "(", "function", "(", "key", ")", "{...
Fix palette values to full hex string
[ "Fix", "palette", "values", "to", "full", "hex", "string" ]
548d4466c653336f8c861ddedf67d432a804590e
https://github.com/zaim/webcolors/blob/548d4466c653336f8c861ddedf67d432a804590e/gulpfile.js#L17-L28
36,816
zaim/webcolors
gulpfile.js
fixMissing
function fixMissing (obj, defaults) { Object.keys(defaults).forEach(function (key) { obj[key] = obj[key] || defaults[key]; }); }
javascript
function fixMissing (obj, defaults) { Object.keys(defaults).forEach(function (key) { obj[key] = obj[key] || defaults[key]; }); }
[ "function", "fixMissing", "(", "obj", ",", "defaults", ")", "{", "Object", ".", "keys", "(", "defaults", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "obj", "[", "key", "]", "=", "obj", "[", "key", "]", "||", "defaults", "[", "key", ...
Fix missing values
[ "Fix", "missing", "values" ]
548d4466c653336f8c861ddedf67d432a804590e
https://github.com/zaim/webcolors/blob/548d4466c653336f8c861ddedf67d432a804590e/gulpfile.js#L31-L35
36,817
zaim/webcolors
gulpfile.js
repoIsClean
function repoIsClean (done) { proc.exec('git status -z', function (err, stdout) { if (!err) { var msg = stdout.toString().trim(); if (msg && msg.length) { err = new Error('Please commit all changes generated by building'); } } done(err); }); }
javascript
function repoIsClean (done) { proc.exec('git status -z', function (err, stdout) { if (!err) { var msg = stdout.toString().trim(); if (msg && msg.length) { err = new Error('Please commit all changes generated by building'); } } done(err); }); }
[ "function", "repoIsClean", "(", "done", ")", "{", "proc", ".", "exec", "(", "'git status -z'", ",", "function", "(", "err", ",", "stdout", ")", "{", "if", "(", "!", "err", ")", "{", "var", "msg", "=", "stdout", ".", "toString", "(", ")", ".", "trim...
Check if repo is clean
[ "Check", "if", "repo", "is", "clean" ]
548d4466c653336f8c861ddedf67d432a804590e
https://github.com/zaim/webcolors/blob/548d4466c653336f8c861ddedf67d432a804590e/gulpfile.js#L38-L48
36,818
WorldMobileCoin/wmcc-core
src/primitives/address.js
Address
function Address(options) { if (!(this instanceof Address)) return new Address(options); this.hash = encoding.ZERO_HASH160; this.type = Address.types.PUBKEYHASH; this.version = -1; this.network = Network.primary; if (options) this.fromOptions(options); }
javascript
function Address(options) { if (!(this instanceof Address)) return new Address(options); this.hash = encoding.ZERO_HASH160; this.type = Address.types.PUBKEYHASH; this.version = -1; this.network = Network.primary; if (options) this.fromOptions(options); }
[ "function", "Address", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Address", ")", ")", "return", "new", "Address", "(", "options", ")", ";", "this", ".", "hash", "=", "encoding", ".", "ZERO_HASH160", ";", "this", ".", "type", ...
Represents an address. @alias module:primitives.Address @constructor @param {Object?} options @property {Buffer} hash @property {AddressPrefix} type @property {Number} version @property {Network} network
[ "Represents", "an", "address", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/primitives/address.js#L35-L46
36,819
WorldMobileCoin/wmcc-core
src/primitives/abstractblock.js
AbstractBlock
function AbstractBlock() { if (!(this instanceof AbstractBlock)) return new AbstractBlock(); this.version = 1; this.prevBlock = encoding.NULL_HASH; this.merkleRoot = encoding.NULL_HASH; this.time = 0; this.bits = 0; this.nonce = 0; this.mutable = false; this._hash = null; this._hhash = null; ...
javascript
function AbstractBlock() { if (!(this instanceof AbstractBlock)) return new AbstractBlock(); this.version = 1; this.prevBlock = encoding.NULL_HASH; this.merkleRoot = encoding.NULL_HASH; this.time = 0; this.bits = 0; this.nonce = 0; this.mutable = false; this._hash = null; this._hhash = null; ...
[ "function", "AbstractBlock", "(", ")", "{", "if", "(", "!", "(", "this", "instanceof", "AbstractBlock", ")", ")", "return", "new", "AbstractBlock", "(", ")", ";", "this", ".", "version", "=", "1", ";", "this", ".", "prevBlock", "=", "encoding", ".", "N...
The class which all block-like objects inherit from. @alias module:primitives.AbstractBlock @constructor @abstract @property {Number} version - Block version. Note that WMCC reads versions as unsigned despite them being signed on the protocol level. This number will never be negative. @property {Hash} prevBlock - Previ...
[ "The", "class", "which", "all", "block", "-", "like", "objects", "inherit", "from", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/primitives/abstractblock.js#L41-L56
36,820
WorldMobileCoin/wmcc-core
src/node/spvnode.js
SPVNode
function SPVNode(options) { if (!(this instanceof SPVNode)) return new SPVNode(options); Node.call(this, options); // SPV flag. this.spv = true; this.chain = new Chain({ network: this.network, logger: this.logger, db: this.config.str('db'), prefix: this.config.prefix, maxFiles: this...
javascript
function SPVNode(options) { if (!(this instanceof SPVNode)) return new SPVNode(options); Node.call(this, options); // SPV flag. this.spv = true; this.chain = new Chain({ network: this.network, logger: this.logger, db: this.config.str('db'), prefix: this.config.prefix, maxFiles: this...
[ "function", "SPVNode", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "SPVNode", ")", ")", "return", "new", "SPVNode", "(", "options", ")", ";", "Node", ".", "call", "(", "this", ",", "options", ")", ";", "// SPV flag.", "this", ...
Create an spv node which only maintains a chain, a pool, and an http server. @alias module:node.SPVNode @extends Node @constructor @param {Object?} options @param {Buffer?} options.sslKey @param {Buffer?} options.sslCert @param {Number?} options.httpPort @param {String?} options.httpHost @property {Boolean} loaded @pro...
[ "Create", "an", "spv", "node", "which", "only", "maintains", "a", "chain", "a", "pool", "and", "an", "http", "server", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/node/spvnode.js#L41-L108
36,821
gw2efficiency/recipe-calculation
src/craftingSteps.js
craftingSteps
function craftingSteps (tree, steps = [], index = 0) { // Skip any tree parts where nothing needs to be crafted if (!tree.components || tree.craft === false) { return steps } // Go through the existing steps, and if we already have a step // with this id, just add up the quantities let stepIndex = step...
javascript
function craftingSteps (tree, steps = [], index = 0) { // Skip any tree parts where nothing needs to be crafted if (!tree.components || tree.craft === false) { return steps } // Go through the existing steps, and if we already have a step // with this id, just add up the quantities let stepIndex = step...
[ "function", "craftingSteps", "(", "tree", ",", "steps", "=", "[", "]", ",", "index", "=", "0", ")", "{", "// Skip any tree parts where nothing needs to be crafted", "if", "(", "!", "tree", ".", "components", "||", "tree", ".", "craft", "===", "false", ")", "...
Generate an ordered list of crafting steps
[ "Generate", "an", "ordered", "list", "of", "crafting", "steps" ]
841d16750cb23c61850f8452492bfbf90db6db7c
https://github.com/gw2efficiency/recipe-calculation/blob/841d16750cb23c61850f8452492bfbf90db6db7c/src/craftingSteps.js#L29-L64
36,822
okunishinishi/node-gitconfig
lib/fetch_repo.js
getAllRemotesUrls
function getAllRemotesUrls (getGitInfo) { const remotes = lget(getGitInfo, 'remote', {}); return Object.keys(remotes).map(key => lget(remotes[key],'url')); }
javascript
function getAllRemotesUrls (getGitInfo) { const remotes = lget(getGitInfo, 'remote', {}); return Object.keys(remotes).map(key => lget(remotes[key],'url')); }
[ "function", "getAllRemotesUrls", "(", "getGitInfo", ")", "{", "const", "remotes", "=", "lget", "(", "getGitInfo", ",", "'remote'", ",", "{", "}", ")", ";", "return", "Object", ".", "keys", "(", "remotes", ")", ".", "map", "(", "key", "=>", "lget", "(",...
Get all remote urls from current project @function getAllRemotesUrls @returns {Array<String>}
[ "Get", "all", "remote", "urls", "from", "current", "project" ]
bb1a82cb60a19f59920e043b4b3615f51d2604d4
https://github.com/okunishinishi/node-gitconfig/blob/bb1a82cb60a19f59920e043b4b3615f51d2604d4/lib/fetch_repo.js#L19-L22
36,823
okunishinishi/node-gitconfig
lib/fetch_repo.js
getUrl
function getUrl(remoteName){ const gitInfo = getGitInfo(); return remoteName ? getRepoRemoteUrl(gitInfo, remoteName) : getAllRemotesUrls(gitInfo); }
javascript
function getUrl(remoteName){ const gitInfo = getGitInfo(); return remoteName ? getRepoRemoteUrl(gitInfo, remoteName) : getAllRemotesUrls(gitInfo); }
[ "function", "getUrl", "(", "remoteName", ")", "{", "const", "gitInfo", "=", "getGitInfo", "(", ")", ";", "return", "remoteName", "?", "getRepoRemoteUrl", "(", "gitInfo", ",", "remoteName", ")", ":", "getAllRemotesUrls", "(", "gitInfo", ")", ";", "}" ]
Get all remote url or all remote urls from current project @param remoteName - string @function getAllRemotesUrls @returns {Array<string> | string}
[ "Get", "all", "remote", "url", "or", "all", "remote", "urls", "from", "current", "project" ]
bb1a82cb60a19f59920e043b4b3615f51d2604d4
https://github.com/okunishinishi/node-gitconfig/blob/bb1a82cb60a19f59920e043b4b3615f51d2604d4/lib/fetch_repo.js#L40-L43
36,824
dashby3000/loopback-connector-twilio
lib/twilio.js
TwilioConnector
function TwilioConnector(settings) { assert(typeof settings === 'object', 'cannot initialize TwilioConnector without a settings object'); var connector = this; var accountSid = this.accountSid = settings.accountSid; var authToken = this.authToken = settings.authToken; var sgAPIKey = this.sgAPIKey ...
javascript
function TwilioConnector(settings) { assert(typeof settings === 'object', 'cannot initialize TwilioConnector without a settings object'); var connector = this; var accountSid = this.accountSid = settings.accountSid; var authToken = this.authToken = settings.authToken; var sgAPIKey = this.sgAPIKey ...
[ "function", "TwilioConnector", "(", "settings", ")", "{", "assert", "(", "typeof", "settings", "===", "'object'", ",", "'cannot initialize TwilioConnector without a settings object'", ")", ";", "var", "connector", "=", "this", ";", "var", "accountSid", "=", "this", ...
Create an instance of the connector with the given `settings`.
[ "Create", "an", "instance", "of", "the", "connector", "with", "the", "given", "settings", "." ]
3c64f7414dadfbb389428f7dea1b7d4b197abb45
https://github.com/dashby3000/loopback-connector-twilio/blob/3c64f7414dadfbb389428f7dea1b7d4b197abb45/lib/twilio.js#L16-L28
36,825
WorldMobileCoin/wmcc-core
src/wallet/masterkey.js
MasterKey
function MasterKey(options) { if (!(this instanceof MasterKey)) return new MasterKey(options); this.encrypted = false; this.iv = null; this.ciphertext = null; this.key = null; this.mnemonic = null; this.alg = MasterKey.alg.PBKDF2; this.N = 50000; this.r = 0; this.p = 0; this.aesKey = null; ...
javascript
function MasterKey(options) { if (!(this instanceof MasterKey)) return new MasterKey(options); this.encrypted = false; this.iv = null; this.ciphertext = null; this.key = null; this.mnemonic = null; this.alg = MasterKey.alg.PBKDF2; this.N = 50000; this.r = 0; this.p = 0; this.aesKey = null; ...
[ "function", "MasterKey", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "MasterKey", ")", ")", "return", "new", "MasterKey", "(", "options", ")", ";", "this", ".", "encrypted", "=", "false", ";", "this", ".", "iv", "=", "null", ...
Master BIP32 key which can exist in a timed out encrypted state. @alias module:wallet.MasterKey @constructor @param {Object} options
[ "Master", "BIP32", "key", "which", "can", "exist", "in", "a", "timed", "out", "encrypted", "state", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/wallet/masterkey.js#L35-L58
36,826
WorldMobileCoin/wmcc-core
src/net/bip151.js
BIP151Stream
function BIP151Stream(cipher) { if (!(this instanceof BIP151Stream)) return new BIP151Stream(cipher); this.cipher = BIP151.ciphers.CHACHAPOLY; this.privateKey = secp256k1.generatePrivateKey(); this.publicKey = null; this.k1 = null; this.k2 = null; this.sid = null; if (cipher != null) { assert(...
javascript
function BIP151Stream(cipher) { if (!(this instanceof BIP151Stream)) return new BIP151Stream(cipher); this.cipher = BIP151.ciphers.CHACHAPOLY; this.privateKey = secp256k1.generatePrivateKey(); this.publicKey = null; this.k1 = null; this.k2 = null; this.sid = null; if (cipher != null) { assert(...
[ "function", "BIP151Stream", "(", "cipher", ")", "{", "if", "(", "!", "(", "this", "instanceof", "BIP151Stream", ")", ")", "return", "new", "BIP151Stream", "(", "cipher", ")", ";", "this", ".", "cipher", "=", "BIP151", ".", "ciphers", ".", "CHACHAPOLY", "...
Represents a BIP151 input or output stream. @alias module:net.BIP151Stream @constructor @param {Number} cipher @property {Buffer} publicKey @property {Buffer} privateKey @property {Number} cipher @property {Buffer} k1 @property {Buffer} k2 @property {Buffer} sid @property {ChaCha20} chacha @property {AEAD} aead @proper...
[ "Represents", "a", "BIP151", "input", "or", "output", "stream", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/net/bip151.js#L66-L91
36,827
WorldMobileCoin/wmcc-core
src/net/bip151.js
BIP151
function BIP151(cipher) { if (!(this instanceof BIP151)) return new BIP151(cipher); EventEmitter.call(this); this.input = new BIP151Stream(cipher); this.output = new BIP151Stream(cipher); this.initReceived = false; this.ackReceived = false; this.initSent = false; this.ackSent = false; this.comp...
javascript
function BIP151(cipher) { if (!(this instanceof BIP151)) return new BIP151(cipher); EventEmitter.call(this); this.input = new BIP151Stream(cipher); this.output = new BIP151Stream(cipher); this.initReceived = false; this.ackReceived = false; this.initSent = false; this.ackSent = false; this.comp...
[ "function", "BIP151", "(", "cipher", ")", "{", "if", "(", "!", "(", "this", "instanceof", "BIP151", ")", ")", "return", "new", "BIP151", "(", "cipher", ")", ";", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "input", "=", "new", ...
Represents a BIP151 input and output stream. Holds state for peer communication. @alias module:net.BIP151 @constructor @param {Number} cipher @property {BIP151Stream} input @property {BIP151Stream} output @property {Boolean} initReceived @property {Boolean} ackReceived @property {Boolean} initSent @property {Boolean} a...
[ "Represents", "a", "BIP151", "input", "and", "output", "stream", ".", "Holds", "state", "for", "peer", "communication", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/net/bip151.js#L304-L330
36,828
WorldMobileCoin/wmcc-core
src/net/socks.js
SOCKS
function SOCKS() { if (!(this instanceof SOCKS)) return new SOCKS(); EventEmitter.call(this); this.socket = new net.Socket(); this.state = SOCKS.states.INIT; this.target = SOCKS.states.INIT; this.destHost = '0.0.0.0'; this.destPort = 0; this.username = ''; this.password = ''; this.name = 'loca...
javascript
function SOCKS() { if (!(this instanceof SOCKS)) return new SOCKS(); EventEmitter.call(this); this.socket = new net.Socket(); this.state = SOCKS.states.INIT; this.target = SOCKS.states.INIT; this.destHost = '0.0.0.0'; this.destPort = 0; this.username = ''; this.password = ''; this.name = 'loca...
[ "function", "SOCKS", "(", ")", "{", "if", "(", "!", "(", "this", "instanceof", "SOCKS", ")", ")", "return", "new", "SOCKS", "(", ")", ";", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "socket", "=", "new", "net", ".", "Socket", ...
SOCKS state machine @constructor
[ "SOCKS", "state", "machine" ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/net/socks.js#L30-L47
36,829
WorldMobileCoin/wmcc-core
src/mempool/fees.js
ConfirmStats
function ConfirmStats(type, logger) { if (!(this instanceof ConfirmStats)) return new ConfirmStats(type, logger); this.logger = Logger.global; this.type = type; this.decay = 0; this.maxConfirms = 0; this.buckets = new Float64Array(0); this.bucketMap = new DoubleMap(); this.confAvg = []; this.c...
javascript
function ConfirmStats(type, logger) { if (!(this instanceof ConfirmStats)) return new ConfirmStats(type, logger); this.logger = Logger.global; this.type = type; this.decay = 0; this.maxConfirms = 0; this.buckets = new Float64Array(0); this.bucketMap = new DoubleMap(); this.confAvg = []; this.c...
[ "function", "ConfirmStats", "(", "type", ",", "logger", ")", "{", "if", "(", "!", "(", "this", "instanceof", "ConfirmStats", ")", ")", "return", "new", "ConfirmStats", "(", "type", ",", "logger", ")", ";", "this", ".", "logger", "=", "Logger", ".", "gl...
Confirmation stats. @alias module:mempool.ConfirmStats @constructor @param {String} type @param {Logger?} logger
[ "Confirmation", "stats", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/mempool/fees.js#L52-L79
36,830
WorldMobileCoin/wmcc-core
src/mempool/fees.js
PolicyEstimator
function PolicyEstimator(logger) { if (!(this instanceof PolicyEstimator)) return new PolicyEstimator(logger); this.logger = Logger.global; this.minTrackedFee = MIN_FEERATE; this.minTrackedPri = MIN_PRIORITY; this.feeStats = new ConfirmStats('FeeRate'); this.priStats = new ConfirmStats('Priority'); ...
javascript
function PolicyEstimator(logger) { if (!(this instanceof PolicyEstimator)) return new PolicyEstimator(logger); this.logger = Logger.global; this.minTrackedFee = MIN_FEERATE; this.minTrackedPri = MIN_PRIORITY; this.feeStats = new ConfirmStats('FeeRate'); this.priStats = new ConfirmStats('Priority'); ...
[ "function", "PolicyEstimator", "(", "logger", ")", "{", "if", "(", "!", "(", "this", "instanceof", "PolicyEstimator", ")", ")", "return", "new", "PolicyEstimator", "(", "logger", ")", ";", "this", ".", "logger", "=", "Logger", ".", "global", ";", "this", ...
Estimator for fees and priority. @alias module:mempool.PolicyEstimator @constructor @param {Logger?} logger
[ "Estimator", "for", "fees", "and", "priority", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/mempool/fees.js#L405-L437
36,831
Spiffyk/twitch-node-sdk
lib/twitch.gui.js
popupNWLogin
function popupNWLogin(params) { var url = core.REDIRECT_URL + 'oauth2/authorize?' + util.param(params); var win = nwGUI.Window.open(url, { title: 'Login with TwitchTV', width: WIDTH, height: HEIGHT, toolbar: false, show: false, resizable: true }); win.on('loaded', function() { var w...
javascript
function popupNWLogin(params) { var url = core.REDIRECT_URL + 'oauth2/authorize?' + util.param(params); var win = nwGUI.Window.open(url, { title: 'Login with TwitchTV', width: WIDTH, height: HEIGHT, toolbar: false, show: false, resizable: true }); win.on('loaded', function() { var w...
[ "function", "popupNWLogin", "(", "params", ")", "{", "var", "url", "=", "core", ".", "REDIRECT_URL", "+", "'oauth2/authorize?'", "+", "util", ".", "param", "(", "params", ")", ";", "var", "win", "=", "nwGUI", ".", "Window", ".", "open", "(", "url", ","...
Opens a login popup using NW.js's API version 0.12 or lower @private @method popupNWLogin @param {Array|Object} params
[ "Opens", "a", "login", "popup", "using", "NW", ".", "js", "s", "API", "version", "0", ".", "12", "or", "lower" ]
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.gui.js#L26-L56
36,832
Spiffyk/twitch-node-sdk
lib/twitch.gui.js
popupNW13Login
function popupNW13Login(params) { var url = core.REDIRECT_URL + 'oauth2/authorize?' + util.param(params); nw.Window.open(url, { title: 'Login with TwitchTV', width: WIDTH, height: HEIGHT, id: 'login', resizable: true }, function(login) { login.on('loaded', function() { var w = this.win...
javascript
function popupNW13Login(params) { var url = core.REDIRECT_URL + 'oauth2/authorize?' + util.param(params); nw.Window.open(url, { title: 'Login with TwitchTV', width: WIDTH, height: HEIGHT, id: 'login', resizable: true }, function(login) { login.on('loaded', function() { var w = this.win...
[ "function", "popupNW13Login", "(", "params", ")", "{", "var", "url", "=", "core", ".", "REDIRECT_URL", "+", "'oauth2/authorize?'", "+", "util", ".", "param", "(", "params", ")", ";", "nw", ".", "Window", ".", "open", "(", "url", ",", "{", "title", ":",...
Opens a login popup using NW.js's API version 0.13 or higher **THIS IS EXPERIMENTAL AT THE MOMENT!** @private @method popupNW13Login @param {Array|Object} params
[ "Opens", "a", "login", "popup", "using", "NW", ".", "js", "s", "API", "version", "0", ".", "13", "or", "higher" ]
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.gui.js#L67-L96
36,833
Spiffyk/twitch-node-sdk
lib/twitch.gui.js
popupElectronLogin
function popupElectronLogin(params) { if ( require('electron').remote ) BrowserWindow = require('electron').remote.BrowserWindow; else BrowserWindow = require('electron').BrowserWindow; var url = core.REDIRECT_URL + 'oauth2/authorize?' + util.param(params); var win = new BrowserWindow({ width: WIDTH, heig...
javascript
function popupElectronLogin(params) { if ( require('electron').remote ) BrowserWindow = require('electron').remote.BrowserWindow; else BrowserWindow = require('electron').BrowserWindow; var url = core.REDIRECT_URL + 'oauth2/authorize?' + util.param(params); var win = new BrowserWindow({ width: WIDTH, heig...
[ "function", "popupElectronLogin", "(", "params", ")", "{", "if", "(", "require", "(", "'electron'", ")", ".", "remote", ")", "BrowserWindow", "=", "require", "(", "'electron'", ")", ".", "remote", ".", "BrowserWindow", ";", "else", "BrowserWindow", "=", "req...
Opens a login popup using Electron's API @private @method popupElectronLogin @param {Array|Object} params
[ "Opens", "a", "login", "popup", "using", "Electron", "s", "API" ]
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.gui.js#L105-L142
36,834
Spiffyk/twitch-node-sdk
lib/twitch.gui.js
setGUIType
function setGUIType(name, nwg) { gui_type = name; if ( gui_type == 'nw' ) { if ( nwg ) nwGUI = nwg; else throw new Error('Did not get nw.gui object with GUI type "nw"'); } }
javascript
function setGUIType(name, nwg) { gui_type = name; if ( gui_type == 'nw' ) { if ( nwg ) nwGUI = nwg; else throw new Error('Did not get nw.gui object with GUI type "nw"'); } }
[ "function", "setGUIType", "(", "name", ",", "nwg", ")", "{", "gui_type", "=", "name", ";", "if", "(", "gui_type", "==", "'nw'", ")", "{", "if", "(", "nwg", ")", "nwGUI", "=", "nwg", ";", "else", "throw", "new", "Error", "(", "'Did not get nw.gui object...
Sets the GUI type @private @method setGUIType @param {String} name The GUI ID (`nw`, `nw13`, `electron`) @param {Object} [nwg] The NW.js `nw.gui` object for NW.js v0.12 and lower
[ "Sets", "the", "GUI", "type" ]
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.gui.js#L152-L161
36,835
Spiffyk/twitch-node-sdk
lib/twitch.gui.js
popupLogin
function popupLogin(params) { switch(gui_type) { case 'nw': popupNWLogin(params); break; case 'nw13': popupNW13Login(params); break; case 'electron': popupElectronLogin(params); break; default: throw new Error('The Twitch SDK was not initialized with any ' + 'compatible ...
javascript
function popupLogin(params) { switch(gui_type) { case 'nw': popupNWLogin(params); break; case 'nw13': popupNW13Login(params); break; case 'electron': popupElectronLogin(params); break; default: throw new Error('The Twitch SDK was not initialized with any ' + 'compatible ...
[ "function", "popupLogin", "(", "params", ")", "{", "switch", "(", "gui_type", ")", "{", "case", "'nw'", ":", "popupNWLogin", "(", "params", ")", ";", "break", ";", "case", "'nw13'", ":", "popupNW13Login", "(", "params", ")", ";", "break", ";", "case", ...
Opens a login popup @private @method popupLogin @param {Array|Object} params
[ "Opens", "a", "login", "popup" ]
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.gui.js#L181-L197
36,836
WorldMobileCoin/wmcc-core
src/utils/co.js
exec
function exec(gen) { return new Promise((resolve, reject) => { const step = (value, rejection) => { let next; try { if (rejection) next = gen.throw(value); else next = gen.next(value); } catch (e) { reject(e); return; } if (next.d...
javascript
function exec(gen) { return new Promise((resolve, reject) => { const step = (value, rejection) => { let next; try { if (rejection) next = gen.throw(value); else next = gen.next(value); } catch (e) { reject(e); return; } if (next.d...
[ "function", "exec", "(", "gen", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "const", "step", "=", "(", "value", ",", "rejection", ")", "=>", "{", "let", "next", ";", "try", "{", "if", "(", "rejection", ...
Execute an instantiated generator. @param {Generator} gen @returns {Promise}
[ "Execute", "an", "instantiated", "generator", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/co.js#L26-L65
36,837
WorldMobileCoin/wmcc-core
src/utils/co.js
promisify
function promisify(func) { return function(...args) { return new Promise((resolve, reject) => { args.push(wrap(resolve, reject)); func.call(this, ...args); }); }; }
javascript
function promisify(func) { return function(...args) { return new Promise((resolve, reject) => { args.push(wrap(resolve, reject)); func.call(this, ...args); }); }; }
[ "function", "promisify", "(", "func", ")", "{", "return", "function", "(", "...", "args", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "args", ".", "push", "(", "wrap", "(", "resolve", ",", "reject", ")", ...
Wrap a function that accepts node.js style callbacks into a function that returns a promise. @param {Function} func @returns {AsyncFunction}
[ "Wrap", "a", "function", "that", "accepts", "node", ".", "js", "style", "callbacks", "into", "a", "function", "that", "returns", "a", "promise", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/co.js#L150-L157
36,838
WorldMobileCoin/wmcc-core
src/utils/co.js
callbackify
function callbackify(func) { return function(...args) { if (args.length === 0 || typeof args[args.length - 1] !== 'function') { throw new Error(`${func.name || 'Function'} requires a callback.`); } const callback = args.pop(); func.call(this, ...args).then((value) => { setImmedia...
javascript
function callbackify(func) { return function(...args) { if (args.length === 0 || typeof args[args.length - 1] !== 'function') { throw new Error(`${func.name || 'Function'} requires a callback.`); } const callback = args.pop(); func.call(this, ...args).then((value) => { setImmedia...
[ "function", "callbackify", "(", "func", ")", "{", "return", "function", "(", "...", "args", ")", "{", "if", "(", "args", ".", "length", "===", "0", "||", "typeof", "args", "[", "args", ".", "length", "-", "1", "]", "!==", "'function'", ")", "{", "t...
Wrap a promise-returning function into a function that accepts a node.js style callback. @param {AsyncFunction} func @returns {Function}
[ "Wrap", "a", "promise", "-", "returning", "function", "into", "a", "function", "that", "accepts", "a", "node", ".", "js", "style", "callback", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/co.js#L167-L182
36,839
WorldMobileCoin/wmcc-core
src/utils/co.js
every
async function every(jobs) { const result = await Promise.all(jobs); for (const item of result) { if (!item) return false; } return true; }
javascript
async function every(jobs) { const result = await Promise.all(jobs); for (const item of result) { if (!item) return false; } return true; }
[ "async", "function", "every", "(", "jobs", ")", "{", "const", "result", "=", "await", "Promise", ".", "all", "(", "jobs", ")", ";", "for", "(", "const", "item", "of", "result", ")", "{", "if", "(", "!", "item", ")", "return", "false", ";", "}", "...
Execute each promise and have them pass a truth test. @method @param {Promise[]} jobs @returns {Promise}
[ "Execute", "each", "promise", "and", "have", "them", "pass", "a", "truth", "test", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/co.js#L192-L201
36,840
WorldMobileCoin/wmcc-core
src/utils/co.js
startInterval
function startInterval(func, time, self) { const ctx = { timer: null, stopped: false }; const cb = async () => { assert(ctx.timer != null); ctx.timer = null; try { await func.call(self); } finally { if (!ctx.stopped) ctx.timer = setTimeout(cb, time); } }; ctx...
javascript
function startInterval(func, time, self) { const ctx = { timer: null, stopped: false }; const cb = async () => { assert(ctx.timer != null); ctx.timer = null; try { await func.call(self); } finally { if (!ctx.stopped) ctx.timer = setTimeout(cb, time); } }; ctx...
[ "function", "startInterval", "(", "func", ",", "time", ",", "self", ")", "{", "const", "ctx", "=", "{", "timer", ":", "null", ",", "stopped", ":", "false", "}", ";", "const", "cb", "=", "async", "(", ")", "=>", "{", "assert", "(", "ctx", ".", "ti...
Start an interval. Wait for promise to resolve on each iteration. @param {Function} func @param {Number?} time @param {Object?} self @returns {Object}
[ "Start", "an", "interval", ".", "Wait", "for", "promise", "to", "resolve", "on", "each", "iteration", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/co.js#L212-L233
36,841
WorldMobileCoin/wmcc-core
src/utils/co.js
stopInterval
function stopInterval(ctx) { assert(ctx); if (ctx.timer != null) { clearTimeout(ctx.timer); ctx.timer = null; } ctx.stopped = true; }
javascript
function stopInterval(ctx) { assert(ctx); if (ctx.timer != null) { clearTimeout(ctx.timer); ctx.timer = null; } ctx.stopped = true; }
[ "function", "stopInterval", "(", "ctx", ")", "{", "assert", "(", "ctx", ")", ";", "if", "(", "ctx", ".", "timer", "!=", "null", ")", "{", "clearTimeout", "(", "ctx", ".", "timer", ")", ";", "ctx", ".", "timer", "=", "null", ";", "}", "ctx", ".", ...
Clear an interval. @param {Object} ctx
[ "Clear", "an", "interval", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/co.js#L240-L247
36,842
WorldMobileCoin/wmcc-core
src/utils/co.js
startTimeout
function startTimeout(func, time, self) { return { timer: setTimeout(func.bind(self), time), stopped: false }; }
javascript
function startTimeout(func, time, self) { return { timer: setTimeout(func.bind(self), time), stopped: false }; }
[ "function", "startTimeout", "(", "func", ",", "time", ",", "self", ")", "{", "return", "{", "timer", ":", "setTimeout", "(", "func", ".", "bind", "(", "self", ")", ",", "time", ")", ",", "stopped", ":", "false", "}", ";", "}" ]
Start a timeout. @param {Function} func @param {Number?} time @param {Object?} self @returns {Object}
[ "Start", "a", "timeout", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/co.js#L257-L262
36,843
WorldMobileCoin/wmcc-core
src/utils/co.js
stopTimeout
function stopTimeout(ctx) { assert(ctx); if (ctx.timer != null) { clearTimeout(ctx.timer); ctx.timer = null; } ctx.stopped = true; }
javascript
function stopTimeout(ctx) { assert(ctx); if (ctx.timer != null) { clearTimeout(ctx.timer); ctx.timer = null; } ctx.stopped = true; }
[ "function", "stopTimeout", "(", "ctx", ")", "{", "assert", "(", "ctx", ")", ";", "if", "(", "ctx", ".", "timer", "!=", "null", ")", "{", "clearTimeout", "(", "ctx", ".", "timer", ")", ";", "ctx", ".", "timer", "=", "null", ";", "}", "ctx", ".", ...
Clear a timeout. @param {Object} ctx
[ "Clear", "a", "timeout", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/co.js#L269-L276
36,844
bigpipe/bigpipe.js
bigpipe.js
BigPipe
function BigPipe(options) { if (!(this instanceof BigPipe)) return new BigPipe(options); options = options || {}; this.expected = +options.pagelets || 0; // Pagelets that this page requires. this.allowed = +options.pagelets || 0; // Pagelets that are allowed for this page. this.maximum = options.limit || 2...
javascript
function BigPipe(options) { if (!(this instanceof BigPipe)) return new BigPipe(options); options = options || {}; this.expected = +options.pagelets || 0; // Pagelets that this page requires. this.allowed = +options.pagelets || 0; // Pagelets that are allowed for this page. this.maximum = options.limit || 2...
[ "function", "BigPipe", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "BigPipe", ")", ")", "return", "new", "BigPipe", "(", "options", ")", ";", "options", "=", "options", "||", "{", "}", ";", "this", ".", "expected", "=", "+", ...
BigPipe is the client-side library which is automatically added to pages which uses the BigPipe framework. Options: - limit: The amount pagelet instances we can reuse. - pagelets: The amount of pagelets we're expecting to load. - id: The id of the page that we're loading. @constructor @param {Object} options BigPipe...
[ "BigPipe", "is", "the", "client", "-", "side", "library", "which", "is", "automatically", "added", "to", "pages", "which", "uses", "the", "BigPipe", "framework", "." ]
80fe2630d363ed2b69f85d28792a9095a4167e3b
https://github.com/bigpipe/bigpipe.js/blob/80fe2630d363ed2b69f85d28792a9095a4167e3b/bigpipe.js#L22-L43
36,845
Autarc/react-htmltree
lib/utilities.js
setDeep
function setDeep(map, listKey, keyPath, value) { if (!Array.isArray(listKey)) { listKey = [listKey]; } var change = typeof value === 'function' ? 'updateIn' : 'setIn'; var subPaths = getPaths(map, listKey, keyPath); return map.withMutations(function (map) { subPaths.forEach(function (keyPath) { ...
javascript
function setDeep(map, listKey, keyPath, value) { if (!Array.isArray(listKey)) { listKey = [listKey]; } var change = typeof value === 'function' ? 'updateIn' : 'setIn'; var subPaths = getPaths(map, listKey, keyPath); return map.withMutations(function (map) { subPaths.forEach(function (keyPath) { ...
[ "function", "setDeep", "(", "map", ",", "listKey", ",", "keyPath", ",", "value", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "listKey", ")", ")", "{", "listKey", "=", "[", "listKey", "]", ";", "}", "var", "change", "=", "typeof", "value...
Changes the the values in the nested collection @param {Immutable.Map} map - [description] @param {Array} listKey - [description] @param {Array} keyPath - [description] @param {*|Function} value - [description]
[ "Changes", "the", "the", "values", "in", "the", "nested", "collection" ]
90af47a18d77bf3a33c2ae7b7ac0d387435923d9
https://github.com/Autarc/react-htmltree/blob/90af47a18d77bf3a33c2ae7b7ac0d387435923d9/lib/utilities.js#L67-L92
36,846
WorldMobileCoin/wmcc-core
src/node/node.js
Node
function Node(options) { if (!(this instanceof Node)) return new Node(options); AsyncObject.call(this); this.config = new Config('wmcc'); this.config.inject(options); this.config.load(options); if (options.config) this.config.open('wmcc.conf'); this.network = Network.get(this.config.network); ...
javascript
function Node(options) { if (!(this instanceof Node)) return new Node(options); AsyncObject.call(this); this.config = new Config('wmcc'); this.config.inject(options); this.config.load(options); if (options.config) this.config.open('wmcc.conf'); this.network = Network.get(this.config.network); ...
[ "function", "Node", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Node", ")", ")", "return", "new", "Node", "(", "options", ")", ";", "AsyncObject", ".", "call", "(", "this", ")", ";", "this", ".", "config", "=", "new", "Con...
Base class from which every other Node-like object inherits. @alias module:node.Node @constructor @abstract @param {Object} options
[ "Base", "class", "from", "which", "every", "other", "Node", "-", "like", "object", "inherits", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/node/node.js#L33-L64
36,847
decs/texas
texas.js
function (format) { return function (card) { card = getCode(card); if (!card) return undefined; card--; return format({rank: card >> 2, suit: card & 3}); }; }
javascript
function (format) { return function (card) { card = getCode(card); if (!card) return undefined; card--; return format({rank: card >> 2, suit: card & 3}); }; }
[ "function", "(", "format", ")", "{", "return", "function", "(", "card", ")", "{", "card", "=", "getCode", "(", "card", ")", ";", "if", "(", "!", "card", ")", "return", "undefined", ";", "card", "--", ";", "return", "format", "(", "{", "rank", ":", ...
Helper function to create card formatters.
[ "Helper", "function", "to", "create", "card", "formatters", "." ]
b3fc63ea2a6e3efc2da45add6052629bdd02dff6
https://github.com/decs/texas/blob/b3fc63ea2a6e3efc2da45add6052629bdd02dff6/texas.js#L55-L63
36,848
decs/texas
texas.js
function (format) { var res = _.range(1, deckSize + 1); var buffer = crypto.randomBytes(deckSize << 2); for (var pos = res.length - 1; pos > 0; pos--) { var rand = buffer.readUInt32LE(pos << 2) % (pos + 1); var temp = res[pos]; res[pos] = res[rand]; res[rand] = temp; }; return format ? _.map(res, ...
javascript
function (format) { var res = _.range(1, deckSize + 1); var buffer = crypto.randomBytes(deckSize << 2); for (var pos = res.length - 1; pos > 0; pos--) { var rand = buffer.readUInt32LE(pos << 2) % (pos + 1); var temp = res[pos]; res[pos] = res[rand]; res[rand] = temp; }; return format ? _.map(res, ...
[ "function", "(", "format", ")", "{", "var", "res", "=", "_", ".", "range", "(", "1", ",", "deckSize", "+", "1", ")", ";", "var", "buffer", "=", "crypto", ".", "randomBytes", "(", "deckSize", "<<", "2", ")", ";", "for", "(", "var", "pos", "=", "...
Creates a new shuffled deck.
[ "Creates", "a", "new", "shuffled", "deck", "." ]
b3fc63ea2a6e3efc2da45add6052629bdd02dff6
https://github.com/decs/texas/blob/b3fc63ea2a6e3efc2da45add6052629bdd02dff6/texas.js#L68-L78
36,849
decs/texas
texas.js
function (cards) { var res = deckSize + 1; for (var c = 0; c < cards.length; c++) res = evaluator[res + getCode(cards[c])]; if (cards.length < 7) res = evaluator[res]; return {name: hands[res >> 12], value: res}; }
javascript
function (cards) { var res = deckSize + 1; for (var c = 0; c < cards.length; c++) res = evaluator[res + getCode(cards[c])]; if (cards.length < 7) res = evaluator[res]; return {name: hands[res >> 12], value: res}; }
[ "function", "(", "cards", ")", "{", "var", "res", "=", "deckSize", "+", "1", ";", "for", "(", "var", "c", "=", "0", ";", "c", "<", "cards", ".", "length", ";", "c", "++", ")", "res", "=", "evaluator", "[", "res", "+", "getCode", "(", "cards", ...
Evaluates the 5 to 7 card hands.
[ "Evaluates", "the", "5", "to", "7", "card", "hands", "." ]
b3fc63ea2a6e3efc2da45add6052629bdd02dff6
https://github.com/decs/texas/blob/b3fc63ea2a6e3efc2da45add6052629bdd02dff6/texas.js#L81-L88
36,850
decs/texas
texas.js
function () { var freq = new Int32Array(hands.length); var start = Date.now(); for (var c1 = 1; c1 <= deckSize; c1++) { var r1 = evaluator[deckSize + c1 + 1]; for (var c2 = c1 + 1; c2 <= deckSize; c2++) { var r2 = evaluator[r1 + c2]; for (var c3 = c2 + 1; c3 <= deckSize; c3++) { var r3 = evalua...
javascript
function () { var freq = new Int32Array(hands.length); var start = Date.now(); for (var c1 = 1; c1 <= deckSize; c1++) { var r1 = evaluator[deckSize + c1 + 1]; for (var c2 = c1 + 1; c2 <= deckSize; c2++) { var r2 = evaluator[r1 + c2]; for (var c3 = c2 + 1; c3 <= deckSize; c3++) { var r3 = evalua...
[ "function", "(", ")", "{", "var", "freq", "=", "new", "Int32Array", "(", "hands", ".", "length", ")", ";", "var", "start", "=", "Date", ".", "now", "(", ")", ";", "for", "(", "var", "c1", "=", "1", ";", "c1", "<=", "deckSize", ";", "c1", "++", ...
Benchmarks the evaluator within all possible 7 card hands.
[ "Benchmarks", "the", "evaluator", "within", "all", "possible", "7", "card", "hands", "." ]
b3fc63ea2a6e3efc2da45add6052629bdd02dff6
https://github.com/decs/texas/blob/b3fc63ea2a6e3efc2da45add6052629bdd02dff6/texas.js#L181-L208
36,851
gw2efficiency/recipe-calculation
src/treeAdjustQuantity.js
treeAdjustQuantity
function treeAdjustQuantity (amount, tree, availableItems, ignoreAvailable = false, nesting = 0) { tree = {...tree} tree.output = tree.output || 1 // Calculate the total quantity needed let treeQuantity = amount * tree.quantity // Round amount to nearest multiple of the tree output treeQuantity = Math.cei...
javascript
function treeAdjustQuantity (amount, tree, availableItems, ignoreAvailable = false, nesting = 0) { tree = {...tree} tree.output = tree.output || 1 // Calculate the total quantity needed let treeQuantity = amount * tree.quantity // Round amount to nearest multiple of the tree output treeQuantity = Math.cei...
[ "function", "treeAdjustQuantity", "(", "amount", ",", "tree", ",", "availableItems", ",", "ignoreAvailable", "=", "false", ",", "nesting", "=", "0", ")", "{", "tree", "=", "{", "...", "tree", "}", "tree", ".", "output", "=", "tree", ".", "output", "||", ...
Go through a recipe tree and set 'totalQuantity' based on the wanted amount and the output of recipes and sub-recipes
[ "Go", "through", "a", "recipe", "tree", "and", "set", "totalQuantity", "based", "on", "the", "wanted", "amount", "and", "the", "output", "of", "recipes", "and", "sub", "-", "recipes" ]
841d16750cb23c61850f8452492bfbf90db6db7c
https://github.com/gw2efficiency/recipe-calculation/blob/841d16750cb23c61850f8452492bfbf90db6db7c/src/treeAdjustQuantity.js#L11-L50
36,852
WorldMobileCoin/wmcc-core
src/http/request.js
request
function request(options) { if (typeof options === 'string') options = { uri: options }; options.buffer = true; return new Promise((resolve, reject) => { const req = new Request(options); req.on('error', err => reject(err)); req.on('end', () => resolve(req)); req.start(); req.end(); ...
javascript
function request(options) { if (typeof options === 'string') options = { uri: options }; options.buffer = true; return new Promise((resolve, reject) => { const req = new Request(options); req.on('error', err => reject(err)); req.on('end', () => resolve(req)); req.start(); req.end(); ...
[ "function", "request", "(", "options", ")", "{", "if", "(", "typeof", "options", "===", "'string'", ")", "options", "=", "{", "uri", ":", "options", "}", ";", "options", ".", "buffer", "=", "true", ";", "return", "new", "Promise", "(", "(", "resolve", ...
Make an HTTP request. @alias module:http.request @param {Object} options @param {String} options.uri @param {Object?} options.query @param {Object?} options.body @param {Object?} options.json @param {Object?} options.form @param {String?} options.type - One of `"json"`, `"form"`, `"text"`, or `"bin"`. @param {String?} ...
[ "Make", "an", "HTTP", "request", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/http/request.js#L564-L579
36,853
ucd-cws/calvin-network-tools
nodejs/lib/utils.js
fileExistsSync
function fileExistsSync(path) { try { fs.accessSync(path, fs.F_OK); } catch (e) { return false; } return true; }
javascript
function fileExistsSync(path) { try { fs.accessSync(path, fs.F_OK); } catch (e) { return false; } return true; }
[ "function", "fileExistsSync", "(", "path", ")", "{", "try", "{", "fs", ".", "accessSync", "(", "path", ",", "fs", ".", "F_OK", ")", ";", "}", "catch", "(", "e", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
stupid node.
[ "stupid", "node", "." ]
9c276972394878dfb6927b56303fca4c4a2bf8f5
https://github.com/ucd-cws/calvin-network-tools/blob/9c276972394878dfb6927b56303fca4c4a2bf8f5/nodejs/lib/utils.js#L38-L45
36,854
solderjs/node-pakman
lib/get-module-tree.js
traverseLeaf
function traverseLeaf(next, requireString, requireIndex) { var reqPath , reqDeps ; if ('.' === requireString[0]) { reqPath = url.resolve('/' + leaf.modulepath, requireString).substr(1); // strip leading '/' } else { // TODO handle absolute paths ...
javascript
function traverseLeaf(next, requireString, requireIndex) { var reqPath , reqDeps ; if ('.' === requireString[0]) { reqPath = url.resolve('/' + leaf.modulepath, requireString).substr(1); // strip leading '/' } else { // TODO handle absolute paths ...
[ "function", "traverseLeaf", "(", "next", ",", "requireString", ",", "requireIndex", ")", "{", "var", "reqPath", ",", "reqDeps", ";", "if", "(", "'.'", "===", "requireString", "[", "0", "]", ")", "{", "reqPath", "=", "url", ".", "resolve", "(", "'/'", "...
turns require strings into dependency objects
[ "turns", "require", "strings", "into", "dependency", "objects" ]
2f2bef996bedc9d69e8320c943a188d665859e20
https://github.com/solderjs/node-pakman/blob/2f2bef996bedc9d69e8320c943a188d665859e20/lib/get-module-tree.js#L22-L52
36,855
WorldMobileCoin/wmcc-core
src/mempool/mempoolentry.js
MempoolEntry
function MempoolEntry(options) { if (!(this instanceof MempoolEntry)) return new MempoolEntry(options); this.tx = null; this.height = -1; this.size = 0; this.sigops = 0; this.priority = 0; this.fee = 0; this.deltaFee = 0; this.time = 0; this.value = 0; this.coinbase = false; this.dependenci...
javascript
function MempoolEntry(options) { if (!(this instanceof MempoolEntry)) return new MempoolEntry(options); this.tx = null; this.height = -1; this.size = 0; this.sigops = 0; this.priority = 0; this.fee = 0; this.deltaFee = 0; this.time = 0; this.value = 0; this.coinbase = false; this.dependenci...
[ "function", "MempoolEntry", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "MempoolEntry", ")", ")", "return", "new", "MempoolEntry", "(", "options", ")", ";", "this", ".", "tx", "=", "null", ";", "this", ".", "height", "=", "-", ...
Represents a mempool entry. @alias module:mempool.MempoolEntry @constructor @param {Object} options @param {TX} options.tx - Transaction in mempool. @param {Number} options.height - Entry height. @param {Number} options.priority - Entry priority. @param {Number} options.time - Entry time. @param {Amount} options.value ...
[ "Represents", "a", "mempool", "entry", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/mempool/mempoolentry.js#L37-L57
36,856
solderjs/node-pakman
lib/reduce-tree.js
mapByDepth
function mapByDepth(rootPackage) { var depth = 0 , allDeps = {} , superDepsList = {} ; function traverseDeps(childPackage) { depth += 1; childPackage.dependencyTree = childPackage.dependencyTree || {}; Object.keys(childPackage.dependencyTree).forEach(function (depName) { ...
javascript
function mapByDepth(rootPackage) { var depth = 0 , allDeps = {} , superDepsList = {} ; function traverseDeps(childPackage) { depth += 1; childPackage.dependencyTree = childPackage.dependencyTree || {}; Object.keys(childPackage.dependencyTree).forEach(function (depName) { ...
[ "function", "mapByDepth", "(", "rootPackage", ")", "{", "var", "depth", "=", "0", ",", "allDeps", "=", "{", "}", ",", "superDepsList", "=", "{", "}", ";", "function", "traverseDeps", "(", "childPackage", ")", "{", "depth", "+=", "1", ";", "childPackage",...
You could traverse it like this
[ "You", "could", "traverse", "it", "like", "this" ]
2f2bef996bedc9d69e8320c943a188d665859e20
https://github.com/solderjs/node-pakman/blob/2f2bef996bedc9d69e8320c943a188d665859e20/lib/reduce-tree.js#L6-L45
36,857
justsocialapps/just-sdk
examples/browser/browser-app.js
init
function init() { // initialize the SDK with the domain where Just is running and the // OAuth 2.0 implicit flow parameters sdk = new window.JustSDK({ domain: 'JUSTDOMAIN', oauth2: { // adapt this to point to the correct domain and path red...
javascript
function init() { // initialize the SDK with the domain where Just is running and the // OAuth 2.0 implicit flow parameters sdk = new window.JustSDK({ domain: 'JUSTDOMAIN', oauth2: { // adapt this to point to the correct domain and path red...
[ "function", "init", "(", ")", "{", "// initialize the SDK with the domain where Just is running and the", "// OAuth 2.0 implicit flow parameters", "sdk", "=", "new", "window", ".", "JustSDK", "(", "{", "domain", ":", "'JUSTDOMAIN'", ",", "oauth2", ":", "{", "// adapt this...
this function is called right after the DOM has loaded
[ "this", "function", "is", "called", "right", "after", "the", "DOM", "has", "loaded" ]
af547343b06624e157ee16fca0a546bb1a3b7a7d
https://github.com/justsocialapps/just-sdk/blob/af547343b06624e157ee16fca0a546bb1a3b7a7d/examples/browser/browser-app.js#L31-L64
36,858
WorldMobileCoin/wmcc-core
src/db/memdb.js
MemDB
function MemDB(location) { if (!(this instanceof MemDB)) return new MemDB(location); this.location = location || 'memory'; this.options = {}; this.tree = new RBT(cmp, true); }
javascript
function MemDB(location) { if (!(this instanceof MemDB)) return new MemDB(location); this.location = location || 'memory'; this.options = {}; this.tree = new RBT(cmp, true); }
[ "function", "MemDB", "(", "location", ")", "{", "if", "(", "!", "(", "this", "instanceof", "MemDB", ")", ")", "return", "new", "MemDB", "(", "location", ")", ";", "this", ".", "location", "=", "location", "||", "'memory'", ";", "this", ".", "options", ...
In memory database for wmcc_core using a red-black tree backend. @alias module:db.MemDB @constructor @param {String?} location - Phony location. @param {Object?} options @param {Function} options.compare - Comparator.
[ "In", "memory", "database", "for", "wmcc_core", "using", "a", "red", "-", "black", "tree", "backend", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/db/memdb.js#L27-L34
36,859
WorldMobileCoin/wmcc-core
src/primitives/input.js
Input
function Input(options) { if (!(this instanceof Input)) return new Input(options); this.prevout = new Outpoint(); this.script = new Script(); this.sequence = 0xffffffff; this.witness = new Witness(); if (options) this.fromOptions(options); }
javascript
function Input(options) { if (!(this instanceof Input)) return new Input(options); this.prevout = new Outpoint(); this.script = new Script(); this.sequence = 0xffffffff; this.witness = new Witness(); if (options) this.fromOptions(options); }
[ "function", "Input", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Input", ")", ")", "return", "new", "Input", "(", "options", ")", ";", "this", ".", "prevout", "=", "new", "Outpoint", "(", ")", ";", "this", ".", "script", "...
Represents a transaction input. @alias module:primitives.Input @constructor @param {NakedInput} options @property {Outpoint} prevout - Outpoint. @property {Script} script - Input script / scriptSig. @property {Number} sequence - nSequence. @property {Witness} witness - Witness (empty if not present).
[ "Represents", "a", "transaction", "input", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/primitives/input.js#L34-L45
36,860
WorldMobileCoin/wmcc-core
src/protocol/timedata.js
TimeData
function TimeData(limit) { if (!(this instanceof TimeData)) return new TimeData(limit); EventEmitter.call(this); if (limit == null) limit = 200; this.samples = []; this.known = new Map(); this.limit = limit; this.offset = 0; this.checked = false; this.ntp = new NTP(); }
javascript
function TimeData(limit) { if (!(this instanceof TimeData)) return new TimeData(limit); EventEmitter.call(this); if (limit == null) limit = 200; this.samples = []; this.known = new Map(); this.limit = limit; this.offset = 0; this.checked = false; this.ntp = new NTP(); }
[ "function", "TimeData", "(", "limit", ")", "{", "if", "(", "!", "(", "this", "instanceof", "TimeData", ")", ")", "return", "new", "TimeData", "(", "limit", ")", ";", "EventEmitter", ".", "call", "(", "this", ")", ";", "if", "(", "limit", "==", "null"...
An object which handles "adjusted time". This may not look it, but this is actually a semi-consensus-critical piece of code. It handles version packets from peers and calculates what to offset our system clock's time by. @alias module:protocol.TimeData @constructor @param {Number} [limit=200] @property {Array} samples ...
[ "An", "object", "which", "handles", "adjusted", "time", ".", "This", "may", "not", "look", "it", "but", "this", "is", "actually", "a", "semi", "-", "consensus", "-", "critical", "piece", "of", "code", ".", "It", "handles", "version", "packets", "from", "...
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/protocol/timedata.js#L31-L46
36,861
WorldMobileCoin/wmcc-core
src/primitives/headers.js
Headers
function Headers(options) { if (!(this instanceof Headers)) return new Headers(options); AbstractBlock.call(this); if (options) this.parseOptions(options); }
javascript
function Headers(options) { if (!(this instanceof Headers)) return new Headers(options); AbstractBlock.call(this); if (options) this.parseOptions(options); }
[ "function", "Headers", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Headers", ")", ")", "return", "new", "Headers", "(", "options", ")", ";", "AbstractBlock", ".", "call", "(", "this", ")", ";", "if", "(", "options", ")", "th...
Represents block headers obtained from the network via `headers`. @alias module:primitives.Headers @constructor @extends AbstractBlock @param {NakedBlock} options
[ "Represents", "block", "headers", "obtained", "from", "the", "network", "via", "headers", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/primitives/headers.js#L27-L35
36,862
WorldMobileCoin/wmcc-core
src/wallet/nodeclient.js
NodeClient
function NodeClient(node) { if (!(this instanceof NodeClient)) return new NodeClient(node); AsyncObject.call(this); this.node = node; this.network = node.network; this.filter = null; this.listen = false; this._init(); }
javascript
function NodeClient(node) { if (!(this instanceof NodeClient)) return new NodeClient(node); AsyncObject.call(this); this.node = node; this.network = node.network; this.filter = null; this.listen = false; this._init(); }
[ "function", "NodeClient", "(", "node", ")", "{", "if", "(", "!", "(", "this", "instanceof", "NodeClient", ")", ")", "return", "new", "NodeClient", "(", "node", ")", ";", "AsyncObject", ".", "call", "(", "this", ")", ";", "this", ".", "node", "=", "no...
NodeClient Sort of a fake local client for separation of concerns. @alias module:node.NodeClient @constructor
[ "NodeClient", "Sort", "of", "a", "fake", "local", "client", "for", "separation", "of", "concerns", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/wallet/nodeclient.js#L22-L34
36,863
WorldMobileCoin/wmcc-core
src/bip70/paymentdetails.js
PaymentDetails
function PaymentDetails(options) { if (!(this instanceof PaymentDetails)) return new PaymentDetails(options); this.network = null; this.outputs = []; this.time = util.now(); this.expires = -1; this.memo = null; this.paymentUrl = null; this.merchantData = null; if (options) this.fromOptions(o...
javascript
function PaymentDetails(options) { if (!(this instanceof PaymentDetails)) return new PaymentDetails(options); this.network = null; this.outputs = []; this.time = util.now(); this.expires = -1; this.memo = null; this.paymentUrl = null; this.merchantData = null; if (options) this.fromOptions(o...
[ "function", "PaymentDetails", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "PaymentDetails", ")", ")", "return", "new", "PaymentDetails", "(", "options", ")", ";", "this", ".", "network", "=", "null", ";", "this", ".", "outputs", ...
Represents BIP70 payment details. @alias module:bip70.PaymentDetails @constructor @param {Object?} options @property {String|null} network @property {Output[]} outputs @property {Number} time @property {Number} expires @property {String|null} memo @property {String|null} paymentUrl @property {Buffer|null} merchantData
[ "Represents", "BIP70", "payment", "details", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/bip70/paymentdetails.js#L33-L47
36,864
WorldMobileCoin/wmcc-core
src/coins/compress.js
compressScript
function compressScript(script, bw) { // Attempt to compress the output scripts. // We can _only_ ever compress them if // they are serialized as minimaldata, as // we need to recreate them when we read // them. // P2PKH -> 0 | key-hash // Saves 5 bytes. const pkh = script.getPubkeyhash(true); if (pk...
javascript
function compressScript(script, bw) { // Attempt to compress the output scripts. // We can _only_ ever compress them if // they are serialized as minimaldata, as // we need to recreate them when we read // them. // P2PKH -> 0 | key-hash // Saves 5 bytes. const pkh = script.getPubkeyhash(true); if (pk...
[ "function", "compressScript", "(", "script", ",", "bw", ")", "{", "// Attempt to compress the output scripts.", "// We can _only_ ever compress them if", "// they are serialized as minimaldata, as", "// we need to recreate them when we read", "// them.", "// P2PKH -> 0 | key-hash", "// S...
Compress a script, write directly to the buffer. @param {Script} script @param {BufferWriter} bw
[ "Compress", "a", "script", "write", "directly", "to", "the", "buffer", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/coins/compress.js#L36-L78
36,865
WorldMobileCoin/wmcc-core
src/coins/compress.js
sizeScript
function sizeScript(script) { if (script.isPubkeyhash(true)) return 21; if (script.isScripthash()) return 21; const pk = script.getPubkey(true); if (pk) { if (publicKeyVerify(pk)) return 33; } let size = 0; size += encoding.sizeVarint(script.raw.length + COMPRESS_TYPES); size += scr...
javascript
function sizeScript(script) { if (script.isPubkeyhash(true)) return 21; if (script.isScripthash()) return 21; const pk = script.getPubkey(true); if (pk) { if (publicKeyVerify(pk)) return 33; } let size = 0; size += encoding.sizeVarint(script.raw.length + COMPRESS_TYPES); size += scr...
[ "function", "sizeScript", "(", "script", ")", "{", "if", "(", "script", ".", "isPubkeyhash", "(", "true", ")", ")", "return", "21", ";", "if", "(", "script", ".", "isScripthash", "(", ")", ")", "return", "21", ";", "const", "pk", "=", "script", ".", ...
Calculate script size. @returns {Number}
[ "Calculate", "script", "size", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/coins/compress.js#L135-L153
36,866
WorldMobileCoin/wmcc-core
src/coins/compress.js
compressOutput
function compressOutput(output, bw) { bw.writeVarint(output.value); compressScript(output.script, bw); return bw; }
javascript
function compressOutput(output, bw) { bw.writeVarint(output.value); compressScript(output.script, bw); return bw; }
[ "function", "compressOutput", "(", "output", ",", "bw", ")", "{", "bw", ".", "writeVarint", "(", "output", ".", "value", ")", ";", "compressScript", "(", "output", ".", "script", ",", "bw", ")", ";", "return", "bw", ";", "}" ]
Compress an output. @param {Output} output @param {BufferWriter} bw
[ "Compress", "an", "output", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/coins/compress.js#L161-L165
36,867
WorldMobileCoin/wmcc-core
src/coins/compress.js
sizeOutput
function sizeOutput(output) { let size = 0; size += encoding.sizeVarint(output.value); size += sizeScript(output.script); return size; }
javascript
function sizeOutput(output) { let size = 0; size += encoding.sizeVarint(output.value); size += sizeScript(output.script); return size; }
[ "function", "sizeOutput", "(", "output", ")", "{", "let", "size", "=", "0", ";", "size", "+=", "encoding", ".", "sizeVarint", "(", "output", ".", "value", ")", ";", "size", "+=", "sizeScript", "(", "output", ".", "script", ")", ";", "return", "size", ...
Calculate output size. @returns {Number}
[ "Calculate", "output", "size", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/coins/compress.js#L184-L189
36,868
WorldMobileCoin/wmcc-core
src/coins/compress.js
compressValue
function compressValue(value) { if (value === 0) return 0; let exp = 0; while (value % 10 === 0 && exp < 9) { value /= 10; exp++; } if (exp < 9) { const last = value % 10; value = (value - last) / 10; return 1 + 10 * (9 * value + last - 1) + exp; } return 10 + 10 * (value - 1); ...
javascript
function compressValue(value) { if (value === 0) return 0; let exp = 0; while (value % 10 === 0 && exp < 9) { value /= 10; exp++; } if (exp < 9) { const last = value % 10; value = (value - last) / 10; return 1 + 10 * (9 * value + last - 1) + exp; } return 10 + 10 * (value - 1); ...
[ "function", "compressValue", "(", "value", ")", "{", "if", "(", "value", "===", "0", ")", "return", "0", ";", "let", "exp", "=", "0", ";", "while", "(", "value", "%", "10", "===", "0", "&&", "exp", "<", "9", ")", "{", "value", "/=", "10", ";", ...
Compress value using an exponent. Takes advantage of the fact that many bitcoin values are divisible by 10. @see https://github.com/btcsuite/btcd/blob/master/blockchain/compress.go @param {Amount} value @returns {Number}
[ "Compress", "value", "using", "an", "exponent", ".", "Takes", "advantage", "of", "the", "fact", "that", "many", "bitcoin", "values", "are", "divisible", "by", "10", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/coins/compress.js#L199-L216
36,869
WorldMobileCoin/wmcc-core
src/coins/compress.js
decompressValue
function decompressValue(value) { if (value === 0) return 0; value--; let exp = value % 10; value = (value - exp) / 10; let n; if (exp < 9) { const last = value % 9; value = (value - last) / 9; n = value * 10 + last + 1; } else { n = value + 1; } while (exp > 0) { n *= 10;...
javascript
function decompressValue(value) { if (value === 0) return 0; value--; let exp = value % 10; value = (value - exp) / 10; let n; if (exp < 9) { const last = value % 9; value = (value - last) / 9; n = value * 10 + last + 1; } else { n = value + 1; } while (exp > 0) { n *= 10;...
[ "function", "decompressValue", "(", "value", ")", "{", "if", "(", "value", "===", "0", ")", "return", "0", ";", "value", "--", ";", "let", "exp", "=", "value", "%", "10", ";", "value", "=", "(", "value", "-", "exp", ")", "/", "10", ";", "let", ...
Decompress value. @param {Number} value - Compressed value. @returns {Amount} value
[ "Decompress", "value", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/coins/compress.js#L224-L249
36,870
WorldMobileCoin/wmcc-core
src/coins/compress.js
compressKey
function compressKey(key) { let out; switch (key[0]) { case 0x02: case 0x03: // Key is already compressed. out = key; break; case 0x04: // Compress the key normally. out = secp256k1.publicKeyConvert(key, true); // Store the oddness. // Pseudo-hybrid format. ...
javascript
function compressKey(key) { let out; switch (key[0]) { case 0x02: case 0x03: // Key is already compressed. out = key; break; case 0x04: // Compress the key normally. out = secp256k1.publicKeyConvert(key, true); // Store the oddness. // Pseudo-hybrid format. ...
[ "function", "compressKey", "(", "key", ")", "{", "let", "out", ";", "switch", "(", "key", "[", "0", "]", ")", "{", "case", "0x02", ":", "case", "0x03", ":", "// Key is already compressed.", "out", "=", "key", ";", "break", ";", "case", "0x04", ":", "...
Compress a public key to coins compression format. @param {Buffer} key @returns {Buffer}
[ "Compress", "a", "public", "key", "to", "coins", "compression", "format", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/coins/compress.js#L281-L304
36,871
WorldMobileCoin/wmcc-core
src/coins/compress.js
decompressKey
function decompressKey(key) { const format = key[0]; assert(key.length === 33); switch (format) { case 0x02: case 0x03: return key; case 0x04: key[0] = 0x02; break; case 0x05: key[0] = 0x03; break; default: throw new Error('Bad point format.'); } // D...
javascript
function decompressKey(key) { const format = key[0]; assert(key.length === 33); switch (format) { case 0x02: case 0x03: return key; case 0x04: key[0] = 0x02; break; case 0x05: key[0] = 0x03; break; default: throw new Error('Bad point format.'); } // D...
[ "function", "decompressKey", "(", "key", ")", "{", "const", "format", "=", "key", "[", "0", "]", ";", "assert", "(", "key", ".", "length", "===", "33", ")", ";", "switch", "(", "format", ")", "{", "case", "0x02", ":", "case", "0x03", ":", "return",...
Decompress a public key from the coins compression format. @param {Buffer} key @returns {Buffer}
[ "Decompress", "a", "public", "key", "from", "the", "coins", "compression", "format", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/coins/compress.js#L312-L339
36,872
WorldMobileCoin/wmcc-core
src/net/parser.js
Parser
function Parser(network) { if (!(this instanceof Parser)) return new Parser(network); EventEmitter.call(this); this.network = Network.get(network); this.pending = []; this.total = 0; this.waiting = 24; this.header = null; }
javascript
function Parser(network) { if (!(this instanceof Parser)) return new Parser(network); EventEmitter.call(this); this.network = Network.get(network); this.pending = []; this.total = 0; this.waiting = 24; this.header = null; }
[ "function", "Parser", "(", "network", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Parser", ")", ")", "return", "new", "Parser", "(", "network", ")", ";", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "network", "=", "Netw...
Protocol packet parser @alias module:net.Parser @constructor @param {Network} network @emits Parser#error @emits Parser#packet
[ "Protocol", "packet", "parser" ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/net/parser.js#L33-L45
36,873
WorldMobileCoin/wmcc-core
src/db/lowlevelup.js
LowlevelUp
function LowlevelUp(backend, location, options) { if (!(this instanceof LowlevelUp)) return new LowlevelUp(backend, location, options); assert(typeof backend === 'function', 'Backend is required.'); assert(typeof location === 'string', 'Filename is required.'); this.options = new LLUOptions(options); th...
javascript
function LowlevelUp(backend, location, options) { if (!(this instanceof LowlevelUp)) return new LowlevelUp(backend, location, options); assert(typeof backend === 'function', 'Backend is required.'); assert(typeof location === 'string', 'Filename is required.'); this.options = new LLUOptions(options); th...
[ "function", "LowlevelUp", "(", "backend", ",", "location", ",", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "LowlevelUp", ")", ")", "return", "new", "LowlevelUp", "(", "backend", ",", "location", ",", "options", ")", ";", "assert", "(...
Extremely low-level version of levelup. This avoids pulling in extra deps and lowers memory usage. @alias module:db.LowlevelUp @constructor @param {Function} backend - Database backend. @param {String} location - File location. @param {Object?} options - Leveldown options.
[ "Extremely", "low", "-", "level", "version", "of", "levelup", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/db/lowlevelup.js#L36-L56
36,874
WorldMobileCoin/wmcc-core
src/primitives/mtx.js
MTX
function MTX(options) { if (!(this instanceof MTX)) return new MTX(options); TX.call(this); this.mutable = true; this.changeIndex = -1; this.view = new CoinView(); if (options) this.fromOptions(options); }
javascript
function MTX(options) { if (!(this instanceof MTX)) return new MTX(options); TX.call(this); this.mutable = true; this.changeIndex = -1; this.view = new CoinView(); if (options) this.fromOptions(options); }
[ "function", "MTX", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "MTX", ")", ")", "return", "new", "MTX", "(", "options", ")", ";", "TX", ".", "call", "(", "this", ")", ";", "this", ".", "mutable", "=", "true", ";", "this",...
A mutable transaction object. @alias module:primitives.MTX @extends TX @constructor @param {Object} options @param {Number?} options.version @param {Number?} options.changeIndex @param {Input[]?} options.inputs @param {Output[]?} options.outputs @property {Number} version - Transaction version. @property {Number} flag ...
[ "A", "mutable", "transaction", "object", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/primitives/mtx.js#L49-L61
36,875
WorldMobileCoin/wmcc-core
src/primitives/mtx.js
FundingError
function FundingError(msg, available, required) { Error.call(this); this.type = 'FundingError'; this.message = msg; this.availableFunds = -1; this.requiredFunds = -1; if (available != null) { this.message += ` (available=${Amount.wmcc(available)},`; this.message += ` required=${Amount.wmcc(require...
javascript
function FundingError(msg, available, required) { Error.call(this); this.type = 'FundingError'; this.message = msg; this.availableFunds = -1; this.requiredFunds = -1; if (available != null) { this.message += ` (available=${Amount.wmcc(available)},`; this.message += ` required=${Amount.wmcc(require...
[ "function", "FundingError", "(", "msg", ",", "available", ",", "required", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "this", ".", "type", "=", "'FundingError'", ";", "this", ".", "message", "=", "msg", ";", "this", ".", "availableFunds", "...
An error thrown from the coin selector. @constructor @ignore @extends Error @param {String} msg @param {Amount} available @param {Amount} required @property {String} message - Error message. @property {Amount} availableFunds @property {Amount} requiredFunds
[ "An", "error", "thrown", "from", "the", "coin", "selector", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/primitives/mtx.js#L1915-L1932
36,876
WorldMobileCoin/wmcc-core
src/workers/workerpool.js
WorkerPool
function WorkerPool(options) { if (!(this instanceof WorkerPool)) return new WorkerPool(options); EventEmitter.call(this); this.enabled = false; this.size = getCores(); this.timeout = 120000; this.file = process.env.WMCC_WORKER_FILE || 'worker.js'; this.children = new Map(); this.uid = 0; this...
javascript
function WorkerPool(options) { if (!(this instanceof WorkerPool)) return new WorkerPool(options); EventEmitter.call(this); this.enabled = false; this.size = getCores(); this.timeout = 120000; this.file = process.env.WMCC_WORKER_FILE || 'worker.js'; this.children = new Map(); this.uid = 0; this...
[ "function", "WorkerPool", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "WorkerPool", ")", ")", "return", "new", "WorkerPool", "(", "options", ")", ";", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "enabled", ...
A worker pool. @alias module:workers.WorkerPool @constructor @param {Object} options @param {Number} [options.size=num-cores] - Max pool size. @param {Number} [options.timeout=120000] - Execution timeout. @property {Number} size @property {Number} timeout @property {Map} children @property {Number} uid
[ "A", "worker", "pool", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/workers/workerpool.js#L41-L56
36,877
WorldMobileCoin/wmcc-core
src/workers/workerpool.js
Worker
function Worker(file) { if (!(this instanceof Worker)) return new Worker(file); EventEmitter.call(this); this.id = -1; this.framer = new Framer(); this.parser = new Parser(); this.pending = new Map(); this.child = new Child(file); this.init(); }
javascript
function Worker(file) { if (!(this instanceof Worker)) return new Worker(file); EventEmitter.call(this); this.id = -1; this.framer = new Framer(); this.parser = new Parser(); this.pending = new Map(); this.child = new Child(file); this.init(); }
[ "function", "Worker", "(", "file", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Worker", ")", ")", "return", "new", "Worker", "(", "file", ")", ";", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "id", "=", "-", "1", ";...
Represents a worker. @alias module:workers.Worker @constructor @param {String} file
[ "Represents", "a", "worker", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/workers/workerpool.js#L369-L383
36,878
Karnith/machinepack-sailsgulpify
templates/gulpfile.js
invokeConfigFn
function invokeConfigFn(tasks) { for (var taskName in tasks) { if (tasks.hasOwnProperty(taskName)) { tasks[taskName](gulp, plugins, growl, path); } } }
javascript
function invokeConfigFn(tasks) { for (var taskName in tasks) { if (tasks.hasOwnProperty(taskName)) { tasks[taskName](gulp, plugins, growl, path); } } }
[ "function", "invokeConfigFn", "(", "tasks", ")", "{", "for", "(", "var", "taskName", "in", "tasks", ")", "{", "if", "(", "tasks", ".", "hasOwnProperty", "(", "taskName", ")", ")", "{", "tasks", "[", "taskName", "]", "(", "gulp", ",", "plugins", ",", ...
Invokes the function from a Grunt configuration module with a single argument - the `grunt` object.
[ "Invokes", "the", "function", "from", "a", "Grunt", "configuration", "module", "with", "a", "single", "argument", "-", "the", "grunt", "object", "." ]
38424f98d59cac4240e676159bd25e3bc82ad8ac
https://github.com/Karnith/machinepack-sailsgulpify/blob/38424f98d59cac4240e676159bd25e3bc82ad8ac/templates/gulpfile.js#L66-L72
36,879
axyjs/node-custom-errors
index.js
create
function create(name, parent, defmessage, abstract, construct) { if (typeof name === "object") { return create(name.name, name.parent, name.defmessage, name.abstract, name.construct); } parent = parent || global.Error; if ((defmessage === null) || (defmessage === undefined)) { if (parent...
javascript
function create(name, parent, defmessage, abstract, construct) { if (typeof name === "object") { return create(name.name, name.parent, name.defmessage, name.abstract, name.construct); } parent = parent || global.Error; if ((defmessage === null) || (defmessage === undefined)) { if (parent...
[ "function", "create", "(", "name", ",", "parent", ",", "defmessage", ",", "abstract", ",", "construct", ")", "{", "if", "(", "typeof", "name", "===", "\"object\"", ")", "{", "return", "create", "(", "name", ".", "name", ",", "name", ".", "parent", ",",...
Create a custom error class @param {(String|Object)} name the name of exception (or dictionary of arguments) @param {Function} [parent] the parent exception class (constructor) (Error by default) @param {String} [defmessage] the default message @param {Boolean} [abstract] the flag of an abstract class @param {Function...
[ "Create", "a", "custom", "error", "class" ]
45cf42257c666b8dbffcafe0636985d3973b83c7
https://github.com/axyjs/node-custom-errors/blob/45cf42257c666b8dbffcafe0636985d3973b83c7/index.js#L32-L81
36,880
axyjs/node-custom-errors
index.js
parent
function parent() { var ce = this.constructor.ce; if (ce && ce.parent) { ce = ce.parent.ce; if (ce && (typeof ce.construct === "function")) { ce.construct.apply(this, arguments); } } }
javascript
function parent() { var ce = this.constructor.ce; if (ce && ce.parent) { ce = ce.parent.ce; if (ce && (typeof ce.construct === "function")) { ce.construct.apply(this, arguments); } } }
[ "function", "parent", "(", ")", "{", "var", "ce", "=", "this", ".", "constructor", ".", "ce", ";", "if", "(", "ce", "&&", "ce", ".", "parent", ")", "{", "ce", "=", "ce", ".", "parent", ".", "ce", ";", "if", "(", "ce", "&&", "(", "typeof", "ce...
Execute the parent constructor @name CustomErrors#parent
[ "Execute", "the", "parent", "constructor" ]
45cf42257c666b8dbffcafe0636985d3973b83c7
https://github.com/axyjs/node-custom-errors/blob/45cf42257c666b8dbffcafe0636985d3973b83c7/index.js#L89-L97
36,881
axyjs/node-custom-errors
index.js
inherit
function inherit(name, defmessage, abstract, construct) { if (typeof name === "object") { name.parent = this; return create(name); } return create(name, this, defmessage, abstract, construct); }
javascript
function inherit(name, defmessage, abstract, construct) { if (typeof name === "object") { name.parent = this; return create(name); } return create(name, this, defmessage, abstract, construct); }
[ "function", "inherit", "(", "name", ",", "defmessage", ",", "abstract", ",", "construct", ")", "{", "if", "(", "typeof", "name", "===", "\"object\"", ")", "{", "name", ".", "parent", "=", "this", ";", "return", "create", "(", "name", ")", ";", "}", "...
Inherit from this class @name CustomErrors.inherit @public @param {(String|Object)} name @param {String} [defmessage] @param {Boolean} [abstract] @param {Function} [construct] @return {Function}
[ "Inherit", "from", "this", "class" ]
45cf42257c666b8dbffcafe0636985d3973b83c7
https://github.com/axyjs/node-custom-errors/blob/45cf42257c666b8dbffcafe0636985d3973b83c7/index.js#L110-L116
36,882
axyjs/node-custom-errors
index.js
Block
function Block(errors, namespace, base, lazy) { if ((base === undefined) || (base === true) || (base === null)) { base = "Base"; } else if (base === false) { base = Error; } else if (typeof base !== "function") { base = "" + base; } this.p = { errors: errors, ...
javascript
function Block(errors, namespace, base, lazy) { if ((base === undefined) || (base === true) || (base === null)) { base = "Base"; } else if (base === false) { base = Error; } else if (typeof base !== "function") { base = "" + base; } this.p = { errors: errors, ...
[ "function", "Block", "(", "errors", ",", "namespace", ",", "base", ",", "lazy", ")", "{", "if", "(", "(", "base", "===", "undefined", ")", "||", "(", "base", "===", "true", ")", "||", "(", "base", "===", "null", ")", ")", "{", "base", "=", "\"Bas...
Class of errors block @class Block @exports @param {Object} errors a dictionary "error name" => "parameters" (mixed) @param {String} [namespace] a basic namespace for the block @param {*} [base] a basic error class for the block @param {Boolean} [lazy] use lazy load
[ "Class", "of", "errors", "block" ]
45cf42257c666b8dbffcafe0636985d3973b83c7
https://github.com/axyjs/node-custom-errors/blob/45cf42257c666b8dbffcafe0636985d3973b83c7/index.js#L151-L170
36,883
WorldMobileCoin/wmcc-core
src/primitives/output.js
Output
function Output(options) { if (!(this instanceof Output)) return new Output(options); this.value = 0; this.script = new Script(); if (options) this.fromOptions(options); }
javascript
function Output(options) { if (!(this instanceof Output)) return new Output(options); this.value = 0; this.script = new Script(); if (options) this.fromOptions(options); }
[ "function", "Output", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Output", ")", ")", "return", "new", "Output", "(", "options", ")", ";", "this", ".", "value", "=", "0", ";", "this", ".", "script", "=", "new", "Script", "(...
Represents a transaction output. @alias module:primitives.Output @constructor @param {NakedOutput} options @property {Amount} value - Value in wmcoins. @property {Script} script
[ "Represents", "a", "transaction", "output", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/primitives/output.js#L34-L43
36,884
WorldMobileCoin/wmcc-core
src/http/rpcclient.js
RPCClient
function RPCClient(options) { if (!(this instanceof RPCClient)) return new RPCClient(options); if (!options) options = {}; if (typeof options === 'string') options = { uri: options }; this.options = options; this.network = Network.get(options.network); this.uri = options.uri || `http://local...
javascript
function RPCClient(options) { if (!(this instanceof RPCClient)) return new RPCClient(options); if (!options) options = {}; if (typeof options === 'string') options = { uri: options }; this.options = options; this.network = Network.get(options.network); this.uri = options.uri || `http://local...
[ "function", "RPCClient", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "RPCClient", ")", ")", "return", "new", "RPCClient", "(", "options", ")", ";", "if", "(", "!", "options", ")", "options", "=", "{", "}", ";", "if", "(", "...
WMCC RPC client. @alias module:http.RPCClient @constructor @param {String} uri @param {Object?} options
[ "WMCC", "RPC", "client", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/http/rpcclient.js#L24-L40
36,885
rubenoost/knx-dpt
src/index.js
function (dptid) { var baseId = null; var subId = null; // Parse the dpt id // If it is a raw number if (typeof dptid === 'number' && isFinite(dptid)) { // we're passed in a raw number (9) baseId = dptid; // If it is a string } else if...
javascript
function (dptid) { var baseId = null; var subId = null; // Parse the dpt id // If it is a raw number if (typeof dptid === 'number' && isFinite(dptid)) { // we're passed in a raw number (9) baseId = dptid; // If it is a string } else if...
[ "function", "(", "dptid", ")", "{", "var", "baseId", "=", "null", ";", "var", "subId", "=", "null", ";", "// Parse the dpt id", "// If it is a raw number", "if", "(", "typeof", "dptid", "===", "'number'", "&&", "isFinite", "(", "dptid", ")", ")", "{", "// ...
a generic DPT resolution function @param dptid The datapoint id. Allowed formats: 9/"9"/"9.001"/"DPT9.001"
[ "a", "generic", "DPT", "resolution", "function" ]
b4b3ca6c946f4c26d09e045a7d0b6553ea8bbfae
https://github.com/rubenoost/knx-dpt/blob/b4b3ca6c946f4c26d09e045a7d0b6553ea8bbfae/src/index.js#L71-L96
36,886
Spiffyk/twitch-node-sdk
lib/twitch.core.js
api
function api(options, callback) { if (!session) { throw new Error('You must call init() before api()'); } var version = options.version || 'v3'; var params = options.params || {}; callback = callback || function() {}; var authenticated = !!session.token, url = REDIRECT_PATH + (options.url || opti...
javascript
function api(options, callback) { if (!session) { throw new Error('You must call init() before api()'); } var version = options.version || 'v3'; var params = options.params || {}; callback = callback || function() {}; var authenticated = !!session.token, url = REDIRECT_PATH + (options.url || opti...
[ "function", "api", "(", "options", ",", "callback", ")", "{", "if", "(", "!", "session", ")", "{", "throw", "new", "Error", "(", "'You must call init() before api()'", ")", ";", "}", "var", "version", "=", "options", ".", "version", "||", "'v3'", ";", "v...
Performs asynchronous calls to the Twitch API. `options` can have the following fields: * `method` - The method of the API like `'channel'`. * `params` - The parameters to augment the amount or type of data received. * `verb` - The HTTP method like `'GET'`, `'PUT'` and `'DELETE'` * `version` - The API version to u...
[ "Performs", "asynchronous", "calls", "to", "the", "Twitch", "API", "." ]
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.core.js#L69-L130
36,887
artikcloud/artikcloud-js
src/api/RegistrationsApi.js
function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Callback function to receive the result of the confirmUser operation. * @callback module:api/RegistrationsApi~confirmUserCallback * @param {String} error Error message, if any. * @param module:model/DeviceRegConf...
javascript
function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Callback function to receive the result of the confirmUser operation. * @callback module:api/RegistrationsApi~confirmUserCallback * @param {String} error Error message, if any. * @param module:model/DeviceRegConf...
[ "function", "(", "apiClient", ")", "{", "this", ".", "apiClient", "=", "apiClient", "||", "ApiClient", ".", "instance", ";", "/**\n * Callback function to receive the result of the confirmUser operation.\n * @callback module:api/RegistrationsApi~confirmUserCallback\n * @par...
Registrations service. @module api/RegistrationsApi @version 2.0.6 Constructs a new RegistrationsApi. @alias module:api/RegistrationsApi @class @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance} if unspecified.
[ "Registrations", "service", "." ]
509fb7e6a42f09cec15a78b035372cb7353e250a
https://github.com/artikcloud/artikcloud-js/blob/509fb7e6a42f09cec15a78b035372cb7353e250a/src/api/RegistrationsApi.js#L31-L171
36,888
WorldMobileCoin/wmcc-core
src/utils/lock.js
Lock
function Lock(named) { if (!(this instanceof Lock)) return Lock.create(named); this.named = named === true; this.jobs = []; this.busy = false; this.destroyed = false; this.map = new Map(); this.current = null; this.unlocker = this.unlock.bind(this); }
javascript
function Lock(named) { if (!(this instanceof Lock)) return Lock.create(named); this.named = named === true; this.jobs = []; this.busy = false; this.destroyed = false; this.map = new Map(); this.current = null; this.unlocker = this.unlock.bind(this); }
[ "function", "Lock", "(", "named", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Lock", ")", ")", "return", "Lock", ".", "create", "(", "named", ")", ";", "this", ".", "named", "=", "named", "===", "true", ";", "this", ".", "jobs", "=", "[...
Represents a mutex lock for locking asynchronous object methods. @alias module:utils.Lock @constructor @param {Boolean?} named - Whether to maintain a map of queued jobs by job name.
[ "Represents", "a", "mutex", "lock", "for", "locking", "asynchronous", "object", "methods", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/lock.js#L24-L38
36,889
WorldMobileCoin/wmcc-core
src/crypto/scrypt.js
derive
function derive(passwd, salt, N, r, p, len) { if (r * p >= (1 << 30)) throw new Error('EFBIG'); if ((N & (N - 1)) !== 0 || N === 0) throw new Error('EINVAL'); if (N > 0xffffffff) throw new Error('EINVAL'); const XY = Buffer.allocUnsafe(256 * r); const V = Buffer.allocUnsafe(128 * r * N); con...
javascript
function derive(passwd, salt, N, r, p, len) { if (r * p >= (1 << 30)) throw new Error('EFBIG'); if ((N & (N - 1)) !== 0 || N === 0) throw new Error('EINVAL'); if (N > 0xffffffff) throw new Error('EINVAL'); const XY = Buffer.allocUnsafe(256 * r); const V = Buffer.allocUnsafe(128 * r * N); con...
[ "function", "derive", "(", "passwd", ",", "salt", ",", "N", ",", "r", ",", "p", ",", "len", ")", "{", "if", "(", "r", "*", "p", ">=", "(", "1", "<<", "30", ")", ")", "throw", "new", "Error", "(", "'EFBIG'", ")", ";", "if", "(", "(", "N", ...
Javascript scrypt implementation. Scrypt is used in bip38. WMCC_Core doesn't support bip38 yet, but here it is, just in case. @alias module:crypto/scrypt.derive @param {Buffer} passwd @param {Buffer} salt @param {Number} N @param {Number} r @param {Number} p @param {Number} len @returns {Buffer}
[ "Javascript", "scrypt", "implementation", ".", "Scrypt", "is", "used", "in", "bip38", ".", "WMCC_Core", "doesn", "t", "support", "bip38", "yet", "but", "here", "it", "is", "just", "in", "case", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/crypto/scrypt.js#L64-L83
36,890
WorldMobileCoin/wmcc-core
src/crypto/scrypt.js
deriveAsync
async function deriveAsync(passwd, salt, N, r, p, len) { if (r * p >= (1 << 30)) throw new Error('EFBIG'); if ((N & (N - 1)) !== 0 || N === 0) throw new Error('EINVAL'); if (N > 0xffffffff) throw new Error('EINVAL'); const XY = Buffer.allocUnsafe(256 * r); const V = Buffer.allocUnsafe(128 * r *...
javascript
async function deriveAsync(passwd, salt, N, r, p, len) { if (r * p >= (1 << 30)) throw new Error('EFBIG'); if ((N & (N - 1)) !== 0 || N === 0) throw new Error('EINVAL'); if (N > 0xffffffff) throw new Error('EINVAL'); const XY = Buffer.allocUnsafe(256 * r); const V = Buffer.allocUnsafe(128 * r *...
[ "async", "function", "deriveAsync", "(", "passwd", ",", "salt", ",", "N", ",", "r", ",", "p", ",", "len", ")", "{", "if", "(", "r", "*", "p", ">=", "(", "1", "<<", "30", ")", ")", "throw", "new", "Error", "(", "'EFBIG'", ")", ";", "if", "(", ...
Asynchronous scrypt implementation. @alias module:crypto/scrypt.deriveAsync @function @param {Buffer} passwd @param {Buffer} salt @param {Number} N @param {Number} r @param {Number} p @param {Number} len @returns {Promise}
[ "Asynchronous", "scrypt", "implementation", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/crypto/scrypt.js#L101-L120
36,891
goblindegook/gulp-font2css
src/index.js
guessFontStyle
function guessFontStyle(basename) { return basename .split('-') .slice(1) .map(item => item.toLowerCase()) .reduce((prev, item) => { if (fontStyleKeywords.indexOf(item) >= 0) { return `font-style:${item};` } return prev }, '') }
javascript
function guessFontStyle(basename) { return basename .split('-') .slice(1) .map(item => item.toLowerCase()) .reduce((prev, item) => { if (fontStyleKeywords.indexOf(item) >= 0) { return `font-style:${item};` } return prev }, '') }
[ "function", "guessFontStyle", "(", "basename", ")", "{", "return", "basename", ".", "split", "(", "'-'", ")", ".", "slice", "(", "1", ")", ".", "map", "(", "item", "=>", "item", ".", "toLowerCase", "(", ")", ")", ".", "reduce", "(", "(", "prev", ",...
Guess the `font-style` property from the font file name. @param {String} basename Font base filename. @return {String} `font-style` property and guessed value.
[ "Guess", "the", "font", "-", "style", "property", "from", "the", "font", "file", "name", "." ]
59ab77074a5d9b6f5b8b18ce2259e6ce4e12ef29
https://github.com/goblindegook/gulp-font2css/blob/59ab77074a5d9b6f5b8b18ce2259e6ce4e12ef29/src/index.js#L25-L37
36,892
goblindegook/gulp-font2css
src/index.js
guessFontWeight
function guessFontWeight(basename) { return basename .split('-') .slice(1) .map(item => item.toLowerCase()) .reduce((prev, item) => { if (item === 'normal') { return prev } if (fontWeightNames[item]) { return `font-weight:${fontWeightNames[item]};` } if ...
javascript
function guessFontWeight(basename) { return basename .split('-') .slice(1) .map(item => item.toLowerCase()) .reduce((prev, item) => { if (item === 'normal') { return prev } if (fontWeightNames[item]) { return `font-weight:${fontWeightNames[item]};` } if ...
[ "function", "guessFontWeight", "(", "basename", ")", "{", "return", "basename", ".", "split", "(", "'-'", ")", ".", "slice", "(", "1", ")", ".", "map", "(", "item", "=>", "item", ".", "toLowerCase", "(", ")", ")", ".", "reduce", "(", "(", "prev", "...
Guess the `font-weight` property from the font file name. @param {String} basename Font base filename. @return {String} `font-weight` property and guessed value.
[ "Guess", "the", "font", "-", "weight", "property", "from", "the", "font", "file", "name", "." ]
59ab77074a5d9b6f5b8b18ce2259e6ce4e12ef29
https://github.com/goblindegook/gulp-font2css/blob/59ab77074a5d9b6f5b8b18ce2259e6ce4e12ef29/src/index.js#L44-L64
36,893
WorldMobileCoin/wmcc-core
src/mempool/mempool.js
Mempool
function Mempool(options) { if (!(this instanceof Mempool)) return new Mempool(options); AsyncObject.call(this); this.options = new MempoolOptions(options); this.network = this.options.network; this.logger = this.options.logger.context('mempool'); this.workers = this.options.workers; this.chain = t...
javascript
function Mempool(options) { if (!(this instanceof Mempool)) return new Mempool(options); AsyncObject.call(this); this.options = new MempoolOptions(options); this.network = this.options.network; this.logger = this.options.logger.context('mempool'); this.workers = this.options.workers; this.chain = t...
[ "function", "Mempool", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Mempool", ")", ")", "return", "new", "Mempool", "(", "options", ")", ";", "AsyncObject", ".", "call", "(", "this", ")", ";", "this", ".", "options", "=", "ne...
Represents a mempool. @alias module:mempool.Mempool @constructor @param {Object} options @param {String?} options.name - Database name. @param {String?} options.location - Database file location. @param {String?} options.db - Database backend (`"memory"` by default). @param {Boolean?} options.limitFree @param {Number?}...
[ "Represents", "a", "mempool", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/mempool/mempool.js#L69-L101
36,894
WorldMobileCoin/wmcc-core
src/primitives/outpoint.js
Outpoint
function Outpoint(hash, index) { if (!(this instanceof Outpoint)) return new Outpoint(hash, index); this.hash = encoding.NULL_HASH; this.index = 0xffffffff; if (hash != null) { assert(typeof hash === 'string', 'Hash must be a string.'); assert(util.isU32(index), 'Index must be a uint32.'); thi...
javascript
function Outpoint(hash, index) { if (!(this instanceof Outpoint)) return new Outpoint(hash, index); this.hash = encoding.NULL_HASH; this.index = 0xffffffff; if (hash != null) { assert(typeof hash === 'string', 'Hash must be a string.'); assert(util.isU32(index), 'Index must be a uint32.'); thi...
[ "function", "Outpoint", "(", "hash", ",", "index", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Outpoint", ")", ")", "return", "new", "Outpoint", "(", "hash", ",", "index", ")", ";", "this", ".", "hash", "=", "encoding", ".", "NULL_HASH", ";...
Represents a COutPoint. @alias module:primitives.Outpoint @constructor @param {Hash?} hash @param {Number?} index @property {Hash} hash @property {Number} index
[ "Represents", "a", "COutPoint", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/primitives/outpoint.js#L29-L42
36,895
ucd-cws/calvin-network-tools
nodejs/cmds/build.js
addBoundsToArray
function addBoundsToArray(bounds, array) { if( !bounds ) return; var bound; for( var j = 0; j < bounds.length; j++ ) { bound = bounds[j]; if( bound.type === 'UBM' || bound.type === 'LBM' ) { array.push(bound); } } }
javascript
function addBoundsToArray(bounds, array) { if( !bounds ) return; var bound; for( var j = 0; j < bounds.length; j++ ) { bound = bounds[j]; if( bound.type === 'UBM' || bound.type === 'LBM' ) { array.push(bound); } } }
[ "function", "addBoundsToArray", "(", "bounds", ",", "array", ")", "{", "if", "(", "!", "bounds", ")", "return", ";", "var", "bound", ";", "for", "(", "var", "j", "=", "0", ";", "j", "<", "bounds", ".", "length", ";", "j", "++", ")", "{", "bound",...
helper for readUBMandLBM
[ "helper", "for", "readUBMandLBM" ]
9c276972394878dfb6927b56303fca4c4a2bf8f5
https://github.com/ucd-cws/calvin-network-tools/blob/9c276972394878dfb6927b56303fca4c4a2bf8f5/nodejs/cmds/build.js#L127-L137
36,896
WorldMobileCoin/wmcc-core
src/utils/ip.js
Address
function Address(host, port, type, hostname, raw) { this.host = host || '0.0.0.0'; this.port = port || 0; this.type = type || IP.types.IPV4; this.hostname = hostname || '0.0.0.0:0'; this.raw = raw || ZERO_IP; }
javascript
function Address(host, port, type, hostname, raw) { this.host = host || '0.0.0.0'; this.port = port || 0; this.type = type || IP.types.IPV4; this.hostname = hostname || '0.0.0.0:0'; this.raw = raw || ZERO_IP; }
[ "function", "Address", "(", "host", ",", "port", ",", "type", ",", "hostname", ",", "raw", ")", "{", "this", ".", "host", "=", "host", "||", "'0.0.0.0'", ";", "this", ".", "port", "=", "port", "||", "0", ";", "this", ".", "type", "=", "type", "||...
Represents a parsed address. @constructor @alias module:utils/ip.Address @param {String} host @param {Number} port @param {Number} type @param {String} hostname @param {Buffer|null} raw @property {String} host @property {Number} port @property {Number} type @property {String} hostname @property {Buffer} raw
[ "Represents", "a", "parsed", "address", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/ip.js#L1059-L1065
36,897
WorldMobileCoin/wmcc-core
src/utils/staticwriter.js
StaticWriter
function StaticWriter(size) { if (!(this instanceof StaticWriter)) return new StaticWriter(size); this.data = size ? Buffer.allocUnsafe(size) : EMPTY; this.offset = 0; }
javascript
function StaticWriter(size) { if (!(this instanceof StaticWriter)) return new StaticWriter(size); this.data = size ? Buffer.allocUnsafe(size) : EMPTY; this.offset = 0; }
[ "function", "StaticWriter", "(", "size", ")", "{", "if", "(", "!", "(", "this", "instanceof", "StaticWriter", ")", ")", "return", "new", "StaticWriter", "(", "size", ")", ";", "this", ".", "data", "=", "size", "?", "Buffer", ".", "allocUnsafe", "(", "s...
Statically allocated buffer writer. @alias module:utils.StaticWriter @constructor @param {Number} size
[ "Statically", "allocated", "buffer", "writer", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/staticwriter.js#L29-L35
36,898
jedmao/blink
js/lib/helpers/string.js
camelize
function camelize(s) { return s.replace(STRING_CAMELIZE, function (match, separator, chr) { return chr.toUpperCase(); }).replace(/^([A-Z])/, function (match) { return match.toLowerCase(); }); }
javascript
function camelize(s) { return s.replace(STRING_CAMELIZE, function (match, separator, chr) { return chr.toUpperCase(); }).replace(/^([A-Z])/, function (match) { return match.toLowerCase(); }); }
[ "function", "camelize", "(", "s", ")", "{", "return", "s", ".", "replace", "(", "STRING_CAMELIZE", ",", "function", "(", "match", ",", "separator", ",", "chr", ")", "{", "return", "chr", ".", "toUpperCase", "(", ")", ";", "}", ")", ".", "replace", "(...
Returns the LowerCamelCase form of a string.
[ "Returns", "the", "LowerCamelCase", "form", "of", "a", "string", "." ]
f80fb591d33ee0cf063b6d6afae897e69ffcf407
https://github.com/jedmao/blink/blob/f80fb591d33ee0cf063b6d6afae897e69ffcf407/js/lib/helpers/string.js#L14-L20
36,899
chjj/node-telnet2
repl.js
setRawMode
function setRawMode (mode) { if (mode) { this.do.suppress_go_ahead() this.will.suppress_go_ahead() this.will.echo() } else { this.dont.suppress_go_ahead() this.wont.suppress_go_ahead() this.wont.echo() } }
javascript
function setRawMode (mode) { if (mode) { this.do.suppress_go_ahead() this.will.suppress_go_ahead() this.will.echo() } else { this.dont.suppress_go_ahead() this.wont.suppress_go_ahead() this.wont.echo() } }
[ "function", "setRawMode", "(", "mode", ")", "{", "if", "(", "mode", ")", "{", "this", ".", "do", ".", "suppress_go_ahead", "(", ")", "this", ".", "will", ".", "suppress_go_ahead", "(", ")", "this", ".", "will", ".", "echo", "(", ")", "}", "else", "...
The equivalent of "raw mode" via telnet option commands. Set this function on a telnet `client` instance.
[ "The", "equivalent", "of", "raw", "mode", "via", "telnet", "option", "commands", ".", "Set", "this", "function", "on", "a", "telnet", "client", "instance", "." ]
62b15d1ecd37f339b49e81d414acf43155b3b1da
https://github.com/chjj/node-telnet2/blob/62b15d1ecd37f339b49e81d414acf43155b3b1da/repl.js#L79-L89