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,900
bigpipe/bigpipe.js
collection.js
each
function each(collection, iterator, context) { var i = 0; if ('array' === type(collection)) { for (; i < collection.length; i++) { if (false === iterator.call(context || iterator, collection[i], i, collection)) { return; // If false is returned by the callback we need to bail out. } } ...
javascript
function each(collection, iterator, context) { var i = 0; if ('array' === type(collection)) { for (; i < collection.length; i++) { if (false === iterator.call(context || iterator, collection[i], i, collection)) { return; // If false is returned by the callback we need to bail out. } } ...
[ "function", "each", "(", "collection", ",", "iterator", ",", "context", ")", "{", "var", "i", "=", "0", ";", "if", "(", "'array'", "===", "type", "(", "collection", ")", ")", "{", "for", "(", ";", "i", "<", "collection", ".", "length", ";", "i", ...
Iterate over a collection. @param {Mixed} collection The object we want to iterate over. @param {Function} iterator The function that's called for each iteration. @param {Mixed} context The context of the function. @api public
[ "Iterate", "over", "a", "collection", "." ]
80fe2630d363ed2b69f85d28792a9095a4167e3b
https://github.com/bigpipe/bigpipe.js/blob/80fe2630d363ed2b69f85d28792a9095a4167e3b/collection.js#L25-L43
36,901
bigpipe/bigpipe.js
collection.js
size
function size(collection) { var x, i = 0; if ('object' === type(collection)) { for (x in collection) i++; return i; } return +collection.length; }
javascript
function size(collection) { var x, i = 0; if ('object' === type(collection)) { for (x in collection) i++; return i; } return +collection.length; }
[ "function", "size", "(", "collection", ")", "{", "var", "x", ",", "i", "=", "0", ";", "if", "(", "'object'", "===", "type", "(", "collection", ")", ")", "{", "for", "(", "x", "in", "collection", ")", "i", "++", ";", "return", "i", ";", "}", "re...
Determine the size of a collection. @param {Mixed} collection The object we want to know the size of. @returns {Number} The size of the collection. @api public
[ "Determine", "the", "size", "of", "a", "collection", "." ]
80fe2630d363ed2b69f85d28792a9095a4167e3b
https://github.com/bigpipe/bigpipe.js/blob/80fe2630d363ed2b69f85d28792a9095a4167e3b/collection.js#L67-L76
36,902
bigpipe/bigpipe.js
collection.js
array
function array(obj) { if ('array' === type(obj)) return obj; if ('arguments' === type(obj)) return Array.prototype.slice.call(obj, 0); return obj // Only transform objects in to an array when they exist. ? [obj] : []; }
javascript
function array(obj) { if ('array' === type(obj)) return obj; if ('arguments' === type(obj)) return Array.prototype.slice.call(obj, 0); return obj // Only transform objects in to an array when they exist. ? [obj] : []; }
[ "function", "array", "(", "obj", ")", "{", "if", "(", "'array'", "===", "type", "(", "obj", ")", ")", "return", "obj", ";", "if", "(", "'arguments'", "===", "type", "(", "obj", ")", ")", "return", "Array", ".", "prototype", ".", "slice", ".", "call...
Wrap the given object in an array if it's not an array already. @param {Mixed} obj The thing we might need to wrap. @returns {Array} We promise! @api public
[ "Wrap", "the", "given", "object", "in", "an", "array", "if", "it", "s", "not", "an", "array", "already", "." ]
80fe2630d363ed2b69f85d28792a9095a4167e3b
https://github.com/bigpipe/bigpipe.js/blob/80fe2630d363ed2b69f85d28792a9095a4167e3b/collection.js#L85-L92
36,903
bigpipe/bigpipe.js
collection.js
copy
function copy() { var result = {} , depth = 2 , seen = []; (function worker() { each(array(arguments), function each(obj) { for (var prop in obj) { if (hasOwn.call(obj, prop) && !~index(seen, obj[prop])) { if (type(obj[prop]) !== 'object' || !depth) { result[prop] = ...
javascript
function copy() { var result = {} , depth = 2 , seen = []; (function worker() { each(array(arguments), function each(obj) { for (var prop in obj) { if (hasOwn.call(obj, prop) && !~index(seen, obj[prop])) { if (type(obj[prop]) !== 'object' || !depth) { result[prop] = ...
[ "function", "copy", "(", ")", "{", "var", "result", "=", "{", "}", ",", "depth", "=", "2", ",", "seen", "=", "[", "]", ";", "(", "function", "worker", "(", ")", "{", "each", "(", "array", "(", "arguments", ")", ",", "function", "each", "(", "ob...
Merge all given objects in to one objects. @returns {Object} @api public
[ "Merge", "all", "given", "objects", "in", "to", "one", "objects", "." ]
80fe2630d363ed2b69f85d28792a9095a4167e3b
https://github.com/bigpipe/bigpipe.js/blob/80fe2630d363ed2b69f85d28792a9095a4167e3b/collection.js#L122-L144
36,904
Karnith/machinepack-sailsgulpify
machines/sails-gulpify.js
function (userInput){ var firstTimeRun = userInput.toLowerCase(); if(firstTimeRun === 'yes'){ createGulpFile({ gulpFileSrcPath: '../templates/gulpfile.js', outputDir: '../../../gulpfile.js' }).exec({ error: function (err){ console.err...
javascript
function (userInput){ var firstTimeRun = userInput.toLowerCase(); if(firstTimeRun === 'yes'){ createGulpFile({ gulpFileSrcPath: '../templates/gulpfile.js', outputDir: '../../../gulpfile.js' }).exec({ error: function (err){ console.err...
[ "function", "(", "userInput", ")", "{", "var", "firstTimeRun", "=", "userInput", ".", "toLowerCase", "(", ")", ";", "if", "(", "firstTimeRun", "===", "'yes'", ")", "{", "createGulpFile", "(", "{", "gulpFileSrcPath", ":", "'../templates/gulpfile.js'", ",", "out...
OK- got user input.
[ "OK", "-", "got", "user", "input", "." ]
38424f98d59cac4240e676159bd25e3bc82ad8ac
https://github.com/Karnith/machinepack-sailsgulpify/blob/38424f98d59cac4240e676159bd25e3bc82ad8ac/machines/sails-gulpify.js#L51-L133
36,905
ramonvictor/gulp-protractor-qa
index.js
readFiles
function readFiles() { /* jshint validthis:true */ var self = this; async.waterfall([ function(callback) { storeFileContent.init(self.options.testSrc, callback); }, function(data, callback) { self.testFiles = data; storeFileContent.init(self.options.viewSrc, callback); }, function(data, callback)...
javascript
function readFiles() { /* jshint validthis:true */ var self = this; async.waterfall([ function(callback) { storeFileContent.init(self.options.testSrc, callback); }, function(data, callback) { self.testFiles = data; storeFileContent.init(self.options.viewSrc, callback); }, function(data, callback)...
[ "function", "readFiles", "(", ")", "{", "/* jshint validthis:true */", "var", "self", "=", "this", ";", "async", ".", "waterfall", "(", "[", "function", "(", "callback", ")", "{", "storeFileContent", ".", "init", "(", "self", ".", "options", ".", "testSrc", ...
Read `testSrc` and `viewSrc` files content.
[ "Read", "testSrc", "and", "viewSrc", "files", "content", "." ]
b5a462649bb9cbdcd9d852d865bb05f120cff84d
https://github.com/ramonvictor/gulp-protractor-qa/blob/b5a462649bb9cbdcd9d852d865bb05f120cff84d/index.js#L53-L72
36,906
lemire/TypedFastBitSet.js
TypedFastBitSet.js
TypedFastBitSet
function TypedFastBitSet(iterable) { this.count = 0 | 0; this.words = new Uint32Array(8); if (isIterable(iterable)) { for (var key of iterable) { this.add(key); } } }
javascript
function TypedFastBitSet(iterable) { this.count = 0 | 0; this.words = new Uint32Array(8); if (isIterable(iterable)) { for (var key of iterable) { this.add(key); } } }
[ "function", "TypedFastBitSet", "(", "iterable", ")", "{", "this", ".", "count", "=", "0", "|", "0", ";", "this", ".", "words", "=", "new", "Uint32Array", "(", "8", ")", ";", "if", "(", "isIterable", "(", "iterable", ")", ")", "{", "for", "(", "var"...
you can provide an iterable an exception is thrown if typed arrays are not supported
[ "you", "can", "provide", "an", "iterable", "an", "exception", "is", "thrown", "if", "typed", "arrays", "are", "not", "supported" ]
7f325b54ab9384aa590c2a85d97e46f3ffa5884b
https://github.com/lemire/TypedFastBitSet.js/blob/7f325b54ab9384aa590c2a85d97e46f3ffa5884b/TypedFastBitSet.js#L47-L55
36,907
WorldMobileCoin/wmcc-core
src/script/script.js
Script
function Script(options) { if (!(this instanceof Script)) return new Script(options); this.raw = EMPTY_BUFFER; this.code = []; if (options) this.fromOptions(options); }
javascript
function Script(options) { if (!(this instanceof Script)) return new Script(options); this.raw = EMPTY_BUFFER; this.code = []; if (options) this.fromOptions(options); }
[ "function", "Script", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Script", ")", ")", "return", "new", "Script", "(", "options", ")", ";", "this", ".", "raw", "=", "EMPTY_BUFFER", ";", "this", ".", "code", "=", "[", "]", ";...
Represents a input or output script. @alias module:script.Script @constructor @param {Buffer|Array|Object|NakedScript} code - Array of script code or a serialized script Buffer. @property {Array} code - Parsed script code. @property {Buffer?} raw - Serialized script. @property {Number} length - Number of parsed opcodes...
[ "Represents", "a", "input", "or", "output", "script", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/script/script.js#L48-L57
36,908
WorldMobileCoin/wmcc-core
src/script/script.js
validateKey
function validateKey(key, flags, version) { assert(Buffer.isBuffer(key)); assert(typeof flags === 'number'); assert(typeof version === 'number'); if (flags & Script.flags.VERIFY_STRICTENC) { if (!common.isKeyEncoding(key)) throw new ScriptError('PUBKEYTYPE'); } if (version === 1) { if (flags...
javascript
function validateKey(key, flags, version) { assert(Buffer.isBuffer(key)); assert(typeof flags === 'number'); assert(typeof version === 'number'); if (flags & Script.flags.VERIFY_STRICTENC) { if (!common.isKeyEncoding(key)) throw new ScriptError('PUBKEYTYPE'); } if (version === 1) { if (flags...
[ "function", "validateKey", "(", "key", ",", "flags", ",", "version", ")", "{", "assert", "(", "Buffer", ".", "isBuffer", "(", "key", ")", ")", ";", "assert", "(", "typeof", "flags", "===", "'number'", ")", ";", "assert", "(", "typeof", "version", "==="...
Test whether the data element is a valid key if VERIFY_STRICTENC is enabled. @param {Buffer} key @param {VerifyFlags?} flags @returns {Boolean} @throws {ScriptError}
[ "Test", "whether", "the", "data", "element", "is", "a", "valid", "key", "if", "VERIFY_STRICTENC", "is", "enabled", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/script/script.js#L3558-L3576
36,909
WorldMobileCoin/wmcc-core
src/script/script.js
validateSignature
function validateSignature(sig, flags) { assert(Buffer.isBuffer(sig)); assert(typeof flags === 'number'); // Allow empty sigs if (sig.length === 0) return true; if ((flags & Script.flags.VERIFY_DERSIG) || (flags & Script.flags.VERIFY_LOW_S) || (flags & Script.flags.VERIFY_STRICTENC)) { i...
javascript
function validateSignature(sig, flags) { assert(Buffer.isBuffer(sig)); assert(typeof flags === 'number'); // Allow empty sigs if (sig.length === 0) return true; if ((flags & Script.flags.VERIFY_DERSIG) || (flags & Script.flags.VERIFY_LOW_S) || (flags & Script.flags.VERIFY_STRICTENC)) { i...
[ "function", "validateSignature", "(", "sig", ",", "flags", ")", "{", "assert", "(", "Buffer", ".", "isBuffer", "(", "sig", ")", ")", ";", "assert", "(", "typeof", "flags", "===", "'number'", ")", ";", "// Allow empty sigs", "if", "(", "sig", ".", "length...
Test whether the data element is a valid signature based on the encoding, S value, and sighash type. Requires VERIFY_DERSIG|VERIFY_LOW_S|VERIFY_STRICTENC, VERIFY_LOW_S and VERIFY_STRING_ENC to be enabled respectively. Note that this will allow zero-length signatures. @param {Buffer} sig @param {VerifyFlags?} flags @ret...
[ "Test", "whether", "the", "data", "element", "is", "a", "valid", "signature", "based", "on", "the", "encoding", "S", "value", "and", "sighash", "type", ".", "Requires", "VERIFY_DERSIG|VERIFY_LOW_S|VERIFY_STRICTENC", "VERIFY_LOW_S", "and", "VERIFY_STRING_ENC", "to", ...
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/script/script.js#L3590-L3616
36,910
WorldMobileCoin/wmcc-core
src/script/script.js
checksig
function checksig(msg, sig, key) { return secp256k1.verify(msg, sig.slice(0, -1), key); }
javascript
function checksig(msg, sig, key) { return secp256k1.verify(msg, sig.slice(0, -1), key); }
[ "function", "checksig", "(", "msg", ",", "sig", ",", "key", ")", "{", "return", "secp256k1", ".", "verify", "(", "msg", ",", "sig", ".", "slice", "(", "0", ",", "-", "1", ")", ",", "key", ")", ";", "}" ]
Verify a signature, taking into account sighash type. @param {Buffer} msg - Signature hash. @param {Buffer} sig @param {Buffer} key @returns {Boolean}
[ "Verify", "a", "signature", "taking", "into", "account", "sighash", "type", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/script/script.js#L3626-L3628
36,911
WorldMobileCoin/wmcc-core
src/workers/master.js
Master
function Master() { if (!(this instanceof Master)) return new Master(); EventEmitter.call(this); this.parent = new Parent(); this.framer = new Framer(); this.parser = new Parser(); this.listening = false; this.color = false; this.init(); }
javascript
function Master() { if (!(this instanceof Master)) return new Master(); EventEmitter.call(this); this.parent = new Parent(); this.framer = new Framer(); this.parser = new Parser(); this.listening = false; this.color = false; this.init(); }
[ "function", "Master", "(", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Master", ")", ")", "return", "new", "Master", "(", ")", ";", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "parent", "=", "new", "Parent", "(", ")",...
Represents the master process. @alias module:workers.Master @constructor
[ "Represents", "the", "master", "process", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/workers/master.js#L30-L43
36,912
WorldMobileCoin/wmcc-core
src/primitives/block.js
Block
function Block(options) { if (!(this instanceof Block)) return new Block(options); AbstractBlock.call(this); this.txs = []; this._raw = null; this._size = -1; this._witness = -1; if (options) this.fromOptions(options); }
javascript
function Block(options) { if (!(this instanceof Block)) return new Block(options); AbstractBlock.call(this); this.txs = []; this._raw = null; this._size = -1; this._witness = -1; if (options) this.fromOptions(options); }
[ "function", "Block", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Block", ")", ")", "return", "new", "Block", "(", "options", ")", ";", "AbstractBlock", ".", "call", "(", "this", ")", ";", "this", ".", "txs", "=", "[", "]",...
Represents a full block. @alias module:primitives.Block @constructor @extends AbstractBlock @param {NakedBlock} options
[ "Represents", "a", "full", "block", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/primitives/block.js#L36-L50
36,913
GitbookIO/tokenize-english
lib/index.js
isNameAbbreviation
function isNameAbbreviation(wordCount, words) { if (words.length > 0) { if (wordCount < 5 && words[0].length < 6 && isCapitalized(words[0])) { return true; } var capitalized = words.filter(function(str) { return /[A-Z]/.test(str.charAt(0)); }); retur...
javascript
function isNameAbbreviation(wordCount, words) { if (words.length > 0) { if (wordCount < 5 && words[0].length < 6 && isCapitalized(words[0])) { return true; } var capitalized = words.filter(function(str) { return /[A-Z]/.test(str.charAt(0)); }); retur...
[ "function", "isNameAbbreviation", "(", "wordCount", ",", "words", ")", "{", "if", "(", "words", ".", "length", ">", "0", ")", "{", "if", "(", "wordCount", "<", "5", "&&", "words", "[", "0", "]", ".", "length", "<", "6", "&&", "isCapitalized", "(", ...
Uses current word count in sentence and next few words to check if it is more likely an abbreviation + name or new sentence.
[ "Uses", "current", "word", "count", "in", "sentence", "and", "next", "few", "words", "to", "check", "if", "it", "is", "more", "likely", "an", "abbreviation", "+", "name", "or", "new", "sentence", "." ]
ea78d188e73b6a9161f876c434e24c02cebbfa3e
https://github.com/GitbookIO/tokenize-english/blob/ea78d188e73b6a9161f876c434e24c02cebbfa3e/lib/index.js#L58-L72
36,914
WorldMobileCoin/wmcc-core
src/utils/asyncobject.js
AsyncObject
function AsyncObject() { assert(this instanceof AsyncObject); EventEmitter.call(this); this._asyncLock = new Lock(); this._hooks = Object.create(null); this.loading = false; this.closing = false; this.loaded = false; }
javascript
function AsyncObject() { assert(this instanceof AsyncObject); EventEmitter.call(this); this._asyncLock = new Lock(); this._hooks = Object.create(null); this.loading = false; this.closing = false; this.loaded = false; }
[ "function", "AsyncObject", "(", ")", "{", "assert", "(", "this", "instanceof", "AsyncObject", ")", ";", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "_asyncLock", "=", "new", "Lock", "(", ")", ";", "this", ".", "_hooks", "=", "Objec...
An abstract object that handles state and provides recallable open and close methods. @alias module:utils.AsyncObject @constructor @property {Boolean} loading @property {Boolean} closing @property {Boolean} loaded
[ "An", "abstract", "object", "that", "handles", "state", "and", "provides", "recallable", "open", "and", "close", "methods", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/asyncobject.js#L27-L38
36,915
WorldMobileCoin/wmcc-core
src/crypto/aes-browser.js
AESKey
function AESKey(key, bits) { if (!(this instanceof AESKey)) return new AESKey(key, bits); this.rounds = null; this.userKey = key; this.bits = bits; switch (this.bits) { case 128: this.rounds = 10; break; case 192: this.rounds = 12; break; case 256: this.rounds =...
javascript
function AESKey(key, bits) { if (!(this instanceof AESKey)) return new AESKey(key, bits); this.rounds = null; this.userKey = key; this.bits = bits; switch (this.bits) { case 128: this.rounds = 10; break; case 192: this.rounds = 12; break; case 256: this.rounds =...
[ "function", "AESKey", "(", "key", ",", "bits", ")", "{", "if", "(", "!", "(", "this", "instanceof", "AESKey", ")", ")", "return", "new", "AESKey", "(", "key", ",", "bits", ")", ";", "this", ".", "rounds", "=", "null", ";", "this", ".", "userKey", ...
An AES key object for encrypting and decrypting blocks. @constructor @ignore @param {Buffer} key @param {Number} bits
[ "An", "AES", "key", "object", "for", "encrypting", "and", "decrypting", "blocks", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/crypto/aes-browser.js#L612-L639
36,916
WorldMobileCoin/wmcc-core
src/crypto/aes-browser.js
AESCipher
function AESCipher(key, iv, bits, mode) { if (!(this instanceof AESCipher)) return new AESCipher(key, iv, mode); assert(mode === 'ecb' || mode === 'cbc', 'Unknown mode.'); this.key = new AESKey(key, bits); this.mode = mode; this.prev = iv; this.waiting = null; }
javascript
function AESCipher(key, iv, bits, mode) { if (!(this instanceof AESCipher)) return new AESCipher(key, iv, mode); assert(mode === 'ecb' || mode === 'cbc', 'Unknown mode.'); this.key = new AESKey(key, bits); this.mode = mode; this.prev = iv; this.waiting = null; }
[ "function", "AESCipher", "(", "key", ",", "iv", ",", "bits", ",", "mode", ")", "{", "if", "(", "!", "(", "this", "instanceof", "AESCipher", ")", ")", "return", "new", "AESCipher", "(", "key", ",", "iv", ",", "mode", ")", ";", "assert", "(", "mode",...
AES cipher. @constructor @ignore @param {Buffer} key @param {Buffer} iv @param {Number} bits @param {String} mode
[ "AES", "cipher", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/crypto/aes-browser.js#L1055-L1065
36,917
WorldMobileCoin/wmcc-core
src/crypto/aes-browser.js
AESDecipher
function AESDecipher(key, iv, bits, mode) { if (!(this instanceof AESDecipher)) return new AESDecipher(key, iv, mode); assert(mode === 'ecb' || mode === 'cbc', 'Unknown mode.'); this.key = new AESKey(key, bits); this.mode = mode; this.prev = iv; this.waiting = null; this.lastBlock = null; }
javascript
function AESDecipher(key, iv, bits, mode) { if (!(this instanceof AESDecipher)) return new AESDecipher(key, iv, mode); assert(mode === 'ecb' || mode === 'cbc', 'Unknown mode.'); this.key = new AESKey(key, bits); this.mode = mode; this.prev = iv; this.waiting = null; this.lastBlock = null; }
[ "function", "AESDecipher", "(", "key", ",", "iv", ",", "bits", ",", "mode", ")", "{", "if", "(", "!", "(", "this", "instanceof", "AESDecipher", ")", ")", "return", "new", "AESDecipher", "(", "key", ",", "iv", ",", "mode", ")", ";", "assert", "(", "...
AES decipher. @constructor @ignore @param {Buffer} key @param {Buffer} iv @param {Number} bits @param {String} mode
[ "AES", "decipher", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/crypto/aes-browser.js#L1140-L1151
36,918
WorldMobileCoin/wmcc-core
src/mining/miner.js
Miner
function Miner(options) { if (!(this instanceof Miner)) return new Miner(options); AsyncObject.call(this); this.options = new MinerOptions(options); this.network = this.options.network; this.logger = this.options.logger.context('miner'); this.workers = this.options.workers; this.chain = this.options...
javascript
function Miner(options) { if (!(this instanceof Miner)) return new Miner(options); AsyncObject.call(this); this.options = new MinerOptions(options); this.network = this.options.network; this.logger = this.options.logger.context('miner'); this.workers = this.options.workers; this.chain = this.options...
[ "function", "Miner", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Miner", ")", ")", "return", "new", "Miner", "(", "options", ")", ";", "AsyncObject", ".", "call", "(", "this", ")", ";", "this", ".", "options", "=", "new", ...
A WMCoin miner and block generator. @alias module:mining.Miner @constructor @param {Object} options
[ "A", "WMCoin", "miner", "and", "block", "generator", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/mining/miner.js#L34-L53
36,919
WorldMobileCoin/wmcc-core
src/script/witness.js
Witness
function Witness(options) { if (!(this instanceof Witness)) return new Witness(options); Stack.call(this, []); if (options) this.fromOptions(options); }
javascript
function Witness(options) { if (!(this instanceof Witness)) return new Witness(options); Stack.call(this, []); if (options) this.fromOptions(options); }
[ "function", "Witness", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Witness", ")", ")", "return", "new", "Witness", "(", "options", ")", ";", "Stack", ".", "call", "(", "this", ",", "[", "]", ")", ";", "if", "(", "options",...
Refers to the witness field of segregated witness transactions. @alias module:script.Witness @constructor @param {Buffer[]|NakedWitness} items - Array of stack items. @property {Buffer[]} items @property {Script?} redeem @property {Number} length
[ "Refers", "to", "the", "witness", "field", "of", "segregated", "witness", "transactions", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/script/witness.js#L37-L45
36,920
WorldMobileCoin/wmcc-core
src/net/hostlist.js
HostListOptions
function HostListOptions(options) { if (!(this instanceof HostListOptions)) return new HostListOptions(options); this.network = Network.primary; this.logger = Logger.global; this.resolve = dns.lookup; this.host = '0.0.0.0'; this.port = this.network.port; this.services = common.LOCAL_SERVICES; this....
javascript
function HostListOptions(options) { if (!(this instanceof HostListOptions)) return new HostListOptions(options); this.network = Network.primary; this.logger = Logger.global; this.resolve = dns.lookup; this.host = '0.0.0.0'; this.port = this.network.port; this.services = common.LOCAL_SERVICES; this....
[ "function", "HostListOptions", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "HostListOptions", ")", ")", "return", "new", "HostListOptions", "(", "options", ")", ";", "this", ".", "network", "=", "Network", ".", "primary", ";", "thi...
Host List Options @alias module:net.HostListOptions @constructor @param {Object?} options
[ "Host", "List", "Options" ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/net/hostlist.js#L1482-L1512
36,921
WorldMobileCoin/wmcc-core
src/mining/cpuminer.js
CPUMiner
function CPUMiner(miner) { if (!(this instanceof CPUMiner)) return new CPUMiner(miner); AsyncObject.call(this); this.miner = miner; this.network = this.miner.network; this.logger = this.miner.logger.context('cpuminer'); this.workers = this.miner.workers; this.chain = this.miner.chain; this.locker ...
javascript
function CPUMiner(miner) { if (!(this instanceof CPUMiner)) return new CPUMiner(miner); AsyncObject.call(this); this.miner = miner; this.network = this.miner.network; this.logger = this.miner.logger.context('cpuminer'); this.workers = this.miner.workers; this.chain = this.miner.chain; this.locker ...
[ "function", "CPUMiner", "(", "miner", ")", "{", "if", "(", "!", "(", "this", "instanceof", "CPUMiner", ")", ")", "return", "new", "CPUMiner", "(", "miner", ")", ";", "AsyncObject", ".", "call", "(", "this", ")", ";", "this", ".", "miner", "=", "miner...
CPU miner. @alias module:mining.CPUMiner @constructor @param {Miner} miner @emits CPUMiner#block @emits CPUMiner#status
[ "CPU", "miner", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/mining/cpuminer.js#L30-L51
36,922
samccone/monocle
monocle.js
setAbsolutePath
function setAbsolutePath(file) { file.absolutePath = path.resolve(process.cwd(), file.fullPath); return file.absolutePath; }
javascript
function setAbsolutePath(file) { file.absolutePath = path.resolve(process.cwd(), file.fullPath); return file.absolutePath; }
[ "function", "setAbsolutePath", "(", "file", ")", "{", "file", ".", "absolutePath", "=", "path", ".", "resolve", "(", "process", ".", "cwd", "(", ")", ",", "file", ".", "fullPath", ")", ";", "return", "file", ".", "absolutePath", ";", "}" ]
sets the absolute path to the file from the current working dir
[ "sets", "the", "absolute", "path", "to", "the", "file", "from", "the", "current", "working", "dir" ]
de6e84cee33695a04ce826039e8da33e707a88f8
https://github.com/samccone/monocle/blob/de6e84cee33695a04ce826039e8da33e707a88f8/monocle.js#L92-L95
36,923
samccone/monocle
monocle.js
watchFile
function watchFile(file, cb, partial) { setAbsolutePath(file); storeDirectory(file); if (!watched_files[file.fullPath]) { if (use_fs_watch) { (function() { watched_files[file.fullPath] = fs.watch(file.fullPath, function() { typeof cb === "function" && cb(file); ...
javascript
function watchFile(file, cb, partial) { setAbsolutePath(file); storeDirectory(file); if (!watched_files[file.fullPath]) { if (use_fs_watch) { (function() { watched_files[file.fullPath] = fs.watch(file.fullPath, function() { typeof cb === "function" && cb(file); ...
[ "function", "watchFile", "(", "file", ",", "cb", ",", "partial", ")", "{", "setAbsolutePath", "(", "file", ")", ";", "storeDirectory", "(", "file", ")", ";", "if", "(", "!", "watched_files", "[", "file", ".", "fullPath", "]", ")", "{", "if", "(", "us...
Watches the file passed and its containing directory on change calls given listener with file object
[ "Watches", "the", "file", "passed", "and", "its", "containing", "directory", "on", "change", "calls", "given", "listener", "with", "file", "object" ]
de6e84cee33695a04ce826039e8da33e707a88f8
https://github.com/samccone/monocle/blob/de6e84cee33695a04ce826039e8da33e707a88f8/monocle.js#L99-L120
36,924
samccone/monocle
monocle.js
storeDirectory
function storeDirectory(file) { var directory = file.fullParentDir; if (!watched_directories[directory]) { fs.stat(directory, function(err, stats) { if (err) { watched_directories[directory] = (new Date).getTime(); } else { watched_directories[directory] = (new Date(sta...
javascript
function storeDirectory(file) { var directory = file.fullParentDir; if (!watched_directories[directory]) { fs.stat(directory, function(err, stats) { if (err) { watched_directories[directory] = (new Date).getTime(); } else { watched_directories[directory] = (new Date(sta...
[ "function", "storeDirectory", "(", "file", ")", "{", "var", "directory", "=", "file", ".", "fullParentDir", ";", "if", "(", "!", "watched_directories", "[", "directory", "]", ")", "{", "fs", ".", "stat", "(", "directory", ",", "function", "(", "err", ","...
Sets up a store of the folders being watched and saves the last modification timestamp for it
[ "Sets", "up", "a", "store", "of", "the", "folders", "being", "watched", "and", "saves", "the", "last", "modification", "timestamp", "for", "it" ]
de6e84cee33695a04ce826039e8da33e707a88f8
https://github.com/samccone/monocle/blob/de6e84cee33695a04ce826039e8da33e707a88f8/monocle.js#L124-L135
36,925
samccone/monocle
monocle.js
distinguishPaths
function distinguishPaths(paths) { paths = Array.isArray(paths) ? paths : [paths]; var result = { directories: [], files: [] }; paths.forEach(function(name) { if (fs.statSync(name).isDirectory()) { result.directories.push(name); } else { result.files.push(name); ...
javascript
function distinguishPaths(paths) { paths = Array.isArray(paths) ? paths : [paths]; var result = { directories: [], files: [] }; paths.forEach(function(name) { if (fs.statSync(name).isDirectory()) { result.directories.push(name); } else { result.files.push(name); ...
[ "function", "distinguishPaths", "(", "paths", ")", "{", "paths", "=", "Array", ".", "isArray", "(", "paths", ")", "?", "paths", ":", "[", "paths", "]", ";", "var", "result", "=", "{", "directories", ":", "[", "]", ",", "files", ":", "[", "]", "}", ...
distinguish between files and directories @returns {Object} contains directories and files array
[ "distinguish", "between", "files", "and", "directories" ]
de6e84cee33695a04ce826039e8da33e707a88f8
https://github.com/samccone/monocle/blob/de6e84cee33695a04ce826039e8da33e707a88f8/monocle.js#L140-L154
36,926
samccone/monocle
monocle.js
extend
function extend(prototype, attributes) { var object = {}; Object.keys(prototype).forEach(function(key) { object[key] = prototype[key]; }); Object.keys(attributes).forEach(function(key) { object[key] = attributes[key]; }); return object; }
javascript
function extend(prototype, attributes) { var object = {}; Object.keys(prototype).forEach(function(key) { object[key] = prototype[key]; }); Object.keys(attributes).forEach(function(key) { object[key] = attributes[key]; }); return object; }
[ "function", "extend", "(", "prototype", ",", "attributes", ")", "{", "var", "object", "=", "{", "}", ";", "Object", ".", "keys", "(", "prototype", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "object", "[", "key", "]", "=", "prototype"...
for functions accepts an object as parameter copy the object and modify with attributes
[ "for", "functions", "accepts", "an", "object", "as", "parameter", "copy", "the", "object", "and", "modify", "with", "attributes" ]
de6e84cee33695a04ce826039e8da33e707a88f8
https://github.com/samccone/monocle/blob/de6e84cee33695a04ce826039e8da33e707a88f8/monocle.js#L158-L167
36,927
samccone/monocle
monocle.js
watchPaths
function watchPaths(args) { var result = distinguishPaths(args.path) if (result.directories.length) { result.directories.forEach(function(directory) { watchDirectory(extend(args, {root: directory})); }); } if (result.files.length) watchFiles(extend(args, {files: result.files}))...
javascript
function watchPaths(args) { var result = distinguishPaths(args.path) if (result.directories.length) { result.directories.forEach(function(directory) { watchDirectory(extend(args, {root: directory})); }); } if (result.files.length) watchFiles(extend(args, {files: result.files}))...
[ "function", "watchPaths", "(", "args", ")", "{", "var", "result", "=", "distinguishPaths", "(", "args", ".", "path", ")", "if", "(", "result", ".", "directories", ".", "length", ")", "{", "result", ".", "directories", ".", "forEach", "(", "function", "("...
watch files if the paths refer to files, or directories
[ "watch", "files", "if", "the", "paths", "refer", "to", "files", "or", "directories" ]
de6e84cee33695a04ce826039e8da33e707a88f8
https://github.com/samccone/monocle/blob/de6e84cee33695a04ce826039e8da33e707a88f8/monocle.js#L170-L179
36,928
WorldMobileCoin/wmcc-core
src/crypto/siphash.js
siphash24
function siphash24(data, key, shift) { const blocks = Math.floor(data.length / 8); const c0 = U64(0x736f6d65, 0x70736575); const c1 = U64(0x646f7261, 0x6e646f6d); const c2 = U64(0x6c796765, 0x6e657261); const c3 = U64(0x74656462, 0x79746573); const f0 = U64(blocks << (shift - 32), 0); const f1 = U64(0, 0x...
javascript
function siphash24(data, key, shift) { const blocks = Math.floor(data.length / 8); const c0 = U64(0x736f6d65, 0x70736575); const c1 = U64(0x646f7261, 0x6e646f6d); const c2 = U64(0x6c796765, 0x6e657261); const c3 = U64(0x74656462, 0x79746573); const f0 = U64(blocks << (shift - 32), 0); const f1 = U64(0, 0x...
[ "function", "siphash24", "(", "data", ",", "key", ",", "shift", ")", "{", "const", "blocks", "=", "Math", ".", "floor", "(", "data", ".", "length", "/", "8", ")", ";", "const", "c0", "=", "U64", "(", "0x736f6d65", ",", "0x70736575", ")", ";", "cons...
Javascript siphash implementation. Used for compact block relay. @alias module:crypto/siphash.siphash24 @param {Buffer} data @param {Buffer} key - 128 bit key. @returns {Array} [hi, lo]
[ "Javascript", "siphash", "implementation", ".", "Used", "for", "compact", "block", "relay", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/crypto/siphash.js#L30-L90
36,929
WorldMobileCoin/wmcc-core
src/utils/reader.js
BufferReader
function BufferReader(data, zeroCopy) { if (!(this instanceof BufferReader)) return new BufferReader(data, zeroCopy); assert(Buffer.isBuffer(data), 'Must pass a Buffer.'); this.data = data; this.offset = 0; this.zeroCopy = zeroCopy || false; this.stack = []; }
javascript
function BufferReader(data, zeroCopy) { if (!(this instanceof BufferReader)) return new BufferReader(data, zeroCopy); assert(Buffer.isBuffer(data), 'Must pass a Buffer.'); this.data = data; this.offset = 0; this.zeroCopy = zeroCopy || false; this.stack = []; }
[ "function", "BufferReader", "(", "data", ",", "zeroCopy", ")", "{", "if", "(", "!", "(", "this", "instanceof", "BufferReader", ")", ")", "return", "new", "BufferReader", "(", "data", ",", "zeroCopy", ")", ";", "assert", "(", "Buffer", ".", "isBuffer", "(...
An object that allows reading of buffers in a sane manner. @alias module:utils.BufferReader @constructor @param {Buffer} data @param {Boolean?} zeroCopy - Do not reallocate buffers when slicing. Note that this can lead to memory leaks if not used carefully.
[ "An", "object", "that", "allows", "reading", "of", "buffers", "in", "a", "sane", "manner", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/utils/reader.js#L30-L40
36,930
Spiffyk/twitch-node-sdk
lib/twitch.auth.js
updateSession
function updateSession(callback) { core.api({method: ''}, function(err, response) { var session; if (err) { core.log('error encountered updating session:', err); callback && callback(err, null); return; } if (!response.token.valid) { // Invalid token. Either it has expired or ...
javascript
function updateSession(callback) { core.api({method: ''}, function(err, response) { var session; if (err) { core.log('error encountered updating session:', err); callback && callback(err, null); return; } if (!response.token.valid) { // Invalid token. Either it has expired or ...
[ "function", "updateSession", "(", "callback", ")", "{", "core", ".", "api", "(", "{", "method", ":", "''", "}", ",", "function", "(", "err", ",", "response", ")", "{", "var", "session", ";", "if", "(", "err", ")", "{", "core", ".", "log", "(", "'...
Updates session info from the API. @private @method updateSession
[ "Updates", "session", "info", "from", "the", "API", "." ]
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.auth.js#L18-L36
36,931
Spiffyk/twitch-node-sdk
lib/twitch.auth.js
makeSession
function makeSession(session) { return { authenticated: !!session.token, token: session.token, scope: session.scope, error: session.error, errorDescription: session.errorDescription }; }
javascript
function makeSession(session) { return { authenticated: !!session.token, token: session.token, scope: session.scope, error: session.error, errorDescription: session.errorDescription }; }
[ "function", "makeSession", "(", "session", ")", "{", "return", "{", "authenticated", ":", "!", "!", "session", ".", "token", ",", "token", ":", "session", ".", "token", ",", "scope", ":", "session", ".", "scope", ",", "error", ":", "session", ".", "err...
Creates a session object @private @method makeSession @return {Object} Created session
[ "Creates", "a", "session", "object" ]
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.auth.js#L44-L52
36,932
Spiffyk/twitch-node-sdk
lib/twitch.auth.js
getStatus
function getStatus(options, callback) { if (typeof options === 'function') { callback = options; } if (typeof callback !== 'function') { callback = function() {}; } if (!core.session) { throw new Error('You must call init() before getStatus()'); } if (options && options.force) { updat...
javascript
function getStatus(options, callback) { if (typeof options === 'function') { callback = options; } if (typeof callback !== 'function') { callback = function() {}; } if (!core.session) { throw new Error('You must call init() before getStatus()'); } if (options && options.force) { updat...
[ "function", "getStatus", "(", "options", ",", "callback", ")", "{", "if", "(", "typeof", "options", "===", "'function'", ")", "{", "callback", "=", "options", ";", "}", "if", "(", "typeof", "callback", "!==", "'function'", ")", "{", "callback", "=", "fun...
Gets the current authentication status. The `force` property will trigger an API request to update session data. @method getStatus @param {Object} options @param {function} [callback]
[ "Gets", "the", "current", "authentication", "status", ".", "The", "force", "property", "will", "trigger", "an", "API", "request", "to", "update", "session", "data", "." ]
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.auth.js#L74-L92
36,933
Spiffyk/twitch-node-sdk
lib/twitch.auth.js
login
function login(options) { if (!gui.isActive()) { throw new Error('Cannot login without a GUI.'); } if (!options.scope) { throw new Error('Must specify list of requested scopes'); } var params = { response_type: 'token', client_id: core.clientId, redirect_uri: 'https://api.twitch.tv/kraken...
javascript
function login(options) { if (!gui.isActive()) { throw new Error('Cannot login without a GUI.'); } if (!options.scope) { throw new Error('Must specify list of requested scopes'); } var params = { response_type: 'token', client_id: core.clientId, redirect_uri: 'https://api.twitch.tv/kraken...
[ "function", "login", "(", "options", ")", "{", "if", "(", "!", "gui", ".", "isActive", "(", ")", ")", "{", "throw", "new", "Error", "(", "'Cannot login without a GUI.'", ")", ";", "}", "if", "(", "!", "options", ".", "scope", ")", "{", "throw", "new"...
Opens a login popup for Twitch if the SDK was initialized with a GUI and the user is not logged in yet. @method login @param {Object} options @example ```javascript Twitch.login({ scope: ['user_read', 'channel_read'] }); ```
[ "Opens", "a", "login", "popup", "for", "Twitch", "if", "the", "SDK", "was", "initialized", "with", "a", "GUI", "and", "the", "user", "is", "not", "logged", "in", "yet", "." ]
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.auth.js#L107-L131
36,934
Spiffyk/twitch-node-sdk
lib/twitch.auth.js
logout
function logout(callback) { // Reset the current session core.setSession({}); core.events.emit('auth.logout'); if (typeof callback === 'function') { callback(null); } }
javascript
function logout(callback) { // Reset the current session core.setSession({}); core.events.emit('auth.logout'); if (typeof callback === 'function') { callback(null); } }
[ "function", "logout", "(", "callback", ")", "{", "// Reset the current session", "core", ".", "setSession", "(", "{", "}", ")", ";", "core", ".", "events", ".", "emit", "(", "'auth.logout'", ")", ";", "if", "(", "typeof", "callback", "===", "'function'", "...
Resets the session, which is akin to logging out. This does not deactivate the access token given to your app, so you can continue to perform actions if your server stored the token. @method logout @param {Function} [callback] @example ```javascript Twitch.logout(function(error) { // the user is now logged out }); ```
[ "Resets", "the", "session", "which", "is", "akin", "to", "logging", "out", ".", "This", "does", "not", "deactivate", "the", "access", "token", "given", "to", "your", "app", "so", "you", "can", "continue", "to", "perform", "actions", "if", "your", "server",...
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.auth.js#L147-L155
36,935
Spiffyk/twitch-node-sdk
lib/twitch.auth.js
initSession
function initSession(storedSession, callback) { if (typeof storedSession === "function") { callback = storedSession; } core.setSession((storedSession && makeSession(storedSession)) || {}); getStatus({ force: true }, function(err, status) { if (status.authenticated) { core.events.emit('auth.login...
javascript
function initSession(storedSession, callback) { if (typeof storedSession === "function") { callback = storedSession; } core.setSession((storedSession && makeSession(storedSession)) || {}); getStatus({ force: true }, function(err, status) { if (status.authenticated) { core.events.emit('auth.login...
[ "function", "initSession", "(", "storedSession", ",", "callback", ")", "{", "if", "(", "typeof", "storedSession", "===", "\"function\"", ")", "{", "callback", "=", "storedSession", ";", "}", "core", ".", "setSession", "(", "(", "storedSession", "&&", "makeSess...
Sets session to a stored one. @private @method initSession @param {Object} storedSession @param {Function} [callback]
[ "Sets", "session", "to", "a", "stored", "one", "." ]
e98234ca52b12569298213869439d17169e26f27
https://github.com/Spiffyk/twitch-node-sdk/blob/e98234ca52b12569298213869439d17169e26f27/lib/twitch.auth.js#L166-L182
36,936
perfectapi/node-perfectapi
lib/cligen.js
runWebServerInProcess
function runWebServerInProcess(rawConfig, serverConfig, emitter) { var server = require('./server.js'); if (serverConfig.command == 'stop') { logger.info('stopping server'); return server.stop(); } var app = server.listen(rawConfig, serverConfig, function(err, newCommandName, newConfig, finalCallb...
javascript
function runWebServerInProcess(rawConfig, serverConfig, emitter) { var server = require('./server.js'); if (serverConfig.command == 'stop') { logger.info('stopping server'); return server.stop(); } var app = server.listen(rawConfig, serverConfig, function(err, newCommandName, newConfig, finalCallb...
[ "function", "runWebServerInProcess", "(", "rawConfig", ",", "serverConfig", ",", "emitter", ")", "{", "var", "server", "=", "require", "(", "'./server.js'", ")", ";", "if", "(", "serverConfig", ".", "command", "==", "'stop'", ")", "{", "logger", ".", "info",...
Runs the web server in the same process as the user's code. This is quicker for a single cpu, but risks the user's code stealing cpu and preventing the web server from serving responses in a timely fashion
[ "Runs", "the", "web", "server", "in", "the", "same", "process", "as", "the", "user", "s", "code", ".", "This", "is", "quicker", "for", "a", "single", "cpu", "but", "risks", "the", "user", "s", "code", "stealing", "cpu", "and", "preventing", "the", "web...
aea295ede31994bf7f3c2903cedbe6d316b30062
https://github.com/perfectapi/node-perfectapi/blob/aea295ede31994bf7f3c2903cedbe6d316b30062/lib/cligen.js#L117-L133
36,937
perfectapi/node-perfectapi
lib/cligen.js
runWebServerAsWorker
function runWebServerAsWorker(rawConfig, serverConfig, emitter, callback) { if (serverConfig.command == 'stop') { logger.info('stopping server workers'); if (netServer) { netServer.close(); netServer = null; } for (var i=0;i<webservers.length;i++) { var webserver = webserver...
javascript
function runWebServerAsWorker(rawConfig, serverConfig, emitter, callback) { if (serverConfig.command == 'stop') { logger.info('stopping server workers'); if (netServer) { netServer.close(); netServer = null; } for (var i=0;i<webservers.length;i++) { var webserver = webserver...
[ "function", "runWebServerAsWorker", "(", "rawConfig", ",", "serverConfig", ",", "emitter", ",", "callback", ")", "{", "if", "(", "serverConfig", ".", "command", "==", "'stop'", ")", "{", "logger", ".", "info", "(", "'stopping server workers'", ")", ";", "if", ...
Runs the web server in a forked process. This is not necessarily quicker, but it does allow the user's code to hog CPU without affecting the running of the web server
[ "Runs", "the", "web", "server", "in", "a", "forked", "process", ".", "This", "is", "not", "necessarily", "quicker", "but", "it", "does", "allow", "the", "user", "s", "code", "to", "hog", "CPU", "without", "affecting", "the", "running", "of", "the", "web"...
aea295ede31994bf7f3c2903cedbe6d316b30062
https://github.com/perfectapi/node-perfectapi/blob/aea295ede31994bf7f3c2903cedbe6d316b30062/lib/cligen.js#L141-L193
36,938
perfectapi/node-perfectapi
lib/cligen.js
function(err, result) { if (err && !util.isError(err)) { err = new Error(err); } if (callback) callback(err, result); }
javascript
function(err, result) { if (err && !util.isError(err)) { err = new Error(err); } if (callback) callback(err, result); }
[ "function", "(", "err", ",", "result", ")", "{", "if", "(", "err", "&&", "!", "util", ".", "isError", "(", "err", ")", ")", "{", "err", "=", "new", "Error", "(", "err", ")", ";", "}", "if", "(", "callback", ")", "callback", "(", "err", ",", "...
stub callback to ensure we always return an Error object
[ "stub", "callback", "to", "ensure", "we", "always", "return", "an", "Error", "object" ]
aea295ede31994bf7f3c2903cedbe6d316b30062
https://github.com/perfectapi/node-perfectapi/blob/aea295ede31994bf7f3c2903cedbe6d316b30062/lib/cligen.js#L299-L304
36,939
WorldMobileCoin/wmcc-core
src/net/peer.js
Peer
function Peer(options) { if (!(this instanceof Peer)) return new Peer(options); EventEmitter.call(this); this.options = options; this.network = this.options.network; this.logger = this.options.logger.context('peer'); this.locker = new Lock(); this.parser = new Parser(this.network); this.framer = ...
javascript
function Peer(options) { if (!(this instanceof Peer)) return new Peer(options); EventEmitter.call(this); this.options = options; this.network = this.options.network; this.logger = this.options.logger.context('peer'); this.locker = new Lock(); this.parser = new Parser(this.network); this.framer = ...
[ "function", "Peer", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Peer", ")", ")", "return", "new", "Peer", "(", "options", ")", ";", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "options", "=", "options", ...
Represents a remote peer. @alias module:net.Peer @constructor @param {PeerOptions} options @property {net.Socket} socket @property {NetAddress} address @property {Parser} parser @property {Framer} framer @property {Number} version @property {Boolean} destroyed @property {Boolean} ack - Whether verack has been received....
[ "Represents", "a", "remote", "peer", "." ]
29c3759a175341cedae6b744c53eda628c669317
https://github.com/WorldMobileCoin/wmcc-core/blob/29c3759a175341cedae6b744c53eda628c669317/src/net/peer.js#L71-L151
36,940
myrmex-org/myrmex
packages/iam/src/helper.js
retrievePolicyArn
function retrievePolicyArn(identifier, context, searchParams) { if (/arn:aws:iam::\d{12}:policy\/?[a-zA-Z_0-9+=,.@\-_/]+]/.test(identifier)) { return Promise.resolve(identifier); } // @TODO make this code more beautiful // Try ENV_PolicyName_stage let policyIdentifier = context.environment + '_' + identi...
javascript
function retrievePolicyArn(identifier, context, searchParams) { if (/arn:aws:iam::\d{12}:policy\/?[a-zA-Z_0-9+=,.@\-_/]+]/.test(identifier)) { return Promise.resolve(identifier); } // @TODO make this code more beautiful // Try ENV_PolicyName_stage let policyIdentifier = context.environment + '_' + identi...
[ "function", "retrievePolicyArn", "(", "identifier", ",", "context", ",", "searchParams", ")", "{", "if", "(", "/", "arn:aws:iam::\\d{12}:policy\\/?[a-zA-Z_0-9+=,.@\\-_/]+]", "/", ".", "test", "(", "identifier", ")", ")", "{", "return", "Promise", ".", "resolve", "...
Retrieve a policy Arn from a identifier that can be either the ARN or the name @param {String} identifier @param {[type]} context @param {[type]} searchParams @returns {[type]}
[ "Retrieve", "a", "policy", "Arn", "from", "a", "identifier", "that", "can", "be", "either", "the", "ARN", "or", "the", "name" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/iam/src/helper.js#L41-L80
36,941
myrmex-org/myrmex
packages/iam/src/helper.js
retrieveRoleArn
function retrieveRoleArn(identifier, context) { const iam = new AWS.IAM(); // First check if the parameter already is an ARN if (/arn:aws:iam::\d{12}:role\/?[a-zA-Z_0-9+=,.@\-_\/]+/.test(identifier)) { return Promise.resolve(identifier); } // Then, we check if a role exists with a name "ENVIRONMENT_identi...
javascript
function retrieveRoleArn(identifier, context) { const iam = new AWS.IAM(); // First check if the parameter already is an ARN if (/arn:aws:iam::\d{12}:role\/?[a-zA-Z_0-9+=,.@\-_\/]+/.test(identifier)) { return Promise.resolve(identifier); } // Then, we check if a role exists with a name "ENVIRONMENT_identi...
[ "function", "retrieveRoleArn", "(", "identifier", ",", "context", ")", "{", "const", "iam", "=", "new", "AWS", ".", "IAM", "(", ")", ";", "// First check if the parameter already is an ARN", "if", "(", "/", "arn:aws:iam::\\d{12}:role\\/?[a-zA-Z_0-9+=,.@\\-_\\/]+", "/", ...
Takes a role ARN, or a role name as parameter, requests AWS, and retruns the ARN of a role matching the ARN or the role name or the role name with context informations @param {string} identifier - a role ARN, or a role name @param {Object} context - an object containing the stage and the environment @return {string} ...
[ "Takes", "a", "role", "ARN", "or", "a", "role", "name", "as", "parameter", "requests", "AWS", "and", "retruns", "the", "ARN", "of", "a", "role", "matching", "the", "ARN", "or", "the", "role", "name", "or", "the", "role", "name", "with", "context", "inf...
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/iam/src/helper.js#L99-L137
36,942
borela-tech/js-toolbox
src/configs/webpack/rules/default.js
fileName
function fileName(file) { let prefix = null let reference = null if (isPathSubDirOf(file, PROJECT_DIR)) { // Assets from the target project. prefix = [] reference = PROJECT_DIR } else if (isPathSubDirOf(file, TOOLBOX_DIR)) { // Assets from the Toolbox. prefix = ['__borela__'] reference ...
javascript
function fileName(file) { let prefix = null let reference = null if (isPathSubDirOf(file, PROJECT_DIR)) { // Assets from the target project. prefix = [] reference = PROJECT_DIR } else if (isPathSubDirOf(file, TOOLBOX_DIR)) { // Assets from the Toolbox. prefix = ['__borela__'] reference ...
[ "function", "fileName", "(", "file", ")", "{", "let", "prefix", "=", "null", "let", "reference", "=", "null", "if", "(", "isPathSubDirOf", "(", "file", ",", "PROJECT_DIR", ")", ")", "{", "// Assets from the target project.", "prefix", "=", "[", "]", "referen...
Calculate the file path for the loaded asset.
[ "Calculate", "the", "file", "path", "for", "the", "loaded", "asset", "." ]
0ed75d373fa1573d64a3d715ee8e6e24852824e4
https://github.com/borela-tech/js-toolbox/blob/0ed75d373fa1573d64a3d715ee8e6e24852824e4/src/configs/webpack/rules/default.js#L26-L50
36,943
doug-martin/coddoc
lib/parser/index.js
function (commentObj, code, filepath, context, emitter) { var tagRegexp = tags.getTagRegexp(); var sym = new Symbol({file:filepath}); var comment = commentObj.comment, match = tagRegexp.exec(comment), description, l = comment.length, i; if (match && match[1]) { ...
javascript
function (commentObj, code, filepath, context, emitter) { var tagRegexp = tags.getTagRegexp(); var sym = new Symbol({file:filepath}); var comment = commentObj.comment, match = tagRegexp.exec(comment), description, l = comment.length, i; if (match && match[1]) { ...
[ "function", "(", "commentObj", ",", "code", ",", "filepath", ",", "context", ",", "emitter", ")", "{", "var", "tagRegexp", "=", "tags", ".", "getTagRegexp", "(", ")", ";", "var", "sym", "=", "new", "Symbol", "(", "{", "file", ":", "filepath", "}", ")...
Parses tags from a comment string. @ignore @param commentObj @param code @param filepath @param context @param emitter @return {Object}
[ "Parses", "tags", "from", "a", "comment", "string", "." ]
9950a4d5e76e7c77e25c3b56b54ba6690f30be1f
https://github.com/doug-martin/coddoc/blob/9950a4d5e76e7c77e25c3b56b54ba6690f30be1f/lib/parser/index.js#L31-L62
36,944
myrmex-org/myrmex
packages/cli/src/load-project.js
getProjectRootDirectory
function getProjectRootDirectory() { // From the current directory, check if parent directories have a package.json file and if it contains // a reference to the @myrmex/core node_module let cwd = process.cwd(); let packageJson; let found = false; do { try { packageJson = require(path.join(cwd, '...
javascript
function getProjectRootDirectory() { // From the current directory, check if parent directories have a package.json file and if it contains // a reference to the @myrmex/core node_module let cwd = process.cwd(); let packageJson; let found = false; do { try { packageJson = require(path.join(cwd, '...
[ "function", "getProjectRootDirectory", "(", ")", "{", "// From the current directory, check if parent directories have a package.json file and if it contains", "// a reference to the @myrmex/core node_module", "let", "cwd", "=", "process", ".", "cwd", "(", ")", ";", "let", "package...
Check if the script is called from a myrmex project and return the root directory @return {string|bool} - false if the script is not called inside a myrmex project, or else, the path to the project root
[ "Check", "if", "the", "script", "is", "called", "from", "a", "myrmex", "project", "and", "return", "the", "root", "directory" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/cli/src/load-project.js#L59-L83
36,945
myrmex-org/myrmex
packages/cli/src/load-project.js
getConfig
function getConfig() { // Load the myrmex main configuration file let config = {}; try { // try to load a myrmex.json or myrmex.js file config = require(path.join(process.cwd(), 'myrmex')); } catch (e) { // Silently ignore if there is no configuration file return config; } config.config = c...
javascript
function getConfig() { // Load the myrmex main configuration file let config = {}; try { // try to load a myrmex.json or myrmex.js file config = require(path.join(process.cwd(), 'myrmex')); } catch (e) { // Silently ignore if there is no configuration file return config; } config.config = c...
[ "function", "getConfig", "(", ")", "{", "// Load the myrmex main configuration file", "let", "config", "=", "{", "}", ";", "try", "{", "// try to load a myrmex.json or myrmex.js file", "config", "=", "require", "(", "path", ".", "join", "(", "process", ".", "cwd", ...
Check if the directory in which the command is launched contains a myrmex.json configuration file and return it @return {Object} - an object that will be consumed by a Myrmex instance
[ "Check", "if", "the", "directory", "in", "which", "the", "command", "is", "launched", "contains", "a", "myrmex", ".", "json", "configuration", "file", "and", "return", "it" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/cli/src/load-project.js#L108-L165
36,946
myrmex-org/myrmex
packages/cloud-formation/src/index.js
loadTemplate
function loadTemplate(templatePath, identifier) { return plugin.myrmex.fire('beforeTemplateLoad', templatePath, identifier) .spread((templatePath, name) => { const templateDoc = _.cloneDeep(require(path.join(templatePath))); // Lasy loading because the plugin has to be registered in a Myrmex instance befor...
javascript
function loadTemplate(templatePath, identifier) { return plugin.myrmex.fire('beforeTemplateLoad', templatePath, identifier) .spread((templatePath, name) => { const templateDoc = _.cloneDeep(require(path.join(templatePath))); // Lasy loading because the plugin has to be registered in a Myrmex instance befor...
[ "function", "loadTemplate", "(", "templatePath", ",", "identifier", ")", "{", "return", "plugin", ".", "myrmex", ".", "fire", "(", "'beforeTemplateLoad'", ",", "templatePath", ",", "identifier", ")", ".", "spread", "(", "(", "templatePath", ",", "name", ")", ...
Load a Template object @param {string} templatePath - path to the template file @param {string} identifier - identifier od the template @return {Promise<Template>} - promise of a Cloud Formation template
[ "Load", "a", "Template", "object" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/cloud-formation/src/index.js#L52-L67
36,947
shisama/toggle-fullscreen
lib/index.js
toggleFullscreen
function toggleFullscreen(element, callback) { if (callback && typeof callback === 'function') { if (!isFullscreen()) { var fn = function (e) { if (isFullscreen()) { callback(true); } else { callback(false); ...
javascript
function toggleFullscreen(element, callback) { if (callback && typeof callback === 'function') { if (!isFullscreen()) { var fn = function (e) { if (isFullscreen()) { callback(true); } else { callback(false); ...
[ "function", "toggleFullscreen", "(", "element", ",", "callback", ")", "{", "if", "(", "callback", "&&", "typeof", "callback", "===", "'function'", ")", "{", "if", "(", "!", "isFullscreen", "(", ")", ")", "{", "var", "fn", "=", "function", "(", "e", ")"...
switch target DOMElement to fullscreen mode. @param element {Element} DOMElement that you want to make fullscreen.
[ "switch", "target", "DOMElement", "to", "fullscreen", "mode", "." ]
9bccd4fc00d829f747e1f8824b6753079068193e
https://github.com/shisama/toggle-fullscreen/blob/9bccd4fc00d829f747e1f8824b6753079068193e/lib/index.js#L8-L77
36,948
shisama/toggle-fullscreen
lib/index.js
enterFullscreen
function enterFullscreen(element) { var userAgent = navigator.userAgent.toLowerCase(); if (element.requestFullscreen) { element.requestFullscreen(); } else if (element.msRequestFullscreen) { element.msRequestFullscreen(); } else if (element.mozRequ...
javascript
function enterFullscreen(element) { var userAgent = navigator.userAgent.toLowerCase(); if (element.requestFullscreen) { element.requestFullscreen(); } else if (element.msRequestFullscreen) { element.msRequestFullscreen(); } else if (element.mozRequ...
[ "function", "enterFullscreen", "(", "element", ")", "{", "var", "userAgent", "=", "navigator", ".", "userAgent", ".", "toLowerCase", "(", ")", ";", "if", "(", "element", ".", "requestFullscreen", ")", "{", "element", ".", "requestFullscreen", "(", ")", ";", ...
enter fullscreen mode. @param {Element} element
[ "enter", "fullscreen", "mode", "." ]
9bccd4fc00d829f747e1f8824b6753079068193e
https://github.com/shisama/toggle-fullscreen/blob/9bccd4fc00d829f747e1f8824b6753079068193e/lib/index.js#L41-L58
36,949
shisama/toggle-fullscreen
lib/index.js
exitFullscreen
function exitFullscreen() { var _doument = document; if (document.exitFullscreen) { document.exitFullscreen(); } else if (_doument.msExitFullscreen) { _doument.msExitFullscreen(); } else if (_doument.mozCancelFullScreen) { _doument.mozC...
javascript
function exitFullscreen() { var _doument = document; if (document.exitFullscreen) { document.exitFullscreen(); } else if (_doument.msExitFullscreen) { _doument.msExitFullscreen(); } else if (_doument.mozCancelFullScreen) { _doument.mozC...
[ "function", "exitFullscreen", "(", ")", "{", "var", "_doument", "=", "document", ";", "if", "(", "document", ".", "exitFullscreen", ")", "{", "document", ".", "exitFullscreen", "(", ")", ";", "}", "else", "if", "(", "_doument", ".", "msExitFullscreen", ")"...
exit fullscreen mode.
[ "exit", "fullscreen", "mode", "." ]
9bccd4fc00d829f747e1f8824b6753079068193e
https://github.com/shisama/toggle-fullscreen/blob/9bccd4fc00d829f747e1f8824b6753079068193e/lib/index.js#L62-L76
36,950
shisama/toggle-fullscreen
lib/index.js
isFullscreen
function isFullscreen() { var _document = document; if (!_document.fullscreenElement && !_document.mozFullScreenElement && !_document.webkitFullscreenElement && !_document.msFullscreenElement) { return false; } return true; }
javascript
function isFullscreen() { var _document = document; if (!_document.fullscreenElement && !_document.mozFullScreenElement && !_document.webkitFullscreenElement && !_document.msFullscreenElement) { return false; } return true; }
[ "function", "isFullscreen", "(", ")", "{", "var", "_document", "=", "document", ";", "if", "(", "!", "_document", ".", "fullscreenElement", "&&", "!", "_document", ".", "mozFullScreenElement", "&&", "!", "_document", ".", "webkitFullscreenElement", "&&", "!", ...
check if fullscreen or not. @returns {boolean}
[ "check", "if", "fullscreen", "or", "not", "." ]
9bccd4fc00d829f747e1f8824b6753079068193e
https://github.com/shisama/toggle-fullscreen/blob/9bccd4fc00d829f747e1f8824b6753079068193e/lib/index.js#L83-L92
36,951
shisama/toggle-fullscreen
lib/index.js
fullscreenChange
function fullscreenChange(callback) { var _document = document; return new Promise(function (resolve, reject) { if (document.fullscreenEnabled) { document.addEventListener('fullscreenchange', callback); } else if (_document.mozFullScreenEnabled) { _document.addEve...
javascript
function fullscreenChange(callback) { var _document = document; return new Promise(function (resolve, reject) { if (document.fullscreenEnabled) { document.addEventListener('fullscreenchange', callback); } else if (_document.mozFullScreenEnabled) { _document.addEve...
[ "function", "fullscreenChange", "(", "callback", ")", "{", "var", "_document", "=", "document", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "if", "(", "document", ".", "fullscreenEnabled", ")", "{", "document", ...
add eventListener 'fullscreenchange' @param callback @return {Promise}
[ "add", "eventListener", "fullscreenchange" ]
9bccd4fc00d829f747e1f8824b6753079068193e
https://github.com/shisama/toggle-fullscreen/blob/9bccd4fc00d829f747e1f8824b6753079068193e/lib/index.js#L99-L120
36,952
evan-duncan/log-rotator
lib/logRotator.js
timeInMs
function timeInMs(time) { var HOUR_IN_MS = 3.6e+6, DAY_IN_MS = HOUR_IN_MS * 24, WK_IN_MS = DAY_IN_MS * 7, MS_DICTIONARY = { 'weeks': WK_IN_MS, 'week': WK_IN_MS, 'w': WK_IN_MS, 'days': DAY_IN_MS, 'day': DAY_IN_MS, 'd': DAY_IN_MS, 'hours': HOUR_IN_MS, 'hour': HOUR_IN_MS, 'h': HOUR_IN_MS ...
javascript
function timeInMs(time) { var HOUR_IN_MS = 3.6e+6, DAY_IN_MS = HOUR_IN_MS * 24, WK_IN_MS = DAY_IN_MS * 7, MS_DICTIONARY = { 'weeks': WK_IN_MS, 'week': WK_IN_MS, 'w': WK_IN_MS, 'days': DAY_IN_MS, 'day': DAY_IN_MS, 'd': DAY_IN_MS, 'hours': HOUR_IN_MS, 'hour': HOUR_IN_MS, 'h': HOUR_IN_MS ...
[ "function", "timeInMs", "(", "time", ")", "{", "var", "HOUR_IN_MS", "=", "3.6e+6", ",", "DAY_IN_MS", "=", "HOUR_IN_MS", "*", "24", ",", "WK_IN_MS", "=", "DAY_IN_MS", "*", "7", ",", "MS_DICTIONARY", "=", "{", "'weeks'", ":", "WK_IN_MS", ",", "'week'", ":"...
Get the time in ms @param {String} time - The time as a string. @example timeInMs('24h'); // => 8.64e+7 @return {Number}
[ "Get", "the", "time", "in", "ms" ]
833f422f94caf1a2d2ceaf450c232480481cc1cc
https://github.com/evan-duncan/log-rotator/blob/833f422f94caf1a2d2ceaf450c232480481cc1cc/lib/logRotator.js#L95-L119
36,953
myrmex-org/myrmex
packages/api-gateway/src/index.js
loadApis
function loadApis() { // Shortcut if apis already have been loaded if (apis !== undefined) { return Promise.resolve(apis); } const apiSpecsPath = path.join(process.cwd(), plugin.config.apisPath); // This event allows to inject code before loading all APIs return plugin.myrmex.fire('beforeApisLoad') ...
javascript
function loadApis() { // Shortcut if apis already have been loaded if (apis !== undefined) { return Promise.resolve(apis); } const apiSpecsPath = path.join(process.cwd(), plugin.config.apisPath); // This event allows to inject code before loading all APIs return plugin.myrmex.fire('beforeApisLoad') ...
[ "function", "loadApis", "(", ")", "{", "// Shortcut if apis already have been loaded", "if", "(", "apis", "!==", "undefined", ")", "{", "return", "Promise", ".", "resolve", "(", "apis", ")", ";", "}", "const", "apiSpecsPath", "=", "path", ".", "join", "(", "...
Load all API specifications @returns {Promise<[Api]>} - the promise of an array containing all APIs
[ "Load", "all", "API", "specifications" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/index.js#L17-L55
36,954
myrmex-org/myrmex
packages/api-gateway/src/index.js
loadApi
function loadApi(apiSpecPath, identifier) { return plugin.myrmex.fire('beforeApiLoad', apiSpecPath, identifier) .spread((apiSpecPath, identifier) => { // Because we use require() to get the spec, it could either be a JSON file // or the content exported by a node module // But because require() caches t...
javascript
function loadApi(apiSpecPath, identifier) { return plugin.myrmex.fire('beforeApiLoad', apiSpecPath, identifier) .spread((apiSpecPath, identifier) => { // Because we use require() to get the spec, it could either be a JSON file // or the content exported by a node module // But because require() caches t...
[ "function", "loadApi", "(", "apiSpecPath", ",", "identifier", ")", "{", "return", "plugin", ".", "myrmex", ".", "fire", "(", "'beforeApiLoad'", ",", "apiSpecPath", ",", "identifier", ")", ".", "spread", "(", "(", "apiSpecPath", ",", "identifier", ")", "=>", ...
Load an API specification @param {string} apiSpecPath - the full path to the specification file @param {string} OPTIONAL identifier - a human readable identifier, eventually configured in the specification file itself @returns {Promise<Api>} - the promise of an API instance
[ "Load", "an", "API", "specification" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/index.js#L64-L84
36,955
myrmex-org/myrmex
packages/api-gateway/src/index.js
loadEndpoints
function loadEndpoints() { // Shortcut if endpoints already have been loaded if (endpoints !== undefined) { return Promise.resolve(endpoints); } const endpointSpecsPath = path.join(process.cwd(), plugin.config.endpointsPath); return plugin.myrmex.fire('beforeEndpointsLoad') .spread(() => { const e...
javascript
function loadEndpoints() { // Shortcut if endpoints already have been loaded if (endpoints !== undefined) { return Promise.resolve(endpoints); } const endpointSpecsPath = path.join(process.cwd(), plugin.config.endpointsPath); return plugin.myrmex.fire('beforeEndpointsLoad') .spread(() => { const e...
[ "function", "loadEndpoints", "(", ")", "{", "// Shortcut if endpoints already have been loaded", "if", "(", "endpoints", "!==", "undefined", ")", "{", "return", "Promise", ".", "resolve", "(", "endpoints", ")", ";", "}", "const", "endpointSpecsPath", "=", "path", ...
Load all Endpoint specifications @returns {Promise<[Endpoints]>} - the promise of an array containing all endpoints
[ "Load", "all", "Endpoint", "specifications" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/index.js#L90-L128
36,956
myrmex-org/myrmex
packages/api-gateway/src/index.js
loadModels
function loadModels() { const modelSpecsPath = path.join(process.cwd(), plugin.config.modelsPath); return plugin.myrmex.fire('beforeModelsLoad') .spread(() => { return Promise.promisify(fs.readdir)(modelSpecsPath); }) .then(fileNames => { // Load all the model specifications return Promise.map(fi...
javascript
function loadModels() { const modelSpecsPath = path.join(process.cwd(), plugin.config.modelsPath); return plugin.myrmex.fire('beforeModelsLoad') .spread(() => { return Promise.promisify(fs.readdir)(modelSpecsPath); }) .then(fileNames => { // Load all the model specifications return Promise.map(fi...
[ "function", "loadModels", "(", ")", "{", "const", "modelSpecsPath", "=", "path", ".", "join", "(", "process", ".", "cwd", "(", ")", ",", "plugin", ".", "config", ".", "modelsPath", ")", ";", "return", "plugin", ".", "myrmex", ".", "fire", "(", "'before...
Load all Model specifications @returns {Promise<[Models]>} - the promise of an array containing all models
[ "Load", "all", "Model", "specifications" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/index.js#L177-L204
36,957
myrmex-org/myrmex
packages/api-gateway/src/index.js
loadModel
function loadModel(modelSpecPath, name) { return plugin.myrmex.fire('beforeModelLoad', modelSpecPath, name) .spread(() => { // Because we use require() to get the spec, it could either be a JSON file // or the content exported by a node module // But because require() caches the content it loads, we clo...
javascript
function loadModel(modelSpecPath, name) { return plugin.myrmex.fire('beforeModelLoad', modelSpecPath, name) .spread(() => { // Because we use require() to get the spec, it could either be a JSON file // or the content exported by a node module // But because require() caches the content it loads, we clo...
[ "function", "loadModel", "(", "modelSpecPath", ",", "name", ")", "{", "return", "plugin", ".", "myrmex", ".", "fire", "(", "'beforeModelLoad'", ",", "modelSpecPath", ",", "name", ")", ".", "spread", "(", "(", ")", "=>", "{", "// Because we use require() to get...
Load an Model specification @param {string} modelSpecPath - the path to the the model specification @returns {Promise<Model>} - the promise of an model instance
[ "Load", "an", "Model", "specification" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/index.js#L211-L231
36,958
myrmex-org/myrmex
packages/api-gateway/src/index.js
loadIntegrations
function loadIntegrations(region, context, endpoints) { // The `deployIntegrations` hook takes four arguments // The region of the deployment // The "context" of the deployment // The list of endpoints that must be deployed // An array that will receive integration results const integrationDataInjectors = [...
javascript
function loadIntegrations(region, context, endpoints) { // The `deployIntegrations` hook takes four arguments // The region of the deployment // The "context" of the deployment // The list of endpoints that must be deployed // An array that will receive integration results const integrationDataInjectors = [...
[ "function", "loadIntegrations", "(", "region", ",", "context", ",", "endpoints", ")", "{", "// The `deployIntegrations` hook takes four arguments", "// The region of the deployment", "// The \"context\" of the deployment", "// The list of endpoints that must be deployed", "// An array th...
Update the configuration of endpoints with data returned by integration This data can come from the deployment of a lambda function, the configuration of an HTTP proxy, the generation of a mock etc ... @param {string} region - AWS region @param {string} stage - API stage @param {string} environment - environment ide...
[ "Update", "the", "configuration", "of", "endpoints", "with", "data", "returned", "by", "integration", "This", "data", "can", "come", "from", "the", "deployment", "of", "a", "lambda", "function", "the", "configuration", "of", "an", "HTTP", "proxy", "the", "gene...
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/index.js#L242-L267
36,959
myrmex-org/myrmex
packages/api-gateway/src/index.js
findApi
function findApi(identifier) { return loadApis() .then(apis => { const api = _.find(apis, (api) => { return api.getIdentifier() === identifier; }); if (!api) { return Promise.reject(new Error('Could not find the API "' + identifier + '" in the current project')); } return api; }); }
javascript
function findApi(identifier) { return loadApis() .then(apis => { const api = _.find(apis, (api) => { return api.getIdentifier() === identifier; }); if (!api) { return Promise.reject(new Error('Could not find the API "' + identifier + '" in the current project')); } return api; }); }
[ "function", "findApi", "(", "identifier", ")", "{", "return", "loadApis", "(", ")", ".", "then", "(", "apis", "=>", "{", "const", "api", "=", "_", ".", "find", "(", "apis", ",", "(", "api", ")", "=>", "{", "return", "api", ".", "getIdentifier", "("...
Find an APIs by its identifier and return it with its endpoints @param {string} identifier - the API identifier @returns {Api} - the API corresponding to the identifier
[ "Find", "an", "APIs", "by", "its", "identifier", "and", "return", "it", "with", "its", "endpoints" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/index.js#L274-L283
36,960
myrmex-org/myrmex
packages/api-gateway/src/index.js
findEndpoint
function findEndpoint(resourcePath, method) { return loadEndpoints() .then(endpoints => { const endpoint = _.find(endpoints, endpoint => { return endpoint.getResourcePath() === resourcePath && endpoint.getMethod() === method; }); if (!endpoint) { return Promise.reject(new Error('Could not find the end...
javascript
function findEndpoint(resourcePath, method) { return loadEndpoints() .then(endpoints => { const endpoint = _.find(endpoints, endpoint => { return endpoint.getResourcePath() === resourcePath && endpoint.getMethod() === method; }); if (!endpoint) { return Promise.reject(new Error('Could not find the end...
[ "function", "findEndpoint", "(", "resourcePath", ",", "method", ")", "{", "return", "loadEndpoints", "(", ")", ".", "then", "(", "endpoints", "=>", "{", "const", "endpoint", "=", "_", ".", "find", "(", "endpoints", ",", "endpoint", "=>", "{", "return", "...
Find an endpoint by its resource path and HTTP method @param {string} resourcePath - the resource path of the endpoint @param {string} method - the HTTP method of the endpoint @returns {Endpoint} - the endpoint corresponding to the resource path and the HTTP method
[ "Find", "an", "endpoint", "by", "its", "resource", "path", "and", "HTTP", "method" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/index.js#L291-L300
36,961
myrmex-org/myrmex
packages/api-gateway/src/index.js
findModel
function findModel(name) { return loadModels() .then(models => { const model = _.find(models, model => { return model.getName('spec') === name; }); if (!model) { return Promise.reject(new Error('Could not find the model "' + name + '" in the current project')); } return model; }); }
javascript
function findModel(name) { return loadModels() .then(models => { const model = _.find(models, model => { return model.getName('spec') === name; }); if (!model) { return Promise.reject(new Error('Could not find the model "' + name + '" in the current project')); } return model; }); }
[ "function", "findModel", "(", "name", ")", "{", "return", "loadModels", "(", ")", ".", "then", "(", "models", "=>", "{", "const", "model", "=", "_", ".", "find", "(", "models", ",", "model", "=>", "{", "return", "model", ".", "getName", "(", "'spec'"...
Find an model by its name @param {string} name - the name of the model @returns {Model} - the model corresponding to the resource path and the HTTP method
[ "Find", "an", "model", "by", "its", "name" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/index.js#L307-L316
36,962
myrmex-org/myrmex
packages/api-gateway/src/index.js
mergeSpecsFiles
function mergeSpecsFiles(beginPath, subPath) { // Initialise specification const spec = {}; // List all directories where we have to look for specifications const subDirs = subPath.split(path.sep); // Initialize the directory path for the do/while statement let searchSpecDir = beginPath; do { let s...
javascript
function mergeSpecsFiles(beginPath, subPath) { // Initialise specification const spec = {}; // List all directories where we have to look for specifications const subDirs = subPath.split(path.sep); // Initialize the directory path for the do/while statement let searchSpecDir = beginPath; do { let s...
[ "function", "mergeSpecsFiles", "(", "beginPath", ",", "subPath", ")", "{", "// Initialise specification", "const", "spec", "=", "{", "}", ";", "// List all directories where we have to look for specifications", "const", "subDirs", "=", "subPath", ".", "split", "(", "pat...
Function that aggregates the specifications found in all spec.json|js files in a path @param {string} beginPath - path from which the function will look for swagger.json|js files @param {string} subPath - path until which the function will look for swagger.json|js files @returns {Object} - aggregation of specifications...
[ "Function", "that", "aggregates", "the", "specifications", "found", "in", "all", "spec", ".", "json|js", "files", "in", "a", "path" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/index.js#L382-L415
36,963
jefersondaniel/dom-form-serializer
lib/InputReaders.js
getSelectValue
function getSelectValue (elem) { var value, option, i var options = elem.options var index = elem.selectedIndex var one = elem.type === 'select-one' var values = one ? null : [] var max = one ? index + 1 : options.length if (index < 0) { i = max } else { i = one ? index : 0 } // Loop throu...
javascript
function getSelectValue (elem) { var value, option, i var options = elem.options var index = elem.selectedIndex var one = elem.type === 'select-one' var values = one ? null : [] var max = one ? index + 1 : options.length if (index < 0) { i = max } else { i = one ? index : 0 } // Loop throu...
[ "function", "getSelectValue", "(", "elem", ")", "{", "var", "value", ",", "option", ",", "i", "var", "options", "=", "elem", ".", "options", "var", "index", "=", "elem", ".", "selectedIndex", "var", "one", "=", "elem", ".", "type", "===", "'select-one'",...
Read select values @see {@link https://github.com/jquery/jquery/blob/master/src/attributes/val.js|Github} @param {object} Select element @return {string|Array} Select value(s)
[ "Read", "select", "values" ]
97e0ebf0431b87e4a9b98d87b1d2d037d27c8af2
https://github.com/jefersondaniel/dom-form-serializer/blob/97e0ebf0431b87e4a9b98d87b1d2d037d27c8af2/lib/InputReaders.js#L19-L59
36,964
FocaBot/ffmpeg-downloader
downloader.js
updateBinary
function updateBinary (os = platform, arch = process.arch) { return new Promise((resolve, reject) => { if (platform === 'freebsd') return resolve(` There are no static ffmpeg builds for FreeBSD currently available. The module will try to use the system-wide installation. Install it by running "pkg install ffmpeg...
javascript
function updateBinary (os = platform, arch = process.arch) { return new Promise((resolve, reject) => { if (platform === 'freebsd') return resolve(` There are no static ffmpeg builds for FreeBSD currently available. The module will try to use the system-wide installation. Install it by running "pkg install ffmpeg...
[ "function", "updateBinary", "(", "os", "=", "platform", ",", "arch", "=", "process", ".", "arch", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "if", "(", "platform", "===", "'freebsd'", ")", "return", "resol...
Downloads the FFMPEG binary. @param {string} os - Target OS @param {string} arch - Target architecture @return {Promise<string>} - Output of ffmpeg -version
[ "Downloads", "the", "FFMPEG", "binary", "." ]
1e2998ee76d672857f205ba506f0568f7e4f97cb
https://github.com/FocaBot/ffmpeg-downloader/blob/1e2998ee76d672857f205ba506f0568f7e4f97cb/downloader.js#L17-L74
36,965
maierfelix/POGO-asset-downloader
index.js
sortArrayByIndex
function sortArrayByIndex(array) { let ii = 0; let length = array.length; let output = []; for (; ii < length; ++ii) { output[array[ii].index] = array[ii]; delete array[ii].index; }; return (output); }
javascript
function sortArrayByIndex(array) { let ii = 0; let length = array.length; let output = []; for (; ii < length; ++ii) { output[array[ii].index] = array[ii]; delete array[ii].index; }; return (output); }
[ "function", "sortArrayByIndex", "(", "array", ")", "{", "let", "ii", "=", "0", ";", "let", "length", "=", "array", ".", "length", ";", "let", "output", "=", "[", "]", ";", "for", "(", ";", "ii", "<", "length", ";", "++", "ii", ")", "{", "output",...
Sort array back into correct call order @param {Array} array @return {Array}
[ "Sort", "array", "back", "into", "correct", "call", "order" ]
c26e011d28a85a07349195973597b2f98484ffc3
https://github.com/maierfelix/POGO-asset-downloader/blob/c26e011d28a85a07349195973597b2f98484ffc3/index.js#L180-L194
36,966
myrmex-org/myrmex
packages/api-gateway/src/endpoint.js
Endpoint
function Endpoint(spec, resourcePath, method) { this.method = method; this.resourcePath = resourcePath || '/'; this.spec = spec; }
javascript
function Endpoint(spec, resourcePath, method) { this.method = method; this.resourcePath = resourcePath || '/'; this.spec = spec; }
[ "function", "Endpoint", "(", "spec", ",", "resourcePath", ",", "method", ")", "{", "this", ".", "method", "=", "method", ";", "this", ".", "resourcePath", "=", "resourcePath", "||", "'/'", ";", "this", ".", "spec", "=", "spec", ";", "}" ]
The specification of an API endpoint @param {Object} spec - Swagger/OpenAPI specification of the endpoint @param {string} resourcePath - path of the endpoint @param {string} method - HTTP method of the endpoint @constructor
[ "The", "specification", "of", "an", "API", "endpoint" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/endpoint.js#L14-L18
36,967
auttoio/typeform-node
gulp/plumb.js
monkeyPatchPipe
function monkeyPatchPipe(stream) { while (!stream.hasOwnProperty('pipe')) { stream = Object.getPrototypeOf(stream) if (!stream) return null } let existingPipe = stream.pipe newPipe['$$monkey-patch'] = true return stream.pipe = newPipe /** Create new pipe copy of existing pipe */ function newPipe...
javascript
function monkeyPatchPipe(stream) { while (!stream.hasOwnProperty('pipe')) { stream = Object.getPrototypeOf(stream) if (!stream) return null } let existingPipe = stream.pipe newPipe['$$monkey-patch'] = true return stream.pipe = newPipe /** Create new pipe copy of existing pipe */ function newPipe...
[ "function", "monkeyPatchPipe", "(", "stream", ")", "{", "while", "(", "!", "stream", ".", "hasOwnProperty", "(", "'pipe'", ")", ")", "{", "stream", "=", "Object", ".", "getPrototypeOf", "(", "stream", ")", "if", "(", "!", "stream", ")", "return", "null",...
Monkey patch Gulp pipe to suppress errors in watch task @param {object} pipe Gulp stream
[ "Monkey", "patch", "Gulp", "pipe", "to", "suppress", "errors", "in", "watch", "task" ]
4ff186158b7031b570b2ba7507a9ff00e9e7e156
https://github.com/auttoio/typeform-node/blob/4ff186158b7031b570b2ba7507a9ff00e9e7e156/gulp/plumb.js#L18-L42
36,968
glayzzle/grafine
src/index.js
function(db, id) { this._db = db; this._id = id; this._index = new Map(); this._size = 0; this._changed = false; }
javascript
function(db, id) { this._db = db; this._id = id; this._index = new Map(); this._size = 0; this._changed = false; }
[ "function", "(", "db", ",", "id", ")", "{", "this", ".", "_db", "=", "db", ";", "this", ".", "_id", "=", "id", ";", "this", ".", "_index", "=", "new", "Map", "(", ")", ";", "this", ".", "_size", "=", "0", ";", "this", ".", "_changed", "=", ...
An index storage @constructor Index
[ "An", "index", "storage" ]
616ff0a57806d6b809b69e81f3e5ff77919fc3cd
https://github.com/glayzzle/grafine/blob/616ff0a57806d6b809b69e81f3e5ff77919fc3cd/src/index.js#L14-L20
36,969
borela-tech/js-toolbox
src/configs/webpack/shared.js
configureBundleStats
function configureBundleStats(config) { // Interactive tree map of the bundle. if (interactiveBundleStats) config.plugins.push(new BundleAnalyzerPlugin) // JSON file containing the bundle stats. if (bundleStats) { config.plugins.push(new StatsWriterPlugin({ filename: 'bundle-stats.json', //...
javascript
function configureBundleStats(config) { // Interactive tree map of the bundle. if (interactiveBundleStats) config.plugins.push(new BundleAnalyzerPlugin) // JSON file containing the bundle stats. if (bundleStats) { config.plugins.push(new StatsWriterPlugin({ filename: 'bundle-stats.json', //...
[ "function", "configureBundleStats", "(", "config", ")", "{", "// Interactive tree map of the bundle.", "if", "(", "interactiveBundleStats", ")", "config", ".", "plugins", ".", "push", "(", "new", "BundleAnalyzerPlugin", ")", "// JSON file containing the bundle stats.", "if"...
Configure the stats generation.
[ "Configure", "the", "stats", "generation", "." ]
0ed75d373fa1573d64a3d715ee8e6e24852824e4
https://github.com/borela-tech/js-toolbox/blob/0ed75d373fa1573d64a3d715ee8e6e24852824e4/src/configs/webpack/shared.js#L55-L68
36,970
borela-tech/js-toolbox
src/configs/webpack/shared.js
configureJsMinification
function configureJsMinification(config) { if (!(minify || minifyJs)) return config.optimization.minimize = true config.optimization.minimizer = [new UglifyJsPlugin({ sourceMap: !disableSourceMaps, uglifyOptions: { output: { comments: false, }, }, })] }
javascript
function configureJsMinification(config) { if (!(minify || minifyJs)) return config.optimization.minimize = true config.optimization.minimizer = [new UglifyJsPlugin({ sourceMap: !disableSourceMaps, uglifyOptions: { output: { comments: false, }, }, })] }
[ "function", "configureJsMinification", "(", "config", ")", "{", "if", "(", "!", "(", "minify", "||", "minifyJs", ")", ")", "return", "config", ".", "optimization", ".", "minimize", "=", "true", "config", ".", "optimization", ".", "minimizer", "=", "[", "ne...
Configure the minifier to compress the final bundle.
[ "Configure", "the", "minifier", "to", "compress", "the", "final", "bundle", "." ]
0ed75d373fa1573d64a3d715ee8e6e24852824e4
https://github.com/borela-tech/js-toolbox/blob/0ed75d373fa1573d64a3d715ee8e6e24852824e4/src/configs/webpack/shared.js#L107-L119
36,971
MtnFranke/node-weka
lib/weka-lib.js
parseArffFile
function parseArffFile(arffObj, cb) { var arffFile = ''; arffFile += '@relation '; arffFile += arffObj.name; arffFile += '\n\n'; async.waterfall([ function (callback) { var i = 0; async.eachSeries(arffObj.data, function (obj, dataCb) { async.eachSeries(_.keys(obj...
javascript
function parseArffFile(arffObj, cb) { var arffFile = ''; arffFile += '@relation '; arffFile += arffObj.name; arffFile += '\n\n'; async.waterfall([ function (callback) { var i = 0; async.eachSeries(arffObj.data, function (obj, dataCb) { async.eachSeries(_.keys(obj...
[ "function", "parseArffFile", "(", "arffObj", ",", "cb", ")", "{", "var", "arffFile", "=", "''", ";", "arffFile", "+=", "'@relation '", ";", "arffFile", "+=", "arffObj", ".", "name", ";", "arffFile", "+=", "'\\n\\n'", ";", "async", ".", "waterfall", "(", ...
JS Arff format back to weka arff format
[ "JS", "Arff", "format", "back", "to", "weka", "arff", "format" ]
fadcc9db5da03e5c089139614905fc7d8325f9b3
https://github.com/MtnFranke/node-weka/blob/fadcc9db5da03e5c089139614905fc7d8325f9b3/lib/weka-lib.js#L75-L159
36,972
vail-systems/node-dct
src/dct.js
function(N) { cosMap = cosMap || {}; cosMap[N] = new Array(N*N); var PI_N = Math.PI / N; for (var k = 0; k < N; k++) { for (var n = 0; n < N; n++) { cosMap[N][n + (k * N)] = Math.cos(PI_N * (n + 0.5) * k); } } }
javascript
function(N) { cosMap = cosMap || {}; cosMap[N] = new Array(N*N); var PI_N = Math.PI / N; for (var k = 0; k < N; k++) { for (var n = 0; n < N; n++) { cosMap[N][n + (k * N)] = Math.cos(PI_N * (n + 0.5) * k); } } }
[ "function", "(", "N", ")", "{", "cosMap", "=", "cosMap", "||", "{", "}", ";", "cosMap", "[", "N", "]", "=", "new", "Array", "(", "N", "*", "N", ")", ";", "var", "PI_N", "=", "Math", ".", "PI", "/", "N", ";", "for", "(", "var", "k", "=", "...
Builds a cosine map for the given input size. This allows multiple input sizes to be memoized automagically if you want to run the DCT over and over.
[ "Builds", "a", "cosine", "map", "for", "the", "given", "input", "size", ".", "This", "allows", "multiple", "input", "sizes", "to", "be", "memoized", "automagically", "if", "you", "want", "to", "run", "the", "DCT", "over", "and", "over", "." ]
a643a5d071a3a087e2f187c3a764b93568707be1
https://github.com/vail-systems/node-dct/blob/a643a5d071a3a087e2f187c3a764b93568707be1/src/dct.js#L14-L25
36,973
shakyShane/svg-sprite-data
lib/svg-obj.js
SVGObj
function SVGObj(file, svg, config) { this.file = file; this.id = path.basename(this.file, '.svg'); // this.newSVG = ; // this.newSVG = new dom().parseFromString('<book><title>Harry Potter</title></book>'); // this.newSVG = new dom().parseFromString(svg); // this.svg = libxmljs.parseXml(svg);...
javascript
function SVGObj(file, svg, config) { this.file = file; this.id = path.basename(this.file, '.svg'); // this.newSVG = ; // this.newSVG = new dom().parseFromString('<book><title>Harry Potter</title></book>'); // this.newSVG = new dom().parseFromString(svg); // this.svg = libxmljs.parseXml(svg);...
[ "function", "SVGObj", "(", "file", ",", "svg", ",", "config", ")", "{", "this", ".", "file", "=", "file", ";", "this", ".", "id", "=", "path", ".", "basename", "(", "this", ".", "file", ",", "'.svg'", ")", ";", "// this.newSVG = ;", "// this.newSVG...
SVG object constructor @param {String} file SVG file name @param {String} svg SVG XML @param {Object} config Configuration @return {SVGObj}
[ "SVG", "object", "constructor" ]
fa2bd9e68df3dd5906153333245aa06a5ac4b2b3
https://github.com/shakyShane/svg-sprite-data/blob/fa2bd9e68df3dd5906153333245aa06a5ac4b2b3/lib/svg-obj.js#L26-L91
36,974
robhicks/financejs
finance.js
dateLastPaymentShouldHaveBeenMade
function dateLastPaymentShouldHaveBeenMade(loan, cb) { var d = Q.defer(); var result; if (!loan || _.isEmpty(loan.amortizationTable)) { d.reject(new Error('required dateLastPaymentShouldHaveBeenMade not provided')); } else { var determinationDate = loan.determinationDate ? moment(loan.determ...
javascript
function dateLastPaymentShouldHaveBeenMade(loan, cb) { var d = Q.defer(); var result; if (!loan || _.isEmpty(loan.amortizationTable)) { d.reject(new Error('required dateLastPaymentShouldHaveBeenMade not provided')); } else { var determinationDate = loan.determinationDate ? moment(loan.determ...
[ "function", "dateLastPaymentShouldHaveBeenMade", "(", "loan", ",", "cb", ")", "{", "var", "d", "=", "Q", ".", "defer", "(", ")", ";", "var", "result", ";", "if", "(", "!", "loan", "||", "_", ".", "isEmpty", "(", "loan", ".", "amortizationTable", ")", ...
Calculates the last date a payment should have been @param loan, which must include - amortizationTable - a loan amortization table with the expected payment dates - daysUntilLate (optional) - the grace days for the loan - defaults to 0 - determinationDate (optional) - the date the determination is made, defaults to to...
[ "Calculates", "the", "last", "date", "a", "payment", "should", "have", "been" ]
dc9f0f63c8440a678f4d3598e1273c01f773cea3
https://github.com/robhicks/financejs/blob/dc9f0f63c8440a678f4d3598e1273c01f773cea3/finance.js#L544-L562
36,975
robhicks/financejs
finance.js
addLateFees
function addLateFees(loan, cb) { var d = Q.defer(); if (!loan || !loan.closingDate || !loan.loanAmount || !loan.interestRate || !loan.paymentAmount) { d.reject(new Error('required parameters for addLateFees not provided')); } else { var lateFee = calcLateFee(loan); var determinationDate =...
javascript
function addLateFees(loan, cb) { var d = Q.defer(); if (!loan || !loan.closingDate || !loan.loanAmount || !loan.interestRate || !loan.paymentAmount) { d.reject(new Error('required parameters for addLateFees not provided')); } else { var lateFee = calcLateFee(loan); var determinationDate =...
[ "function", "addLateFees", "(", "loan", ",", "cb", ")", "{", "var", "d", "=", "Q", ".", "defer", "(", ")", ";", "if", "(", "!", "loan", "||", "!", "loan", ".", "closingDate", "||", "!", "loan", ".", "loanAmount", "||", "!", "loan", ".", "interest...
Add Late Fees @param loan @param cb @returns {*}
[ "Add", "Late", "Fees" ]
dc9f0f63c8440a678f4d3598e1273c01f773cea3
https://github.com/robhicks/financejs/blob/dc9f0f63c8440a678f4d3598e1273c01f773cea3/finance.js#L727-L774
36,976
sjkaliski/music
commands/play.js
SpotifySearch
function SpotifySearch (title) { /** * @public {Array} tracks. */ this.tracks = [] // Query spotify, parse xml response, display in terminal, // prompt user for track number, play track. this._query(title) .then(this._parseJSON.bind(this)) .then(this._printData.bind(this)) .then(this._promptUser....
javascript
function SpotifySearch (title) { /** * @public {Array} tracks. */ this.tracks = [] // Query spotify, parse xml response, display in terminal, // prompt user for track number, play track. this._query(title) .then(this._parseJSON.bind(this)) .then(this._printData.bind(this)) .then(this._promptUser....
[ "function", "SpotifySearch", "(", "title", ")", "{", "/**\n * @public {Array} tracks.\n */", "this", ".", "tracks", "=", "[", "]", "// Query spotify, parse xml response, display in terminal,", "// prompt user for track number, play track.", "this", ".", "_query", "(", "titl...
Spotify search client. @param {string} search query. @constructor
[ "Spotify", "search", "client", "." ]
cb56232204ce455590fc9a27eead22b3d7fd2172
https://github.com/sjkaliski/music/blob/cb56232204ce455590fc9a27eead22b3d7fd2172/commands/play.js#L45-L59
36,977
mozilla/MakeAPI
lib/middleware.js
function (modelName) { if (["make", "list"].indexOf(modelName) === -1) { throw new Error( "checkOwnerApp middleware can only be configured with 'make' or 'list'. You passed in: '" + modelName + "'" ); } return function (req, res, next) { // Don't ...
javascript
function (modelName) { if (["make", "list"].indexOf(modelName) === -1) { throw new Error( "checkOwnerApp middleware can only be configured with 'make' or 'list'. You passed in: '" + modelName + "'" ); } return function (req, res, next) { // Don't ...
[ "function", "(", "modelName", ")", "{", "if", "(", "[", "\"make\"", ",", "\"list\"", "]", ".", "indexOf", "(", "modelName", ")", "===", "-", "1", ")", "{", "throw", "new", "Error", "(", "\"checkOwnerApp middleware can only be configured with 'make' or 'list'. You ...
modelName must be "make" or "list" only
[ "modelName", "must", "be", "make", "or", "list", "only" ]
f2893cf6cb81cfed10252a83f721572a1bf2e7ce
https://github.com/mozilla/MakeAPI/blob/f2893cf6cb81cfed10252a83f721572a1bf2e7ce/lib/middleware.js#L311-L337
36,978
helion3/lodash-addons
src/getPrototype.js
getPrototype
function getPrototype(value) { let prototype; if (!_.isUndefined(value) && !_.isNull(value)) { if (!_.isObject(value)) { prototype = value.constructor.prototype; } else if (_.isFunction(value)) { prototype = value.prototype; } else { p...
javascript
function getPrototype(value) { let prototype; if (!_.isUndefined(value) && !_.isNull(value)) { if (!_.isObject(value)) { prototype = value.constructor.prototype; } else if (_.isFunction(value)) { prototype = value.prototype; } else { p...
[ "function", "getPrototype", "(", "value", ")", "{", "let", "prototype", ";", "if", "(", "!", "_", ".", "isUndefined", "(", "value", ")", "&&", "!", "_", ".", "isNull", "(", "value", ")", ")", "{", "if", "(", "!", "_", ".", "isObject", "(", "value...
Gets the prototype for the given value. @static @memberOf _ @category Util @param {*} value Source value @return {object} Found prototype or undefined. @example _.getPrototype(5); // => { toFixed: func(), ... }
[ "Gets", "the", "prototype", "for", "the", "given", "value", "." ]
83b5bf14258241e7ae35eef346151a332fdb6f50
https://github.com/helion3/lodash-addons/blob/83b5bf14258241e7ae35eef346151a332fdb6f50/src/getPrototype.js#L16-L32
36,979
helion3/lodash-addons
src/generateKey.js
generateKey
function generateKey(length) { const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; const possibleLength = possible.length - 1; let text = ''; _.times(getNumber(length, 16), () => { text += possible.charAt(_.random(possibleLength)); }); return text; }
javascript
function generateKey(length) { const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; const possibleLength = possible.length - 1; let text = ''; _.times(getNumber(length, 16), () => { text += possible.charAt(_.random(possibleLength)); }); return text; }
[ "function", "generateKey", "(", "length", ")", "{", "const", "possible", "=", "'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'", ";", "const", "possibleLength", "=", "possible", ".", "length", "-", "1", ";", "let", "text", "=", "''", ";", "_", "."...
Generates a random alphanumeric string with length n. @static @memberOf _ @category String @param {int} length Desired length. @return {string} String of random characters. @example _.generateKey(5); // => 'L7IpD'
[ "Generates", "a", "random", "alphanumeric", "string", "with", "length", "n", "." ]
83b5bf14258241e7ae35eef346151a332fdb6f50
https://github.com/helion3/lodash-addons/blob/83b5bf14258241e7ae35eef346151a332fdb6f50/src/generateKey.js#L17-L27
36,980
myrmex-org/myrmex
packages/api-gateway/src/cli/create-model.js
executeCommand
function executeCommand(parameters) { // If a name has been provided, we create the project directory const modelFilePath = path.join(process.cwd(), plugin.config.modelsPath); return mkdirpAsync(modelFilePath) .then(() => { const model = { type: 'object', properties: {} }; ...
javascript
function executeCommand(parameters) { // If a name has been provided, we create the project directory const modelFilePath = path.join(process.cwd(), plugin.config.modelsPath); return mkdirpAsync(modelFilePath) .then(() => { const model = { type: 'object', properties: {} }; ...
[ "function", "executeCommand", "(", "parameters", ")", "{", "// If a name has been provided, we create the project directory", "const", "modelFilePath", "=", "path", ".", "join", "(", "process", ".", "cwd", "(", ")", ",", "plugin", ".", "config", ".", "modelsPath", "...
Create the new model @param {Object} parameters - the parameters provided in the command and in the prompt @returns {Promise<null>} - The execution stops here
[ "Create", "the", "new", "model" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/cli/create-model.js#L42-L58
36,981
myrmex-org/myrmex
packages/iam/src/index.js
loadPolicies
function loadPolicies() { const policyConfigsPath = path.join(process.cwd(), plugin.config.policiesPath); // This event allows to inject code before loading all APIs return plugin.myrmex.fire('beforePoliciesLoad') .then(() => { // Retrieve configuration path of all API specifications return fs.readdirA...
javascript
function loadPolicies() { const policyConfigsPath = path.join(process.cwd(), plugin.config.policiesPath); // This event allows to inject code before loading all APIs return plugin.myrmex.fire('beforePoliciesLoad') .then(() => { // Retrieve configuration path of all API specifications return fs.readdirA...
[ "function", "loadPolicies", "(", ")", "{", "const", "policyConfigsPath", "=", "path", ".", "join", "(", "process", ".", "cwd", "(", ")", ",", "plugin", ".", "config", ".", "policiesPath", ")", ";", "// This event allows to inject code before loading all APIs", "re...
Load all policy configurations @return {Promise<[Policy]>} - promise of an array of policies
[ "Load", "all", "policy", "configurations" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/iam/src/index.js#L14-L46
36,982
myrmex-org/myrmex
packages/iam/src/index.js
loadPolicy
function loadPolicy(documentPath, name) { return plugin.myrmex.fire('beforePolicyLoad', documentPath, name) .spread((documentPath, name) => { // Because we use require() to get the document, it could either be a JSON file // or the content exported by a node module // But because require() caches the co...
javascript
function loadPolicy(documentPath, name) { return plugin.myrmex.fire('beforePolicyLoad', documentPath, name) .spread((documentPath, name) => { // Because we use require() to get the document, it could either be a JSON file // or the content exported by a node module // But because require() caches the co...
[ "function", "loadPolicy", "(", "documentPath", ",", "name", ")", "{", "return", "plugin", ".", "myrmex", ".", "fire", "(", "'beforePolicyLoad'", ",", "documentPath", ",", "name", ")", ".", "spread", "(", "(", "documentPath", ",", "name", ")", "=>", "{", ...
Load a policy @param {string} documentPath - path to the document file @param {string} name - the policy name @returns {Promise<Policy>} - the promise of a policy
[ "Load", "a", "policy" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/iam/src/index.js#L54-L71
36,983
myrmex-org/myrmex
packages/iam/src/index.js
findPolicies
function findPolicies(identifiers) { return loadPolicies() .then((policies) => { return _.filter(policies, (policy) => { return identifiers.indexOf(policy.name) !== -1; }); }); }
javascript
function findPolicies(identifiers) { return loadPolicies() .then((policies) => { return _.filter(policies, (policy) => { return identifiers.indexOf(policy.name) !== -1; }); }); }
[ "function", "findPolicies", "(", "identifiers", ")", "{", "return", "loadPolicies", "(", ")", ".", "then", "(", "(", "policies", ")", "=>", "{", "return", "_", ".", "filter", "(", "policies", ",", "(", "policy", ")", "=>", "{", "return", "identifiers", ...
Retrieve policies by their identifier @param {Array} identifiers - an array of policy identifiers @return {Promise<[Policy]>} - promise of an array of policies
[ "Retrieve", "policies", "by", "their", "identifier" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/iam/src/index.js#L78-L83
36,984
myrmex-org/myrmex
packages/iam/src/index.js
registerCommands
function registerCommands(icli) { return Promise.all([ require('./cli/create-policy')(icli), require('./cli/create-role')(icli), require('./cli/deploy-policies')(icli), require('./cli/deploy-roles')(icli) ]) .then(() => { return Promise.resolve([]); }); ...
javascript
function registerCommands(icli) { return Promise.all([ require('./cli/create-policy')(icli), require('./cli/create-role')(icli), require('./cli/deploy-policies')(icli), require('./cli/deploy-roles')(icli) ]) .then(() => { return Promise.resolve([]); }); ...
[ "function", "registerCommands", "(", "icli", ")", "{", "return", "Promise", ".", "all", "(", "[", "require", "(", "'./cli/create-policy'", ")", "(", "icli", ")", ",", "require", "(", "'./cli/create-role'", ")", "(", "icli", ")", ",", "require", "(", "'./cl...
Hooks that add new commands to the Myrmex CLI @returns {Promise}
[ "Hooks", "that", "add", "new", "commands", "to", "the", "Myrmex", "CLI" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/iam/src/index.js#L174-L184
36,985
helion3/lodash-addons
src/hasInOfType.js
hasInOfType
function hasInOfType(value, path, validator) { return _.hasIn(value, path) ? validator(_.get(value, path)) : false; }
javascript
function hasInOfType(value, path, validator) { return _.hasIn(value, path) ? validator(_.get(value, path)) : false; }
[ "function", "hasInOfType", "(", "value", ",", "path", ",", "validator", ")", "{", "return", "_", ".", "hasIn", "(", "value", ",", "path", ")", "?", "validator", "(", "_", ".", "get", "(", "value", ",", "path", ")", ")", ":", "false", ";", "}" ]
If _.hasIn returns true, run a validator on value. @static @memberOf _ @category Object @param {mixed} value Collection for _.hasIn @param {string|number} path Path. @param {function} validator Function to validate value. @return {boolean} Whether collection has the path and it passes validation
[ "If", "_", ".", "hasIn", "returns", "true", "run", "a", "validator", "on", "value", "." ]
83b5bf14258241e7ae35eef346151a332fdb6f50
https://github.com/helion3/lodash-addons/blob/83b5bf14258241e7ae35eef346151a332fdb6f50/src/hasInOfType.js#L14-L16
36,986
stanford-oval/thingpedia-api
lib/helpers/oauth2.js
rot13
function rot13(x) { return Array.prototype.map.call(x, (ch) => { var code = ch.charCodeAt(0); if (code >= 0x41 && code <= 0x5a) code = (((code - 0x41) + 13) % 26) + 0x41; else if (code >= 0x61 && code <= 0x7a) code = (((code - 0x61) + 13) % 26) + 0x61; return...
javascript
function rot13(x) { return Array.prototype.map.call(x, (ch) => { var code = ch.charCodeAt(0); if (code >= 0x41 && code <= 0x5a) code = (((code - 0x41) + 13) % 26) + 0x41; else if (code >= 0x61 && code <= 0x7a) code = (((code - 0x61) + 13) % 26) + 0x61; return...
[ "function", "rot13", "(", "x", ")", "{", "return", "Array", ".", "prototype", ".", "map", ".", "call", "(", "x", ",", "(", "ch", ")", "=>", "{", "var", "code", "=", "ch", ".", "charCodeAt", "(", "0", ")", ";", "if", "(", "code", ">=", "0x41", ...
encryption ;)
[ "encryption", ";", ")" ]
a5e795ec5384b0ebce462793014643dd1c7dac36
https://github.com/stanford-oval/thingpedia-api/blob/a5e795ec5384b0ebce462793014643dd1c7dac36/lib/helpers/oauth2.js#L15-L25
36,987
nodetiles/nodetiles-core
lib/Map.js
function(options) { options = options || {}; this.datasources = []; this.styles = []; this.projection = DEFAULT_PROJECTION; this.assetsPath = "."; if (options.projection){ this.projection = projector.util.cleanProjString(options.projection); console.log(this.projection); } this.boundsBu...
javascript
function(options) { options = options || {}; this.datasources = []; this.styles = []; this.projection = DEFAULT_PROJECTION; this.assetsPath = "."; if (options.projection){ this.projection = projector.util.cleanProjString(options.projection); console.log(this.projection); } this.boundsBu...
[ "function", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "datasources", "=", "[", "]", ";", "this", ".", "styles", "=", "[", "]", ";", "this", ".", "projection", "=", "DEFAULT_PROJECTION", ";", "this", ".", ...
"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs";
[ "+", "proj", "=", "merc", "+", "a", "=", "6378137", "+", "b", "=", "6378137", "+", "lat_ts", "=", "0", ".", "0", "+", "lon_0", "=", "0", ".", "0", "+", "x_0", "=", "0", ".", "0", "+", "y_0", "=", "0", "+", "k", "=", "1", ".", "0", "+", ...
117853de6935081f7ebefb19c766ab6c1bded244
https://github.com/nodetiles/nodetiles-core/blob/117853de6935081f7ebefb19c766ab6c1bded244/lib/Map.js#L20-L37
36,988
nodetiles/nodetiles-core
lib/Map.js
function() { var projection = this.projection; this.datasources.forEach(function(datasource) { datasource.load && datasource.load(function(error) { datasource.project && datasource.project(projection); }); }); }
javascript
function() { var projection = this.projection; this.datasources.forEach(function(datasource) { datasource.load && datasource.load(function(error) { datasource.project && datasource.project(projection); }); }); }
[ "function", "(", ")", "{", "var", "projection", "=", "this", ".", "projection", ";", "this", ".", "datasources", ".", "forEach", "(", "function", "(", "datasource", ")", "{", "datasource", ".", "load", "&&", "datasource", ".", "load", "(", "function", "(...
Triggers all the map's datasources to prepare themselves. Usually this connecting to a database, loading and processing a file, etc. Calling this method is completely optional, but allows you to speed up rendering of the first tile.
[ "Triggers", "all", "the", "map", "s", "datasources", "to", "prepare", "themselves", ".", "Usually", "this", "connecting", "to", "a", "database", "loading", "and", "processing", "a", "file", "etc", ".", "Calling", "this", "method", "is", "completely", "optional...
117853de6935081f7ebefb19c766ab6c1bded244
https://github.com/nodetiles/nodetiles-core/blob/117853de6935081f7ebefb19c766ab6c1bded244/lib/Map.js#L196-L204
36,989
helion3/lodash-addons
src/differenceKeys.js
differenceKeys
function differenceKeys(first, second) { return filterKeys(first, function(val, key) { return val !== second[key]; }); }
javascript
function differenceKeys(first, second) { return filterKeys(first, function(val, key) { return val !== second[key]; }); }
[ "function", "differenceKeys", "(", "first", ",", "second", ")", "{", "return", "filterKeys", "(", "first", ",", "function", "(", "val", ",", "key", ")", "{", "return", "val", "!==", "second", "[", "key", "]", ";", "}", ")", ";", "}" ]
Gets indices for which elements differ between two arrays. @static @memberOf _ @category Collection @param {array} first First array @param {array} second Second array @return {array} Array of indices of differing elements @example _.differenceKeys([false, true], [false, false]); // => [1]
[ "Gets", "indices", "for", "which", "elements", "differ", "between", "two", "arrays", "." ]
83b5bf14258241e7ae35eef346151a332fdb6f50
https://github.com/helion3/lodash-addons/blob/83b5bf14258241e7ae35eef346151a332fdb6f50/src/differenceKeys.js#L17-L21
36,990
helion3/lodash-addons
src/slugify.js
slugify
function slugify(string) { return _.deburr(string).trim().toLowerCase().replace(/ /g, '-').replace(/([^a-zA-Z0-9\._-]+)/, ''); }
javascript
function slugify(string) { return _.deburr(string).trim().toLowerCase().replace(/ /g, '-').replace(/([^a-zA-Z0-9\._-]+)/, ''); }
[ "function", "slugify", "(", "string", ")", "{", "return", "_", ".", "deburr", "(", "string", ")", ".", "trim", "(", ")", ".", "toLowerCase", "(", ")", ".", "replace", "(", "/", " ", "/", "g", ",", "'-'", ")", ".", "replace", "(", "/", "([^a-zA-Z0...
Generates a url-safe "slug" form of a string. @static @memberOf _ @category String @param {string} string String value. @return {string} URL-safe form of a string. @example _.slugify('A Test'); // => a-test
[ "Generates", "a", "url", "-", "safe", "slug", "form", "of", "a", "string", "." ]
83b5bf14258241e7ae35eef346151a332fdb6f50
https://github.com/helion3/lodash-addons/blob/83b5bf14258241e7ae35eef346151a332fdb6f50/src/slugify.js#L16-L18
36,991
helion3/lodash-addons
src/objectWith.js
objectWith
function objectWith() { const args = _.reverse(arguments); const [value, path] = _.take(args, 2); const object = _.nth(args, 2) || {}; return _.set(object, path, value); }
javascript
function objectWith() { const args = _.reverse(arguments); const [value, path] = _.take(args, 2); const object = _.nth(args, 2) || {}; return _.set(object, path, value); }
[ "function", "objectWith", "(", ")", "{", "const", "args", "=", "_", ".", "reverse", "(", "arguments", ")", ";", "const", "[", "value", ",", "path", "]", "=", "_", ".", "take", "(", "args", ",", "2", ")", ";", "const", "object", "=", "_", ".", "...
Shorthand object creation when sole property is a variable, or a path. @static @memberOf _ @category Object @param {[object]} object Existing object (optional) @param {string|number} path Property @param {mixed} value Value @return {object} Resulting object @example // To create a new object: _.objectWith('key', 'va...
[ "Shorthand", "object", "creation", "when", "sole", "property", "is", "a", "variable", "or", "a", "path", "." ]
83b5bf14258241e7ae35eef346151a332fdb6f50
https://github.com/helion3/lodash-addons/blob/83b5bf14258241e7ae35eef346151a332fdb6f50/src/objectWith.js#L33-L39
36,992
myrmex-org/myrmex
packages/api-gateway/src/cli/create-api.js
executeCommand
function executeCommand(parameters) { // If a name has been provided, we create the project directory const specFilePath = path.join(process.cwd(), plugin.config.apisPath, parameters.apiIdentifier); return mkdirpAsync(specFilePath) .then(() => { const spec = { swagger: '2.0', info:...
javascript
function executeCommand(parameters) { // If a name has been provided, we create the project directory const specFilePath = path.join(process.cwd(), plugin.config.apisPath, parameters.apiIdentifier); return mkdirpAsync(specFilePath) .then(() => { const spec = { swagger: '2.0', info:...
[ "function", "executeCommand", "(", "parameters", ")", "{", "// If a name has been provided, we create the project directory", "const", "specFilePath", "=", "path", ".", "join", "(", "process", ".", "cwd", "(", ")", ",", "plugin", ".", "config", ".", "apisPath", ",",...
Create the new api @param {Object} parameters - the parameters provided in the command and in the prompt @returns {Promise<null>} - The execution stops here
[ "Create", "the", "new", "api" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/cli/create-api.js#L61-L87
36,993
Joe3Ray/vue-to-js
lib/index.js
generateCode
function generateCode(filepath) { var mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'amd'; // support 4 types of output as follows: // amd/commonjs/global/umd var choice = { amd: { prefix: 'define([\'module\', \'exports\'], function (module, exports) {'...
javascript
function generateCode(filepath) { var mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'amd'; // support 4 types of output as follows: // amd/commonjs/global/umd var choice = { amd: { prefix: 'define([\'module\', \'exports\'], function (module, exports) {'...
[ "function", "generateCode", "(", "filepath", ")", "{", "var", "mode", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "'amd'", ";", "// support 4 types of output as follow...
compile vue file to js code @param {string} filepath the path of .vue file @param {string} mode the output mode, it should be one of amd/commonjs/global/umd @return {string} js code with appointed mode
[ "compile", "vue", "file", "to", "js", "code" ]
c98a09ed5c00998efab45e6c65c79bf480d1a67a
https://github.com/Joe3Ray/vue-to-js/blob/c98a09ed5c00998efab45e6c65c79bf480d1a67a/lib/index.js#L85-L128
36,994
Joe3Ray/vue-to-js
lib/index.js
compile
function compile(_ref2) { var resource = _ref2.resource, dest = _ref2.dest, mode = _ref2.mode; dest = dest || 'dest'; resource = resource || '*.vue'; mode = ['amd', 'commonjs', 'umd', 'global'].indexOf(mode) > -1 ? mode : 'amd'; if ((0, _fs.existsSync)(dest)) { if (!(0, _fs....
javascript
function compile(_ref2) { var resource = _ref2.resource, dest = _ref2.dest, mode = _ref2.mode; dest = dest || 'dest'; resource = resource || '*.vue'; mode = ['amd', 'commonjs', 'umd', 'global'].indexOf(mode) > -1 ? mode : 'amd'; if ((0, _fs.existsSync)(dest)) { if (!(0, _fs....
[ "function", "compile", "(", "_ref2", ")", "{", "var", "resource", "=", "_ref2", ".", "resource", ",", "dest", "=", "_ref2", ".", "dest", ",", "mode", "=", "_ref2", ".", "mode", ";", "dest", "=", "dest", "||", "'dest'", ";", "resource", "=", "resource...
compile .vue to .js with appointed destination directory @param {Object} options compile config info @param {string} options.resource glob pattern file path @param {string} options.dest output destination directory @param {string} options.mode one of amd/commonjs/umd/global
[ "compile", ".", "vue", "to", ".", "js", "with", "appointed", "destination", "directory" ]
c98a09ed5c00998efab45e6c65c79bf480d1a67a
https://github.com/Joe3Ray/vue-to-js/blob/c98a09ed5c00998efab45e6c65c79bf480d1a67a/lib/index.js#L138-L169
36,995
XadillaX/ez-upyun
lib/upyun.js
function(callback) { fs.exists(file, function(exists) { if(!exists) { rawData = file; if(typeof rawData === "string") rawData = new Buffer(file); return callback(); } fs.readFile(file, functi...
javascript
function(callback) { fs.exists(file, function(exists) { if(!exists) { rawData = file; if(typeof rawData === "string") rawData = new Buffer(file); return callback(); } fs.readFile(file, functi...
[ "function", "(", "callback", ")", "{", "fs", ".", "exists", "(", "file", ",", "function", "(", "exists", ")", "{", "if", "(", "!", "exists", ")", "{", "rawData", "=", "file", ";", "if", "(", "typeof", "rawData", "===", "\"string\"", ")", "rawData", ...
get the raw data @param callback
[ "get", "the", "raw", "data" ]
f6111bc855050f77d7d1abfb0dc651712774f984
https://github.com/XadillaX/ez-upyun/blob/f6111bc855050f77d7d1abfb0dc651712774f984/lib/upyun.js#L402-L416
36,996
XadillaX/ez-upyun
lib/upyun.js
function(callback) { spidex.put(self.baseUri + "/" + uploadFilename, { data: rawData, header: header, charset: "utf8" }, function(html, status, respHeader) { if(200 !== status && 201 !== status) { return c...
javascript
function(callback) { spidex.put(self.baseUri + "/" + uploadFilename, { data: rawData, header: header, charset: "utf8" }, function(html, status, respHeader) { if(200 !== status && 201 !== status) { return c...
[ "function", "(", "callback", ")", "{", "spidex", ".", "put", "(", "self", ".", "baseUri", "+", "\"/\"", "+", "uploadFilename", ",", "{", "data", ":", "rawData", ",", "header", ":", "header", ",", "charset", ":", "\"utf8\"", "}", ",", "function", "(", ...
use upyun api to upload the file and get result @param callback
[ "use", "upyun", "api", "to", "upload", "the", "file", "and", "get", "result" ]
f6111bc855050f77d7d1abfb0dc651712774f984
https://github.com/XadillaX/ez-upyun/blob/f6111bc855050f77d7d1abfb0dc651712774f984/lib/upyun.js#L452-L470
36,997
myrmex-org/myrmex
packages/api-gateway/src/cli/create-endpoint.js
executeCommand
function executeCommand(parameters) { if (!parameters.role && parameters.roleManually) { parameters.role = parameters.roleManually; } if (parameters.resourcePath.charAt(0) !== '/') { parameters.resourcePath = '/' + parameters.resourcePath; } // We calculate the path where we will save the specification and...
javascript
function executeCommand(parameters) { if (!parameters.role && parameters.roleManually) { parameters.role = parameters.roleManually; } if (parameters.resourcePath.charAt(0) !== '/') { parameters.resourcePath = '/' + parameters.resourcePath; } // We calculate the path where we will save the specification and...
[ "function", "executeCommand", "(", "parameters", ")", "{", "if", "(", "!", "parameters", ".", "role", "&&", "parameters", ".", "roleManually", ")", "{", "parameters", ".", "role", "=", "parameters", ".", "roleManually", ";", "}", "if", "(", "parameters", "...
Create the new endpoint @param {Object} parameters - the parameters provided in the command and in the prompt @returns {Promise<null>} - The execution stops here
[ "Create", "the", "new", "endpoint" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/api-gateway/src/cli/create-endpoint.js#L207-L271
36,998
myrmex-org/myrmex
packages/iam/src/cli/create-policy.js
executeCommand
function executeCommand(parameters) { const configFilePath = path.join(process.cwd(), plugin.config.policiesPath); return mkdirpAsync(configFilePath) .then(() => { // We create the configuration file of the Lambda const document = { Version: '2012-10-17', Statement: [{ ...
javascript
function executeCommand(parameters) { const configFilePath = path.join(process.cwd(), plugin.config.policiesPath); return mkdirpAsync(configFilePath) .then(() => { // We create the configuration file of the Lambda const document = { Version: '2012-10-17', Statement: [{ ...
[ "function", "executeCommand", "(", "parameters", ")", "{", "const", "configFilePath", "=", "path", ".", "join", "(", "process", ".", "cwd", "(", ")", ",", "plugin", ".", "config", ".", "policiesPath", ")", ";", "return", "mkdirpAsync", "(", "configFilePath",...
Create the new policy @param {Object} parameters - the parameters provided in the command and in the prompt @returns {Promise<null>} - The execution stops here
[ "Create", "the", "new", "policy" ]
9dba3b8686d87bd603779b00c0545cd12ccad43c
https://github.com/myrmex-org/myrmex/blob/9dba3b8686d87bd603779b00c0545cd12ccad43c/packages/iam/src/cli/create-policy.js#L41-L63
36,999
helion3/lodash-addons
src/transformValueMap.js
transformValueMap
function transformValueMap(collection, path, transformer) { _.each(collection, (element) => { let val = _.get(element, path); if (!_.isUndefined(val)) { _.set(element, path, transformer(val)); } }); return collection; }
javascript
function transformValueMap(collection, path, transformer) { _.each(collection, (element) => { let val = _.get(element, path); if (!_.isUndefined(val)) { _.set(element, path, transformer(val)); } }); return collection; }
[ "function", "transformValueMap", "(", "collection", ",", "path", ",", "transformer", ")", "{", "_", ".", "each", "(", "collection", ",", "(", "element", ")", "=>", "{", "let", "val", "=", "_", ".", "get", "(", "element", ",", "path", ")", ";", "if", ...
Transforms a value in each element of collection if the path is not undefined. @static @memberOf _ @category Array @param {Array} collection Array of objects @param {string} path The path of the value to transform @param {function} transformer Callback which returns the transformed value @return {Array} Returns the ar...
[ "Transforms", "a", "value", "in", "each", "element", "of", "collection", "if", "the", "path", "is", "not", "undefined", "." ]
83b5bf14258241e7ae35eef346151a332fdb6f50
https://github.com/helion3/lodash-addons/blob/83b5bf14258241e7ae35eef346151a332fdb6f50/src/transformValueMap.js#L14-L24