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
partition
stringclasses
1 value
altshift/altshift
lib/altshift/promise.js
function (milliseconds) { if (milliseconds === undefined) { milliseconds = this._timeout; } var self = this; if (self._timeout !== milliseconds) { self._timeout = milliseconds; if (self._timer) { clearTimeout(this._timer); ...
javascript
function (milliseconds) { if (milliseconds === undefined) { milliseconds = this._timeout; } var self = this; if (self._timeout !== milliseconds) { self._timeout = milliseconds; if (self._timer) { clearTimeout(this._timer); ...
[ "function", "(", "milliseconds", ")", "{", "if", "(", "milliseconds", "===", "undefined", ")", "{", "milliseconds", "=", "this", ".", "_timeout", ";", "}", "var", "self", "=", "this", ";", "if", "(", "self", ".", "_timeout", "!==", "milliseconds", ")", ...
Set the timeout in milliseconds to auto cancel the promise @param {int} milliseconds @return this
[ "Set", "the", "timeout", "in", "milliseconds", "to", "auto", "cancel", "the", "promise" ]
5c051157e6f558636c8e12081b6707caa66249de
https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L595-L634
train
altshift/altshift
lib/altshift/promise.js
function (target, property) { return perform(target, function (target) { return target.get(property); }, function (target) { return target[property]; }); }
javascript
function (target, property) { return perform(target, function (target) { return target.get(property); }, function (target) { return target[property]; }); }
[ "function", "(", "target", ",", "property", ")", "{", "return", "perform", "(", "target", ",", "function", "(", "target", ")", "{", "return", "target", ".", "get", "(", "property", ")", ";", "}", ",", "function", "(", "target", ")", "{", "return", "t...
Gets the value of a property in a future turn. @param {Promise} target promise or value for target object @param {string} property name of property to get @return {Promise} promise for the property value
[ "Gets", "the", "value", "of", "a", "property", "in", "a", "future", "turn", "." ]
5c051157e6f558636c8e12081b6707caa66249de
https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L768-L774
train
altshift/altshift
lib/altshift/promise.js
function (target, methodName, args) { return perform(target, function (target) { return target.apply(methodName, args); }, function (target) { return target[methodName].apply(target, args); }); }
javascript
function (target, methodName, args) { return perform(target, function (target) { return target.apply(methodName, args); }, function (target) { return target[methodName].apply(target, args); }); }
[ "function", "(", "target", ",", "methodName", ",", "args", ")", "{", "return", "perform", "(", "target", ",", "function", "(", "target", ")", "{", "return", "target", ".", "apply", "(", "methodName", ",", "args", ")", ";", "}", ",", "function", "(", ...
Invokes a method in a future turn. @param {Promise} target promise or value for target object @param {string} methodName name of method to invoke @param {Array} args array of invocation arguments @return {Promise} promise for the return value
[ "Invokes", "a", "method", "in", "a", "future", "turn", "." ]
5c051157e6f558636c8e12081b6707caa66249de
https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L784-L790
train
altshift/altshift
lib/altshift/promise.js
function (target, property, value) { return perform(target, function (target) { return target.set(property, value); }, function (target) { target[property] = value; return value; }); }
javascript
function (target, property, value) { return perform(target, function (target) { return target.set(property, value); }, function (target) { target[property] = value; return value; }); }
[ "function", "(", "target", ",", "property", ",", "value", ")", "{", "return", "perform", "(", "target", ",", "function", "(", "target", ")", "{", "return", "target", ".", "set", "(", "property", ",", "value", ")", ";", "}", ",", "function", "(", "tar...
Sets the value of a property in a future turn. @param {Promise} target promise or value for target object @param {string} property name of property to set @param {*} value new value of property @return promise for the return value
[ "Sets", "the", "value", "of", "a", "property", "in", "a", "future", "turn", "." ]
5c051157e6f558636c8e12081b6707caa66249de
https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L800-L807
train
altshift/altshift
lib/altshift/promise.js
function (asyncFunction, callbackNotDeclared) { var arity = asyncFunction.length; return function () { var deferred = new Deferred(), args = slice.call(arguments), callback; if (callbackNotDeclared && !args[args.length + 1] instanceof Function) { arity = args...
javascript
function (asyncFunction, callbackNotDeclared) { var arity = asyncFunction.length; return function () { var deferred = new Deferred(), args = slice.call(arguments), callback; if (callbackNotDeclared && !args[args.length + 1] instanceof Function) { arity = args...
[ "function", "(", "asyncFunction", ",", "callbackNotDeclared", ")", "{", "var", "arity", "=", "asyncFunction", ".", "length", ";", "return", "function", "(", ")", "{", "var", "deferred", "=", "new", "Deferred", "(", ")", ",", "args", "=", "slice", ".", "c...
Converts a Node async function to a promise returning function @param {Function} asyncFunction node async function which takes a callback as its last argument @param {boolean} callbackNotDeclared true if callback is optional in the definition @return {Function} A function that returns a promise
[ "Converts", "a", "Node", "async", "function", "to", "a", "promise", "returning", "function" ]
5c051157e6f558636c8e12081b6707caa66249de
https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L907-L949
train
iopa-io/iopa-devices
demo.js
DemoDevice
function DemoDevice(){ var _device = {}; _device[DEVICE.ModelManufacturer] = "Internet of Protocols Alliance"; _device[DEVICE.ModelManufacturerUrl] = "http://iopa.io"; _device[DEVICE.ModelName] = "npm install iopa-devices"; _device[DEVICE.ModelNumber] = "iopa-devices"; _device[DEVICE.ModelUrl] = "http://git...
javascript
function DemoDevice(){ var _device = {}; _device[DEVICE.ModelManufacturer] = "Internet of Protocols Alliance"; _device[DEVICE.ModelManufacturerUrl] = "http://iopa.io"; _device[DEVICE.ModelName] = "npm install iopa-devices"; _device[DEVICE.ModelNumber] = "iopa-devices"; _device[DEVICE.ModelUrl] = "http://git...
[ "function", "DemoDevice", "(", ")", "{", "var", "_device", "=", "{", "}", ";", "_device", "[", "DEVICE", ".", "ModelManufacturer", "]", "=", "\"Internet of Protocols Alliance\"", ";", "_device", "[", "DEVICE", ".", "ModelManufacturerUrl", "]", "=", "\"http://iop...
Demo Device Class
[ "Demo", "Device", "Class" ]
1610a73f391fefa3f67f21b113f2206f13ba268d
https://github.com/iopa-io/iopa-devices/blob/1610a73f391fefa3f67f21b113f2206f13ba268d/demo.js#L46-L80
train
mannyvergel/oils-js
core/utils/oilsUtils.js
function(arrPathFromRoot) { if (arrPathFromRoot) { let routes = {}; for (let pathFromRoot of arrPathFromRoot) { routes['/' + pathFromRoot] = { get: function(req, res) { web.utils.serveStaticFile(path.join(web.conf.publicDir, pathFromRoot), res); } } } return routes; ...
javascript
function(arrPathFromRoot) { if (arrPathFromRoot) { let routes = {}; for (let pathFromRoot of arrPathFromRoot) { routes['/' + pathFromRoot] = { get: function(req, res) { web.utils.serveStaticFile(path.join(web.conf.publicDir, pathFromRoot), res); } } } return routes; ...
[ "function", "(", "arrPathFromRoot", ")", "{", "if", "(", "arrPathFromRoot", ")", "{", "let", "routes", "=", "{", "}", ";", "for", "(", "let", "pathFromRoot", "of", "arrPathFromRoot", ")", "{", "routes", "[", "'/'", "+", "pathFromRoot", "]", "=", "{", "...
because of the ability to change the context of the public folder some icons like favico, sitemap, robots.txt are still best served in root
[ "because", "of", "the", "ability", "to", "change", "the", "context", "of", "the", "public", "folder", "some", "icons", "like", "favico", "sitemap", "robots", ".", "txt", "are", "still", "best", "served", "in", "root" ]
8d23714cab202f6dbb79d5d4ec536a684d77ca00
https://github.com/mannyvergel/oils-js/blob/8d23714cab202f6dbb79d5d4ec536a684d77ca00/core/utils/oilsUtils.js#L25-L40
train
GoIncremental/gi-util
dist/gi-util.js
transformData
function transformData(data, headers, status, fns) { if (isFunction(fns)) return fns(data, headers, status); forEach(fns, function(fn) { data = fn(data, headers, status); }); return data; }
javascript
function transformData(data, headers, status, fns) { if (isFunction(fns)) return fns(data, headers, status); forEach(fns, function(fn) { data = fn(data, headers, status); }); return data; }
[ "function", "transformData", "(", "data", ",", "headers", ",", "status", ",", "fns", ")", "{", "if", "(", "isFunction", "(", "fns", ")", ")", "return", "fns", "(", "data", ",", "headers", ",", "status", ")", ";", "forEach", "(", "fns", ",", "function...
Chain all given functions This function is used for both request and response transforming @param {*} data Data to transform. @param {function(string=)} headers HTTP headers getter fn. @param {number} status HTTP status code of the response. @param {(Function|Array.<Function>)} fns Function or an array of functions. ...
[ "Chain", "all", "given", "functions" ]
ea9eb87f1c94efbc2a5f935e8159b536d7af3c40
https://github.com/GoIncremental/gi-util/blob/ea9eb87f1c94efbc2a5f935e8159b536d7af3c40/dist/gi-util.js#L13310-L13319
train
nfroidure/gulp-vartree
src/index.js
treeSorter
function treeSorter(node) { if(node[options.childsProp]) { node[options.childsProp].forEach(function(node) { treeSorter(node); }); node[options.childsProp].sort(function childSorter(a, b) { var result; if('undefined' === typeof a[options.sortProp]) { result = (opt...
javascript
function treeSorter(node) { if(node[options.childsProp]) { node[options.childsProp].forEach(function(node) { treeSorter(node); }); node[options.childsProp].sort(function childSorter(a, b) { var result; if('undefined' === typeof a[options.sortProp]) { result = (opt...
[ "function", "treeSorter", "(", "node", ")", "{", "if", "(", "node", "[", "options", ".", "childsProp", "]", ")", "{", "node", "[", "options", ".", "childsProp", "]", ".", "forEach", "(", "function", "(", "node", ")", "{", "treeSorter", "(", "node", "...
Tree sorting function
[ "Tree", "sorting", "function" ]
44ea5059845b2e330f7514a666d89eb8e889422e
https://github.com/nfroidure/gulp-vartree/blob/44ea5059845b2e330f7514a666d89eb8e889422e/src/index.js#L41-L59
train
Jam3/innkeeper
index.js
function( userId ) { return this.memory.createRoom( userId ) .then( function( id ) { rooms[ id ] = room( this.memory, id ); return promise.resolve( rooms[ id ] ); }.bind( this ), function() { return promise.reject( 'could not get a roomID to create a room' ); }); ...
javascript
function( userId ) { return this.memory.createRoom( userId ) .then( function( id ) { rooms[ id ] = room( this.memory, id ); return promise.resolve( rooms[ id ] ); }.bind( this ), function() { return promise.reject( 'could not get a roomID to create a room' ); }); ...
[ "function", "(", "userId", ")", "{", "return", "this", ".", "memory", ".", "createRoom", "(", "userId", ")", ".", "then", "(", "function", "(", "id", ")", "{", "rooms", "[", "id", "]", "=", "room", "(", "this", ".", "memory", ",", "id", ")", ";",...
Create a new room object @param {String} userId id of the user whose reserving a room @param {Boolean} isPublic whether the room your are creating is publicly available @return {Promise} This promise will resolve by sending a room instance
[ "Create", "a", "new", "room", "object" ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/index.js#L28-L40
train
Jam3/innkeeper
index.js
function( userId, id ) { return this.memory.joinRoom( userId, id ) .then( function( id ) { if( rooms[ id ] === undefined ) { rooms[ id ] = room( this.memory, id ); } return promise.resolve( rooms[ id ] ); }.bind( this )); }
javascript
function( userId, id ) { return this.memory.joinRoom( userId, id ) .then( function( id ) { if( rooms[ id ] === undefined ) { rooms[ id ] = room( this.memory, id ); } return promise.resolve( rooms[ id ] ); }.bind( this )); }
[ "function", "(", "userId", ",", "id", ")", "{", "return", "this", ".", "memory", ".", "joinRoom", "(", "userId", ",", "id", ")", ".", "then", "(", "function", "(", "id", ")", "{", "if", "(", "rooms", "[", "id", "]", "===", "undefined", ")", "{", ...
Join a room @param {String} userId id of the user whose entering a room @param {String} id id for the room you'd like to enter @return {Promise} This promise will resolve by sending a room instance if the room does not exist it will fail
[ "Join", "a", "room" ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/index.js#L49-L61
train
Jam3/innkeeper
index.js
function( userId ) { return this.memory.getPublicRoom() .then(function( roomId ) { if ( roomId ) { return this.enter( userId, roomId); } else { return promise.reject( 'Could not find a public room' ); } }.bind(this)); }
javascript
function( userId ) { return this.memory.getPublicRoom() .then(function( roomId ) { if ( roomId ) { return this.enter( userId, roomId); } else { return promise.reject( 'Could not find a public room' ); } }.bind(this)); }
[ "function", "(", "userId", ")", "{", "return", "this", ".", "memory", ".", "getPublicRoom", "(", ")", ".", "then", "(", "function", "(", "roomId", ")", "{", "if", "(", "roomId", ")", "{", "return", "this", ".", "enter", "(", "userId", ",", "roomId", ...
Join an available public room or create one @param {String} userId id of the user whose entering a room @return {Promise} This promise will resolve by sending a room instance, or reject if no public rooms available
[ "Join", "an", "available", "public", "room", "or", "create", "one" ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/index.js#L82-L91
train
Jam3/innkeeper
index.js
function( userId, id ) { return this.memory.leaveRoom( userId, id ) .then( function( numUsers ) { if( numUsers == 0 ) { // remove all listeners from room since there should be one rooms[ id ].removeAllListeners(); rooms[ id ].setPrivate(); delete rooms[ id ]; return promise.resolve( n...
javascript
function( userId, id ) { return this.memory.leaveRoom( userId, id ) .then( function( numUsers ) { if( numUsers == 0 ) { // remove all listeners from room since there should be one rooms[ id ].removeAllListeners(); rooms[ id ].setPrivate(); delete rooms[ id ]; return promise.resolve( n...
[ "function", "(", "userId", ",", "id", ")", "{", "return", "this", ".", "memory", ".", "leaveRoom", "(", "userId", ",", "id", ")", ".", "then", "(", "function", "(", "numUsers", ")", "{", "if", "(", "numUsers", "==", "0", ")", "{", "// remove all list...
Leave a room. @param {String} userId id of the user whose leaving a room @param {String} id id for the room you'd like to leave @return {Promise} When this promise resolves it will return a room object if the room still exists and null if not
[ "Leave", "a", "room", "." ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/index.js#L100-L118
train
juttle/juttle-googleanalytics-adapter
lib/google.js
getProperties
function getProperties() { return analytics.management.webproperties.listAsync({ auth: auth, accountId: accountId }) .then((properties) => { logger.debug('got properties', JSON.stringify(properties, null, 4)); return _.map(properties.items, (property) => { return ...
javascript
function getProperties() { return analytics.management.webproperties.listAsync({ auth: auth, accountId: accountId }) .then((properties) => { logger.debug('got properties', JSON.stringify(properties, null, 4)); return _.map(properties.items, (property) => { return ...
[ "function", "getProperties", "(", ")", "{", "return", "analytics", ".", "management", ".", "webproperties", ".", "listAsync", "(", "{", "auth", ":", "auth", ",", "accountId", ":", "accountId", "}", ")", ".", "then", "(", "(", "properties", ")", "=>", "{"...
Get all accessible properties for the account
[ "Get", "all", "accessible", "properties", "for", "the", "account" ]
2843c9667f21a3ff5dad62eca34e9935e835da22
https://github.com/juttle/juttle-googleanalytics-adapter/blob/2843c9667f21a3ff5dad62eca34e9935e835da22/lib/google.js#L116-L127
train
juttle/juttle-googleanalytics-adapter
lib/google.js
getViews
function getViews(property, options) { logger.debug('getting views for', property); return analytics.management.profiles.listAsync({ auth: auth, accountId: accountId, webPropertyId: property.id }) .then((profiles) => { // If we're not grouping by view, then only include t...
javascript
function getViews(property, options) { logger.debug('getting views for', property); return analytics.management.profiles.listAsync({ auth: auth, accountId: accountId, webPropertyId: property.id }) .then((profiles) => { // If we're not grouping by view, then only include t...
[ "function", "getViews", "(", "property", ",", "options", ")", "{", "logger", ".", "debug", "(", "'getting views for'", ",", "property", ")", ";", "return", "analytics", ".", "management", ".", "profiles", ".", "listAsync", "(", "{", "auth", ":", "auth", ",...
Get all views for the given property
[ "Get", "all", "views", "for", "the", "given", "property" ]
2843c9667f21a3ff5dad62eca34e9935e835da22
https://github.com/juttle/juttle-googleanalytics-adapter/blob/2843c9667f21a3ff5dad62eca34e9935e835da22/lib/google.js#L130-L153
train
hl198181/neptune
misc/demo/public/vendor/plupload-2.1.2/js/plupload.dev.js
get
function get(ids) { var els = [], el; if (o.typeOf(ids) !== 'array') { ids = [ids]; } var i = ids.length; while (i--) { el = o.get(ids[i]); if (el) { els.push(el); } } return els.length ? els : null; }
javascript
function get(ids) { var els = [], el; if (o.typeOf(ids) !== 'array') { ids = [ids]; } var i = ids.length; while (i--) { el = o.get(ids[i]); if (el) { els.push(el); } } return els.length ? els : null; }
[ "function", "get", "(", "ids", ")", "{", "var", "els", "=", "[", "]", ",", "el", ";", "if", "(", "o", ".", "typeOf", "(", "ids", ")", "!==", "'array'", ")", "{", "ids", "=", "[", "ids", "]", ";", "}", "var", "i", "=", "ids", ".", "length", ...
Get array of DOM Elements by their ids. @method get @for Utils @param {String} id Identifier of the DOM Element @return {Array}
[ "Get", "array", "of", "DOM", "Elements", "by", "their", "ids", "." ]
88030bb4222945900e6a225469380cc43a016c13
https://github.com/hl198181/neptune/blob/88030bb4222945900e6a225469380cc43a016c13/misc/demo/public/vendor/plupload-2.1.2/js/plupload.dev.js#L310-L326
train
hl198181/neptune
misc/demo/public/vendor/plupload-2.1.2/js/plupload.dev.js
function(config, runtimes) { var up, runtime; up = new plupload.Uploader(config); runtime = o.Runtime.thatCan(up.getOption().required_features, runtimes || config.runtimes); up.destroy(); return runtime; }
javascript
function(config, runtimes) { var up, runtime; up = new plupload.Uploader(config); runtime = o.Runtime.thatCan(up.getOption().required_features, runtimes || config.runtimes); up.destroy(); return runtime; }
[ "function", "(", "config", ",", "runtimes", ")", "{", "var", "up", ",", "runtime", ";", "up", "=", "new", "plupload", ".", "Uploader", "(", "config", ")", ";", "runtime", "=", "o", ".", "Runtime", ".", "thatCan", "(", "up", ".", "getOption", "(", "...
A way to predict what runtime will be choosen in the current environment with the specified settings. @method predictRuntime @static @param {Object|String} config Plupload settings to check @param {String} [runtimes] Comma-separated list of runtimes to check against @return {String} Type of compatible runtime
[ "A", "way", "to", "predict", "what", "runtime", "will", "be", "choosen", "in", "the", "current", "environment", "with", "the", "specified", "settings", "." ]
88030bb4222945900e6a225469380cc43a016c13
https://github.com/hl198181/neptune/blob/88030bb4222945900e6a225469380cc43a016c13/misc/demo/public/vendor/plupload-2.1.2/js/plupload.dev.js#L625-L632
train
robertblackwell/yake
src/yake/tasks.js
normalizeArguments
function normalizeArguments() { const a = arguments; if (debug) debugLog(`normalizeArguments: arguments:${util.inspect(arguments)}`); if (debug) debugLog(`normalizeArguments: a0: ${a[0]} a1:${a[1]} a2:${a[2]} a3:${a[3]}`); if (debug) debugLog(`normalizeArguments: a0: ${typeof a[0]} a1:${typeof a[1]} a2...
javascript
function normalizeArguments() { const a = arguments; if (debug) debugLog(`normalizeArguments: arguments:${util.inspect(arguments)}`); if (debug) debugLog(`normalizeArguments: a0: ${a[0]} a1:${a[1]} a2:${a[2]} a3:${a[3]}`); if (debug) debugLog(`normalizeArguments: a0: ${typeof a[0]} a1:${typeof a[1]} a2...
[ "function", "normalizeArguments", "(", ")", "{", "const", "a", "=", "arguments", ";", "if", "(", "debug", ")", "debugLog", "(", "`", "${", "util", ".", "inspect", "(", "arguments", ")", "}", "`", ")", ";", "if", "(", "debug", ")", "debugLog", "(", ...
Normalize the arguments passed into the task definition function. Inside a yakefile tasks are defined with a call like ... jake.task('name', 'description', ['prerequisite1', ...], function action(){}) The name and action are manditory while the other two - description and [prerequisistes] are optional. This function...
[ "Normalize", "the", "arguments", "passed", "into", "the", "task", "definition", "function", ".", "Inside", "a", "yakefile", "tasks", "are", "defined", "with", "a", "call", "like", "..." ]
172b02e29303fb718bac88bbda9b85749c57169c
https://github.com/robertblackwell/yake/blob/172b02e29303fb718bac88bbda9b85749c57169c/src/yake/tasks.js#L233-L302
train
robertblackwell/yake
src/yake/tasks.js
loadPreloadedTasks
function loadPreloadedTasks(taskCollection) { const preTasks = [ { name : 'help', description : 'list all tasks', prerequisites : [], action : function actionHelp() { /* eslint-disable no-console */ console.log('this...
javascript
function loadPreloadedTasks(taskCollection) { const preTasks = [ { name : 'help', description : 'list all tasks', prerequisites : [], action : function actionHelp() { /* eslint-disable no-console */ console.log('this...
[ "function", "loadPreloadedTasks", "(", "taskCollection", ")", "{", "const", "preTasks", "=", "[", "{", "name", ":", "'help'", ",", "description", ":", "'list all tasks'", ",", "prerequisites", ":", "[", "]", ",", "action", ":", "function", "actionHelp", "(", ...
Yake provides for a set of standard tasks to be preloaded. This function performs that process. @param {TaskCollection} taskCollection into which the tasks are to be loaded @return {TaskCollection} the same one that was passed in but updated
[ "Yake", "provides", "for", "a", "set", "of", "standard", "tasks", "to", "be", "preloaded", ".", "This", "function", "performs", "that", "process", "." ]
172b02e29303fb718bac88bbda9b85749c57169c
https://github.com/robertblackwell/yake/blob/172b02e29303fb718bac88bbda9b85749c57169c/src/yake/tasks.js#L332-L350
train
robertblackwell/yake
src/yake/tasks.js
requireTasks
function requireTasks(yakefile, taskCollection) { const debug = false; globals.globalTaskCollection = taskCollection; if (debug) debugLog(`loadTasks: called ${yakefile}`); /* eslint-disable global-require */ require(yakefile); /* eslint-disable global-require */ const newTaskCollectio...
javascript
function requireTasks(yakefile, taskCollection) { const debug = false; globals.globalTaskCollection = taskCollection; if (debug) debugLog(`loadTasks: called ${yakefile}`); /* eslint-disable global-require */ require(yakefile); /* eslint-disable global-require */ const newTaskCollectio...
[ "function", "requireTasks", "(", "yakefile", ",", "taskCollection", ")", "{", "const", "debug", "=", "false", ";", "globals", ".", "globalTaskCollection", "=", "taskCollection", ";", "if", "(", "debug", ")", "debugLog", "(", "`", "${", "yakefile", "}", "`", ...
Loads tasks from a yakefile into taskCollection and returns the updated taskCollection. It does this by a dynamic 'require' @param {string} yakefile - full path to yakefile - assume it exists @parame {TaskCollection} taskCollection - collection into which tasks will be placed @return {TaskCollection}...
[ "Loads", "tasks", "from", "a", "yakefile", "into", "taskCollection", "and", "returns", "the", "updated", "taskCollection", ".", "It", "does", "this", "by", "a", "dynamic", "require" ]
172b02e29303fb718bac88bbda9b85749c57169c
https://github.com/robertblackwell/yake/blob/172b02e29303fb718bac88bbda9b85749c57169c/src/yake/tasks.js#L361-L375
train
BarzinJS/string-extensions
lib/parsers/bool.js
function (item, arr, options) { debug('Match'); debug('Item: %s', item); debug('Array: %s', arr); debug('Options: %o', options); // normal item match (case-sensitive) let found = arr.indexOf(item) > -1; // case insensitive test if on...
javascript
function (item, arr, options) { debug('Match'); debug('Item: %s', item); debug('Array: %s', arr); debug('Options: %o', options); // normal item match (case-sensitive) let found = arr.indexOf(item) > -1; // case insensitive test if on...
[ "function", "(", "item", ",", "arr", ",", "options", ")", "{", "debug", "(", "'Match'", ")", ";", "debug", "(", "'Item: %s'", ",", "item", ")", ";", "debug", "(", "'Array: %s'", ",", "arr", ")", ";", "debug", "(", "'Options: %o'", ",", "options", ")"...
Match item in an array @param {string} item Item to search for @param {array<string>} arr Array of string items @param {any} options Search/Match options @returns {bool} Match result
[ "Match", "item", "in", "an", "array" ]
448db8fa460cb10859e927fadde3bde0eb8fb054
https://github.com/BarzinJS/string-extensions/blob/448db8fa460cb10859e927fadde3bde0eb8fb054/lib/parsers/bool.js#L21-L48
train
lorenwest/monitor-min
lib/Sync.js
function(changedModel, options) { // Don't update unless the model is different var newModel = model.syncMonitor.get('model'); if (_.isEqual(JSON.parse(JSON.stringify(model)), JSON.parse(JSON.stringify(newModel)))) { log.info('monitorListener.noChanges', t.className, newModel); ...
javascript
function(changedModel, options) { // Don't update unless the model is different var newModel = model.syncMonitor.get('model'); if (_.isEqual(JSON.parse(JSON.stringify(model)), JSON.parse(JSON.stringify(newModel)))) { log.info('monitorListener.noChanges', t.className, newModel); ...
[ "function", "(", "changedModel", ",", "options", ")", "{", "// Don't update unless the model is different", "var", "newModel", "=", "model", ".", "syncMonitor", ".", "get", "(", "'model'", ")", ";", "if", "(", "_", ".", "isEqual", "(", "JSON", ".", "parse", ...
Server-side listener - for updating server changes into the model
[ "Server", "-", "side", "listener", "-", "for", "updating", "server", "changes", "into", "the", "model" ]
859ba34a121498dc1cb98577ae24abd825407fca
https://github.com/lorenwest/monitor-min/blob/859ba34a121498dc1cb98577ae24abd825407fca/lib/Sync.js#L299-L326
train
imlucas/node-stor
stores/indexeddb.js
db
function db(op, fn){ if(!indexedDB){ return fn(new Error('store `indexeddb` not supported by this browser')); } if(typeof op === 'function'){ fn = op; op = 'readwrite'; } if(source !== null){ return fn(null, source.transaction(module.exports.prefix, op).objectStore(module.exports.prefix)); ...
javascript
function db(op, fn){ if(!indexedDB){ return fn(new Error('store `indexeddb` not supported by this browser')); } if(typeof op === 'function'){ fn = op; op = 'readwrite'; } if(source !== null){ return fn(null, source.transaction(module.exports.prefix, op).objectStore(module.exports.prefix)); ...
[ "function", "db", "(", "op", ",", "fn", ")", "{", "if", "(", "!", "indexedDB", ")", "{", "return", "fn", "(", "new", "Error", "(", "'store `indexeddb` not supported by this browser'", ")", ")", ";", "}", "if", "(", "typeof", "op", "===", "'function'", ")...
Wrapper function that handles creating or acquiring the object store if it hasn't been already.
[ "Wrapper", "function", "that", "handles", "creating", "or", "acquiring", "the", "object", "store", "if", "it", "hasn", "t", "been", "already", "." ]
6b74af52bf160873658bc3570db716d44c33f335
https://github.com/imlucas/node-stor/blob/6b74af52bf160873658bc3570db716d44c33f335/stores/indexeddb.js#L8-L32
train
YahooArchive/mojito-cli-jslint
lib/reporter.js
main
function main(env, print, cb) { var dir = env.opts.directory || path.resolve(env.cwd, 'artifacts/jslint'), lines = [], count = 0, total = 0; function perOffense(o) { var evidence = o.evidence.trim(); count += 1; total += 1; lines.push(fmt(' #%d %d,%d: ...
javascript
function main(env, print, cb) { var dir = env.opts.directory || path.resolve(env.cwd, 'artifacts/jslint'), lines = [], count = 0, total = 0; function perOffense(o) { var evidence = o.evidence.trim(); count += 1; total += 1; lines.push(fmt(' #%d %d,%d: ...
[ "function", "main", "(", "env", ",", "print", ",", "cb", ")", "{", "var", "dir", "=", "env", ".", "opts", ".", "directory", "||", "path", ".", "resolve", "(", "env", ".", "cwd", ",", "'artifacts/jslint'", ")", ",", "lines", "=", "[", "]", ",", "c...
return a function that is responsible for outputing the lint results, to a file or stdout, and then invoking the final callback.
[ "return", "a", "function", "that", "is", "responsible", "for", "outputing", "the", "lint", "results", "to", "a", "file", "or", "stdout", "and", "then", "invoking", "the", "final", "callback", "." ]
cc6f90352534689a9e8c524c4cce825215bb5186
https://github.com/YahooArchive/mojito-cli-jslint/blob/cc6f90352534689a9e8c524c4cce825215bb5186/lib/reporter.js#L57-L121
train
commenthol/streamss-readonly
index.js
readonly
function readonly (stream) { var rs = stream._readableState || {} var opts = {} if (typeof stream.read !== 'function') { throw new Error('not a readable stream') } ['highWaterMark', 'encoding', 'objectMode'].forEach(function (p) { opts[p] = rs[p] }) var readOnly = new Readable(opts) var waiti...
javascript
function readonly (stream) { var rs = stream._readableState || {} var opts = {} if (typeof stream.read !== 'function') { throw new Error('not a readable stream') } ['highWaterMark', 'encoding', 'objectMode'].forEach(function (p) { opts[p] = rs[p] }) var readOnly = new Readable(opts) var waiti...
[ "function", "readonly", "(", "stream", ")", "{", "var", "rs", "=", "stream", ".", "_readableState", "||", "{", "}", "var", "opts", "=", "{", "}", "if", "(", "typeof", "stream", ".", "read", "!==", "'function'", ")", "{", "throw", "new", "Error", "(",...
Converts any stream into a read-only stream @param {Readable|Transform|Duplex} stream - A stream which shall behave as a Readable only stream. @throws {Error} "not a readable stream" - if stream does not implement a Readable component this error is thrown @return {Readable} - A read-only readable stream
[ "Converts", "any", "stream", "into", "a", "read", "-", "only", "stream" ]
cdeb9a41821a4837d94bc8bda8667d86dc74d273
https://github.com/commenthol/streamss-readonly/blob/cdeb9a41821a4837d94bc8bda8667d86dc74d273/index.js#L19-L62
train
fczbkk/event-simulator
lib/index.js
setupEvent
function setupEvent(event_type) { var event = void 0; if (exists(document.createEvent)) { // modern browsers event = document.createEvent('HTMLEvents'); event.initEvent(event_type, true, true); } else if (exists(document.createEventObject)) { // IE9- event = document.createEventObject(); ...
javascript
function setupEvent(event_type) { var event = void 0; if (exists(document.createEvent)) { // modern browsers event = document.createEvent('HTMLEvents'); event.initEvent(event_type, true, true); } else if (exists(document.createEventObject)) { // IE9- event = document.createEventObject(); ...
[ "function", "setupEvent", "(", "event_type", ")", "{", "var", "event", "=", "void", "0", ";", "if", "(", "exists", "(", "document", ".", "createEvent", ")", ")", "{", "// modern browsers", "event", "=", "document", ".", "createEvent", "(", "'HTMLEvents'", ...
Cross-browser bridge that creates event object @param {string} event_type Event identifier @returns {Event} Event object @private
[ "Cross", "-", "browser", "bridge", "that", "creates", "event", "object" ]
ad7f7caff8145226c5b19faeac680772e5040001
https://github.com/fczbkk/event-simulator/blob/ad7f7caff8145226c5b19faeac680772e5040001/lib/index.js#L27-L41
train
fczbkk/event-simulator
lib/index.js
fireEvent
function fireEvent(target_object, event, event_type) { var on_event_type = 'on' + event_type; if (exists(target_object.dispatchEvent)) { // modern browsers target_object.dispatchEvent(event); } else if (exists(target_object.fireEvent)) { // IE9- target_object.fireEvent(on_event_type, event); } ...
javascript
function fireEvent(target_object, event, event_type) { var on_event_type = 'on' + event_type; if (exists(target_object.dispatchEvent)) { // modern browsers target_object.dispatchEvent(event); } else if (exists(target_object.fireEvent)) { // IE9- target_object.fireEvent(on_event_type, event); } ...
[ "function", "fireEvent", "(", "target_object", ",", "event", ",", "event_type", ")", "{", "var", "on_event_type", "=", "'on'", "+", "event_type", ";", "if", "(", "exists", "(", "target_object", ".", "dispatchEvent", ")", ")", "{", "// modern browsers", "target...
Cross-browser bridge that fires an event object on target object @param {Object} target_object Any object that can fire an event @param {Event} event Event object @param {string} event_type Event identifier @private
[ "Cross", "-", "browser", "bridge", "that", "fires", "an", "event", "object", "on", "target", "object" ]
ad7f7caff8145226c5b19faeac680772e5040001
https://github.com/fczbkk/event-simulator/blob/ad7f7caff8145226c5b19faeac680772e5040001/lib/index.js#L50-L64
train
fczbkk/event-simulator
lib/index.js
simulateEvent
function simulateEvent(target_object, event_type) { if (!exists(target_object)) { throw new TypeError('simulateEvent: target object must be defined'); } if (typeof event_type !== 'string') { throw new TypeError('simulateEvent: event type must be a string'); } var event = setupEvent(event_type); fi...
javascript
function simulateEvent(target_object, event_type) { if (!exists(target_object)) { throw new TypeError('simulateEvent: target object must be defined'); } if (typeof event_type !== 'string') { throw new TypeError('simulateEvent: event type must be a string'); } var event = setupEvent(event_type); fi...
[ "function", "simulateEvent", "(", "target_object", ",", "event_type", ")", "{", "if", "(", "!", "exists", "(", "target_object", ")", ")", "{", "throw", "new", "TypeError", "(", "'simulateEvent: target object must be defined'", ")", ";", "}", "if", "(", "typeof",...
Fires an event of provided type on provided object @param {Object} target_object Any object that can fire an event @param {string} event_type Event identifier @example simulateEvent(window, 'scroll');
[ "Fires", "an", "event", "of", "provided", "type", "on", "provided", "object" ]
ad7f7caff8145226c5b19faeac680772e5040001
https://github.com/fczbkk/event-simulator/blob/ad7f7caff8145226c5b19faeac680772e5040001/lib/index.js#L73-L84
train
fczbkk/event-simulator
lib/index.js
setupMouseEvent
function setupMouseEvent(properties) { var event = document.createEvent('MouseEvents'); event.initMouseEvent(properties.type, properties.canBubble, properties.cancelable, properties.view, properties.detail, properties.screenX, properties.screenY, properties.clientX, properties.clientY, properties.ctrlKey, propertie...
javascript
function setupMouseEvent(properties) { var event = document.createEvent('MouseEvents'); event.initMouseEvent(properties.type, properties.canBubble, properties.cancelable, properties.view, properties.detail, properties.screenX, properties.screenY, properties.clientX, properties.clientY, properties.ctrlKey, propertie...
[ "function", "setupMouseEvent", "(", "properties", ")", "{", "var", "event", "=", "document", ".", "createEvent", "(", "'MouseEvents'", ")", ";", "event", ".", "initMouseEvent", "(", "properties", ".", "type", ",", "properties", ".", "canBubble", ",", "properti...
Constructs mouse event object @param {Object} properties @returns {Event} @private
[ "Constructs", "mouse", "event", "object" ]
ad7f7caff8145226c5b19faeac680772e5040001
https://github.com/fczbkk/event-simulator/blob/ad7f7caff8145226c5b19faeac680772e5040001/lib/index.js#L136-L140
train
fczbkk/event-simulator
lib/index.js
simulateMouseEvent
function simulateMouseEvent(target_object) { var custom_properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var properties = sanitizeProperties(custom_properties); var event = setupMouseEvent(properties); target_object.dispatchEvent(event); }
javascript
function simulateMouseEvent(target_object) { var custom_properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var properties = sanitizeProperties(custom_properties); var event = setupMouseEvent(properties); target_object.dispatchEvent(event); }
[ "function", "simulateMouseEvent", "(", "target_object", ")", "{", "var", "custom_properties", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "{", "}", ";", "var", "pr...
Fires a mouse event on provided object @param {Object} target_object @param {Object} custom_properties @example simulateMouseEvent(window, {type: 'mousedown', button: 'right'});
[ "Fires", "a", "mouse", "event", "on", "provided", "object" ]
ad7f7caff8145226c5b19faeac680772e5040001
https://github.com/fczbkk/event-simulator/blob/ad7f7caff8145226c5b19faeac680772e5040001/lib/index.js#L149-L155
train
TJkrusinski/feedtitles
index.js
onText
function onText (text) { if (!current || !text) return; titles.push(text); self.emit('title', text); }
javascript
function onText (text) { if (!current || !text) return; titles.push(text); self.emit('title', text); }
[ "function", "onText", "(", "text", ")", "{", "if", "(", "!", "current", "||", "!", "text", ")", "return", ";", "titles", ".", "push", "(", "text", ")", ";", "self", ".", "emit", "(", "'title'", ",", "text", ")", ";", "}" ]
If we are in a title node then push on the text @param {String} text
[ "If", "we", "are", "in", "a", "title", "node", "then", "push", "on", "the", "text" ]
f398f4515607f03af05e4e3e340f9fdfd1aec195
https://github.com/TJkrusinski/feedtitles/blob/f398f4515607f03af05e4e3e340f9fdfd1aec195/index.js#L50-L54
train
pmh/espresso
lib/ometa/ometa/base.js
extend
function extend(obj) { for(var i=1,len=arguments.length;i<len;i++) { var props = arguments[i]; for(var p in props) { if(props.hasOwnProperty(p)) { obj[p] = props[p]; } } } return obj; }
javascript
function extend(obj) { for(var i=1,len=arguments.length;i<len;i++) { var props = arguments[i]; for(var p in props) { if(props.hasOwnProperty(p)) { obj[p] = props[p]; } } } return obj; }
[ "function", "extend", "(", "obj", ")", "{", "for", "(", "var", "i", "=", "1", ",", "len", "=", "arguments", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "var", "props", "=", "arguments", "[", "i", "]", ";", "for", "(", "var"...
Local helper methods
[ "Local", "helper", "methods" ]
26d7b2089a2098344aaaf32ec7eb942e91a7edf5
https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L47-L58
train
pmh/espresso
lib/ometa/ometa/base.js
inherit
function inherit(x, props) { var r = Object.create(x); return extend(r, props); }
javascript
function inherit(x, props) { var r = Object.create(x); return extend(r, props); }
[ "function", "inherit", "(", "x", ",", "props", ")", "{", "var", "r", "=", "Object", ".", "create", "(", "x", ")", ";", "return", "extend", "(", "r", ",", "props", ")", ";", "}" ]
A simplified Version of Object.create
[ "A", "simplified", "Version", "of", "Object", ".", "create" ]
26d7b2089a2098344aaaf32ec7eb942e91a7edf5
https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L61-L64
train
pmh/espresso
lib/ometa/ometa/base.js
function(grammar, ruleName) { grammar = this._apply("anything"); ruleName = this._apply("anything"); var foreign = inherit(grammar, { bt: this.bt.borrow() }); var ans = foreign._apply(ruleName); this.bt.take_back(); // return the borrowed input stream return ans; ...
javascript
function(grammar, ruleName) { grammar = this._apply("anything"); ruleName = this._apply("anything"); var foreign = inherit(grammar, { bt: this.bt.borrow() }); var ans = foreign._apply(ruleName); this.bt.take_back(); // return the borrowed input stream return ans; ...
[ "function", "(", "grammar", ",", "ruleName", ")", "{", "grammar", "=", "this", ".", "_apply", "(", "\"anything\"", ")", ";", "ruleName", "=", "this", ".", "_apply", "(", "\"anything\"", ")", ";", "var", "foreign", "=", "inherit", "(", "grammar", ",", "...
otherGrammar.rule
[ "otherGrammar", ".", "rule" ]
26d7b2089a2098344aaaf32ec7eb942e91a7edf5
https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L684-L695
train
pmh/espresso
lib/ometa/ometa/base.js
_not
function _not(expr) { var state = this.bt.current_state(); try { var r = expr.call(this) } catch (f) { this.bt.catch_mismatch(f); this.bt.restore(state); return true } this.bt.mismatch("Negative lookahead didn't match got " + r); }
javascript
function _not(expr) { var state = this.bt.current_state(); try { var r = expr.call(this) } catch (f) { this.bt.catch_mismatch(f); this.bt.restore(state); return true } this.bt.mismatch("Negative lookahead didn't match got " + r); }
[ "function", "_not", "(", "expr", ")", "{", "var", "state", "=", "this", ".", "bt", ".", "current_state", "(", ")", ";", "try", "{", "var", "r", "=", "expr", ".", "call", "(", "this", ")", "}", "catch", "(", "f", ")", "{", "this", ".", "bt", "...
negative lookahead ~rule
[ "negative", "lookahead", "~rule" ]
26d7b2089a2098344aaaf32ec7eb942e91a7edf5
https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L714-L723
train
pmh/espresso
lib/ometa/ometa/base.js
_lookahead
function _lookahead(expr) { var state = this.bt.current_state(), ans = expr.call(this); this.bt.restore(state); return ans }
javascript
function _lookahead(expr) { var state = this.bt.current_state(), ans = expr.call(this); this.bt.restore(state); return ans }
[ "function", "_lookahead", "(", "expr", ")", "{", "var", "state", "=", "this", ".", "bt", ".", "current_state", "(", ")", ",", "ans", "=", "expr", ".", "call", "(", "this", ")", ";", "this", ".", "bt", ".", "restore", "(", "state", ")", ";", "retu...
positive lookahead &rule
[ "positive", "lookahead", "&rule" ]
26d7b2089a2098344aaaf32ec7eb942e91a7edf5
https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L727-L732
train
pmh/espresso
lib/ometa/ometa/base.js
function() { var state = this.bt.current_state(); for(var i=0,len=arguments.length; i<len; i++) { try { return arguments[i].call(this) } catch (f) { this.bt.catch_mismatch(f); this.bt.restore(state); } } this.bt.mismatch("All alter...
javascript
function() { var state = this.bt.current_state(); for(var i=0,len=arguments.length; i<len; i++) { try { return arguments[i].call(this) } catch (f) { this.bt.catch_mismatch(f); this.bt.restore(state); } } this.bt.mismatch("All alter...
[ "function", "(", ")", "{", "var", "state", "=", "this", ".", "bt", ".", "current_state", "(", ")", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "arguments", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "try", "{",...
ordered alternatives rule_a | rule_b tries all alternatives until the first match
[ "ordered", "alternatives", "rule_a", "|", "rule_b", "tries", "all", "alternatives", "until", "the", "first", "match" ]
26d7b2089a2098344aaaf32ec7eb942e91a7edf5
https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L737-L749
train
pmh/espresso
lib/ometa/ometa/base.js
function(rule) { var state = this.bt.current_state(); try { return rule.call(this); } catch(f) { this.bt.catch_mismatch(f); this.bt.restore(state); } }
javascript
function(rule) { var state = this.bt.current_state(); try { return rule.call(this); } catch(f) { this.bt.catch_mismatch(f); this.bt.restore(state); } }
[ "function", "(", "rule", ")", "{", "var", "state", "=", "this", ".", "bt", ".", "current_state", "(", ")", ";", "try", "{", "return", "rule", ".", "call", "(", "this", ")", ";", "}", "catch", "(", "f", ")", "{", "this", ".", "bt", ".", "catch_m...
Optional occurance of rule rule?
[ "Optional", "occurance", "of", "rule", "rule?" ]
26d7b2089a2098344aaaf32ec7eb942e91a7edf5
https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L788-L795
train
nail/node-gelf-manager
lib/gelf-manager.js
GELFManager
function GELFManager(options) { if (typeof options === 'undefined') options = {}; for (k in GELFManager.options) if (typeof options[k] === 'undefined') options[k] = GELFManager.options[k]; this.debug = options.debug; this.chunkTimeout = options.chunkTimeout; this.gcTimeout = options.gcTi...
javascript
function GELFManager(options) { if (typeof options === 'undefined') options = {}; for (k in GELFManager.options) if (typeof options[k] === 'undefined') options[k] = GELFManager.options[k]; this.debug = options.debug; this.chunkTimeout = options.chunkTimeout; this.gcTimeout = options.gcTi...
[ "function", "GELFManager", "(", "options", ")", "{", "if", "(", "typeof", "options", "===", "'undefined'", ")", "options", "=", "{", "}", ";", "for", "(", "k", "in", "GELFManager", ".", "options", ")", "if", "(", "typeof", "options", "[", "k", "]", "...
GELFManager - Handles GELF messages Example: var manager = new GELFManager(); manager.on('message', function(msg) { console.log(msg); }); manager.feed(rawUDPMessage);
[ "GELFManager", "-", "Handles", "GELF", "messages" ]
4c090050c8706e5e20158263fea451e5e814285e
https://github.com/nail/node-gelf-manager/blob/4c090050c8706e5e20158263fea451e5e814285e/lib/gelf-manager.js#L23-L39
train
danawoodman/parent-folder
lib/index.js
parentFolder
function parentFolder(fullPath) { var isFile = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; // If no path passed in, use the file path of the // caller. if (!fullPath) { fullPath = module.parent.filename; isFile = true; } var pathObj = _path2['default'].parse(fullPat...
javascript
function parentFolder(fullPath) { var isFile = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; // If no path passed in, use the file path of the // caller. if (!fullPath) { fullPath = module.parent.filename; isFile = true; } var pathObj = _path2['default'].parse(fullPat...
[ "function", "parentFolder", "(", "fullPath", ")", "{", "var", "isFile", "=", "arguments", ".", "length", "<=", "1", "||", "arguments", "[", "1", "]", "===", "undefined", "?", "false", ":", "arguments", "[", "1", "]", ";", "// If no path passed in, use the fi...
Get the name of the parent folder. If given a directory as a path, return the last directory. If given a path with a file, return the parent of that file. Default to the parent folder of the call path. @module parentFolder @param {String} [fullPath=module.parent.filename] The full path to find the parent folder from @...
[ "Get", "the", "name", "of", "the", "parent", "folder", ".", "If", "given", "a", "directory", "as", "a", "path", "return", "the", "last", "directory", ".", "If", "given", "a", "path", "with", "a", "file", "return", "the", "parent", "of", "that", "file",...
36ec3bf041d1402ce9f6946e1d05d7f9aff01e5a
https://github.com/danawoodman/parent-folder/blob/36ec3bf041d1402ce9f6946e1d05d7f9aff01e5a/lib/index.js#L26-L43
train
peteromano/jetrunner
lib/util.js
function() { var obj = arguments[0], args = Array.prototype.slice.call(arguments, 1); function copy(destination, source) { for (var property in source) { if (source[property] && source[property].constructor && source[property].constructor === Object) { ...
javascript
function() { var obj = arguments[0], args = Array.prototype.slice.call(arguments, 1); function copy(destination, source) { for (var property in source) { if (source[property] && source[property].constructor && source[property].constructor === Object) { ...
[ "function", "(", ")", "{", "var", "obj", "=", "arguments", "[", "0", "]", ",", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ";", "function", "copy", "(", "destination", ",", "source", ")", "{",...
Recursively merge objects together
[ "Recursively", "merge", "objects", "together" ]
1882e0ee83d31fe1c799b42848c8c1357a62c995
https://github.com/peteromano/jetrunner/blob/1882e0ee83d31fe1c799b42848c8c1357a62c995/lib/util.js#L10-L31
train
peteromano/jetrunner
lib/util.js
function(proto) { function F() {} this.merge(F.prototype, proto || {}, (function() { var Events = function() {}; Events.prototype = EventEmitter.prototype; return new Events(); })()); return new F(); }
javascript
function(proto) { function F() {} this.merge(F.prototype, proto || {}, (function() { var Events = function() {}; Events.prototype = EventEmitter.prototype; return new Events(); })()); return new F(); }
[ "function", "(", "proto", ")", "{", "function", "F", "(", ")", "{", "}", "this", ".", "merge", "(", "F", ".", "prototype", ",", "proto", "||", "{", "}", ",", "(", "function", "(", ")", "{", "var", "Events", "=", "function", "(", ")", "{", "}", ...
Factory for extending from EventEmitter @param {Object} proto Class definition
[ "Factory", "for", "extending", "from", "EventEmitter" ]
1882e0ee83d31fe1c799b42848c8c1357a62c995
https://github.com/peteromano/jetrunner/blob/1882e0ee83d31fe1c799b42848c8c1357a62c995/lib/util.js#L38-L46
train
TheRoSS/jsfilter
lib/common.js
splitByDot
function splitByDot(str) { var result = []; var s = ""; for (var i = 0; i < str.length; i++) { if (str[i] == "\\" && str[i+1] == ".") { i++; s += "."; continue; } if (str[i] == ".") { result.push(s); s = ""; co...
javascript
function splitByDot(str) { var result = []; var s = ""; for (var i = 0; i < str.length; i++) { if (str[i] == "\\" && str[i+1] == ".") { i++; s += "."; continue; } if (str[i] == ".") { result.push(s); s = ""; co...
[ "function", "splitByDot", "(", "str", ")", "{", "var", "result", "=", "[", "]", ";", "var", "s", "=", "\"\"", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "str", ".", "length", ";", "i", "++", ")", "{", "if", "(", "str", "[", "i", ...
Splits dot notation selector by its components Escaped dots are ignored @param {string} str @returns {Array.<string>}
[ "Splits", "dot", "notation", "selector", "by", "its", "components", "Escaped", "dots", "are", "ignored" ]
e06e689e7ad175eb1479645c9b4e38fadc385cf5
https://github.com/TheRoSS/jsfilter/blob/e06e689e7ad175eb1479645c9b4e38fadc385cf5/lib/common.js#L35-L60
train
TheRoSS/jsfilter
lib/common.js
normilizeSquareBrackets
function normilizeSquareBrackets(str) { var m; while ((m = reSqrBrackets.exec(str))) { var header = m[1] ? m[1] + '.' : ''; var body = m[2].replace(/\./g, "\\."); var footer = m[3] || ''; str = header + body + footer; } return str; }
javascript
function normilizeSquareBrackets(str) { var m; while ((m = reSqrBrackets.exec(str))) { var header = m[1] ? m[1] + '.' : ''; var body = m[2].replace(/\./g, "\\."); var footer = m[3] || ''; str = header + body + footer; } return str; }
[ "function", "normilizeSquareBrackets", "(", "str", ")", "{", "var", "m", ";", "while", "(", "(", "m", "=", "reSqrBrackets", ".", "exec", "(", "str", ")", ")", ")", "{", "var", "header", "=", "m", "[", "1", "]", "?", "m", "[", "1", "]", "+", "'....
Replaces square brackets notation by escaped dot notation @param {string} str @returns {string}
[ "Replaces", "square", "brackets", "notation", "by", "escaped", "dot", "notation" ]
e06e689e7ad175eb1479645c9b4e38fadc385cf5
https://github.com/TheRoSS/jsfilter/blob/e06e689e7ad175eb1479645c9b4e38fadc385cf5/lib/common.js#L69-L80
train
sydneystockholm/blog.md
lib/loaders/array.js
ArrayLoader
function ArrayLoader(posts) { var self = this; posts.forEach(function (post, index) { if (!('id' in post)) { post.id = index; } }); process.nextTick(function () { self.emit('load', posts); }); }
javascript
function ArrayLoader(posts) { var self = this; posts.forEach(function (post, index) { if (!('id' in post)) { post.id = index; } }); process.nextTick(function () { self.emit('load', posts); }); }
[ "function", "ArrayLoader", "(", "posts", ")", "{", "var", "self", "=", "this", ";", "posts", ".", "forEach", "(", "function", "(", "post", ",", "index", ")", "{", "if", "(", "!", "(", "'id'", "in", "post", ")", ")", "{", "post", ".", "id", "=", ...
Create a new array loader. @param {Array} posts
[ "Create", "a", "new", "array", "loader", "." ]
0b145fa1620cbe8b7296eb242241ee93223db9f9
https://github.com/sydneystockholm/blog.md/blob/0b145fa1620cbe8b7296eb242241ee93223db9f9/lib/loaders/array.js#L10-L20
train
eventEmitter/ee-mysql-schema
lib/StaticModel.js
function( options ){ options = options || {}; options.$db = cOptions.db; options.$dbName = cOptions.database; options.$model = cOptions.model; return new cOptions.cls( options ); }
javascript
function( options ){ options = options || {}; options.$db = cOptions.db; options.$dbName = cOptions.database; options.$model = cOptions.model; return new cOptions.cls( options ); }
[ "function", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "options", ".", "$db", "=", "cOptions", ".", "db", ";", "options", ".", "$dbName", "=", "cOptions", ".", "database", ";", "options", ".", "$model", "=", "cOptions", ...
create a constructor proxy
[ "create", "a", "constructor", "proxy" ]
521d9e008233360d9a4bb8b9af45c10f079cd41c
https://github.com/eventEmitter/ee-mysql-schema/blob/521d9e008233360d9a4bb8b9af45c10f079cd41c/lib/StaticModel.js#L414-L422
train
Tictrac/grunt-i18n-linter
tasks/i18n_linter.js
report
function report(items, heading) { grunt.log.subhead(heading); if (items.length > 0) { grunt.log.error(grunt.log.wordlist(items, {separator: '\n'})); } else { grunt.log.ok(); } }
javascript
function report(items, heading) { grunt.log.subhead(heading); if (items.length > 0) { grunt.log.error(grunt.log.wordlist(items, {separator: '\n'})); } else { grunt.log.ok(); } }
[ "function", "report", "(", "items", ",", "heading", ")", "{", "grunt", ".", "log", ".", "subhead", "(", "heading", ")", ";", "if", "(", "items", ".", "length", ">", "0", ")", "{", "grunt", ".", "log", ".", "error", "(", "grunt", ".", "log", ".", ...
Report the status of items @param {Array} items If empty its successful @param {String} success Success message @param {String} error Error message
[ "Report", "the", "status", "of", "items" ]
7a64e19ece1cf974beb29f85ec15dec17a39c45f
https://github.com/Tictrac/grunt-i18n-linter/blob/7a64e19ece1cf974beb29f85ec15dec17a39c45f/tasks/i18n_linter.js#L35-L42
train
melvincarvalho/rdf-shell
lib/obj.js
obj
function obj(argv, callback) { var uri = argv[2]; if (argv[3]) { util.put(argv[2], '<> <> """' + argv[3] + '""" .', function(err, callback){ if (err) { console.error(err); } else { console.log('put value : ' + argv[3]); } }); } else { var wss = 'wss://' + uri.split('...
javascript
function obj(argv, callback) { var uri = argv[2]; if (argv[3]) { util.put(argv[2], '<> <> """' + argv[3] + '""" .', function(err, callback){ if (err) { console.error(err); } else { console.log('put value : ' + argv[3]); } }); } else { var wss = 'wss://' + uri.split('...
[ "function", "obj", "(", "argv", ",", "callback", ")", "{", "var", "uri", "=", "argv", "[", "2", "]", ";", "if", "(", "argv", "[", "3", "]", ")", "{", "util", ".", "put", "(", "argv", "[", "2", "]", ",", "'<> <> \"\"\"'", "+", "argv", "[", "3"...
obj gets list of files for a given container @param {String} argv[2] url @callback {bin~cb} callback
[ "obj", "gets", "list", "of", "files", "for", "a", "given", "container" ]
bf2015f6f333855e69a18ce3ec9e917bbddfb425
https://github.com/melvincarvalho/rdf-shell/blob/bf2015f6f333855e69a18ce3ec9e917bbddfb425/lib/obj.js#L13-L52
train
melvincarvalho/rdf-shell
lib/obj.js
bin
function bin(argv) { obj(argv, function(err, res) { if (err) { console.log(err); } else { console.log(res); } }); }
javascript
function bin(argv) { obj(argv, function(err, res) { if (err) { console.log(err); } else { console.log(res); } }); }
[ "function", "bin", "(", "argv", ")", "{", "obj", "(", "argv", ",", "function", "(", "err", ",", "res", ")", "{", "if", "(", "err", ")", "{", "console", ".", "log", "(", "err", ")", ";", "}", "else", "{", "console", ".", "log", "(", "res", ")"...
obj as a command @param {String} argv[2] login @callback {bin~cb} callback
[ "obj", "as", "a", "command" ]
bf2015f6f333855e69a18ce3ec9e917bbddfb425
https://github.com/melvincarvalho/rdf-shell/blob/bf2015f6f333855e69a18ce3ec9e917bbddfb425/lib/obj.js#L61-L69
train
hitchyjs/odem
lib/model/compiler.js
validateAttributes
function validateAttributes( modelName, attributes = {}, errors = [] ) { if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) { throw new TypeError( "definition of attributes must be object" ); } const names = Object.keys( attributes ); const handlers = {}; for ( let i = 0, lengt...
javascript
function validateAttributes( modelName, attributes = {}, errors = [] ) { if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) { throw new TypeError( "definition of attributes must be object" ); } const names = Object.keys( attributes ); const handlers = {}; for ( let i = 0, lengt...
[ "function", "validateAttributes", "(", "modelName", ",", "attributes", "=", "{", "}", ",", "errors", "=", "[", "]", ")", "{", "if", "(", "!", "attributes", "||", "typeof", "attributes", "!==", "\"object\"", "||", "Array", ".", "isArray", "(", "attributes",...
Basically validates provided definitions of attributes. @note Qualification of attributes' definitions are applied to provided object and thus alter the provided set of definitions, too. @param {string} modelName name of model definition of attributes is used for @param {object<string,object>} attributes definition o...
[ "Basically", "validates", "provided", "definitions", "of", "attributes", "." ]
28f3dc31cc3314f9109d2cac1f5f7e20dad6521b
https://github.com/hitchyjs/odem/blob/28f3dc31cc3314f9109d2cac1f5f7e20dad6521b/lib/model/compiler.js#L291-L318
train
hitchyjs/odem
lib/model/compiler.js
compileCoercionMap
function compileCoercionMap( attributes ) { if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) { throw new TypeError( "definition of attributes must be object" ); } const coercions = {}; const attributeNames = Object.keys( attributes ); for ( let ai = 0, aLength = attributeName...
javascript
function compileCoercionMap( attributes ) { if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) { throw new TypeError( "definition of attributes must be object" ); } const coercions = {}; const attributeNames = Object.keys( attributes ); for ( let ai = 0, aLength = attributeName...
[ "function", "compileCoercionMap", "(", "attributes", ")", "{", "if", "(", "!", "attributes", "||", "typeof", "attributes", "!==", "\"object\"", "||", "Array", ".", "isArray", "(", "attributes", ")", ")", "{", "throw", "new", "TypeError", "(", "\"definition of ...
Compiles coercion handlers per attribute of model. @param {object<string,object>} attributes definition of essential attributes @returns {object<string,function(*,object):*>} map of attributes' names into either attribute's coercion handler
[ "Compiles", "coercion", "handlers", "per", "attribute", "of", "model", "." ]
28f3dc31cc3314f9109d2cac1f5f7e20dad6521b
https://github.com/hitchyjs/odem/blob/28f3dc31cc3314f9109d2cac1f5f7e20dad6521b/lib/model/compiler.js#L326-L344
train
hitchyjs/odem
lib/model/compiler.js
compileCoercion
function compileCoercion( attributes ) { if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) { throw new TypeError( "definition of attributes must be object" ); } const attributeNames = Object.keys( attributes ); const numAttributes = attributeNames.length; const coercion = []; ...
javascript
function compileCoercion( attributes ) { if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) { throw new TypeError( "definition of attributes must be object" ); } const attributeNames = Object.keys( attributes ); const numAttributes = attributeNames.length; const coercion = []; ...
[ "function", "compileCoercion", "(", "attributes", ")", "{", "if", "(", "!", "attributes", "||", "typeof", "attributes", "!==", "\"object\"", "||", "Array", ".", "isArray", "(", "attributes", ")", ")", "{", "throw", "new", "TypeError", "(", "\"definition of att...
Creates function coercing all attributes. @param {object<string,object>} attributes definition of essential attributes @returns {function()} concatenated implementation of all defined attributes' coercion handlers
[ "Creates", "function", "coercing", "all", "attributes", "." ]
28f3dc31cc3314f9109d2cac1f5f7e20dad6521b
https://github.com/hitchyjs/odem/blob/28f3dc31cc3314f9109d2cac1f5f7e20dad6521b/lib/model/compiler.js#L352-L391
train
hitchyjs/odem
lib/model/compiler.js
compileValidator
function compileValidator( attributes ) { if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) { throw new TypeError( "definition of attributes must be object" ); } const attributeNames = Object.keys( attributes ); const numAttributes = attributeNames.length; const validation = []...
javascript
function compileValidator( attributes ) { if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) { throw new TypeError( "definition of attributes must be object" ); } const attributeNames = Object.keys( attributes ); const numAttributes = attributeNames.length; const validation = []...
[ "function", "compileValidator", "(", "attributes", ")", "{", "if", "(", "!", "attributes", "||", "typeof", "attributes", "!==", "\"object\"", "||", "Array", ".", "isArray", "(", "attributes", ")", ")", "{", "throw", "new", "TypeError", "(", "\"definition of at...
Creates validator function assessing all defined attributes of a model. @param {object<string,object>} attributes definition of essential attributes @returns {function():Error[]} concatenated implementation of all defined attributes' validation handlers
[ "Creates", "validator", "function", "assessing", "all", "defined", "attributes", "of", "a", "model", "." ]
28f3dc31cc3314f9109d2cac1f5f7e20dad6521b
https://github.com/hitchyjs/odem/blob/28f3dc31cc3314f9109d2cac1f5f7e20dad6521b/lib/model/compiler.js#L399-L443
train
hitchyjs/odem
lib/model/compiler.js
compileDeserializer
function compileDeserializer( attributes ) { if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) { throw new TypeError( "definition of attributes must be object" ); } const attributeNames = Object.keys( attributes ); const numAttributes = attributeNames.length; const deserializat...
javascript
function compileDeserializer( attributes ) { if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) { throw new TypeError( "definition of attributes must be object" ); } const attributeNames = Object.keys( attributes ); const numAttributes = attributeNames.length; const deserializat...
[ "function", "compileDeserializer", "(", "attributes", ")", "{", "if", "(", "!", "attributes", "||", "typeof", "attributes", "!==", "\"object\"", "||", "Array", ".", "isArray", "(", "attributes", ")", ")", "{", "throw", "new", "TypeError", "(", "\"definition of...
Creates function de-serializing and coercing all attributes in a provided record. This method is creating function resulting from concatenating methods `deserialize()` and `coerce()` of every attribute's type handler. @param {object<string,object>} attributes definition of essential attributes @returns {function(obje...
[ "Creates", "function", "de", "-", "serializing", "and", "coercing", "all", "attributes", "in", "a", "provided", "record", "." ]
28f3dc31cc3314f9109d2cac1f5f7e20dad6521b
https://github.com/hitchyjs/odem/blob/28f3dc31cc3314f9109d2cac1f5f7e20dad6521b/lib/model/compiler.js#L503-L578
train
skerit/alchemy-styleboost
public/ckeditor/4.4dev/plugins/language/plugin.js
function( editor ) { var elementPath = editor.elementPath(), activePath = elementPath && elementPath.elements, pathMember, ret; // IE8: upon initialization if there is no path elementPath() returns null. if ( elementPath ) { for ( var i = 0; i < activePath.length; i++ ) { pathMember =...
javascript
function( editor ) { var elementPath = editor.elementPath(), activePath = elementPath && elementPath.elements, pathMember, ret; // IE8: upon initialization if there is no path elementPath() returns null. if ( elementPath ) { for ( var i = 0; i < activePath.length; i++ ) { pathMember =...
[ "function", "(", "editor", ")", "{", "var", "elementPath", "=", "editor", ".", "elementPath", "(", ")", ",", "activePath", "=", "elementPath", "&&", "elementPath", ".", "elements", ",", "pathMember", ",", "ret", ";", "// IE8: upon initialization if there is no pat...
Gets the first language element for the current editor selection. @param {CKEDITOR.editor} editor @returns {CKEDITOR.dom.element} The language element, if any.
[ "Gets", "the", "first", "language", "element", "for", "the", "current", "editor", "selection", "." ]
2b90b8a6afc9f065f785651292fb193940021d90
https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/language/plugin.js#L127-L143
train
palanik/restpress
index.js
function(actionName) { self[actionName] = function() { var args = arguments; self._stack.push({action : actionName, args : args}); return self; }; }
javascript
function(actionName) { self[actionName] = function() { var args = arguments; self._stack.push({action : actionName, args : args}); return self; }; }
[ "function", "(", "actionName", ")", "{", "self", "[", "actionName", "]", "=", "function", "(", ")", "{", "var", "args", "=", "arguments", ";", "self", ".", "_stack", ".", "push", "(", "{", "action", ":", "actionName", ",", "args", ":", "args", "}", ...
Kick the can down the road for app to pick it up later
[ "Kick", "the", "can", "down", "the", "road", "for", "app", "to", "pick", "it", "up", "later" ]
4c01cc95f36f383ce47a0f80f0c2129a5f4b055c
https://github.com/palanik/restpress/blob/4c01cc95f36f383ce47a0f80f0c2129a5f4b055c/index.js#L96-L102
train
palanik/restpress
index.js
function(actionName, action, resourcePath) { // prefix function to set rest values var identify = function(req, res, next) { res.set('XX-Powered-By', 'Restpress'); req.resource = self; req.actionName = actionName; req.action = action; next(); }; self[actionName] = function() { if (identify) {...
javascript
function(actionName, action, resourcePath) { // prefix function to set rest values var identify = function(req, res, next) { res.set('XX-Powered-By', 'Restpress'); req.resource = self; req.actionName = actionName; req.action = action; next(); }; self[actionName] = function() { if (identify) {...
[ "function", "(", "actionName", ",", "action", ",", "resourcePath", ")", "{", "// prefix function to set rest values", "var", "identify", "=", "function", "(", "req", ",", "res", ",", "next", ")", "{", "res", ".", "set", "(", "'XX-Powered-By'", ",", "'Restpress...
Re-Create methods working via app for known actions
[ "Re", "-", "Create", "methods", "working", "via", "app", "for", "known", "actions" ]
4c01cc95f36f383ce47a0f80f0c2129a5f4b055c
https://github.com/palanik/restpress/blob/4c01cc95f36f383ce47a0f80f0c2129a5f4b055c/index.js#L161-L196
train
palanik/restpress
index.js
function(req, res, next) { res.set('XX-Powered-By', 'Restpress'); req.resource = self; req.actionName = actionName; req.action = action; next(); }
javascript
function(req, res, next) { res.set('XX-Powered-By', 'Restpress'); req.resource = self; req.actionName = actionName; req.action = action; next(); }
[ "function", "(", "req", ",", "res", ",", "next", ")", "{", "res", ".", "set", "(", "'XX-Powered-By'", ",", "'Restpress'", ")", ";", "req", ".", "resource", "=", "self", ";", "req", ".", "actionName", "=", "actionName", ";", "req", ".", "action", "=",...
prefix function to set rest values
[ "prefix", "function", "to", "set", "rest", "values" ]
4c01cc95f36f383ce47a0f80f0c2129a5f4b055c
https://github.com/palanik/restpress/blob/4c01cc95f36f383ce47a0f80f0c2129a5f4b055c/index.js#L163-L169
train
christophercrouzet/pillr
lib/components/source.js
populateStack
function populateStack(stack, rootPath, files, callback) { stack.unshift(...files .filter(file => file.stats.isDirectory()) .map(file => path.join(rootPath, file.path))); async.nextTick(callback, null, files); }
javascript
function populateStack(stack, rootPath, files, callback) { stack.unshift(...files .filter(file => file.stats.isDirectory()) .map(file => path.join(rootPath, file.path))); async.nextTick(callback, null, files); }
[ "function", "populateStack", "(", "stack", ",", "rootPath", ",", "files", ",", "callback", ")", "{", "stack", ".", "unshift", "(", "...", "files", ".", "filter", "(", "file", "=>", "file", ".", "stats", ".", "isDirectory", "(", ")", ")", ".", "map", ...
Add subdirectories to the given stack.
[ "Add", "subdirectories", "to", "the", "given", "stack", "." ]
411ccd344a03478776c4e8d2e2f9bdc45dc8ee45
https://github.com/christophercrouzet/pillr/blob/411ccd344a03478776c4e8d2e2f9bdc45dc8ee45/lib/components/source.js#L11-L16
train
christophercrouzet/pillr
lib/components/source.js
processStackItem
function processStackItem(out, stack, rootPath, userFilter, readMode) { // Initialize a new file object. const initFile = (dirPath) => { return (fileName, callback) => { const filePath = path.join(dirPath, fileName); fs.stat(filePath, (error, stats) => { async.nextTick(callback, error, { ...
javascript
function processStackItem(out, stack, rootPath, userFilter, readMode) { // Initialize a new file object. const initFile = (dirPath) => { return (fileName, callback) => { const filePath = path.join(dirPath, fileName); fs.stat(filePath, (error, stats) => { async.nextTick(callback, error, { ...
[ "function", "processStackItem", "(", "out", ",", "stack", ",", "rootPath", ",", "userFilter", ",", "readMode", ")", "{", "// Initialize a new file object.", "const", "initFile", "=", "(", "dirPath", ")", "=>", "{", "return", "(", "fileName", ",", "callback", "...
Process a single stack item.
[ "Process", "a", "single", "stack", "item", "." ]
411ccd344a03478776c4e8d2e2f9bdc45dc8ee45
https://github.com/christophercrouzet/pillr/blob/411ccd344a03478776c4e8d2e2f9bdc45dc8ee45/lib/components/source.js#L20-L79
train
jkroso/string-tween
index.js
tween
function tween(a, b){ var string = [] var keys = [] var from = [] var to = [] var cursor = 0 var m while (m = number.exec(b)) { if (m.index > cursor) string.push(b.slice(cursor, m.index)) to.push(Number(m[0])) keys.push(string.length) string.push(null) cursor = number.lastIndex } if (cursor < b.leng...
javascript
function tween(a, b){ var string = [] var keys = [] var from = [] var to = [] var cursor = 0 var m while (m = number.exec(b)) { if (m.index > cursor) string.push(b.slice(cursor, m.index)) to.push(Number(m[0])) keys.push(string.length) string.push(null) cursor = number.lastIndex } if (cursor < b.leng...
[ "function", "tween", "(", "a", ",", "b", ")", "{", "var", "string", "=", "[", "]", "var", "keys", "=", "[", "]", "var", "from", "=", "[", "]", "var", "to", "=", "[", "]", "var", "cursor", "=", "0", "var", "m", "while", "(", "m", "=", "numbe...
create a tween generator from `a` to `b` @param {String} a @param {String} b @return {Function}
[ "create", "a", "tween", "generator", "from", "a", "to", "b" ]
8a74c87659f58ea4b6e152997e309bd7e57ed2a4
https://github.com/jkroso/string-tween/blob/8a74c87659f58ea4b6e152997e309bd7e57ed2a4/index.js#L19-L43
train
Biyaheroes/bh-mj-issue
dependency-mjml.support.js
safeEndingTags
function safeEndingTags(content) { var MJElements = [].concat(WHITELISTED_GLOBAL_TAG); (0, _forEach2.default)(_extends({}, _MJMLElementsCollection2.default, _MJMLHead2.default), function (element, name) { var tagName = element.tagName || name; MJElements.push(tagName); }); var safeContent = (0, _pars...
javascript
function safeEndingTags(content) { var MJElements = [].concat(WHITELISTED_GLOBAL_TAG); (0, _forEach2.default)(_extends({}, _MJMLElementsCollection2.default, _MJMLHead2.default), function (element, name) { var tagName = element.tagName || name; MJElements.push(tagName); }); var safeContent = (0, _pars...
[ "function", "safeEndingTags", "(", "content", ")", "{", "var", "MJElements", "=", "[", "]", ".", "concat", "(", "WHITELISTED_GLOBAL_TAG", ")", ";", "(", "0", ",", "_forEach2", ".", "default", ")", "(", "_extends", "(", "{", "}", ",", "_MJMLElementsCollecti...
Avoid htmlparser to parse ending tags
[ "Avoid", "htmlparser", "to", "parse", "ending", "tags" ]
878be949e0a142139e75f579bdaed2cb43511008
https://github.com/Biyaheroes/bh-mj-issue/blob/878be949e0a142139e75f579bdaed2cb43511008/dependency-mjml.support.js#L623-L639
train
Biyaheroes/bh-mj-issue
dependency-mjml.support.js
mjmlElementParser
function mjmlElementParser(elem, content) { if (!elem) { throw new _Error.NullElementError('Null element found in mjmlElementParser'); } var findLine = content.substr(0, elem.startIndex).match(/\n/g); var lineNumber = findLine ? findLine.length + 1 : 1; var tagName = elem.tagName.toLowerCase(); var att...
javascript
function mjmlElementParser(elem, content) { if (!elem) { throw new _Error.NullElementError('Null element found in mjmlElementParser'); } var findLine = content.substr(0, elem.startIndex).match(/\n/g); var lineNumber = findLine ? findLine.length + 1 : 1; var tagName = elem.tagName.toLowerCase(); var att...
[ "function", "mjmlElementParser", "(", "elem", ",", "content", ")", "{", "if", "(", "!", "elem", ")", "{", "throw", "new", "_Error", ".", "NullElementError", "(", "'Null element found in mjmlElementParser'", ")", ";", "}", "var", "findLine", "=", "content", "."...
converts MJML body into a JSON representation
[ "converts", "MJML", "body", "into", "a", "JSON", "representation" ]
878be949e0a142139e75f579bdaed2cb43511008
https://github.com/Biyaheroes/bh-mj-issue/blob/878be949e0a142139e75f579bdaed2cb43511008/dependency-mjml.support.js#L644-L671
train
ForbesLindesay-Unmaintained/sauce-test
lib/run-browser-stack.js
runSauceLabs
function runSauceLabs(location, remote, options) { var capabilities = options.capabilities; if (remote === 'browserstack') { var user = options.username || process.env.BROWSER_STACK_USERNAME; var key = options.accessKey || process.env.BROWSER_STACK_ACCESS_KEY; if (!user || !key) { return Promise.r...
javascript
function runSauceLabs(location, remote, options) { var capabilities = options.capabilities; if (remote === 'browserstack') { var user = options.username || process.env.BROWSER_STACK_USERNAME; var key = options.accessKey || process.env.BROWSER_STACK_ACCESS_KEY; if (!user || !key) { return Promise.r...
[ "function", "runSauceLabs", "(", "location", ",", "remote", ",", "options", ")", "{", "var", "capabilities", "=", "options", ".", "capabilities", ";", "if", "(", "remote", "===", "'browserstack'", ")", "{", "var", "user", "=", "options", ".", "username", "...
Run a test in a collection of browsers on sauce labs @option {String} username @option {String} accessKey @option {Function} filterPlatforms @option {Function} choosePlatforms @option {Number} parallel @option {PlatformsInput} platforms @option {Function} throttl...
[ "Run", "a", "test", "in", "a", "collection", "of", "browsers", "on", "sauce", "labs" ]
7c671b3321dc63aefc00c1c8d49e943ead2e7f5e
https://github.com/ForbesLindesay-Unmaintained/sauce-test/blob/7c671b3321dc63aefc00c1c8d49e943ead2e7f5e/lib/run-browser-stack.js#L41-L89
train
eventEmitter/ee-mysql
dep/node-buffalo/lib/mongo.js
writeHeader
function writeHeader(buffer, offset, size, opCode) { offset = binary.writeInt(buffer, offset, size) offset = binary.writeInt(buffer, offset, 0) offset = binary.writeInt(buffer, offset, 0) offset = binary.writeInt(buffer, offset, opCode) return offset }
javascript
function writeHeader(buffer, offset, size, opCode) { offset = binary.writeInt(buffer, offset, size) offset = binary.writeInt(buffer, offset, 0) offset = binary.writeInt(buffer, offset, 0) offset = binary.writeInt(buffer, offset, opCode) return offset }
[ "function", "writeHeader", "(", "buffer", ",", "offset", ",", "size", ",", "opCode", ")", "{", "offset", "=", "binary", ".", "writeInt", "(", "buffer", ",", "offset", ",", "size", ")", "offset", "=", "binary", ".", "writeInt", "(", "buffer", ",", "offs...
header int32 size int32 request id int32 0 int32 op code command
[ "header", "int32", "size", "int32", "request", "id", "int32", "0", "int32", "op", "code", "command" ]
9797bff09a21157fb1dddb68275b01f282a184af
https://github.com/eventEmitter/ee-mysql/blob/9797bff09a21157fb1dddb68275b01f282a184af/dep/node-buffalo/lib/mongo.js#L57-L63
train
leozdgao/lgutil
src/dom/position.js
function (elem, offsetParent) { var offset, parentOffset if (window.jQuery) { if (!offsetParent) { return window.jQuery(elem).position() } offset = window.jQuery(elem).offset() parentOffset = window.jQuery(offsetParent).offset() // Get element offset relative to offsetParent return ...
javascript
function (elem, offsetParent) { var offset, parentOffset if (window.jQuery) { if (!offsetParent) { return window.jQuery(elem).position() } offset = window.jQuery(elem).offset() parentOffset = window.jQuery(offsetParent).offset() // Get element offset relative to offsetParent return ...
[ "function", "(", "elem", ",", "offsetParent", ")", "{", "var", "offset", ",", "parentOffset", "if", "(", "window", ".", "jQuery", ")", "{", "if", "(", "!", "offsetParent", ")", "{", "return", "window", ".", "jQuery", "(", "elem", ")", ".", "position", ...
Get elements position @param {HTMLElement} elem @param {HTMLElement?} offsetParent @returns {{top: number, left: number}}
[ "Get", "elements", "position" ]
e9c71106fecb97fd8094f82663fe0a3aa13ae22b
https://github.com/leozdgao/lgutil/blob/e9c71106fecb97fd8094f82663fe0a3aa13ae22b/src/dom/position.js#L10-L57
train
Zhouzi/gulp-bucket
index.js
Definition
function Definition (factoryName, factory) { var configDefaults = {} var deps = [] return { /** * Calls the factory for each arguments and returns * the list of tasks that just got created. * * @params {Object} * @returns {Array} */ add: function add () { var configs =...
javascript
function Definition (factoryName, factory) { var configDefaults = {} var deps = [] return { /** * Calls the factory for each arguments and returns * the list of tasks that just got created. * * @params {Object} * @returns {Array} */ add: function add () { var configs =...
[ "function", "Definition", "(", "factoryName", ",", "factory", ")", "{", "var", "configDefaults", "=", "{", "}", "var", "deps", "=", "[", "]", "return", "{", "/**\n * Calls the factory for each arguments and returns\n * the list of tasks that just got created.\n *\...
Return a Definition object that's used to create tasks from a given factory. @param {String} factoryName @param {Function} factory @returns {{add: add, defaults: defaults}}
[ "Return", "a", "Definition", "object", "that", "s", "used", "to", "create", "tasks", "from", "a", "given", "factory", "." ]
b0e9a77607be62d993e473b72eaf5952562b9656
https://github.com/Zhouzi/gulp-bucket/blob/b0e9a77607be62d993e473b72eaf5952562b9656/index.js#L15-L85
train
Zhouzi/gulp-bucket
index.js
main
function main () { var taskList = _(arguments).toArray().flatten(true).value() gulp.task('default', taskList) return this }
javascript
function main () { var taskList = _(arguments).toArray().flatten(true).value() gulp.task('default', taskList) return this }
[ "function", "main", "(", ")", "{", "var", "taskList", "=", "_", "(", "arguments", ")", ".", "toArray", "(", ")", ".", "flatten", "(", "true", ")", ".", "value", "(", ")", "gulp", ".", "task", "(", "'default'", ",", "taskList", ")", "return", "this"...
Create gulp's default task that runs every tasks passed as arguments. @params array of strings @returns {bucket}
[ "Create", "gulp", "s", "default", "task", "that", "runs", "every", "tasks", "passed", "as", "arguments", "." ]
b0e9a77607be62d993e473b72eaf5952562b9656
https://github.com/Zhouzi/gulp-bucket/blob/b0e9a77607be62d993e473b72eaf5952562b9656/index.js#L112-L116
train
Zhouzi/gulp-bucket
index.js
tasks
function tasks (taskName) { var taskList = _.keys(gulp.tasks) if (taskName == null) { return taskList } return _.filter(taskList, function (task) { return _.startsWith(task, taskName) }) }
javascript
function tasks (taskName) { var taskList = _.keys(gulp.tasks) if (taskName == null) { return taskList } return _.filter(taskList, function (task) { return _.startsWith(task, taskName) }) }
[ "function", "tasks", "(", "taskName", ")", "{", "var", "taskList", "=", "_", ".", "keys", "(", "gulp", ".", "tasks", ")", "if", "(", "taskName", "==", "null", ")", "{", "return", "taskList", "}", "return", "_", ".", "filter", "(", "taskList", ",", ...
Returns every gulp tasks with a name that starts by taskName if provided, otherwise returns all existing tasks. @param {String} [taskName] @returns {Array}
[ "Returns", "every", "gulp", "tasks", "with", "a", "name", "that", "starts", "by", "taskName", "if", "provided", "otherwise", "returns", "all", "existing", "tasks", "." ]
b0e9a77607be62d993e473b72eaf5952562b9656
https://github.com/Zhouzi/gulp-bucket/blob/b0e9a77607be62d993e473b72eaf5952562b9656/index.js#L143-L153
train
PrinceNebulon/github-api-promise
src/repositories/releases.js
function() { var deferred = Q.defer(); try { request .get(getRepoUrl('releases')) .set('Authorization', 'token ' + config.token) .then(function(res) { logRequestSuccess(res); deferred.resolve(res.body); }, function(err) { logRequestError(err); deferred.reject(err.message...
javascript
function() { var deferred = Q.defer(); try { request .get(getRepoUrl('releases')) .set('Authorization', 'token ' + config.token) .then(function(res) { logRequestSuccess(res); deferred.resolve(res.body); }, function(err) { logRequestError(err); deferred.reject(err.message...
[ "function", "(", ")", "{", "var", "deferred", "=", "Q", ".", "defer", "(", ")", ";", "try", "{", "request", ".", "get", "(", "getRepoUrl", "(", "'releases'", ")", ")", ".", "set", "(", "'Authorization'", ",", "'token '", "+", "config", ".", "token", ...
This returns a list of releases, which does not include regular Git tags that have not been associated with a release. To get a list of Git tags, use the Repository Tags API. Information about published releases are available to everyone. Only users with push access will receive listings for draft releases. @return {JS...
[ "This", "returns", "a", "list", "of", "releases", "which", "does", "not", "include", "regular", "Git", "tags", "that", "have", "not", "been", "associated", "with", "a", "release", ".", "To", "get", "a", "list", "of", "Git", "tags", "use", "the", "Reposit...
990cb2cce19b53f54d9243002fde47428f24e7cc
https://github.com/PrinceNebulon/github-api-promise/blob/990cb2cce19b53f54d9243002fde47428f24e7cc/src/repositories/releases.js#L44-L65
train
skerit/alchemy-styleboost
public/ckeditor/4.4dev/core/dom/elementpath.js
function( query, excludeRoot, fromTop ) { var evaluator; if ( typeof query == 'string' ) evaluator = function( node ) { return node.getName() == query; }; if ( query instanceof CKEDITOR.dom.element ) evaluator = function( node ) { return node.equals( query ); }; else if ( CKEDITOR.tools.isAr...
javascript
function( query, excludeRoot, fromTop ) { var evaluator; if ( typeof query == 'string' ) evaluator = function( node ) { return node.getName() == query; }; if ( query instanceof CKEDITOR.dom.element ) evaluator = function( node ) { return node.equals( query ); }; else if ( CKEDITOR.tools.isAr...
[ "function", "(", "query", ",", "excludeRoot", ",", "fromTop", ")", "{", "var", "evaluator", ";", "if", "(", "typeof", "query", "==", "'string'", ")", "evaluator", "=", "function", "(", "node", ")", "{", "return", "node", ".", "getName", "(", ")", "==",...
Search the path elements that meets the specified criteria. @param {String/Array/Function/Object/CKEDITOR.dom.element} query The criteria that can be either a tag name, list (array and object) of tag names, element or an node evaluator function. @param {Boolean} [excludeRoot] Not taking path root element into consider...
[ "Search", "the", "path", "elements", "that", "meets", "the", "specified", "criteria", "." ]
2b90b8a6afc9f065f785651292fb193940021d90
https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/elementpath.js#L183-L219
train
skerit/alchemy-styleboost
public/ckeditor/4.4dev/core/dom/elementpath.js
function( tag ) { var holder; // Check for block context. if ( tag in CKEDITOR.dtd.$block ) { // Indeterminate elements which are not subjected to be splitted or surrounded must be checked first. var inter = this.contains( CKEDITOR.dtd.$intermediate ); holder = inter || ( this.root.equals( this.block ) ...
javascript
function( tag ) { var holder; // Check for block context. if ( tag in CKEDITOR.dtd.$block ) { // Indeterminate elements which are not subjected to be splitted or surrounded must be checked first. var inter = this.contains( CKEDITOR.dtd.$intermediate ); holder = inter || ( this.root.equals( this.block ) ...
[ "function", "(", "tag", ")", "{", "var", "holder", ";", "// Check for block context.", "if", "(", "tag", "in", "CKEDITOR", ".", "dtd", ".", "$block", ")", "{", "// Indeterminate elements which are not subjected to be splitted or surrounded must be checked first.", "var", ...
Check whether the elements path is the proper context for the specified tag name in the DTD. @param {String} tag The tag name. @returns {Boolean}
[ "Check", "whether", "the", "elements", "path", "is", "the", "proper", "context", "for", "the", "specified", "tag", "name", "in", "the", "DTD", "." ]
2b90b8a6afc9f065f785651292fb193940021d90
https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/elementpath.js#L228-L240
train
doowb/session-cache
index.js
isActive
function isActive() { try { var key = '___session is active___'; return session.get(key) || session.set(key, true); } catch (err) { return false; } }
javascript
function isActive() { try { var key = '___session is active___'; return session.get(key) || session.set(key, true); } catch (err) { return false; } }
[ "function", "isActive", "(", ")", "{", "try", "{", "var", "key", "=", "'___session is active___'", ";", "return", "session", ".", "get", "(", "key", ")", "||", "session", ".", "set", "(", "key", ",", "true", ")", ";", "}", "catch", "(", "err", ")", ...
Set a heuristic for determining if the session is actually active. @return {Boolean} Returns `true` if session is active @api private
[ "Set", "a", "heuristic", "for", "determining", "if", "the", "session", "is", "actually", "active", "." ]
5f8c686a8f93c30c4e703158814a625f4b4a9dbf
https://github.com/doowb/session-cache/blob/5f8c686a8f93c30c4e703158814a625f4b4a9dbf/index.js#L50-L57
train
skerit/alchemy-debugbar
assets/scripts/debugbar/core.js
function (event) { event.preventDefault(); if (!currentElement) { return; } var newHeight = currentElement.data('startHeight') + (event.pageY - currentElement.data('startY')); currentElement.parent().height(newHeight); }
javascript
function (event) { event.preventDefault(); if (!currentElement) { return; } var newHeight = currentElement.data('startHeight') + (event.pageY - currentElement.data('startY')); currentElement.parent().height(newHeight); }
[ "function", "(", "event", ")", "{", "event", ".", "preventDefault", "(", ")", ";", "if", "(", "!", "currentElement", ")", "{", "return", ";", "}", "var", "newHeight", "=", "currentElement", ".", "data", "(", "'startHeight'", ")", "+", "(", "event", "."...
Use the elements startHeight stored Event.pageY and current Event.pageY to resize the panel.
[ "Use", "the", "elements", "startHeight", "stored", "Event", ".", "pageY", "and", "current", "Event", ".", "pageY", "to", "resize", "the", "panel", "." ]
af0e34906646f43b0fe915c9a9a11e3f7bc27a87
https://github.com/skerit/alchemy-debugbar/blob/af0e34906646f43b0fe915c9a9a11e3f7bc27a87/assets/scripts/debugbar/core.js#L304-L311
train
isuttell/throttled
middleware.js
assign
function assign() { var result = {}; var args = Array.prototype.slice.call(arguments); for(var i = 0; i < args.length; i++) { var obj = args[i]; if(typeof obj !== 'object') { continue; } for(var key in obj) { if(obj.hasOwnProperty(key)) { result[key] = obj[key]; } } ...
javascript
function assign() { var result = {}; var args = Array.prototype.slice.call(arguments); for(var i = 0; i < args.length; i++) { var obj = args[i]; if(typeof obj !== 'object') { continue; } for(var key in obj) { if(obj.hasOwnProperty(key)) { result[key] = obj[key]; } } ...
[ "function", "assign", "(", ")", "{", "var", "result", "=", "{", "}", ";", "var", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "args", ".", "lengt...
Merge multiple obects together @param {Object...} @return {Object}
[ "Merge", "multiple", "obects", "together" ]
80634416f0c487bebe64133b0064f29834bcc16a
https://github.com/isuttell/throttled/blob/80634416f0c487bebe64133b0064f29834bcc16a/middleware.js#L41-L57
train
isuttell/throttled
middleware.js
function(err, results) { if(options.headers) { // Set some headers so we can track what's going on var headers = { 'X-Throttled': results.throttled, 'X-Throttle-Remaining': Math.max(options.limit - results.count, 0) }; if (results.expiresAt) { ...
javascript
function(err, results) { if(options.headers) { // Set some headers so we can track what's going on var headers = { 'X-Throttled': results.throttled, 'X-Throttle-Remaining': Math.max(options.limit - results.count, 0) }; if (results.expiresAt) { ...
[ "function", "(", "err", ",", "results", ")", "{", "if", "(", "options", ".", "headers", ")", "{", "// Set some headers so we can track what's going on", "var", "headers", "=", "{", "'X-Throttled'", ":", "results", ".", "throttled", ",", "'X-Throttle-Remaining'", "...
Now do something with all of this information @param {Error} err @param {Object} results
[ "Now", "do", "something", "with", "all", "of", "this", "information" ]
80634416f0c487bebe64133b0064f29834bcc16a
https://github.com/isuttell/throttled/blob/80634416f0c487bebe64133b0064f29834bcc16a/middleware.js#L186-L230
train
Qwerios/madlib-settings
lib/settings.js
function(key, data) { var currentData; currentData = settings[key]; if ((currentData != null) && _.isObject(currentData)) { settings[key] = _.extend(data, settings[key]); } else if (currentData == null) { settings[key] = data; } }
javascript
function(key, data) { var currentData; currentData = settings[key]; if ((currentData != null) && _.isObject(currentData)) { settings[key] = _.extend(data, settings[key]); } else if (currentData == null) { settings[key] = data; } }
[ "function", "(", "key", ",", "data", ")", "{", "var", "currentData", ";", "currentData", "=", "settings", "[", "key", "]", ";", "if", "(", "(", "currentData", "!=", "null", ")", "&&", "_", ".", "isObject", "(", "currentData", ")", ")", "{", "settings...
Used to initially set a setttings value. Convenient for settings defaults that wont overwrite already set actual values @function init @param {String} key The setting name @param {Mixed} data The setting value @return None
[ "Used", "to", "initially", "set", "a", "setttings", "value", ".", "Convenient", "for", "settings", "defaults", "that", "wont", "overwrite", "already", "set", "actual", "values" ]
078283c18d07e42a5f19a7fa4fcca92f59ee4c29
https://github.com/Qwerios/madlib-settings/blob/078283c18d07e42a5f19a7fa4fcca92f59ee4c29/lib/settings.js#L32-L40
train
Qwerios/madlib-settings
lib/settings.js
function(key, data) { var currentData; currentData = settings[key] || {}; settings[key] = _.extend(currentData, data); }
javascript
function(key, data) { var currentData; currentData = settings[key] || {}; settings[key] = _.extend(currentData, data); }
[ "function", "(", "key", ",", "data", ")", "{", "var", "currentData", ";", "currentData", "=", "settings", "[", "key", "]", "||", "{", "}", ";", "settings", "[", "key", "]", "=", "_", ".", "extend", "(", "currentData", ",", "data", ")", ";", "}" ]
Merge a setting using underscore's extend. Only useful if the setting is an object @function merge @param {String} key The setting name @param {Mixed} data The setting value @return None
[ "Merge", "a", "setting", "using", "underscore", "s", "extend", ".", "Only", "useful", "if", "the", "setting", "is", "an", "object" ]
078283c18d07e42a5f19a7fa4fcca92f59ee4c29
https://github.com/Qwerios/madlib-settings/blob/078283c18d07e42a5f19a7fa4fcca92f59ee4c29/lib/settings.js#L108-L112
train
crobinson42/error-shelter
errorShelter.js
function (err) { var storage = getStorage(); if (storage && storage.errors) { storage.errors.push(err); return localStorage.setItem([config.nameSpace], JSON.stringify(storage)); } }
javascript
function (err) { var storage = getStorage(); if (storage && storage.errors) { storage.errors.push(err); return localStorage.setItem([config.nameSpace], JSON.stringify(storage)); } }
[ "function", "(", "err", ")", "{", "var", "storage", "=", "getStorage", "(", ")", ";", "if", "(", "storage", "&&", "storage", ".", "errors", ")", "{", "storage", ".", "errors", ".", "push", "(", "err", ")", ";", "return", "localStorage", ".", "setItem...
JSON.stringify the object and put back in localStorage
[ "JSON", ".", "stringify", "the", "object", "and", "put", "back", "in", "localStorage" ]
dcdda9b3a802c53baa957bd15a3f657c3ef222d8
https://github.com/crobinson42/error-shelter/blob/dcdda9b3a802c53baa957bd15a3f657c3ef222d8/errorShelter.js#L52-L58
train
AndreasMadsen/piccolo
lib/build/dependencies.js
searchArray
function searchArray(list, value) { var index = list.indexOf(value); if (index === -1) return false; return value; }
javascript
function searchArray(list, value) { var index = list.indexOf(value); if (index === -1) return false; return value; }
[ "function", "searchArray", "(", "list", ",", "value", ")", "{", "var", "index", "=", "list", ".", "indexOf", "(", "value", ")", ";", "if", "(", "index", "===", "-", "1", ")", "return", "false", ";", "return", "value", ";", "}" ]
search array and return the search argument or false if not found
[ "search", "array", "and", "return", "the", "search", "argument", "or", "false", "if", "not", "found" ]
ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d
https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/build/dependencies.js#L117-L122
train
AndreasMadsen/piccolo
lib/build/dependencies.js
searchBase
function searchBase(base) { var basename = path.resolve(base, modulename); // return no path var filename = searchArray(dirMap, basename); if (filename) return filename; // return .js path filename = searchArray(dirMap, basename + '.js'); if (filename) return filename; // return .json...
javascript
function searchBase(base) { var basename = path.resolve(base, modulename); // return no path var filename = searchArray(dirMap, basename); if (filename) return filename; // return .js path filename = searchArray(dirMap, basename + '.js'); if (filename) return filename; // return .json...
[ "function", "searchBase", "(", "base", ")", "{", "var", "basename", "=", "path", ".", "resolve", "(", "base", ",", "modulename", ")", ";", "// return no path", "var", "filename", "=", "searchArray", "(", "dirMap", ",", "basename", ")", ";", "if", "(", "f...
search each query
[ "search", "each", "query" ]
ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d
https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/build/dependencies.js#L163-L187
train
AndreasMadsen/piccolo
lib/build/dependencies.js
buildPackage
function buildPackage(callback) { var dirMap = self.build.dirMap, i = dirMap.length, filepath, pkgName = '/package.json', pkgLength = pkgName.length, list = []; // search dirmap for package.json while(i--) { filepath = dirMap[i]; if (filepath.slice(filep...
javascript
function buildPackage(callback) { var dirMap = self.build.dirMap, i = dirMap.length, filepath, pkgName = '/package.json', pkgLength = pkgName.length, list = []; // search dirmap for package.json while(i--) { filepath = dirMap[i]; if (filepath.slice(filep...
[ "function", "buildPackage", "(", "callback", ")", "{", "var", "dirMap", "=", "self", ".", "build", ".", "dirMap", ",", "i", "=", "dirMap", ".", "length", ",", "filepath", ",", "pkgName", "=", "'/package.json'", ",", "pkgLength", "=", "pkgName", ".", "len...
scan and resolve all packages
[ "scan", "and", "resolve", "all", "packages" ]
ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d
https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/build/dependencies.js#L235-L306
train
AndreasMadsen/piccolo
lib/build/dependencies.js
buildMap
function buildMap() { var dependencies = self.build.dependencies = {}; var cacheTime = self.cache.stats; var buildTime = self.build.mtime; Object.keys(cacheTime).forEach(function (filepath) { buildTime[filepath] = cacheTime[filepath].getTime(); }); // deep resolve all dependencies se...
javascript
function buildMap() { var dependencies = self.build.dependencies = {}; var cacheTime = self.cache.stats; var buildTime = self.build.mtime; Object.keys(cacheTime).forEach(function (filepath) { buildTime[filepath] = cacheTime[filepath].getTime(); }); // deep resolve all dependencies se...
[ "function", "buildMap", "(", ")", "{", "var", "dependencies", "=", "self", ".", "build", ".", "dependencies", "=", "{", "}", ";", "var", "cacheTime", "=", "self", ".", "cache", ".", "stats", ";", "var", "buildTime", "=", "self", ".", "build", ".", "m...
rebuild dependency tree
[ "rebuild", "dependency", "tree" ]
ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d
https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/build/dependencies.js#L309-L334
train
mgesmundo/authorify-client
lib/class/Handshake.js
function() { var cert = this.keychain.getCertPem(); if (!cert) { throw new CError('missing certificate').log(); } var tmp = this.getDate() + '::' + cert + '::' + SECRET_CLIENT; var hmac = forge.hmac.create(); hmac.start('sha256', SECRET); hmac.update(tmp); return ...
javascript
function() { var cert = this.keychain.getCertPem(); if (!cert) { throw new CError('missing certificate').log(); } var tmp = this.getDate() + '::' + cert + '::' + SECRET_CLIENT; var hmac = forge.hmac.create(); hmac.start('sha256', SECRET); hmac.update(tmp); return ...
[ "function", "(", ")", "{", "var", "cert", "=", "this", ".", "keychain", ".", "getCertPem", "(", ")", ";", "if", "(", "!", "cert", ")", "{", "throw", "new", "CError", "(", "'missing certificate'", ")", ".", "log", "(", ")", ";", "}", "var", "tmp", ...
Generate a valid token @returns {String} The token
[ "Generate", "a", "valid", "token" ]
39fb57db897eaa49b76444ff62bbc0ccedc7ee16
https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/lib/class/Handshake.js#L60-L70
train
mgesmundo/authorify-client
lib/class/Handshake.js
function() { if (this.getMode() !== mode) { throw new CError('unexpected mode').log(); } var cert; try { cert = this.keychain.getCertPem(); } catch (e) { throw new CError({ body: { code: 'ImATeapot', message: 'missing certificate', ...
javascript
function() { if (this.getMode() !== mode) { throw new CError('unexpected mode').log(); } var cert; try { cert = this.keychain.getCertPem(); } catch (e) { throw new CError({ body: { code: 'ImATeapot', message: 'missing certificate', ...
[ "function", "(", ")", "{", "if", "(", "this", ".", "getMode", "(", ")", "!==", "mode", ")", "{", "throw", "new", "CError", "(", "'unexpected mode'", ")", ".", "log", "(", ")", ";", "}", "var", "cert", ";", "try", "{", "cert", "=", "this", ".", ...
Get the payload property of the header @return {Object} The payload property of the header
[ "Get", "the", "payload", "property", "of", "the", "header" ]
39fb57db897eaa49b76444ff62bbc0ccedc7ee16
https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/lib/class/Handshake.js#L76-L103
train
skerit/alchemy-styleboost
public/ckeditor/4.4dev/core/htmldataprocessor.js
blockFilter
function blockFilter( isOutput, fillEmptyBlock ) { return function( block ) { // DO NOT apply the filler if it's a fragment node. if ( block.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT ) return; cleanBogus( block ); var shouldFillBlock = typeof fillEmptyBlock == 'function' ? fillEmptyBlock( block...
javascript
function blockFilter( isOutput, fillEmptyBlock ) { return function( block ) { // DO NOT apply the filler if it's a fragment node. if ( block.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT ) return; cleanBogus( block ); var shouldFillBlock = typeof fillEmptyBlock == 'function' ? fillEmptyBlock( block...
[ "function", "blockFilter", "(", "isOutput", ",", "fillEmptyBlock", ")", "{", "return", "function", "(", "block", ")", "{", "// DO NOT apply the filler if it's a fragment node.", "if", "(", "block", ".", "type", "==", "CKEDITOR", ".", "NODE_DOCUMENT_FRAGMENT", ")", "...
This text block filter, remove any bogus and create the filler on demand.
[ "This", "text", "block", "filter", "remove", "any", "bogus", "and", "create", "the", "filler", "on", "demand", "." ]
2b90b8a6afc9f065f785651292fb193940021d90
https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/htmldataprocessor.js#L308-L323
train
skerit/alchemy-styleboost
public/ckeditor/4.4dev/core/htmldataprocessor.js
brFilter
function brFilter( isOutput ) { return function( br ) { // DO NOT apply the filer if parent's a fragment node. if ( br.parent.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT ) return; var attrs = br.attributes; // Dismiss BRs that are either bogus or eol marker. if ( 'data-cke-bogus' in attrs || 'd...
javascript
function brFilter( isOutput ) { return function( br ) { // DO NOT apply the filer if parent's a fragment node. if ( br.parent.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT ) return; var attrs = br.attributes; // Dismiss BRs that are either bogus or eol marker. if ( 'data-cke-bogus' in attrs || 'd...
[ "function", "brFilter", "(", "isOutput", ")", "{", "return", "function", "(", "br", ")", "{", "// DO NOT apply the filer if parent's a fragment node.", "if", "(", "br", ".", "parent", ".", "type", "==", "CKEDITOR", ".", "NODE_DOCUMENT_FRAGMENT", ")", "return", ";"...
Append a filler right after the last line-break BR, found at the end of block.
[ "Append", "a", "filler", "right", "after", "the", "last", "line", "-", "break", "BR", "found", "at", "the", "end", "of", "block", "." ]
2b90b8a6afc9f065f785651292fb193940021d90
https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/htmldataprocessor.js#L326-L347
train
skerit/alchemy-styleboost
public/ckeditor/4.4dev/core/htmldataprocessor.js
maybeBogus
function maybeBogus( node, atBlockEnd ) { // BR that's not from IE<11 DOM, except for a EOL marker. if ( !( isOutput && !CKEDITOR.env.needsBrFiller ) && node.type == CKEDITOR.NODE_ELEMENT && node.name == 'br' && !node.attributes[ 'data-cke-eol' ] ) { return true; } var match; // NBSP, po...
javascript
function maybeBogus( node, atBlockEnd ) { // BR that's not from IE<11 DOM, except for a EOL marker. if ( !( isOutput && !CKEDITOR.env.needsBrFiller ) && node.type == CKEDITOR.NODE_ELEMENT && node.name == 'br' && !node.attributes[ 'data-cke-eol' ] ) { return true; } var match; // NBSP, po...
[ "function", "maybeBogus", "(", "node", ",", "atBlockEnd", ")", "{", "// BR that's not from IE<11 DOM, except for a EOL marker.", "if", "(", "!", "(", "isOutput", "&&", "!", "CKEDITOR", ".", "env", ".", "needsBrFiller", ")", "&&", "node", ".", "type", "==", "CKED...
Determinate whether this node is potentially a bogus node.
[ "Determinate", "whether", "this", "node", "is", "potentially", "a", "bogus", "node", "." ]
2b90b8a6afc9f065f785651292fb193940021d90
https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/htmldataprocessor.js#L350-L388
train
skerit/alchemy-styleboost
public/ckeditor/4.4dev/core/htmldataprocessor.js
cleanBogus
function cleanBogus( block ) { var bogus = []; var last = getLast( block ), node, previous; if ( last ) { // Check for bogus at the end of this block. // e.g. <p>foo<br /></p> maybeBogus( last, 1 ) && bogus.push( last ); while ( last ) { // Check for bogus at the end of any pseudo block ...
javascript
function cleanBogus( block ) { var bogus = []; var last = getLast( block ), node, previous; if ( last ) { // Check for bogus at the end of this block. // e.g. <p>foo<br /></p> maybeBogus( last, 1 ) && bogus.push( last ); while ( last ) { // Check for bogus at the end of any pseudo block ...
[ "function", "cleanBogus", "(", "block", ")", "{", "var", "bogus", "=", "[", "]", ";", "var", "last", "=", "getLast", "(", "block", ")", ",", "node", ",", "previous", ";", "if", "(", "last", ")", "{", "// Check for bogus at the end of this block.", "// e.g....
Removes all bogus inside of this block, and to convert fillers into the proper form.
[ "Removes", "all", "bogus", "inside", "of", "this", "block", "and", "to", "convert", "fillers", "into", "the", "proper", "form", "." ]
2b90b8a6afc9f065f785651292fb193940021d90
https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/htmldataprocessor.js#L391-L421
train
skerit/alchemy-styleboost
public/ckeditor/4.4dev/core/htmldataprocessor.js
isEmptyBlockNeedFiller
function isEmptyBlockNeedFiller( block ) { // DO NOT fill empty editable in IE<11. if ( !isOutput && !CKEDITOR.env.needsBrFiller && block.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT ) return false; // 1. For IE version >=8, empty blocks are displayed correctly themself in wysiwiyg; // 2. For the rest, at...
javascript
function isEmptyBlockNeedFiller( block ) { // DO NOT fill empty editable in IE<11. if ( !isOutput && !CKEDITOR.env.needsBrFiller && block.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT ) return false; // 1. For IE version >=8, empty blocks are displayed correctly themself in wysiwiyg; // 2. For the rest, at...
[ "function", "isEmptyBlockNeedFiller", "(", "block", ")", "{", "// DO NOT fill empty editable in IE<11.", "if", "(", "!", "isOutput", "&&", "!", "CKEDITOR", ".", "env", ".", "needsBrFiller", "&&", "block", ".", "type", "==", "CKEDITOR", ".", "NODE_DOCUMENT_FRAGMENT",...
Judge whether it's an empty block that requires a filler node.
[ "Judge", "whether", "it", "s", "an", "empty", "block", "that", "requires", "a", "filler", "node", "." ]
2b90b8a6afc9f065f785651292fb193940021d90
https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/htmldataprocessor.js#L424-L441
train
skerit/alchemy-styleboost
public/ckeditor/4.4dev/core/htmldataprocessor.js
isEmpty
function isEmpty( node ) { return node.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.trim( node.value ) || node.type == CKEDITOR.NODE_ELEMENT && node.attributes[ 'data-cke-bookmark' ]; }
javascript
function isEmpty( node ) { return node.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.trim( node.value ) || node.type == CKEDITOR.NODE_ELEMENT && node.attributes[ 'data-cke-bookmark' ]; }
[ "function", "isEmpty", "(", "node", ")", "{", "return", "node", ".", "type", "==", "CKEDITOR", ".", "NODE_TEXT", "&&", "!", "CKEDITOR", ".", "tools", ".", "trim", "(", "node", ".", "value", ")", "||", "node", ".", "type", "==", "CKEDITOR", ".", "NODE...
Judge whether the node is an ghost node to be ignored, when traversing.
[ "Judge", "whether", "the", "node", "is", "an", "ghost", "node", "to", "be", "ignored", "when", "traversing", "." ]
2b90b8a6afc9f065f785651292fb193940021d90
https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/htmldataprocessor.js#L494-L499
train
skerit/alchemy-styleboost
public/ckeditor/4.4dev/core/htmldataprocessor.js
isBlockBoundary
function isBlockBoundary( node ) { return node && ( node.type == CKEDITOR.NODE_ELEMENT && node.name in blockLikeTags || node.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT ); }
javascript
function isBlockBoundary( node ) { return node && ( node.type == CKEDITOR.NODE_ELEMENT && node.name in blockLikeTags || node.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT ); }
[ "function", "isBlockBoundary", "(", "node", ")", "{", "return", "node", "&&", "(", "node", ".", "type", "==", "CKEDITOR", ".", "NODE_ELEMENT", "&&", "node", ".", "name", "in", "blockLikeTags", "||", "node", ".", "type", "==", "CKEDITOR", ".", "NODE_DOCUMEN...
Judge whether the node is a block-like element.
[ "Judge", "whether", "the", "node", "is", "a", "block", "-", "like", "element", "." ]
2b90b8a6afc9f065f785651292fb193940021d90
https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/htmldataprocessor.js#L502-L506
train
stefanmintert/ep_xmlexport
PadProcessor.js
function(regex, text){ var nextIndex = 0; var result = []; var execResult; while ((execResult = regex.exec(text))!== null) { result.push({ start: execResult.index, matchLength: execResult[0].length}); } return { next: function(){ return next...
javascript
function(regex, text){ var nextIndex = 0; var result = []; var execResult; while ((execResult = regex.exec(text))!== null) { result.push({ start: execResult.index, matchLength: execResult[0].length}); } return { next: function(){ return next...
[ "function", "(", "regex", ",", "text", ")", "{", "var", "nextIndex", "=", "0", ";", "var", "result", "=", "[", "]", ";", "var", "execResult", ";", "while", "(", "(", "execResult", "=", "regex", ".", "exec", "(", "text", ")", ")", "!==", "null", "...
this is a convenience regex matcher that iterates through the matches and returns each start index and length @param {RegExp} regex @param {String} text
[ "this", "is", "a", "convenience", "regex", "matcher", "that", "iterates", "through", "the", "matches", "and", "returns", "each", "start", "index", "and", "length" ]
c46a742b66bc048453ebe26c7b3fbd710ae8f7c4
https://github.com/stefanmintert/ep_xmlexport/blob/c46a742b66bc048453ebe26c7b3fbd710ae8f7c4/PadProcessor.js#L31-L49
train
TyphosLabs/api-gateway-errors
index.js
lambdaError
function lambdaError(fn, settings){ var log = (settings && settings.log === false ? false : true); var map = (settings && settings.map ? settings.map : undefined); var exclude = (settings && settings.exclude ? settings.exclude : undefined); return (event, context, callback) => { fn(event, c...
javascript
function lambdaError(fn, settings){ var log = (settings && settings.log === false ? false : true); var map = (settings && settings.map ? settings.map : undefined); var exclude = (settings && settings.exclude ? settings.exclude : undefined); return (event, context, callback) => { fn(event, c...
[ "function", "lambdaError", "(", "fn", ",", "settings", ")", "{", "var", "log", "=", "(", "settings", "&&", "settings", ".", "log", "===", "false", "?", "false", ":", "true", ")", ";", "var", "map", "=", "(", "settings", "&&", "settings", ".", "map", ...
Wrap all API Gateway lambda handlers with this function. @param {Function} fn - AWS lambda handler function to wrap. @param {Object} setting - @param {boolean} setting.log - Whether or not to log errors to console. @returns {Function}
[ "Wrap", "all", "API", "Gateway", "lambda", "handlers", "with", "this", "function", "." ]
82bf92c7e7402d4f4e311ad47cc7652efdf863b7
https://github.com/TyphosLabs/api-gateway-errors/blob/82bf92c7e7402d4f4e311ad47cc7652efdf863b7/index.js#L24-L47
train
ugate/pulses
lib/platelets.js
asyncd
function asyncd(pw, evts, fname, args) { var es = Array.isArray(evts) ? evts : [evts]; for (var i = 0; i < es.length; i++) { if (es[i]) { defer(asyncCb.bind(es[i])); } } function asyncCb() { var argsp = args && args.length ? [this] : null; if (argsp) { ...
javascript
function asyncd(pw, evts, fname, args) { var es = Array.isArray(evts) ? evts : [evts]; for (var i = 0; i < es.length; i++) { if (es[i]) { defer(asyncCb.bind(es[i])); } } function asyncCb() { var argsp = args && args.length ? [this] : null; if (argsp) { ...
[ "function", "asyncd", "(", "pw", ",", "evts", ",", "fname", ",", "args", ")", "{", "var", "es", "=", "Array", ".", "isArray", "(", "evts", ")", "?", "evts", ":", "[", "evts", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "es", ...
Executes one or more events an asynchronously @arg {PulseEmitter} pw the pulse emitter @arg {(String | Array)} evts the event or array of events @arg {String} fname the function name to execute on the pulse emitter @arg {*[]} args the arguments to pass into the pulse emitter function @returns {PulseEmitter} the pulse ...
[ "Executes", "one", "or", "more", "events", "an", "asynchronously" ]
214b186e1b72bed9c99c0a7903c70de4eca3c259
https://github.com/ugate/pulses/blob/214b186e1b72bed9c99c0a7903c70de4eca3c259/lib/platelets.js#L25-L40
train
ugate/pulses
lib/platelets.js
defer
function defer(cb) { if (!defer.nextLoop) { var ntv = typeof setImmediate === 'function'; defer.nextLoop = ntv ? setImmediate : function setImmediateShim(cb) { if (defer.obj) { if (!defer.cbs.length) { defer.obj.setAttribute('cnt', 'inc'); ...
javascript
function defer(cb) { if (!defer.nextLoop) { var ntv = typeof setImmediate === 'function'; defer.nextLoop = ntv ? setImmediate : function setImmediateShim(cb) { if (defer.obj) { if (!defer.cbs.length) { defer.obj.setAttribute('cnt', 'inc'); ...
[ "function", "defer", "(", "cb", ")", "{", "if", "(", "!", "defer", ".", "nextLoop", ")", "{", "var", "ntv", "=", "typeof", "setImmediate", "===", "'function'", ";", "defer", ".", "nextLoop", "=", "ntv", "?", "setImmediate", ":", "function", "setImmediate...
Defers a function's execution to the next iteration in the event loop @arg {function} cb the callback function @returns {Object} the callback's return value
[ "Defers", "a", "function", "s", "execution", "to", "the", "next", "iteration", "in", "the", "event", "loop" ]
214b186e1b72bed9c99c0a7903c70de4eca3c259
https://github.com/ugate/pulses/blob/214b186e1b72bed9c99c0a7903c70de4eca3c259/lib/platelets.js#L48-L72
train
ugate/pulses
lib/platelets.js
merge
function merge(dest, src, ctyp, nou, non) { if (!src || typeof src !== 'object') return dest; var keys = Object.keys(src); var i = keys.length, dt; while (i--) { if (isNaN(keys[i]) && src.hasOwnProperty(keys[i]) && (!nou || (nou && typeof src[keys[i]] !== 'undefined')) && ...
javascript
function merge(dest, src, ctyp, nou, non) { if (!src || typeof src !== 'object') return dest; var keys = Object.keys(src); var i = keys.length, dt; while (i--) { if (isNaN(keys[i]) && src.hasOwnProperty(keys[i]) && (!nou || (nou && typeof src[keys[i]] !== 'undefined')) && ...
[ "function", "merge", "(", "dest", ",", "src", ",", "ctyp", ",", "nou", ",", "non", ")", "{", "if", "(", "!", "src", "||", "typeof", "src", "!==", "'object'", ")", "return", "dest", ";", "var", "keys", "=", "Object", ".", "keys", "(", "src", ")", ...
Merges an object with the properties of another object @arg {Object} dest the destination object where the properties will be added @arg {Object} src the source object that will be used for adding new properties to the destination @arg {Boolean} ctyp flag that ensures that source values are constrained to the same typ...
[ "Merges", "an", "object", "with", "the", "properties", "of", "another", "object" ]
214b186e1b72bed9c99c0a7903c70de4eca3c259
https://github.com/ugate/pulses/blob/214b186e1b72bed9c99c0a7903c70de4eca3c259/lib/platelets.js#L113-L128
train
ugate/pulses
lib/platelets.js
props
function props(dest, pds, src, isrc, ndflt, nm, nmsrc) { var asrt = nm && src; if (asrt) assert.ok(dest, 'no ' + nm); var i = pds.length; while (i--) { if (asrt) prop(dest, pds[i], src, isrc, ndflt, nm, nmsrc); else prop(dest, pds[i], src, isrc, ndflt); } return dest; }
javascript
function props(dest, pds, src, isrc, ndflt, nm, nmsrc) { var asrt = nm && src; if (asrt) assert.ok(dest, 'no ' + nm); var i = pds.length; while (i--) { if (asrt) prop(dest, pds[i], src, isrc, ndflt, nm, nmsrc); else prop(dest, pds[i], src, isrc, ndflt); } return dest; }
[ "function", "props", "(", "dest", ",", "pds", ",", "src", ",", "isrc", ",", "ndflt", ",", "nm", ",", "nmsrc", ")", "{", "var", "asrt", "=", "nm", "&&", "src", ";", "if", "(", "asrt", ")", "assert", ".", "ok", "(", "dest", ",", "'no '", "+", "...
Assigns property values on a destination object or asserts that the destination object properties are within the defined boundaries when a source object is passed along with its name @arg {Object} dest the object to assign properties to or assert properties for @arg {Object[]} pds property definition objects that dete...
[ "Assigns", "property", "values", "on", "a", "destination", "object", "or", "asserts", "that", "the", "destination", "object", "properties", "are", "within", "the", "defined", "boundaries", "when", "a", "source", "object", "is", "passed", "along", "with", "its", ...
214b186e1b72bed9c99c0a7903c70de4eca3c259
https://github.com/ugate/pulses/blob/214b186e1b72bed9c99c0a7903c70de4eca3c259/lib/platelets.js#L148-L157
train
ugate/pulses
lib/platelets.js
prop
function prop(dest, pd, src, isrc, ndflt, nm, nmsrc) { if (nm && src) { assert.strictEqual(dest[pd.n], src[pd.n], (nm ? nm + '.' : '') + pd.n + ': ' + dest[pd.n] + ' !== ' + (nmsrc ? nmsrc + '.' : '') + pd.n + ': ' + src[pd.n]); } else { var dtyp = (dest && typeof dest[pd.n]) || '',...
javascript
function prop(dest, pd, src, isrc, ndflt, nm, nmsrc) { if (nm && src) { assert.strictEqual(dest[pd.n], src[pd.n], (nm ? nm + '.' : '') + pd.n + ': ' + dest[pd.n] + ' !== ' + (nmsrc ? nmsrc + '.' : '') + pd.n + ': ' + src[pd.n]); } else { var dtyp = (dest && typeof dest[pd.n]) || '',...
[ "function", "prop", "(", "dest", ",", "pd", ",", "src", ",", "isrc", ",", "ndflt", ",", "nm", ",", "nmsrc", ")", "{", "if", "(", "nm", "&&", "src", ")", "{", "assert", ".", "strictEqual", "(", "dest", "[", "pd", ".", "n", "]", ",", "src", "["...
Assigns a property value on a destination object or asserts that the destination object property is within the defined boundaries when a source object is passed along with its name @arg {Object} dest the object to assign properties to or assert properties for @arg {Object} pd the property definition that determine whi...
[ "Assigns", "a", "property", "value", "on", "a", "destination", "object", "or", "asserts", "that", "the", "destination", "object", "property", "is", "within", "the", "defined", "boundaries", "when", "a", "source", "object", "is", "passed", "along", "with", "its...
214b186e1b72bed9c99c0a7903c70de4eca3c259
https://github.com/ugate/pulses/blob/214b186e1b72bed9c99c0a7903c70de4eca3c259/lib/platelets.js#L177-L191
train
icanjs/grid-filter
src/grid-filter.js
function(el){ var self = this; var $input = $('input.tokenSearch', el); var suggestions = new can.List([]); this.viewModel.attr('searchInput', $input); // http://loopj.com/jquery-tokeninput/ $input.tokenInput(suggestions, { theme: 'facebook', placehol...
javascript
function(el){ var self = this; var $input = $('input.tokenSearch', el); var suggestions = new can.List([]); this.viewModel.attr('searchInput', $input); // http://loopj.com/jquery-tokeninput/ $input.tokenInput(suggestions, { theme: 'facebook', placehol...
[ "function", "(", "el", ")", "{", "var", "self", "=", "this", ";", "var", "$input", "=", "$", "(", "'input.tokenSearch'", ",", "el", ")", ";", "var", "suggestions", "=", "new", "can", ".", "List", "(", "[", "]", ")", ";", "this", ".", "viewModel", ...
Run the jQuery.tokenizer plugin when the templated is inserted. When the input updates, the tokenizer will update the searchTerms in the viewModel.
[ "Run", "the", "jQuery", ".", "tokenizer", "plugin", "when", "the", "templated", "is", "inserted", ".", "When", "the", "input", "updates", "the", "tokenizer", "will", "update", "the", "searchTerms", "in", "the", "viewModel", "." ]
48d9ce876cdc6ef459fcae70ac67b23229e85a5a
https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/grid-filter.js#L25-L89
train