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
34,700
ethjs/ethjs-account
src/index.js
publicToAddress
function publicToAddress(publicKey) { if (!Buffer.isBuffer(publicKey)) { throw new Error('[ethjs-account] public key must be a buffer object in order to get public key address'); } return getAddress(sha3(publicKey, true).slice(12).toString('hex')); }
javascript
function publicToAddress(publicKey) { if (!Buffer.isBuffer(publicKey)) { throw new Error('[ethjs-account] public key must be a buffer object in order to get public key address'); } return getAddress(sha3(publicKey, true).slice(12).toString('hex')); }
[ "function", "publicToAddress", "(", "publicKey", ")", "{", "if", "(", "!", "Buffer", ".", "isBuffer", "(", "publicKey", ")", ")", "{", "throw", "new", "Error", "(", "'[ethjs-account] public key must be a buffer object in order to get public key address'", ")", ";", "}...
Returns the Ethereum standard address of a public sepk key. @method publicToAddress @param {Object} publicKey a single public key Buffer object @returns {String} address the 20 byte Ethereum address
[ "Returns", "the", "Ethereum", "standard", "address", "of", "a", "public", "sepk", "key", "." ]
7cbdd667a8c21c8546436650d17bcc9735d7d6bb
https://github.com/ethjs/ethjs-account/blob/7cbdd667a8c21c8546436650d17bcc9735d7d6bb/src/index.js#L88-L92
34,701
ethjs/ethjs-account
src/index.js
privateToAccount
function privateToAccount(privateKey) { const publicKey = privateToPublic(privateKey, true); return { privateKey: `0x${stripHexPrefix(privateKey)}`, publicKey: `0x${publicKey.toString('hex')}`, address: publicToAddress(publicKey), }; }
javascript
function privateToAccount(privateKey) { const publicKey = privateToPublic(privateKey, true); return { privateKey: `0x${stripHexPrefix(privateKey)}`, publicKey: `0x${publicKey.toString('hex')}`, address: publicToAddress(publicKey), }; }
[ "function", "privateToAccount", "(", "privateKey", ")", "{", "const", "publicKey", "=", "privateToPublic", "(", "privateKey", ",", "true", ")", ";", "return", "{", "privateKey", ":", "`", "${", "stripHexPrefix", "(", "privateKey", ")", "}", "`", ",", "public...
Returns an Ethereum account address, private and public key based on the public key. @method privateToAccount @param {String} privateKey a single string of entropy longer than 32 chars @returns {Object} output the Ethereum account address, and keys as hex strings
[ "Returns", "an", "Ethereum", "account", "address", "private", "and", "public", "key", "based", "on", "the", "public", "key", "." ]
7cbdd667a8c21c8546436650d17bcc9735d7d6bb
https://github.com/ethjs/ethjs-account/blob/7cbdd667a8c21c8546436650d17bcc9735d7d6bb/src/index.js#L102-L110
34,702
ethjs/ethjs-account
src/index.js
generate
function generate(entropy) { if (typeof entropy !== 'string') { throw new Error(`[ethjs-account] while generating account, invalid input type: '${typeof(entropy)}' should be type 'String'.`); } if (entropy.length < 32) { throw new Error(`[ethjs-account] while generating account, entropy value not random and long en...
javascript
function generate(entropy) { if (typeof entropy !== 'string') { throw new Error(`[ethjs-account] while generating account, invalid input type: '${typeof(entropy)}' should be type 'String'.`); } if (entropy.length < 32) { throw new Error(`[ethjs-account] while generating account, entropy value not random and long en...
[ "function", "generate", "(", "entropy", ")", "{", "if", "(", "typeof", "entropy", "!==", "'string'", ")", "{", "throw", "new", "Error", "(", "`", "${", "typeof", "(", "entropy", ")", "}", "`", ")", ";", "}", "if", "(", "entropy", ".", "length", "<"...
Create a single Ethereum account address, private and public key. @method generate @param {String} entropy a single string of entropy longer than 32 chars @returns {Object} output the Ethereum account address, and keys
[ "Create", "a", "single", "Ethereum", "account", "address", "private", "and", "public", "key", "." ]
7cbdd667a8c21c8546436650d17bcc9735d7d6bb
https://github.com/ethjs/ethjs-account/blob/7cbdd667a8c21c8546436650d17bcc9735d7d6bb/src/index.js#L120-L125
34,703
doggan/diablo-file-formats
lib/dun.js
DunFile
function DunFile(startCoord, rawPillarData, dunName) { this.startCol = startCoord[0]; this.startRow = startCoord[1]; this.fileName = dunName; this.rawPillarData = rawPillarData; this.rawColCount = this.rawPillarData.length; this.rawRowCount = (this.rawColCount > 0) ? this.rawPillarData[0].lengt...
javascript
function DunFile(startCoord, rawPillarData, dunName) { this.startCol = startCoord[0]; this.startRow = startCoord[1]; this.fileName = dunName; this.rawPillarData = rawPillarData; this.rawColCount = this.rawPillarData.length; this.rawRowCount = (this.rawColCount > 0) ? this.rawPillarData[0].lengt...
[ "function", "DunFile", "(", "startCoord", ",", "rawPillarData", ",", "dunName", ")", "{", "this", ".", "startCol", "=", "startCoord", "[", "0", "]", ";", "this", ".", "startRow", "=", "startCoord", "[", "1", "]", ";", "this", ".", "fileName", "=", "dun...
DUN files contain information for arranging the squares of a TIL file. Multiple DUN files can be pieced together to form entire levels. For example, the 'town' level is a combination of 4 DUN files. In addition, DUN files also provide information regarding dungeon monsters and object ids.
[ "DUN", "files", "contain", "information", "for", "arranging", "the", "squares", "of", "a", "TIL", "file", ".", "Multiple", "DUN", "files", "can", "be", "pieced", "together", "to", "form", "entire", "levels", ".", "For", "example", "the", "town", "level", "...
1c468868361752b01a1164d6135939621e18dab5
https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/dun.js#L15-L27
34,704
simoami/mimik
runner/reporters/html/base/js/vendor/magnific-popup/jquery.magnific-popup.js
function(isLarge) { var el; if(isLarge) { el = mfp.currItem.img; } else { el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem); } var offset = el.offset(); var paddingTop = parseInt(el.css('padding-top'),10); var paddingBottom = parseInt(el.css('padding-bottom'),10); offset.top -= (...
javascript
function(isLarge) { var el; if(isLarge) { el = mfp.currItem.img; } else { el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem); } var offset = el.offset(); var paddingTop = parseInt(el.css('padding-top'),10); var paddingBottom = parseInt(el.css('padding-bottom'),10); offset.top -= (...
[ "function", "(", "isLarge", ")", "{", "var", "el", ";", "if", "(", "isLarge", ")", "{", "el", "=", "mfp", ".", "currItem", ".", "img", ";", "}", "else", "{", "el", "=", "mfp", ".", "st", ".", "zoom", ".", "opener", "(", "mfp", ".", "currItem", ...
Get element postion relative to viewport
[ "Get", "element", "postion", "relative", "to", "viewport" ]
464a4679bba671d43aea6660485d8db9fa767b1b
https://github.com/simoami/mimik/blob/464a4679bba671d43aea6660485d8db9fa767b1b/runner/reporters/html/base/js/vendor/magnific-popup/jquery.magnific-popup.js#L1531-L1564
34,705
quorrajs/Ouch
handler/JsonResponseHandler.js
JsonResponseHandler
function JsonResponseHandler(onlyForAjaxOrJsonRequests, returnFrames, sendResponse) { JsonResponseHandler.super_.call(this); /** * Should Ouch push output directly to the client? * If this is false, output will be passed to the callback * provided to the handle method. * * @type {boole...
javascript
function JsonResponseHandler(onlyForAjaxOrJsonRequests, returnFrames, sendResponse) { JsonResponseHandler.super_.call(this); /** * Should Ouch push output directly to the client? * If this is false, output will be passed to the callback * provided to the handle method. * * @type {boole...
[ "function", "JsonResponseHandler", "(", "onlyForAjaxOrJsonRequests", ",", "returnFrames", ",", "sendResponse", ")", "{", "JsonResponseHandler", ".", "super_", ".", "call", "(", "this", ")", ";", "/**\n * Should Ouch push output directly to the client?\n * If this is fal...
Catches an exception and converts it to a JSON response. Additionally can also return exception frames for consumption by an API.
[ "Catches", "an", "exception", "and", "converts", "it", "to", "a", "JSON", "response", ".", "Additionally", "can", "also", "return", "exception", "frames", "for", "consumption", "by", "an", "API", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/handler/JsonResponseHandler.js#L20-L47
34,706
quorrajs/Ouch
handler/Handler.js
Handler
function Handler() { if (this.constructor === Handler) { throw new Error("Can't instantiate abstract class!"); } /** * @var {Object} * @protected */ this.__inspector; /** * @var {Object} * @protected */ this.__run; /** * @var {Object} * @pro...
javascript
function Handler() { if (this.constructor === Handler) { throw new Error("Can't instantiate abstract class!"); } /** * @var {Object} * @protected */ this.__inspector; /** * @var {Object} * @protected */ this.__run; /** * @var {Object} * @pro...
[ "function", "Handler", "(", ")", "{", "if", "(", "this", ".", "constructor", "===", "Handler", ")", "{", "throw", "new", "Error", "(", "\"Can't instantiate abstract class!\"", ")", ";", "}", "/**\n * @var {Object}\n * @protected\n */", "this", ".", "__in...
Abstract implementation of a error handler. @class @abstract @author: Harish Anchu <harishanchu@gmail.com> @copyright 2015, Harish Anchu. All rights reserved. @license Licensed under MIT (https://github.com/quorrajs/Ouch/blob/master/LICENSE)
[ "Abstract", "implementation", "of", "a", "error", "handler", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/handler/Handler.js#L11-L39
34,707
Planeshifter/node-wordnet-magic
lib/morphy.js
morphyPromise
function morphyPromise( str, pos ) { /* jshint: -WO40 */ var substitutions; var query; var i; if ( !pos ) { var resArray = []; for ( i = 0; i < POS_TAGS.length; i++ ){ resArray.push( morphyPromise( str, POS_TAGS[i] ) ); } return Promise.all( resArray ).then( function onDone( data ) { var reducedArray...
javascript
function morphyPromise( str, pos ) { /* jshint: -WO40 */ var substitutions; var query; var i; if ( !pos ) { var resArray = []; for ( i = 0; i < POS_TAGS.length; i++ ){ resArray.push( morphyPromise( str, POS_TAGS[i] ) ); } return Promise.all( resArray ).then( function onDone( data ) { var reducedArray...
[ "function", "morphyPromise", "(", "str", ",", "pos", ")", "{", "/* jshint: -WO40 */", "var", "substitutions", ";", "var", "query", ";", "var", "i", ";", "if", "(", "!", "pos", ")", "{", "var", "resArray", "=", "[", "]", ";", "for", "(", "i", "=", "...
Extract base form of supplied word using Morphy algorithm. @param {string} str - input string @param {string} pos - part of speech @returns {Promise} results promise
[ "Extract", "base", "form", "of", "supplied", "word", "using", "Morphy", "algorithm", "." ]
a7c6000bd63c79562ebb1e9a85820809a9a17058
https://github.com/Planeshifter/node-wordnet-magic/blob/a7c6000bd63c79562ebb1e9a85820809a9a17058/lib/morphy.js#L23-L94
34,708
Streampunk/kelvinadon
util/meta.js
function (type, name) { if (metaDictByName[type][name]) { return metaDictByName[type][name]; } else if (name.endsWith('Type')) { return metaDictByName[type][name.slice(0, -4)]; } return undefined; }
javascript
function (type, name) { if (metaDictByName[type][name]) { return metaDictByName[type][name]; } else if (name.endsWith('Type')) { return metaDictByName[type][name.slice(0, -4)]; } return undefined; }
[ "function", "(", "type", ",", "name", ")", "{", "if", "(", "metaDictByName", "[", "type", "]", "[", "name", "]", ")", "{", "return", "metaDictByName", "[", "type", "]", "[", "name", "]", ";", "}", "else", "if", "(", "name", ".", "endsWith", "(", ...
For use when already inside a promise
[ "For", "use", "when", "already", "inside", "a", "promise" ]
75dc0a22428fd57073806e7de0bf1364883958e4
https://github.com/Streampunk/kelvinadon/blob/75dc0a22428fd57073806e7de0bf1364883958e4/util/meta.js#L649-L656
34,709
richardeoin/nodejs-fft-windowing
windowing.js
window
function window(data_array, windowing_function, alpha) { var datapoints = data_array.length; /* For each item in the array */ for (var n=0; n<datapoints; ++n) { /* Apply the windowing function */ data_array[n] *= windowing_function(n, datapoints, alpha); } return data_array; }
javascript
function window(data_array, windowing_function, alpha) { var datapoints = data_array.length; /* For each item in the array */ for (var n=0; n<datapoints; ++n) { /* Apply the windowing function */ data_array[n] *= windowing_function(n, datapoints, alpha); } return data_array; }
[ "function", "window", "(", "data_array", ",", "windowing_function", ",", "alpha", ")", "{", "var", "datapoints", "=", "data_array", ".", "length", ";", "/* For each item in the array */", "for", "(", "var", "n", "=", "0", ";", "n", "<", "datapoints", ";", "+...
Applies a Windowing Function to an array.
[ "Applies", "a", "Windowing", "Function", "to", "an", "array", "." ]
9762d07570046b7f2d255791cee5772ce1865a22
https://github.com/richardeoin/nodejs-fft-windowing/blob/9762d07570046b7f2d255791cee5772ce1865a22/windowing.js#L81-L91
34,710
marchah/node-countries
index.js
getCountryByName
function getCountryByName(name, useAlias) { if (!_.isString(name)) return undefined; return _.find(countries, (country) => { if (useAlias) { return country.name.toUpperCase() === name.toUpperCase() || _.find(country.alias, (alias) => (alias.toUpperCase() === name.toUpperCase())); } retur...
javascript
function getCountryByName(name, useAlias) { if (!_.isString(name)) return undefined; return _.find(countries, (country) => { if (useAlias) { return country.name.toUpperCase() === name.toUpperCase() || _.find(country.alias, (alias) => (alias.toUpperCase() === name.toUpperCase())); } retur...
[ "function", "getCountryByName", "(", "name", ",", "useAlias", ")", "{", "if", "(", "!", "_", ".", "isString", "(", "name", ")", ")", "return", "undefined", ";", "return", "_", ".", "find", "(", "countries", ",", "(", "country", ")", "=>", "{", "if", ...
Find the country object of the given country name @param {String} name country name @param {Boolean} [useAlias] use alias flag, default `false` @return {Object} country country object
[ "Find", "the", "country", "object", "of", "the", "given", "country", "name" ]
4ec36f37adbf8293c9a9d4872136750b78291e8d
https://github.com/marchah/node-countries/blob/4ec36f37adbf8293c9a9d4872136750b78291e8d/index.js#L19-L29
34,711
marchah/node-countries
index.js
getCountryByNameOrShortName
function getCountryByNameOrShortName(name, useAlias) { if (!_.isString(name)) return undefined; return _.find(countries, (country) => { if (useAlias) { return country.name.toUpperCase() === name.toUpperCase() || country.alpha2.toUpperCase() === name.toUpperCase() || _.find(country.alias,...
javascript
function getCountryByNameOrShortName(name, useAlias) { if (!_.isString(name)) return undefined; return _.find(countries, (country) => { if (useAlias) { return country.name.toUpperCase() === name.toUpperCase() || country.alpha2.toUpperCase() === name.toUpperCase() || _.find(country.alias,...
[ "function", "getCountryByNameOrShortName", "(", "name", ",", "useAlias", ")", "{", "if", "(", "!", "_", ".", "isString", "(", "name", ")", ")", "return", "undefined", ";", "return", "_", ".", "find", "(", "countries", ",", "(", "country", ")", "=>", "{...
Find the country object of the given country name or short name @param {String} name country name or short name (alpha2) @param {Boolean} [useAlias] use alias flag, default `false` @return {Object} country country object
[ "Find", "the", "country", "object", "of", "the", "given", "country", "name", "or", "short", "name" ]
4ec36f37adbf8293c9a9d4872136750b78291e8d
https://github.com/marchah/node-countries/blob/4ec36f37adbf8293c9a9d4872136750b78291e8d/index.js#L38-L49
34,712
marchah/node-countries
index.js
getProvinceByName
function getProvinceByName(name, useAlias) { if (!_.isString(name) || !_.isArray(this.provinces)) return undefined; return _.find(this.provinces, (province) => { if (useAlias) { return province.name.toUpperCase() === name.toUpperCase() || _.find(province.alias, (alias) => (alias.toUpperCase() ==...
javascript
function getProvinceByName(name, useAlias) { if (!_.isString(name) || !_.isArray(this.provinces)) return undefined; return _.find(this.provinces, (province) => { if (useAlias) { return province.name.toUpperCase() === name.toUpperCase() || _.find(province.alias, (alias) => (alias.toUpperCase() ==...
[ "function", "getProvinceByName", "(", "name", ",", "useAlias", ")", "{", "if", "(", "!", "_", ".", "isString", "(", "name", ")", "||", "!", "_", ".", "isArray", "(", "this", ".", "provinces", ")", ")", "return", "undefined", ";", "return", "_", ".", ...
Find the province object of the given province name @param {String} name english province name @param {Boolean} [useAlias] use alias flag, default `false` @return {Object} province province object
[ "Find", "the", "province", "object", "of", "the", "given", "province", "name" ]
4ec36f37adbf8293c9a9d4872136750b78291e8d
https://github.com/marchah/node-countries/blob/4ec36f37adbf8293c9a9d4872136750b78291e8d/index.js#L64-L74
34,713
marchah/node-countries
index.js
getProvinceByNameOrShortName
function getProvinceByNameOrShortName(name, useAlias) { if (!_.isString(name) || !_.isArray(this.provinces)) return undefined; return _.find(this.provinces, (province) => { if (useAlias) { return province.name.toUpperCase() === name.toUpperCase() || (province.short && province.short.toUpperCase()...
javascript
function getProvinceByNameOrShortName(name, useAlias) { if (!_.isString(name) || !_.isArray(this.provinces)) return undefined; return _.find(this.provinces, (province) => { if (useAlias) { return province.name.toUpperCase() === name.toUpperCase() || (province.short && province.short.toUpperCase()...
[ "function", "getProvinceByNameOrShortName", "(", "name", ",", "useAlias", ")", "{", "if", "(", "!", "_", ".", "isString", "(", "name", ")", "||", "!", "_", ".", "isArray", "(", "this", ".", "provinces", ")", ")", "return", "undefined", ";", "return", "...
Find the province object of the given province name or short name @param {String} name english province name or short name @param {Boolean} [useAlias] use alias flag, default `false` @return {Object} province province object
[ "Find", "the", "province", "object", "of", "the", "given", "province", "name", "or", "short", "name" ]
4ec36f37adbf8293c9a9d4872136750b78291e8d
https://github.com/marchah/node-countries/blob/4ec36f37adbf8293c9a9d4872136750b78291e8d/index.js#L83-L94
34,714
doggan/diablo-file-formats
lib/sol.js
SolFile
function SolFile(data, path) { this.data = data; this.path = path; // levels/towndata/town.sol -> town this.name = pathLib.basename(path, '.sol'); }
javascript
function SolFile(data, path) { this.data = data; this.path = path; // levels/towndata/town.sol -> town this.name = pathLib.basename(path, '.sol'); }
[ "function", "SolFile", "(", "data", ",", "path", ")", "{", "this", ".", "data", "=", "data", ";", "this", ".", "path", "=", "path", ";", "// levels/towndata/town.sol -> town", "this", ".", "name", "=", "pathLib", ".", "basename", "(", "path", ",", "'.sol...
SOL files contain meta information about pillars, such as collision and transparency properties. The usage of some of the bits are currently unknown.
[ "SOL", "files", "contain", "meta", "information", "about", "pillars", "such", "as", "collision", "and", "transparency", "properties", "." ]
1c468868361752b01a1164d6135939621e18dab5
https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/sol.js#L11-L17
34,715
neyric/aws-swf
lib/workflow-execution.js
function (config, cb) { var o = {}, k; for (k in this.baseConfig) { if (this.baseConfig.hasOwnProperty(k)) { o[k] = this.baseConfig[k]; } } for (k in config) { if (config.hasOwnProperty(k)) { o[k] = config[k]; ...
javascript
function (config, cb) { var o = {}, k; for (k in this.baseConfig) { if (this.baseConfig.hasOwnProperty(k)) { o[k] = this.baseConfig[k]; } } for (k in config) { if (config.hasOwnProperty(k)) { o[k] = config[k]; ...
[ "function", "(", "config", ",", "cb", ")", "{", "var", "o", "=", "{", "}", ",", "k", ";", "for", "(", "k", "in", "this", ".", "baseConfig", ")", "{", "if", "(", "this", ".", "baseConfig", ".", "hasOwnProperty", "(", "k", ")", ")", "{", "o", "...
Start a worfklow @param {Object} config @param {Function} cb
[ "Start", "a", "worfklow" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/workflow-execution.js#L20-L45
34,716
neyric/aws-swf
lib/workflow-execution.js
function (config, cb) { var o = {}, k; o.domain = this.baseConfig.domain; //o.execution = this.workflowId; for (k in config) { if (config.hasOwnProperty(k)) { o[k] = config[k]; } } this.swfClient.getWorkflowExecutionHistory(o, cb...
javascript
function (config, cb) { var o = {}, k; o.domain = this.baseConfig.domain; //o.execution = this.workflowId; for (k in config) { if (config.hasOwnProperty(k)) { o[k] = config[k]; } } this.swfClient.getWorkflowExecutionHistory(o, cb...
[ "function", "(", "config", ",", "cb", ")", "{", "var", "o", "=", "{", "}", ",", "k", ";", "o", ".", "domain", "=", "this", ".", "baseConfig", ".", "domain", ";", "//o.execution = this.workflowId;", "for", "(", "k", "in", "config", ")", "{", "if", "...
Get the history for the workflow execution @param {Object} config @param {Function} cb
[ "Get", "the", "history", "for", "the", "workflow", "execution" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/workflow-execution.js#L86-L99
34,717
origin1tech/sequelize-cmd
lib/migrator.js
Migrator
function Migrator(sequelize, options) { this.sequelize = sequelize; this.options = Utils._.extend({ path: __dirname + '/../migrations', from: null, to: null, logging: console.log, filesFilter: /\.js$/ }, opti...
javascript
function Migrator(sequelize, options) { this.sequelize = sequelize; this.options = Utils._.extend({ path: __dirname + '/../migrations', from: null, to: null, logging: console.log, filesFilter: /\.js$/ }, opti...
[ "function", "Migrator", "(", "sequelize", ",", "options", ")", "{", "this", ".", "sequelize", "=", "sequelize", ";", "this", ".", "options", "=", "Utils", ".", "_", ".", "extend", "(", "{", "path", ":", "__dirname", "+", "'/../migrations'", ",", "from", ...
Sequelize Migrator class. @class Migrator @param {object} sequelize - the sequelize instance. @param {object} [options] - the migration options. @constructor
[ "Sequelize", "Migrator", "class", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/migrator.js#L22-L43
34,718
jbielick/kona
lib/kona/watch.js
watch
function watch(path, cb) { debug('watching %s for changes', path); var options = {ignoreInitial: true, persistent: true}, watcher = chokidar.watch(path, options); watcher.on('change', function(path, stat) { /* istanbul ignore next */ debug(format("%s changed", path)); /* istanb...
javascript
function watch(path, cb) { debug('watching %s for changes', path); var options = {ignoreInitial: true, persistent: true}, watcher = chokidar.watch(path, options); watcher.on('change', function(path, stat) { /* istanbul ignore next */ debug(format("%s changed", path)); /* istanb...
[ "function", "watch", "(", "path", ",", "cb", ")", "{", "debug", "(", "'watching %s for changes'", ",", "path", ")", ";", "var", "options", "=", "{", "ignoreInitial", ":", "true", ",", "persistent", ":", "true", "}", ",", "watcher", "=", "chokidar", ".", ...
setup a chokidar persistent watcher on a dir or file and call the callback on `change` event @param {String} path directory (recursive) or file path to watch @param {Function} cb callback to call on `change` event @return {choikdar.watcher} the watcher instance created
[ "setup", "a", "chokidar", "persistent", "watcher", "on", "a", "dir", "or", "file", "and", "call", "the", "callback", "on", "change", "event" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona/watch.js#L30-L47
34,719
jbielick/kona
lib/kona/watch.js
watchModules
function watchModules(paths) { paths || (paths = []); if (!Array.isArray(paths)) { paths = [paths]; } // for all directories / files in `config.watch` array paths.forEach(function(watchPath) { // watch modules for changes this.watch(watchPath, function(eventPath, stat) { // dele...
javascript
function watchModules(paths) { paths || (paths = []); if (!Array.isArray(paths)) { paths = [paths]; } // for all directories / files in `config.watch` array paths.forEach(function(watchPath) { // watch modules for changes this.watch(watchPath, function(eventPath, stat) { // dele...
[ "function", "watchModules", "(", "paths", ")", "{", "paths", "||", "(", "paths", "=", "[", "]", ")", ";", "if", "(", "!", "Array", ".", "isArray", "(", "paths", ")", ")", "{", "paths", "=", "[", "paths", "]", ";", "}", "// for all directories / files...
watches routes, controllers, models for changes and clears require cache for those objects to be reloaded or clears routes and reloads them
[ "watches", "routes", "controllers", "models", "for", "changes", "and", "clears", "require", "cache", "for", "those", "objects", "to", "be", "reloaded", "or", "clears", "routes", "and", "reloads", "them" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona/watch.js#L54-L81
34,720
jbielick/kona
lib/kona.js
Kona
function Kona(options) { // call the koa constructor here Koa.call(this); options = options || {}; // setup kona root and application paths / helpers this.setupPaths(options); // setup env vars, logger, needed modules this.setupEnvironment(options); this.loadMixins(this.root.join('package.json')); ...
javascript
function Kona(options) { // call the koa constructor here Koa.call(this); options = options || {}; // setup kona root and application paths / helpers this.setupPaths(options); // setup env vars, logger, needed modules this.setupEnvironment(options); this.loadMixins(this.root.join('package.json')); ...
[ "function", "Kona", "(", "options", ")", "{", "// call the koa constructor here", "Koa", ".", "call", "(", "this", ")", ";", "options", "=", "options", "||", "{", "}", ";", "// setup kona root and application paths / helpers", "this", ".", "setupPaths", "(", "opti...
the application module that will house the koa app and provide an api layer to registering middleware, establishing db connections, loading application routes, controllers, models and helpers @param {Object} options options options from commander
[ "the", "application", "module", "that", "will", "house", "the", "koa", "app", "and", "provide", "an", "api", "layer", "to", "registering", "middleware", "establishing", "db", "connections", "loading", "application", "routes", "controllers", "models", "and", "helpe...
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L25-L39
34,721
jbielick/kona
lib/kona.js
function (options) { this.expose('kona', this); // livepath for the application root this.root = new LivePath(options.root || process.cwd()); // livepath for the kona module root this._root = new LivePath(path.resolve(__dirname, '..')); debug('Application CWD: ' + this.root.toString()); ...
javascript
function (options) { this.expose('kona', this); // livepath for the application root this.root = new LivePath(options.root || process.cwd()); // livepath for the kona module root this._root = new LivePath(path.resolve(__dirname, '..')); debug('Application CWD: ' + this.root.toString()); ...
[ "function", "(", "options", ")", "{", "this", ".", "expose", "(", "'kona'", ",", "this", ")", ";", "// livepath for the application root", "this", ".", "root", "=", "new", "LivePath", "(", "options", ".", "root", "||", "process", ".", "cwd", "(", ")", ")...
sets up root paths, application version @param {Object} options options or arguments passed in via constructor
[ "sets", "up", "root", "paths", "application", "version" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L158-L172
34,722
jbielick/kona
lib/kona.js
function(options) { dotenv.config({path: this.root.join('.env'), silent: true}); this.env = options.environment || process.env.NODE_ENV || 'development'; // detect if we're in an kona application cwd this.inApp = fs.existsSync(this.root.join('config', 'application.js')); // create a winston logg...
javascript
function(options) { dotenv.config({path: this.root.join('.env'), silent: true}); this.env = options.environment || process.env.NODE_ENV || 'development'; // detect if we're in an kona application cwd this.inApp = fs.existsSync(this.root.join('config', 'application.js')); // create a winston logg...
[ "function", "(", "options", ")", "{", "dotenv", ".", "config", "(", "{", "path", ":", "this", ".", "root", ".", "join", "(", "'.env'", ")", ",", "silent", ":", "true", "}", ")", ";", "this", ".", "env", "=", "options", ".", "environment", "||", "...
parse .env, global env vars, inApp check and setup middleware paths for readiness @param {Object} options kona construction options
[ "parse", ".", "env", "global", "env", "vars", "inApp", "check", "and", "setup", "middleware", "paths", "for", "readiness" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L180-L217
34,723
jbielick/kona
lib/kona.js
function () { this.middlewarePaths.forEach(function (mwPath) { require(mwPath)(this); debug(format('mounted middleware/%s', path.basename(mwPath))); }, this); }
javascript
function () { this.middlewarePaths.forEach(function (mwPath) { require(mwPath)(this); debug(format('mounted middleware/%s', path.basename(mwPath))); }, this); }
[ "function", "(", ")", "{", "this", ".", "middlewarePaths", ".", "forEach", "(", "function", "(", "mwPath", ")", "{", "require", "(", "mwPath", ")", "(", "this", ")", ";", "debug", "(", "format", "(", "'mounted middleware/%s'", ",", "path", ".", "basename...
requires barebones Kona middleware and pushes them to the koa middleware stack one by one
[ "requires", "barebones", "Kona", "middleware", "and", "pushes", "them", "to", "the", "koa", "middleware", "stack", "one", "by", "one" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L223-L233
34,724
jbielick/kona
lib/kona.js
function (name, object) { if (global[name] && this.env !== 'test') { debug(format('global "%s" already exists', name)); } return (global[name] = object); }
javascript
function (name, object) { if (global[name] && this.env !== 'test') { debug(format('global "%s" already exists', name)); } return (global[name] = object); }
[ "function", "(", "name", ",", "object", ")", "{", "if", "(", "global", "[", "name", "]", "&&", "this", ".", "env", "!==", "'test'", ")", "{", "debug", "(", "format", "(", "'global \"%s\" already exists'", ",", "name", ")", ")", ";", "}", "return", "(...
exposes objects globally @param {String} name name of the global @param {Mixed} object the value to assign to the global
[ "exposes", "objects", "globally" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L241-L246
34,725
jbielick/kona
lib/kona.js
function () { var writeStream = fs.createWriteStream('/dev/null'), readStream = fs.createReadStream('/dev/null'); return repl.start({ prompt: format('kona~%s > ', this.version), useColors: true, input: this.env === 'test' ? readStream : process.stdin, output: this.env === 'test...
javascript
function () { var writeStream = fs.createWriteStream('/dev/null'), readStream = fs.createReadStream('/dev/null'); return repl.start({ prompt: format('kona~%s > ', this.version), useColors: true, input: this.env === 'test' ? readStream : process.stdin, output: this.env === 'test...
[ "function", "(", ")", "{", "var", "writeStream", "=", "fs", ".", "createWriteStream", "(", "'/dev/null'", ")", ",", "readStream", "=", "fs", ".", "createReadStream", "(", "'/dev/null'", ")", ";", "return", "repl", ".", "start", "(", "{", "prompt", ":", "...
starts the kona repl
[ "starts", "the", "kona", "repl" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L252-L264
34,726
jbielick/kona
lib/kona.js
function () { var args = Array.prototype.slice.call(arguments), port = args.shift(), bean; if (!this._ready) { throw new Error('Cannot call #listen before Kona has been intialized'); } bean = require('./utilities/bean'); if (this.env === 'test') { delete this.port; ...
javascript
function () { var args = Array.prototype.slice.call(arguments), port = args.shift(), bean; if (!this._ready) { throw new Error('Cannot call #listen before Kona has been intialized'); } bean = require('./utilities/bean'); if (this.env === 'test') { delete this.port; ...
[ "function", "(", ")", "{", "var", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ",", "port", "=", "args", ".", "shift", "(", ")", ",", "bean", ";", "if", "(", "!", "this", ".", "_ready", ")", "{", "th...
start the http server and listen @return {HttpServer} koa server instance
[ "start", "the", "http", "server", "and", "listen" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L271-L304
34,727
bojand/grpc-create-error
index.js
applyCreate
function applyCreate (err, message, code, metadata) { if (err instanceof Error === false) { throw new Error('Source error must be an instance of Error') } if (message instanceof Error) { err.message = message.message.toString() if (typeof message.code === 'number') { err.code = message.code ...
javascript
function applyCreate (err, message, code, metadata) { if (err instanceof Error === false) { throw new Error('Source error must be an instance of Error') } if (message instanceof Error) { err.message = message.message.toString() if (typeof message.code === 'number') { err.code = message.code ...
[ "function", "applyCreate", "(", "err", ",", "message", ",", "code", ",", "metadata", ")", "{", "if", "(", "err", "instanceof", "Error", "===", "false", ")", "{", "throw", "new", "Error", "(", "'Source error must be an instance of Error'", ")", "}", "if", "("...
Actual function that does all the work. Same as createGRPCError but applies cretion to the existing error. @param {Error} err The error to apply creation to @param {String|Number|Error|Object} message See <code>createGRPCError</code> description @param {Number|Object} code See <code>createGRPCError</code> descriptio...
[ "Actual", "function", "that", "does", "all", "the", "work", ".", "Same", "as", "createGRPCError", "but", "applies", "cretion", "to", "the", "existing", "error", "." ]
01909b70c947ce2c28077ec2438e32561167e968
https://github.com/bojand/grpc-create-error/blob/01909b70c947ce2c28077ec2438e32561167e968/index.js#L67-L131
34,728
neyric/aws-swf
lib/workflow.js
function (config, cb) { var w = new WorkflowExecution(this.swfClient, this.config); w.start(config, cb); return w; }
javascript
function (config, cb) { var w = new WorkflowExecution(this.swfClient, this.config); w.start(config, cb); return w; }
[ "function", "(", "config", ",", "cb", ")", "{", "var", "w", "=", "new", "WorkflowExecution", "(", "this", ".", "swfClient", ",", "this", ".", "config", ")", ";", "w", ".", "start", "(", "config", ",", "cb", ")", ";", "return", "w", ";", "}" ]
Creates a new Workflow instance and start it @param {Object} config @param {Function} [cb] - called once the workflow execution started @returns {WorkflowExecution} workflowExecution - The new instance of the workflow execution
[ "Creates", "a", "new", "Workflow", "instance", "and", "start", "it" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/workflow.js#L24-L28
34,729
neyric/aws-swf
lib/workflow.js
function (cb) { this.swfClient.registerWorkflowType({ "domain": this.config.domain, "name": this.config.workflowType.name, "version": this.config.workflowType.version }, cb); }
javascript
function (cb) { this.swfClient.registerWorkflowType({ "domain": this.config.domain, "name": this.config.workflowType.name, "version": this.config.workflowType.version }, cb); }
[ "function", "(", "cb", ")", "{", "this", ".", "swfClient", ".", "registerWorkflowType", "(", "{", "\"domain\"", ":", "this", ".", "config", ".", "domain", ",", "\"name\"", ":", "this", ".", "config", ".", "workflowType", ".", "name", ",", "\"version\"", ...
register the workflow @param {Function} [cb]
[ "register", "the", "workflow" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/workflow.js#L49-L55
34,730
origin1tech/sequelize-cmd
lib/compare.js
upToString
function upToString() { var upStr = '', ctr = 0, items = getActions(build.up), tab, suffix; // build the output string for up. _.forEach(items, function (v,k) { _.forEach(v, function(item, key){ ...
javascript
function upToString() { var upStr = '', ctr = 0, items = getActions(build.up), tab, suffix; // build the output string for up. _.forEach(items, function (v,k) { _.forEach(v, function(item, key){ ...
[ "function", "upToString", "(", ")", "{", "var", "upStr", "=", "''", ",", "ctr", "=", "0", ",", "items", "=", "getActions", "(", "build", ".", "up", ")", ",", "tab", ",", "suffix", ";", "// build the output string for up.", "_", ".", "forEach", "(", "it...
Concats all up migration events to string. @private @memberof Compare @returns {string}
[ "Concats", "all", "up", "migration", "events", "to", "string", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/compare.js#L125-L141
34,731
origin1tech/sequelize-cmd
lib/compare.js
downToString
function downToString() { var dwnStr = '', ctr = 0, items = getActions(build.down), tab, suffix; // build the output string for down. _.forEach(items, function (v,k) { _.forEach(v, function(item, key){ ...
javascript
function downToString() { var dwnStr = '', ctr = 0, items = getActions(build.down), tab, suffix; // build the output string for down. _.forEach(items, function (v,k) { _.forEach(v, function(item, key){ ...
[ "function", "downToString", "(", ")", "{", "var", "dwnStr", "=", "''", ",", "ctr", "=", "0", ",", "items", "=", "getActions", "(", "build", ".", "down", ")", ",", "tab", ",", "suffix", ";", "// build the output string for down.", "_", ".", "forEach", "("...
Concats all down migration events to string. @private @memberof Compare @returns {string}
[ "Concats", "all", "down", "migration", "events", "to", "string", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/compare.js#L149-L165
34,732
origin1tech/sequelize-cmd
lib/compare.js
recurseChildOptions
function recurseChildOptions(obj, level){ var child = '', len = Object.keys(obj).length, ctr = 0, prefix; level = level || 1; for(var prop in obj) { if(obj.hasOwnProperty(prop)){ var tab = getTabs(lev...
javascript
function recurseChildOptions(obj, level){ var child = '', len = Object.keys(obj).length, ctr = 0, prefix; level = level || 1; for(var prop in obj) { if(obj.hasOwnProperty(prop)){ var tab = getTabs(lev...
[ "function", "recurseChildOptions", "(", "obj", ",", "level", ")", "{", "var", "child", "=", "''", ",", "len", "=", "Object", ".", "keys", "(", "obj", ")", ".", "length", ",", "ctr", "=", "0", ",", "prefix", ";", "level", "=", "level", "||", "1", ...
Recurse child options concat to string. @private @memberof Compare @param {object} obj - the child object. @returns {string}
[ "Recurse", "child", "options", "concat", "to", "string", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/compare.js#L174-L216
34,733
origin1tech/sequelize-cmd
lib/compare.js
parseOptions
function parseOptions(obj) { var ctr = 0, tab = getTabs(1, true); for(var prop in obj) { if(obj.hasOwnProperty(prop)){ if(_.isPlainObject(obj[prop])){ if(!_.isEmpty(obj[prop])){ var child = re...
javascript
function parseOptions(obj) { var ctr = 0, tab = getTabs(1, true); for(var prop in obj) { if(obj.hasOwnProperty(prop)){ if(_.isPlainObject(obj[prop])){ if(!_.isEmpty(obj[prop])){ var child = re...
[ "function", "parseOptions", "(", "obj", ")", "{", "var", "ctr", "=", "0", ",", "tab", "=", "getTabs", "(", "1", ",", "true", ")", ";", "for", "(", "var", "prop", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "prop", ")", ...
Parse options for create model migrations. @private @memberof Compare @param {object} obj - the object of options.
[ "Parse", "options", "for", "create", "model", "migrations", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/compare.js#L224-L251
34,734
origin1tech/sequelize-cmd
lib/compare.js
attributesToString
function attributesToString(obj, prevObj, level) { var attrs = '', prefix, tab; level = level || 1; tab = getTabs(level, true); _.forEach(obj, function (v, k) { if(excludeAttrs.indexOf(k) === -1){ var pre...
javascript
function attributesToString(obj, prevObj, level) { var attrs = '', prefix, tab; level = level || 1; tab = getTabs(level, true); _.forEach(obj, function (v, k) { if(excludeAttrs.indexOf(k) === -1){ var pre...
[ "function", "attributesToString", "(", "obj", ",", "prevObj", ",", "level", ")", "{", "var", "attrs", "=", "''", ",", "prefix", ",", "tab", ";", "level", "=", "level", "||", "1", ";", "tab", "=", "getTabs", "(", "level", ",", "true", ")", ";", "_",...
Converts a property's atttributes to string. @private @memberof Compare @param {object} obj - the object of attributes. @param {object} prevObj - the previous object of attributes from last snapshot. @returns {string}
[ "Converts", "a", "property", "s", "atttributes", "to", "string", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/compare.js#L261-L290
34,735
origin1tech/sequelize-cmd
lib/utils/helpers.js
strToCase
function strToCase(str, casing) { casing = casing === 'capitalize' ? 'first' : casing; if (!casing) return str; casing = casing || 'first'; if (casing === 'lower') return str.toLowerCase(); if (casing === 'upper') return str.t...
javascript
function strToCase(str, casing) { casing = casing === 'capitalize' ? 'first' : casing; if (!casing) return str; casing = casing || 'first'; if (casing === 'lower') return str.toLowerCase(); if (casing === 'upper') return str.t...
[ "function", "strToCase", "(", "str", ",", "casing", ")", "{", "casing", "=", "casing", "===", "'capitalize'", "?", "'first'", ":", "casing", ";", "if", "(", "!", "casing", ")", "return", "str", ";", "casing", "=", "casing", "||", "'first'", ";", "if", ...
Converts the case of a string. @memberof Helpers @param {string} str - the string to convert. @param {string} casing - case to convert to ex: 'first', 'upper', 'title', 'camel', 'pascal'
[ "Converts", "the", "case", "of", "a", "string", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/utils/helpers.js#L35-L61
34,736
origin1tech/sequelize-cmd
lib/utils/helpers.js
camelToUnderscore
function camelToUnderscore(str) { return s.split(/(?=[A-Z])/).map(function (p) { return p.charAt(0).toUpperCase() + p.slice(1); }).join('_'); }
javascript
function camelToUnderscore(str) { return s.split(/(?=[A-Z])/).map(function (p) { return p.charAt(0).toUpperCase() + p.slice(1); }).join('_'); }
[ "function", "camelToUnderscore", "(", "str", ")", "{", "return", "s", ".", "split", "(", "/", "(?=[A-Z])", "/", ")", ".", "map", "(", "function", "(", "p", ")", "{", "return", "p", ".", "charAt", "(", "0", ")", ".", "toUpperCase", "(", ")", "+", ...
Converts camel case string to underscore. @param {string} str - the string to convert. @returns {string}
[ "Converts", "camel", "case", "string", "to", "underscore", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/utils/helpers.js#L68-L72
34,737
origin1tech/sequelize-cmd
lib/utils/helpers.js
normalizeAttributes
function normalizeAttributes(attrs, strip) { // map for converting SQL types to Sequelize DataTypes. var map = { TINYINT: 'BOOLEAN', DATETIME: 'DATE', TIMESTAMP: 'DATE', 'VARCHAR BINARY': 'STRING.BINARY', ...
javascript
function normalizeAttributes(attrs, strip) { // map for converting SQL types to Sequelize DataTypes. var map = { TINYINT: 'BOOLEAN', DATETIME: 'DATE', TIMESTAMP: 'DATE', 'VARCHAR BINARY': 'STRING.BINARY', ...
[ "function", "normalizeAttributes", "(", "attrs", ",", "strip", ")", "{", "// map for converting SQL types to Sequelize DataTypes.", "var", "map", "=", "{", "TINYINT", ":", "'BOOLEAN'", ",", "DATETIME", ":", "'DATE'", ",", "TIMESTAMP", ":", "'DATE'", ",", "'VARCHAR B...
Normalize property attributes primarily the type. @memberof Helpers @param {object} attrs - the attributes to be parsed. @param {array} strip - an array of keys to strip/remove. @returns {object}
[ "Normalize", "property", "attributes", "primarily", "the", "type", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/utils/helpers.js#L146-L234
34,738
origin1tech/sequelize-cmd
lib/utils/helpers.js
getType
function getType(type, len, name) { if(!type) return undefined; type = type.split('(')[0]; if(map[type]){ var tmp = map[type]; if(len && !_.contains([255, 11], len)) len = '(' + len + ')'; else len = ''; ...
javascript
function getType(type, len, name) { if(!type) return undefined; type = type.split('(')[0]; if(map[type]){ var tmp = map[type]; if(len && !_.contains([255, 11], len)) len = '(' + len + ')'; else len = ''; ...
[ "function", "getType", "(", "type", ",", "len", ",", "name", ")", "{", "if", "(", "!", "type", ")", "return", "undefined", ";", "type", "=", "type", ".", "split", "(", "'('", ")", "[", "0", "]", ";", "if", "(", "map", "[", "type", "]", ")", "...
convert and format to Sequelize Model Type.
[ "convert", "and", "format", "to", "Sequelize", "Model", "Type", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/utils/helpers.js#L177-L190
34,739
origin1tech/sequelize-cmd
lib/utils/helpers.js
normalizeOptions
function normalizeOptions(options, include) { _.forEach(options, function (v,k) { if(!_.contains(include, k)) delete options[k]; }); return options; }
javascript
function normalizeOptions(options, include) { _.forEach(options, function (v,k) { if(!_.contains(include, k)) delete options[k]; }); return options; }
[ "function", "normalizeOptions", "(", "options", ",", "include", ")", "{", "_", ".", "forEach", "(", "options", ",", "function", "(", "v", ",", "k", ")", "{", "if", "(", "!", "_", ".", "contains", "(", "include", ",", "k", ")", ")", "delete", "optio...
Normalize options including only required. @memberof Helpers @param {object} options - the options object. @param {array} include - an array of keys to include. @returns {object}
[ "Normalize", "options", "including", "only", "required", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/utils/helpers.js#L243-L249
34,740
node-ffi-napi/ref-array-di
lib/array.js
ArrayType
function ArrayType (data, length) { if (!(this instanceof ArrayType)) { return new ArrayType(data, length) } debug('creating new array instance') ArrayIndex.call(this) var item_size = ArrayType.BYTES_PER_ELEMENT if (0 === arguments.length) { // new IntArray() // use the "fixedL...
javascript
function ArrayType (data, length) { if (!(this instanceof ArrayType)) { return new ArrayType(data, length) } debug('creating new array instance') ArrayIndex.call(this) var item_size = ArrayType.BYTES_PER_ELEMENT if (0 === arguments.length) { // new IntArray() // use the "fixedL...
[ "function", "ArrayType", "(", "data", ",", "length", ")", "{", "if", "(", "!", "(", "this", "instanceof", "ArrayType", ")", ")", "{", "return", "new", "ArrayType", "(", "data", ",", "length", ")", "}", "debug", "(", "'creating new array instance'", ")", ...
This is the ArrayType "constructor" that gets returned.
[ "This", "is", "the", "ArrayType", "constructor", "that", "gets", "returned", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L28-L90
34,741
node-ffi-napi/ref-array-di
lib/array.js
set
function set (buffer, offset, value) { debug('Array "type" setter for buffer at offset', buffer, offset, value) var array = this.get(buffer, offset) var isInstance = value instanceof this if (isInstance || isArray(value)) { for (var i = 0; i < value.length; i++) { array[i] = value[i] } } else { ...
javascript
function set (buffer, offset, value) { debug('Array "type" setter for buffer at offset', buffer, offset, value) var array = this.get(buffer, offset) var isInstance = value instanceof this if (isInstance || isArray(value)) { for (var i = 0; i < value.length; i++) { array[i] = value[i] } } else { ...
[ "function", "set", "(", "buffer", ",", "offset", ",", "value", ")", "{", "debug", "(", "'Array \"type\" setter for buffer at offset'", ",", "buffer", ",", "offset", ",", "value", ")", "var", "array", "=", "this", ".", "get", "(", "buffer", ",", "offset", "...
The "set" function of the Array "type" interface. Most likely invoked when setting within a "ref-struct" type.
[ "The", "set", "function", "of", "the", "Array", "type", "interface", ".", "Most", "likely", "invoked", "when", "setting", "within", "a", "ref", "-", "struct", "type", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L180-L191
34,742
node-ffi-napi/ref-array-di
lib/array.js
setRef
function setRef (buffer, offset, value) { debug('Array reference "type" setter for buffer at offset', offset) var ptr if (value instanceof this) { ptr = value.buffer } else { ptr = new this(value).buffer } _ref.writePointer(buffer, offset, ptr) }
javascript
function setRef (buffer, offset, value) { debug('Array reference "type" setter for buffer at offset', offset) var ptr if (value instanceof this) { ptr = value.buffer } else { ptr = new this(value).buffer } _ref.writePointer(buffer, offset, ptr) }
[ "function", "setRef", "(", "buffer", ",", "offset", ",", "value", ")", "{", "debug", "(", "'Array reference \"type\" setter for buffer at offset'", ",", "offset", ")", "var", "ptr", "if", "(", "value", "instanceof", "this", ")", "{", "ptr", "=", "value", ".", ...
Most likely invoked when passing an array instance as an argument to an FFI'd function.
[ "Most", "likely", "invoked", "when", "passing", "an", "array", "instance", "as", "an", "argument", "to", "an", "FFI", "d", "function", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L210-L219
34,743
node-ffi-napi/ref-array-di
lib/array.js
ref
function ref () { debug('ref()') var type = this.constructor var origSize = this.buffer.length var r = _ref.ref(this.buffer) r.type = Object.create(_ref.types.CString) r.type.get = function (buf, offset) { return new type(_ref.readPointer(buf, offset | 0, origSize)) } r.type.set = function () { ...
javascript
function ref () { debug('ref()') var type = this.constructor var origSize = this.buffer.length var r = _ref.ref(this.buffer) r.type = Object.create(_ref.types.CString) r.type.get = function (buf, offset) { return new type(_ref.readPointer(buf, offset | 0, origSize)) } r.type.set = function () { ...
[ "function", "ref", "(", ")", "{", "debug", "(", "'ref()'", ")", "var", "type", "=", "this", ".", "constructor", "var", "origSize", "=", "this", ".", "buffer", ".", "length", "var", "r", "=", "_ref", ".", "ref", "(", "this", ".", "buffer", ")", "r",...
Returns a reference to the backing buffer of this Array instance. i.e. if the array represents `int[]` (a.k.a. `int *`), then the returned Buffer represents `int (*)[]` (a.k.a. `int **`)
[ "Returns", "a", "reference", "to", "the", "backing", "buffer", "of", "this", "Array", "instance", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L228-L241
34,744
node-ffi-napi/ref-array-di
lib/array.js
getter
function getter (index) { debug('getting array[%d]', index) var size = this.constructor.BYTES_PER_ELEMENT var baseType = this.constructor.type var offset = size * index var end = offset + size var buffer = this.buffer if (buffer.length < end) { debug('reinterpreting buffer from %d to %d', buffer.lengt...
javascript
function getter (index) { debug('getting array[%d]', index) var size = this.constructor.BYTES_PER_ELEMENT var baseType = this.constructor.type var offset = size * index var end = offset + size var buffer = this.buffer if (buffer.length < end) { debug('reinterpreting buffer from %d to %d', buffer.lengt...
[ "function", "getter", "(", "index", ")", "{", "debug", "(", "'getting array[%d]'", ",", "index", ")", "var", "size", "=", "this", ".", "constructor", ".", "BYTES_PER_ELEMENT", "var", "baseType", "=", "this", ".", "constructor", ".", "type", "var", "offset", ...
The "getter" implementation for the "array-index" interface.
[ "The", "getter", "implementation", "for", "the", "array", "-", "index", "interface", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L247-L259
34,745
node-ffi-napi/ref-array-di
lib/array.js
setter
function setter (index, value) { debug('setting array[%d]', index) var size = this.constructor.BYTES_PER_ELEMENT var baseType = this.constructor.type var offset = size * index var end = offset + size var buffer = this.buffer if (buffer.length < end) { debug('reinterpreting buffer from %d to %d', buffe...
javascript
function setter (index, value) { debug('setting array[%d]', index) var size = this.constructor.BYTES_PER_ELEMENT var baseType = this.constructor.type var offset = size * index var end = offset + size var buffer = this.buffer if (buffer.length < end) { debug('reinterpreting buffer from %d to %d', buffe...
[ "function", "setter", "(", "index", ",", "value", ")", "{", "debug", "(", "'setting array[%d]'", ",", "index", ")", "var", "size", "=", "this", ".", "constructor", ".", "BYTES_PER_ELEMENT", "var", "baseType", "=", "this", ".", "constructor", ".", "type", "...
The "setter" implementation for the "array-index" interface.
[ "The", "setter", "implementation", "for", "the", "array", "-", "index", "interface", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L265-L280
34,746
node-ffi-napi/ref-array-di
lib/array.js
slice
function slice (start, end) { var data if (end) { debug('slicing array from %d to %d', start, end) data = this.buffer.slice(start*this.constructor.BYTES_PER_ELEMENT, end*this.constructor.BYTES_PER_ELEMENT) } else { debug('slicing array from %d', start) data = this.buffer.slice(start*this.construc...
javascript
function slice (start, end) { var data if (end) { debug('slicing array from %d to %d', start, end) data = this.buffer.slice(start*this.constructor.BYTES_PER_ELEMENT, end*this.constructor.BYTES_PER_ELEMENT) } else { debug('slicing array from %d', start) data = this.buffer.slice(start*this.construc...
[ "function", "slice", "(", "start", ",", "end", ")", "{", "var", "data", "if", "(", "end", ")", "{", "debug", "(", "'slicing array from %d to %d'", ",", "start", ",", "end", ")", "data", "=", "this", ".", "buffer", ".", "slice", "(", "start", "*", "th...
The "slice" implementation.
[ "The", "slice", "implementation", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L286-L298
34,747
simoami/mimik
lib/utils.js
function (message, config, cb) { if(typeof config === 'function') { cb = config; config = {}; } var stdin = config.stdin || process.stdin, stdout = config.stdout || process.stdout, prompt = config.prompt || '\u203A'; stdout.write(' ' + mes...
javascript
function (message, config, cb) { if(typeof config === 'function') { cb = config; config = {}; } var stdin = config.stdin || process.stdin, stdout = config.stdout || process.stdout, prompt = config.prompt || '\u203A'; stdout.write(' ' + mes...
[ "function", "(", "message", ",", "config", ",", "cb", ")", "{", "if", "(", "typeof", "config", "===", "'function'", ")", "{", "cb", "=", "config", ";", "config", "=", "{", "}", ";", "}", "var", "stdin", "=", "config", ".", "stdin", "||", "process",...
creates a console prompt and calls the passed callback with the anwser
[ "creates", "a", "console", "prompt", "and", "calls", "the", "passed", "callback", "with", "the", "anwser" ]
464a4679bba671d43aea6660485d8db9fa767b1b
https://github.com/simoami/mimik/blob/464a4679bba671d43aea6660485d8db9fa767b1b/lib/utils.js#L259-L274
34,748
tgriesser/create-error
create-error.js
attachProps
function attachProps(context, target) { if (isObject(target)) { var keys = inheritedKeys(target); for (var i = 0, l = keys.length; i < l; ++i) { context[keys[i]] = clone(target[keys[i]]); } } }
javascript
function attachProps(context, target) { if (isObject(target)) { var keys = inheritedKeys(target); for (var i = 0, l = keys.length; i < l; ++i) { context[keys[i]] = clone(target[keys[i]]); } } }
[ "function", "attachProps", "(", "context", ",", "target", ")", "{", "if", "(", "isObject", "(", "target", ")", ")", "{", "var", "keys", "=", "inheritedKeys", "(", "target", ")", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "keys", ".", "...
Used to attach attributes to the error object in the constructor.
[ "Used", "to", "attach", "attributes", "to", "the", "error", "object", "in", "the", "constructor", "." ]
03e4a517a16a115cdf61d84168dac510c550a53c
https://github.com/tgriesser/create-error/blob/03e4a517a16a115cdf61d84168dac510c550a53c/create-error.js#L78-L85
34,749
neyric/aws-swf
lib/activity-task.js
function (result, cb) { var self = this; this.swfClient.respondActivityTaskCompleted({ result: stringify(result), taskToken: this.config.taskToken }, function (err) { if (self.onDone) { self.onDone(); } if (cb) { ...
javascript
function (result, cb) { var self = this; this.swfClient.respondActivityTaskCompleted({ result: stringify(result), taskToken: this.config.taskToken }, function (err) { if (self.onDone) { self.onDone(); } if (cb) { ...
[ "function", "(", "result", ",", "cb", ")", "{", "var", "self", "=", "this", ";", "this", ".", "swfClient", ".", "respondActivityTaskCompleted", "(", "{", "result", ":", "stringify", "(", "result", ")", ",", "taskToken", ":", "this", ".", "config", ".", ...
Sends a "RespondActivityTaskCompleted" to AWS. @param {Mixed} result - Result of the activity (will get stringified in JSON if not a string) @param {Function} [cb] - callback
[ "Sends", "a", "RespondActivityTaskCompleted", "to", "AWS", "." ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/activity-task.js#L56-L71
34,750
neyric/aws-swf
lib/activity-task.js
function (reason, details, cb) { var self = this; var o = { "taskToken": this.config.taskToken }; if (reason) { o.reason = reason; } if (details) { o.details = stringify(details); } this.swfClient.respondActivityTaskFai...
javascript
function (reason, details, cb) { var self = this; var o = { "taskToken": this.config.taskToken }; if (reason) { o.reason = reason; } if (details) { o.details = stringify(details); } this.swfClient.respondActivityTaskFai...
[ "function", "(", "reason", ",", "details", ",", "cb", ")", "{", "var", "self", "=", "this", ";", "var", "o", "=", "{", "\"taskToken\"", ":", "this", ".", "config", ".", "taskToken", "}", ";", "if", "(", "reason", ")", "{", "o", ".", "reason", "="...
Sends a "RespondActivityTaskFailed" to AWS. @param {String} reason @param {String} details @param {Function} [cb] - callback
[ "Sends", "a", "RespondActivityTaskFailed", "to", "AWS", "." ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/activity-task.js#L80-L102
34,751
neyric/aws-swf
lib/activity-task.js
function (heartbeat, cb) { var self = this; this.swfClient.recordActivityTaskHeartbeat({ taskToken: this.config.taskToken, details: stringify(heartbeat) }, function (err) { if (cb) { cb(err); } }); }
javascript
function (heartbeat, cb) { var self = this; this.swfClient.recordActivityTaskHeartbeat({ taskToken: this.config.taskToken, details: stringify(heartbeat) }, function (err) { if (cb) { cb(err); } }); }
[ "function", "(", "heartbeat", ",", "cb", ")", "{", "var", "self", "=", "this", ";", "this", ".", "swfClient", ".", "recordActivityTaskHeartbeat", "(", "{", "taskToken", ":", "this", ".", "config", ".", "taskToken", ",", "details", ":", "stringify", "(", ...
Sends a heartbeat to AWS. Needed for long run activity @param {Mixed} heartbeat - Details of the heartbeat (will get stringified in JSON if not a string) @param {Function} [cb] - callback
[ "Sends", "a", "heartbeat", "to", "AWS", ".", "Needed", "for", "long", "run", "activity" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/activity-task.js#L109-L120
34,752
quorrajs/Ouch
handler/PrettyPageHandler.js
PrettyPageHandler
function PrettyPageHandler(theme, pageTitle, editor, sendResponse, additionalScripts) { PrettyPageHandler.super_.call(this); /** * @var {String} * @protected */ this.__pageTitle = pageTitle || "Ouch! There was an error."; /** * @var {String} * @protected */ this.__th...
javascript
function PrettyPageHandler(theme, pageTitle, editor, sendResponse, additionalScripts) { PrettyPageHandler.super_.call(this); /** * @var {String} * @protected */ this.__pageTitle = pageTitle || "Ouch! There was an error."; /** * @var {String} * @protected */ this.__th...
[ "function", "PrettyPageHandler", "(", "theme", ",", "pageTitle", ",", "editor", ",", "sendResponse", ",", "additionalScripts", ")", "{", "PrettyPageHandler", ".", "super_", ".", "call", "(", "this", ")", ";", "/**\n * @var {String}\n * @protected\n */", "t...
Prettifies a javascript error stack. @param theme @param pageTitle @param editor @param sendResponse @param [additionalScripts] @class
[ "Prettifies", "a", "javascript", "error", "stack", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/handler/PrettyPageHandler.js#L31-L90
34,753
quorrajs/Ouch
exception/frame.js
frame
function frame(frame) { frame.__comments = []; frame.__proto__ = { __proto__: frame.__proto__, /** * Returns the contents of the file for this frame as an * array of lines, and optionally as a clamped range of lines. * * NOTE: lines are 0-indexed * ...
javascript
function frame(frame) { frame.__comments = []; frame.__proto__ = { __proto__: frame.__proto__, /** * Returns the contents of the file for this frame as an * array of lines, and optionally as a clamped range of lines. * * NOTE: lines are 0-indexed * ...
[ "function", "frame", "(", "frame", ")", "{", "frame", ".", "__comments", "=", "[", "]", ";", "frame", ".", "__proto__", "=", "{", "__proto__", ":", "frame", ".", "__proto__", ",", "/**\n * Returns the contents of the file for this frame as an\n * array...
Adds additional prototypes to CallSite objects returned by stack-trace module. @param frame @returns frame
[ "Adds", "additional", "prototypes", "to", "CallSite", "objects", "returned", "by", "stack", "-", "trace", "module", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/exception/frame.js#L18-L137
34,754
quorrajs/Ouch
exception/frame.js
function (start, length) { if (!start) { start = 0; } var contents = this.getFileContents(); if (null !== contents) { var lines = (contents).split("\n"); // Get a subset of lines from $start to $end if (leng...
javascript
function (start, length) { if (!start) { start = 0; } var contents = this.getFileContents(); if (null !== contents) { var lines = (contents).split("\n"); // Get a subset of lines from $start to $end if (leng...
[ "function", "(", "start", ",", "length", ")", "{", "if", "(", "!", "start", ")", "{", "start", "=", "0", ";", "}", "var", "contents", "=", "this", ".", "getFileContents", "(", ")", ";", "if", "(", "null", "!==", "contents", ")", "{", "var", "line...
Returns the contents of the file for this frame as an array of lines, and optionally as a clamped range of lines. NOTE: lines are 0-indexed @throws RangeError if length is less than or equal to 0 @param start @param length @returns {Array|undefined}
[ "Returns", "the", "contents", "of", "the", "file", "for", "this", "frame", "as", "an", "array", "of", "lines", "and", "optionally", "as", "a", "clamped", "range", "of", "lines", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/exception/frame.js#L35-L62
34,755
quorrajs/Ouch
exception/frame.js
function () { var filePath = this.getFileName(); if (!this.__fileContentsCache && filePath) { // Leave the stage early when 'Unknown' is passed // this would otherwise raise an exception when // open_basedir is enabled. if (filePath...
javascript
function () { var filePath = this.getFileName(); if (!this.__fileContentsCache && filePath) { // Leave the stage early when 'Unknown' is passed // this would otherwise raise an exception when // open_basedir is enabled. if (filePath...
[ "function", "(", ")", "{", "var", "filePath", "=", "this", ".", "getFileName", "(", ")", ";", "if", "(", "!", "this", ".", "__fileContentsCache", "&&", "filePath", ")", "{", "// Leave the stage early when 'Unknown' is passed", "// this would otherwise raise an excepti...
Returns the full contents of the file for this frame, if it's known. @returns {*}
[ "Returns", "the", "full", "contents", "of", "the", "file", "for", "this", "frame", "if", "it", "s", "known", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/exception/frame.js#L69-L95
34,756
quorrajs/Ouch
exception/frame.js
function (filter) { if (!filter) { filter = null; } var comments = this.__comments; if (filter !== null) { comments = comments.filter(function (c) { return c.context === filter; }); } ...
javascript
function (filter) { if (!filter) { filter = null; } var comments = this.__comments; if (filter !== null) { comments = comments.filter(function (c) { return c.context === filter; }); } ...
[ "function", "(", "filter", ")", "{", "if", "(", "!", "filter", ")", "{", "filter", "=", "null", ";", "}", "var", "comments", "=", "this", ".", "__comments", ";", "if", "(", "filter", "!==", "null", ")", "{", "comments", "=", "comments", ".", "filte...
Returns all comments for this frame. Optionally allows a filter to only retrieve comments from a specific context. @param {String} filter @returns {Array}
[ "Returns", "all", "comments", "for", "this", "frame", ".", "Optionally", "allows", "a", "filter", "to", "only", "retrieve", "comments", "from", "a", "specific", "context", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/exception/frame.js#L120-L133
34,757
doggan/diablo-file-formats
lib/cel_decode.js
getPixelSetter
function getPixelSetter() { var offset = 0; return function(colors, c) { colors[offset] = c.r; colors[offset + 1] = c.g; colors[offset + 2] = c.b; colors[offset + 3] = c.a; offset += 4; }; }
javascript
function getPixelSetter() { var offset = 0; return function(colors, c) { colors[offset] = c.r; colors[offset + 1] = c.g; colors[offset + 2] = c.b; colors[offset + 3] = c.a; offset += 4; }; }
[ "function", "getPixelSetter", "(", ")", "{", "var", "offset", "=", "0", ";", "return", "function", "(", "colors", ",", "c", ")", "{", "colors", "[", "offset", "]", "=", "c", ".", "r", ";", "colors", "[", "offset", "+", "1", "]", "=", "c", ".", ...
Utility for setting pixels.
[ "Utility", "for", "setting", "pixels", "." ]
1c468868361752b01a1164d6135939621e18dab5
https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/cel_decode.js#L9-L18
34,758
doggan/diablo-file-formats
lib/cel_decode.js
isType0
function isType0(celName, frameNum) { // These special frames are type 1. switch (celName) { case 'l1': switch (frameNum) { case 148: case 159: case 181: case 186: case 188: return false; } break; case 'l2': switch (frameNum) { case 47: case 13...
javascript
function isType0(celName, frameNum) { // These special frames are type 1. switch (celName) { case 'l1': switch (frameNum) { case 148: case 159: case 181: case 186: case 188: return false; } break; case 'l2': switch (frameNum) { case 47: case 13...
[ "function", "isType0", "(", "celName", ",", "frameNum", ")", "{", "// These special frames are type 1.", "switch", "(", "celName", ")", "{", "case", "'l1'", ":", "switch", "(", "frameNum", ")", "{", "case", "148", ":", "case", "159", ":", "case", "181", ":...
Returns true if the image is a plain 32x32.
[ "Returns", "true", "if", "the", "image", "is", "a", "plain", "32x32", "." ]
1c468868361752b01a1164d6135939621e18dab5
https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/cel_decode.js#L23-L52
34,759
doggan/diablo-file-formats
lib/cel_decode.js
DecodeFrameType0
function DecodeFrameType0(frameData, width, height, palFile) { var colors = new Uint8Array(width * height * BYTES_PER_PIXEL); var setPixel = getPixelSetter(); for (var i = 0; i < frameData.length; i++) { setPixel(colors, palFile.colors[frameData[i]]); } return { width: width, ...
javascript
function DecodeFrameType0(frameData, width, height, palFile) { var colors = new Uint8Array(width * height * BYTES_PER_PIXEL); var setPixel = getPixelSetter(); for (var i = 0; i < frameData.length; i++) { setPixel(colors, palFile.colors[frameData[i]]); } return { width: width, ...
[ "function", "DecodeFrameType0", "(", "frameData", ",", "width", ",", "height", ",", "palFile", ")", "{", "var", "colors", "=", "new", "Uint8Array", "(", "width", "*", "height", "*", "BYTES_PER_PIXEL", ")", ";", "var", "setPixel", "=", "getPixelSetter", "(", ...
Type0 corresponds to plain 32x32 images with no transparency. 1) Range through the frame, one byte at the time. - Each byte corresponds to a color index of the palette. - Set one regular pixel per byte, using the color index to locate the color in the palette.
[ "Type0", "corresponds", "to", "plain", "32x32", "images", "with", "no", "transparency", "." ]
1c468868361752b01a1164d6135939621e18dab5
https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/cel_decode.js#L90-L102
34,760
doggan/diablo-file-formats
lib/cel_decode.js
_getCelFrameDecoder
function _getCelFrameDecoder(celName, frameData, frameNum) { var frameSize = frameData.length; switch (celName) { case 'l1': case 'l2': case 'l3': case 'l4': case 'town': // Some regular (type 1) CEL images just happen to have a frame size of // exactly 0x220, 0x320 or 0x400. Therefore the isType...
javascript
function _getCelFrameDecoder(celName, frameData, frameNum) { var frameSize = frameData.length; switch (celName) { case 'l1': case 'l2': case 'l3': case 'l4': case 'town': // Some regular (type 1) CEL images just happen to have a frame size of // exactly 0x220, 0x320 or 0x400. Therefore the isType...
[ "function", "_getCelFrameDecoder", "(", "celName", ",", "frameData", ",", "frameNum", ")", "{", "var", "frameSize", "=", "frameData", ".", "length", ";", "switch", "(", "celName", ")", "{", "case", "'l1'", ":", "case", "'l2'", ":", "case", "'l3'", ":", "...
Gets the appropriate frame decoder for the particular frame.
[ "Gets", "the", "appropriate", "frame", "decoder", "for", "the", "particular", "frame", "." ]
1c468868361752b01a1164d6135939621e18dab5
https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/cel_decode.js#L546-L577
34,761
simoami/mimik
runner/Session.js
function(config) { var me = this; me.id = me.getId(); var Driver = DriverFactory.get(config.profile.driver); me.driver = new Driver({ session: me, options: config.options, profile: config.profile }); me.featureFile = config.featureFile; me.profile = config.profile; ...
javascript
function(config) { var me = this; me.id = me.getId(); var Driver = DriverFactory.get(config.profile.driver); me.driver = new Driver({ session: me, options: config.options, profile: config.profile }); me.featureFile = config.featureFile; me.profile = config.profile; ...
[ "function", "(", "config", ")", "{", "var", "me", "=", "this", ";", "me", ".", "id", "=", "me", ".", "getId", "(", ")", ";", "var", "Driver", "=", "DriverFactory", ".", "get", "(", "config", ".", "profile", ".", "driver", ")", ";", "me", ".", "...
Error.stackTraceLimit = Infinity;
[ "Error", ".", "stackTraceLimit", "=", "Infinity", ";" ]
464a4679bba671d43aea6660485d8db9fa767b1b
https://github.com/simoami/mimik/blob/464a4679bba671d43aea6660485d8db9fa767b1b/runner/Session.js#L16-L34
34,762
laxa1986/gulp-angular-embed-templates
index.js
transform
function transform(file, enc, cb) { // ignore empty files if (file.isNull()) { cb(null, file); return; } if (file.isStream()) { throw new PluginError(PLUGIN_NAME, 'Streaming not supported. particular file: ' + file.path); } logger.deb...
javascript
function transform(file, enc, cb) { // ignore empty files if (file.isNull()) { cb(null, file); return; } if (file.isStream()) { throw new PluginError(PLUGIN_NAME, 'Streaming not supported. particular file: ' + file.path); } logger.deb...
[ "function", "transform", "(", "file", ",", "enc", ",", "cb", ")", "{", "// ignore empty files", "if", "(", "file", ".", "isNull", "(", ")", ")", "{", "cb", "(", "null", ",", "file", ")", ";", "return", ";", "}", "if", "(", "file", ".", "isStream", ...
This function is 'through' callback, so it has predefined arguments @param {File} file file to analyse @param {String} enc encoding (unused) @param {Function} cb callback
[ "This", "function", "is", "through", "callback", "so", "it", "has", "predefined", "arguments" ]
f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72
https://github.com/laxa1986/gulp-angular-embed-templates/blob/f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72/index.js#L62-L85
34,763
laxa1986/gulp-angular-embed-templates
lib/utils.js
recursiveCycle
function recursiveCycle(arr, onIteration, onEnd) { var i=0; function next() { if (i >= arr.length) { onEnd(); return; } var item = arr[i]; i++; onIteration(item, next, onEnd); } next(); }
javascript
function recursiveCycle(arr, onIteration, onEnd) { var i=0; function next() { if (i >= arr.length) { onEnd(); return; } var item = arr[i]; i++; onIteration(item, next, onEnd); } next(); }
[ "function", "recursiveCycle", "(", "arr", ",", "onIteration", ",", "onEnd", ")", "{", "var", "i", "=", "0", ";", "function", "next", "(", ")", "{", "if", "(", "i", ">=", "arr", ".", "length", ")", "{", "onEnd", "(", ")", ";", "return", ";", "}", ...
Helper function to walk recursively through arr @param arr @param onIteration @param onEnd
[ "Helper", "function", "to", "walk", "recursively", "through", "arr" ]
f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72
https://github.com/laxa1986/gulp-angular-embed-templates/blob/f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72/lib/utils.js#L30-L42
34,764
laxa1986/gulp-angular-embed-templates
lib/utils.js
createLogger
function createLogger(logger) { var result = logger ? objectAssign({}, logger) : {}; if (!result.debug) result.debug = console.log; if (!result.info) result.info = console.info; if (!result.warn) result.warn = console.warn; if (!result.error) result.error = console.error; return result; }
javascript
function createLogger(logger) { var result = logger ? objectAssign({}, logger) : {}; if (!result.debug) result.debug = console.log; if (!result.info) result.info = console.info; if (!result.warn) result.warn = console.warn; if (!result.error) result.error = console.error; return result; }
[ "function", "createLogger", "(", "logger", ")", "{", "var", "result", "=", "logger", "?", "objectAssign", "(", "{", "}", ",", "logger", ")", ":", "{", "}", ";", "if", "(", "!", "result", ".", "debug", ")", "result", ".", "debug", "=", "console", "....
create a logger object based on passed logger. If passed logger has no some methods then add them @param {Object} [logger] object with methods .debug, .warn, .error. Can be @return {Object}
[ "create", "a", "logger", "object", "based", "on", "passed", "logger", ".", "If", "passed", "logger", "has", "no", "some", "methods", "then", "add", "them" ]
f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72
https://github.com/laxa1986/gulp-angular-embed-templates/blob/f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72/lib/utils.js#L50-L57
34,765
burl/mock-env
index.js
delVars
function delVars(origEnv, deleteVars) { var i; if (!Array.isArray(deleteVars)) return; for (i = 0; i < deleteVars.length; i++) { if (!has(origEnv, deleteVars[i])) { origEnv[deleteVars[i]] = [ !!has(process.env, deleteVars[i]), process.env[deleteVars[i]] ]; } delete proc...
javascript
function delVars(origEnv, deleteVars) { var i; if (!Array.isArray(deleteVars)) return; for (i = 0; i < deleteVars.length; i++) { if (!has(origEnv, deleteVars[i])) { origEnv[deleteVars[i]] = [ !!has(process.env, deleteVars[i]), process.env[deleteVars[i]] ]; } delete proc...
[ "function", "delVars", "(", "origEnv", ",", "deleteVars", ")", "{", "var", "i", ";", "if", "(", "!", "Array", ".", "isArray", "(", "deleteVars", ")", ")", "return", ";", "for", "(", "i", "=", "0", ";", "i", "<", "deleteVars", ".", "length", ";", ...
remove vars from env @arg {Object} origEnv - place to save state of original env @arg {Array} deleteVars - names of env vars to remove from env @function
[ "remove", "vars", "from", "env" ]
90a2b585c957a08007c3f8e23a257aa416e8e6e1
https://github.com/burl/mock-env/blob/90a2b585c957a08007c3f8e23a257aa416e8e6e1/index.js#L43-L57
34,766
burl/mock-env
index.js
restoreEnv
function restoreEnv(origEnv) { var key; for (key in origEnv) { if (origEnv[key][0]) { process.env[key] = origEnv[key][1]; } else { delete process.env[key]; } } return; }
javascript
function restoreEnv(origEnv) { var key; for (key in origEnv) { if (origEnv[key][0]) { process.env[key] = origEnv[key][1]; } else { delete process.env[key]; } } return; }
[ "function", "restoreEnv", "(", "origEnv", ")", "{", "var", "key", ";", "for", "(", "key", "in", "origEnv", ")", "{", "if", "(", "origEnv", "[", "key", "]", "[", "0", "]", ")", "{", "process", ".", "env", "[", "key", "]", "=", "origEnv", "[", "k...
restore environment to original state @arg {Object} origEnv - delta/state of process.env from prior morphing @function
[ "restore", "environment", "to", "original", "state" ]
90a2b585c957a08007c3f8e23a257aa416e8e6e1
https://github.com/burl/mock-env/blob/90a2b585c957a08007c3f8e23a257aa416e8e6e1/index.js#L64-L74
34,767
burl/mock-env
index.js
callbackInModifiedEnv
function callbackInModifiedEnv(callback, setInEnv, removeFromEnv) { var origEnv = {}; var result; setVars(origEnv, setInEnv); delVars(origEnv, removeFromEnv); result = callback(); restoreEnv(origEnv); return result; }
javascript
function callbackInModifiedEnv(callback, setInEnv, removeFromEnv) { var origEnv = {}; var result; setVars(origEnv, setInEnv); delVars(origEnv, removeFromEnv); result = callback(); restoreEnv(origEnv); return result; }
[ "function", "callbackInModifiedEnv", "(", "callback", ",", "setInEnv", ",", "removeFromEnv", ")", "{", "var", "origEnv", "=", "{", "}", ";", "var", "result", ";", "setVars", "(", "origEnv", ",", "setInEnv", ")", ";", "delVars", "(", "origEnv", ",", "remove...
calls callback within context of modified environment @callback callback - function to be called while environment is modified @arg {Object} setInEnv - vars to set in current env @arg {Array} removeFromEnv - array of variable names to remove from env @function
[ "calls", "callback", "within", "context", "of", "modified", "environment" ]
90a2b585c957a08007c3f8e23a257aa416e8e6e1
https://github.com/burl/mock-env/blob/90a2b585c957a08007c3f8e23a257aa416e8e6e1/index.js#L83-L91
34,768
quorrajs/Ouch
handler/CallbackHandler.js
CallbackHandler
function CallbackHandler(callable) { CallbackHandler.super_.call(this); if (!_.isFunction(callable)) { throw new TypeError( 'Argument must be valid callable' ); } this.__callable = callable; }
javascript
function CallbackHandler(callable) { CallbackHandler.super_.call(this); if (!_.isFunction(callable)) { throw new TypeError( 'Argument must be valid callable' ); } this.__callable = callable; }
[ "function", "CallbackHandler", "(", "callable", ")", "{", "CallbackHandler", ".", "super_", ".", "call", "(", "this", ")", ";", "if", "(", "!", "_", ".", "isFunction", "(", "callable", ")", ")", "{", "throw", "new", "TypeError", "(", "'Argument must be va...
Wrapper for Closures passed as handlers. Can be used directly, or will be instantiated automagically by Ouch if passed to ouchInstance.pushHandler @param {function} callable @constructor @throws TypeError if argument is not callable
[ "Wrapper", "for", "Closures", "passed", "as", "handlers", ".", "Can", "be", "used", "directly", "or", "will", "be", "instantiated", "automagically", "by", "Ouch", "if", "passed", "to", "ouchInstance", ".", "pushHandler" ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/handler/CallbackHandler.js#L22-L32
34,769
Planeshifter/node-wordnet-magic
lib/rules_of_detachment.js
rulesOfDetachment
function rulesOfDetachment( word, pos, substitutions, dictionary ) { var newEnding; var recResult; var newWord; var result = []; var suffix; var elem; var i; for ( i = 0; i < dictionary.length; i++ ) { elem = dictionary[ i ]; if ( elem.lemma === word ) { if ( elem.pos === pos ) { var obj = new this...
javascript
function rulesOfDetachment( word, pos, substitutions, dictionary ) { var newEnding; var recResult; var newWord; var result = []; var suffix; var elem; var i; for ( i = 0; i < dictionary.length; i++ ) { elem = dictionary[ i ]; if ( elem.lemma === word ) { if ( elem.pos === pos ) { var obj = new this...
[ "function", "rulesOfDetachment", "(", "word", ",", "pos", ",", "substitutions", ",", "dictionary", ")", "{", "var", "newEnding", ";", "var", "recResult", ";", "var", "newWord", ";", "var", "result", "=", "[", "]", ";", "var", "suffix", ";", "var", "elem"...
Apply rules of detachment to obtain base forms for supplied word. @param {string} word - input word @param {string} pos - part of speech @param {Array} substitutions - Morphy substitutions @param {Array} dictionary - WordNet dictionary @returns {Array} base forms
[ "Apply", "rules", "of", "detachment", "to", "obtain", "base", "forms", "for", "supplied", "word", "." ]
a7c6000bd63c79562ebb1e9a85820809a9a17058
https://github.com/Planeshifter/node-wordnet-magic/blob/a7c6000bd63c79562ebb1e9a85820809a9a17058/lib/rules_of_detachment.js#L13-L55
34,770
pavben/WebIRC
static/js/statechanges.js
function(element, sortedList, sortFunction) { var lo = 0; var hi = sortedList.length - 1; var mid, result; while (lo <= hi) { mid = lo + Math.floor((hi - lo) / 2); result = sortFunction(element, sortedList[mid]); if (result < 0) { // mid is too high hi = mid - 1; } else if (resu...
javascript
function(element, sortedList, sortFunction) { var lo = 0; var hi = sortedList.length - 1; var mid, result; while (lo <= hi) { mid = lo + Math.floor((hi - lo) / 2); result = sortFunction(element, sortedList[mid]); if (result < 0) { // mid is too high hi = mid - 1; } else if (resu...
[ "function", "(", "element", ",", "sortedList", ",", "sortFunction", ")", "{", "var", "lo", "=", "0", ";", "var", "hi", "=", "sortedList", ".", "length", "-", "1", ";", "var", "mid", ",", "result", ";", "while", "(", "lo", "<=", "hi", ")", "{", "m...
returns the index of the element if found, or null otherwise
[ "returns", "the", "index", "of", "the", "element", "if", "found", "or", "null", "otherwise" ]
518e311f87a6190c620e9b405855b8557b672bd6
https://github.com/pavben/WebIRC/blob/518e311f87a6190c620e9b405855b8557b672bd6/static/js/statechanges.js#L565-L588
34,771
pavben/WebIRC
static/js/statechanges.js
function(element, sortedList, sortFunction) { // p(index) = val at index is same or larger than element function p(index) { return (sortFunction(element, sortedList[index]) <= 0); } var lo = 0; var hi = sortedList.length - 1; var mid, result; while (lo < hi) { mid = lo + Math.floor((hi - ...
javascript
function(element, sortedList, sortFunction) { // p(index) = val at index is same or larger than element function p(index) { return (sortFunction(element, sortedList[index]) <= 0); } var lo = 0; var hi = sortedList.length - 1; var mid, result; while (lo < hi) { mid = lo + Math.floor((hi - ...
[ "function", "(", "element", ",", "sortedList", ",", "sortFunction", ")", "{", "// p(index) = val at index is same or larger than element", "function", "p", "(", "index", ")", "{", "return", "(", "sortFunction", "(", "element", ",", "sortedList", "[", "index", "]", ...
returns the index at which the element should be inserted
[ "returns", "the", "index", "at", "which", "the", "element", "should", "be", "inserted" ]
518e311f87a6190c620e9b405855b8557b672bd6
https://github.com/pavben/WebIRC/blob/518e311f87a6190c620e9b405855b8557b672bd6/static/js/statechanges.js#L590-L620
34,772
Alhadis/Print
print.js
print
function print(input, opts = {}, /* …Internal:*/ name = "", refs = null){ // Handle options and defaults let { ampedSymbols, escapeChars, invokeGetters, maxArrayLength, showAll, showArrayIndices, showArrayLength, sortProps, } = opts; ampedSymbols = undefined === ampedSymbols ? true : ampedSy...
javascript
function print(input, opts = {}, /* …Internal:*/ name = "", refs = null){ // Handle options and defaults let { ampedSymbols, escapeChars, invokeGetters, maxArrayLength, showAll, showArrayIndices, showArrayLength, sortProps, } = opts; ampedSymbols = undefined === ampedSymbols ? true : ampedSy...
[ "function", "print", "(", "input", ",", "opts", "=", "{", "}", ",", "/* …Internal:*/ n", "me =", "\"", ", ", "r", "fs =", "n", "ll){", "", "", "// Handle options and defaults", "let", "{", "ampedSymbols", ",", "escapeChars", ",", "invokeGetters", ",", "maxAr...
Generate a human-readable representation of a value. @param {Mixed} input - Value to print @param {Object} opts - Optional parameters @param {Boolean} opts.ampedSymbols - Prefix Symbol-keyed properties with @@ @param {Mixed} opts.escapeChars - Which characters to escape i...
[ "Generate", "a", "human", "-", "readable", "representation", "of", "a", "value", "." ]
c289a04a25669370e7038ce3db8bc343d5e87347
https://github.com/Alhadis/Print/blob/c289a04a25669370e7038ce3db8bc343d5e87347/print.js#L18-L437
34,773
neyric/aws-swf
lib/event-list.js
function (scheduledEventId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventId === scheduledEventId) { return evt.activityTaskScheduledEventAttributes.activityId; } } return false; }
javascript
function (scheduledEventId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventId === scheduledEventId) { return evt.activityTaskScheduledEventAttributes.activityId; } } return false; }
[ "function", "(", "scheduledEventId", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "this", ".", "_events", "[", "i", "]", ";", "if", "(...
Return the activityId given the scheduledEventId @param {String} scheduledEventId @returns {String} activityId - The activityId if found, false otherwise
[ "Return", "the", "activityId", "given", "the", "scheduledEventId" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L19-L28
34,774
neyric/aws-swf
lib/event-list.js
function (eventId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventId === eventId) { return evt; } } return false; }
javascript
function (eventId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventId === eventId) { return evt; } } return false; }
[ "function", "(", "eventId", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "this", ".", "_events", "[", "i", "]", ";", "if", "(", "evt...
Return the activityId @param {Integer} eventId @returns {Object} evt - The event if found, false otherwise
[ "Return", "the", "activityId" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L35-L44
34,775
neyric/aws-swf
lib/event-list.js
function(eventType, attributeKey, attributeValue) { var attrsKey = this._event_attributes_key(eventType); for(var i = 0; i < this._events.length ; i++) { var evt = this._events[i]; if ( (evt.eventType === eventType) && (evt[attrsKey][attributeKey] === attributeValue) ) { return evt; } ...
javascript
function(eventType, attributeKey, attributeValue) { var attrsKey = this._event_attributes_key(eventType); for(var i = 0; i < this._events.length ; i++) { var evt = this._events[i]; if ( (evt.eventType === eventType) && (evt[attrsKey][attributeKey] === attributeValue) ) { return evt; } ...
[ "function", "(", "eventType", ",", "attributeKey", ",", "attributeValue", ")", "{", "var", "attrsKey", "=", "this", ".", "_event_attributes_key", "(", "eventType", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", ...
Return the Event for the given type that has the given attribute value @param {String} eventType @param {String} attributeKey @param {String} attributeValue @returns {Object} evt - The event if found, null otherwise
[ "Return", "the", "Event", "for", "the", "given", "type", "that", "has", "the", "given", "attribute", "value" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L63-L72
34,776
neyric/aws-swf
lib/event-list.js
function(eventType, activityId) { var attrsKey = this._event_attributes_key(eventType); return this._events.some(function (evt) { if (evt.eventType === eventType) { if (this.activityIdFor(evt[attrsKey].scheduledEventId) === activityId) { return true; } ...
javascript
function(eventType, activityId) { var attrsKey = this._event_attributes_key(eventType); return this._events.some(function (evt) { if (evt.eventType === eventType) { if (this.activityIdFor(evt[attrsKey].scheduledEventId) === activityId) { return true; } ...
[ "function", "(", "eventType", ",", "activityId", ")", "{", "var", "attrsKey", "=", "this", ".", "_event_attributes_key", "(", "eventType", ")", ";", "return", "this", ".", "_events", ".", "some", "(", "function", "(", "evt", ")", "{", "if", "(", "evt", ...
Search for an event with the corresponding type that matches the scheduled activityId @param {String} eventType @param {String} activityId @returns {Boolean}
[ "Search", "for", "an", "event", "with", "the", "corresponding", "type", "that", "matches", "the", "scheduled", "activityId" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L102-L111
34,777
neyric/aws-swf
lib/event-list.js
function(control) { return this._events.some(function (evt) { if (evt.eventType === "StartChildWorkflowExecutionInitiated") { if (evt.startChildWorkflowExecutionInitiatedEventAttributes.control === control) { return true; } } }); }
javascript
function(control) { return this._events.some(function (evt) { if (evt.eventType === "StartChildWorkflowExecutionInitiated") { if (evt.startChildWorkflowExecutionInitiatedEventAttributes.control === control) { return true; } } }); }
[ "function", "(", "control", ")", "{", "return", "this", ".", "_events", ".", "some", "(", "function", "(", "evt", ")", "{", "if", "(", "evt", ".", "eventType", "===", "\"StartChildWorkflowExecutionInitiated\"", ")", "{", "if", "(", "evt", ".", "startChildW...
lookup for StartChildWorkflowExecutionInitiated @param {String} control @returns {Boolean}
[ "lookup", "for", "StartChildWorkflowExecutionInitiated" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L156-L164
34,778
neyric/aws-swf
lib/event-list.js
function(control) { return this._events.some(function (evt) { if (evt.eventType === "ChildWorkflowExecutionCompleted") { var initiatedEventId = evt.childWorkflowExecutionCompletedEventAttributes.initiatedEventId; var initiatedEvent = this.eventById(initiatedEventId); ...
javascript
function(control) { return this._events.some(function (evt) { if (evt.eventType === "ChildWorkflowExecutionCompleted") { var initiatedEventId = evt.childWorkflowExecutionCompletedEventAttributes.initiatedEventId; var initiatedEvent = this.eventById(initiatedEventId); ...
[ "function", "(", "control", ")", "{", "return", "this", ".", "_events", ".", "some", "(", "function", "(", "evt", ")", "{", "if", "(", "evt", ".", "eventType", "===", "\"ChildWorkflowExecutionCompleted\"", ")", "{", "var", "initiatedEventId", "=", "evt", "...
Return true if the child workflow is completed @param {String} control @returns {Boolean}
[ "Return", "true", "if", "the", "child", "workflow", "is", "completed" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L171-L182
34,779
neyric/aws-swf
lib/event-list.js
function(control) { var initiatedEventId, initiatedEvent; return this._events.some(function (evt) { if (evt.eventType === "StartChildWorkflowExecutionFailed") { initiatedEventId = evt.startChildWorkflowExecutionFailedEventAttributes.initiatedEventId; initiatedEvent = this.ev...
javascript
function(control) { var initiatedEventId, initiatedEvent; return this._events.some(function (evt) { if (evt.eventType === "StartChildWorkflowExecutionFailed") { initiatedEventId = evt.startChildWorkflowExecutionFailedEventAttributes.initiatedEventId; initiatedEvent = this.ev...
[ "function", "(", "control", ")", "{", "var", "initiatedEventId", ",", "initiatedEvent", ";", "return", "this", ".", "_events", ".", "some", "(", "function", "(", "evt", ")", "{", "if", "(", "evt", ".", "eventType", "===", "\"StartChildWorkflowExecutionFailed\"...
Return true if the child workflow has failed @param {String} control @returns {Boolean}
[ "Return", "true", "if", "the", "child", "workflow", "has", "failed" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L189-L206
34,780
neyric/aws-swf
lib/event-list.js
function (signalName) { var evt = this._event_find('WorkflowExecutionSignaled', 'signalName', signalName); if(!evt) { return null; } var signalInput = evt.workflowExecutionSignaledEventAttributes.input; try { var d = JSON.parse(signalInput); return d; } catc...
javascript
function (signalName) { var evt = this._event_find('WorkflowExecutionSignaled', 'signalName', signalName); if(!evt) { return null; } var signalInput = evt.workflowExecutionSignaledEventAttributes.input; try { var d = JSON.parse(signalInput); return d; } catc...
[ "function", "(", "signalName", ")", "{", "var", "evt", "=", "this", ".", "_event_find", "(", "'WorkflowExecutionSignaled'", ",", "'signalName'", ",", "signalName", ")", ";", "if", "(", "!", "evt", ")", "{", "return", "null", ";", "}", "var", "signalInput",...
Returns the signal input or null if the signal is not found or doesn't have JSON input @param {String} signalName @returns {Mixed}
[ "Returns", "the", "signal", "input", "or", "null", "if", "the", "signal", "is", "not", "found", "or", "doesn", "t", "have", "JSON", "input" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L278-L292
34,781
neyric/aws-swf
lib/event-list.js
function () { var i; for (i = 0; i < arguments.length; i++) { if (!this.is_activity_scheduled(arguments[i])) { return false; } } return true; }
javascript
function () { var i; for (i = 0; i < arguments.length; i++) { if (!this.is_activity_scheduled(arguments[i])) { return false; } } return true; }
[ "function", "(", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "this", ".", "is_activity_scheduled", "(", "arguments", "[", "i", "]", ")", ")", "{", ...
Return true if the arguments are all scheduled @param {String} [...] @returns {Boolean}
[ "Return", "true", "if", "the", "arguments", "are", "all", "scheduled" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L328-L336
34,782
neyric/aws-swf
lib/event-list.js
function () { var i; for (i = 0; i < arguments.length; i++) { if (!this.is_lambda_scheduled(arguments[i])) { return false; } } return true; }
javascript
function () { var i; for (i = 0; i < arguments.length; i++) { if (!this.is_lambda_scheduled(arguments[i])) { return false; } } return true; }
[ "function", "(", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "this", ".", "is_lambda_scheduled", "(", "arguments", "[", "i", "]", ")", ")", "{", "r...
Return true if the arguments are all scheduled lambda functions @param {String} [...] @returns {Boolean}
[ "Return", "true", "if", "the", "arguments", "are", "all", "scheduled", "lambda", "functions" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L343-L351
34,783
neyric/aws-swf
lib/event-list.js
function () { var i; for (i = 0; i < arguments.length; i++) { if ( ! (this.has_activity_completed(arguments[i]) || this.has_lambda_completed(arguments[i]) || this.childworkflow_completed(arguments[i]) || this.timer_fired(arguments[i]) ) ) { return false; } } return...
javascript
function () { var i; for (i = 0; i < arguments.length; i++) { if ( ! (this.has_activity_completed(arguments[i]) || this.has_lambda_completed(arguments[i]) || this.childworkflow_completed(arguments[i]) || this.timer_fired(arguments[i]) ) ) { return false; } } return...
[ "function", "(", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "(", "this", ".", "has_activity_completed", "(", "arguments", "[", "i", "]", ")", "||", ...
Return true if all the arguments are completed @param {String} [...] @returns {Boolean}
[ "Return", "true", "if", "all", "the", "arguments", "are", "completed" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L424-L432
34,784
neyric/aws-swf
lib/event-list.js
function () { var wfInput = this._events[0].workflowExecutionStartedEventAttributes.input; try { var d = JSON.parse(wfInput); return d; } catch (ex) { return wfInput; } }
javascript
function () { var wfInput = this._events[0].workflowExecutionStartedEventAttributes.input; try { var d = JSON.parse(wfInput); return d; } catch (ex) { return wfInput; } }
[ "function", "(", ")", "{", "var", "wfInput", "=", "this", ".", "_events", "[", "0", "]", ".", "workflowExecutionStartedEventAttributes", ".", "input", ";", "try", "{", "var", "d", "=", "JSON", ".", "parse", "(", "wfInput", ")", ";", "return", "d", ";",...
Get the input parameters of the workflow @returns {Mixed}
[ "Get", "the", "input", "parameters", "of", "the", "workflow" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L438-L448
34,785
neyric/aws-swf
lib/event-list.js
function (activityId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "ActivityTaskCompleted") { if (this.activityIdFor(evt.activityTaskCompletedEventAttributes.scheduledEventId) === activityId) { var result...
javascript
function (activityId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "ActivityTaskCompleted") { if (this.activityIdFor(evt.activityTaskCompletedEventAttributes.scheduledEventId) === activityId) { var result...
[ "function", "(", "activityId", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "this", ".", "_events", "[", "i", "]", ";", "if", "(", "...
Get the results for the given activityId @param {String} activityId @returns {Mixed}
[ "Get", "the", "results", "for", "the", "given", "activityId" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L456-L478
34,786
neyric/aws-swf
lib/event-list.js
function(control) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "ChildWorkflowExecutionCompleted") { var initiatedEventId = evt.childWorkflowExecutionCompletedEventAttributes.initiatedEventId; var initiatedE...
javascript
function(control) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "ChildWorkflowExecutionCompleted") { var initiatedEventId = evt.childWorkflowExecutionCompletedEventAttributes.initiatedEventId; var initiatedE...
[ "function", "(", "control", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "this", ".", "_events", "[", "i", "]", ";", "if", "(", "evt...
Get the results of a completed child workflow @param {String} control @returns {Mixed}
[ "Get", "the", "results", "of", "a", "completed", "child", "workflow" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L486-L512
34,787
neyric/aws-swf
lib/event-list.js
function (markerName) { var i, finalDetail; var lastEventId = 0; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if ((evt.eventType === 'MarkerRecorded') && (evt.markerRecordedEventAttributes.markerName === markerName) && (parseInt(evt.eventId, 10) > lastEvent...
javascript
function (markerName) { var i, finalDetail; var lastEventId = 0; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if ((evt.eventType === 'MarkerRecorded') && (evt.markerRecordedEventAttributes.markerName === markerName) && (parseInt(evt.eventId, 10) > lastEvent...
[ "function", "(", "markerName", ")", "{", "var", "i", ",", "finalDetail", ";", "var", "lastEventId", "=", "0", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "th...
Get the details of the last marker with the given name @param {String} markerName @returns {Mixed}
[ "Get", "the", "details", "of", "the", "last", "marker", "with", "the", "given", "name" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L519-L531
34,788
neyric/aws-swf
lib/event-list.js
function(){ var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "WorkflowExecutionCancelRequested") { return true; } } return false; }
javascript
function(){ var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "WorkflowExecutionCancelRequested") { return true; } } return false; }
[ "function", "(", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "this", ".", "_events", "[", "i", "]", ";", "if", "(", "evt", ".", "...
Return true if cancel request has arrived @returns {boolean}
[ "Return", "true", "if", "cancel", "request", "has", "arrived" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L545-L555
34,789
langholz/dtw
lib/dtw.js
function (options) { var state = { distanceCostMatrix: null }; if (typeof options === 'undefined') { state.distance = require('./distanceFunctions/squaredEuclidean').distance; } else { validateOptions(options); if (typeof options.distanceMetric === 'string') { state.dista...
javascript
function (options) { var state = { distanceCostMatrix: null }; if (typeof options === 'undefined') { state.distance = require('./distanceFunctions/squaredEuclidean').distance; } else { validateOptions(options); if (typeof options.distanceMetric === 'string') { state.dista...
[ "function", "(", "options", ")", "{", "var", "state", "=", "{", "distanceCostMatrix", ":", "null", "}", ";", "if", "(", "typeof", "options", "===", "'undefined'", ")", "{", "state", ".", "distance", "=", "require", "(", "'./distanceFunctions/squaredEuclidean'"...
Create a DTW object @class DTW Initializes a new instance of the `DTW`. If no options are provided the squared euclidean distance function is used. @function DTW @param {DTWOptions} [options] The options to initialize the dynamic time warping instance with. Computes the optimal match between two provided sequences....
[ "Create", "a", "DTW", "object" ]
fe0f3fdfa6dbbcfb0714056a744a9b9f633e74be
https://github.com/langholz/dtw/blob/fe0f3fdfa6dbbcfb0714056a744a9b9f633e74be/lib/dtw.js#L72-L106
34,790
lautr3k/lw.raster-to-gcode
dist/webworker_example/index.js
loadFile
function loadFile(file) { console.log('loadFile:', file); // <file> can be Image, File URL object or URL string (http://* or data:image/*) rasterToGcode.load(file).then(function(rtg) { console.log('rasterToGcode:', rtg); }) .catch(function(error) { console.error('error:', error); ...
javascript
function loadFile(file) { console.log('loadFile:', file); // <file> can be Image, File URL object or URL string (http://* or data:image/*) rasterToGcode.load(file).then(function(rtg) { console.log('rasterToGcode:', rtg); }) .catch(function(error) { console.error('error:', error); ...
[ "function", "loadFile", "(", "file", ")", "{", "console", ".", "log", "(", "'loadFile:'", ",", "file", ")", ";", "// <file> can be Image, File URL object or URL string (http://* or data:image/*)", "rasterToGcode", ".", "load", "(", "file", ")", ".", "then", "(", "fu...
Load the input file
[ "Load", "the", "input", "file" ]
f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e
https://github.com/lautr3k/lw.raster-to-gcode/blob/f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e/dist/webworker_example/index.js#L39-L49
34,791
lautr3k/lw.raster-to-gcode
dist/webworker_example/index.js
createWorker
function createWorker() { var worker = new Worker('worker.js'); // On worker messsage worker.onmessage = function(event) { if (event.data.event === 'done') { console.log('done:', event.data.data); $('#start').show(); $('#abort').hide(); } else if ...
javascript
function createWorker() { var worker = new Worker('worker.js'); // On worker messsage worker.onmessage = function(event) { if (event.data.event === 'done') { console.log('done:', event.data.data); $('#start').show(); $('#abort').hide(); } else if ...
[ "function", "createWorker", "(", ")", "{", "var", "worker", "=", "new", "Worker", "(", "'worker.js'", ")", ";", "// On worker messsage", "worker", ".", "onmessage", "=", "function", "(", "event", ")", "{", "if", "(", "event", ".", "data", ".", "event", "...
Create and return the Worker object
[ "Create", "and", "return", "the", "Worker", "object" ]
f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e
https://github.com/lautr3k/lw.raster-to-gcode/blob/f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e/dist/webworker_example/index.js#L52-L68
34,792
lautr3k/lw.raster-to-gcode
dist/example/index.js
toHeightMap
function toHeightMap() { if (rasterToGcode.running) { return rasterToGcode.abort(); } console.log('toHeightMap:', file.name); $toHeightMap.text('Abort').addClass('btn-danger'); $progressBar.removeClass('progress-bar-danger'); $progressBar.parent().show(); rasterToGcode.getHeightMap(...
javascript
function toHeightMap() { if (rasterToGcode.running) { return rasterToGcode.abort(); } console.log('toHeightMap:', file.name); $toHeightMap.text('Abort').addClass('btn-danger'); $progressBar.removeClass('progress-bar-danger'); $progressBar.parent().show(); rasterToGcode.getHeightMap(...
[ "function", "toHeightMap", "(", ")", "{", "if", "(", "rasterToGcode", ".", "running", ")", "{", "return", "rasterToGcode", ".", "abort", "(", ")", ";", "}", "console", ".", "log", "(", "'toHeightMap:'", ",", "file", ".", "name", ")", ";", "$toHeightMap",...
To height-map
[ "To", "height", "-", "map" ]
f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e
https://github.com/lautr3k/lw.raster-to-gcode/blob/f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e/dist/example/index.js#L194-L204
34,793
lautr3k/lw.raster-to-gcode
dist/example/index.js
downloadHeightMap
function downloadHeightMap() { console.log('downloadHeightMap:', file.name); var heightMapFile = new Blob([heightMap], { type: 'text/plain;charset=utf-8' }); saveAs(heightMapFile, file.name + '.height-map.txt'); }
javascript
function downloadHeightMap() { console.log('downloadHeightMap:', file.name); var heightMapFile = new Blob([heightMap], { type: 'text/plain;charset=utf-8' }); saveAs(heightMapFile, file.name + '.height-map.txt'); }
[ "function", "downloadHeightMap", "(", ")", "{", "console", ".", "log", "(", "'downloadHeightMap:'", ",", "file", ".", "name", ")", ";", "var", "heightMapFile", "=", "new", "Blob", "(", "[", "heightMap", "]", ",", "{", "type", ":", "'text/plain;charset=utf-8'...
Download height-map
[ "Download", "height", "-", "map" ]
f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e
https://github.com/lautr3k/lw.raster-to-gcode/blob/f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e/dist/example/index.js#L207-L211
34,794
strophe/strophejs-plugin-pubsub
src/strophe.pubsub.js
function(conn) { this._connection = conn; /* Function used to setup plugin. */ /* extend name space * NS.PUBSUB - XMPP Publish Subscribe namespace * from XEP 60. * * NS.PUBSUB_SUBSCRIBE_OPTIONS - XMPP pubsub * ...
javascript
function(conn) { this._connection = conn; /* Function used to setup plugin. */ /* extend name space * NS.PUBSUB - XMPP Publish Subscribe namespace * from XEP 60. * * NS.PUBSUB_SUBSCRIBE_OPTIONS - XMPP pubsub * ...
[ "function", "(", "conn", ")", "{", "this", ".", "_connection", "=", "conn", ";", "/*\n Function used to setup plugin.\n */", "/* extend name space\n * NS.PUBSUB - XMPP Publish Subscribe namespace\n * from XEP 60.\n *\n * NS.PUBSUB_SUBS...
The plugin must have the init function.
[ "The", "plugin", "must", "have", "the", "init", "function", "." ]
fc12f60570bdd2b73cc87077a884a102bc32f3be
https://github.com/strophe/strophejs-plugin-pubsub/blob/fc12f60570bdd2b73cc87077a884a102bc32f3be/src/strophe.pubsub.js#L98-L140
34,795
strophe/strophejs-plugin-pubsub
src/strophe.pubsub.js
function (status, condition) { var that = this._connection; if (this._autoService && status === Strophe.Status.CONNECTED) { this.service = 'pubsub.'+Strophe.getDomainFromJid(that.jid); this.jid = that.jid; } }
javascript
function (status, condition) { var that = this._connection; if (this._autoService && status === Strophe.Status.CONNECTED) { this.service = 'pubsub.'+Strophe.getDomainFromJid(that.jid); this.jid = that.jid; } }
[ "function", "(", "status", ",", "condition", ")", "{", "var", "that", "=", "this", ".", "_connection", ";", "if", "(", "this", ".", "_autoService", "&&", "status", "===", "Strophe", ".", "Status", ".", "CONNECTED", ")", "{", "this", ".", "service", "="...
Called by Strophe on connection event
[ "Called", "by", "Strophe", "on", "connection", "event" ]
fc12f60570bdd2b73cc87077a884a102bc32f3be
https://github.com/strophe/strophejs-plugin-pubsub/blob/fc12f60570bdd2b73cc87077a884a102bc32f3be/src/strophe.pubsub.js#L143-L149
34,796
ucscXena/static-interval-tree
js/index.js
toTree
function toTree(arr, low, high) { if (low >= high) { return undefined; } var mid = Math.floor((high + low) / 2); return { el: arr[mid], right: toTree(arr, mid + 1, high), left: toTree(arr, low, mid) }; }
javascript
function toTree(arr, low, high) { if (low >= high) { return undefined; } var mid = Math.floor((high + low) / 2); return { el: arr[mid], right: toTree(arr, mid + 1, high), left: toTree(arr, low, mid) }; }
[ "function", "toTree", "(", "arr", ",", "low", ",", "high", ")", "{", "if", "(", "low", ">=", "high", ")", "{", "return", "undefined", ";", "}", "var", "mid", "=", "Math", ".", "floor", "(", "(", "high", "+", "low", ")", "/", "2", ")", ";", "r...
Build a balanced binary tree from an ordered array.
[ "Build", "a", "balanced", "binary", "tree", "from", "an", "ordered", "array", "." ]
5cbe1e5b35a8b9fa27f1530a820def21d3ca037b
https://github.com/ucscXena/static-interval-tree/blob/5cbe1e5b35a8b9fa27f1530a820def21d3ca037b/js/index.js#L12-L22
34,797
ucscXena/static-interval-tree
js/index.js
findEnd
function findEnd(node) { if (!node) { return undefined; } var {left, right, el} = node; findEnd(left); findEnd(right); node.high = Math.max(getHigh(left), getHigh(right), el.end); return node; }
javascript
function findEnd(node) { if (!node) { return undefined; } var {left, right, el} = node; findEnd(left); findEnd(right); node.high = Math.max(getHigh(left), getHigh(right), el.end); return node; }
[ "function", "findEnd", "(", "node", ")", "{", "if", "(", "!", "node", ")", "{", "return", "undefined", ";", "}", "var", "{", "left", ",", "right", ",", "el", "}", "=", "node", ";", "findEnd", "(", "left", ")", ";", "findEnd", "(", "right", ")", ...
Find the highest end value of each node. Mutates its input.
[ "Find", "the", "highest", "end", "value", "of", "each", "node", ".", "Mutates", "its", "input", "." ]
5cbe1e5b35a8b9fa27f1530a820def21d3ca037b
https://github.com/ucscXena/static-interval-tree/blob/5cbe1e5b35a8b9fa27f1530a820def21d3ca037b/js/index.js#L27-L36
34,798
groupon/assertive
src/assertive.js
getNameOfType
function getNameOfType(x) { switch (false) { case !(x == null): return `${x}`; // null / undefined case !is.String(x): return x; case !is.Function(x): return x.name; case !is.NaN(x): return 'NaN'; default: return x; } }
javascript
function getNameOfType(x) { switch (false) { case !(x == null): return `${x}`; // null / undefined case !is.String(x): return x; case !is.Function(x): return x.name; case !is.NaN(x): return 'NaN'; default: return x; } }
[ "function", "getNameOfType", "(", "x", ")", "{", "switch", "(", "false", ")", "{", "case", "!", "(", "x", "==", "null", ")", ":", "return", "`", "${", "x", "}", "`", ";", "// null / undefined", "case", "!", "is", ".", "String", "(", "x", ")", ":"...
translates any argument we were meant to interpret as a type, into its name
[ "translates", "any", "argument", "we", "were", "meant", "to", "interpret", "as", "a", "type", "into", "its", "name" ]
4118ffca647260914494183d9ebbc5bde735a574
https://github.com/groupon/assertive/blob/4118ffca647260914494183d9ebbc5bde735a574/src/assertive.js#L223-L236
34,799
simonepri/phc-argon2
index.js
hash
function hash(password, options) { options = options || {}; let variant = options.variant || defaults.variant; const iterations = options.iterations || defaults.iterations; const memory = options.memory || defaults.memory; const parallelism = options.parallelism || defaults.parallelism; const saltSize = opt...
javascript
function hash(password, options) { options = options || {}; let variant = options.variant || defaults.variant; const iterations = options.iterations || defaults.iterations; const memory = options.memory || defaults.memory; const parallelism = options.parallelism || defaults.parallelism; const saltSize = opt...
[ "function", "hash", "(", "password", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "let", "variant", "=", "options", ".", "variant", "||", "defaults", ".", "variant", ";", "const", "iterations", "=", "options", ".", "iteration...
Computes the hash string of the given password in the PHC format using argon2 package. @public @param {string} password The password to hash. @param {Object} [options] Optional configurations related to the hashing function. @param {number} [options.variant=id] Optinal variant of argon2 to use. Can be one of [`'d'`,...
[ "Computes", "the", "hash", "string", "of", "the", "given", "password", "in", "the", "PHC", "format", "using", "argon2", "package", "." ]
900c5aea9185b69a677ce27ce06aa8a9526222fd
https://github.com/simonepri/phc-argon2/blob/900c5aea9185b69a677ce27ce06aa8a9526222fd/index.js#L81-L182