id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
34,100
Jeff2Ma/postcss-lazysprite
index.js
getBackgroundPositionInPercent
function getBackgroundPositionInPercent(image) { var x = 100 * (image.coordinates.x) / (image.properties.width - image.coordinates.width); var y = 100 * (image.coordinates.y) / (image.properties.height - image.coordinates.height); var template = _.template('<%= (x ? x + "%" : x) %> <%= (y ? y + "%" : y) %>'); retur...
javascript
function getBackgroundPositionInPercent(image) { var x = 100 * (image.coordinates.x) / (image.properties.width - image.coordinates.width); var y = 100 * (image.coordinates.y) / (image.properties.height - image.coordinates.height); var template = _.template('<%= (x ? x + "%" : x) %> <%= (y ? y + "%" : y) %>'); retur...
[ "function", "getBackgroundPositionInPercent", "(", "image", ")", "{", "var", "x", "=", "100", "*", "(", "image", ".", "coordinates", ".", "x", ")", "/", "(", "image", ".", "properties", ".", "width", "-", "image", ".", "coordinates", ".", "width", ")", ...
Return the pencentage value for background-position property
[ "Return", "the", "pencentage", "value", "for", "background", "-", "position", "property" ]
96725425a6d67fdb0c79ce476c33af55337aea9b
https://github.com/Jeff2Ma/postcss-lazysprite/blob/96725425a6d67fdb0c79ce476c33af55337aea9b/index.js#L750-L755
34,101
Jeff2Ma/postcss-lazysprite
index.js
getBackgroundSize
function getBackgroundSize(image) { var x = image.properties.width / image.ratio; var y = image.properties.height / image.ratio; var template = _.template('<%= x %>px <%= y %>px'); return template({x: x, y: y}); }
javascript
function getBackgroundSize(image) { var x = image.properties.width / image.ratio; var y = image.properties.height / image.ratio; var template = _.template('<%= x %>px <%= y %>px'); return template({x: x, y: y}); }
[ "function", "getBackgroundSize", "(", "image", ")", "{", "var", "x", "=", "image", ".", "properties", ".", "width", "/", "image", ".", "ratio", ";", "var", "y", "=", "image", ".", "properties", ".", "height", "/", "image", ".", "ratio", ";", "var", "...
Return the value for background-size property.
[ "Return", "the", "value", "for", "background", "-", "size", "property", "." ]
96725425a6d67fdb0c79ce476c33af55337aea9b
https://github.com/Jeff2Ma/postcss-lazysprite/blob/96725425a6d67fdb0c79ce476c33af55337aea9b/index.js#L758-L764
34,102
Jeff2Ma/postcss-lazysprite
index.js
getRetinaRatio
function getRetinaRatio(url) { var matches = /[@_](\d)x\.[a-z]{3,4}$/gi.exec(url); if (!matches) { return 1; } var ratio = _.parseInt(matches[1]); return ratio; }
javascript
function getRetinaRatio(url) { var matches = /[@_](\d)x\.[a-z]{3,4}$/gi.exec(url); if (!matches) { return 1; } var ratio = _.parseInt(matches[1]); return ratio; }
[ "function", "getRetinaRatio", "(", "url", ")", "{", "var", "matches", "=", "/", "[@_](\\d)x\\.[a-z]{3,4}$", "/", "gi", ".", "exec", "(", "url", ")", ";", "if", "(", "!", "matches", ")", "{", "return", "1", ";", "}", "var", "ratio", "=", "_", ".", "...
Return the value of retina ratio.
[ "Return", "the", "value", "of", "retina", "ratio", "." ]
96725425a6d67fdb0c79ce476c33af55337aea9b
https://github.com/Jeff2Ma/postcss-lazysprite/blob/96725425a6d67fdb0c79ce476c33af55337aea9b/index.js#L785-L792
34,103
Jeff2Ma/postcss-lazysprite
index.js
log
function log(logLevel, level, content) { var output = true; switch (logLevel) { case 'slient': if (level !== 'lv1') { output = false; } break; case 'info': if (level === 'lv3') { output = false; } break; default: output = true; } if (output) { var data = Array.prototype.slice.call(content)...
javascript
function log(logLevel, level, content) { var output = true; switch (logLevel) { case 'slient': if (level !== 'lv1') { output = false; } break; case 'info': if (level === 'lv3') { output = false; } break; default: output = true; } if (output) { var data = Array.prototype.slice.call(content)...
[ "function", "log", "(", "logLevel", ",", "level", ",", "content", ")", "{", "var", "output", "=", "true", ";", "switch", "(", "logLevel", ")", "{", "case", "'slient'", ":", "if", "(", "level", "!==", "'lv1'", ")", "{", "output", "=", "false", ";", ...
Log with same stylesheet and level control.
[ "Log", "with", "same", "stylesheet", "and", "level", "control", "." ]
96725425a6d67fdb0c79ce476c33af55337aea9b
https://github.com/Jeff2Ma/postcss-lazysprite/blob/96725425a6d67fdb0c79ce476c33af55337aea9b/index.js#L811-L832
34,104
Jeff2Ma/postcss-lazysprite
index.js
debug
function debug() { var data = Array.prototype.slice.call(arguments); fancyLog.apply(false, data); }
javascript
function debug() { var data = Array.prototype.slice.call(arguments); fancyLog.apply(false, data); }
[ "function", "debug", "(", ")", "{", "var", "data", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ";", "fancyLog", ".", "apply", "(", "false", ",", "data", ")", ";", "}" ]
Log for debug
[ "Log", "for", "debug" ]
96725425a6d67fdb0c79ce476c33af55337aea9b
https://github.com/Jeff2Ma/postcss-lazysprite/blob/96725425a6d67fdb0c79ce476c33af55337aea9b/index.js#L835-L838
34,105
twolfson/gmsmith
lib/engine.js
Gmsmith
function Gmsmith(options) { options = options || {}; this.gm = _gm; var useImageMagick = options.hasOwnProperty('imagemagick') ? options.imagemagick : !gmExists; if (useImageMagick) { this.gm = _gm.subClass({imageMagick: true}); } }
javascript
function Gmsmith(options) { options = options || {}; this.gm = _gm; var useImageMagick = options.hasOwnProperty('imagemagick') ? options.imagemagick : !gmExists; if (useImageMagick) { this.gm = _gm.subClass({imageMagick: true}); } }
[ "function", "Gmsmith", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "gm", "=", "_gm", ";", "var", "useImageMagick", "=", "options", ".", "hasOwnProperty", "(", "'imagemagick'", ")", "?", "options", ".", "imagemag...
Define our engine constructor
[ "Define", "our", "engine", "constructor" ]
2bc44e50a9b562691745f5cb5261e85debeefd7e
https://github.com/twolfson/gmsmith/blob/2bc44e50a9b562691745f5cb5261e85debeefd7e/lib/engine.js#L16-L23
34,106
MatteoGabriele/storage-helper
dist/storage-helper.js
setItem
function setItem(key, value) { storage[key] = typeof value === 'string' ? value : JSON.stringify(value); }
javascript
function setItem(key, value) { storage[key] = typeof value === 'string' ? value : JSON.stringify(value); }
[ "function", "setItem", "(", "key", ",", "value", ")", "{", "storage", "[", "key", "]", "=", "typeof", "value", "===", "'string'", "?", "value", ":", "JSON", ".", "stringify", "(", "value", ")", ";", "}" ]
Add item in out session storage @param {String} key @param {String} value
[ "Add", "item", "in", "out", "session", "storage" ]
72d4e773811cf52091019aa98f2990c0eb7546e4
https://github.com/MatteoGabriele/storage-helper/blob/72d4e773811cf52091019aa98f2990c0eb7546e4/dist/storage-helper.js#L27-L29
34,107
MatteoGabriele/storage-helper
dist/storage-helper.js
log
function log(text) { var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'success'; var debug$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (!debug$$1) { return; } var success = 'padding: 2px; background: #219621; color: #ffffff'; var war...
javascript
function log(text) { var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'success'; var debug$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (!debug$$1) { return; } var success = 'padding: 2px; background: #219621; color: #ffffff'; var war...
[ "function", "log", "(", "text", ")", "{", "var", "type", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "'success'", ";", "var", "debug$$1", "=", "arguments", "."...
Logger for different type of messages. @param {String} text @param {String} [type='success']
[ "Logger", "for", "different", "type", "of", "messages", "." ]
72d4e773811cf52091019aa98f2990c0eb7546e4
https://github.com/MatteoGabriele/storage-helper/blob/72d4e773811cf52091019aa98f2990c0eb7546e4/dist/storage-helper.js#L77-L91
34,108
MatteoGabriele/storage-helper
dist/storage-helper.js
parse
function parse(data) { try { return JSON.parse(data); } catch (e) { log('Oops! Some problems parsing this ' + (typeof data === 'undefined' ? 'undefined' : _typeof(data)) + '.', 'error', debug); } return null; }
javascript
function parse(data) { try { return JSON.parse(data); } catch (e) { log('Oops! Some problems parsing this ' + (typeof data === 'undefined' ? 'undefined' : _typeof(data)) + '.', 'error', debug); } return null; }
[ "function", "parse", "(", "data", ")", "{", "try", "{", "return", "JSON", ".", "parse", "(", "data", ")", ";", "}", "catch", "(", "e", ")", "{", "log", "(", "'Oops! Some problems parsing this '", "+", "(", "typeof", "data", "===", "'undefined'", "?", "...
JSON parse with error @param {String} data @return {String|null}
[ "JSON", "parse", "with", "error" ]
72d4e773811cf52091019aa98f2990c0eb7546e4
https://github.com/MatteoGabriele/storage-helper/blob/72d4e773811cf52091019aa98f2990c0eb7546e4/dist/storage-helper.js#L98-L106
34,109
MatteoGabriele/storage-helper
dist/storage-helper.js
setItem
function setItem(key, value) { var expires = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; if (!isCookieEnabled) { session.setItem(key, value); log('I\'ve saved "' + key + '" in a plain object :)', 'warning', debug); return; } cookie.set(key, value, { expires: expires }); ...
javascript
function setItem(key, value) { var expires = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; if (!isCookieEnabled) { session.setItem(key, value); log('I\'ve saved "' + key + '" in a plain object :)', 'warning', debug); return; } cookie.set(key, value, { expires: expires }); ...
[ "function", "setItem", "(", "key", ",", "value", ")", "{", "var", "expires", "=", "arguments", ".", "length", ">", "2", "&&", "arguments", "[", "2", "]", "!==", "undefined", "?", "arguments", "[", "2", "]", ":", "1", ";", "if", "(", "!", "isCookieE...
Set the item in the cookies if possible, otherwise is going to store it inside a plain object @param {String} key @param {String} value @param {Number} [expires=1]
[ "Set", "the", "item", "in", "the", "cookies", "if", "possible", "otherwise", "is", "going", "to", "store", "it", "inside", "a", "plain", "object" ]
72d4e773811cf52091019aa98f2990c0eb7546e4
https://github.com/MatteoGabriele/storage-helper/blob/72d4e773811cf52091019aa98f2990c0eb7546e4/dist/storage-helper.js#L130-L141
34,110
MatteoGabriele/storage-helper
dist/storage-helper.js
clear
function clear() { var cookies = isBrowser && document.cookie.split(';'); if (!cookies.length) { return; } for (var i = 0, l = cookies.length; i < l; i++) { var item = cookies[i]; var key = item.split('=')[0]; cookie.remove(key); } }
javascript
function clear() { var cookies = isBrowser && document.cookie.split(';'); if (!cookies.length) { return; } for (var i = 0, l = cookies.length; i < l; i++) { var item = cookies[i]; var key = item.split('=')[0]; cookie.remove(key); } }
[ "function", "clear", "(", ")", "{", "var", "cookies", "=", "isBrowser", "&&", "document", ".", "cookie", ".", "split", "(", "';'", ")", ";", "if", "(", "!", "cookies", ".", "length", ")", "{", "return", ";", "}", "for", "(", "var", "i", "=", "0",...
Remove all cookies
[ "Remove", "all", "cookies" ]
72d4e773811cf52091019aa98f2990c0eb7546e4
https://github.com/MatteoGabriele/storage-helper/blob/72d4e773811cf52091019aa98f2990c0eb7546e4/dist/storage-helper.js#L163-L176
34,111
MatteoGabriele/storage-helper
dist/storage-helper.js
hasLocalStorage
function hasLocalStorage() { if (!localstorage) { return false; } try { localstorage.setItem('0', ''); localstorage.removeItem('0'); return true; } catch (error) { return false; } }
javascript
function hasLocalStorage() { if (!localstorage) { return false; } try { localstorage.setItem('0', ''); localstorage.removeItem('0'); return true; } catch (error) { return false; } }
[ "function", "hasLocalStorage", "(", ")", "{", "if", "(", "!", "localstorage", ")", "{", "return", "false", ";", "}", "try", "{", "localstorage", ".", "setItem", "(", "'0'", ",", "''", ")", ";", "localstorage", ".", "removeItem", "(", "'0'", ")", ";", ...
Check if the browser has localStorage @return {Boolean}
[ "Check", "if", "the", "browser", "has", "localStorage" ]
72d4e773811cf52091019aa98f2990c0eb7546e4
https://github.com/MatteoGabriele/storage-helper/blob/72d4e773811cf52091019aa98f2990c0eb7546e4/dist/storage-helper.js#L192-L204
34,112
MatteoGabriele/storage-helper
dist/storage-helper.js
getItem
function getItem(key) { var parsed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var fallbackValue = arguments[2]; var result = void 0; var cookieItem = cookie$1.getItem(key); var sessionItem = session.getItem(key); if (!hasLocalStorage()) { result = cookieItem || sessi...
javascript
function getItem(key) { var parsed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var fallbackValue = arguments[2]; var result = void 0; var cookieItem = cookie$1.getItem(key); var sessionItem = session.getItem(key); if (!hasLocalStorage()) { result = cookieItem || sessi...
[ "function", "getItem", "(", "key", ")", "{", "var", "parsed", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "false", ";", "var", "fallbackValue", "=", "arguments",...
Get the item Here the object is taken from the localStorage, if it was available, or from the object @param {String} key @param {Boolean} [parsed=false] @return {any}
[ "Get", "the", "item", "Here", "the", "object", "is", "taken", "from", "the", "localStorage", "if", "it", "was", "available", "or", "from", "the", "object" ]
72d4e773811cf52091019aa98f2990c0eb7546e4
https://github.com/MatteoGabriele/storage-helper/blob/72d4e773811cf52091019aa98f2990c0eb7546e4/dist/storage-helper.js#L255-L277
34,113
MatteoGabriele/storage-helper
dist/storage-helper.js
removeItem
function removeItem(key) { cookie$1.removeItem(key); session.removeItem(key); if (!hasLocalStorage()) { return; } localstorage.removeItem(key); }
javascript
function removeItem(key) { cookie$1.removeItem(key); session.removeItem(key); if (!hasLocalStorage()) { return; } localstorage.removeItem(key); }
[ "function", "removeItem", "(", "key", ")", "{", "cookie$1", ".", "removeItem", "(", "key", ")", ";", "session", ".", "removeItem", "(", "key", ")", ";", "if", "(", "!", "hasLocalStorage", "(", ")", ")", "{", "return", ";", "}", "localstorage", ".", "...
Remove a single item from the storage @param {String} key
[ "Remove", "a", "single", "item", "from", "the", "storage" ]
72d4e773811cf52091019aa98f2990c0eb7546e4
https://github.com/MatteoGabriele/storage-helper/blob/72d4e773811cf52091019aa98f2990c0eb7546e4/dist/storage-helper.js#L297-L306
34,114
kaola-fed/foxman
packages/foxman-plugin-server/lib/client/js/builtin/eventbus.js
off
function off(type, handler) { if (all[type]) { all[type].splice(all[type].indexOf(handler) >>> 0, 1); } }
javascript
function off(type, handler) { if (all[type]) { all[type].splice(all[type].indexOf(handler) >>> 0, 1); } }
[ "function", "off", "(", "type", ",", "handler", ")", "{", "if", "(", "all", "[", "type", "]", ")", "{", "all", "[", "type", "]", ".", "splice", "(", "all", "[", "type", "]", ".", "indexOf", "(", "handler", ")", ">>>", "0", ",", "1", ")", ";",...
Remove an event handler for the given type. @param {String} type Type of event to unregister `handler` from, or `"*"` @param {Function} handler Handler function to remove @memberOf mitt
[ "Remove", "an", "event", "handler", "for", "the", "given", "type", "." ]
e444c0908fabbfe49908ae4ccc3d6619a22dec57
https://github.com/kaola-fed/foxman/blob/e444c0908fabbfe49908ae4ccc3d6619a22dec57/packages/foxman-plugin-server/lib/client/js/builtin/eventbus.js#L41-L45
34,115
nodejitsu/godot
lib/godot/net/client.js
defaultify
function defaultify (obj) { return Object.keys(self.defaults).reduce(function (acc, key) { if (!acc[key]) { acc[key] = self.defaults[key] } return acc; }, obj); }
javascript
function defaultify (obj) { return Object.keys(self.defaults).reduce(function (acc, key) { if (!acc[key]) { acc[key] = self.defaults[key] } return acc; }, obj); }
[ "function", "defaultify", "(", "obj", ")", "{", "return", "Object", ".", "keys", "(", "self", ".", "defaults", ")", ".", "reduce", "(", "function", "(", "acc", ",", "key", ")", "{", "if", "(", "!", "acc", "[", "key", "]", ")", "{", "acc", "[", ...
Add defaults to each object where a value does not already exist
[ "Add", "defaults", "to", "each", "object", "where", "a", "value", "does", "not", "already", "exist" ]
fc2397c8282ad97de17a807b2ea4498a0365e77e
https://github.com/nodejitsu/godot/blob/fc2397c8282ad97de17a807b2ea4498a0365e77e/lib/godot/net/client.js#L151-L156
34,116
BrandwatchLtd/nudge
index.js
nudge
function nudge(emitter, eventSpecs) { 'use strict'; checkValidity(eventSpecs); var proxy = makeProxyEmitter(emitter, eventSpecs); return function middleware(req, res) { function write(string) { res.write(string); } proxy.on('data', write); req.once('close', function removeListener() { proxy.remov...
javascript
function nudge(emitter, eventSpecs) { 'use strict'; checkValidity(eventSpecs); var proxy = makeProxyEmitter(emitter, eventSpecs); return function middleware(req, res) { function write(string) { res.write(string); } proxy.on('data', write); req.once('close', function removeListener() { proxy.remov...
[ "function", "nudge", "(", "emitter", ",", "eventSpecs", ")", "{", "'use strict'", ";", "checkValidity", "(", "eventSpecs", ")", ";", "var", "proxy", "=", "makeProxyEmitter", "(", "emitter", ",", "eventSpecs", ")", ";", "return", "function", "middleware", "(", ...
eventSpecs is an object. Each field must contain true, or a sub object with a name, or a function, or both.
[ "eventSpecs", "is", "an", "object", ".", "Each", "field", "must", "contain", "true", "or", "a", "sub", "object", "with", "a", "name", "or", "a", "function", "or", "both", "." ]
77d52b654791ccc8e4fc67860efa6706212bde7e
https://github.com/BrandwatchLtd/nudge/blob/77d52b654791ccc8e4fc67860efa6706212bde7e/index.js#L7-L36
34,117
applitools/Eyes.Protractor
src/Eyes.js
function (point, size, isRelative) { return {left: Math.ceil(point.x), top: Math.ceil(point.y), width: Math.ceil(size.width), height: Math.ceil(size.height), relative: isRelative}; }
javascript
function (point, size, isRelative) { return {left: Math.ceil(point.x), top: Math.ceil(point.y), width: Math.ceil(size.width), height: Math.ceil(size.height), relative: isRelative}; }
[ "function", "(", "point", ",", "size", ",", "isRelative", ")", "{", "return", "{", "left", ":", "Math", ".", "ceil", "(", "point", ".", "x", ")", ",", "top", ":", "Math", ".", "ceil", "(", "point", ".", "y", ")", ",", "width", ":", "Math", ".",...
A helper function for creating region objects to be used in checkWindow @param {Object} point A point which represents the location of the region (x,y). @param {Object} size The size of the region (width, height). @param {boolean} isRelative Whether or not the region coordinates are relative to the image coordinates. @...
[ "A", "helper", "function", "for", "creating", "region", "objects", "to", "be", "used", "in", "checkWindow" ]
bccd29c27029c2344e732ea120a6b544b859004d
https://github.com/applitools/Eyes.Protractor/blob/bccd29c27029c2344e732ea120a6b544b859004d/src/Eyes.js#L169-L172
34,118
helpers/handlebars-helper-md
index.js
function(grunt, context) { grunt.config.data = _.defaults(context || {}, _.cloneDeep(grunt.config.data)); return grunt.config.process(grunt.config.data); }
javascript
function(grunt, context) { grunt.config.data = _.defaults(context || {}, _.cloneDeep(grunt.config.data)); return grunt.config.process(grunt.config.data); }
[ "function", "(", "grunt", ",", "context", ")", "{", "grunt", ".", "config", ".", "data", "=", "_", ".", "defaults", "(", "context", "||", "{", "}", ",", "_", ".", "cloneDeep", "(", "grunt", ".", "config", ".", "data", ")", ")", ";", "return", "gr...
Process templates using grunt.config.data and context
[ "Process", "templates", "using", "grunt", ".", "config", ".", "data", "and", "context" ]
18e4b2f937473f88cbfce59122cb084ac18465ca
https://github.com/helpers/handlebars-helper-md/blob/18e4b2f937473f88cbfce59122cb084ac18465ca/index.js#L153-L156
34,119
aurelia-contrib/aurelia-typed-observable-plugin
dist/es2015/index.js
mapCoerceFunction
function mapCoerceFunction(type, strType, coerceFunction) { coerceFunction = coerceFunction || type.coerce; if (typeof strType !== 'string' || typeof coerceFunction !== 'function') { getLogger('map-coerce-function') .warn(`Bad attempt at mapping coerce function for type: ${type.name} to: ${s...
javascript
function mapCoerceFunction(type, strType, coerceFunction) { coerceFunction = coerceFunction || type.coerce; if (typeof strType !== 'string' || typeof coerceFunction !== 'function') { getLogger('map-coerce-function') .warn(`Bad attempt at mapping coerce function for type: ${type.name} to: ${s...
[ "function", "mapCoerceFunction", "(", "type", ",", "strType", ",", "coerceFunction", ")", "{", "coerceFunction", "=", "coerceFunction", "||", "type", ".", "coerce", ";", "if", "(", "typeof", "strType", "!==", "'string'", "||", "typeof", "coerceFunction", "!==", ...
Map a class to a string for typescript property coerce @param type the property class to register @param strType the string that represents class in the lookup @param coerceFunction coerce function to register with param strType
[ "Map", "a", "class", "to", "a", "string", "for", "typescript", "property", "coerce" ]
e041e96366b1179472f3e742a4dc40a03159e025
https://github.com/aurelia-contrib/aurelia-typed-observable-plugin/blob/e041e96366b1179472f3e742a4dc40a03159e025/dist/es2015/index.js#L43-L52
34,120
inadarei/connect-thumbs
lib/connect-thumbs.js
parseOptions
function parseOptions(options) { ttl = options.ttl || (3600 * 24); // cache for 1 day by default. tmpCacheTTL = options.tmpCacheTTL || 5; // small by default decodeFn = options.decodeFn || exports.decodeURL; presets = options.presets || defaultPresets(); tmpDir = options.tmpDir || '/tmp/nodethumbnails'; ...
javascript
function parseOptions(options) { ttl = options.ttl || (3600 * 24); // cache for 1 day by default. tmpCacheTTL = options.tmpCacheTTL || 5; // small by default decodeFn = options.decodeFn || exports.decodeURL; presets = options.presets || defaultPresets(); tmpDir = options.tmpDir || '/tmp/nodethumbnails'; ...
[ "function", "parseOptions", "(", "options", ")", "{", "ttl", "=", "options", ".", "ttl", "||", "(", "3600", "*", "24", ")", ";", "// cache for 1 day by default.", "tmpCacheTTL", "=", "options", ".", "tmpCacheTTL", "||", "5", ";", "// small by default", "decode...
Merge user-provided options with the sensible defaults. @param options
[ "Merge", "user", "-", "provided", "options", "with", "the", "sensible", "defaults", "." ]
ccd6495cdb9718d674ce09eb35f1eb2ce077d340
https://github.com/inadarei/connect-thumbs/blob/ccd6495cdb9718d674ce09eb35f1eb2ce077d340/lib/connect-thumbs.js#L183-L207
34,121
sbolel/image-uploader
src/image-uploader.js
function () { var text = '' var regx = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' for (var idx = 0; idx < 8; idx++) { text = text + regx.charAt(Math.floor(Math.random() * regx.length)) } return text }
javascript
function () { var text = '' var regx = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' for (var idx = 0; idx < 8; idx++) { text = text + regx.charAt(Math.floor(Math.random() * regx.length)) } return text }
[ "function", "(", ")", "{", "var", "text", "=", "''", "var", "regx", "=", "'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'", "for", "(", "var", "idx", "=", "0", ";", "idx", "<", "8", ";", "idx", "++", ")", "{", "text", "=", "text", "+", "...
Generate a unique string
[ "Generate", "a", "unique", "string" ]
7ddb9ef0029e577b81d88d6e4379687895cf64f3
https://github.com/sbolel/image-uploader/blob/7ddb9ef0029e577b81d88d6e4379687895cf64f3/src/image-uploader.js#L7-L14
34,122
calvium/react-native-device-screen-switcher
src/ScreenSwitcher.js
performResize
function performResize(deviceInfo) { const {windowPhysicalPixels} = deviceInfo; const {width, height} = windowPhysicalPixels; // Force RN to re-set the Dimensions sizes Dimensions.set({windowPhysicalPixels}); console.log(`Resizing window to physical pixels ${width}x${height}`); // TODO: Android uses screen...
javascript
function performResize(deviceInfo) { const {windowPhysicalPixels} = deviceInfo; const {width, height} = windowPhysicalPixels; // Force RN to re-set the Dimensions sizes Dimensions.set({windowPhysicalPixels}); console.log(`Resizing window to physical pixels ${width}x${height}`); // TODO: Android uses screen...
[ "function", "performResize", "(", "deviceInfo", ")", "{", "const", "{", "windowPhysicalPixels", "}", "=", "deviceInfo", ";", "const", "{", "width", ",", "height", "}", "=", "windowPhysicalPixels", ";", "// Force RN to re-set the Dimensions sizes", "Dimensions", ".", ...
Force resize of Dimensions.get by using the setter.
[ "Force", "resize", "of", "Dimensions", ".", "get", "by", "using", "the", "setter", "." ]
b1ae5c9b90b9d99a5b972437498995dfdde1baff
https://github.com/calvium/react-native-device-screen-switcher/blob/b1ae5c9b90b9d99a5b972437498995dfdde1baff/src/ScreenSwitcher.js#L19-L27
34,123
jonschlinkert/write-json
index.js
writeJson
function writeJson(filepath, value, cb) { var args = [].slice.call(arguments, 1); if (typeof args[args.length - 1] === 'function') { cb = args.pop(); } return writeFile(filepath, stringify.apply(null, args), cb); }
javascript
function writeJson(filepath, value, cb) { var args = [].slice.call(arguments, 1); if (typeof args[args.length - 1] === 'function') { cb = args.pop(); } return writeFile(filepath, stringify.apply(null, args), cb); }
[ "function", "writeJson", "(", "filepath", ",", "value", ",", "cb", ")", "{", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ";", "if", "(", "typeof", "args", "[", "args", ".", "length", "-", "1", "]", ...
Calls `JSON.stringify` on the given `value` then asynchronously writes the result to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Returns a promise if a callback function is not passed. ```js var writeJson = require('write'); var pkg = {name: 'w...
[ "Calls", "JSON", ".", "stringify", "on", "the", "given", "value", "then", "asynchronously", "writes", "the", "result", "to", "a", "file", "replacing", "the", "file", "if", "it", "already", "exists", "and", "creating", "any", "intermediate", "directories", "if"...
1159465425ab04f3a8748663fdb5dead306c2c2e
https://github.com/jonschlinkert/write-json/blob/1159465425ab04f3a8748663fdb5dead306c2c2e/index.js#L58-L64
34,124
jonschlinkert/write-json
index.js
stringify
function stringify(value, replacer, indent) { if (isObject(replacer)) { var opts = replacer; replacer = opts.replacer; indent = opts.indent; } if (indent == null) { indent = 2; } return JSON.stringify(value, replacer, indent); }
javascript
function stringify(value, replacer, indent) { if (isObject(replacer)) { var opts = replacer; replacer = opts.replacer; indent = opts.indent; } if (indent == null) { indent = 2; } return JSON.stringify(value, replacer, indent); }
[ "function", "stringify", "(", "value", ",", "replacer", ",", "indent", ")", "{", "if", "(", "isObject", "(", "replacer", ")", ")", "{", "var", "opts", "=", "replacer", ";", "replacer", "=", "opts", ".", "replacer", ";", "indent", "=", "opts", ".", "i...
Utility function for stringifying the given value, ensuring that options are correctly passed to `JSON.stringify`. @param {any} `value` @param {Function|Object} `replacer` Function or options object @param {String|Number} `indent` The actual value to use for spacing, or the number of spaces to use. @return {String}
[ "Utility", "function", "for", "stringifying", "the", "given", "value", "ensuring", "that", "options", "are", "correctly", "passed", "to", "JSON", ".", "stringify", "." ]
1159465425ab04f3a8748663fdb5dead306c2c2e
https://github.com/jonschlinkert/write-json/blob/1159465425ab04f3a8748663fdb5dead306c2c2e/index.js#L144-L154
34,125
personality-insights/text-summary
src/utilities/comparators.js
compareByRelevance
function compareByRelevance(o1, o2) { var result = 0; if (Math.abs(0.5 - o1.percentage) > Math.abs(0.5 - o2.percentage)) { result = -1; // A trait with 1% is more interesting than one with 60%. } if (Math.abs(0.5 - o1.percentage) < Math.abs(0.5 - o2.percentage)) { result = 1; } return res...
javascript
function compareByRelevance(o1, o2) { var result = 0; if (Math.abs(0.5 - o1.percentage) > Math.abs(0.5 - o2.percentage)) { result = -1; // A trait with 1% is more interesting than one with 60%. } if (Math.abs(0.5 - o1.percentage) < Math.abs(0.5 - o2.percentage)) { result = 1; } return res...
[ "function", "compareByRelevance", "(", "o1", ",", "o2", ")", "{", "var", "result", "=", "0", ";", "if", "(", "Math", ".", "abs", "(", "0.5", "-", "o1", ".", "percentage", ")", ">", "Math", ".", "abs", "(", "0.5", "-", "o2", ".", "percentage", ")"...
Copyright 2015 IBM Corp. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
[ "Copyright", "2015", "IBM", "Corp", ".", "All", "Rights", "Reserved", "." ]
3d6585e2ee65528b256857f9fa2be34bf1c2de0c
https://github.com/personality-insights/text-summary/blob/3d6585e2ee65528b256857f9fa2be34bf1c2de0c/src/utilities/comparators.js#L18-L30
34,126
scottinet/espresso-logic-minimizer
index.js
minimize
function minimize(data) { if (!Array.isArray(data)) { throw new Error('EspressoLogicMinimizer: expected an array, got a ' + typeof data); } const badContent = data.filter((element) => typeof element != 'string'); if (badContent.length > 0) { throw new Error('EspressoLogicMinimizer: incorrect data cont...
javascript
function minimize(data) { if (!Array.isArray(data)) { throw new Error('EspressoLogicMinimizer: expected an array, got a ' + typeof data); } const badContent = data.filter((element) => typeof element != 'string'); if (badContent.length > 0) { throw new Error('EspressoLogicMinimizer: incorrect data cont...
[ "function", "minimize", "(", "data", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "data", ")", ")", "{", "throw", "new", "Error", "(", "'EspressoLogicMinimizer: expected an array, got a '", "+", "typeof", "data", ")", ";", "}", "const", "badConten...
Applies the Espresso Heuristic Logic Minimizer algorithm to the provided data in PLA format @param {Array} data @returns {Array}
[ "Applies", "the", "Espresso", "Heuristic", "Logic", "Minimizer", "algorithm", "to", "the", "provided", "data", "in", "PLA", "format" ]
034ff2d466336ee49db64f8f3f975ed2b57f2364
https://github.com/scottinet/espresso-logic-minimizer/blob/034ff2d466336ee49db64f8f3f975ed2b57f2364/index.js#L15-L27
34,127
VideoSpike/nativescript-screen-orientation
screen-orientation.ios.js
findPrototypeForProperty
function findPrototypeForProperty(object,property){ while(false==object.hasOwnProperty(property)){ object = Object.getPrototypeOf(object); } return object; }
javascript
function findPrototypeForProperty(object,property){ while(false==object.hasOwnProperty(property)){ object = Object.getPrototypeOf(object); } return object; }
[ "function", "findPrototypeForProperty", "(", "object", ",", "property", ")", "{", "while", "(", "false", "==", "object", ".", "hasOwnProperty", "(", "property", ")", ")", "{", "object", "=", "Object", ".", "getPrototypeOf", "(", "object", ")", ";", "}", "r...
find the exact object by which the property is owned in the prototype chain @param object @param property @returns {*}
[ "find", "the", "exact", "object", "by", "which", "the", "property", "is", "owned", "in", "the", "prototype", "chain" ]
95b526434b9f077cf1e295bba6bb67c739512a17
https://github.com/VideoSpike/nativescript-screen-orientation/blob/95b526434b9f077cf1e295bba6bb67c739512a17/screen-orientation.ios.js#L16-L21
34,128
VideoSpike/nativescript-screen-orientation
screen-orientation.ios.js
setShouldAutoRotate
function setShouldAutoRotate(bool){ var prototypeForNavController = findPrototypeForProperty(frameModule.topmost().ios.controller,"shouldAutorotate"); Object.defineProperty(prototypeForNavController,"shouldAutorotate",{ configurable:true, enumerable:false, get:function(){ ret...
javascript
function setShouldAutoRotate(bool){ var prototypeForNavController = findPrototypeForProperty(frameModule.topmost().ios.controller,"shouldAutorotate"); Object.defineProperty(prototypeForNavController,"shouldAutorotate",{ configurable:true, enumerable:false, get:function(){ ret...
[ "function", "setShouldAutoRotate", "(", "bool", ")", "{", "var", "prototypeForNavController", "=", "findPrototypeForProperty", "(", "frameModule", ".", "topmost", "(", ")", ".", "ios", ".", "controller", ",", "\"shouldAutorotate\"", ")", ";", "Object", ".", "defin...
set should auto rotate @param bool
[ "set", "should", "auto", "rotate" ]
95b526434b9f077cf1e295bba6bb67c739512a17
https://github.com/VideoSpike/nativescript-screen-orientation/blob/95b526434b9f077cf1e295bba6bb67c739512a17/screen-orientation.ios.js#L27-L37
34,129
VideoSpike/nativescript-screen-orientation
screen-orientation.ios.js
setCurrentOrientation
function setCurrentOrientation(orientationType,callback){ if("landscape"==orientationType.toLowerCase()){ UIDevice.currentDevice.setValueForKey(UIInterfaceOrientationLandscapeLeft,"orientation"); setShouldAutoRotate(false); } else if("portrait"==orientationType.toLowerCase()){ UIDev...
javascript
function setCurrentOrientation(orientationType,callback){ if("landscape"==orientationType.toLowerCase()){ UIDevice.currentDevice.setValueForKey(UIInterfaceOrientationLandscapeLeft,"orientation"); setShouldAutoRotate(false); } else if("portrait"==orientationType.toLowerCase()){ UIDev...
[ "function", "setCurrentOrientation", "(", "orientationType", ",", "callback", ")", "{", "if", "(", "\"landscape\"", "==", "orientationType", ".", "toLowerCase", "(", ")", ")", "{", "UIDevice", ".", "currentDevice", ".", "setValueForKey", "(", "UIInterfaceOrientation...
set current orientation and call the callback once the orientation is set @param orientationType @param callback
[ "set", "current", "orientation", "and", "call", "the", "callback", "once", "the", "orientation", "is", "set" ]
95b526434b9f077cf1e295bba6bb67c739512a17
https://github.com/VideoSpike/nativescript-screen-orientation/blob/95b526434b9f077cf1e295bba6bb67c739512a17/screen-orientation.ios.js#L44-L61
34,130
textlint/textlint-plugin-html
src/html-to-ast.js
removeUnusedProperties
function removeUnusedProperties(node) { if (typeof node !== "object") { return; } ["position"].forEach(function (key) { if (node.hasOwnProperty(key)) { delete node[key]; } }); }
javascript
function removeUnusedProperties(node) { if (typeof node !== "object") { return; } ["position"].forEach(function (key) { if (node.hasOwnProperty(key)) { delete node[key]; } }); }
[ "function", "removeUnusedProperties", "(", "node", ")", "{", "if", "(", "typeof", "node", "!==", "\"object\"", ")", "{", "return", ";", "}", "[", "\"position\"", "]", ".", "forEach", "(", "function", "(", "key", ")", "{", "if", "(", "node", ".", "hasOw...
Remove undocumented properties on TxtNode from node @param {TxtNode} node already has loc,range
[ "Remove", "undocumented", "properties", "on", "TxtNode", "from", "node" ]
13d1f3a7619dd3d1bdcd7e1a5bd80726b2bdd816
https://github.com/textlint/textlint-plugin-html/blob/13d1f3a7619dd3d1bdcd7e1a5bd80726b2bdd816/src/html-to-ast.js#L11-L20
34,131
dfahlander/just-build
src/execute.js
executeAll
function executeAll (cfg) { console.log(`${clr.DIM+clr.LIGHT_MAGENTA}Package: ${cfg.packageRoot}${clr.RESET}`); return new Promise((resolve, reject) => { createObservable(cfg).subscribe({ next ({command, exitCode}) { if (exitCode == 0) cfg.log(`${EMIT_COLO...
javascript
function executeAll (cfg) { console.log(`${clr.DIM+clr.LIGHT_MAGENTA}Package: ${cfg.packageRoot}${clr.RESET}`); return new Promise((resolve, reject) => { createObservable(cfg).subscribe({ next ({command, exitCode}) { if (exitCode == 0) cfg.log(`${EMIT_COLO...
[ "function", "executeAll", "(", "cfg", ")", "{", "console", ".", "log", "(", "`", "${", "clr", ".", "DIM", "+", "clr", ".", "LIGHT_MAGENTA", "}", "${", "cfg", ".", "packageRoot", "}", "${", "clr", ".", "RESET", "}", "`", ")", ";", "return", "new", ...
Execute the build tasks. @param cfg {{ dir: string, taskSet: Object.<string, string[]>, tasksToRun: string[], watchMode: boolean, spawn: Function, env: Object, log: Function, packageRoot: string }} Configuration to execute @return Promise
[ "Execute", "the", "build", "tasks", "." ]
52919bab419bbda36a02524b6897333e52ec2a94
https://github.com/dfahlander/just-build/blob/52919bab419bbda36a02524b6897333e52ec2a94/src/execute.js#L31-L50
34,132
dfahlander/just-build
src/execute.js
createObservable
function createObservable (cfg) { const {dir, taskSet, tasksToRun, watchMode, spawn, env, log} = cfg; const tasks = tasksToRun.map(taskName => { const commandList = taskSet[taskName]; if (!commandList) throw new Error (`No such task name: ${taskName} was configured`); return...
javascript
function createObservable (cfg) { const {dir, taskSet, tasksToRun, watchMode, spawn, env, log} = cfg; const tasks = tasksToRun.map(taskName => { const commandList = taskSet[taskName]; if (!commandList) throw new Error (`No such task name: ${taskName} was configured`); return...
[ "function", "createObservable", "(", "cfg", ")", "{", "const", "{", "dir", ",", "taskSet", ",", "tasksToRun", ",", "watchMode", ",", "spawn", ",", "env", ",", "log", "}", "=", "cfg", ";", "const", "tasks", "=", "tasksToRun", ".", "map", "(", "taskName"...
Create a build-task executer as an Observable @param cfg {{ dir: string, taskSet: Object.<string, string[]>, tasksToRun: string[], watchMode: boolean, spawn: Function, env: Object, log: Function }} Configuration to execute @return Observable
[ "Create", "a", "build", "-", "task", "executer", "as", "an", "Observable" ]
52919bab419bbda36a02524b6897333e52ec2a94
https://github.com/dfahlander/just-build/blob/52919bab419bbda36a02524b6897333e52ec2a94/src/execute.js#L66-L82
34,133
dfahlander/just-build
src/execute.js
createSequencialCommandExecutor
function createSequencialCommandExecutor (commands, workingDir, envVars, watchMode, host) { const source = Observable.from([{ cwd: workingDir, env: envVars, exitCode: 0 }]); return commands.reduce((prev, command) => createCommandExecutor(command, prev, watchMode, host), sour...
javascript
function createSequencialCommandExecutor (commands, workingDir, envVars, watchMode, host) { const source = Observable.from([{ cwd: workingDir, env: envVars, exitCode: 0 }]); return commands.reduce((prev, command) => createCommandExecutor(command, prev, watchMode, host), sour...
[ "function", "createSequencialCommandExecutor", "(", "commands", ",", "workingDir", ",", "envVars", ",", "watchMode", ",", "host", ")", "{", "const", "source", "=", "Observable", ".", "from", "(", "[", "{", "cwd", ":", "workingDir", ",", "env", ":", "envVars"...
Create an Observable that would execute a sequence of commands. @param commands {string[]} A sequence of commands to execute @param workingDir {string} Initial Working Directory @param envVars {Object} Initial environment variables @param watchMode {boolean} Whether to execute watchers or not @param host {{spawn: Func...
[ "Create", "an", "Observable", "that", "would", "execute", "a", "sequence", "of", "commands", "." ]
52919bab419bbda36a02524b6897333e52ec2a94
https://github.com/dfahlander/just-build/blob/52919bab419bbda36a02524b6897333e52ec2a94/src/execute.js#L144-L153
34,134
dfahlander/just-build
src/dirutils.js
getPackageRoot
function getPackageRoot (dir) { let lastDir = null; while (lastDir !== dir && !fs.existsSync(path.resolve(dir, "./package.json"))) { lastDir = dir; dir = path.dirname(dir); } return (lastDir === dir ? null : dir); }
javascript
function getPackageRoot (dir) { let lastDir = null; while (lastDir !== dir && !fs.existsSync(path.resolve(dir, "./package.json"))) { lastDir = dir; dir = path.dirname(dir); } return (lastDir === dir ? null : dir); }
[ "function", "getPackageRoot", "(", "dir", ")", "{", "let", "lastDir", "=", "null", ";", "while", "(", "lastDir", "!==", "dir", "&&", "!", "fs", ".", "existsSync", "(", "path", ".", "resolve", "(", "dir", ",", "\"./package.json\"", ")", ")", ")", "{", ...
Navigates upwards to the closest dir that contains a 'package.json'. @param dir {string} Directory to start from.
[ "Navigates", "upwards", "to", "the", "closest", "dir", "that", "contains", "a", "package", ".", "json", "." ]
52919bab419bbda36a02524b6897333e52ec2a94
https://github.com/dfahlander/just-build/blob/52919bab419bbda36a02524b6897333e52ec2a94/src/dirutils.js#L7-L14
34,135
liferay/liferay-module-config-generator
lib/config-generator.js
function() { var self = this; self._modules = []; return new Promise(function(resolve, reject) { var base; var processors = []; if (self._options.base) { base = fs.readFileSync(path.resolve(self._options.base), 'utf8'); } ...
javascript
function() { var self = this; self._modules = []; return new Promise(function(resolve, reject) { var base; var processors = []; if (self._options.base) { base = fs.readFileSync(path.resolve(self._options.base), 'utf8'); } ...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "self", ".", "_modules", "=", "[", "]", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "base", ";", "var", "processors", "=", "[", "]", ...
Processes the passed files or folders and generates config file. @method process @return {Promise} Returns a Promise which will be resolved with the generated config file
[ "Processes", "the", "passed", "files", "or", "folders", "and", "generates", "config", "file", "." ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L37-L98
34,136
liferay/liferay-module-config-generator
lib/config-generator.js
function(ast) { var self = this; var found; var meta = ast; var values = {}; jsstana.traverse(ast, function(node) { if (!found) { var match = jsstana.match('(ident META)', node); if (match) { jsstana.traverse(meta...
javascript
function(ast) { var self = this; var found; var meta = ast; var values = {}; jsstana.traverse(ast, function(node) { if (!found) { var match = jsstana.match('(ident META)', node); if (match) { jsstana.traverse(meta...
[ "function", "(", "ast", ")", "{", "var", "self", "=", "this", ";", "var", "found", ";", "var", "meta", "=", "ast", ";", "var", "values", "=", "{", "}", ";", "jsstana", ".", "traverse", "(", "ast", ",", "function", "(", "node", ")", "{", "if", "...
Extracts conditions from a module configuration. @method _extractCondition @protected @param {Object} ast AST to be processed @return {Object} The extracted values for the conditional options
[ "Extracts", "conditions", "from", "a", "module", "configuration", "." ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L108-L139
34,137
liferay/liferay-module-config-generator
lib/config-generator.js
function(idents, ast) { var self = this; var result = Object.create(null); var found; var ident; if (ast) { jsstana.traverse(ast, function(node) { if (found) { found = false; result[ident] = self._extractValue...
javascript
function(idents, ast) { var self = this; var result = Object.create(null); var found; var ident; if (ast) { jsstana.traverse(ast, function(node) { if (found) { found = false; result[ident] = self._extractValue...
[ "function", "(", "idents", ",", "ast", ")", "{", "var", "self", "=", "this", ";", "var", "result", "=", "Object", ".", "create", "(", "null", ")", ";", "var", "found", ";", "var", "ident", ";", "if", "(", "ast", ")", "{", "jsstana", ".", "travers...
Extract values for some idents from an AST. @method _extractObjectValues @param {Array} idents The idents which values should be looked up in the AST @param {AST} ast The AST to be processed @return {Object} An object with the extracted values for all found idents
[ "Extract", "values", "for", "some", "idents", "from", "an", "AST", "." ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L149-L177
34,138
liferay/liferay-module-config-generator
lib/config-generator.js
function(node) { var self = this; var i; if (node.type === 'Literal') { return node.value; } else if (node.type === 'ObjectExpression') { var obj = {}; for (i = 0; i < node.properties.length; i++) { var property = node.properties[i];...
javascript
function(node) { var self = this; var i; if (node.type === 'Literal') { return node.value; } else if (node.type === 'ObjectExpression') { var obj = {}; for (i = 0; i < node.properties.length; i++) { var property = node.properties[i];...
[ "function", "(", "node", ")", "{", "var", "self", "=", "this", ";", "var", "i", ";", "if", "(", "node", ".", "type", "===", "'Literal'", ")", "{", "return", "node", ".", "value", ";", "}", "else", "if", "(", "node", ".", "type", "===", "'ObjectEx...
Extracts the value from a jsstana node. The value may be Literal, ObjectExpression, ArrayExpression or FunctionExpression. @method _extractValue @protected @param {Object} node jsstana node which should be processed @return {String} The extracted value from the node
[ "Extracts", "the", "value", "from", "a", "jsstana", "node", ".", "The", "value", "may", "be", "Literal", "ObjectExpression", "ArrayExpression", "or", "FunctionExpression", "." ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L188-L219
34,139
liferay/liferay-module-config-generator
lib/config-generator.js
function() { var self = this; return new Promise(function(resolve, reject) { var config = {}; for (var i = 0; i < self._modules.length; i++) { var module = self._modules[i]; var storedModule = config[module.name] = { dependen...
javascript
function() { var self = this; return new Promise(function(resolve, reject) { var config = {}; for (var i = 0; i < self._modules.length; i++) { var module = self._modules[i]; var storedModule = config[module.name] = { dependen...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "config", "=", "{", "}", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "self", ".",...
Generates a config object from all found modules. @method _generateConfig @protected @return {Promise} Returns a Promise which will be resolved with the generated configuration
[ "Generates", "a", "config", "object", "from", "all", "found", "modules", "." ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L228-L260
34,140
liferay/liferay-module-config-generator
lib/config-generator.js
function(file) { var self = this; var ext; if (!self._options.keepExtension) { ext = self._options.extension || path.extname(file); } var fileName = path.basename(file, ext); if (self._options.format) { var formatRegex = self._options.format[0]...
javascript
function(file) { var self = this; var ext; if (!self._options.keepExtension) { ext = self._options.extension || path.extname(file); } var fileName = path.basename(file, ext); if (self._options.format) { var formatRegex = self._options.format[0]...
[ "function", "(", "file", ")", "{", "var", "self", "=", "this", ";", "var", "ext", ";", "if", "(", "!", "self", ".", "_options", ".", "keepExtension", ")", "{", "ext", "=", "self", ".", "_options", ".", "extension", "||", "path", ".", "extname", "("...
Generates a module name in case it is not present in the AMD definition. @method _generateModuleName @protected @param {String} file The file path to be processed and module name to be generated @return {String} The generated module name
[ "Generates", "a", "module", "name", "in", "case", "it", "is", "not", "present", "in", "the", "AMD", "definition", "." ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L270-L322
34,141
liferay/liferay-module-config-generator
lib/config-generator.js
function(root, fileStats, next) { var self = this; var file = path.join(root, fileStats.name); if (minimatch(file, self._options.filePattern, { dot: true })) { self._processFile(file) .then(function(config) { next(); ...
javascript
function(root, fileStats, next) { var self = this; var file = path.join(root, fileStats.name); if (minimatch(file, self._options.filePattern, { dot: true })) { self._processFile(file) .then(function(config) { next(); ...
[ "function", "(", "root", ",", "fileStats", ",", "next", ")", "{", "var", "self", "=", "this", ";", "var", "file", "=", "path", ".", "join", "(", "root", ",", "fileStats", ".", "name", ")", ";", "if", "(", "minimatch", "(", "file", ",", "self", "....
Listener which will be invoked when a file whiting the provided folder is found @method _onWalkerFile @protected @param {String} root The root directory of the file @param {Object} fileStats Object with data about the file @param {Function} next A callback function to be called once the file is processed
[ "Listener", "which", "will", "be", "invoked", "when", "a", "file", "whiting", "the", "provided", "folder", "is", "found" ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L436-L451
34,142
liferay/liferay-module-config-generator
lib/config-generator.js
function(file, content) { return new Promise(function(resolve, reject) { var ast = recast.parse(content); resolve(ast); }); }
javascript
function(file, content) { return new Promise(function(resolve, reject) { var ast = recast.parse(content); resolve(ast); }); }
[ "function", "(", "file", ",", "content", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "ast", "=", "recast", ".", "parse", "(", "content", ")", ";", "resolve", "(", "ast", ")", ";", "}", ")",...
Parses the content of a file @method _parseFile @protected @param {String} file The file which should be parsed @param {String} content The content of the file which should be parsed @return {Promise} Returns a Promise which will be resolved with file's AST
[ "Parses", "the", "content", "of", "a", "file" ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L475-L481
34,143
liferay/liferay-module-config-generator
lib/config-generator.js
function(file) { var self = this; return new Promise(function(resolve) { fs.readFileAsync(file, 'utf-8') .then(function(content) { return self._parseFile(file, content); }) .then(function(ast) { return s...
javascript
function(file) { var self = this; return new Promise(function(resolve) { fs.readFileAsync(file, 'utf-8') .then(function(content) { return self._parseFile(file, content); }) .then(function(ast) { return s...
[ "function", "(", "file", ")", "{", "var", "self", "=", "this", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ")", "{", "fs", ".", "readFileAsync", "(", "file", ",", "'utf-8'", ")", ".", "then", "(", "function", "(", "content", ")"...
Processes a file and generates configuration object for all modules found inside. @method _processFile @protected @param {String} file The file which should be processed @return {Promise} Returns a Promise which will be resolved with the generated config
[ "Processes", "a", "file", "and", "generates", "configuration", "object", "for", "all", "modules", "found", "inside", "." ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L491-L508
34,144
liferay/liferay-module-config-generator
lib/config-generator.js
function(file, ast) { var content = recast.print(ast, { wrapColumn: Number.Infinity }).code; content = this._updateSourceMap(file, content); fs.writeFileSync(file, content); }
javascript
function(file, ast) { var content = recast.print(ast, { wrapColumn: Number.Infinity }).code; content = this._updateSourceMap(file, content); fs.writeFileSync(file, content); }
[ "function", "(", "file", ",", "ast", ")", "{", "var", "content", "=", "recast", ".", "print", "(", "ast", ",", "{", "wrapColumn", ":", "Number", ".", "Infinity", "}", ")", ".", "code", ";", "content", "=", "this", ".", "_updateSourceMap", "(", "file"...
Saves file with the reprinted AST and updated source map, if any. @method _saveFile @protected @param {String} file The file to save @param {Object} ast The AST of the file
[ "Saves", "file", "with", "the", "reprinted", "AST", "and", "updated", "source", "map", "if", "any", "." ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L518-L526
34,145
liferay/liferay-module-config-generator
lib/config-generator.js
function(config) { var self = this; return new Promise(function(resolve, reject) { if (self._options.output) { fs.writeFileAsync(self._options.output, config) .then(function() { resolve(config); }); ...
javascript
function(config) { var self = this; return new Promise(function(resolve, reject) { if (self._options.output) { fs.writeFileAsync(self._options.output, config) .then(function() { resolve(config); }); ...
[ "function", "(", "config", ")", "{", "var", "self", "=", "this", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "if", "(", "self", ".", "_options", ".", "output", ")", "{", "fs", ".", "writeFileAsync", "(",...
Saves the generated configuration file on the hard drive. @method _saveConfig @protected @param {Object} config The configuration object to be saved @return {Promise} Returns a Promise which will be resolved with the generated config file
[ "Saves", "the", "generated", "configuration", "file", "on", "the", "hard", "drive", "." ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L536-L549
34,146
liferay/liferay-module-config-generator
lib/config-generator.js
function(file, content) { var sourceMapURLMatch = REGEX_SOURCEMAP.exec(content); if (sourceMapURLMatch) { var sourceMapURL = sourceMapURLMatch[1]; if (sourceMapURL) { var sourceMapContent = fs.readFileSync(path.resolve(path.dirname(file), sourceMapURL), 'utf-8')...
javascript
function(file, content) { var sourceMapURLMatch = REGEX_SOURCEMAP.exec(content); if (sourceMapURLMatch) { var sourceMapURL = sourceMapURLMatch[1]; if (sourceMapURL) { var sourceMapContent = fs.readFileSync(path.resolve(path.dirname(file), sourceMapURL), 'utf-8')...
[ "function", "(", "file", ",", "content", ")", "{", "var", "sourceMapURLMatch", "=", "REGEX_SOURCEMAP", ".", "exec", "(", "content", ")", ";", "if", "(", "sourceMapURLMatch", ")", "{", "var", "sourceMapURL", "=", "sourceMapURLMatch", "[", "1", "]", ";", "if...
Updates the source and source map of the processed file. @method _updateSourceMap @protected @param {String} file The name of the processed file @param {String} content The content of the processed file @return {String} The modified content after updating the source map
[ "Updates", "the", "source", "and", "source", "map", "of", "the", "processed", "file", "." ]
c8b549dd0058cb39f242bc33ebee59a1a9474734
https://github.com/liferay/liferay-module-config-generator/blob/c8b549dd0058cb39f242bc33ebee59a1a9474734/lib/config-generator.js#L560-L582
34,147
dasuchin/grunt-ssh-deploy
tasks/ssh_deploy.js
function(cmd, showLog, next){ connection.exec(cmd, function(err, stream) { if (err) { grunt.log.errorlns(err); grunt.log.subhead('ERROR DEPLOYING. CLOSING CONNECTION AND DELETING RELEASE.'); deleteRelease(closeC...
javascript
function(cmd, showLog, next){ connection.exec(cmd, function(err, stream) { if (err) { grunt.log.errorlns(err); grunt.log.subhead('ERROR DEPLOYING. CLOSING CONNECTION AND DELETING RELEASE.'); deleteRelease(closeC...
[ "function", "(", "cmd", ",", "showLog", ",", "next", ")", "{", "connection", ".", "exec", "(", "cmd", ",", "function", "(", "err", ",", "stream", ")", "{", "if", "(", "err", ")", "{", "grunt", ".", "log", ".", "errorlns", "(", "err", ")", ";", ...
executes a remote command via ssh
[ "executes", "a", "remote", "command", "via", "ssh" ]
b58d1caa5a79e4204f93caa9c8de2d3e6a6ec6a8
https://github.com/dasuchin/grunt-ssh-deploy/blob/b58d1caa5a79e4204f93caa9c8de2d3e6a6ec6a8/tasks/ssh_deploy.js#L120-L138
34,148
dasuchin/grunt-ssh-deploy
tasks/ssh_deploy.js
function(callback) { connection.end(); client.close(); client.__sftp = null; client.__ssh = null; callback(); }
javascript
function(callback) { connection.end(); client.close(); client.__sftp = null; client.__ssh = null; callback(); }
[ "function", "(", "callback", ")", "{", "connection", ".", "end", "(", ")", ";", "client", ".", "close", "(", ")", ";", "client", ".", "__sftp", "=", "null", ";", "client", ".", "__ssh", "=", "null", ";", "callback", "(", ")", ";", "}" ]
closing connection to remote server
[ "closing", "connection", "to", "remote", "server" ]
b58d1caa5a79e4204f93caa9c8de2d3e6a6ec6a8
https://github.com/dasuchin/grunt-ssh-deploy/blob/b58d1caa5a79e4204f93caa9c8de2d3e6a6ec6a8/tasks/ssh_deploy.js#L268-L276
34,149
Dreamscapes/semantic-merge
lib/merger.js
doMerge
function doMerge(source, target, opts) { return target instanceof Array ? mergeArrays(source, target) : mergeObjects(source, target, opts) }
javascript
function doMerge(source, target, opts) { return target instanceof Array ? mergeArrays(source, target) : mergeObjects(source, target, opts) }
[ "function", "doMerge", "(", "source", ",", "target", ",", "opts", ")", "{", "return", "target", "instanceof", "Array", "?", "mergeArrays", "(", "source", ",", "target", ")", ":", "mergeObjects", "(", "source", ",", "target", ",", "opts", ")", "}" ]
Determine whether we should do an array or object merge @private @param {Object} source Source to merge @param {Object} target Target to merge into @param {Object} opts Options for the merge @return {Object}
[ "Determine", "whether", "we", "should", "do", "an", "array", "or", "object", "merge" ]
212a17034f1bea3eedb15e5a30220a27d55c9366
https://github.com/Dreamscapes/semantic-merge/blob/212a17034f1bea3eedb15e5a30220a27d55c9366/lib/merger.js#L140-L144
34,150
phproberto/joomla-gulp
src/packages.js
getPackages
function getPackages() { var results = []; if (extensions && extensions.hasOwnProperty('packages')) { var sourceArray = extensions.packages; for (index = 0; index < sourceArray.length; ++index) { results.push(sourceArray[index]); } } return results; }
javascript
function getPackages() { var results = []; if (extensions && extensions.hasOwnProperty('packages')) { var sourceArray = extensions.packages; for (index = 0; index < sourceArray.length; ++index) { results.push(sourceArray[index]); } } return results; }
[ "function", "getPackages", "(", ")", "{", "var", "results", "=", "[", "]", ";", "if", "(", "extensions", "&&", "extensions", ".", "hasOwnProperty", "(", "'packages'", ")", ")", "{", "var", "sourceArray", "=", "extensions", ".", "packages", ";", "for", "(...
Get the list of the active packages @return array
[ "Get", "the", "list", "of", "the", "active", "packages" ]
17e0631140db730a7613f87399d0655df1698b30
https://github.com/phproberto/joomla-gulp/blob/17e0631140db730a7613f87399d0655df1698b30/src/packages.js#L17-L29
34,151
phproberto/joomla-gulp
src/packages.js
getPackagesTasks
function getPackagesTasks(baseTask) { var packages = getPackages(); var tasks = []; for (index = 0; index < packages.length; ++index) { tasks.push(baseTask + '.' + packages[index]); } return tasks; }
javascript
function getPackagesTasks(baseTask) { var packages = getPackages(); var tasks = []; for (index = 0; index < packages.length; ++index) { tasks.push(baseTask + '.' + packages[index]); } return tasks; }
[ "function", "getPackagesTasks", "(", "baseTask", ")", "{", "var", "packages", "=", "getPackages", "(", ")", ";", "var", "tasks", "=", "[", "]", ";", "for", "(", "index", "=", "0", ";", "index", "<", "packages", ".", "length", ";", "++", "index", ")",...
Get packages tasks @param string baseTask Task to use as root. Example: 'clean:modules.frontend' @return array
[ "Get", "packages", "tasks" ]
17e0631140db730a7613f87399d0655df1698b30
https://github.com/phproberto/joomla-gulp/blob/17e0631140db730a7613f87399d0655df1698b30/src/packages.js#L38-L47
34,152
jasonreece/css-burrito
js/lib/utils/read-module-directory.js
readModuleDirectory
function readModuleDirectory() { return _fsExtra2.default.existsSync((0, _config2.default)().moduleDirectoryPath()) ? _fsExtra2.default.readdirSync((0, _config2.default)().moduleDirectoryPath(), function (err, files) { return files; }).filter(_isNotModulesImportFile) : []; }
javascript
function readModuleDirectory() { return _fsExtra2.default.existsSync((0, _config2.default)().moduleDirectoryPath()) ? _fsExtra2.default.readdirSync((0, _config2.default)().moduleDirectoryPath(), function (err, files) { return files; }).filter(_isNotModulesImportFile) : []; }
[ "function", "readModuleDirectory", "(", ")", "{", "return", "_fsExtra2", ".", "default", ".", "existsSync", "(", "(", "0", ",", "_config2", ".", "default", ")", "(", ")", ".", "moduleDirectoryPath", "(", ")", ")", "?", "_fsExtra2", ".", "default", ".", "...
if module file exists, return a list of everything in the directory, otherwise return an empty array
[ "if", "module", "file", "exists", "return", "a", "list", "of", "everything", "in", "the", "directory", "otherwise", "return", "an", "empty", "array" ]
f0b98a51f10f4bccc656f4ebf37ff9e0290968ac
https://github.com/jasonreece/css-burrito/blob/f0b98a51f10f4bccc656f4ebf37ff9e0290968ac/js/lib/utils/read-module-directory.js#L24-L28
34,153
ivpusic/sequelize-import
index.js
load
function load(PATH, sequelize, opts) { var files = fs.readdirSync(PATH), models = {}; opts = opts || {}; if (opts.exclude) { removeAll(opts.exclude, files); } files.forEach(function (file) { if (fs.statSync(path.join(PATH, file)).isDirectory()) { models[file] = load(path.join(PATH, file), ...
javascript
function load(PATH, sequelize, opts) { var files = fs.readdirSync(PATH), models = {}; opts = opts || {}; if (opts.exclude) { removeAll(opts.exclude, files); } files.forEach(function (file) { if (fs.statSync(path.join(PATH, file)).isDirectory()) { models[file] = load(path.join(PATH, file), ...
[ "function", "load", "(", "PATH", ",", "sequelize", ",", "opts", ")", "{", "var", "files", "=", "fs", ".", "readdirSync", "(", "PATH", ")", ",", "models", "=", "{", "}", ";", "opts", "=", "opts", "||", "{", "}", ";", "if", "(", "opts", ".", "exc...
Function for searching and loading sequelize models @param {Object} PATH root location to search @param {Object} sequelize sequelize connection @return {Object} @api public
[ "Function", "for", "searching", "and", "loading", "sequelize", "models" ]
1c7135168a14b2dcc3f33afa20a71702f9a46d71
https://github.com/ivpusic/sequelize-import/blob/1c7135168a14b2dcc3f33afa20a71702f9a46d71/index.js#L32-L51
34,154
fex-team/yog2-kernel
plugins/dispatcher/dispatcher.js
wrapAsyncFunction
function wrapAsyncFunction(fn, isSubAction) { if (!fn || fn.__asyncWrapped__) { return fn; } var wrapedFn = fn; if (typeof fn === 'function') { wrapedFn = function asyncWrap(req, res, next) { var maybePromise = fn(req, res, next); i...
javascript
function wrapAsyncFunction(fn, isSubAction) { if (!fn || fn.__asyncWrapped__) { return fn; } var wrapedFn = fn; if (typeof fn === 'function') { wrapedFn = function asyncWrap(req, res, next) { var maybePromise = fn(req, res, next); i...
[ "function", "wrapAsyncFunction", "(", "fn", ",", "isSubAction", ")", "{", "if", "(", "!", "fn", "||", "fn", ".", "__asyncWrapped__", ")", "{", "return", "fn", ";", "}", "var", "wrapedFn", "=", "fn", ";", "if", "(", "typeof", "fn", "===", "'function'", ...
warp a action method to catch async error @param {Function} fn [description] @return {[type]} [description]
[ "warp", "a", "action", "method", "to", "catch", "async", "error" ]
8446ec4822706d7b112000f64453655c20f9be77
https://github.com/fex-team/yog2-kernel/blob/8446ec4822706d7b112000f64453655c20f9be77/plugins/dispatcher/dispatcher.js#L186-L212
34,155
phproberto/joomla-gulp
src/templates.js
getTemplates
function getTemplates(app) { var results = []; if (extensions && extensions.hasOwnProperty('templates') && extensions.templates.hasOwnProperty(app) ) { var sourceArray = extensions.templates[app]; for (index = 0; index < sourceArray.length; ++index) { results.push(app + '.' + sourceArray[index]); } ...
javascript
function getTemplates(app) { var results = []; if (extensions && extensions.hasOwnProperty('templates') && extensions.templates.hasOwnProperty(app) ) { var sourceArray = extensions.templates[app]; for (index = 0; index < sourceArray.length; ++index) { results.push(app + '.' + sourceArray[index]); } ...
[ "function", "getTemplates", "(", "app", ")", "{", "var", "results", "=", "[", "]", ";", "if", "(", "extensions", "&&", "extensions", ".", "hasOwnProperty", "(", "'templates'", ")", "&&", "extensions", ".", "templates", ".", "hasOwnProperty", "(", "app", ")...
Get the available templates @param string app 'frontend' | 'backend' @return array
[ "Get", "the", "available", "templates" ]
17e0631140db730a7613f87399d0655df1698b30
https://github.com/phproberto/joomla-gulp/blob/17e0631140db730a7613f87399d0655df1698b30/src/templates.js#L19-L33
34,156
Microsoft/Essex-PowerBI-visuals-base
packages/oss-report-builder/index.js
parseNPMLL
function parseNPMLL(cb) { /* read the original package.json file and parse it */ const packagePath = path.join(process.cwd(), 'package.json') const packageJsonContent = fs.readFileSync(packagePath, 'utf8') const packageJson = JSON.parse(packageJsonContent) /* save a version of package.json with the privateSubmodu...
javascript
function parseNPMLL(cb) { /* read the original package.json file and parse it */ const packagePath = path.join(process.cwd(), 'package.json') const packageJsonContent = fs.readFileSync(packagePath, 'utf8') const packageJson = JSON.parse(packageJsonContent) /* save a version of package.json with the privateSubmodu...
[ "function", "parseNPMLL", "(", "cb", ")", "{", "/* read the original package.json file and parse it */", "const", "packagePath", "=", "path", ".", "join", "(", "process", ".", "cwd", "(", ")", ",", "'package.json'", ")", "const", "packageJsonContent", "=", "fs", "...
Parses the output of `npm ll` making sure that the private sub-modules are included in the report. @method parseNPMLL @param {Function} cb - Callback to be invoked when the operation is complete.
[ "Parses", "the", "output", "of", "npm", "ll", "making", "sure", "that", "the", "private", "sub", "-", "modules", "are", "included", "in", "the", "report", "." ]
effd9357d32860624ee1f8a0e825641697be95e1
https://github.com/Microsoft/Essex-PowerBI-visuals-base/blob/effd9357d32860624ee1f8a0e825641697be95e1/packages/oss-report-builder/index.js#L43-L83
34,157
Microsoft/Essex-PowerBI-visuals-base
packages/oss-report-builder/index.js
readObjectValue
function readObjectValue(object) { let result = '' if (typeof object === 'string' || object instanceof String) { result = object } else if (typeof object === 'number' || object instanceof Number) { result = object.toString() } else if (object) { Object.keys(object).forEach(key => { result += key + ': ' + ...
javascript
function readObjectValue(object) { let result = '' if (typeof object === 'string' || object instanceof String) { result = object } else if (typeof object === 'number' || object instanceof Number) { result = object.toString() } else if (object) { Object.keys(object).forEach(key => { result += key + ': ' + ...
[ "function", "readObjectValue", "(", "object", ")", "{", "let", "result", "=", "''", "if", "(", "typeof", "object", "===", "'string'", "||", "object", "instanceof", "String", ")", "{", "result", "=", "object", "}", "else", "if", "(", "typeof", "object", "...
Converts an object representing a JSON property to a CSV compatible string. @method readObjectValue @param {Object} object - The object to read as a string. @returns {String}
[ "Converts", "an", "object", "representing", "a", "JSON", "property", "to", "a", "CSV", "compatible", "string", "." ]
effd9357d32860624ee1f8a0e825641697be95e1
https://github.com/Microsoft/Essex-PowerBI-visuals-base/blob/effd9357d32860624ee1f8a0e825641697be95e1/packages/oss-report-builder/index.js#L92-L110
34,158
Microsoft/Essex-PowerBI-visuals-base
packages/oss-report-builder/index.js
parseDependencies
function parseDependencies(info, runtimeDependencies, isParentRoot) { const dependencies = info.dependencies const devDependencies = info.devDependencies const nodeModulesPath = path.join(path.resolve('./'), 'node_modules/') let csv = '' /* licence */ /* URL */ /* description */ /* version */ /* type */ /* usage ...
javascript
function parseDependencies(info, runtimeDependencies, isParentRoot) { const dependencies = info.dependencies const devDependencies = info.devDependencies const nodeModulesPath = path.join(path.resolve('./'), 'node_modules/') let csv = '' /* licence */ /* URL */ /* description */ /* version */ /* type */ /* usage ...
[ "function", "parseDependencies", "(", "info", ",", "runtimeDependencies", ",", "isParentRoot", ")", "{", "const", "dependencies", "=", "info", ".", "dependencies", "const", "devDependencies", "=", "info", ".", "devDependencies", "const", "nodeModulesPath", "=", "pat...
Recursively parses the dependencies object withing the given info object and returns them as a CSV string. @method parseDependencies @param {Object} info - An info object containing the `dependencies` property to parse. @param {Object} runtimeDependencies - An Object containing the runtime dependencies of this project...
[ "Recursively", "parses", "the", "dependencies", "object", "withing", "the", "given", "info", "object", "and", "returns", "them", "as", "a", "CSV", "string", "." ]
effd9357d32860624ee1f8a0e825641697be95e1
https://github.com/Microsoft/Essex-PowerBI-visuals-base/blob/effd9357d32860624ee1f8a0e825641697be95e1/packages/oss-report-builder/index.js#L121-L181
34,159
Microsoft/Essex-PowerBI-visuals-base
packages/oss-report-builder/index.js
findRuntimeDependencies
function findRuntimeDependencies(webpackModules) { const runtimeDependencies = {} webpackModules.forEach(module => { const name = module.name if ( name.startsWith('./~/') || name.startsWith('./node_modules/') || name.startsWith('./lib/') ) { const components = name.split('/') let i = 2 let mod...
javascript
function findRuntimeDependencies(webpackModules) { const runtimeDependencies = {} webpackModules.forEach(module => { const name = module.name if ( name.startsWith('./~/') || name.startsWith('./node_modules/') || name.startsWith('./lib/') ) { const components = name.split('/') let i = 2 let mod...
[ "function", "findRuntimeDependencies", "(", "webpackModules", ")", "{", "const", "runtimeDependencies", "=", "{", "}", "webpackModules", ".", "forEach", "(", "module", "=>", "{", "const", "name", "=", "module", ".", "name", "if", "(", "name", ".", "startsWith"...
Finds the runtime dependencies in the given webpack modules and adds the dependencies defined in the `alwaysRuntimeDependencies` object. @method findRuntimeDependencies @param {Object} webpackModules - An object containing the dependencies as obtaining from compiling the project using webpack. @returns {Object}
[ "Finds", "the", "runtime", "dependencies", "in", "the", "given", "webpack", "modules", "and", "adds", "the", "dependencies", "defined", "in", "the", "alwaysRuntimeDependencies", "object", "." ]
effd9357d32860624ee1f8a0e825641697be95e1
https://github.com/Microsoft/Essex-PowerBI-visuals-base/blob/effd9357d32860624ee1f8a0e825641697be95e1/packages/oss-report-builder/index.js#L191-L213
34,160
Microsoft/Essex-PowerBI-visuals-base
packages/oss-report-builder/index.js
buildOSSReport
function buildOSSReport(webpackModules, cb) { parseNPMLL(dependencies => { const runtimeDependencies = findRuntimeDependencies(webpackModules) const dependenciesCSV = parseDependencies( dependencies, runtimeDependencies, true ) cb( '"Dependency","Version","Type","Usage","Included In Product","In Gi...
javascript
function buildOSSReport(webpackModules, cb) { parseNPMLL(dependencies => { const runtimeDependencies = findRuntimeDependencies(webpackModules) const dependenciesCSV = parseDependencies( dependencies, runtimeDependencies, true ) cb( '"Dependency","Version","Type","Usage","Included In Product","In Gi...
[ "function", "buildOSSReport", "(", "webpackModules", ",", "cb", ")", "{", "parseNPMLL", "(", "dependencies", "=>", "{", "const", "runtimeDependencies", "=", "findRuntimeDependencies", "(", "webpackModules", ")", "const", "dependenciesCSV", "=", "parseDependencies", "(...
Builds an OSS report for this project taking into account the specified webpack dependencies. @method buildOSSReport @param {Object} webpackModules - An object containing the dependencies as obtaining from compiling the project using webpack. @param {Function} cb - A callback function to be invoked qhen the process is...
[ "Builds", "an", "OSS", "report", "for", "this", "project", "taking", "into", "account", "the", "specified", "webpack", "dependencies", "." ]
effd9357d32860624ee1f8a0e825641697be95e1
https://github.com/Microsoft/Essex-PowerBI-visuals-base/blob/effd9357d32860624ee1f8a0e825641697be95e1/packages/oss-report-builder/index.js#L222-L235
34,161
hammerlab/vcf.js
vcf.js
maybeMapOverVal
function maybeMapOverVal(fn, val) { var vals = val.split(','); if (vals.length > 1) { return vals.map(function(v) { return v == '.' ? null : fn(v); }); } return val == '.' ? null : fn(val); }
javascript
function maybeMapOverVal(fn, val) { var vals = val.split(','); if (vals.length > 1) { return vals.map(function(v) { return v == '.' ? null : fn(v); }); } return val == '.' ? null : fn(val); }
[ "function", "maybeMapOverVal", "(", "fn", ",", "val", ")", "{", "var", "vals", "=", "val", ".", "split", "(", "','", ")", ";", "if", "(", "vals", ".", "length", ">", "1", ")", "{", "return", "vals", ".", "map", "(", "function", "(", "v", ")", "...
VCF values can be comma-separated lists, so here we want to convert them into lists of the proper type, else return the singleton value of that type. All values are also nullable, signified with a '.', we want to watch out for those as well.
[ "VCF", "values", "can", "be", "comma", "-", "separated", "lists", "so", "here", "we", "want", "to", "convert", "them", "into", "lists", "of", "the", "proper", "type", "else", "return", "the", "singleton", "value", "of", "that", "type", ".", "All", "value...
017583ddf5a5b02d2a538ffd1e85c41c3ffeefa1
https://github.com/hammerlab/vcf.js/blob/017583ddf5a5b02d2a538ffd1e85c41c3ffeefa1/vcf.js#L33-L39
34,162
hammerlab/vcf.js
vcf.js
parseVCF
function parseVCF(text) { var lines = U.reject(text.split('\n'), function(line) { return line === ''; }); var partitions = U.partition(lines, function(line) { return line[0] === '#'; }); var header = parseHeader(partitions[0]), records = U.map(partitions[1], function(line) { ...
javascript
function parseVCF(text) { var lines = U.reject(text.split('\n'), function(line) { return line === ''; }); var partitions = U.partition(lines, function(line) { return line[0] === '#'; }); var header = parseHeader(partitions[0]), records = U.map(partitions[1], function(line) { ...
[ "function", "parseVCF", "(", "text", ")", "{", "var", "lines", "=", "U", ".", "reject", "(", "text", ".", "split", "(", "'\\n'", ")", ",", "function", "(", "line", ")", "{", "return", "line", "===", "''", ";", "}", ")", ";", "var", "partitions", ...
Returns a parsed VCF object, with attributes `records` and `header`. `records` - a list of VCF Records. `header` - an object of the metadata parsed from the VCF header. `text` - VCF plaintext.
[ "Returns", "a", "parsed", "VCF", "object", "with", "attributes", "records", "and", "header", ".", "records", "-", "a", "list", "of", "VCF", "Records", ".", "header", "-", "an", "object", "of", "the", "metadata", "parsed", "from", "the", "VCF", "header", ...
017583ddf5a5b02d2a538ffd1e85c41c3ffeefa1
https://github.com/hammerlab/vcf.js/blob/017583ddf5a5b02d2a538ffd1e85c41c3ffeefa1/vcf.js#L378-L393
34,163
ccbabi/axios-add-jsonp
index.js
runHook
function runHook (instance, type) { var hook = type ? 'response' : 'request' hook += 'Hook' if (instance[hook] && isFunction(instance[hook])) { instance[hook]() } }
javascript
function runHook (instance, type) { var hook = type ? 'response' : 'request' hook += 'Hook' if (instance[hook] && isFunction(instance[hook])) { instance[hook]() } }
[ "function", "runHook", "(", "instance", ",", "type", ")", "{", "var", "hook", "=", "type", "?", "'response'", ":", "'request'", "hook", "+=", "'Hook'", "if", "(", "instance", "[", "hook", "]", "&&", "isFunction", "(", "instance", "[", "hook", "]", ")",...
Every time it is detected, it means that the external dynamic changes
[ "Every", "time", "it", "is", "detected", "it", "means", "that", "the", "external", "dynamic", "changes" ]
64a1fb06e731390bbdbc28a55ab33ad3cde0f25e
https://github.com/ccbabi/axios-add-jsonp/blob/64a1fb06e731390bbdbc28a55ab33ad3cde0f25e/index.js#L76-L82
34,164
jonathantneal/postcss-export-custom-variables
index.js
isCustomMediaQuery
function isCustomMediaQuery(node) { return node.type === 'atrule' && node.name === 'custom-media' && customMediaQueryMatch.test(node.params); }
javascript
function isCustomMediaQuery(node) { return node.type === 'atrule' && node.name === 'custom-media' && customMediaQueryMatch.test(node.params); }
[ "function", "isCustomMediaQuery", "(", "node", ")", "{", "return", "node", ".", "type", "===", "'atrule'", "&&", "node", ".", "name", "===", "'custom-media'", "&&", "customMediaQueryMatch", ".", "test", "(", "node", ".", "params", ")", ";", "}" ]
Variable detection functions
[ "Variable", "detection", "functions" ]
ce15caa33e52cca56b0b95cebfc9f32f3a8e6923
https://github.com/jonathantneal/postcss-export-custom-variables/blob/ce15caa33e52cca56b0b95cebfc9f32f3a8e6923/index.js#L64-L66
34,165
jonathantneal/postcss-export-custom-variables
index.js
defaultAssigner
function defaultAssigner(rawproperty, rawvalue) { const property = rawproperty.replace(/-+(.|$)/g, ([ , letter]) => letter.toUpperCase()); return { [property]: rawvalue }; }
javascript
function defaultAssigner(rawproperty, rawvalue) { const property = rawproperty.replace(/-+(.|$)/g, ([ , letter]) => letter.toUpperCase()); return { [property]: rawvalue }; }
[ "function", "defaultAssigner", "(", "rawproperty", ",", "rawvalue", ")", "{", "const", "property", "=", "rawproperty", ".", "replace", "(", "/", "-+(.|$)", "/", "g", ",", "(", "[", ",", "letter", "]", ")", "=>", "letter", ".", "toUpperCase", "(", ")", ...
Default Assigner functions
[ "Default", "Assigner", "functions" ]
ce15caa33e52cca56b0b95cebfc9f32f3a8e6923
https://github.com/jonathantneal/postcss-export-custom-variables/blob/ce15caa33e52cca56b0b95cebfc9f32f3a8e6923/index.js#L82-L88
34,166
jonathantneal/postcss-export-custom-variables
index.js
defaultJsExporter
function defaultJsExporter(variables, options, root) { const pathname = options.destination || root.source && root.source.input && root.source.input.file && root.source.input.file + '.js' || 'custom-variables.js'; const contents = Object.keys(variables).reduce( (buffer, key) => `${ buffer }export const ${ key } = $...
javascript
function defaultJsExporter(variables, options, root) { const pathname = options.destination || root.source && root.source.input && root.source.input.file && root.source.input.file + '.js' || 'custom-variables.js'; const contents = Object.keys(variables).reduce( (buffer, key) => `${ buffer }export const ${ key } = $...
[ "function", "defaultJsExporter", "(", "variables", ",", "options", ",", "root", ")", "{", "const", "pathname", "=", "options", ".", "destination", "||", "root", ".", "source", "&&", "root", ".", "source", ".", "input", "&&", "root", ".", "source", ".", "...
Default export functions
[ "Default", "export", "functions" ]
ce15caa33e52cca56b0b95cebfc9f32f3a8e6923
https://github.com/jonathantneal/postcss-export-custom-variables/blob/ce15caa33e52cca56b0b95cebfc9f32f3a8e6923/index.js#L109-L123
34,167
jpodwys/cache-service
cacheService.js
checkCacheResponse
function checkCacheResponse(key, err, result, type, cacheIndex){ if(err){ log(true, 'Error when getting key ' + key + ' from cache of type ' + type + ':', err); if(cacheIndex < self.caches.length - 1){ return {status:'continue'}; } } //THIS ALLOWS false AS A VALID CACHE VALUE, BUT...
javascript
function checkCacheResponse(key, err, result, type, cacheIndex){ if(err){ log(true, 'Error when getting key ' + key + ' from cache of type ' + type + ':', err); if(cacheIndex < self.caches.length - 1){ return {status:'continue'}; } } //THIS ALLOWS false AS A VALID CACHE VALUE, BUT...
[ "function", "checkCacheResponse", "(", "key", ",", "err", ",", "result", ",", "type", ",", "cacheIndex", ")", "{", "if", "(", "err", ")", "{", "log", "(", "true", ",", "'Error when getting key '", "+", "key", "+", "' from cache of type '", "+", "type", "+"...
Decides what action cacheService should take given the response from a configured cache @param {string} key @param {null | object} err @param {null | object | string} result @param {string} type @param {integer} cacheIndex
[ "Decides", "what", "action", "cacheService", "should", "take", "given", "the", "response", "from", "a", "configured", "cache" ]
cffc91b262b9dd2f6529628fda5782ed985bfaaf
https://github.com/jpodwys/cache-service/blob/cffc91b262b9dd2f6529628fda5782ed985bfaaf/cacheService.js#L253-L274
34,168
jpodwys/cache-service
cacheService.js
writeToVolatileCaches
function writeToVolatileCaches(currentCacheIndex, key, value){ if(currentCacheIndex > 0){ var curExpiration = self.caches[currentCacheIndex].expiration; for(var tempIndex = currentCacheIndex; tempIndex > -1; tempIndex--){ var preExpiration = self.caches[tempIndex].expiration; if(preExpir...
javascript
function writeToVolatileCaches(currentCacheIndex, key, value){ if(currentCacheIndex > 0){ var curExpiration = self.caches[currentCacheIndex].expiration; for(var tempIndex = currentCacheIndex; tempIndex > -1; tempIndex--){ var preExpiration = self.caches[tempIndex].expiration; if(preExpir...
[ "function", "writeToVolatileCaches", "(", "currentCacheIndex", ",", "key", ",", "value", ")", "{", "if", "(", "currentCacheIndex", ">", "0", ")", "{", "var", "curExpiration", "=", "self", ".", "caches", "[", "currentCacheIndex", "]", ".", "expiration", ";", ...
Writes data to caches that appear before the current cache in caches @param {integer} currentCacheIndex @param {string} key @param {null | object | string} value
[ "Writes", "data", "to", "caches", "that", "appear", "before", "the", "current", "cache", "in", "caches" ]
cffc91b262b9dd2f6529628fda5782ed985bfaaf
https://github.com/jpodwys/cache-service/blob/cffc91b262b9dd2f6529628fda5782ed985bfaaf/cacheService.js#L282-L298
34,169
jpodwys/cache-service
cacheService.js
log
function log(isError, message, data){ var indentifier = 'cacheService: '; if(self.verbose || isError){ if(data) { console.log(indentifier + message, data); } else { console.log(indentifier + message); } } }
javascript
function log(isError, message, data){ var indentifier = 'cacheService: '; if(self.verbose || isError){ if(data) { console.log(indentifier + message, data); } else { console.log(indentifier + message); } } }
[ "function", "log", "(", "isError", ",", "message", ",", "data", ")", "{", "var", "indentifier", "=", "'cacheService: '", ";", "if", "(", "self", ".", "verbose", "||", "isError", ")", "{", "if", "(", "data", ")", "{", "console", ".", "log", "(", "inde...
Logging utility function @param {boolean} isError @param {string} message @param {object} data
[ "Logging", "utility", "function" ]
cffc91b262b9dd2f6529628fda5782ed985bfaaf
https://github.com/jpodwys/cache-service/blob/cffc91b262b9dd2f6529628fda5782ed985bfaaf/cacheService.js#L317-L326
34,170
phproberto/joomla-gulp
src/plugins.js
getPlugins
function getPlugins() { var results = [] if (extensions && extensions.hasOwnProperty('plugins')) { for(var type in extensions.plugins) { var sourceArray = extensions.plugins[type]; for (index = 0; index < sourceArray.length; ++index) { results.push(type + '.' + sourceArray[index]); } } } ret...
javascript
function getPlugins() { var results = [] if (extensions && extensions.hasOwnProperty('plugins')) { for(var type in extensions.plugins) { var sourceArray = extensions.plugins[type]; for (index = 0; index < sourceArray.length; ++index) { results.push(type + '.' + sourceArray[index]); } } } ret...
[ "function", "getPlugins", "(", ")", "{", "var", "results", "=", "[", "]", "if", "(", "extensions", "&&", "extensions", ".", "hasOwnProperty", "(", "'plugins'", ")", ")", "{", "for", "(", "var", "type", "in", "extensions", ".", "plugins", ")", "{", "var...
Get the list of available plugins @return array
[ "Get", "the", "list", "of", "available", "plugins" ]
17e0631140db730a7613f87399d0655df1698b30
https://github.com/phproberto/joomla-gulp/blob/17e0631140db730a7613f87399d0655df1698b30/src/plugins.js#L17-L33
34,171
phproberto/joomla-gulp
src/plugins.js
getPluginsTasks
function getPluginsTasks(baseTask) { var tasks = []; var plugins = getPlugins(); if (plugins) { for (pos = 0; pos < plugins.length; ++pos) { tasks.push(baseTask + '.' + plugins[pos]); } } return tasks; }
javascript
function getPluginsTasks(baseTask) { var tasks = []; var plugins = getPlugins(); if (plugins) { for (pos = 0; pos < plugins.length; ++pos) { tasks.push(baseTask + '.' + plugins[pos]); } } return tasks; }
[ "function", "getPluginsTasks", "(", "baseTask", ")", "{", "var", "tasks", "=", "[", "]", ";", "var", "plugins", "=", "getPlugins", "(", ")", ";", "if", "(", "plugins", ")", "{", "for", "(", "pos", "=", "0", ";", "pos", "<", "plugins", ".", "length"...
Function to ease the custom plugins management @param string baseTask Task to use as root. Example: 'clean:plugins.frontend' @param string app 'frontend', 'backend' @return array
[ "Function", "to", "ease", "the", "custom", "plugins", "management" ]
17e0631140db730a7613f87399d0655df1698b30
https://github.com/phproberto/joomla-gulp/blob/17e0631140db730a7613f87399d0655df1698b30/src/plugins.js#L43-L54
34,172
phproberto/joomla-gulp
src/modules.js
getModules
function getModules(app) { var results = []; if (extensions && extensions.hasOwnProperty('modules') && extensions.modules.hasOwnProperty(app) ) { var sourceArray = extensions.modules[app]; for (index = 0; index < sourceArray.length; ++index) { results.push(app + '.' + sourceArray[index]); } } retu...
javascript
function getModules(app) { var results = []; if (extensions && extensions.hasOwnProperty('modules') && extensions.modules.hasOwnProperty(app) ) { var sourceArray = extensions.modules[app]; for (index = 0; index < sourceArray.length; ++index) { results.push(app + '.' + sourceArray[index]); } } retu...
[ "function", "getModules", "(", "app", ")", "{", "var", "results", "=", "[", "]", ";", "if", "(", "extensions", "&&", "extensions", ".", "hasOwnProperty", "(", "'modules'", ")", "&&", "extensions", ".", "modules", ".", "hasOwnProperty", "(", "app", ")", "...
Get the available modules from paths @param string app 'frontend' | 'backend' @return array
[ "Get", "the", "available", "modules", "from", "paths" ]
17e0631140db730a7613f87399d0655df1698b30
https://github.com/phproberto/joomla-gulp/blob/17e0631140db730a7613f87399d0655df1698b30/src/modules.js#L19-L33
34,173
phproberto/joomla-gulp
src/modules.js
getModulesTasks
function getModulesTasks(baseTask, app) { var tasks = []; var modules = getModules(app); if (modules) { for (index = 0; index < modules.length; ++index) { tasks.push(baseTask + '.' + modules[index]); } } return tasks; }
javascript
function getModulesTasks(baseTask, app) { var tasks = []; var modules = getModules(app); if (modules) { for (index = 0; index < modules.length; ++index) { tasks.push(baseTask + '.' + modules[index]); } } return tasks; }
[ "function", "getModulesTasks", "(", "baseTask", ",", "app", ")", "{", "var", "tasks", "=", "[", "]", ";", "var", "modules", "=", "getModules", "(", "app", ")", ";", "if", "(", "modules", ")", "{", "for", "(", "index", "=", "0", ";", "index", "<", ...
Function to ease the modules management @param string baseTask Task to use as root. Example: 'clean:modules' @param string app 'frontend', 'backend' @return array
[ "Function", "to", "ease", "the", "modules", "management" ]
17e0631140db730a7613f87399d0655df1698b30
https://github.com/phproberto/joomla-gulp/blob/17e0631140db730a7613f87399d0655df1698b30/src/modules.js#L43-L54
34,174
phproberto/joomla-gulp
src/components.js
getComponents
function getComponents() { var results = []; if (extensions && extensions.hasOwnProperty('components')) { var sourceArray = extensions.components; for (index = 0; index < sourceArray.length; ++index) { results.push(sourceArray[index]); } } return results; }
javascript
function getComponents() { var results = []; if (extensions && extensions.hasOwnProperty('components')) { var sourceArray = extensions.components; for (index = 0; index < sourceArray.length; ++index) { results.push(sourceArray[index]); } } return results; }
[ "function", "getComponents", "(", ")", "{", "var", "results", "=", "[", "]", ";", "if", "(", "extensions", "&&", "extensions", ".", "hasOwnProperty", "(", "'components'", ")", ")", "{", "var", "sourceArray", "=", "extensions", ".", "components", ";", "for"...
Get the list of the active components from paths @return array
[ "Get", "the", "list", "of", "the", "active", "components", "from", "paths" ]
17e0631140db730a7613f87399d0655df1698b30
https://github.com/phproberto/joomla-gulp/blob/17e0631140db730a7613f87399d0655df1698b30/src/components.js#L17-L29
34,175
phproberto/joomla-gulp
src/components.js
getComponentsTasks
function getComponentsTasks(baseTask) { var components = getComponents(); var tasks = []; for (index = 0; index < components.length; ++index) { tasks.push(baseTask + '.' + components[index]); } return tasks; }
javascript
function getComponentsTasks(baseTask) { var components = getComponents(); var tasks = []; for (index = 0; index < components.length; ++index) { tasks.push(baseTask + '.' + components[index]); } return tasks; }
[ "function", "getComponentsTasks", "(", "baseTask", ")", "{", "var", "components", "=", "getComponents", "(", ")", ";", "var", "tasks", "=", "[", "]", ";", "for", "(", "index", "=", "0", ";", "index", "<", "components", ".", "length", ";", "++", "index"...
Function to ease the components @param string baseTask Task to use as root. Example: 'clean:modules.frontend' @return array
[ "Function", "to", "ease", "the", "components" ]
17e0631140db730a7613f87399d0655df1698b30
https://github.com/phproberto/joomla-gulp/blob/17e0631140db730a7613f87399d0655df1698b30/src/components.js#L38-L47
34,176
alekseykulikov/storage
lib/index.js
get
function get(key, cb) { return type(key) != 'array' ? localForage.getItem(key).then(wrap(cb, true), cb) : Promise.all(key.map(getSubkey)).then(wrap(cb, true), cb); function getSubkey(key) { return get(key, function() {}); // noob function to prevent logs } }
javascript
function get(key, cb) { return type(key) != 'array' ? localForage.getItem(key).then(wrap(cb, true), cb) : Promise.all(key.map(getSubkey)).then(wrap(cb, true), cb); function getSubkey(key) { return get(key, function() {}); // noob function to prevent logs } }
[ "function", "get", "(", "key", ",", "cb", ")", "{", "return", "type", "(", "key", ")", "!=", "'array'", "?", "localForage", ".", "getItem", "(", "key", ")", ".", "then", "(", "wrap", "(", "cb", ",", "true", ")", ",", "cb", ")", ":", "Promise", ...
Get `key`. @param {Array|Mixed} key @param {Function} cb
[ "Get", "key", "." ]
7ce45bcd9b3f61ae94914fd63fcacd06760e00b1
https://github.com/alekseykulikov/storage/blob/7ce45bcd9b3f61ae94914fd63fcacd06760e00b1/lib/index.js#L62-L70
34,177
alekseykulikov/storage
lib/index.js
set
function set(key, val, cb) { return type(key) != 'object' ? localForage.setItem(key, val).then(wrap(cb), cb) : Promise.all(Object.keys(key).map(setSubkey)).then(wrap(val), val); function setSubkey(subkey, next) { return key[subkey] === null ? del(subkey, next) : set(subkey, key[subkey], nex...
javascript
function set(key, val, cb) { return type(key) != 'object' ? localForage.setItem(key, val).then(wrap(cb), cb) : Promise.all(Object.keys(key).map(setSubkey)).then(wrap(val), val); function setSubkey(subkey, next) { return key[subkey] === null ? del(subkey, next) : set(subkey, key[subkey], nex...
[ "function", "set", "(", "key", ",", "val", ",", "cb", ")", "{", "return", "type", "(", "key", ")", "!=", "'object'", "?", "localForage", ".", "setItem", "(", "key", ",", "val", ")", ".", "then", "(", "wrap", "(", "cb", ")", ",", "cb", ")", ":",...
Set `val` to `key`. @param {Array|Mixed} key @param {Mixed} val @param {Function} cb
[ "Set", "val", "to", "key", "." ]
7ce45bcd9b3f61ae94914fd63fcacd06760e00b1
https://github.com/alekseykulikov/storage/blob/7ce45bcd9b3f61ae94914fd63fcacd06760e00b1/lib/index.js#L80-L90
34,178
alekseykulikov/storage
lib/index.js
del
function del(key, cb) { return type(key) != 'array' ? localForage.removeItem(key).then(wrap(cb), cb) : Promise.all(key.map(del)).then(wrap(cb), cb); }
javascript
function del(key, cb) { return type(key) != 'array' ? localForage.removeItem(key).then(wrap(cb), cb) : Promise.all(key.map(del)).then(wrap(cb), cb); }
[ "function", "del", "(", "key", ",", "cb", ")", "{", "return", "type", "(", "key", ")", "!=", "'array'", "?", "localForage", ".", "removeItem", "(", "key", ")", ".", "then", "(", "wrap", "(", "cb", ")", ",", "cb", ")", ":", "Promise", ".", "all", ...
Delete `key`. @param {Array|Mixed} key @param {Function} cb
[ "Delete", "key", "." ]
7ce45bcd9b3f61ae94914fd63fcacd06760e00b1
https://github.com/alekseykulikov/storage/blob/7ce45bcd9b3f61ae94914fd63fcacd06760e00b1/lib/index.js#L99-L103
34,179
alekseykulikov/storage
lib/index.js
wrap
function wrap(cb, hasResult) { return function(res) { if (type(cb) == 'function') { hasResult ? cb(null, res) : cb(); } else if (hasResult && storage.development) { console.log(res); } return res; }; }
javascript
function wrap(cb, hasResult) { return function(res) { if (type(cb) == 'function') { hasResult ? cb(null, res) : cb(); } else if (hasResult && storage.development) { console.log(res); } return res; }; }
[ "function", "wrap", "(", "cb", ",", "hasResult", ")", "{", "return", "function", "(", "res", ")", "{", "if", "(", "type", "(", "cb", ")", "==", "'function'", ")", "{", "hasResult", "?", "cb", "(", "null", ",", "res", ")", ":", "cb", "(", ")", "...
Wrap promise style response to callback style. If `cb` does not specified, it uses console.log in development mode. @param {Function} cb @param {Boolean} [hasResult] @return {Function}
[ "Wrap", "promise", "style", "response", "to", "callback", "style", ".", "If", "cb", "does", "not", "specified", "it", "uses", "console", ".", "log", "in", "development", "mode", "." ]
7ce45bcd9b3f61ae94914fd63fcacd06760e00b1
https://github.com/alekseykulikov/storage/blob/7ce45bcd9b3f61ae94914fd63fcacd06760e00b1/lib/index.js#L134-L143
34,180
phproberto/joomla-gulp
src/libraries.js
getLibrariesTasks
function getLibrariesTasks(baseTask) { var libraries = getLibraries(); var tasks = []; for (index = 0; index < libraries.length; ++index) { tasks.push(baseTask + '.' + libraries[index]); } return tasks; }
javascript
function getLibrariesTasks(baseTask) { var libraries = getLibraries(); var tasks = []; for (index = 0; index < libraries.length; ++index) { tasks.push(baseTask + '.' + libraries[index]); } return tasks; }
[ "function", "getLibrariesTasks", "(", "baseTask", ")", "{", "var", "libraries", "=", "getLibraries", "(", ")", ";", "var", "tasks", "=", "[", "]", ";", "for", "(", "index", "=", "0", ";", "index", "<", "libraries", ".", "length", ";", "++", "index", ...
Function to get the tasks to execute on libraries @param string baseTask Task to use as root. Example: 'clean:libraries' @return array
[ "Function", "to", "get", "the", "tasks", "to", "execute", "on", "libraries" ]
17e0631140db730a7613f87399d0655df1698b30
https://github.com/phproberto/joomla-gulp/blob/17e0631140db730a7613f87399d0655df1698b30/src/libraries.js#L38-L47
34,181
jpodwys/cache-service
cacheCollection.js
init
function init(){ self.caches = []; if(isEmpty(cacheModules)){ log(false, 'No cacheModules array provided--using the default configuration.'); getDefaultConfiguration(); } else{ log(false, 'cacheModules array provided--using a custom configuration.'); getCustomConfiguration(); ...
javascript
function init(){ self.caches = []; if(isEmpty(cacheModules)){ log(false, 'No cacheModules array provided--using the default configuration.'); getDefaultConfiguration(); } else{ log(false, 'cacheModules array provided--using a custom configuration.'); getCustomConfiguration(); ...
[ "function", "init", "(", ")", "{", "self", ".", "caches", "=", "[", "]", ";", "if", "(", "isEmpty", "(", "cacheModules", ")", ")", "{", "log", "(", "false", ",", "'No cacheModules array provided--using the default configuration.'", ")", ";", "getDefaultConfigura...
Initialize cacheCollection given the provided constructor params
[ "Initialize", "cacheCollection", "given", "the", "provided", "constructor", "params" ]
cffc91b262b9dd2f6529628fda5782ed985bfaaf
https://github.com/jpodwys/cache-service/blob/cffc91b262b9dd2f6529628fda5782ed985bfaaf/cacheCollection.js#L18-L31
34,182
jpodwys/cache-service
cacheCollection.js
getDefaultConfiguration
function getDefaultConfiguration(){ var CModule = require('cache-service-cache-module'); var cacheModule = new CModule(); cacheModule = addSettings(cacheModule); self.caches.push(cacheModule); }
javascript
function getDefaultConfiguration(){ var CModule = require('cache-service-cache-module'); var cacheModule = new CModule(); cacheModule = addSettings(cacheModule); self.caches.push(cacheModule); }
[ "function", "getDefaultConfiguration", "(", ")", "{", "var", "CModule", "=", "require", "(", "'cache-service-cache-module'", ")", ";", "var", "cacheModule", "=", "new", "CModule", "(", ")", ";", "cacheModule", "=", "addSettings", "(", "cacheModule", ")", ";", ...
Adds a nodeCacheModule instance to self.caches if no cacheModules array is provided
[ "Adds", "a", "nodeCacheModule", "instance", "to", "self", ".", "caches", "if", "no", "cacheModules", "array", "is", "provided" ]
cffc91b262b9dd2f6529628fda5782ed985bfaaf
https://github.com/jpodwys/cache-service/blob/cffc91b262b9dd2f6529628fda5782ed985bfaaf/cacheCollection.js#L36-L41
34,183
jpodwys/cache-service
cacheCollection.js
getCustomConfiguration
function getCustomConfiguration(){ for(var i = 0; i < cacheModules.length; i++){ var cacheModule = cacheModules[i]; if(isEmpty(cacheModule)){ log(true, 'Cache module at index ' + i + ' is \'empty\'.'); continue; } cacheModule = addSettings(cacheModule); self.caches.push...
javascript
function getCustomConfiguration(){ for(var i = 0; i < cacheModules.length; i++){ var cacheModule = cacheModules[i]; if(isEmpty(cacheModule)){ log(true, 'Cache module at index ' + i + ' is \'empty\'.'); continue; } cacheModule = addSettings(cacheModule); self.caches.push...
[ "function", "getCustomConfiguration", "(", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "cacheModules", ".", "length", ";", "i", "++", ")", "{", "var", "cacheModule", "=", "cacheModules", "[", "i", "]", ";", "if", "(", "isEmpty", "(", ...
Adds caches that are not 'empty' from the cacheModules array to self.caches
[ "Adds", "caches", "that", "are", "not", "empty", "from", "the", "cacheModules", "array", "to", "self", ".", "caches" ]
cffc91b262b9dd2f6529628fda5782ed985bfaaf
https://github.com/jpodwys/cache-service/blob/cffc91b262b9dd2f6529628fda5782ed985bfaaf/cacheCollection.js#L46-L56
34,184
jpodwys/cache-service
cacheCollection.js
addSettings
function addSettings(cacheModule){ cacheModule.nameSpace = settings.nameSpace; cacheModule.verbose = settings.verbose; return cacheModule; }
javascript
function addSettings(cacheModule){ cacheModule.nameSpace = settings.nameSpace; cacheModule.verbose = settings.verbose; return cacheModule; }
[ "function", "addSettings", "(", "cacheModule", ")", "{", "cacheModule", ".", "nameSpace", "=", "settings", ".", "nameSpace", ";", "cacheModule", ".", "verbose", "=", "settings", ".", "verbose", ";", "return", "cacheModule", ";", "}" ]
Adds cache-service config properties to each cache module @param {object} cacheModule @return {object} cacheModule
[ "Adds", "cache", "-", "service", "config", "properties", "to", "each", "cache", "module" ]
cffc91b262b9dd2f6529628fda5782ed985bfaaf
https://github.com/jpodwys/cache-service/blob/cffc91b262b9dd2f6529628fda5782ed985bfaaf/cacheCollection.js#L63-L67
34,185
jpodwys/cache-service
cacheCollection.js
isEmpty
function isEmpty (val) { return (val === undefined || val === false || val === null || (typeof val === 'object' && Object.keys(val).length === 0)); }
javascript
function isEmpty (val) { return (val === undefined || val === false || val === null || (typeof val === 'object' && Object.keys(val).length === 0)); }
[ "function", "isEmpty", "(", "val", ")", "{", "return", "(", "val", "===", "undefined", "||", "val", "===", "false", "||", "val", "===", "null", "||", "(", "typeof", "val", "===", "'object'", "&&", "Object", ".", "keys", "(", "val", ")", ".", "length"...
Checks if a value is "empty" @param {object | string | null | undefined} val @return {boolean}
[ "Checks", "if", "a", "value", "is", "empty" ]
cffc91b262b9dd2f6529628fda5782ed985bfaaf
https://github.com/jpodwys/cache-service/blob/cffc91b262b9dd2f6529628fda5782ed985bfaaf/cacheCollection.js#L74-L77
34,186
fibo/dflow
src/engine/inject/additionalFunctions.js
injectAdditionalFunctions
function injectAdditionalFunctions (funcs, additionalFunctions) { // Nothing to do if no additional function is given. if (no(additionalFunctions)) return /** * Validate and insert an additional function. */ function injectAdditionalFunction (key) { var isAFunction = typeof additionalFunctions[key] ...
javascript
function injectAdditionalFunctions (funcs, additionalFunctions) { // Nothing to do if no additional function is given. if (no(additionalFunctions)) return /** * Validate and insert an additional function. */ function injectAdditionalFunction (key) { var isAFunction = typeof additionalFunctions[key] ...
[ "function", "injectAdditionalFunctions", "(", "funcs", ",", "additionalFunctions", ")", "{", "// Nothing to do if no additional function is given.", "if", "(", "no", "(", "additionalFunctions", ")", ")", "return", "/**\n * Validate and insert an additional function.\n */", "f...
Optionally add custom functions. @params {Object} funcs @params {Object} additionalFunctions
[ "Optionally", "add", "custom", "functions", "." ]
6530e4659952b9013e47b5fb28fbbd3a7a4af17d
https://github.com/fibo/dflow/blob/6530e4659952b9013e47b5fb28fbbd3a7a4af17d/src/engine/inject/additionalFunctions.js#L10-L26
34,187
fibo/dflow
src/engine/inject/additionalFunctions.js
injectAdditionalFunction
function injectAdditionalFunction (key) { var isAFunction = typeof additionalFunctions[key] === 'function' if (isAFunction) funcs[key] = additionalFunctions[key] }
javascript
function injectAdditionalFunction (key) { var isAFunction = typeof additionalFunctions[key] === 'function' if (isAFunction) funcs[key] = additionalFunctions[key] }
[ "function", "injectAdditionalFunction", "(", "key", ")", "{", "var", "isAFunction", "=", "typeof", "additionalFunctions", "[", "key", "]", "===", "'function'", "if", "(", "isAFunction", ")", "funcs", "[", "key", "]", "=", "additionalFunctions", "[", "key", "]"...
Validate and insert an additional function.
[ "Validate", "and", "insert", "an", "additional", "function", "." ]
6530e4659952b9013e47b5fb28fbbd3a7a4af17d
https://github.com/fibo/dflow/blob/6530e4659952b9013e47b5fb28fbbd3a7a4af17d/src/engine/inject/additionalFunctions.js#L18-L22
34,188
fibo/dflow
src/engine/walkGlobal.js
walkGlobal
function walkGlobal (taskName) { // Skip dot operator and tasks that start with a dot. if (taskName.indexOf('.') === 0) return // Skip stuff that may include dots: // * comments // * strings // * numbers // * references if (regexComment.test(taskName)) return if (parseFloat(taskName)) return if (re...
javascript
function walkGlobal (taskName) { // Skip dot operator and tasks that start with a dot. if (taskName.indexOf('.') === 0) return // Skip stuff that may include dots: // * comments // * strings // * numbers // * references if (regexComment.test(taskName)) return if (parseFloat(taskName)) return if (re...
[ "function", "walkGlobal", "(", "taskName", ")", "{", "// Skip dot operator and tasks that start with a dot.", "if", "(", "taskName", ".", "indexOf", "(", "'.'", ")", "===", "0", ")", "return", "// Skip stuff that may include dots:", "// * comments", "// * strings", "// * ...
Walk through global context. process.version will return global[process][version] @param {String} taskName @returns {*} leaf
[ "Walk", "through", "global", "context", "." ]
6530e4659952b9013e47b5fb28fbbd3a7a4af17d
https://github.com/fibo/dflow/blob/6530e4659952b9013e47b5fb28fbbd3a7a4af17d/src/engine/walkGlobal.js#L24-L44
34,189
fibo/dflow
src/engine/fun.js
compileSubgraph
function compileSubgraph (key) { var subGraph = graph.func[key] var funcName = '/' + key funcs[funcName] = fun(subGraph, additionalFunctions) }
javascript
function compileSubgraph (key) { var subGraph = graph.func[key] var funcName = '/' + key funcs[funcName] = fun(subGraph, additionalFunctions) }
[ "function", "compileSubgraph", "(", "key", ")", "{", "var", "subGraph", "=", "graph", ".", "func", "[", "key", "]", "var", "funcName", "=", "'/'", "+", "key", "funcs", "[", "funcName", "]", "=", "fun", "(", "subGraph", ",", "additionalFunctions", ")", ...
Compiles a sub graph.
[ "Compiles", "a", "sub", "graph", "." ]
6530e4659952b9013e47b5fb28fbbd3a7a4af17d
https://github.com/fibo/dflow/blob/6530e4659952b9013e47b5fb28fbbd3a7a4af17d/src/engine/fun.js#L66-L72
34,190
fibo/dflow
src/engine/fun.js
byLevel
function byLevel (a, b) { if (no(cachedLevelOf[a])) cachedLevelOf[a] = computeLevelOf(a) if (no(cachedLevelOf[b])) cachedLevelOf[b] = computeLevelOf(b) return cachedLevelOf[a] - cachedLevelOf[b] }
javascript
function byLevel (a, b) { if (no(cachedLevelOf[a])) cachedLevelOf[a] = computeLevelOf(a) if (no(cachedLevelOf[b])) cachedLevelOf[b] = computeLevelOf(b) return cachedLevelOf[a] - cachedLevelOf[b] }
[ "function", "byLevel", "(", "a", ",", "b", ")", "{", "if", "(", "no", "(", "cachedLevelOf", "[", "a", "]", ")", ")", "cachedLevelOf", "[", "a", "]", "=", "computeLevelOf", "(", "a", ")", "if", "(", "no", "(", "cachedLevelOf", "[", "b", "]", ")", ...
Sorts tasks by their level.
[ "Sorts", "tasks", "by", "their", "level", "." ]
6530e4659952b9013e47b5fb28fbbd3a7a4af17d
https://github.com/fibo/dflow/blob/6530e4659952b9013e47b5fb28fbbd3a7a4af17d/src/engine/fun.js#L78-L84
34,191
fibo/dflow
src/engine/fun.js
checkTaskIsCompiled
function checkTaskIsCompiled (taskKey) { var taskName = task[taskKey] // Ignore tasks injected at run time. if (reservedKeys.indexOf(taskName) > -1) return var msg = 'Task not compiled: ' + taskName + ' [' + taskKey + ']' // Check subgraphs. if (regexSubgraph.test(taskName)) { var subgr...
javascript
function checkTaskIsCompiled (taskKey) { var taskName = task[taskKey] // Ignore tasks injected at run time. if (reservedKeys.indexOf(taskName) > -1) return var msg = 'Task not compiled: ' + taskName + ' [' + taskKey + ']' // Check subgraphs. if (regexSubgraph.test(taskName)) { var subgr...
[ "function", "checkTaskIsCompiled", "(", "taskKey", ")", "{", "var", "taskName", "=", "task", "[", "taskKey", "]", "// Ignore tasks injected at run time.", "if", "(", "reservedKeys", ".", "indexOf", "(", "taskName", ")", ">", "-", "1", ")", "return", "var", "ms...
Throw if a task is not compiled.
[ "Throw", "if", "a", "task", "is", "not", "compiled", "." ]
6530e4659952b9013e47b5fb28fbbd3a7a4af17d
https://github.com/fibo/dflow/blob/6530e4659952b9013e47b5fb28fbbd3a7a4af17d/src/engine/fun.js#L102-L134
34,192
fibo/dflow
src/engine/fun.js
run
function run (taskKey) { var args = inputArgs(outs, pipe, taskKey) var taskName = task[taskKey] var f = funcs[taskName] // Behave like a JavaScript function: // if found a return, skip all other tasks. if (gotReturn) return if ((taskName === 'return') && (!gotReturn)) { ...
javascript
function run (taskKey) { var args = inputArgs(outs, pipe, taskKey) var taskName = task[taskKey] var f = funcs[taskName] // Behave like a JavaScript function: // if found a return, skip all other tasks. if (gotReturn) return if ((taskName === 'return') && (!gotReturn)) { ...
[ "function", "run", "(", "taskKey", ")", "{", "var", "args", "=", "inputArgs", "(", "outs", ",", "pipe", ",", "taskKey", ")", "var", "taskName", "=", "task", "[", "taskKey", "]", "var", "f", "=", "funcs", "[", "taskName", "]", "// Behave like a JavaScript...
Execute task.
[ "Execute", "task", "." ]
6530e4659952b9013e47b5fb28fbbd3a7a4af17d
https://github.com/fibo/dflow/blob/6530e4659952b9013e47b5fb28fbbd3a7a4af17d/src/engine/fun.js#L160-L195
34,193
quantmind/d3-view
src/core/selection.js
mount
function mount(data) { var promises = []; this.each(function() { var view = select(this).view(); if (view) promises.push(mountElement(this, view, data)); else warn("Cannot mount, no view object available to mount to"); }); return Promise.all(promises); }
javascript
function mount(data) { var promises = []; this.each(function() { var view = select(this).view(); if (view) promises.push(mountElement(this, view, data)); else warn("Cannot mount, no view object available to mount to"); }); return Promise.all(promises); }
[ "function", "mount", "(", "data", ")", "{", "var", "promises", "=", "[", "]", ";", "this", ".", "each", "(", "function", "(", ")", "{", "var", "view", "=", "select", "(", "this", ")", ".", "view", "(", ")", ";", "if", "(", "view", ")", "promise...
mount function on a d3 selection Use this function to mount the selection This method returns nothing or a promise
[ "mount", "function", "on", "a", "d3", "selection", "Use", "this", "function", "to", "mount", "the", "selection", "This", "method", "returns", "nothing", "or", "a", "promise" ]
014e8233fd3beacc454f63c8c054405e2506ae8e
https://github.com/quantmind/d3-view/blob/014e8233fd3beacc454f63c8c054405e2506ae8e/src/core/selection.js#L49-L57
34,194
quantmind/d3-view
src/core/clean.js
Manager
function Manager(records) { let sel, nodes, node, vm; records.forEach(record => { nodes = record.removedNodes; if (!nodes || !nodes.length) return; vm = record.target ? select(record.target).view() : null; for (let i = 0; i < nodes.length; ++i) { node = nodes[i]; if (!node.querySelecto...
javascript
function Manager(records) { let sel, nodes, node, vm; records.forEach(record => { nodes = record.removedNodes; if (!nodes || !nodes.length) return; vm = record.target ? select(record.target).view() : null; for (let i = 0; i < nodes.length; ++i) { node = nodes[i]; if (!node.querySelecto...
[ "function", "Manager", "(", "records", ")", "{", "let", "sel", ",", "nodes", ",", "node", ",", "vm", ";", "records", ".", "forEach", "(", "record", "=>", "{", "nodes", "=", "record", ".", "removedNodes", ";", "if", "(", "!", "nodes", "||", "!", "no...
Clears element going out of scope
[ "Clears", "element", "going", "out", "of", "scope" ]
014e8233fd3beacc454f63c8c054405e2506ae8e
https://github.com/quantmind/d3-view/blob/014e8233fd3beacc454f63c8c054405e2506ae8e/src/core/clean.js#L16-L34
34,195
fibo/dflow
src/cli/utils.js
appendCwd
function appendCwd (givenPath) { return path.isAbsolute(givenPath) ? givenPath : path.join(process.cwd(), givenPath) }
javascript
function appendCwd (givenPath) { return path.isAbsolute(givenPath) ? givenPath : path.join(process.cwd(), givenPath) }
[ "function", "appendCwd", "(", "givenPath", ")", "{", "return", "path", ".", "isAbsolute", "(", "givenPath", ")", "?", "givenPath", ":", "path", ".", "join", "(", "process", ".", "cwd", "(", ")", ",", "givenPath", ")", "}" ]
Append current working dir, if path is relative. ['graph1.json', 'graph2.json'].map(appendCwd)
[ "Append", "current", "working", "dir", "if", "path", "is", "relative", "." ]
6530e4659952b9013e47b5fb28fbbd3a7a4af17d
https://github.com/fibo/dflow/blob/6530e4659952b9013e47b5fb28fbbd3a7a4af17d/src/cli/utils.js#L22-L24
34,196
cgmartin/express-api-server
src/lib/errors.js
HttpError
function HttpError(message, options) { // handle constructor call without 'new' if (!(this instanceof HttpError)) { return new HttpError(message, options); } HttpError.super_.call(this); Error.captureStackTrace(this, this.constructor); this.name = 'HttpError'; this.message = message...
javascript
function HttpError(message, options) { // handle constructor call without 'new' if (!(this instanceof HttpError)) { return new HttpError(message, options); } HttpError.super_.call(this); Error.captureStackTrace(this, this.constructor); this.name = 'HttpError'; this.message = message...
[ "function", "HttpError", "(", "message", ",", "options", ")", "{", "// handle constructor call without 'new'", "if", "(", "!", "(", "this", "instanceof", "HttpError", ")", ")", "{", "return", "new", "HttpError", "(", "message", ",", "options", ")", ";", "}", ...
All HTTP Errors will extend from this object
[ "All", "HTTP", "Errors", "will", "extend", "from", "this", "object" ]
9d6de16e7c84d21b83639a904f2eaed4a30a4088
https://github.com/cgmartin/express-api-server/blob/9d6de16e7c84d21b83639a904f2eaed4a30a4088/src/lib/errors.js#L12-L29
34,197
cgmartin/express-api-server
src/lib/errors.js
getErrorNameFromStatusCode
function getErrorNameFromStatusCode(statusCode) { statusCode = parseInt(statusCode, 10); var status = http.STATUS_CODES[statusCode]; if (!status) { return false; } var name = ''; var words = status.split(/\s+/); words.forEach(function(w) { name += w.charAt(0).toUpperCase() + w.slice(1)....
javascript
function getErrorNameFromStatusCode(statusCode) { statusCode = parseInt(statusCode, 10); var status = http.STATUS_CODES[statusCode]; if (!status) { return false; } var name = ''; var words = status.split(/\s+/); words.forEach(function(w) { name += w.charAt(0).toUpperCase() + w.slice(1)....
[ "function", "getErrorNameFromStatusCode", "(", "statusCode", ")", "{", "statusCode", "=", "parseInt", "(", "statusCode", ",", "10", ")", ";", "var", "status", "=", "http", ".", "STATUS_CODES", "[", "statusCode", "]", ";", "if", "(", "!", "status", ")", "{"...
Convert status description to error name
[ "Convert", "status", "description", "to", "error", "name" ]
9d6de16e7c84d21b83639a904f2eaed4a30a4088
https://github.com/cgmartin/express-api-server/blob/9d6de16e7c84d21b83639a904f2eaed4a30a4088/src/lib/errors.js#L94-L111
34,198
fibo/dflow
src/engine/parents.js
parents
function parents (pipe, taskKey) { var inputPipesOf = inputPipes.bind(null, pipe) var parentTaskIds = [] function pushParentTaskId (pipe) { parentTaskIds.push(pipe[0]) } inputPipesOf(taskKey).forEach(pushParentTaskId) return parentTaskIds }
javascript
function parents (pipe, taskKey) { var inputPipesOf = inputPipes.bind(null, pipe) var parentTaskIds = [] function pushParentTaskId (pipe) { parentTaskIds.push(pipe[0]) } inputPipesOf(taskKey).forEach(pushParentTaskId) return parentTaskIds }
[ "function", "parents", "(", "pipe", ",", "taskKey", ")", "{", "var", "inputPipesOf", "=", "inputPipes", ".", "bind", "(", "null", ",", "pipe", ")", "var", "parentTaskIds", "=", "[", "]", "function", "pushParentTaskId", "(", "pipe", ")", "{", "parentTaskIds...
Compute parent tasks. @param {Array} pipes of graph @param {String} taskKey @returns {Array} parentTaskIds
[ "Compute", "parent", "tasks", "." ]
6530e4659952b9013e47b5fb28fbbd3a7a4af17d
https://github.com/fibo/dflow/blob/6530e4659952b9013e47b5fb28fbbd3a7a4af17d/src/engine/parents.js#L12-L23
34,199
fibo/dflow
src/engine/inject/numbers.js
injectNumbers
function injectNumbers (funcs, task) { /** * Inject a function that returns a number. */ function inject (taskKey) { var taskName = task[taskKey] var num = parseFloat(taskName) if (!isNaN(num)) { funcs[taskName] = function () { return num } } } Object.keys(task) .forEach(inje...
javascript
function injectNumbers (funcs, task) { /** * Inject a function that returns a number. */ function inject (taskKey) { var taskName = task[taskKey] var num = parseFloat(taskName) if (!isNaN(num)) { funcs[taskName] = function () { return num } } } Object.keys(task) .forEach(inje...
[ "function", "injectNumbers", "(", "funcs", ",", "task", ")", "{", "/**\n * Inject a function that returns a number.\n */", "function", "inject", "(", "taskKey", ")", "{", "var", "taskName", "=", "task", "[", "taskKey", "]", "var", "num", "=", "parseFloat", "("...
Inject functions that return numbers. @param {Object} funcs reference @param {Object} task collection
[ "Inject", "functions", "that", "return", "numbers", "." ]
6530e4659952b9013e47b5fb28fbbd3a7a4af17d
https://github.com/fibo/dflow/blob/6530e4659952b9013e47b5fb28fbbd3a7a4af17d/src/engine/inject/numbers.js#L8-L25