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
37,600
BohemiaInteractive/bi-service
bin/bi-service.js
_setImmediate
function _setImmediate(fn) { let args = Array.prototype.slice.call(arguments, 1); return new Promise(function(resolve, reject) { setImmediate(function() { try { fn.apply(this, args); } catch(e) { return reject(e); } resolve(...
javascript
function _setImmediate(fn) { let args = Array.prototype.slice.call(arguments, 1); return new Promise(function(resolve, reject) { setImmediate(function() { try { fn.apply(this, args); } catch(e) { return reject(e); } resolve(...
[ "function", "_setImmediate", "(", "fn", ")", "{", "let", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "s...
setImmediate which returns a Promise @return <Promise>
[ "setImmediate", "which", "returns", "a", "Promise" ]
89e76f2e93714a3150ce7f59f16f646e4bdbbce1
https://github.com/BohemiaInteractive/bi-service/blob/89e76f2e93714a3150ce7f59f16f646e4bdbbce1/bin/bi-service.js#L223-L235
37,601
BohemiaInteractive/bi-service
bin/bi-service.js
_onBuildApp
function _onBuildApp(app) { let proto = Object.getPrototypeOf(app); if (proto.constructor && proto.constructor.name === 'ShellApp') { app.once('post-init', function() { this.build(); this.listen(); }); } }
javascript
function _onBuildApp(app) { let proto = Object.getPrototypeOf(app); if (proto.constructor && proto.constructor.name === 'ShellApp') { app.once('post-init', function() { this.build(); this.listen(); }); } }
[ "function", "_onBuildApp", "(", "app", ")", "{", "let", "proto", "=", "Object", ".", "getPrototypeOf", "(", "app", ")", ";", "if", "(", "proto", ".", "constructor", "&&", "proto", ".", "constructor", ".", "name", "===", "'ShellApp'", ")", "{", "app", "...
`build-app` AppManager listener @private
[ "build", "-", "app", "AppManager", "listener" ]
89e76f2e93714a3150ce7f59f16f646e4bdbbce1
https://github.com/BohemiaInteractive/bi-service/blob/89e76f2e93714a3150ce7f59f16f646e4bdbbce1/bin/bi-service.js#L241-L249
37,602
koopero/node-unique-file-name
src/random.js
random
function random( width, set ) { width = parseInt( width ) || 4 set = set || RANDOM_SET ass.isString( set, "Random character set must be string" ) var i = 0, r = '' for ( ; i < width; i ++ ) r += RANDOM_SET[ Math.floor( Math.random() * RANDOM_SET.length ) ] return r }
javascript
function random( width, set ) { width = parseInt( width ) || 4 set = set || RANDOM_SET ass.isString( set, "Random character set must be string" ) var i = 0, r = '' for ( ; i < width; i ++ ) r += RANDOM_SET[ Math.floor( Math.random() * RANDOM_SET.length ) ] return r }
[ "function", "random", "(", "width", ",", "set", ")", "{", "width", "=", "parseInt", "(", "width", ")", "||", "4", "set", "=", "set", "||", "RANDOM_SET", "ass", ".", "isString", "(", "set", ",", "\"Random character set must be string\"", ")", "var", "i", ...
Produces a string of random character of a certain width. Uses the character set RANDOM_SET.
[ "Produces", "a", "string", "of", "random", "character", "of", "a", "certain", "width", ".", "Uses", "the", "character", "set", "RANDOM_SET", "." ]
e503c0f743711bbfcf5444165902206192567c06
https://github.com/koopero/node-unique-file-name/blob/e503c0f743711bbfcf5444165902206192567c06/src/random.js#L13-L27
37,603
jimivdw/grunt-mutation-testing
utils/OptionUtils.js
expandFiles
function expandFiles(files, basePath) { var expandedFiles = []; files = files ? _.isArray(files) ? files : [files] : []; _.forEach(files, function(fileName) { expandedFiles = _.union( expandedFiles, glob.sync(path.join(basePath, fileName), { dot: true, nodir: true }) ...
javascript
function expandFiles(files, basePath) { var expandedFiles = []; files = files ? _.isArray(files) ? files : [files] : []; _.forEach(files, function(fileName) { expandedFiles = _.union( expandedFiles, glob.sync(path.join(basePath, fileName), { dot: true, nodir: true }) ...
[ "function", "expandFiles", "(", "files", ",", "basePath", ")", "{", "var", "expandedFiles", "=", "[", "]", ";", "files", "=", "files", "?", "_", ".", "isArray", "(", "files", ")", "?", "files", ":", "[", "files", "]", ":", "[", "]", ";", "_", "."...
Prepend all given files with the provided basepath and expand all wildcards @param files the files to expand @param basePath the basepath from which the files should be expanded @returns {Array} list of expanded files
[ "Prepend", "all", "given", "files", "with", "the", "provided", "basepath", "and", "expand", "all", "wildcards" ]
698b1b20813cd7d46cf44f09cc016f5cd6460f5f
https://github.com/jimivdw/grunt-mutation-testing/blob/698b1b20813cd7d46cf44f09cc016f5cd6460f5f/utils/OptionUtils.js#L89-L101
37,604
jimivdw/grunt-mutation-testing
utils/OptionUtils.js
getOptions
function getOptions(grunt, task) { var globalOpts = grunt.config(task.name).options; var localOpts = grunt.config([task.name, task.target]).options; var opts = _.merge({}, DEFAULT_OPTIONS, globalOpts, localOpts); // Set logging options log4js.setGlobalLogLevel(log4js.levels[opts.logLevel]); log...
javascript
function getOptions(grunt, task) { var globalOpts = grunt.config(task.name).options; var localOpts = grunt.config([task.name, task.target]).options; var opts = _.merge({}, DEFAULT_OPTIONS, globalOpts, localOpts); // Set logging options log4js.setGlobalLogLevel(log4js.levels[opts.logLevel]); log...
[ "function", "getOptions", "(", "grunt", ",", "task", ")", "{", "var", "globalOpts", "=", "grunt", ".", "config", "(", "task", ".", "name", ")", ".", "options", ";", "var", "localOpts", "=", "grunt", ".", "config", "(", "[", "task", ".", "name", ",", ...
Get the options for a given mutationTest grunt task @param grunt @param task the grunt task @returns {*} the found options, or [null] when not all required options have been set
[ "Get", "the", "options", "for", "a", "given", "mutationTest", "grunt", "task" ]
698b1b20813cd7d46cf44f09cc016f5cd6460f5f
https://github.com/jimivdw/grunt-mutation-testing/blob/698b1b20813cd7d46cf44f09cc016f5cd6460f5f/utils/OptionUtils.js#L109-L136
37,605
peecky/node-buffering
lib/buffering.js
Buffering
function Buffering(options) { events.EventEmitter.call(this); options = options || {}; if (options.useUnique) { var newOptions = {}; Object.keys(options).forEach(function(key) { if (key != 'useUnique') newOptions[key] = options[key]; }); return new UniqueBufferi...
javascript
function Buffering(options) { events.EventEmitter.call(this); options = options || {}; if (options.useUnique) { var newOptions = {}; Object.keys(options).forEach(function(key) { if (key != 'useUnique') newOptions[key] = options[key]; }); return new UniqueBufferi...
[ "function", "Buffering", "(", "options", ")", "{", "events", ".", "EventEmitter", ".", "call", "(", "this", ")", ";", "options", "=", "options", "||", "{", "}", ";", "if", "(", "options", ".", "useUnique", ")", "{", "var", "newOptions", "=", "{", "}"...
ES 5+ will handle null and undefined
[ "ES", "5", "+", "will", "handle", "null", "and", "undefined" ]
c3ce84d796aeb319ecbeafce6833587dff9cb048
https://github.com/peecky/node-buffering/blob/c3ce84d796aeb319ecbeafce6833587dff9cb048/lib/buffering.js#L6-L26
37,606
eswdd/aardvark
static-content/HorizonRenderer.js
reducer
function reducer(individualSeries, initialFunction, reductionFunction) { if (individualSeries.length == 0) { return NaN; } var initial = initialFunction(individualSeries[0][1]); var i=1; ...
javascript
function reducer(individualSeries, initialFunction, reductionFunction) { if (individualSeries.length == 0) { return NaN; } var initial = initialFunction(individualSeries[0][1]); var i=1; ...
[ "function", "reducer", "(", "individualSeries", ",", "initialFunction", ",", "reductionFunction", ")", "{", "if", "(", "individualSeries", ".", "length", "==", "0", ")", "{", "return", "NaN", ";", "}", "var", "initial", "=", "initialFunction", "(", "individual...
do sorting before we parse
[ "do", "sorting", "before", "we", "parse" ]
7e0797fe5cde53047e610bd866d22e6caf0c6d49
https://github.com/eswdd/aardvark/blob/7e0797fe5cde53047e610bd866d22e6caf0c6d49/static-content/HorizonRenderer.js#L326-L341
37,607
jimivdw/grunt-mutation-testing
lib/reporting/html/IndexHtmlBuilder.js
function(baseDir, config) { this._baseDir = baseDir; this._config = _.merge({}, DEFAULT_CONFIG, config); this._folderPercentages = {}; }
javascript
function(baseDir, config) { this._baseDir = baseDir; this._config = _.merge({}, DEFAULT_CONFIG, config); this._folderPercentages = {}; }
[ "function", "(", "baseDir", ",", "config", ")", "{", "this", ".", "_baseDir", "=", "baseDir", ";", "this", ".", "_config", "=", "_", ".", "merge", "(", "{", "}", ",", "DEFAULT_CONFIG", ",", "config", ")", ";", "this", ".", "_folderPercentages", "=", ...
IndexHtmlBuilder constructor. @param {string} baseDir @param {object=} config @constructor
[ "IndexHtmlBuilder", "constructor", "." ]
698b1b20813cd7d46cf44f09cc016f5cd6460f5f
https://github.com/jimivdw/grunt-mutation-testing/blob/698b1b20813cd7d46cf44f09cc016f5cd6460f5f/lib/reporting/html/IndexHtmlBuilder.js#L28-L32
37,608
userapp-io/passport-userapp
examples/signup-login/app.js
createUser
function createUser(req, res, next){ // the HTML form names are conveniently named the same as // the UserApp fields... var user = req.body; // Create the user in UserApp UserApp.User.save(user, function(err, user){ // We can just pass through messages like "Passwo...
javascript
function createUser(req, res, next){ // the HTML form names are conveniently named the same as // the UserApp fields... var user = req.body; // Create the user in UserApp UserApp.User.save(user, function(err, user){ // We can just pass through messages like "Passwo...
[ "function", "createUser", "(", "req", ",", "res", ",", "next", ")", "{", "// the HTML form names are conveniently named the same as", "// the UserApp fields...", "var", "user", "=", "req", ".", "body", ";", "// Create the user in UserApp", "UserApp", ".", "User", ".", ...
first we need to create the user in UserApp
[ "first", "we", "need", "to", "create", "the", "user", "in", "UserApp" ]
3f4b7a09ff19abf7f7620c04b37023b06b2f85d0
https://github.com/userapp-io/passport-userapp/blob/3f4b7a09ff19abf7f7620c04b37023b06b2f85d0/examples/signup-login/app.js#L92-L112
37,609
jhermsmeier/node-udif
lib/block.js
Block
function Block() { if( !(this instanceof Block) ) return new Block() /** @type {Number} Entry / compression type */ this.type = 0x00000000 /** @type {String} Entry type name */ this.description = 'UNKNOWN' /** @type {String} Comment ('+beg'|'+end' if type == COMMENT) */ this.comment = '' /** @type...
javascript
function Block() { if( !(this instanceof Block) ) return new Block() /** @type {Number} Entry / compression type */ this.type = 0x00000000 /** @type {String} Entry type name */ this.description = 'UNKNOWN' /** @type {String} Comment ('+beg'|'+end' if type == COMMENT) */ this.comment = '' /** @type...
[ "function", "Block", "(", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Block", ")", ")", "return", "new", "Block", "(", ")", "/** @type {Number} Entry / compression type */", "this", ".", "type", "=", "0x00000000", "/** @type {String} Entry type name */", ...
Mish Blkx Block Descriptor @constructor @memberOf DMG.Mish @return {Block}
[ "Mish", "Blkx", "Block", "Descriptor" ]
1f5ee84d617e8ebafc8740aec0a734602a1e8b13
https://github.com/jhermsmeier/node-udif/blob/1f5ee84d617e8ebafc8740aec0a734602a1e8b13/lib/block.js#L10-L30
37,610
jhermsmeier/node-udif
lib/block.js
function( buffer, offset ) { offset = offset || 0 this.type = buffer.readUInt32BE( offset + 0 ) this.description = Block.getDescription( this.type ) this.comment = buffer.toString( 'ascii', offset + 4, offset + 8 ).replace( /\u0000/g, '' ) this.sectorNumber = uint64.readBE( buffer, offset + 8, 8 )...
javascript
function( buffer, offset ) { offset = offset || 0 this.type = buffer.readUInt32BE( offset + 0 ) this.description = Block.getDescription( this.type ) this.comment = buffer.toString( 'ascii', offset + 4, offset + 8 ).replace( /\u0000/g, '' ) this.sectorNumber = uint64.readBE( buffer, offset + 8, 8 )...
[ "function", "(", "buffer", ",", "offset", ")", "{", "offset", "=", "offset", "||", "0", "this", ".", "type", "=", "buffer", ".", "readUInt32BE", "(", "offset", "+", "0", ")", "this", ".", "description", "=", "Block", ".", "getDescription", "(", "this",...
Parse Mish Block data from a buffer @param {Buffer} buffer @param {Number} [offset=0] @returns {Block}
[ "Parse", "Mish", "Block", "data", "from", "a", "buffer" ]
1f5ee84d617e8ebafc8740aec0a734602a1e8b13
https://github.com/jhermsmeier/node-udif/blob/1f5ee84d617e8ebafc8740aec0a734602a1e8b13/lib/block.js#L76-L90
37,611
tumblr/tumblr-repl
index.js
print
function print(object) { console.log(util.inspect(object, null, null, true)); }
javascript
function print(object) { console.log(util.inspect(object, null, null, true)); }
[ "function", "print", "(", "object", ")", "{", "console", ".", "log", "(", "util", ".", "inspect", "(", "object", ",", "null", ",", "null", ",", "true", ")", ")", ";", "}" ]
Style output with ANSI color codes
[ "Style", "output", "with", "ANSI", "color", "codes" ]
9af1d83ff76aa318be921947ecdefe7d0ae90346
https://github.com/tumblr/tumblr-repl/blob/9af1d83ff76aa318be921947ecdefe7d0ae90346/index.js#L19-L21
37,612
chanon/re-require-module
index.js
callsites
function callsites() { var _ = Error.prepareStackTrace; Error.prepareStackTrace = function (_, stack) { return stack; }; var stack = new Error().stack.slice(1); Error.prepareStackTrace = _; return stack; }
javascript
function callsites() { var _ = Error.prepareStackTrace; Error.prepareStackTrace = function (_, stack) { return stack; }; var stack = new Error().stack.slice(1); Error.prepareStackTrace = _; return stack; }
[ "function", "callsites", "(", ")", "{", "var", "_", "=", "Error", ".", "prepareStackTrace", ";", "Error", ".", "prepareStackTrace", "=", "function", "(", "_", ",", "stack", ")", "{", "return", "stack", ";", "}", ";", "var", "stack", "=", "new", "Error"...
taken from callsites module
[ "taken", "from", "callsites", "module" ]
bd0d05df8bdd0efd3d49e26b91f71e09ec24b340
https://github.com/chanon/re-require-module/blob/bd0d05df8bdd0efd3d49e26b91f71e09ec24b340/index.js#L5-L13
37,613
chanon/re-require-module
index.js
existsCached
function existsCached(testPath) { if (existsCache[testPath] == 1) { return true; } if (existsCache[testPath] == 0) { return false; } if (exists(testPath)) { existsCache[testPath] = 1; return true; } else { existsCache[testPath] = 0; return false; } }
javascript
function existsCached(testPath) { if (existsCache[testPath] == 1) { return true; } if (existsCache[testPath] == 0) { return false; } if (exists(testPath)) { existsCache[testPath] = 1; return true; } else { existsCache[testPath] = 0; return false; } }
[ "function", "existsCached", "(", "testPath", ")", "{", "if", "(", "existsCache", "[", "testPath", "]", "==", "1", ")", "{", "return", "true", ";", "}", "if", "(", "existsCache", "[", "testPath", "]", "==", "0", ")", "{", "return", "false", ";", "}", ...
caches the 'exists' results so we don't hit the file system everytime in production
[ "caches", "the", "exists", "results", "so", "we", "don", "t", "hit", "the", "file", "system", "everytime", "in", "production" ]
bd0d05df8bdd0efd3d49e26b91f71e09ec24b340
https://github.com/chanon/re-require-module/blob/bd0d05df8bdd0efd3d49e26b91f71e09ec24b340/index.js#L28-L43
37,614
mikewesthad/pirate-speak
lib/pirate-speak.js
applyCase
function applyCase(wordA, wordB) { // Exception to avoid words like "I" being converted to "ME" if (wordA.length === 1 && wordB.length !== 1) return wordB; // Uppercase if (wordA === wordA.toUpperCase()) return wordB.toUpperCase(); // Lowercase if (wordA === wordA.toLowerCase()) return wordB.toLowerCase(); // Ca...
javascript
function applyCase(wordA, wordB) { // Exception to avoid words like "I" being converted to "ME" if (wordA.length === 1 && wordB.length !== 1) return wordB; // Uppercase if (wordA === wordA.toUpperCase()) return wordB.toUpperCase(); // Lowercase if (wordA === wordA.toLowerCase()) return wordB.toLowerCase(); // Ca...
[ "function", "applyCase", "(", "wordA", ",", "wordB", ")", "{", "// Exception to avoid words like \"I\" being converted to \"ME\"", "if", "(", "wordA", ".", "length", "===", "1", "&&", "wordB", ".", "length", "!==", "1", ")", "return", "wordB", ";", "// Uppercase",...
Take the case from wordA and apply it to wordB
[ "Take", "the", "case", "from", "wordA", "and", "apply", "it", "to", "wordB" ]
2b7c9ef4fb82877ed88d0ed2644ccb60b06415d6
https://github.com/mikewesthad/pirate-speak/blob/2b7c9ef4fb82877ed88d0ed2644ccb60b06415d6/lib/pirate-speak.js#L164-L179
37,615
gosaya-com/needjs
index.js
function(options){ EventEmitter.call(this); // Data Structures // Persistence this.data = {}; this.triggers = {}; this.queue = []; this.nextTick = false; // Dynamic this.needs = {}; this.events = {}; this.options = options || {}; }
javascript
function(options){ EventEmitter.call(this); // Data Structures // Persistence this.data = {}; this.triggers = {}; this.queue = []; this.nextTick = false; // Dynamic this.needs = {}; this.events = {}; this.options = options || {}; }
[ "function", "(", "options", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", ";", "// Data Structures", "// Persistence", "this", ".", "data", "=", "{", "}", ";", "this", ".", "triggers", "=", "{", "}", ";", "this", ".", "queue", "=", "[", "]...
The core NeedJS system. This class handles all calls and manages the needs and requests. @module NeedJS @alias module:NeedJS
[ "The", "core", "NeedJS", "system", ".", "This", "class", "handles", "all", "calls", "and", "manages", "the", "needs", "and", "requests", "." ]
d45f1f91127710becac512f4309de8fca5a0bef9
https://github.com/gosaya-com/needjs/blob/d45f1f91127710becac512f4309de8fca5a0bef9/index.js#L12-L26
37,616
shaoshuai0102/sief
lib/plugins/weibo.com.js
run
function run(data) { var cookies = cookie.parse(data.cookies); debug('cookies: ', cookies); request({ method: 'POST', url: 'http://weibo.com/aj/mblog/add?_wv=5&__rnd=' + (new Date).getTime(), headers: { Cookie: data.cookies, Referer: data.referer }, form: 'text=you%20are%20attacked...
javascript
function run(data) { var cookies = cookie.parse(data.cookies); debug('cookies: ', cookies); request({ method: 'POST', url: 'http://weibo.com/aj/mblog/add?_wv=5&__rnd=' + (new Date).getTime(), headers: { Cookie: data.cookies, Referer: data.referer }, form: 'text=you%20are%20attacked...
[ "function", "run", "(", "data", ")", "{", "var", "cookies", "=", "cookie", ".", "parse", "(", "data", ".", "cookies", ")", ";", "debug", "(", "'cookies: '", ",", "cookies", ")", ";", "request", "(", "{", "method", ":", "'POST'", ",", "url", ":", "'...
request.debug = true;
[ "request", ".", "debug", "=", "true", ";" ]
eeaf5e4363505021ec28783827d35c17dca3074c
https://github.com/shaoshuai0102/sief/blob/eeaf5e4363505021ec28783827d35c17dca3074c/lib/plugins/weibo.com.js#L7-L22
37,617
pmlopes/webpack-vertx-plugin
index.js
getMaven
function getMaven(dir) { var mvn = 'mvn'; var isWin = /^win/.test(process.platform); // check for wrapper if (isWin) { if (fs.existsSync(path.resolve(dir, 'mvnw.bat'))) { mvn = path.resolve(dir, 'mvnw.bat'); } } else { if (fs.existsSync(path.resolve(dir, 'mvnw'))) { mvn = path.resolve...
javascript
function getMaven(dir) { var mvn = 'mvn'; var isWin = /^win/.test(process.platform); // check for wrapper if (isWin) { if (fs.existsSync(path.resolve(dir, 'mvnw.bat'))) { mvn = path.resolve(dir, 'mvnw.bat'); } } else { if (fs.existsSync(path.resolve(dir, 'mvnw'))) { mvn = path.resolve...
[ "function", "getMaven", "(", "dir", ")", "{", "var", "mvn", "=", "'mvn'", ";", "var", "isWin", "=", "/", "^win", "/", ".", "test", "(", "process", ".", "platform", ")", ";", "// check for wrapper", "if", "(", "isWin", ")", "{", "if", "(", "fs", "."...
Helper to select local maven wrapper or system maven @param dir current working directory @returns {string} the maven command
[ "Helper", "to", "select", "local", "maven", "wrapper", "or", "system", "maven" ]
de15ee291c21c5303f36b53b7ae4a93eec850b17
https://github.com/pmlopes/webpack-vertx-plugin/blob/de15ee291c21c5303f36b53b7ae4a93eec850b17/index.js#L21-L37
37,618
AlexanderOMara/bootstrap-node
src/index.js
getBootstrapNode
function getBootstrapNode() { // Use the cache if already found. if (cache) { return cache; } // Get the debug object. var Debug = require('vm').runInDebugContext('Debug'); // Use the debug object to list all of the scripts. // It is only possible to get the scripts is a listener is set. // However, we do n...
javascript
function getBootstrapNode() { // Use the cache if already found. if (cache) { return cache; } // Get the debug object. var Debug = require('vm').runInDebugContext('Debug'); // Use the debug object to list all of the scripts. // It is only possible to get the scripts is a listener is set. // However, we do n...
[ "function", "getBootstrapNode", "(", ")", "{", "// Use the cache if already found.", "if", "(", "cache", ")", "{", "return", "cache", ";", "}", "// Get the debug object.", "var", "Debug", "=", "require", "(", "'vm'", ")", ".", "runInDebugContext", "(", "'Debug'", ...
Get the Node bootstrap script source. @throws Error - If script not found. @returns {string} - Script source.
[ "Get", "the", "Node", "bootstrap", "script", "source", "." ]
c3b08faf71c553feff9c31ab1772e71be5fd9fbd
https://github.com/AlexanderOMara/bootstrap-node/blob/c3b08faf71c553feff9c31ab1772e71be5fd9fbd/src/index.js#L28-L87
37,619
mikolalysenko/3p
lib/decoder.js
buildStars
function buildStars(numVerts, cells) { var stars = new Array(numVerts) for(var i=0; i<numVerts; ++i) { stars[i] = [] } var numCells = cells.length for(var i=0; i<numCells; ++i) { var f = cells[i] for(var j=0; j<3; ++j) { stars[f[j]].push(i) } } return stars }
javascript
function buildStars(numVerts, cells) { var stars = new Array(numVerts) for(var i=0; i<numVerts; ++i) { stars[i] = [] } var numCells = cells.length for(var i=0; i<numCells; ++i) { var f = cells[i] for(var j=0; j<3; ++j) { stars[f[j]].push(i) } } return stars }
[ "function", "buildStars", "(", "numVerts", ",", "cells", ")", "{", "var", "stars", "=", "new", "Array", "(", "numVerts", ")", "for", "(", "var", "i", "=", "0", ";", "i", "<", "numVerts", ";", "++", "i", ")", "{", "stars", "[", "i", "]", "=", "[...
Construct all stars of a mesh
[ "Construct", "all", "stars", "of", "a", "mesh" ]
e8148a633303d65db1a81e1ef3761c811536c113
https://github.com/mikolalysenko/3p/blob/e8148a633303d65db1a81e1ef3761c811536c113/lib/decoder.js#L8-L21
37,620
zaim/immpatch
lib/parse.js
clone
function clone(obj) { var key; var copy = {}; for (key in obj) { /* istanbul ignore else */ if (hop.call(obj, key)) { copy[key] = obj[key]; } } return copy; }
javascript
function clone(obj) { var key; var copy = {}; for (key in obj) { /* istanbul ignore else */ if (hop.call(obj, key)) { copy[key] = obj[key]; } } return copy; }
[ "function", "clone", "(", "obj", ")", "{", "var", "key", ";", "var", "copy", "=", "{", "}", ";", "for", "(", "key", "in", "obj", ")", "{", "/* istanbul ignore else */", "if", "(", "hop", ".", "call", "(", "obj", ",", "key", ")", ")", "{", "copy",...
Shallow-clone an object.
[ "Shallow", "-", "clone", "an", "object", "." ]
039647d10506bc928f95c962f7cd5950574637e8
https://github.com/zaim/immpatch/blob/039647d10506bc928f95c962f7cd5950574637e8/lib/parse.js#L91-L101
37,621
zaim/immpatch
lib/parse.js
parse
function parse(op, target) { if (OPERATORS.indexOf(op.op) !== -1) { op = clone(op); if (op.from != null) { op.from = parsePointer(op.from); } if (op.path != null) { op.path = parsePointer(op.path); } else { throw new error.InvalidOperationError(op.op, 'Operation object must have ...
javascript
function parse(op, target) { if (OPERATORS.indexOf(op.op) !== -1) { op = clone(op); if (op.from != null) { op.from = parsePointer(op.from); } if (op.path != null) { op.path = parsePointer(op.path); } else { throw new error.InvalidOperationError(op.op, 'Operation object must have ...
[ "function", "parse", "(", "op", ",", "target", ")", "{", "if", "(", "OPERATORS", ".", "indexOf", "(", "op", ".", "op", ")", "!==", "-", "1", ")", "{", "op", "=", "clone", "(", "op", ")", ";", "if", "(", "op", ".", "from", "!=", "null", ")", ...
Parse and validate the patch operation. Converts `op.path` (and `op.from` if available) to an array. @param {object} op @param {Immutable} target @returns {object} op
[ "Parse", "and", "validate", "the", "patch", "operation", "." ]
039647d10506bc928f95c962f7cd5950574637e8
https://github.com/zaim/immpatch/blob/039647d10506bc928f95c962f7cd5950574637e8/lib/parse.js#L114-L129
37,622
LaunchPadLab/lp-redux-api
src/handlers/set-on-success.js
setOnSuccess
function setOnSuccess (path, transform=getDataFromAction) { return handleSuccess((state, action) => set(path, transform(action, state), state)) }
javascript
function setOnSuccess (path, transform=getDataFromAction) { return handleSuccess((state, action) => set(path, transform(action, state), state)) }
[ "function", "setOnSuccess", "(", "path", ",", "transform", "=", "getDataFromAction", ")", "{", "return", "handleSuccess", "(", "(", "state", ",", "action", ")", "=>", "set", "(", "path", ",", "transform", "(", "action", ",", "state", ")", ",", "state", "...
A function that creates an API action handler that sets a path in the state with the returned data if a request succeeds. @name setOnSuccess @param {String} path - The path in the state to set with the returned data @param {Function} [transform] - A function that determines the data that is set in the state. Passed `a...
[ "A", "function", "that", "creates", "an", "API", "action", "handler", "that", "sets", "a", "path", "in", "the", "state", "with", "the", "returned", "data", "if", "a", "request", "succeeds", "." ]
73eee231067365326780ddc1dbbfa50d3e65defc
https://github.com/LaunchPadLab/lp-redux-api/blob/73eee231067365326780ddc1dbbfa50d3e65defc/src/handlers/set-on-success.js#L21-L23
37,623
LaunchPadLab/lp-redux-api
src/handlers/set-on-failure.js
setOnFailure
function setOnFailure (path, transform=getDataFromAction) { return handleFailure((state, action) => set(path, transform(action, state), state)) }
javascript
function setOnFailure (path, transform=getDataFromAction) { return handleFailure((state, action) => set(path, transform(action, state), state)) }
[ "function", "setOnFailure", "(", "path", ",", "transform", "=", "getDataFromAction", ")", "{", "return", "handleFailure", "(", "(", "state", ",", "action", ")", "=>", "set", "(", "path", ",", "transform", "(", "action", ",", "state", ")", ",", "state", "...
A function that creates an API action handler that sets a path in the state with the returned error if a request fails. @name setOnFailure @param {String} path - The path in the state to set with the returned error @param {Function} [transform] - A function that determines the data that is set in the state. Passed `ac...
[ "A", "function", "that", "creates", "an", "API", "action", "handler", "that", "sets", "a", "path", "in", "the", "state", "with", "the", "returned", "error", "if", "a", "request", "fails", "." ]
73eee231067365326780ddc1dbbfa50d3e65defc
https://github.com/LaunchPadLab/lp-redux-api/blob/73eee231067365326780ddc1dbbfa50d3e65defc/src/handlers/set-on-failure.js#L21-L23
37,624
axke/rs-api
lib/apis/distraction/circus.js
Circus
function Circus() { const LOCATIONS = [ 'Tree Gnome Stronghold', 'Seers\' Village', 'Catherby', 'Taverley', 'Edgeville', 'Falador', 'Rimmington', 'Draynor Village', 'Al Kharid', 'Lumbridge', 'Lumber Yard', 'Gertrude\'s H...
javascript
function Circus() { const LOCATIONS = [ 'Tree Gnome Stronghold', 'Seers\' Village', 'Catherby', 'Taverley', 'Edgeville', 'Falador', 'Rimmington', 'Draynor Village', 'Al Kharid', 'Lumbridge', 'Lumber Yard', 'Gertrude\'s H...
[ "function", "Circus", "(", ")", "{", "const", "LOCATIONS", "=", "[", "'Tree Gnome Stronghold'", ",", "'Seers\\' Village'", ",", "'Catherby'", ",", "'Taverley'", ",", "'Edgeville'", ",", "'Falador'", ",", "'Rimmington'", ",", "'Draynor Village'", ",", "'Al Kharid'", ...
Module containing Circus functions @module Circus
[ "Module", "containing", "Circus", "functions" ]
71af4973e1d079f09b7d888b6d24735784185942
https://github.com/axke/rs-api/blob/71af4973e1d079f09b7d888b6d24735784185942/lib/apis/distraction/circus.js#L10-L51
37,625
schlosser/substituteteacher.js
src/substituteteacher.js
_parseSentence
function _parseSentence(rawSentence) { if (!rawSentence || typeof rawSentence !== "string") { throw "rawSentence must be a string."; } var components = []; var start, end, endChar; for (start = 0, end = 0; end < rawSentence.length; end++) { endChar = rawSentence.charAt(end); /** ...
javascript
function _parseSentence(rawSentence) { if (!rawSentence || typeof rawSentence !== "string") { throw "rawSentence must be a string."; } var components = []; var start, end, endChar; for (start = 0, end = 0; end < rawSentence.length; end++) { endChar = rawSentence.charAt(end); /** ...
[ "function", "_parseSentence", "(", "rawSentence", ")", "{", "if", "(", "!", "rawSentence", "||", "typeof", "rawSentence", "!==", "\"string\"", ")", "{", "throw", "\"rawSentence must be a string.\"", ";", "}", "var", "components", "=", "[", "]", ";", "var", "st...
Parse the raw sentence into an array of words. Separate the sentence by spaces, and then go along each word and pull punctuation off words that end with a punctuation symbol: "We're here (in Wilkes-Barre), finally!" => ["We're", "here", "(", "in", "Wilkes-Barre", ")", ",", "finally", "!"] TODO: figure out some way t...
[ "Parse", "the", "raw", "sentence", "into", "an", "array", "of", "words", "." ]
2c278ed803333d889f94dd75083e35d7d46b4d91
https://github.com/schlosser/substituteteacher.js/blob/2c278ed803333d889f94dd75083e35d7d46b4d91/src/substituteteacher.js#L38-L81
37,626
schlosser/substituteteacher.js
src/substituteteacher.js
_whichTransitionEndEvent
function _whichTransitionEndEvent() { var t; var el = document.createElement("fakeelement"); var transitions = { "WebkitTransition": "webkitTransitionEnd", "MozTransition": "transitionend", "MSTransition": "msTransitionEnd", "OTransition": "otransitionend", "transition": "trans...
javascript
function _whichTransitionEndEvent() { var t; var el = document.createElement("fakeelement"); var transitions = { "WebkitTransition": "webkitTransitionEnd", "MozTransition": "transitionend", "MSTransition": "msTransitionEnd", "OTransition": "otransitionend", "transition": "trans...
[ "function", "_whichTransitionEndEvent", "(", ")", "{", "var", "t", ";", "var", "el", "=", "document", ".", "createElement", "(", "\"fakeelement\"", ")", ";", "var", "transitions", "=", "{", "\"WebkitTransition\"", ":", "\"webkitTransitionEnd\"", ",", "\"MozTransit...
Find the CSS transition end event that we should listen for. @returns {string} t - the transition string
[ "Find", "the", "CSS", "transition", "end", "event", "that", "we", "should", "listen", "for", "." ]
2c278ed803333d889f94dd75083e35d7d46b4d91
https://github.com/schlosser/substituteteacher.js/blob/2c278ed803333d889f94dd75083e35d7d46b4d91/src/substituteteacher.js#L88-L105
37,627
mikolalysenko/polytope-closest-point
lib/closest_point_1d.js
closestPoint1d
function closestPoint1d(a, b, x, result) { var denom = 0.0; var numer = 0.0; for(var i=0; i<x.length; ++i) { var ai = a[i]; var bi = b[i]; var xi = x[i]; var dd = ai - bi; numer += dd * (xi - bi); denom += dd * dd; } var t = 0.0; if(Math.abs(denom) > EPSILON) { t = numer / denom;...
javascript
function closestPoint1d(a, b, x, result) { var denom = 0.0; var numer = 0.0; for(var i=0; i<x.length; ++i) { var ai = a[i]; var bi = b[i]; var xi = x[i]; var dd = ai - bi; numer += dd * (xi - bi); denom += dd * dd; } var t = 0.0; if(Math.abs(denom) > EPSILON) { t = numer / denom;...
[ "function", "closestPoint1d", "(", "a", ",", "b", ",", "x", ",", "result", ")", "{", "var", "denom", "=", "0.0", ";", "var", "numer", "=", "0.0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "x", ".", "length", ";", "++", "i", ")", ...
Computes closest point to a line segment
[ "Computes", "closest", "point", "to", "a", "line", "segment" ]
de523419bf633743f4333d0768b5e929bc82fd80
https://github.com/mikolalysenko/polytope-closest-point/blob/de523419bf633743f4333d0768b5e929bc82fd80/lib/closest_point_1d.js#L6-L35
37,628
jaredLunde/react-broker
src/macro/index.js
evaluateMacros
function evaluateMacros({references, state, babel}) { references.default.forEach(referencePath => makeLegacyEnsure({ references, state, babel, referencePath })) }
javascript
function evaluateMacros({references, state, babel}) { references.default.forEach(referencePath => makeLegacyEnsure({ references, state, babel, referencePath })) }
[ "function", "evaluateMacros", "(", "{", "references", ",", "state", ",", "babel", "}", ")", "{", "references", ".", "default", ".", "forEach", "(", "referencePath", "=>", "makeLegacyEnsure", "(", "{", "references", ",", "state", ",", "babel", ",", "reference...
cycles through each call to the macro and determines an output for each
[ "cycles", "through", "each", "call", "to", "the", "macro", "and", "determines", "an", "output", "for", "each" ]
bc77d6ddb768c0d2fd57bc806ae60468067978f9
https://github.com/jaredLunde/react-broker/blob/bc77d6ddb768c0d2fd57bc806ae60468067978f9/src/macro/index.js#L9-L16
37,629
jaredLunde/react-broker
src/macro/index.js
makeLegacyEnsure
function makeLegacyEnsure ({references, state, babel, referencePath}) { const brokerTemplate = babel.template.smart(` (typeof Broker !== 'undefined' ? Broker : require('${pkgName}').default)( PROMISES, OPTIONS ) `, {preserveComments: true}) const {promises, options} = parseArguments( refe...
javascript
function makeLegacyEnsure ({references, state, babel, referencePath}) { const brokerTemplate = babel.template.smart(` (typeof Broker !== 'undefined' ? Broker : require('${pkgName}').default)( PROMISES, OPTIONS ) `, {preserveComments: true}) const {promises, options} = parseArguments( refe...
[ "function", "makeLegacyEnsure", "(", "{", "references", ",", "state", ",", "babel", ",", "referencePath", "}", ")", "{", "const", "brokerTemplate", "=", "babel", ".", "template", ".", "smart", "(", "`", "${", "pkgName", "}", "`", ",", "{", "preserveComment...
if Broker is defined in the scope then it will use that Broker, otherwise it requires the module.
[ "if", "Broker", "is", "defined", "in", "the", "scope", "then", "it", "will", "use", "that", "Broker", "otherwise", "it", "requires", "the", "module", "." ]
bc77d6ddb768c0d2fd57bc806ae60468067978f9
https://github.com/jaredLunde/react-broker/blob/bc77d6ddb768c0d2fd57bc806ae60468067978f9/src/macro/index.js#L20-L59
37,630
jaredLunde/react-broker
src/macro/index.js
toObjectExpression
function toObjectExpression (obj, {types: t, template}) { const properties = [] for (let key in obj) { properties.push(t.objectProperty(t.stringLiteral(key), obj[key])) } return t.objectExpression(properties) }
javascript
function toObjectExpression (obj, {types: t, template}) { const properties = [] for (let key in obj) { properties.push(t.objectProperty(t.stringLiteral(key), obj[key])) } return t.objectExpression(properties) }
[ "function", "toObjectExpression", "(", "obj", ",", "{", "types", ":", "t", ",", "template", "}", ")", "{", "const", "properties", "=", "[", "]", "for", "(", "let", "key", "in", "obj", ")", "{", "properties", ".", "push", "(", "t", ".", "objectPropert...
creates a Babel object expression from a Javascript object with string keys
[ "creates", "a", "Babel", "object", "expression", "from", "a", "Javascript", "object", "with", "string", "keys" ]
bc77d6ddb768c0d2fd57bc806ae60468067978f9
https://github.com/jaredLunde/react-broker/blob/bc77d6ddb768c0d2fd57bc806ae60468067978f9/src/macro/index.js#L63-L71
37,631
jaredLunde/react-broker
src/macro/index.js
getShortChunkName
function getShortChunkName (source) { if (source.match(relativePkg) || path.isAbsolute(source)) { return path.dirname(source).split(path.sep).slice(-2).join('/') + '/' + path.basename(source) } else { return source } }
javascript
function getShortChunkName (source) { if (source.match(relativePkg) || path.isAbsolute(source)) { return path.dirname(source).split(path.sep).slice(-2).join('/') + '/' + path.basename(source) } else { return source } }
[ "function", "getShortChunkName", "(", "source", ")", "{", "if", "(", "source", ".", "match", "(", "relativePkg", ")", "||", "path", ".", "isAbsolute", "(", "source", ")", ")", "{", "return", "path", ".", "dirname", "(", "source", ")", ".", "split", "("...
shortens the chunk name to its parent directory basename and its basename
[ "shortens", "the", "chunk", "name", "to", "its", "parent", "directory", "basename", "and", "its", "basename" ]
bc77d6ddb768c0d2fd57bc806ae60468067978f9
https://github.com/jaredLunde/react-broker/blob/bc77d6ddb768c0d2fd57bc806ae60468067978f9/src/macro/index.js#L135-L142
37,632
emeryrose/konduit
lib/pipeline.js
function(options) { stream.Duplex.call(this, { objectMode: true }); this.options = extend(true, Pipeline.DEFAULTS, options || {}); this.readyState = 0; // 0: closed, 1: open this._pipeline = []; this.setMaxListeners(0); // unlimited listeners allowed this.options.ipc.subscribe( this.options.ipc.name...
javascript
function(options) { stream.Duplex.call(this, { objectMode: true }); this.options = extend(true, Pipeline.DEFAULTS, options || {}); this.readyState = 0; // 0: closed, 1: open this._pipeline = []; this.setMaxListeners(0); // unlimited listeners allowed this.options.ipc.subscribe( this.options.ipc.name...
[ "function", "(", "options", ")", "{", "stream", ".", "Duplex", ".", "call", "(", "this", ",", "{", "objectMode", ":", "true", "}", ")", ";", "this", ".", "options", "=", "extend", "(", "true", ",", "Pipeline", ".", "DEFAULTS", ",", "options", "||", ...
A stream of "activities" that flow through a handler pipeline. @constructor @param {object} options - a configuration object
[ "A", "stream", "of", "activities", "that", "flow", "through", "a", "handler", "pipeline", "." ]
6fcd6d4d0191b2ba42834f807cc62b9f607306d8
https://github.com/emeryrose/konduit/blob/6fcd6d4d0191b2ba42834f807cc62b9f607306d8/lib/pipeline.js#L16-L30
37,633
bahmutov/connect-slow
index.js
getQueryDelay
function getQueryDelay(url) { var delay; if (options.delayQueryParam) { var parsedUrl = parseUrl(url, true); if (parsedUrl.query && parsedUrl.query[options.delayQueryParam]) { var queryDelay = parseInt(parsedUrl.query[options.delayQueryParam]); if (queryDelay > 0) { delay ...
javascript
function getQueryDelay(url) { var delay; if (options.delayQueryParam) { var parsedUrl = parseUrl(url, true); if (parsedUrl.query && parsedUrl.query[options.delayQueryParam]) { var queryDelay = parseInt(parsedUrl.query[options.delayQueryParam]); if (queryDelay > 0) { delay ...
[ "function", "getQueryDelay", "(", "url", ")", "{", "var", "delay", ";", "if", "(", "options", ".", "delayQueryParam", ")", "{", "var", "parsedUrl", "=", "parseUrl", "(", "url", ",", "true", ")", ";", "if", "(", "parsedUrl", ".", "query", "&&", "parsedU...
Return the query delay if it makes sense for this request, else undefined
[ "Return", "the", "query", "delay", "if", "it", "makes", "sense", "for", "this", "request", "else", "undefined" ]
8a8ca741f56c041792f6871f87556ef1f55ae752
https://github.com/bahmutov/connect-slow/blob/8a8ca741f56c041792f6871f87556ef1f55ae752/index.js#L20-L34
37,634
bahmutov/connect-slow
index.js
getUrlDelay
function getUrlDelay(url) { var delay; if (options.url && !options.url.test(url)) { delay = 0; } return delay; }
javascript
function getUrlDelay(url) { var delay; if (options.url && !options.url.test(url)) { delay = 0; } return delay; }
[ "function", "getUrlDelay", "(", "url", ")", "{", "var", "delay", ";", "if", "(", "options", ".", "url", "&&", "!", "options", ".", "url", ".", "test", "(", "url", ")", ")", "{", "delay", "=", "0", ";", "}", "return", "delay", ";", "}" ]
Return the url delay if it makes sense for this request, else undefined
[ "Return", "the", "url", "delay", "if", "it", "makes", "sense", "for", "this", "request", "else", "undefined" ]
8a8ca741f56c041792f6871f87556ef1f55ae752
https://github.com/bahmutov/connect-slow/blob/8a8ca741f56c041792f6871f87556ef1f55ae752/index.js#L37-L44
37,635
littlebits/cloud-client-api-http
lib/make-method.js
todo_name_me
function todo_name_me() { var args = process_signature(arguments) var opts = merge({}, base_defaults, args.overrides) return f.apply(null, [opts, args.cb]) }
javascript
function todo_name_me() { var args = process_signature(arguments) var opts = merge({}, base_defaults, args.overrides) return f.apply(null, [opts, args.cb]) }
[ "function", "todo_name_me", "(", ")", "{", "var", "args", "=", "process_signature", "(", "arguments", ")", "var", "opts", "=", "merge", "(", "{", "}", ",", "base_defaults", ",", "args", ".", "overrides", ")", "return", "f", ".", "apply", "(", "null", "...
Give this function a better name. We could accept a name parameter and create the function using Function constructor.
[ "Give", "this", "function", "a", "better", "name", ".", "We", "could", "accept", "a", "name", "parameter", "and", "create", "the", "function", "using", "Function", "constructor", "." ]
d7bd5e31ee95873ce644f9526f5459483f67988b
https://github.com/littlebits/cloud-client-api-http/blob/d7bd5e31ee95873ce644f9526f5459483f67988b/lib/make-method.js#L12-L16
37,636
lgeiger/escape-carriage
index.js
escapeCarriageReturn
function escapeCarriageReturn(txt) { if (!txt) return ""; if (!/\r/.test(txt)) return txt; txt = txt.replace(/\r+\n/gm, "\n"); // \r followed by \n --> newline while (/\r[^$]/.test(txt)) { var base = /^(.*)\r+/m.exec(txt)[1]; var insert = /\r+(.*)$/m.exec(txt)[1]; insert = insert + base.slice(insert...
javascript
function escapeCarriageReturn(txt) { if (!txt) return ""; if (!/\r/.test(txt)) return txt; txt = txt.replace(/\r+\n/gm, "\n"); // \r followed by \n --> newline while (/\r[^$]/.test(txt)) { var base = /^(.*)\r+/m.exec(txt)[1]; var insert = /\r+(.*)$/m.exec(txt)[1]; insert = insert + base.slice(insert...
[ "function", "escapeCarriageReturn", "(", "txt", ")", "{", "if", "(", "!", "txt", ")", "return", "\"\"", ";", "if", "(", "!", "/", "\\r", "/", ".", "test", "(", "txt", ")", ")", "return", "txt", ";", "txt", "=", "txt", ".", "replace", "(", "/", ...
Escape carrigage returns like a terminal @param {string} txt - String to escape. @return {string} - Escaped string.
[ "Escape", "carrigage", "returns", "like", "a", "terminal" ]
fb4fcdfd11745cf654909f87c557e662b827351b
https://github.com/lgeiger/escape-carriage/blob/fb4fcdfd11745cf654909f87c557e662b827351b/index.js#L6-L17
37,637
lgeiger/escape-carriage
index.js
escapeCarriageReturnSafe
function escapeCarriageReturnSafe(txt) { if (!txt) return ""; if (!/\r/.test(txt)) return txt; if (!/\n/.test(txt)) return escapeSingleLineSafe(txt); txt = txt.replace(/\r+\n/gm, "\n"); // \r followed by \n --> newline var idx = txt.lastIndexOf("\n"); return ( escapeCarriageReturn(txt.slice(0, idx)) + ...
javascript
function escapeCarriageReturnSafe(txt) { if (!txt) return ""; if (!/\r/.test(txt)) return txt; if (!/\n/.test(txt)) return escapeSingleLineSafe(txt); txt = txt.replace(/\r+\n/gm, "\n"); // \r followed by \n --> newline var idx = txt.lastIndexOf("\n"); return ( escapeCarriageReturn(txt.slice(0, idx)) + ...
[ "function", "escapeCarriageReturnSafe", "(", "txt", ")", "{", "if", "(", "!", "txt", ")", "return", "\"\"", ";", "if", "(", "!", "/", "\\r", "/", ".", "test", "(", "txt", ")", ")", "return", "txt", ";", "if", "(", "!", "/", "\\n", "/", ".", "te...
Safely escape carrigage returns like a terminal. This allows to escape carrigage returns while allowing future output to be appended without loosing information. Use this as a intermediate escape step if your stream hasn't completed yet. @param {string} txt - String to escape. @return {string} - Escaped string.
[ "Safely", "escape", "carrigage", "returns", "like", "a", "terminal", ".", "This", "allows", "to", "escape", "carrigage", "returns", "while", "allowing", "future", "output", "to", "be", "appended", "without", "loosing", "information", ".", "Use", "this", "as", ...
fb4fcdfd11745cf654909f87c557e662b827351b
https://github.com/lgeiger/escape-carriage/blob/fb4fcdfd11745cf654909f87c557e662b827351b/index.js#L51-L63
37,638
LaunchPadLab/lp-redux-api
src/middleware/parse-action.js
parseAction
function parseAction ({ action, payload={}, error=false }) { switch (typeof action) { // If it's an action creator, create the action case 'function': return action(payload) // If it's an action object return the action case 'object': return action // Otherwise, create a "default" action object wi...
javascript
function parseAction ({ action, payload={}, error=false }) { switch (typeof action) { // If it's an action creator, create the action case 'function': return action(payload) // If it's an action object return the action case 'object': return action // Otherwise, create a "default" action object wi...
[ "function", "parseAction", "(", "{", "action", ",", "payload", "=", "{", "}", ",", "error", "=", "false", "}", ")", "{", "switch", "(", "typeof", "action", ")", "{", "// If it's an action creator, create the action", "case", "'function'", ":", "return", "actio...
Create an action from an action "definition."
[ "Create", "an", "action", "from", "an", "action", "definition", "." ]
73eee231067365326780ddc1dbbfa50d3e65defc
https://github.com/LaunchPadLab/lp-redux-api/blob/73eee231067365326780ddc1dbbfa50d3e65defc/src/middleware/parse-action.js#L2-L12
37,639
RetailMeNotSandbox/roux
lib/pantry.js
Pantry
function Pantry(config) { this.name = config.name; this.path = config.path; this.ingredients = _.clone(config.ingredients); }
javascript
function Pantry(config) { this.name = config.name; this.path = config.path; this.ingredients = _.clone(config.ingredients); }
[ "function", "Pantry", "(", "config", ")", "{", "this", ".", "name", "=", "config", ".", "name", ";", "this", ".", "path", "=", "config", ".", "path", ";", "this", ".", "ingredients", "=", "_", ".", "clone", "(", "config", ".", "ingredients", ")", "...
Interface to a pantry of Roux ingredients @param {Object} config - Pantry configuration @param {string} config.path - the path to the pantry @param {string} config.name - the name of the pantry @param {Ingredient} config.ingredients - the ingredients in the pantry
[ "Interface", "to", "a", "pantry", "of", "Roux", "ingredients" ]
519616c4deeb47545da44098767e71dfd10a0e83
https://github.com/RetailMeNotSandbox/roux/blob/519616c4deeb47545da44098767e71dfd10a0e83/lib/pantry.js#L14-L19
37,640
zaim/immpatch
src/parse.js
parsePointer
function parsePointer (pointer) { if (pointer === '') { return [] } if (pointer.charAt(0) !== '/') { throw new error.PointerError('Invalid JSON pointer: ' + pointer) } return pointer.substring(1).split(/\//).map(unescape) }
javascript
function parsePointer (pointer) { if (pointer === '') { return [] } if (pointer.charAt(0) !== '/') { throw new error.PointerError('Invalid JSON pointer: ' + pointer) } return pointer.substring(1).split(/\//).map(unescape) }
[ "function", "parsePointer", "(", "pointer", ")", "{", "if", "(", "pointer", "===", "''", ")", "{", "return", "[", "]", "}", "if", "(", "pointer", ".", "charAt", "(", "0", ")", "!==", "'/'", ")", "{", "throw", "new", "error", ".", "PointerError", "(...
Convert a JSON Pointer into a key path array @private @param {string} pointer @returns {array}
[ "Convert", "a", "JSON", "Pointer", "into", "a", "key", "path", "array" ]
039647d10506bc928f95c962f7cd5950574637e8
https://github.com/zaim/immpatch/blob/039647d10506bc928f95c962f7cd5950574637e8/src/parse.js#L30-L38
37,641
zaim/immpatch
src/parse.js
validatePath
function validatePath (path, target) { var i = 0 var len = path.length var ref = target for (; i < len; i++) { if (Iterable.isIterable(ref)) { ref = ref.getIn(path.slice(0, i)) if (Iterable.isIndexed(ref) && !validateIndexToken(path[i])) { throw new error.PointerError('Invalid array inde...
javascript
function validatePath (path, target) { var i = 0 var len = path.length var ref = target for (; i < len; i++) { if (Iterable.isIterable(ref)) { ref = ref.getIn(path.slice(0, i)) if (Iterable.isIndexed(ref) && !validateIndexToken(path[i])) { throw new error.PointerError('Invalid array inde...
[ "function", "validatePath", "(", "path", ",", "target", ")", "{", "var", "i", "=", "0", "var", "len", "=", "path", ".", "length", "var", "ref", "=", "target", "for", "(", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "Iterable", "....
Validate key path @private @param {array} path @param {Immutable} target @throws PatchError
[ "Validate", "key", "path" ]
039647d10506bc928f95c962f7cd5950574637e8
https://github.com/zaim/immpatch/blob/039647d10506bc928f95c962f7cd5950574637e8/src/parse.js#L50-L62
37,642
coditorium/gulp-html-lint
lib/index.js
gulpHtmlLint
function gulpHtmlLint(options) { let htmlLintOptions = {}, issueFileCount = 0, issueCount = 0; options = options || {}; options.htmllintrc = options.htmllintrc || '.htmllintrc'; options.useHtmllintrc = options.useHtmllintrc !== false; options.plugins = options.plugins || []; options.limitFiles = options.limi...
javascript
function gulpHtmlLint(options) { let htmlLintOptions = {}, issueFileCount = 0, issueCount = 0; options = options || {}; options.htmllintrc = options.htmllintrc || '.htmllintrc'; options.useHtmllintrc = options.useHtmllintrc !== false; options.plugins = options.plugins || []; options.limitFiles = options.limi...
[ "function", "gulpHtmlLint", "(", "options", ")", "{", "let", "htmlLintOptions", "=", "{", "}", ",", "issueFileCount", "=", "0", ",", "issueCount", "=", "0", ";", "options", "=", "options", "||", "{", "}", ";", "options", ".", "htmllintrc", "=", "options"...
Append HtmlLint result to each file in gulp stream. @param {(Object|String)} [options] - Configure rules, plugins and other options for running HtmlLint @returns {stream} gulp file stream
[ "Append", "HtmlLint", "result", "to", "each", "file", "in", "gulp", "stream", "." ]
a403ab7f8a7f13fe439f6035bc3a5e49deca3d98
https://github.com/coditorium/gulp-html-lint/blob/a403ab7f8a7f13fe439f6035bc3a5e49deca3d98/lib/index.js#L17-L80
37,643
coditorium/gulp-html-lint
lib/index.js
tryResultAction
function tryResultAction(action, result, callback) { if (action.length > 1) return action.call(this, result, callback); try { action.call(this, result); } catch (err) { return callback(err || new Error('Unknown Error')); } return callback(); }
javascript
function tryResultAction(action, result, callback) { if (action.length > 1) return action.call(this, result, callback); try { action.call(this, result); } catch (err) { return callback(err || new Error('Unknown Error')); } return callback(); }
[ "function", "tryResultAction", "(", "action", ",", "result", ",", "callback", ")", "{", "if", "(", "action", ".", "length", ">", "1", ")", "return", "action", ".", "call", "(", "this", ",", "result", ",", "callback", ")", ";", "try", "{", "action", "...
Call sync or async action and handle any thrown or async error @param {Function} action - Result action to call @param {(Object|Array)} result - An HtmlLint result or result list @param {Function} callback - An callback for when the action is complete @returns {undefined}
[ "Call", "sync", "or", "async", "action", "and", "handle", "any", "thrown", "or", "async", "error" ]
a403ab7f8a7f13fe439f6035bc3a5e49deca3d98
https://github.com/coditorium/gulp-html-lint/blob/a403ab7f8a7f13fe439f6035bc3a5e49deca3d98/lib/index.js#L209-L217
37,644
coditorium/gulp-html-lint
lib/index.js
wrapError
function wrapError(err) { if (err && !(err instanceof gutil.PluginError)) { err = new PluginError(err.plugin || PLUGIN_NAME, err, { showStack: (err.showStack !== false) }); } return err; }
javascript
function wrapError(err) { if (err && !(err instanceof gutil.PluginError)) { err = new PluginError(err.plugin || PLUGIN_NAME, err, { showStack: (err.showStack !== false) }); } return err; }
[ "function", "wrapError", "(", "err", ")", "{", "if", "(", "err", "&&", "!", "(", "err", "instanceof", "gutil", ".", "PluginError", ")", ")", "{", "err", "=", "new", "PluginError", "(", "err", ".", "plugin", "||", "PLUGIN_NAME", ",", "err", ",", "{", ...
Ensure that error is wrapped in a gulp PluginError @param {Object} err - An error to be wrapped @returns {Object} A wrapped error
[ "Ensure", "that", "error", "is", "wrapped", "in", "a", "gulp", "PluginError" ]
a403ab7f8a7f13fe439f6035bc3a5e49deca3d98
https://github.com/coditorium/gulp-html-lint/blob/a403ab7f8a7f13fe439f6035bc3a5e49deca3d98/lib/index.js#L225-L232
37,645
coditorium/gulp-html-lint
lib/index.js
resolveFormatter
function resolveFormatter(formatter) { if (!formatter) return resolveFormatter('stylish'); if (typeof formatter === 'function') return formatter; if (typeof formatter === 'string') { if (isModuleAvailable(formatter)) return require(formatter); if (isModuleAvailable(`./formatters/${formatter}`)) return require(`....
javascript
function resolveFormatter(formatter) { if (!formatter) return resolveFormatter('stylish'); if (typeof formatter === 'function') return formatter; if (typeof formatter === 'string') { if (isModuleAvailable(formatter)) return require(formatter); if (isModuleAvailable(`./formatters/${formatter}`)) return require(`....
[ "function", "resolveFormatter", "(", "formatter", ")", "{", "if", "(", "!", "formatter", ")", "return", "resolveFormatter", "(", "'stylish'", ")", ";", "if", "(", "typeof", "formatter", "===", "'function'", ")", "return", "formatter", ";", "if", "(", "typeof...
Resolves formatter. @param {string|function} formatter - formatter @returns {function} formatter function
[ "Resolves", "formatter", "." ]
a403ab7f8a7f13fe439f6035bc3a5e49deca3d98
https://github.com/coditorium/gulp-html-lint/blob/a403ab7f8a7f13fe439f6035bc3a5e49deca3d98/lib/index.js#L240-L248
37,646
axke/rs-api
lib/util/jsonp.js
function (obj) { var keys = [] for (var key in obj) { if (obj.hasOwnProperty(key)) { keys.push(key) } } return keys }
javascript
function (obj) { var keys = [] for (var key in obj) { if (obj.hasOwnProperty(key)) { keys.push(key) } } return keys }
[ "function", "(", "obj", ")", "{", "var", "keys", "=", "[", "]", "for", "(", "var", "key", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "keys", ".", "push", "(", "key", ")", "}", "}", "return", "ke...
Gets all the keys that belong to an object
[ "Gets", "all", "the", "keys", "that", "belong", "to", "an", "object" ]
71af4973e1d079f09b7d888b6d24735784185942
https://github.com/axke/rs-api/blob/71af4973e1d079f09b7d888b6d24735784185942/lib/util/jsonp.js#L50-L58
37,647
kibertoad/validation-utils
lib/validation.helper.js
lessThan
function lessThan(validatedObject, threshold, errorText) { number(validatedObject); number(threshold, 'Threshold is not a number'); if (validatedObject >= threshold) { throw new ValidationError( errorText || `Validated number ${validatedObject} is not less than the threshold ${threshold}` ); } r...
javascript
function lessThan(validatedObject, threshold, errorText) { number(validatedObject); number(threshold, 'Threshold is not a number'); if (validatedObject >= threshold) { throw new ValidationError( errorText || `Validated number ${validatedObject} is not less than the threshold ${threshold}` ); } r...
[ "function", "lessThan", "(", "validatedObject", ",", "threshold", ",", "errorText", ")", "{", "number", "(", "validatedObject", ")", ";", "number", "(", "threshold", ",", "'Threshold is not a number'", ")", ";", "if", "(", "validatedObject", ">=", "threshold", "...
Checks value to be a number that is less than the specified number @param {*} validatedObject @param {number} threshold - if validated number is equal or larger than this, throw an error @param {String} [errorText] - message for error thrown if validation fails @returns {number} validatedObject
[ "Checks", "value", "to", "be", "a", "number", "that", "is", "less", "than", "the", "specified", "number" ]
6cc2a41e9dd6407f29986ed605840d30234802d6
https://github.com/kibertoad/validation-utils/blob/6cc2a41e9dd6407f29986ed605840d30234802d6/lib/validation.helper.js#L64-L73
37,648
kibertoad/validation-utils
lib/validation.helper.js
greaterThan
function greaterThan(validatedObject, threshold, errorText) { number(validatedObject); number(threshold, 'Threshold is not a number'); if (validatedObject <= threshold) { throw new ValidationError( errorText || `Validated number ${validatedObject} is not greater than the threshold ${threshold}` ...
javascript
function greaterThan(validatedObject, threshold, errorText) { number(validatedObject); number(threshold, 'Threshold is not a number'); if (validatedObject <= threshold) { throw new ValidationError( errorText || `Validated number ${validatedObject} is not greater than the threshold ${threshold}` ...
[ "function", "greaterThan", "(", "validatedObject", ",", "threshold", ",", "errorText", ")", "{", "number", "(", "validatedObject", ")", ";", "number", "(", "threshold", ",", "'Threshold is not a number'", ")", ";", "if", "(", "validatedObject", "<=", "threshold", ...
Checks value to be a number that is greater than specified number @param {*} validatedObject @param {number} threshold - if validated number is equal or less than this, throw an error @param {String} [errorText] - message for error thrown if validation fails @returns {number} validatedObject
[ "Checks", "value", "to", "be", "a", "number", "that", "is", "greater", "than", "specified", "number" ]
6cc2a41e9dd6407f29986ed605840d30234802d6
https://github.com/kibertoad/validation-utils/blob/6cc2a41e9dd6407f29986ed605840d30234802d6/lib/validation.helper.js#L82-L92
37,649
kibertoad/validation-utils
lib/validation.helper.js
booleanTrue
function booleanTrue(validatedObject, errorText) { if (!_.isBoolean(validatedObject) || !validatedObject) { throw new ValidationError(errorText || 'Validated object is not True'); } return validatedObject; }
javascript
function booleanTrue(validatedObject, errorText) { if (!_.isBoolean(validatedObject) || !validatedObject) { throw new ValidationError(errorText || 'Validated object is not True'); } return validatedObject; }
[ "function", "booleanTrue", "(", "validatedObject", ",", "errorText", ")", "{", "if", "(", "!", "_", ".", "isBoolean", "(", "validatedObject", ")", "||", "!", "validatedObject", ")", "{", "throw", "new", "ValidationError", "(", "errorText", "||", "'Validated ob...
Checks value to be a True boolean @param {*} validatedObject @param {String} [errorText] - message for error thrown if validation fails @returns {boolean} validatedObject
[ "Checks", "value", "to", "be", "a", "True", "boolean" ]
6cc2a41e9dd6407f29986ed605840d30234802d6
https://github.com/kibertoad/validation-utils/blob/6cc2a41e9dd6407f29986ed605840d30234802d6/lib/validation.helper.js#L143-L148
37,650
kibertoad/validation-utils
lib/validation.helper.js
booleanFalse
function booleanFalse(validatedObject, errorText) { if (!_.isBoolean(validatedObject) || validatedObject) { throw new ValidationError(errorText || 'Validated object is not False'); } return validatedObject; }
javascript
function booleanFalse(validatedObject, errorText) { if (!_.isBoolean(validatedObject) || validatedObject) { throw new ValidationError(errorText || 'Validated object is not False'); } return validatedObject; }
[ "function", "booleanFalse", "(", "validatedObject", ",", "errorText", ")", "{", "if", "(", "!", "_", ".", "isBoolean", "(", "validatedObject", ")", "||", "validatedObject", ")", "{", "throw", "new", "ValidationError", "(", "errorText", "||", "'Validated object i...
Checks value to be a False boolean @param {*} validatedObject @param {String} [errorText] - message for error thrown if validation fails @returns {boolean} validatedObject
[ "Checks", "value", "to", "be", "a", "False", "boolean" ]
6cc2a41e9dd6407f29986ed605840d30234802d6
https://github.com/kibertoad/validation-utils/blob/6cc2a41e9dd6407f29986ed605840d30234802d6/lib/validation.helper.js#L200-L205
37,651
kibertoad/validation-utils
lib/validation.helper.js
withProperties
function withProperties(validatedObject, validatedProperties) { notNil(validatedObject); const undefinedProperties = _.filter(validatedProperties, function(property) { return !validatedObject.hasOwnProperty(property); }); if (!_.isEmpty(undefinedProperties)) { throw new ValidationError("Validated obje...
javascript
function withProperties(validatedObject, validatedProperties) { notNil(validatedObject); const undefinedProperties = _.filter(validatedProperties, function(property) { return !validatedObject.hasOwnProperty(property); }); if (!_.isEmpty(undefinedProperties)) { throw new ValidationError("Validated obje...
[ "function", "withProperties", "(", "validatedObject", ",", "validatedProperties", ")", "{", "notNil", "(", "validatedObject", ")", ";", "const", "undefinedProperties", "=", "_", ".", "filter", "(", "validatedProperties", ",", "function", "(", "property", ")", "{",...
Checks object to have at least a given set of properties defined @param {*} validatedObject @param {String[]} validatedProperties - names of properties which existence should be checked @returns {*} validatedObject
[ "Checks", "object", "to", "have", "at", "least", "a", "given", "set", "of", "properties", "defined" ]
6cc2a41e9dd6407f29986ed605840d30234802d6
https://github.com/kibertoad/validation-utils/blob/6cc2a41e9dd6407f29986ed605840d30234802d6/lib/validation.helper.js#L252-L263
37,652
kibertoad/validation-utils
lib/validation.helper.js
instanceOf
function instanceOf(validatedObject, expectedClass, errorText) { if (!(validatedObject instanceof expectedClass)) { throw new ValidationError( errorText || `Validated object is not an instance of ${expectedClass.name}` ); } return validatedObject; }
javascript
function instanceOf(validatedObject, expectedClass, errorText) { if (!(validatedObject instanceof expectedClass)) { throw new ValidationError( errorText || `Validated object is not an instance of ${expectedClass.name}` ); } return validatedObject; }
[ "function", "instanceOf", "(", "validatedObject", ",", "expectedClass", ",", "errorText", ")", "{", "if", "(", "!", "(", "validatedObject", "instanceof", "expectedClass", ")", ")", "{", "throw", "new", "ValidationError", "(", "errorText", "||", "`", "${", "exp...
Checks value to be an instance of a given class @param validatedObject @param {class} expectedClass @param {string} [errorText] - message for error thrown if validation fails @returns {Object} validatedObject
[ "Checks", "value", "to", "be", "an", "instance", "of", "a", "given", "class" ]
6cc2a41e9dd6407f29986ed605840d30234802d6
https://github.com/kibertoad/validation-utils/blob/6cc2a41e9dd6407f29986ed605840d30234802d6/lib/validation.helper.js#L298-L305
37,653
kibertoad/validation-utils
lib/validation.helper.js
inheritsFrom
function inheritsFrom(validatedClass, expectedParentClass, errorText) { if ( //fail-fast if it is nil !validatedClass || //lenient check whether class directly or indirectly inherits from expected class (!(validatedClass.prototype instanceof expectedParentClass) && validatedClass !== expectedPar...
javascript
function inheritsFrom(validatedClass, expectedParentClass, errorText) { if ( //fail-fast if it is nil !validatedClass || //lenient check whether class directly or indirectly inherits from expected class (!(validatedClass.prototype instanceof expectedParentClass) && validatedClass !== expectedPar...
[ "function", "inheritsFrom", "(", "validatedClass", ",", "expectedParentClass", ",", "errorText", ")", "{", "if", "(", "//fail-fast if it is nil", "!", "validatedClass", "||", "//lenient check whether class directly or indirectly inherits from expected class", "(", "!", "(", "...
Checks value to inherit from a given class or to be that class @param validatedClass @param {class} expectedParentClass @param {string} [errorText] - message for error thrown if validation fails @returns {Object} validatedObject
[ "Checks", "value", "to", "inherit", "from", "a", "given", "class", "or", "to", "be", "that", "class" ]
6cc2a41e9dd6407f29986ed605840d30234802d6
https://github.com/kibertoad/validation-utils/blob/6cc2a41e9dd6407f29986ed605840d30234802d6/lib/validation.helper.js#L314-L327
37,654
ryan-self/exec-plan
main.js
function (execPlan, error, stderr, errorHandler) { var shouldContinue = execPlan.continuesOnError(); // default to using configured policy var errorHandlerDefined = utils.isFunction(errorHandler); var errorHandlerReturn; var shouldOverridePolicy; // whether the given error handler is overriding the...
javascript
function (execPlan, error, stderr, errorHandler) { var shouldContinue = execPlan.continuesOnError(); // default to using configured policy var errorHandlerDefined = utils.isFunction(errorHandler); var errorHandlerReturn; var shouldOverridePolicy; // whether the given error handler is overriding the...
[ "function", "(", "execPlan", ",", "error", ",", "stderr", ",", "errorHandler", ")", "{", "var", "shouldContinue", "=", "execPlan", ".", "continuesOnError", "(", ")", ";", "// default to using configured policy", "var", "errorHandlerDefined", "=", "utils", ".", "is...
Provide a common handler for errors that occur during the execution of a plan. @param execPlan ExecPlan @param error Error @param stderr String @param errorHandler Function @param error Error @param stderr String @return Boolean - whether the plan should continue to execute
[ "Provide", "a", "common", "handler", "for", "errors", "that", "occur", "during", "the", "execution", "of", "a", "plan", "." ]
28110ea45aac02fb6a6674ba7783d40db5389b07
https://github.com/ryan-self/exec-plan/blob/28110ea45aac02fb6a6674ba7783d40db5389b07/main.js#L29-L48
37,655
ryan-self/exec-plan
main.js
function (execPlan, first, preLogic, command, options, errorHandler, nextStep) { return function (error, stdout, stderr) { var shouldContinue; // whether the plan should continue executing beyond this step // log stdout/err if (!first) { // a previous step's stdout/err is available ...
javascript
function (execPlan, first, preLogic, command, options, errorHandler, nextStep) { return function (error, stdout, stderr) { var shouldContinue; // whether the plan should continue executing beyond this step // log stdout/err if (!first) { // a previous step's stdout/err is available ...
[ "function", "(", "execPlan", ",", "first", ",", "preLogic", ",", "command", ",", "options", ",", "errorHandler", ",", "nextStep", ")", "{", "return", "function", "(", "error", ",", "stdout", ",", "stderr", ")", "{", "var", "shouldContinue", ";", "// whethe...
this is an internal API, so for the time being, assume all arguments are valid. provides a function that corresponds to a 'step' in an execution plan. @param execPlan ExecPlan @param first Boolean - whether this corresponds to the 'first' step in execution plan. @param preLogic Function - function to execut...
[ "this", "is", "an", "internal", "API", "so", "for", "the", "time", "being", "assume", "all", "arguments", "are", "valid", ".", "provides", "a", "function", "that", "corresponds", "to", "a", "step", "in", "an", "execution", "plan", "." ]
28110ea45aac02fb6a6674ba7783d40db5389b07
https://github.com/ryan-self/exec-plan/blob/28110ea45aac02fb6a6674ba7783d40db5389b07/main.js#L88-L109
37,656
RetailMeNotSandbox/roux
lib/ingredient.js
Ingredient
function Ingredient(config) { this.name = config.name; this.path = config.path; this.pantryName = config.pantryName; this.entryPoints = _.clone(config.entryPoints); }
javascript
function Ingredient(config) { this.name = config.name; this.path = config.path; this.pantryName = config.pantryName; this.entryPoints = _.clone(config.entryPoints); }
[ "function", "Ingredient", "(", "config", ")", "{", "this", ".", "name", "=", "config", ".", "name", ";", "this", ".", "path", "=", "config", ".", "path", ";", "this", ".", "pantryName", "=", "config", ".", "pantryName", ";", "this", ".", "entryPoints",...
Interface to a Roux ingredient @param {Object} config - Ingredient configuration @param {string} config.path - the path to the ingredient @param {string} config.name - the name of the ingredient @param {string} config.pantryName - the name of the pantry @param {boolean[]} config.entryPoints - the entryPoints the ingre...
[ "Interface", "to", "a", "Roux", "ingredient" ]
519616c4deeb47545da44098767e71dfd10a0e83
https://github.com/RetailMeNotSandbox/roux/blob/519616c4deeb47545da44098767e71dfd10a0e83/lib/ingredient.js#L15-L20
37,657
jhermsmeier/node-udif
lib/footer.js
function( buffer, offset ) { offset = offset || 0 this.signature = buffer.readUInt32BE( offset + 0 ) if( this.signature !== Footer.signature ) { var expected = Footer.signature.toString(16) var actual = this.signature.toString(16) throw new Error( `Invalid footer signature: Expected 0x$...
javascript
function( buffer, offset ) { offset = offset || 0 this.signature = buffer.readUInt32BE( offset + 0 ) if( this.signature !== Footer.signature ) { var expected = Footer.signature.toString(16) var actual = this.signature.toString(16) throw new Error( `Invalid footer signature: Expected 0x$...
[ "function", "(", "buffer", ",", "offset", ")", "{", "offset", "=", "offset", "||", "0", "this", ".", "signature", "=", "buffer", ".", "readUInt32BE", "(", "offset", "+", "0", ")", "if", "(", "this", ".", "signature", "!==", "Footer", ".", "signature", ...
Parse a Koly block from a buffer @param {Buffer} buffer @param {Number} [offset=0] @returns {Footer}
[ "Parse", "a", "Koly", "block", "from", "a", "buffer" ]
1f5ee84d617e8ebafc8740aec0a734602a1e8b13
https://github.com/jhermsmeier/node-udif/blob/1f5ee84d617e8ebafc8740aec0a734602a1e8b13/lib/footer.js#L86-L129
37,658
LaunchPadLab/lp-redux-api
src/handlers/handle-success.js
handleSuccess
function handleSuccess (handler) { return (state, action) => isSuccessAction(action) ? handler(state, action, getDataFromAction(action)) : state }
javascript
function handleSuccess (handler) { return (state, action) => isSuccessAction(action) ? handler(state, action, getDataFromAction(action)) : state }
[ "function", "handleSuccess", "(", "handler", ")", "{", "return", "(", "state", ",", "action", ")", "=>", "isSuccessAction", "(", "action", ")", "?", "handler", "(", "state", ",", "action", ",", "getDataFromAction", "(", "action", ")", ")", ":", "state", ...
A function that takes an API action handler and only applies that handler when the request succeeds. @name handleSuccess @param {Function} handler - An action handler that is passed `state`, `action` and `data` params @returns {Function} An action handler that runs when a request is successful @example handleActions(...
[ "A", "function", "that", "takes", "an", "API", "action", "handler", "and", "only", "applies", "that", "handler", "when", "the", "request", "succeeds", "." ]
73eee231067365326780ddc1dbbfa50d3e65defc
https://github.com/LaunchPadLab/lp-redux-api/blob/73eee231067365326780ddc1dbbfa50d3e65defc/src/handlers/handle-success.js#L20-L22
37,659
emmetio/stylesheet-formatters
format/css.js
injectFields
function injectFields(string, values) { const fieldsModel = parseFields(string); const fieldsAmount = fieldsModel.fields.length; if (fieldsAmount) { values = values.slice(); if (values.length > fieldsAmount) { // More values that output fields: collapse rest values into // a single token values = value...
javascript
function injectFields(string, values) { const fieldsModel = parseFields(string); const fieldsAmount = fieldsModel.fields.length; if (fieldsAmount) { values = values.slice(); if (values.length > fieldsAmount) { // More values that output fields: collapse rest values into // a single token values = value...
[ "function", "injectFields", "(", "string", ",", "values", ")", "{", "const", "fieldsModel", "=", "parseFields", "(", "string", ")", ";", "const", "fieldsAmount", "=", "fieldsModel", ".", "fields", ".", "length", ";", "if", "(", "fieldsAmount", ")", "{", "v...
Injects given field values at each field of given string @param {String} string @param {String[]} attributes @return {FieldString}
[ "Injects", "given", "field", "values", "at", "each", "field", "of", "given", "string" ]
1ba9fa2609b8088e7567547990f123106de84b1d
https://github.com/emmetio/stylesheet-formatters/blob/1ba9fa2609b8088e7567547990f123106de84b1d/format/css.js#L58-L88
37,660
mikolalysenko/polytope-closest-point
lib/closest_point_0d.js
closestPoint0d
function closestPoint0d(a, x, result) { var d = 0.0; for(var i=0; i<x.length; ++i) { result[i] = a[i]; var t = a[i] - x[i]; d += t * t; } return d; }
javascript
function closestPoint0d(a, x, result) { var d = 0.0; for(var i=0; i<x.length; ++i) { result[i] = a[i]; var t = a[i] - x[i]; d += t * t; } return d; }
[ "function", "closestPoint0d", "(", "a", ",", "x", ",", "result", ")", "{", "var", "d", "=", "0.0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "x", ".", "length", ";", "++", "i", ")", "{", "result", "[", "i", "]", "=", "a", "[", ...
Closest point to a point is trivial
[ "Closest", "point", "to", "a", "point", "is", "trivial" ]
de523419bf633743f4333d0768b5e929bc82fd80
https://github.com/mikolalysenko/polytope-closest-point/blob/de523419bf633743f4333d0768b5e929bc82fd80/lib/closest_point_0d.js#L4-L12
37,661
zaim/immpatch
lib/patch.js
patch
function patch(object, ops) { ops = Array.isArray(ops) ? ops : [ops]; object = ops.reduce(function (ob, op) { op = (0, _parse2['default'])(op, ob); return operators[op.op].call(ob, op); }, object); // Re-convert the returned object into an // immutable structure, in case the entire // object was rep...
javascript
function patch(object, ops) { ops = Array.isArray(ops) ? ops : [ops]; object = ops.reduce(function (ob, op) { op = (0, _parse2['default'])(op, ob); return operators[op.op].call(ob, op); }, object); // Re-convert the returned object into an // immutable structure, in case the entire // object was rep...
[ "function", "patch", "(", "object", ",", "ops", ")", "{", "ops", "=", "Array", ".", "isArray", "(", "ops", ")", "?", "ops", ":", "[", "ops", "]", ";", "object", "=", "ops", ".", "reduce", "(", "function", "(", "ob", ",", "op", ")", "{", "op", ...
Update the immutable object using JSON Patch operations. @param {object} object @param {array|object} ops @returns {object}
[ "Update", "the", "immutable", "object", "using", "JSON", "Patch", "operations", "." ]
039647d10506bc928f95c962f7cd5950574637e8
https://github.com/zaim/immpatch/blob/039647d10506bc928f95c962f7cd5950574637e8/lib/patch.js#L171-L181
37,662
JakeSidSmith/slik
src/index.js
invert
function invert () { if (Immutable.Iterable.isIterable(toValues)) { toValues = toValues.map(mapInvertValues); } else { toValues = mapInvertValues(toValues); } return self; }
javascript
function invert () { if (Immutable.Iterable.isIterable(toValues)) { toValues = toValues.map(mapInvertValues); } else { toValues = mapInvertValues(toValues); } return self; }
[ "function", "invert", "(", ")", "{", "if", "(", "Immutable", ".", "Iterable", ".", "isIterable", "(", "toValues", ")", ")", "{", "toValues", "=", "toValues", ".", "map", "(", "mapInvertValues", ")", ";", "}", "else", "{", "toValues", "=", "mapInvertValue...
Invert animation values
[ "Invert", "animation", "values" ]
493e7759fa608befc96d42e2beb4a7f05bea0ee4
https://github.com/JakeSidSmith/slik/blob/493e7759fa608befc96d42e2beb4a7f05bea0ee4/src/index.js#L301-L309
37,663
JakeSidSmith/slik
src/index.js
start
function start () { var now = performance.now(); if (typeof pausedAfter !== 'undefined') { startTime = now + pausedAfter; } else { startTime = now + delayMillis; } lastTime = startTime; pausedAfter = undefined; triggerEvent('start'); ...
javascript
function start () { var now = performance.now(); if (typeof pausedAfter !== 'undefined') { startTime = now + pausedAfter; } else { startTime = now + delayMillis; } lastTime = startTime; pausedAfter = undefined; triggerEvent('start'); ...
[ "function", "start", "(", ")", "{", "var", "now", "=", "performance", ".", "now", "(", ")", ";", "if", "(", "typeof", "pausedAfter", "!==", "'undefined'", ")", "{", "startTime", "=", "now", "+", "pausedAfter", ";", "}", "else", "{", "startTime", "=", ...
Start or resume animation
[ "Start", "or", "resume", "animation" ]
493e7759fa608befc96d42e2beb4a7f05bea0ee4
https://github.com/JakeSidSmith/slik/blob/493e7759fa608befc96d42e2beb4a7f05bea0ee4/src/index.js#L320-L337
37,664
JakeSidSmith/slik
src/index.js
stop
function stop () { currentValues = fromValues; triggerEvent('stop'); stopLoop(animationId); pausedAfter = undefined; startTime = undefined; return self; }
javascript
function stop () { currentValues = fromValues; triggerEvent('stop'); stopLoop(animationId); pausedAfter = undefined; startTime = undefined; return self; }
[ "function", "stop", "(", ")", "{", "currentValues", "=", "fromValues", ";", "triggerEvent", "(", "'stop'", ")", ";", "stopLoop", "(", "animationId", ")", ";", "pausedAfter", "=", "undefined", ";", "startTime", "=", "undefined", ";", "return", "self", ";", ...
Stop animation and resume from beginning
[ "Stop", "animation", "and", "resume", "from", "beginning" ]
493e7759fa608befc96d42e2beb4a7f05bea0ee4
https://github.com/JakeSidSmith/slik/blob/493e7759fa608befc96d42e2beb4a7f05bea0ee4/src/index.js#L340-L347
37,665
JakeSidSmith/slik
src/index.js
pause
function pause () { triggerEvent('pause'); stopLoop(animationId); pausedAfter = startTime - performance.now(); startTime = undefined; return self; }
javascript
function pause () { triggerEvent('pause'); stopLoop(animationId); pausedAfter = startTime - performance.now(); startTime = undefined; return self; }
[ "function", "pause", "(", ")", "{", "triggerEvent", "(", "'pause'", ")", ";", "stopLoop", "(", "animationId", ")", ";", "pausedAfter", "=", "startTime", "-", "performance", ".", "now", "(", ")", ";", "startTime", "=", "undefined", ";", "return", "self", ...
Pause animation and resume from this point
[ "Pause", "animation", "and", "resume", "from", "this", "point" ]
493e7759fa608befc96d42e2beb4a7f05bea0ee4
https://github.com/JakeSidSmith/slik/blob/493e7759fa608befc96d42e2beb4a7f05bea0ee4/src/index.js#L350-L356
37,666
JakeSidSmith/slik
src/index.js
first
function first (callback) { if (typeof callback !== 'function') { throw new Error('Callback must be a function, instead got: ' + (typeof callback)); } function firstCallback (result) { callback(result); unbind('start', firstCallback); } bind('start...
javascript
function first (callback) { if (typeof callback !== 'function') { throw new Error('Callback must be a function, instead got: ' + (typeof callback)); } function firstCallback (result) { callback(result); unbind('start', firstCallback); } bind('start...
[ "function", "first", "(", "callback", ")", "{", "if", "(", "typeof", "callback", "!==", "'function'", ")", "{", "throw", "new", "Error", "(", "'Callback must be a function, instead got: '", "+", "(", "typeof", "callback", ")", ")", ";", "}", "function", "first...
Run on start and automatically unbind
[ "Run", "on", "start", "and", "automatically", "unbind" ]
493e7759fa608befc96d42e2beb4a7f05bea0ee4
https://github.com/JakeSidSmith/slik/blob/493e7759fa608befc96d42e2beb4a7f05bea0ee4/src/index.js#L407-L421
37,667
JakeSidSmith/slik
src/index.js
then
function then (callback) { if (typeof callback !== 'function') { throw new Error('Callback must be a function, instead got: ' + (typeof callback)); } function thenCallback (result) { callback(result); unbind('end', thenCallback); } bind('end', then...
javascript
function then (callback) { if (typeof callback !== 'function') { throw new Error('Callback must be a function, instead got: ' + (typeof callback)); } function thenCallback (result) { callback(result); unbind('end', thenCallback); } bind('end', then...
[ "function", "then", "(", "callback", ")", "{", "if", "(", "typeof", "callback", "!==", "'function'", ")", "{", "throw", "new", "Error", "(", "'Callback must be a function, instead got: '", "+", "(", "typeof", "callback", ")", ")", ";", "}", "function", "thenCa...
Run on complete and automatically unbind
[ "Run", "on", "complete", "and", "automatically", "unbind" ]
493e7759fa608befc96d42e2beb4a7f05bea0ee4
https://github.com/JakeSidSmith/slik/blob/493e7759fa608befc96d42e2beb4a7f05bea0ee4/src/index.js#L424-L438
37,668
openbiz/openbiz
lib/objects/Application.js
function(routePrefix) { if(routePrefix==='/')routePrefix=''; this.appUrl = routePrefix; var pattern = /^(.*?)\s(.*?)$/ for(var routePath in this.routes) { var routePathArray = routePath.match(pattern); this.openbiz.context[routePathArray[1]](routePrefix+routePathArray[2],this.routes[routePath]); ...
javascript
function(routePrefix) { if(routePrefix==='/')routePrefix=''; this.appUrl = routePrefix; var pattern = /^(.*?)\s(.*?)$/ for(var routePath in this.routes) { var routePathArray = routePath.match(pattern); this.openbiz.context[routePathArray[1]](routePrefix+routePathArray[2],this.routes[routePath]); ...
[ "function", "(", "routePrefix", ")", "{", "if", "(", "routePrefix", "===", "'/'", ")", "routePrefix", "=", "''", ";", "this", ".", "appUrl", "=", "routePrefix", ";", "var", "pattern", "=", "/", "^(.*?)\\s(.*?)$", "/", "for", "(", "var", "routePath", "in"...
Mounts current application to specified URL router @memberof openbiz.objects.Application @instance @param {string} routePrefix - The prefix of URL to mount this application instance @returns {openbiz.objects.Application} @example // init cubi app to routes => /app/* openbiz.apps['cubi'].initRoutes('/api');
[ "Mounts", "current", "application", "to", "specified", "URL", "router" ]
997f1398396683d7ad667b1b360ce74c7c7fcf6f
https://github.com/openbiz/openbiz/blob/997f1398396683d7ad667b1b360ce74c7c7fcf6f/lib/objects/Application.js#L148-L159
37,669
axke/rs-api
lib/apis/news.js
News
function News(config) { this.getRecent = function() { return new Promise(function(resolve, reject) { request.rss(config.urls.rss).then(function(data) { resolve(data); }).catch(reject); }); } }
javascript
function News(config) { this.getRecent = function() { return new Promise(function(resolve, reject) { request.rss(config.urls.rss).then(function(data) { resolve(data); }).catch(reject); }); } }
[ "function", "News", "(", "config", ")", "{", "this", ".", "getRecent", "=", "function", "(", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "request", ".", "rss", "(", "config", ".", "urls", ".", "rss"...
Module containing to retrieve RS News @module News
[ "Module", "containing", "to", "retrieve", "RS", "News" ]
71af4973e1d079f09b7d888b6d24735784185942
https://github.com/axke/rs-api/blob/71af4973e1d079f09b7d888b6d24735784185942/lib/apis/news.js#L10-L18
37,670
sguha-work/csv-array
csv-array.js
function(line) { var dataArray = []; var tempString=""; var lineLength = line.length; var index=0; while(index<lineLength) { if(line[index]=='"') { var index2 = index+1; while(line[index2]!='"') { tempString+=line[index2]; index2++; } dataArray.push(tempString); tempString = "...
javascript
function(line) { var dataArray = []; var tempString=""; var lineLength = line.length; var index=0; while(index<lineLength) { if(line[index]=='"') { var index2 = index+1; while(line[index2]!='"') { tempString+=line[index2]; index2++; } dataArray.push(tempString); tempString = "...
[ "function", "(", "line", ")", "{", "var", "dataArray", "=", "[", "]", ";", "var", "tempString", "=", "\"\"", ";", "var", "lineLength", "=", "line", ".", "length", ";", "var", "index", "=", "0", ";", "while", "(", "index", "<", "lineLength", ")", "{...
returns data from a single line
[ "returns", "data", "from", "a", "single", "line" ]
ce5caaf831c53d2a6341229c553bdf77d6880a5a
https://github.com/sguha-work/csv-array/blob/ce5caaf831c53d2a6341229c553bdf77d6880a5a/csv-array.js#L19-L49
37,671
madoublet/hashedit
dist/hashedit.js
function() { var x, els; // setup [contentEditable=true] els = document.querySelectorAll( 'p[hashedit-element], [hashedit] h1[hashedit-element], [hashedit] h2[hashedit-element], h3[hashedit-element], h4[hashedit-element], h5[hashedit-element], span[hashedit-element], ul[hashedit-element] li,...
javascript
function() { var x, els; // setup [contentEditable=true] els = document.querySelectorAll( 'p[hashedit-element], [hashedit] h1[hashedit-element], [hashedit] h2[hashedit-element], h3[hashedit-element], h4[hashedit-element], h5[hashedit-element], span[hashedit-element], ul[hashedit-element] li,...
[ "function", "(", ")", "{", "var", "x", ",", "els", ";", "// setup [contentEditable=true]", "els", "=", "document", ".", "querySelectorAll", "(", "'p[hashedit-element], [hashedit] h1[hashedit-element], [hashedit] h2[hashedit-element], h3[hashedit-element], h4[hashedit-element], h5[has...
Setup content editable element
[ "Setup", "content", "editable", "element" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L125-L141
37,672
madoublet/hashedit
dist/hashedit.js
function() { var x, sortable, els; els = document.querySelectorAll('[hashedit-sortable]'); // walk through sortable clases for (x = 0; x < els.length; x += 1) { if(els[x].firstElementChild === null){ els[x].setAttribute('hashedit-empty', 'true'); } else { ...
javascript
function() { var x, sortable, els; els = document.querySelectorAll('[hashedit-sortable]'); // walk through sortable clases for (x = 0; x < els.length; x += 1) { if(els[x].firstElementChild === null){ els[x].setAttribute('hashedit-empty', 'true'); } else { ...
[ "function", "(", ")", "{", "var", "x", ",", "sortable", ",", "els", ";", "els", "=", "document", ".", "querySelectorAll", "(", "'[hashedit-sortable]'", ")", ";", "// walk through sortable clases", "for", "(", "x", "=", "0", ";", "x", "<", "els", ".", "le...
Sets up empty @param {Array} sortable
[ "Sets", "up", "empty" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L147-L165
37,673
madoublet/hashedit
dist/hashedit.js
function() { var x, els, y, div, blocks, el, next, previous, span; blocks = hashedit.config.blocks; // setup sortable classes els = document.querySelectorAll('[hashedit] ' + blocks); // set [data-hashedit-sortable=true] for (y = 0; y < els.length; y += 1) { // setup blo...
javascript
function() { var x, els, y, div, blocks, el, next, previous, span; blocks = hashedit.config.blocks; // setup sortable classes els = document.querySelectorAll('[hashedit] ' + blocks); // set [data-hashedit-sortable=true] for (y = 0; y < els.length; y += 1) { // setup blo...
[ "function", "(", ")", "{", "var", "x", ",", "els", ",", "y", ",", "div", ",", "blocks", ",", "el", ",", "next", ",", "previous", ",", "span", ";", "blocks", "=", "hashedit", ".", "config", ".", "blocks", ";", "// setup sortable classes", "els", "=", ...
Sets up block @param {Array} sortable
[ "Sets", "up", "block" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L171-L249
37,674
madoublet/hashedit
dist/hashedit.js
function(el) { var menu, span; // set element el.setAttribute('hashedit-element', ''); // create element menu menu = document.createElement('span'); menu.setAttribute('class', 'hashedit-element-menu'); menu.setAttribute('contentEditable', 'false'); menu.innerHTML = '<l...
javascript
function(el) { var menu, span; // set element el.setAttribute('hashedit-element', ''); // create element menu menu = document.createElement('span'); menu.setAttribute('class', 'hashedit-element-menu'); menu.setAttribute('contentEditable', 'false'); menu.innerHTML = '<l...
[ "function", "(", "el", ")", "{", "var", "menu", ",", "span", ";", "// set element", "el", ".", "setAttribute", "(", "'hashedit-element'", ",", "''", ")", ";", "// create element menu", "menu", "=", "document", ".", "createElement", "(", "'span'", ")", ";", ...
Adds an element menu to a given element @param {DOMElement} el
[ "Adds", "an", "element", "menu", "to", "a", "given", "element" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L255-L293
37,675
madoublet/hashedit
dist/hashedit.js
function() { var x, y, els, div, span, el, item, obj, menu, sortable, a; sortable = hashedit.config.sortable; // walk through sortable clases for (x = 0; x < sortable.length; x += 1) { // setup sortable classes els = document.querySelectorAll('[hashedit] ' + sortable[x]); ...
javascript
function() { var x, y, els, div, span, el, item, obj, menu, sortable, a; sortable = hashedit.config.sortable; // walk through sortable clases for (x = 0; x < sortable.length; x += 1) { // setup sortable classes els = document.querySelectorAll('[hashedit] ' + sortable[x]); ...
[ "function", "(", ")", "{", "var", "x", ",", "y", ",", "els", ",", "div", ",", "span", ",", "el", ",", "item", ",", "obj", ",", "menu", ",", "sortable", ",", "a", ";", "sortable", "=", "hashedit", ".", "config", ".", "sortable", ";", "// walk thro...
Adds a hashedit-sortable class to any selector in the sortable array, enables sorting @param {Array} sortable
[ "Adds", "a", "hashedit", "-", "sortable", "class", "to", "any", "selector", "in", "the", "sortable", "array", "enables", "sorting" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L299-L371
37,676
madoublet/hashedit
dist/hashedit.js
function() { var menu, data, xhr, url, help, els, x, title = '', arr; // create menu menu = document.createElement('menu'); menu.setAttribute('class', 'hashedit-menu'); menu.innerHTML = '<div class="hashedit-menu-body"></div>'; // append menu hashedit.current.contain...
javascript
function() { var menu, data, xhr, url, help, els, x, title = '', arr; // create menu menu = document.createElement('menu'); menu.setAttribute('class', 'hashedit-menu'); menu.innerHTML = '<div class="hashedit-menu-body"></div>'; // append menu hashedit.current.contain...
[ "function", "(", ")", "{", "var", "menu", ",", "data", ",", "xhr", ",", "url", ",", "help", ",", "els", ",", "x", ",", "title", "=", "''", ",", "arr", ";", "// create menu", "menu", "=", "document", ".", "createElement", "(", "'menu'", ")", ";", ...
Create the menu
[ "Create", "the", "menu" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L376-L413
37,677
madoublet/hashedit
dist/hashedit.js
function() { var menu = document.querySelector('.hashedit-menu'); if(menu.hasAttribute('active') == true) { menu.removeAttribute('active'); } else { menu.setAttribute('active', true); } }
javascript
function() { var menu = document.querySelector('.hashedit-menu'); if(menu.hasAttribute('active') == true) { menu.removeAttribute('active'); } else { menu.setAttribute('active', true); } }
[ "function", "(", ")", "{", "var", "menu", "=", "document", ".", "querySelector", "(", "'.hashedit-menu'", ")", ";", "if", "(", "menu", ".", "hasAttribute", "(", "'active'", ")", "==", "true", ")", "{", "menu", ".", "removeAttribute", "(", "'active'", ")"...
Shows the menu
[ "Shows", "the", "menu" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L418-L429
37,678
madoublet/hashedit
dist/hashedit.js
function() { var data, xhr; data = hashedit.retrieveUpdateArray(); if (hashedit.saveUrl) { // construct an HTTP request xhr = new XMLHttpRequest(); xhr.open('post', hashedit.saveUrl, true); // set token if(hashedit.useToken == true) { xhr.setReque...
javascript
function() { var data, xhr; data = hashedit.retrieveUpdateArray(); if (hashedit.saveUrl) { // construct an HTTP request xhr = new XMLHttpRequest(); xhr.open('post', hashedit.saveUrl, true); // set token if(hashedit.useToken == true) { xhr.setReque...
[ "function", "(", ")", "{", "var", "data", ",", "xhr", ";", "data", "=", "hashedit", ".", "retrieveUpdateArray", "(", ")", ";", "if", "(", "hashedit", ".", "saveUrl", ")", "{", "// construct an HTTP request", "xhr", "=", "new", "XMLHttpRequest", "(", ")", ...
Saves the content
[ "Saves", "the", "content" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L434-L462
37,679
madoublet/hashedit
dist/hashedit.js
function() { var x, el, selector, sortable, item, action, html; // setup sortable on the menu el = document.querySelector('.hashedit-menu-body'); sortable = new Sortable(el, { group: { name: 'hashedit-sortable', pull: 'clone', put: false }, ...
javascript
function() { var x, el, selector, sortable, item, action, html; // setup sortable on the menu el = document.querySelector('.hashedit-menu-body'); sortable = new Sortable(el, { group: { name: 'hashedit-sortable', pull: 'clone', put: false }, ...
[ "function", "(", ")", "{", "var", "x", ",", "el", ",", "selector", ",", "sortable", ",", "item", ",", "action", ",", "html", ";", "// setup sortable on the menu", "el", "=", "document", ".", "querySelector", "(", "'.hashedit-menu-body'", ")", ";", "sortable"...
Setup draggable events on menu items
[ "Setup", "draggable", "events", "on", "menu", "items" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L467-L544
37,680
madoublet/hashedit
dist/hashedit.js
function(element) { var x, link, image, text, fields; // set current element and node hashedit.current.element = element; hashedit.current.node = element; // if the current element is not a [hashedit-element], find the parent that matches if(hashedit.current.element.hasAttribute('...
javascript
function(element) { var x, link, image, text, fields; // set current element and node hashedit.current.element = element; hashedit.current.node = element; // if the current element is not a [hashedit-element], find the parent that matches if(hashedit.current.element.hasAttribute('...
[ "function", "(", "element", ")", "{", "var", "x", ",", "link", ",", "image", ",", "text", ",", "fields", ";", "// set current element and node", "hashedit", ".", "current", ".", "element", "=", "element", ";", "hashedit", ".", "current", ".", "node", "=", ...
Shows the text options
[ "Shows", "the", "text", "options" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L866-L904
37,681
madoublet/hashedit
dist/hashedit.js
function() { var attrs, x, y, z, key, value, html, inputs, textarea; console.log(hashedit.current.node); if (hashedit.current.node !== null) { // get attributes attrs = hashedit.current.node.attributes; for (x = 0; x < attrs.length; x += 1) { // get key and valu...
javascript
function() { var attrs, x, y, z, key, value, html, inputs, textarea; console.log(hashedit.current.node); if (hashedit.current.node !== null) { // get attributes attrs = hashedit.current.node.attributes; for (x = 0; x < attrs.length; x += 1) { // get key and valu...
[ "function", "(", ")", "{", "var", "attrs", ",", "x", ",", "y", ",", "z", ",", "key", ",", "value", ",", "html", ",", "inputs", ",", "textarea", ";", "console", ".", "log", "(", "hashedit", ".", "current", ".", "node", ")", ";", "if", "(", "hash...
Binds data from the current element
[ "Binds", "data", "from", "the", "current", "element" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L909-L959
37,682
madoublet/hashedit
dist/hashedit.js
function(el) { var text = ''; for (var i = 0; i < el.childNodes.length; i++) { var curNode = el.childNodes[i]; var whitespace = /^\s*$/; if(curNode === undefined) { text = ""; break; } if (curNode.nodeName === "#text" && !(whitesp...
javascript
function(el) { var text = ''; for (var i = 0; i < el.childNodes.length; i++) { var curNode = el.childNodes[i]; var whitespace = /^\s*$/; if(curNode === undefined) { text = ""; break; } if (curNode.nodeName === "#text" && !(whitesp...
[ "function", "(", "el", ")", "{", "var", "text", "=", "''", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "el", ".", "childNodes", ".", "length", ";", "i", "++", ")", "{", "var", "curNode", "=", "el", ".", "childNodes", "[", "i", "]", ...
Returns the value of the text node
[ "Returns", "the", "value", "of", "the", "text", "node" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L1437-L1458
37,683
madoublet/hashedit
dist/hashedit.js
function(html) { var x, newNode, node, firstChild; // create a new node newNode = document.createElement('div'); newNode.innerHTML = html; // get new new node newNode = newNode.childNodes[0]; newNode.setAttribute('hashedit-element', ''); hashedit.setupElementMenu(newN...
javascript
function(html) { var x, newNode, node, firstChild; // create a new node newNode = document.createElement('div'); newNode.innerHTML = html; // get new new node newNode = newNode.childNodes[0]; newNode.setAttribute('hashedit-element', ''); hashedit.setupElementMenu(newN...
[ "function", "(", "html", ")", "{", "var", "x", ",", "newNode", ",", "node", ",", "firstChild", ";", "// create a new node", "newNode", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "newNode", ".", "innerHTML", "=", "html", ";", "// get new...
Appends items to the editor
[ "Appends", "items", "to", "the", "editor" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L1476-L1555
37,684
madoublet/hashedit
dist/hashedit.js
function(current, position) { var x, newNode, node, firstChild; // create a new node newNode = current.cloneNode(true); // create new node in mirror if (position == 'before') { // insert element current.parentNode.insertBefore(newNode, current); } // re-in...
javascript
function(current, position) { var x, newNode, node, firstChild; // create a new node newNode = current.cloneNode(true); // create new node in mirror if (position == 'before') { // insert element current.parentNode.insertBefore(newNode, current); } // re-in...
[ "function", "(", "current", ",", "position", ")", "{", "var", "x", ",", "newNode", ",", "node", ",", "firstChild", ";", "// create a new node", "newNode", "=", "current", ".", "cloneNode", "(", "true", ")", ";", "// create new node in mirror", "if", "(", "po...
Duplicates a block and appends it to the editor
[ "Duplicates", "a", "block", "and", "appends", "it", "to", "the", "editor" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L1560-L1580
37,685
madoublet/hashedit
dist/hashedit.js
function(html, current, position) { var x, newNode, node, firstChild; // create a new node newNode = document.createElement('div'); newNode.innerHTML = html; // get new new node newNode = newNode.childNodes[0]; // create new node in mirror if (position == 'before') { ...
javascript
function(html, current, position) { var x, newNode, node, firstChild; // create a new node newNode = document.createElement('div'); newNode.innerHTML = html; // get new new node newNode = newNode.childNodes[0]; // create new node in mirror if (position == 'before') { ...
[ "function", "(", "html", ",", "current", ",", "position", ")", "{", "var", "x", ",", "newNode", ",", "node", ",", "firstChild", ";", "// create a new node", "newNode", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "newNode", ".", "innerHTM...
Appends blocks to the editor
[ "Appends", "blocks", "to", "the", "editor" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L1585-L1609
37,686
madoublet/hashedit
dist/hashedit.js
function() { var id, cssClass, href, target, title, link; // get selected link hashedit.currLink = hashedit.getLinkFromSelection(); // populate link values if (hashedit.currLink !== null) { // get attributes id = hashedit.currLink.getAttribute('id') || ''; cssC...
javascript
function() { var id, cssClass, href, target, title, link; // get selected link hashedit.currLink = hashedit.getLinkFromSelection(); // populate link values if (hashedit.currLink !== null) { // get attributes id = hashedit.currLink.getAttribute('id') || ''; cssC...
[ "function", "(", ")", "{", "var", "id", ",", "cssClass", ",", "href", ",", "target", ",", "title", ",", "link", ";", "// get selected link", "hashedit", ".", "currLink", "=", "hashedit", ".", "getLinkFromSelection", "(", ")", ";", "// populate link values", ...
Sets up the link dialog
[ "Sets", "up", "the", "link", "dialog" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L2189-L2220
37,687
madoublet/hashedit
dist/hashedit.js
function(block) { var x, dialog, list, html, el, target, i, items; if(block !== null) { block.setAttribute('hashedit-block-active', ''); } // show the layout dialog dialog = document.querySelector('#hashedit-layout-modal'); // get list list = document.querySelector(...
javascript
function(block) { var x, dialog, list, html, el, target, i, items; if(block !== null) { block.setAttribute('hashedit-block-active', ''); } // show the layout dialog dialog = document.querySelector('#hashedit-layout-modal'); // get list list = document.querySelector(...
[ "function", "(", "block", ")", "{", "var", "x", ",", "dialog", ",", "list", ",", "html", ",", "el", ",", "target", ",", "i", ",", "items", ";", "if", "(", "block", "!==", "null", ")", "{", "block", ".", "setAttribute", "(", "'hashedit-block-active'",...
Sets up the layout dialog
[ "Sets", "up", "the", "layout", "dialog" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L2225-L2281
37,688
madoublet/hashedit
dist/hashedit.js
function() { var id, cssClass, src, target, link, alt, title; // populate link values if (hashedit.current.node !== null) { // get attributes id = hashedit.current.node.getAttribute('id') || ''; cssClass = hashedit.current.node.getAttribute('class') || ''; src = has...
javascript
function() { var id, cssClass, src, target, link, alt, title; // populate link values if (hashedit.current.node !== null) { // get attributes id = hashedit.current.node.getAttribute('id') || ''; cssClass = hashedit.current.node.getAttribute('class') || ''; src = has...
[ "function", "(", ")", "{", "var", "id", ",", "cssClass", ",", "src", ",", "target", ",", "link", ",", "alt", ",", "title", ";", "// populate link values", "if", "(", "hashedit", ".", "current", ".", "node", "!==", "null", ")", "{", "// get attributes", ...
Sets up the images dialog
[ "Sets", "up", "the", "images", "dialog" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L2286-L2314
37,689
madoublet/hashedit
dist/hashedit.js
function() { var ranges, i, sel, len; if (window.getSelection) { sel = window.getSelection(); if (sel.getRangeAt && sel.rangeCount) { ranges = []; len = sel.rangeCount; for (i = 0; i < len; i += 1) { ranges.push(sel.getRangeAt(i)); } ...
javascript
function() { var ranges, i, sel, len; if (window.getSelection) { sel = window.getSelection(); if (sel.getRangeAt && sel.rangeCount) { ranges = []; len = sel.rangeCount; for (i = 0; i < len; i += 1) { ranges.push(sel.getRangeAt(i)); } ...
[ "function", "(", ")", "{", "var", "ranges", ",", "i", ",", "sel", ",", "len", ";", "if", "(", "window", ".", "getSelection", ")", "{", "sel", "=", "window", ".", "getSelection", "(", ")", ";", "if", "(", "sel", ".", "getRangeAt", "&&", "sel", "."...
Saves text selection
[ "Saves", "text", "selection" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L2355-L2373
37,690
madoublet/hashedit
dist/hashedit.js
function() { var parent, selection, range, div, links; parent = null; if (document.selection) { parent = document.selection.createRange().parentElement(); } else { selection = window.getSelection(); if (selection.rangeCount > 0) { parent = selection.getRangeA...
javascript
function() { var parent, selection, range, div, links; parent = null; if (document.selection) { parent = document.selection.createRange().parentElement(); } else { selection = window.getSelection(); if (selection.rangeCount > 0) { parent = selection.getRangeA...
[ "function", "(", ")", "{", "var", "parent", ",", "selection", ",", "range", ",", "div", ",", "links", ";", "parent", "=", "null", ";", "if", "(", "document", ".", "selection", ")", "{", "parent", "=", "document", ".", "selection", ".", "createRange", ...
Retrieve a link from the selection
[ "Retrieve", "a", "link", "from", "the", "selection" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L2378-L2418
37,691
madoublet/hashedit
dist/hashedit.js
function(node) { var style, textColor, textSize, textShadowColor, textShadowHorizontal, textShadowVertical, textShadowBlur; // get current node style = ''; // build a style attribute for (text-color, text-size, text-shadow-color, text-shadow-vertical, text-shadow-horizontal, text-shadow-blur)...
javascript
function(node) { var style, textColor, textSize, textShadowColor, textShadowHorizontal, textShadowVertical, textShadowBlur; // get current node style = ''; // build a style attribute for (text-color, text-size, text-shadow-color, text-shadow-vertical, text-shadow-horizontal, text-shadow-blur)...
[ "function", "(", "node", ")", "{", "var", "style", ",", "textColor", ",", "textSize", ",", "textShadowColor", ",", "textShadowHorizontal", ",", "textShadowVertical", ",", "textShadowBlur", ";", "// get current node", "style", "=", "''", ";", "// build a style attrib...
Executes a function by its name and applies arguments @param {HTMLElement} node
[ "Executes", "a", "function", "by", "its", "name", "and", "applies", "arguments" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L2445-L2476
37,692
madoublet/hashedit
dist/hashedit.js
function() { var toast; toast = document.createElement('div'); toast.setAttribute('class', 'hashedit-toast'); toast.innerHTML = 'Sample Toast'; // append toast if (hashedit.current) { hashedit.current.container.appendChild(toast); } else { document.body.appen...
javascript
function() { var toast; toast = document.createElement('div'); toast.setAttribute('class', 'hashedit-toast'); toast.innerHTML = 'Sample Toast'; // append toast if (hashedit.current) { hashedit.current.container.appendChild(toast); } else { document.body.appen...
[ "function", "(", ")", "{", "var", "toast", ";", "toast", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "toast", ".", "setAttribute", "(", "'class'", ",", "'hashedit-toast'", ")", ";", "toast", ".", "innerHTML", "=", "'Sample Toast'", ";", ...
Create the toast
[ "Create", "the", "toast" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L2979-L2994
37,693
madoublet/hashedit
dist/hashedit.js
function(src, stringToFind, stringToReplace) { var temp, index; temp = src; index = temp.indexOf(stringToFind); while (index != -1) { temp = temp.replace(stringToFind, stringToReplace); index = temp.indexOf(stringToFind); } return temp; }
javascript
function(src, stringToFind, stringToReplace) { var temp, index; temp = src; index = temp.indexOf(stringToFind); while (index != -1) { temp = temp.replace(stringToFind, stringToReplace); index = temp.indexOf(stringToFind); } return temp; }
[ "function", "(", "src", ",", "stringToFind", ",", "stringToReplace", ")", "{", "var", "temp", ",", "index", ";", "temp", "=", "src", ";", "index", "=", "temp", ".", "indexOf", "(", "stringToFind", ")", ";", "while", "(", "index", "!=", "-", "1", ")",...
Replace all occurrences of a string @param {String} src - Source string (e.g. haystack) @param {String} stringToFind - String to find (e.g. needle) @param {String} stringToReplace - String to replacr
[ "Replace", "all", "occurrences", "of", "a", "string" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L3002-L3015
37,694
madoublet/hashedit
dist/hashedit.js
function(language){ var els, x, id, html; // select elements els = document.querySelectorAll('[data-i18n]'); // walk through elements for(x=0; x<els.length; x++){ id = els[x].getAttribute('data-i18n'); // set id to text if empty if(id == ''){ id = els[x].innerText(); }...
javascript
function(language){ var els, x, id, html; // select elements els = document.querySelectorAll('[data-i18n]'); // walk through elements for(x=0; x<els.length; x++){ id = els[x].getAttribute('data-i18n'); // set id to text if empty if(id == ''){ id = els[x].innerText(); }...
[ "function", "(", "language", ")", "{", "var", "els", ",", "x", ",", "id", ",", "html", ";", "// select elements", "els", "=", "document", ".", "querySelectorAll", "(", "'[data-i18n]'", ")", ";", "// walk through elements", "for", "(", "x", "=", "0", ";", ...
translates a page
[ "translates", "a", "page" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L3051-L3073
37,695
madoublet/hashedit
dist/hashedit.js
function(text){ var options, language, path; language = hashedit.language; // translatable if(hashedit.canTranslate === true) { // make sure library is installed if(i18n !== undefined) { if(hashedit.isI18nInit === false) { // get language path pa...
javascript
function(text){ var options, language, path; language = hashedit.language; // translatable if(hashedit.canTranslate === true) { // make sure library is installed if(i18n !== undefined) { if(hashedit.isI18nInit === false) { // get language path pa...
[ "function", "(", "text", ")", "{", "var", "options", ",", "language", ",", "path", ";", "language", "=", "hashedit", ".", "language", ";", "// translatable", "if", "(", "hashedit", ".", "canTranslate", "===", "true", ")", "{", "// make sure library is installe...
translates a text string
[ "translates", "a", "text", "string" ]
14b5570cc7a97f8bdcfa596ce27260d25f8e18da
https://github.com/madoublet/hashedit/blob/14b5570cc7a97f8bdcfa596ce27260d25f8e18da/dist/hashedit.js#L3076-L3116
37,696
RetailMeNotSandbox/roux
index.js
initAndCachePantry
function initAndCachePantry(pantryCache, config) { return initialize(config) .then(function (initializedPantry) { // cache the pantry for next time pantryCache[config.name] = initializedPantry; return initializedPantry; }); }
javascript
function initAndCachePantry(pantryCache, config) { return initialize(config) .then(function (initializedPantry) { // cache the pantry for next time pantryCache[config.name] = initializedPantry; return initializedPantry; }); }
[ "function", "initAndCachePantry", "(", "pantryCache", ",", "config", ")", "{", "return", "initialize", "(", "config", ")", ".", "then", "(", "function", "(", "initializedPantry", ")", "{", "// cache the pantry for next time", "pantryCache", "[", "config", ".", "na...
Proxies to initialize but adds the result to the pantryCache before returning it. @param {Object} pantryCache cache of pantry objects. The result of initialize will be stored in pantryCache[config.name] @param {Object} config config to be passed to initialize @return {Promise} promise for the initiali...
[ "Proxies", "to", "initialize", "but", "adds", "the", "result", "to", "the", "pantryCache", "before", "returning", "it", "." ]
519616c4deeb47545da44098767e71dfd10a0e83
https://github.com/RetailMeNotSandbox/roux/blob/519616c4deeb47545da44098767e71dfd10a0e83/index.js#L457-L464
37,697
RetailMeNotSandbox/roux
index.js
normalizeConfig
function normalizeConfig(config, defaults) { if (_.isUndefined(config)) { config = {}; } if (!_.isObject(config)) { throw new TypeError('`config` must be an object'); } if (_.isUndefined(defaults)) { defaults = {}; } if (!_.isObject(defaults)) { throw new TypeError('`defaults` must be an object'); } ...
javascript
function normalizeConfig(config, defaults) { if (_.isUndefined(config)) { config = {}; } if (!_.isObject(config)) { throw new TypeError('`config` must be an object'); } if (_.isUndefined(defaults)) { defaults = {}; } if (!_.isObject(defaults)) { throw new TypeError('`defaults` must be an object'); } ...
[ "function", "normalizeConfig", "(", "config", ",", "defaults", ")", "{", "if", "(", "_", ".", "isUndefined", "(", "config", ")", ")", "{", "config", "=", "{", "}", ";", "}", "if", "(", "!", "_", ".", "isObject", "(", "config", ")", ")", "{", "thr...
Normalize an config common to a Roux pantry Some modules, such as roux-sass-importer may want to expose a similar api to resolve. This method validates and initializes the configuration accepted by the resolve method. @param {Object} [config] - configuration object @param {Object} config.pantries - a cache of `Pantry...
[ "Normalize", "an", "config", "common", "to", "a", "Roux", "pantry" ]
519616c4deeb47545da44098767e71dfd10a0e83
https://github.com/RetailMeNotSandbox/roux/blob/519616c4deeb47545da44098767e71dfd10a0e83/index.js#L480-L511
37,698
bholloway/persistent-cache-webpack-plugin
index.js
onInit
function onInit(unused, callback) { var filePath = path.resolve(options.file); stats.deserialise.fs.start = Date.now(); if (fs.existsSync(filePath)) { fs.readFile(filePath, complete); } else { complete(true); } function complete(error, contents) { stats.deserialise.fs.stop = ...
javascript
function onInit(unused, callback) { var filePath = path.resolve(options.file); stats.deserialise.fs.start = Date.now(); if (fs.existsSync(filePath)) { fs.readFile(filePath, complete); } else { complete(true); } function complete(error, contents) { stats.deserialise.fs.stop = ...
[ "function", "onInit", "(", "unused", ",", "callback", ")", "{", "var", "filePath", "=", "path", ".", "resolve", "(", "options", ".", "file", ")", ";", "stats", ".", "deserialise", ".", "fs", ".", "start", "=", "Date", ".", "now", "(", ")", ";", "if...
Deserialise any existing file into pending cache elements.
[ "Deserialise", "any", "existing", "file", "into", "pending", "cache", "elements", "." ]
bd5aec58b1b38477218dcdc0fb144c6981604fa8
https://github.com/bholloway/persistent-cache-webpack-plugin/blob/bd5aec58b1b38477218dcdc0fb144c6981604fa8/index.js#L49-L69
37,699
bholloway/persistent-cache-webpack-plugin
index.js
afterEmit
function afterEmit(compilation, callback) { var failures; if (options.persist) { var cache = compilation.cache, filePath = path.resolve(options.file); stats.serialise.encode.start = Date.now(); var encoded = encode(cache); failures = (encoded.$failed || []) .filter(...
javascript
function afterEmit(compilation, callback) { var failures; if (options.persist) { var cache = compilation.cache, filePath = path.resolve(options.file); stats.serialise.encode.start = Date.now(); var encoded = encode(cache); failures = (encoded.$failed || []) .filter(...
[ "function", "afterEmit", "(", "compilation", ",", "callback", ")", "{", "var", "failures", ";", "if", "(", "options", ".", "persist", ")", "{", "var", "cache", "=", "compilation", ".", "cache", ",", "filePath", "=", "path", ".", "resolve", "(", "options"...
Serialise the cache to file, don't wait for async.
[ "Serialise", "the", "cache", "to", "file", "don", "t", "wait", "for", "async", "." ]
bd5aec58b1b38477218dcdc0fb144c6981604fa8
https://github.com/bholloway/persistent-cache-webpack-plugin/blob/bd5aec58b1b38477218dcdc0fb144c6981604fa8/index.js#L81-L125