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
50,600
alexpods/ClazzJS
src/components/meta/Property/Type.js
function(value, params, property, fields, object) { var that = this; if (!_.isSimpleObject(value)) { throw new Error('Value of property "' + [property].concat(fields).join('.') +'" must be a simple object!'); } if ('keys' in params) {...
javascript
function(value, params, property, fields, object) { var that = this; if (!_.isSimpleObject(value)) { throw new Error('Value of property "' + [property].concat(fields).join('.') +'" must be a simple object!'); } if ('keys' in params) {...
[ "function", "(", "value", ",", "params", ",", "property", ",", "fields", ",", "object", ")", "{", "var", "that", "=", "this", ";", "if", "(", "!", "_", ".", "isSimpleObject", "(", "value", ")", ")", "{", "throw", "new", "Error", "(", "'Value of prope...
Hash property type Check 'simple object' type of value, applies 'keys' and 'element' parameters @param {*} value Property value @param {object} params Property parameters @param {string} property Property name @param {array} fields Property fields @param {object} object Object to which property belongs ...
[ "Hash", "property", "type", "Check", "simple", "object", "type", "of", "value", "applies", "keys", "and", "element", "parameters" ]
2f94496019669813c8246d48fcceb12a3e68a870
https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Property/Type.js#L307-L330
50,601
alexpods/ClazzJS
src/components/meta/Property/Type.js
function(value, params, property, fields, object) { if (!_.isObject(value)) { throw new Error('Value of property "' + property + '" must be an object!'); } if ('instanceOf' in params) { var instanceOf = params.instanceOf; var clazzCl...
javascript
function(value, params, property, fields, object) { if (!_.isObject(value)) { throw new Error('Value of property "' + property + '" must be an object!'); } if ('instanceOf' in params) { var instanceOf = params.instanceOf; var clazzCl...
[ "function", "(", "value", ",", "params", ",", "property", ",", "fields", ",", "object", ")", "{", "if", "(", "!", "_", ".", "isObject", "(", "value", ")", ")", "{", "throw", "new", "Error", "(", "'Value of property \"'", "+", "property", "+", "'\" must...
Object property type Check 'object' type of value, applies 'instanceOf' parameters @param {*} value Property value @param {object} params Property parameters @param {string} property Property name @param {array} fields Property fields @param {object} object Object to which property belongs @throws {Err...
[ "Object", "property", "type", "Check", "object", "type", "of", "value", "applies", "instanceOf", "parameters" ]
2f94496019669813c8246d48fcceb12a3e68a870
https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Property/Type.js#L349-L381
50,602
Becklyn/becklyn-gulp
tasks/publish.js
removeExisting
function removeExisting () { if (fs.existsSync("web/assets")) { var stat = fs.lstatSync("web/assets"); if (stat.isFile() || stat.isSymbolicLink()) { fs.unlinkSync("web/assets"); } else { wrench.rmdirSyncRecursive("web/assets"); } ...
javascript
function removeExisting () { if (fs.existsSync("web/assets")) { var stat = fs.lstatSync("web/assets"); if (stat.isFile() || stat.isSymbolicLink()) { fs.unlinkSync("web/assets"); } else { wrench.rmdirSyncRecursive("web/assets"); } ...
[ "function", "removeExisting", "(", ")", "{", "if", "(", "fs", ".", "existsSync", "(", "\"web/assets\"", ")", ")", "{", "var", "stat", "=", "fs", ".", "lstatSync", "(", "\"web/assets\"", ")", ";", "if", "(", "stat", ".", "isFile", "(", ")", "||", "sta...
Removes the existing directory
[ "Removes", "the", "existing", "directory" ]
1c633378d561f07101f9db19ccd153617b8e0252
https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/publish.js#L14-L29
50,603
wordijp/flexi-require
lib/internal/bower-utils.js
componentsHome
function componentsHome(workdir) { var bowerrc = path.join(workdir, '.bowerrc'), defaultHome = path.join(workdir, 'bower_components'); return (fs.existsSync(bowerrc) && require(bowerrc).directory) || defaultHome; }
javascript
function componentsHome(workdir) { var bowerrc = path.join(workdir, '.bowerrc'), defaultHome = path.join(workdir, 'bower_components'); return (fs.existsSync(bowerrc) && require(bowerrc).directory) || defaultHome; }
[ "function", "componentsHome", "(", "workdir", ")", "{", "var", "bowerrc", "=", "path", ".", "join", "(", "workdir", ",", "'.bowerrc'", ")", ",", "defaultHome", "=", "path", ".", "join", "(", "workdir", ",", "'bower_components'", ")", ";", "return", "(", ...
determine bower components home dir, maybe need to get dir name from '.bowerrc'
[ "determine", "bower", "components", "home", "dir", "maybe", "need", "to", "get", "dir", "name", "from", ".", "bowerrc" ]
f62a7141fd97f4a5b47c9808a5c4a3349aeccb43
https://github.com/wordijp/flexi-require/blob/f62a7141fd97f4a5b47c9808a5c4a3349aeccb43/lib/internal/bower-utils.js#L12-L16
50,604
wordijp/flexi-require
lib/internal/bower-utils.js
componentName
function componentName(rawname) { var name = rawname.split(':')[0], index = name.replace('\\', '/').indexOf('/'); return (index > 0) ? name.substring(0, index) : name; }
javascript
function componentName(rawname) { var name = rawname.split(':')[0], index = name.replace('\\', '/').indexOf('/'); return (index > 0) ? name.substring(0, index) : name; }
[ "function", "componentName", "(", "rawname", ")", "{", "var", "name", "=", "rawname", ".", "split", "(", "':'", ")", "[", "0", "]", ",", "index", "=", "name", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ".", "indexOf", "(", "'/'", ")", ";", "...
extract component name from inputting rawname
[ "extract", "component", "name", "from", "inputting", "rawname" ]
f62a7141fd97f4a5b47c9808a5c4a3349aeccb43
https://github.com/wordijp/flexi-require/blob/f62a7141fd97f4a5b47c9808a5c4a3349aeccb43/lib/internal/bower-utils.js#L21-L25
50,605
wordijp/flexi-require
lib/internal/bower-utils.js
componentNames
function componentNames(workdir) { workdir = workdir || process.cwd(); try { var bowerJson = require(path.join(workdir, 'bower.json')); return _(Object.keys(bowerJson.dependencies || {})) .union(Object.keys(bowerJson.devDependencies || {})) .value(); } catch (ex) { // not found bower //console.warn(ex....
javascript
function componentNames(workdir) { workdir = workdir || process.cwd(); try { var bowerJson = require(path.join(workdir, 'bower.json')); return _(Object.keys(bowerJson.dependencies || {})) .union(Object.keys(bowerJson.devDependencies || {})) .value(); } catch (ex) { // not found bower //console.warn(ex....
[ "function", "componentNames", "(", "workdir", ")", "{", "workdir", "=", "workdir", "||", "process", ".", "cwd", "(", ")", ";", "try", "{", "var", "bowerJson", "=", "require", "(", "path", ".", "join", "(", "workdir", ",", "'bower.json'", ")", ")", ";",...
get bower components names
[ "get", "bower", "components", "names" ]
f62a7141fd97f4a5b47c9808a5c4a3349aeccb43
https://github.com/wordijp/flexi-require/blob/f62a7141fd97f4a5b47c9808a5c4a3349aeccb43/lib/internal/bower-utils.js#L30-L42
50,606
wordijp/flexi-require
lib/internal/bower-utils.js
resolve
function resolve(name, workdir) { workdir = workdir || process.cwd(); var compName = componentName(name), subname = name.substring(compName.length + 1), basedir = path.join(componentsHome(workdir), compName), bowerJson = require(path.join(basedir, 'bower.json')); var mainfile = Array.isArray(bowerJson.main) ...
javascript
function resolve(name, workdir) { workdir = workdir || process.cwd(); var compName = componentName(name), subname = name.substring(compName.length + 1), basedir = path.join(componentsHome(workdir), compName), bowerJson = require(path.join(basedir, 'bower.json')); var mainfile = Array.isArray(bowerJson.main) ...
[ "function", "resolve", "(", "name", ",", "workdir", ")", "{", "workdir", "=", "workdir", "||", "process", ".", "cwd", "(", ")", ";", "var", "compName", "=", "componentName", "(", "name", ")", ",", "subname", "=", "name", ".", "substring", "(", "compNam...
resolve and return entry file's full path for specified component
[ "resolve", "and", "return", "entry", "file", "s", "full", "path", "for", "specified", "component" ]
f62a7141fd97f4a5b47c9808a5c4a3349aeccb43
https://github.com/wordijp/flexi-require/blob/f62a7141fd97f4a5b47c9808a5c4a3349aeccb43/lib/internal/bower-utils.js#L48-L77
50,607
wunderbyte/grunt-spiritual-dox
Gruntfile.js
uglify
function uglify(js) { return ugli.minify(js, { fromString: true, mangle: false, compress: { warnings: false } }).code; }
javascript
function uglify(js) { return ugli.minify(js, { fromString: true, mangle: false, compress: { warnings: false } }).code; }
[ "function", "uglify", "(", "js", ")", "{", "return", "ugli", ".", "minify", "(", "js", ",", "{", "fromString", ":", "true", ",", "mangle", ":", "false", ",", "compress", ":", "{", "warnings", ":", "false", "}", "}", ")", ".", "code", ";", "}" ]
Compute compressed source for file. @param {String} filepath The file path @returns {String}
[ "Compute", "compressed", "source", "for", "file", "." ]
5afcfe31ddbf7d654166aa15b938553b61de5811
https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/Gruntfile.js#L106-L114
50,608
JohnnieFucker/dreamix-rpc
lib/rpc-client/failureProcess.js
failsafe
function failsafe(code, tracer, serverId, msg, opts, cb) { // eslint-disable-line const self = this; const retryTimes = opts.retryTimes || constants.DEFAULT_PARAM.FAILSAFE_RETRIES; const retryConnectTime = opts.retryConnectTime || constants.DEFAULT_PARAM.FAILSAFE_CONNECT_TIME; if (!tracer.retryTimes)...
javascript
function failsafe(code, tracer, serverId, msg, opts, cb) { // eslint-disable-line const self = this; const retryTimes = opts.retryTimes || constants.DEFAULT_PARAM.FAILSAFE_RETRIES; const retryConnectTime = opts.retryConnectTime || constants.DEFAULT_PARAM.FAILSAFE_CONNECT_TIME; if (!tracer.retryTimes)...
[ "function", "failsafe", "(", "code", ",", "tracer", ",", "serverId", ",", "msg", ",", "opts", ",", "cb", ")", "{", "// eslint-disable-line", "const", "self", "=", "this", ";", "const", "retryTimes", "=", "opts", ".", "retryTimes", "||", "constants", ".", ...
Failsafe rpc failure process. @param code {Number} error code number. @param tracer {Object} current rpc tracer. @param serverId {String} rpc remote target server id. @param msg {Object} rpc message. @param opts {Object} rpc client options. @param cb {Function} user rpc callback. @api private
[ "Failsafe", "rpc", "failure", "process", "." ]
eb29e247214148c025456b2bb0542e1094fd2edb
https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/failureProcess.js#L54-L94
50,609
tolokoban/ToloFrameWork
lib/boilerplate.preprocessor.js
process
function process( ctx, obj ) { try { if ( Array.isArray( obj ) ) return processArray( ctx, obj ); switch ( typeof obj ) { case "string": return processString( ctx, obj ); case "object": return processObject( ctx, obj ); default: return obj;...
javascript
function process( ctx, obj ) { try { if ( Array.isArray( obj ) ) return processArray( ctx, obj ); switch ( typeof obj ) { case "string": return processString( ctx, obj ); case "object": return processObject( ctx, obj ); default: return obj;...
[ "function", "process", "(", "ctx", ",", "obj", ")", "{", "try", "{", "if", "(", "Array", ".", "isArray", "(", "obj", ")", ")", "return", "processArray", "(", "ctx", ",", "obj", ")", ";", "switch", "(", "typeof", "obj", ")", "{", "case", "\"string\"...
Return a copy of `obj` after processing it.
[ "Return", "a", "copy", "of", "obj", "after", "processing", "it", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/boilerplate.preprocessor.js#L53-L67
50,610
redisjs/jsr-server
lib/pubsub.js
PubSub
function PubSub(stats) { // ref to statistics so they can be updated // as subscriptions change this._stats = stats; // normal channels this._channels = {}; // pattern channels this._patterns = {}; this._count = { channels: { total: 0, // total number of channels subscribers: 0...
javascript
function PubSub(stats) { // ref to statistics so they can be updated // as subscriptions change this._stats = stats; // normal channels this._channels = {}; // pattern channels this._patterns = {}; this._count = { channels: { total: 0, // total number of channels subscribers: 0...
[ "function", "PubSub", "(", "stats", ")", "{", "// ref to statistics so they can be updated", "// as subscriptions change", "this", ".", "_stats", "=", "stats", ";", "// normal channels", "this", ".", "_channels", "=", "{", "}", ";", "// pattern channels", "this", ".",...
Encapsulates the pubsub system. Maps channel identifiers to arrays of client identifiers subscribed to the given channel. Clients are given a reference to the channels they are subscribed to, this global subsystem is responsible for managing the client pubsub references as well as the global references. The global i...
[ "Encapsulates", "the", "pubsub", "system", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/pubsub.js#L41-L63
50,611
redisjs/jsr-server
lib/pubsub.js
getChannelList
function getChannelList(channels) { var i , channel , list = []; for(i = 0;i < channels.length;i++) { channel = channels[i]; list.push(channel, this._channels[channel] ? this._channels[channel].length : 0); } return list; }
javascript
function getChannelList(channels) { var i , channel , list = []; for(i = 0;i < channels.length;i++) { channel = channels[i]; list.push(channel, this._channels[channel] ? this._channels[channel].length : 0); } return list; }
[ "function", "getChannelList", "(", "channels", ")", "{", "var", "i", ",", "channel", ",", "list", "=", "[", "]", ";", "for", "(", "i", "=", "0", ";", "i", "<", "channels", ".", "length", ";", "i", "++", ")", "{", "channel", "=", "channels", "[", ...
Get a multi bulk array reply of channels with subscriber counts. Suitable for the PUBSUB NUMSUB [channel-1 channel-N] command. @param channels The array of channels.
[ "Get", "a", "multi", "bulk", "array", "reply", "of", "channels", "with", "subscriber", "counts", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/pubsub.js#L127-L137
50,612
redisjs/jsr-server
lib/pubsub.js
getChannels
function getChannels(pattern) { if(!pattern) return Object.keys(this._channels); var re = (pattern instanceof RegExp) ? pattern : Pattern.compile(pattern) , k , list = []; for(k in this._channels) { if(re.test(k)) { list.push(k); } } return list; }
javascript
function getChannels(pattern) { if(!pattern) return Object.keys(this._channels); var re = (pattern instanceof RegExp) ? pattern : Pattern.compile(pattern) , k , list = []; for(k in this._channels) { if(re.test(k)) { list.push(k); } } return list; }
[ "function", "getChannels", "(", "pattern", ")", "{", "if", "(", "!", "pattern", ")", "return", "Object", ".", "keys", "(", "this", ".", "_channels", ")", ";", "var", "re", "=", "(", "pattern", "instanceof", "RegExp", ")", "?", "pattern", ":", "Pattern"...
Get channels matching pattern not including pattern subscribers. Suitable for the PUBSUB CHANNELS [pattern] command.
[ "Get", "channels", "matching", "pattern", "not", "including", "pattern", "subscribers", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/pubsub.js#L144-L155
50,613
redisjs/jsr-server
lib/pubsub.js
cleanup
function cleanup(client) { if(client.pubsub && client.pubsub.channels && client.pubsub.patterns && !client.pubsub.channels.length && !client.pubsub.patterns.length) { client.pubsub = null; } }
javascript
function cleanup(client) { if(client.pubsub && client.pubsub.channels && client.pubsub.patterns && !client.pubsub.channels.length && !client.pubsub.patterns.length) { client.pubsub = null; } }
[ "function", "cleanup", "(", "client", ")", "{", "if", "(", "client", ".", "pubsub", "&&", "client", ".", "pubsub", ".", "channels", "&&", "client", ".", "pubsub", ".", "patterns", "&&", "!", "client", ".", "pubsub", ".", "channels", ".", "length", "&&"...
Clean pubsub references on the client when it has no more channels or patterns.
[ "Clean", "pubsub", "references", "on", "the", "client", "when", "it", "has", "no", "more", "channels", "or", "patterns", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/pubsub.js#L386-L394
50,614
bentomas/node-async-testing
lib/running.js
generateHelp
function generateHelp(flags) { var max = 0; for (var group in flags) { for (var i = 0; i < flags[group].length; i++) { var n = 2; // ' ' if (flags[group][i].longFlag) { n += 2; // '--' n += flags[group][i].longFlag.length; } if (flags[group][i].longFlag && flags[group][i...
javascript
function generateHelp(flags) { var max = 0; for (var group in flags) { for (var i = 0; i < flags[group].length; i++) { var n = 2; // ' ' if (flags[group][i].longFlag) { n += 2; // '--' n += flags[group][i].longFlag.length; } if (flags[group][i].longFlag && flags[group][i...
[ "function", "generateHelp", "(", "flags", ")", "{", "var", "max", "=", "0", ";", "for", "(", "var", "group", "in", "flags", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "flags", "[", "group", "]", ".", "length", ";", "i", "++", ...
creates the help message for running this from the command line
[ "creates", "the", "help", "message", "for", "running", "this", "from", "the", "command", "line" ]
82384ba4b8444e4659464bad661788827ea721aa
https://github.com/bentomas/node-async-testing/blob/82384ba4b8444e4659464bad661788827ea721aa/lib/running.js#L247-L302
50,615
KapIT/observe-utils
lib/observe-utils.js
isPositiveFiniteInteger
function isPositiveFiniteInteger(value, errorMessage) { value = Number(value); if (isNaN(value) || !isFinite(value) || value < 0 || value % 1 !== 0) { throw new RangeError(errorMessage.replace('$', value)); } return value; }
javascript
function isPositiveFiniteInteger(value, errorMessage) { value = Number(value); if (isNaN(value) || !isFinite(value) || value < 0 || value % 1 !== 0) { throw new RangeError(errorMessage.replace('$', value)); } return value; }
[ "function", "isPositiveFiniteInteger", "(", "value", ",", "errorMessage", ")", "{", "value", "=", "Number", "(", "value", ")", ";", "if", "(", "isNaN", "(", "value", ")", "||", "!", "isFinite", "(", "value", ")", "||", "value", "<", "0", "||", "value",...
cast a value as number, and test if the obtained result is a positive finite integer, throw an error otherwise
[ "cast", "a", "value", "as", "number", "and", "test", "if", "the", "obtained", "result", "is", "a", "positive", "finite", "integer", "throw", "an", "error", "otherwise" ]
4a9d0140e2dfcb15e85f9d5951692045265fb391
https://github.com/KapIT/observe-utils/blob/4a9d0140e2dfcb15e85f9d5951692045265fb391/lib/observe-utils.js#L82-L88
50,616
KapIT/observe-utils
lib/observe-utils.js
defineObservableProperty
function defineObservableProperty(target, property, originalValue) { //we store the value in an non-enumerable property with generated unique name var internalPropName = '_' + (uidCounter++) + property; if (target.hasOwnProperty(property)) { Object.defineProperty(target, internalPr...
javascript
function defineObservableProperty(target, property, originalValue) { //we store the value in an non-enumerable property with generated unique name var internalPropName = '_' + (uidCounter++) + property; if (target.hasOwnProperty(property)) { Object.defineProperty(target, internalPr...
[ "function", "defineObservableProperty", "(", "target", ",", "property", ",", "originalValue", ")", "{", "//we store the value in an non-enumerable property with generated unique name", "var", "internalPropName", "=", "'_'", "+", "(", "uidCounter", "++", ")", "+", "property"...
Define a property on an object that will call the Notifier.notify method when updated
[ "Define", "a", "property", "on", "an", "object", "that", "will", "call", "the", "Notifier", ".", "notify", "method", "when", "updated" ]
4a9d0140e2dfcb15e85f9d5951692045265fb391
https://github.com/KapIT/observe-utils/blob/4a9d0140e2dfcb15e85f9d5951692045265fb391/lib/observe-utils.js#L97-L133
50,617
zthun/zbuildtools
src/karma/zkarma.js
createKarmaTypescriptConfig
function createKarmaTypescriptConfig(tsconfigJson, coverageDir) { return { tsconfig: tsconfigJson, coverageOptions: { instrumentation: !isDebug() }, reports: { 'cobertura': { directory: coverageDir, sub...
javascript
function createKarmaTypescriptConfig(tsconfigJson, coverageDir) { return { tsconfig: tsconfigJson, coverageOptions: { instrumentation: !isDebug() }, reports: { 'cobertura': { directory: coverageDir, sub...
[ "function", "createKarmaTypescriptConfig", "(", "tsconfigJson", ",", "coverageDir", ")", "{", "return", "{", "tsconfig", ":", "tsconfigJson", ",", "coverageOptions", ":", "{", "instrumentation", ":", "!", "isDebug", "(", ")", "}", ",", "reports", ":", "{", "'c...
Creates an object that represents a karma typescript config object. @param {String} tsconfigJson The relative path to the tsconfig.json file. @param {String} coverageDir The coverage report directory. @return {Object} The common options for a karma typescript configuration.
[ "Creates", "an", "object", "that", "represents", "a", "karma", "typescript", "config", "object", "." ]
f9b339fc3c3b8188638ccd17a96cb44d457bafd4
https://github.com/zthun/zbuildtools/blob/f9b339fc3c3b8188638ccd17a96cb44d457bafd4/src/karma/zkarma.js#L39-L60
50,618
igorski/zjslib
src/Sprite.js
Sprite
function Sprite( aElement, aProperties, aContent ) { aProperties = aProperties || {}; var domElement = "div"; if ( aElement && typeof aElement !== "object" ) { domElement = /** @type {string} */ ( aElement); } /* creates HTML element of requested tag type in the DOM */ if ( !aE...
javascript
function Sprite( aElement, aProperties, aContent ) { aProperties = aProperties || {}; var domElement = "div"; if ( aElement && typeof aElement !== "object" ) { domElement = /** @type {string} */ ( aElement); } /* creates HTML element of requested tag type in the DOM */ if ( !aE...
[ "function", "Sprite", "(", "aElement", ",", "aProperties", ",", "aContent", ")", "{", "aProperties", "=", "aProperties", "||", "{", "}", ";", "var", "domElement", "=", "\"div\"", ";", "if", "(", "aElement", "&&", "typeof", "aElement", "!==", "\"object\"", ...
A wrapper providing a convenient API to manage a DOM element, provides Event handling and "display list"s extends a basic EventTarget for dispatching events @constructor @param {string|Element|Node|Window|HTMLDocument=} aElement when String: this function will create an element in the DOM with the String as tag name...
[ "A", "wrapper", "providing", "a", "convenient", "API", "to", "manage", "a", "DOM", "element", "provides", "Event", "handling", "and", "display", "list", "s" ]
d3c3fd49862d21de4646af0403c03f31b1134b00
https://github.com/igorski/zjslib/blob/d3c3fd49862d21de4646af0403c03f31b1134b00/src/Sprite.js#L50-L87
50,619
igorski/zjslib
src/Sprite.js
function( e ) { var event = new Event( aType ); event.target = self; event.srcEvent = e; aHandler( event ); }
javascript
function( e ) { var event = new Event( aType ); event.target = self; event.srcEvent = e; aHandler( event ); }
[ "function", "(", "e", ")", "{", "var", "event", "=", "new", "Event", "(", "aType", ")", ";", "event", ".", "target", "=", "self", ";", "event", ".", "srcEvent", "=", "e", ";", "aHandler", "(", "event", ")", ";", "}" ]
wrap the callback invocation to reference the Sprite, NOT the DOM node as its target
[ "wrap", "the", "callback", "invocation", "to", "reference", "the", "Sprite", "NOT", "the", "DOM", "node", "as", "its", "target" ]
d3c3fd49862d21de4646af0403c03f31b1134b00
https://github.com/igorski/zjslib/blob/d3c3fd49862d21de4646af0403c03f31b1134b00/src/Sprite.js#L180-L187
50,620
magemello/gulp-license-check
index.js
checkHeaderFromStream
function checkHeaderFromStream(file, ctx) { file.contents.pipe(es.wait(function (err, data) { if (err) { throw err; } var bufferFile = new File({ path: file.path, contents: data }); checkHeaderFromBuffer(bufferFile, ctx); })); }
javascript
function checkHeaderFromStream(file, ctx) { file.contents.pipe(es.wait(function (err, data) { if (err) { throw err; } var bufferFile = new File({ path: file.path, contents: data }); checkHeaderFromBuffer(bufferFile, ctx); })); }
[ "function", "checkHeaderFromStream", "(", "file", ",", "ctx", ")", "{", "file", ".", "contents", ".", "pipe", "(", "es", ".", "wait", "(", "function", "(", "err", ",", "data", ")", "{", "if", "(", "err", ")", "{", "throw", "err", ";", "}", "var", ...
Check header from stream. @param {object} file - current file from stream. @param {object} ctx - context. @returns {string[]} file in string[] format.
[ "Check", "header", "from", "stream", "." ]
fbd547b989a90f7ea3bb41304868a03ec207f204
https://github.com/magemello/gulp-license-check/blob/fbd547b989a90f7ea3bb41304868a03ec207f204/index.js#L59-L72
50,621
magemello/gulp-license-check
index.js
checkHeaderFromBuffer
function checkHeaderFromBuffer(file, ctx) { if (isLicenseHeaderPresent(file)) { log(file.path, ctx); } else { error(file.path, ctx); } }
javascript
function checkHeaderFromBuffer(file, ctx) { if (isLicenseHeaderPresent(file)) { log(file.path, ctx); } else { error(file.path, ctx); } }
[ "function", "checkHeaderFromBuffer", "(", "file", ",", "ctx", ")", "{", "if", "(", "isLicenseHeaderPresent", "(", "file", ")", ")", "{", "log", "(", "file", ".", "path", ",", "ctx", ")", ";", "}", "else", "{", "error", "(", "file", ".", "path", ",", ...
Check header from buffer. @param {object} file - current file from buffer. @param {object} ctx - context.
[ "Check", "header", "from", "buffer", "." ]
fbd547b989a90f7ea3bb41304868a03ec207f204
https://github.com/magemello/gulp-license-check/blob/fbd547b989a90f7ea3bb41304868a03ec207f204/index.js#L80-L86
50,622
magemello/gulp-license-check
index.js
readLicenseHeaderFile
function readLicenseHeaderFile() { if (licenseFileUtf8) { return licenseFileUtf8; } if (fs.existsSync(licenseFilePath)) { return fs.readFileSync(licenseFilePath, 'utf8').split(/\r?\n/); } throw new gutil.PluginError('gulp-license-check', new Error('The license header file doesn`t exist ' + licenseFile...
javascript
function readLicenseHeaderFile() { if (licenseFileUtf8) { return licenseFileUtf8; } if (fs.existsSync(licenseFilePath)) { return fs.readFileSync(licenseFilePath, 'utf8').split(/\r?\n/); } throw new gutil.PluginError('gulp-license-check', new Error('The license header file doesn`t exist ' + licenseFile...
[ "function", "readLicenseHeaderFile", "(", ")", "{", "if", "(", "licenseFileUtf8", ")", "{", "return", "licenseFileUtf8", ";", "}", "if", "(", "fs", ".", "existsSync", "(", "licenseFilePath", ")", ")", "{", "return", "fs", ".", "readFileSync", "(", "licenseFi...
Read the file header path. @returns {string[]} The license header template in sting[] format.
[ "Read", "the", "file", "header", "path", "." ]
fbd547b989a90f7ea3bb41304868a03ec207f204
https://github.com/magemello/gulp-license-check/blob/fbd547b989a90f7ea3bb41304868a03ec207f204/index.js#L104-L114
50,623
magemello/gulp-license-check
index.js
log
function log(filePath, ctx) { if (isInfoLogActive) { ctx.emit('log', { msg: HEADER_PRESENT, path: filePath }); gutil.log(gutil.colors.green(HEADER_PRESENT), filePath); } }
javascript
function log(filePath, ctx) { if (isInfoLogActive) { ctx.emit('log', { msg: HEADER_PRESENT, path: filePath }); gutil.log(gutil.colors.green(HEADER_PRESENT), filePath); } }
[ "function", "log", "(", "filePath", ",", "ctx", ")", "{", "if", "(", "isInfoLogActive", ")", "{", "ctx", ".", "emit", "(", "'log'", ",", "{", "msg", ":", "HEADER_PRESENT", ",", "path", ":", "filePath", "}", ")", ";", "gutil", ".", "log", "(", "guti...
Log util. @param {string} filePath - file Path. @param {object} ctx - context.
[ "Log", "util", "." ]
fbd547b989a90f7ea3bb41304868a03ec207f204
https://github.com/magemello/gulp-license-check/blob/fbd547b989a90f7ea3bb41304868a03ec207f204/index.js#L122-L130
50,624
magemello/gulp-license-check
index.js
error
function error(filePath, ctx) { if (isErrorBlocking) { throw new gutil.PluginError('gulp-license-check', new Error('The following file doesn`t contain the license header ' + filePath)); } else { logError(filePath, ctx); } }
javascript
function error(filePath, ctx) { if (isErrorBlocking) { throw new gutil.PluginError('gulp-license-check', new Error('The following file doesn`t contain the license header ' + filePath)); } else { logError(filePath, ctx); } }
[ "function", "error", "(", "filePath", ",", "ctx", ")", "{", "if", "(", "isErrorBlocking", ")", "{", "throw", "new", "gutil", ".", "PluginError", "(", "'gulp-license-check'", ",", "new", "Error", "(", "'The following file doesn`t contain the license header '", "+", ...
Manage error in case the header is not present. @param {string} filePath - file Path. @param {object} ctx - context.
[ "Manage", "error", "in", "case", "the", "header", "is", "not", "present", "." ]
fbd547b989a90f7ea3bb41304868a03ec207f204
https://github.com/magemello/gulp-license-check/blob/fbd547b989a90f7ea3bb41304868a03ec207f204/index.js#L138-L144
50,625
magemello/gulp-license-check
index.js
logError
function logError(filePath, ctx) { if (isErrorLogActive) { ctx.emit('log', { msg: HEADER_NOT_PRESENT, path: filePath }); gutil.log(gutil.colors.red(HEADER_NOT_PRESENT), filePath); } }
javascript
function logError(filePath, ctx) { if (isErrorLogActive) { ctx.emit('log', { msg: HEADER_NOT_PRESENT, path: filePath }); gutil.log(gutil.colors.red(HEADER_NOT_PRESENT), filePath); } }
[ "function", "logError", "(", "filePath", ",", "ctx", ")", "{", "if", "(", "isErrorLogActive", ")", "{", "ctx", ".", "emit", "(", "'log'", ",", "{", "msg", ":", "HEADER_NOT_PRESENT", ",", "path", ":", "filePath", "}", ")", ";", "gutil", ".", "log", "(...
Log error. @param {string} filePath - file Path. @param {object} ctx - context.
[ "Log", "error", "." ]
fbd547b989a90f7ea3bb41304868a03ec207f204
https://github.com/magemello/gulp-license-check/blob/fbd547b989a90f7ea3bb41304868a03ec207f204/index.js#L152-L160
50,626
magemello/gulp-license-check
index.js
isLicenseHeaderPresent
function isLicenseHeaderPresent(currentFile) { if (!isFileEmpty(currentFile.contents)) { var currentFileUtf8 = readCurrentFile(currentFile), licenseFileUtf8 = readLicenseHeaderFile(), skipStrict = 0; if(currentFileUtf8[0] === '"use strict";' ) { skipStrict = 1; } for (var i = skipStrict; i <...
javascript
function isLicenseHeaderPresent(currentFile) { if (!isFileEmpty(currentFile.contents)) { var currentFileUtf8 = readCurrentFile(currentFile), licenseFileUtf8 = readLicenseHeaderFile(), skipStrict = 0; if(currentFileUtf8[0] === '"use strict";' ) { skipStrict = 1; } for (var i = skipStrict; i <...
[ "function", "isLicenseHeaderPresent", "(", "currentFile", ")", "{", "if", "(", "!", "isFileEmpty", "(", "currentFile", ".", "contents", ")", ")", "{", "var", "currentFileUtf8", "=", "readCurrentFile", "(", "currentFile", ")", ",", "licenseFileUtf8", "=", "readLi...
Check if header is present. @param {object} currentFile - file in string[] format. @returns {boolean} dose match.
[ "Check", "if", "header", "is", "present", "." ]
fbd547b989a90f7ea3bb41304868a03ec207f204
https://github.com/magemello/gulp-license-check/blob/fbd547b989a90f7ea3bb41304868a03ec207f204/index.js#L169-L186
50,627
calleboketoft/ng2-browser-storage
src/browser-storage/services/browser-storage.util.js
getConfigFromLS
function getConfigFromLS() { var configStr = localStorage[getFullBSKey(browser_storage_config_1.browserStorageConfig.DB_CONFIG_KEY)]; if (typeof configStr === 'undefined') { return null; } else { return JSON.parse(configStr); } }
javascript
function getConfigFromLS() { var configStr = localStorage[getFullBSKey(browser_storage_config_1.browserStorageConfig.DB_CONFIG_KEY)]; if (typeof configStr === 'undefined') { return null; } else { return JSON.parse(configStr); } }
[ "function", "getConfigFromLS", "(", ")", "{", "var", "configStr", "=", "localStorage", "[", "getFullBSKey", "(", "browser_storage_config_1", ".", "browserStorageConfig", ".", "DB_CONFIG_KEY", ")", "]", ";", "if", "(", "typeof", "configStr", "===", "'undefined'", "...
get config from browser storage and deserialize to JSON
[ "get", "config", "from", "browser", "storage", "and", "deserialize", "to", "JSON" ]
7186096797957de62649bbb832a7c6b7d463d861
https://github.com/calleboketoft/ng2-browser-storage/blob/7186096797957de62649bbb832a7c6b7d463d861/src/browser-storage/services/browser-storage.util.js#L5-L13
50,628
calleboketoft/ng2-browser-storage
src/browser-storage/services/browser-storage.util.js
setConfigToLS
function setConfigToLS(configObj) { var configStr = JSON.stringify(configObj); window.localStorage[getFullBSKey(browser_storage_config_1.browserStorageConfig.DB_CONFIG_KEY)] = configStr; }
javascript
function setConfigToLS(configObj) { var configStr = JSON.stringify(configObj); window.localStorage[getFullBSKey(browser_storage_config_1.browserStorageConfig.DB_CONFIG_KEY)] = configStr; }
[ "function", "setConfigToLS", "(", "configObj", ")", "{", "var", "configStr", "=", "JSON", ".", "stringify", "(", "configObj", ")", ";", "window", ".", "localStorage", "[", "getFullBSKey", "(", "browser_storage_config_1", ".", "browserStorageConfig", ".", "DB_CONFI...
serialize config and save to browser storage
[ "serialize", "config", "and", "save", "to", "browser", "storage" ]
7186096797957de62649bbb832a7c6b7d463d861
https://github.com/calleboketoft/ng2-browser-storage/blob/7186096797957de62649bbb832a7c6b7d463d861/src/browser-storage/services/browser-storage.util.js#L16-L19
50,629
calleboketoft/ng2-browser-storage
src/browser-storage/services/browser-storage.util.js
getInitialBrowserStorageState
function getInitialBrowserStorageState() { var memorizedFile = getConfigFromLS()[browser_storage_config_1.browserStorageConfig.DB_INITIAL_KEY]; return memorizedFile.map(function (memItem) { var browserStorageValue = window[memItem.storageType]['getItem'](getFullBSKey(memItem.key)); if (browserSt...
javascript
function getInitialBrowserStorageState() { var memorizedFile = getConfigFromLS()[browser_storage_config_1.browserStorageConfig.DB_INITIAL_KEY]; return memorizedFile.map(function (memItem) { var browserStorageValue = window[memItem.storageType]['getItem'](getFullBSKey(memItem.key)); if (browserSt...
[ "function", "getInitialBrowserStorageState", "(", ")", "{", "var", "memorizedFile", "=", "getConfigFromLS", "(", ")", "[", "browser_storage_config_1", ".", "browserStorageConfig", ".", "DB_INITIAL_KEY", "]", ";", "return", "memorizedFile", ".", "map", "(", "function",...
go through memorized file config and get all separate browser storage values from keys
[ "go", "through", "memorized", "file", "config", "and", "get", "all", "separate", "browser", "storage", "values", "from", "keys" ]
7186096797957de62649bbb832a7c6b7d463d861
https://github.com/calleboketoft/ng2-browser-storage/blob/7186096797957de62649bbb832a7c6b7d463d861/src/browser-storage/services/browser-storage.util.js#L23-L34
50,630
calleboketoft/ng2-browser-storage
src/browser-storage/services/browser-storage.util.js
initFromScratch
function initFromScratch(cbsConfigFromFile) { cbsConfigFromFile.initialState.forEach(function (item) { return saveItemToBrowserStorage(item); }); return _a = {}, _a[browser_storage_config_1.browserStorageConfig.DB_INITIAL_KEY] = cbsConfigFromFile.initialState, _a; var _a; }
javascript
function initFromScratch(cbsConfigFromFile) { cbsConfigFromFile.initialState.forEach(function (item) { return saveItemToBrowserStorage(item); }); return _a = {}, _a[browser_storage_config_1.browserStorageConfig.DB_INITIAL_KEY] = cbsConfigFromFile.initialState, _a; var _a; }
[ "function", "initFromScratch", "(", "cbsConfigFromFile", ")", "{", "cbsConfigFromFile", ".", "initialState", ".", "forEach", "(", "function", "(", "item", ")", "{", "return", "saveItemToBrowserStorage", "(", "item", ")", ";", "}", ")", ";", "return", "_a", "="...
Initialize storage items from scratch
[ "Initialize", "storage", "items", "from", "scratch" ]
7186096797957de62649bbb832a7c6b7d463d861
https://github.com/calleboketoft/ng2-browser-storage/blob/7186096797957de62649bbb832a7c6b7d463d861/src/browser-storage/services/browser-storage.util.js#L55-L61
50,631
calleboketoft/ng2-browser-storage
src/browser-storage/services/browser-storage.util.js
initExisting
function initExisting(cbsConfigFromFile, cbsConfigFromLS) { // Restore items that have been manually removed by a user restoreManuallyRemovedItems(cbsConfigFromLS); var configFileDifferOptions = { fileInitialState: cbsConfigFromFile.initialState, memoryInitialState: cbsConfigFromLS[browser_s...
javascript
function initExisting(cbsConfigFromFile, cbsConfigFromLS) { // Restore items that have been manually removed by a user restoreManuallyRemovedItems(cbsConfigFromLS); var configFileDifferOptions = { fileInitialState: cbsConfigFromFile.initialState, memoryInitialState: cbsConfigFromLS[browser_s...
[ "function", "initExisting", "(", "cbsConfigFromFile", ",", "cbsConfigFromLS", ")", "{", "// Restore items that have been manually removed by a user", "restoreManuallyRemovedItems", "(", "cbsConfigFromLS", ")", ";", "var", "configFileDifferOptions", "=", "{", "fileInitialState", ...
Initialize storage items for existing config, handle any config file updates
[ "Initialize", "storage", "items", "for", "existing", "config", "handle", "any", "config", "file", "updates" ]
7186096797957de62649bbb832a7c6b7d463d861
https://github.com/calleboketoft/ng2-browser-storage/blob/7186096797957de62649bbb832a7c6b7d463d861/src/browser-storage/services/browser-storage.util.js#L63-L73
50,632
calleboketoft/ng2-browser-storage
src/browser-storage/services/browser-storage.util.js
restoreManuallyRemovedItems
function restoreManuallyRemovedItems(cbsConfigFromLS) { cbsConfigFromLS[browser_storage_config_1.browserStorageConfig.DB_INITIAL_KEY].map(function (memoryItem) { var storageItemValue = getItemValueFromBrowserStorage(memoryItem); // the storage item has been removed, put back from memory object ...
javascript
function restoreManuallyRemovedItems(cbsConfigFromLS) { cbsConfigFromLS[browser_storage_config_1.browserStorageConfig.DB_INITIAL_KEY].map(function (memoryItem) { var storageItemValue = getItemValueFromBrowserStorage(memoryItem); // the storage item has been removed, put back from memory object ...
[ "function", "restoreManuallyRemovedItems", "(", "cbsConfigFromLS", ")", "{", "cbsConfigFromLS", "[", "browser_storage_config_1", ".", "browserStorageConfig", ".", "DB_INITIAL_KEY", "]", ".", "map", "(", "function", "(", "memoryItem", ")", "{", "var", "storageItemValue",...
if an item has been manually removed from browser storage, restore it
[ "if", "an", "item", "has", "been", "manually", "removed", "from", "browser", "storage", "restore", "it" ]
7186096797957de62649bbb832a7c6b7d463d861
https://github.com/calleboketoft/ng2-browser-storage/blob/7186096797957de62649bbb832a7c6b7d463d861/src/browser-storage/services/browser-storage.util.js#L75-L83
50,633
blueflag/immutable-math
lib/transformations.js
percentBy
function percentBy(valueMapper) { var valueSetter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return function (input) { if (input.isEmpty()) { return input; } var percents = input.map(valueMapper).update(percent()); if (!valueSetter) ...
javascript
function percentBy(valueMapper) { var valueSetter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return function (input) { if (input.isEmpty()) { return input; } var percents = input.map(valueMapper).update(percent()); if (!valueSetter) ...
[ "function", "percentBy", "(", "valueMapper", ")", "{", "var", "valueSetter", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "null", ";", "return", "function", "(", ...
Like `percent`, but also accepts a `valueMapper` function which allows you to process child properties. @param {ValueMapper} valueMapper @param {ValueSetter} valueSetter @return {InputFunction}
[ "Like", "percent", "but", "also", "accepts", "a", "valueMapper", "function", "which", "allows", "you", "to", "process", "child", "properties", "." ]
64aba91517ce6836e0a3ebec2ba2b248408140f3
https://github.com/blueflag/immutable-math/blob/64aba91517ce6836e0a3ebec2ba2b248408140f3/lib/transformations.js#L39-L56
50,634
jamespdlynn/microjs
examples/game/lib/model/player.js
function(deltaTime){ var currentTime = new Date().getTime(); deltaTime = deltaTime || currentTime-this.lastUpdated; //Ignore minor updates if (deltaTime < 5){ return this; } deltaTime /= 1000; //convert to seconds //...
javascript
function(deltaTime){ var currentTime = new Date().getTime(); deltaTime = deltaTime || currentTime-this.lastUpdated; //Ignore minor updates if (deltaTime < 5){ return this; } deltaTime /= 1000; //convert to seconds //...
[ "function", "(", "deltaTime", ")", "{", "var", "currentTime", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "deltaTime", "=", "deltaTime", "||", "currentTime", "-", "this", ".", "lastUpdated", ";", "//Ignore minor updates", "if", "(", "delta...
Updates this player's velocity and position values @param {number} [deltaTime] Time interval in milliseconds (by default uses the amount of time since function last called) @returns {*}
[ "Updates", "this", "player", "s", "velocity", "and", "position", "values" ]
780a4074de84bcd74e3ae50d0ed64144b4474166
https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/model/player.js#L73-L140
50,635
jamespdlynn/microjs
examples/game/lib/model/player.js
function(posX, posY){ //Calculate the position deltas while account for zone boundaries var zoneWidth = Constants.Zone.WIDTH; var zoneHeight = Constants.Zone.HEIGHT; var deltaX = posX - this.get("posX"); if (Math.abs(deltaX) > zoneWidth/2){ (...
javascript
function(posX, posY){ //Calculate the position deltas while account for zone boundaries var zoneWidth = Constants.Zone.WIDTH; var zoneHeight = Constants.Zone.HEIGHT; var deltaX = posX - this.get("posX"); if (Math.abs(deltaX) > zoneWidth/2){ (...
[ "function", "(", "posX", ",", "posY", ")", "{", "//Calculate the position deltas while account for zone boundaries", "var", "zoneWidth", "=", "Constants", ".", "Zone", ".", "WIDTH", ";", "var", "zoneHeight", "=", "Constants", ".", "Zone", ".", "HEIGHT", ";", "var"...
Ease a player to a new position, by adding an auxiliary angle and velocity to update by. This function can serve as a "dead reckoning algorithm" to smooth difference between positions on the client and server @param {number} posX @param {number} posY @returns {*}
[ "Ease", "a", "player", "to", "a", "new", "position", "by", "adding", "an", "auxiliary", "angle", "and", "velocity", "to", "update", "by", ".", "This", "function", "can", "serve", "as", "a", "dead", "reckoning", "algorithm", "to", "smooth", "difference", "b...
780a4074de84bcd74e3ae50d0ed64144b4474166
https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/model/player.js#L149-L177
50,636
usingjsonschema/ujs-safefile-nodejs
lib/safeFile.js
readFileSync
function readFileSync (fileName, options) { verifyFileName (fileName); var info = getFileInfo (fileName); if (info.exists === false) { var message1 = format (cc.MSG_DOES_NOT_EXIST, fileName); throw new SafeFileError (cc.DOES_NOT_EXIST, message1); } if (info.isFile === false) { ...
javascript
function readFileSync (fileName, options) { verifyFileName (fileName); var info = getFileInfo (fileName); if (info.exists === false) { var message1 = format (cc.MSG_DOES_NOT_EXIST, fileName); throw new SafeFileError (cc.DOES_NOT_EXIST, message1); } if (info.isFile === false) { ...
[ "function", "readFileSync", "(", "fileName", ",", "options", ")", "{", "verifyFileName", "(", "fileName", ")", ";", "var", "info", "=", "getFileInfo", "(", "fileName", ")", ";", "if", "(", "info", ".", "exists", "===", "false", ")", "{", "var", "message1...
Read file. @param {String} fileName File to read. @returns {String} Data read from file. @throws SafeFileError
[ "Read", "file", "." ]
73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7
https://github.com/usingjsonschema/ujs-safefile-nodejs/blob/73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7/lib/safeFile.js#L23-L47
50,637
usingjsonschema/ujs-safefile-nodejs
lib/safeFile.js
writeFileSync
function writeFileSync (fileName, data, options) { verifyFileName (fileName); var info = getFileInfo (fileName); if ((info.exists === true) && (info.isFile === false)) { var message1 = format (cc.MSG_IS_NOT_A_FILE, fileName); throw new SafeFileError (cc.IS_NOT_A_FILE, message1); } ...
javascript
function writeFileSync (fileName, data, options) { verifyFileName (fileName); var info = getFileInfo (fileName); if ((info.exists === true) && (info.isFile === false)) { var message1 = format (cc.MSG_IS_NOT_A_FILE, fileName); throw new SafeFileError (cc.IS_NOT_A_FILE, message1); } ...
[ "function", "writeFileSync", "(", "fileName", ",", "data", ",", "options", ")", "{", "verifyFileName", "(", "fileName", ")", ";", "var", "info", "=", "getFileInfo", "(", "fileName", ")", ";", "if", "(", "(", "info", ".", "exists", "===", "true", ")", "...
Write data to a file. @param {String} fileName Name of file (path optional). @param {String} data Data to write. @throws SafeFileError
[ "Write", "data", "to", "a", "file", "." ]
73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7
https://github.com/usingjsonschema/ujs-safefile-nodejs/blob/73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7/lib/safeFile.js#L55-L76
50,638
usingjsonschema/ujs-safefile-nodejs
lib/safeFile.js
safeGetState
function safeGetState (fileName) { if ((fileName === undefined) || (fileName === null)) { return (cc.INVALID_NAME); } // if fileName exists, verify it is a file var info = getFileInfo (fileName); if ((info.exists) && (info.isFile === false)) { return (cc.IS_NOT_A_FILE); } va...
javascript
function safeGetState (fileName) { if ((fileName === undefined) || (fileName === null)) { return (cc.INVALID_NAME); } // if fileName exists, verify it is a file var info = getFileInfo (fileName); if ((info.exists) && (info.isFile === false)) { return (cc.IS_NOT_A_FILE); } va...
[ "function", "safeGetState", "(", "fileName", ")", "{", "if", "(", "(", "fileName", "===", "undefined", ")", "||", "(", "fileName", "===", "null", ")", ")", "{", "return", "(", "cc", ".", "INVALID_NAME", ")", ";", "}", "// if fileName exists, verify it is a f...
Get status of the file. @param {String} file Name of base file. @returns {Integer} SAFE_NORMAL, SAFE_AUTO_RECOVERABLE, SAFE_INTERVENE, INVALID_NAME, IS_NOT_A_FILE, or DOES_NOT_EXIST
[ "Get", "status", "of", "the", "file", "." ]
73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7
https://github.com/usingjsonschema/ujs-safefile-nodejs/blob/73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7/lib/safeFile.js#L84-L96
50,639
usingjsonschema/ujs-safefile-nodejs
lib/safeFile.js
safeRecover
function safeRecover (fileName) { verifyFileName (fileName); // if fileName exists, verify it is a file var info = getFileInfo (fileName); if ((info.exists) && (info.isFile === false)) { var message1 = format (cc.MSG_IS_NOT_A_FILE, fileName); throw new SafeFileError (cc.IS_NOT_A_FILE, m...
javascript
function safeRecover (fileName) { verifyFileName (fileName); // if fileName exists, verify it is a file var info = getFileInfo (fileName); if ((info.exists) && (info.isFile === false)) { var message1 = format (cc.MSG_IS_NOT_A_FILE, fileName); throw new SafeFileError (cc.IS_NOT_A_FILE, m...
[ "function", "safeRecover", "(", "fileName", ")", "{", "verifyFileName", "(", "fileName", ")", ";", "// if fileName exists, verify it is a file", "var", "info", "=", "getFileInfo", "(", "fileName", ")", ";", "if", "(", "(", "info", ".", "exists", ")", "&&", "("...
Initiate auto-recovery processing. @param {String} fileName Name of base file @throws SafeFileError
[ "Initiate", "auto", "-", "recovery", "processing", "." ]
73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7
https://github.com/usingjsonschema/ujs-safefile-nodejs/blob/73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7/lib/safeFile.js#L103-L121
50,640
usingjsonschema/ujs-safefile-nodejs
lib/safeFile.js
safeReadFileSync
function safeReadFileSync (fileName, options) { verifyFileName (fileName); // if fileName exists, verify it is a file var info = getFileInfo (fileName); if ((info.exists) && (info.isFile === false)) { var message = format (cc.MSG_IS_NOT_A_FILE, fileName); throw new SafeFileError (cc...
javascript
function safeReadFileSync (fileName, options) { verifyFileName (fileName); // if fileName exists, verify it is a file var info = getFileInfo (fileName); if ((info.exists) && (info.isFile === false)) { var message = format (cc.MSG_IS_NOT_A_FILE, fileName); throw new SafeFileError (cc...
[ "function", "safeReadFileSync", "(", "fileName", ",", "options", ")", "{", "verifyFileName", "(", "fileName", ")", ";", "// if fileName exists, verify it is a file", "var", "info", "=", "getFileInfo", "(", "fileName", ")", ";", "if", "(", "(", "info", ".", "exis...
Read a file, performing recovery processing if necessary. @param {String} file File to read. @returns {String} Data read from file. @throws SafeFileError
[ "Read", "a", "file", "performing", "recovery", "processing", "if", "necessary", "." ]
73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7
https://github.com/usingjsonschema/ujs-safefile-nodejs/blob/73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7/lib/safeFile.js#L129-L147
50,641
usingjsonschema/ujs-safefile-nodejs
lib/safeFile.js
safeWriteFileSync
function safeWriteFileSync (fileName, data, options) { verifyFileName (fileName); // if fileName exists, verify it is a file var info = getFileInfo (fileName); if ((info.exists) && (info.isFile === false)) { var message = format (cc.MSG_IS_NOT_A_FILE, fileName); throw new SafeFileEr...
javascript
function safeWriteFileSync (fileName, data, options) { verifyFileName (fileName); // if fileName exists, verify it is a file var info = getFileInfo (fileName); if ((info.exists) && (info.isFile === false)) { var message = format (cc.MSG_IS_NOT_A_FILE, fileName); throw new SafeFileEr...
[ "function", "safeWriteFileSync", "(", "fileName", ",", "data", ",", "options", ")", "{", "verifyFileName", "(", "fileName", ")", ";", "// if fileName exists, verify it is a file", "var", "info", "=", "getFileInfo", "(", "fileName", ")", ";", "if", "(", "(", "inf...
Write data to a file using a recoverable process. @param {String} fileName Name of file (path optional). @param {String} data Data to write. @throws SafeFileError
[ "Write", "data", "to", "a", "file", "using", "a", "recoverable", "process", "." ]
73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7
https://github.com/usingjsonschema/ujs-safefile-nodejs/blob/73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7/lib/safeFile.js#L155-L187
50,642
usingjsonschema/ujs-safefile-nodejs
lib/safeFile.js
verifyFileName
function verifyFileName (fileName) { // if fileName undefined or null, throw exception if ((fileName === undefined) || (fileName === null)) { var message1 = format (cc.MSG_INVALID_NAME); throw new SafeFileError (cc.INVALID_NAME, message1); } }
javascript
function verifyFileName (fileName) { // if fileName undefined or null, throw exception if ((fileName === undefined) || (fileName === null)) { var message1 = format (cc.MSG_INVALID_NAME); throw new SafeFileError (cc.INVALID_NAME, message1); } }
[ "function", "verifyFileName", "(", "fileName", ")", "{", "// if fileName undefined or null, throw exception", "if", "(", "(", "fileName", "===", "undefined", ")", "||", "(", "fileName", "===", "null", ")", ")", "{", "var", "message1", "=", "format", "(", "cc", ...
Verify fileName parameter. @param {String} fileName Name of file to verify. @throws SafeFileError
[ "Verify", "fileName", "parameter", "." ]
73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7
https://github.com/usingjsonschema/ujs-safefile-nodejs/blob/73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7/lib/safeFile.js#L194-L201
50,643
usingjsonschema/ujs-safefile-nodejs
lib/safeFile.js
getState
function getState (file) { // collect state for all possible data and recovery files var state = {}; state.ephemeral = getFileInfo (file + ".eph"); state.ready = getFileInfo (file + ".rdy"); state.base = getFileInfo (file); state.backup = getFileInfo (file + ".bak"); state.tertiary = getFile...
javascript
function getState (file) { // collect state for all possible data and recovery files var state = {}; state.ephemeral = getFileInfo (file + ".eph"); state.ready = getFileInfo (file + ".rdy"); state.base = getFileInfo (file); state.backup = getFileInfo (file + ".bak"); state.tertiary = getFile...
[ "function", "getState", "(", "file", ")", "{", "// collect state for all possible data and recovery files", "var", "state", "=", "{", "}", ";", "state", ".", "ephemeral", "=", "getFileInfo", "(", "file", "+", "\".eph\"", ")", ";", "state", ".", "ready", "=", "...
Get state for file system entities. @param {String} file Base file name. @returns {Object} State object.
[ "Get", "state", "for", "file", "system", "entities", "." ]
73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7
https://github.com/usingjsonschema/ujs-safefile-nodejs/blob/73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7/lib/safeFile.js#L208-L232
50,644
usingjsonschema/ujs-safefile-nodejs
lib/safeFile.js
performRecovery
function performRecovery (state, removeEphemeral) { // if ephemeral flag true, and ephemeral file exists, remove it if ((removeEphemeral) && (state.ephemeral.exists)) { fs.unlinkSync (state.ephemeral.name); } // if only backups exist, restore from backup var baseAvailable = state.base.exist...
javascript
function performRecovery (state, removeEphemeral) { // if ephemeral flag true, and ephemeral file exists, remove it if ((removeEphemeral) && (state.ephemeral.exists)) { fs.unlinkSync (state.ephemeral.name); } // if only backups exist, restore from backup var baseAvailable = state.base.exist...
[ "function", "performRecovery", "(", "state", ",", "removeEphemeral", ")", "{", "// if ephemeral flag true, and ephemeral file exists, remove it", "if", "(", "(", "removeEphemeral", ")", "&&", "(", "state", ".", "ephemeral", ".", "exists", ")", ")", "{", "fs", ".", ...
Evaluate save state, initiating recovery if necessary. @param {Object} state State object with file names and existence flags
[ "Evaluate", "save", "state", "initiating", "recovery", "if", "necessary", "." ]
73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7
https://github.com/usingjsonschema/ujs-safefile-nodejs/blob/73a50d0c74bb7c0f0b73a91312f10f7c3f78adb7/lib/safeFile.js#L260-L312
50,645
SciSpike/yaktor-ui-angular1
lib/parse.js
function (daString) { // stop shouting daString = daString.replace(/^([A-Z]*)$/, function (match, c) { return (c ? c.toLowerCase() : '') }) // prepare camels for _ daString = daString.replace(/([A-Z])/g, function (match, c) { return (c ? '_' + c : '') }) // conv...
javascript
function (daString) { // stop shouting daString = daString.replace(/^([A-Z]*)$/, function (match, c) { return (c ? c.toLowerCase() : '') }) // prepare camels for _ daString = daString.replace(/([A-Z])/g, function (match, c) { return (c ? '_' + c : '') }) // conv...
[ "function", "(", "daString", ")", "{", "// stop shouting", "daString", "=", "daString", ".", "replace", "(", "/", "^([A-Z]*)$", "/", ",", "function", "(", "match", ",", "c", ")", "{", "return", "(", "c", "?", "c", ".", "toLowerCase", "(", ")", ":", "...
Generate a UI model based on a SciSpike generated state matrix.
[ "Generate", "a", "UI", "model", "based", "on", "a", "SciSpike", "generated", "state", "matrix", "." ]
35c29a18045a5f0f7eeedd3781f77a155ed5b017
https://github.com/SciSpike/yaktor-ui-angular1/blob/35c29a18045a5f0f7eeedd3781f77a155ed5b017/lib/parse.js#L8-L27
50,646
biggora/trinte-creator
app/bin/trinte.js
bootModel
function bootModel(trinte, schema, file) { if (/\.js$/i.test(file)) { var name = file.replace(/\.js$/i, ''); var modelDir = path.resolve(__dirname, '../app/models'); trinte.models[name] = require(modelDir + '/' + name)(schema);// Include the mongoose file global[name] = trinte.models...
javascript
function bootModel(trinte, schema, file) { if (/\.js$/i.test(file)) { var name = file.replace(/\.js$/i, ''); var modelDir = path.resolve(__dirname, '../app/models'); trinte.models[name] = require(modelDir + '/' + name)(schema);// Include the mongoose file global[name] = trinte.models...
[ "function", "bootModel", "(", "trinte", ",", "schema", ",", "file", ")", "{", "if", "(", "/", "\\.js$", "/", "i", ".", "test", "(", "file", ")", ")", "{", "var", "name", "=", "file", ".", "replace", "(", "/", "\\.js$", "/", "i", ",", "''", ")",...
simplistic model support @param {TrinteJS} trinte - trinte app descriptor. @param {Schema} schema @param {String} file
[ "simplistic", "model", "support" ]
fdd723405418967ca8a690867940863fd77e636b
https://github.com/biggora/trinte-creator/blob/fdd723405418967ca8a690867940863fd77e636b/app/bin/trinte.js#L39-L46
50,647
mstrutt/node-match-media
main.js
convertUnit
function convertUnit (xUnit, mUnit, mVal) { if (xUnit !== mUnit) { if (mUnit === 'em') { mVal = options.px_em_ratio * mVal; } if (xUnit === 'em') { mVal = mVal/options.px_em_ratio; } } return mVal; }
javascript
function convertUnit (xUnit, mUnit, mVal) { if (xUnit !== mUnit) { if (mUnit === 'em') { mVal = options.px_em_ratio * mVal; } if (xUnit === 'em') { mVal = mVal/options.px_em_ratio; } } return mVal; }
[ "function", "convertUnit", "(", "xUnit", ",", "mUnit", ",", "mVal", ")", "{", "if", "(", "xUnit", "!==", "mUnit", ")", "{", "if", "(", "mUnit", "===", "'em'", ")", "{", "mVal", "=", "options", ".", "px_em_ratio", "*", "mVal", ";", "}", "if", "(", ...
checking for unit match and converting if needed
[ "checking", "for", "unit", "match", "and", "converting", "if", "needed" ]
6c239bfb6f154a6ac030ed9446b8fac0faa7e66a
https://github.com/mstrutt/node-match-media/blob/6c239bfb6f154a6ac030ed9446b8fac0faa7e66a/main.js#L11-L22
50,648
tnantoka/LooseLeaf
lib/looseleaf.js
loadModules
function loadModules(dir, container, args) { var files = fs.readdirSync(dir); for (var i = 0; i < files.length; i++) { var file = files[i]; var filePath = path.join(dir, file); if (fs.statSync(filePath).isDirectory()) { container[file] = {}; loadModules(filePath, container[file], args); ...
javascript
function loadModules(dir, container, args) { var files = fs.readdirSync(dir); for (var i = 0; i < files.length; i++) { var file = files[i]; var filePath = path.join(dir, file); if (fs.statSync(filePath).isDirectory()) { container[file] = {}; loadModules(filePath, container[file], args); ...
[ "function", "loadModules", "(", "dir", ",", "container", ",", "args", ")", "{", "var", "files", "=", "fs", ".", "readdirSync", "(", "dir", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "files", ".", "length", ";", "i", "++", ")", "...
Load and require js files to container obj from dir
[ "Load", "and", "require", "js", "files", "to", "container", "obj", "from", "dir" ]
0c6333977224d8f4ef7ad40415aa69e0ff76f7b5
https://github.com/tnantoka/LooseLeaf/blob/0c6333977224d8f4ef7ad40415aa69e0ff76f7b5/lib/looseleaf.js#L92-L107
50,649
mathieudutour/nplint
lib/cli-engine.js
loadPlugins
function loadPlugins(pluginNames) { if (pluginNames) { pluginNames.forEach(function(pluginName) { var pluginNamespace = util.getNamespace(pluginName), pluginNameWithoutNamespace = util.removeNameSpace(pluginName), pluginNameWithoutPrefix = util.removePluginPrefix(pluginNameWithoutNamespace),...
javascript
function loadPlugins(pluginNames) { if (pluginNames) { pluginNames.forEach(function(pluginName) { var pluginNamespace = util.getNamespace(pluginName), pluginNameWithoutNamespace = util.removeNameSpace(pluginName), pluginNameWithoutPrefix = util.removePluginPrefix(pluginNameWithoutNamespace),...
[ "function", "loadPlugins", "(", "pluginNames", ")", "{", "if", "(", "pluginNames", ")", "{", "pluginNames", ".", "forEach", "(", "function", "(", "pluginName", ")", "{", "var", "pluginNamespace", "=", "util", ".", "getNamespace", "(", "pluginName", ")", ",",...
Load the given plugins if they are not loaded already. @param {string[]} pluginNames An array of plugin names which should be loaded. @returns {void}
[ "Load", "the", "given", "plugins", "if", "they", "are", "not", "loaded", "already", "." ]
ef444abcc6dd08fb61d5fc8ce618598d4455e08e
https://github.com/mathieudutour/nplint/blob/ef444abcc6dd08fb61d5fc8ce618598d4455e08e/lib/cli-engine.js#L32-L52
50,650
mathieudutour/nplint
lib/cli-engine.js
CLIEngine
function CLIEngine(options) { /** * Stored options for this instance * @type {Object} */ this.options = assign(Object.create(defaultOptions), options || {}); // load in additional rules if (this.options.rulePaths) { this.options.rulePaths.forEach(function(rulesdir) { rules.load(rulesdir); ...
javascript
function CLIEngine(options) { /** * Stored options for this instance * @type {Object} */ this.options = assign(Object.create(defaultOptions), options || {}); // load in additional rules if (this.options.rulePaths) { this.options.rulePaths.forEach(function(rulesdir) { rules.load(rulesdir); ...
[ "function", "CLIEngine", "(", "options", ")", "{", "/**\n * Stored options for this instance\n * @type {Object}\n */", "this", ".", "options", "=", "assign", "(", "Object", ".", "create", "(", "defaultOptions", ")", ",", "options", "||", "{", "}", ")", ";", ...
Creates a new instance of the core CLI engine. @param {CLIEngineOptions} options The options for this instance. @constructor
[ "Creates", "a", "new", "instance", "of", "the", "core", "CLI", "engine", "." ]
ef444abcc6dd08fb61d5fc8ce618598d4455e08e
https://github.com/mathieudutour/nplint/blob/ef444abcc6dd08fb61d5fc8ce618598d4455e08e/lib/cli-engine.js#L120-L134
50,651
mathieudutour/nplint
lib/cli-engine.js
function(name, pluginobject) { var pluginNameWithoutPrefix = util.removePluginPrefix(util.removeNameSpace(name)); if (pluginobject.rules) { rules.import(pluginobject.rules, pluginNameWithoutPrefix); } loadedPlugins[pluginNameWithoutPrefix] = pluginobject; }
javascript
function(name, pluginobject) { var pluginNameWithoutPrefix = util.removePluginPrefix(util.removeNameSpace(name)); if (pluginobject.rules) { rules.import(pluginobject.rules, pluginNameWithoutPrefix); } loadedPlugins[pluginNameWithoutPrefix] = pluginobject; }
[ "function", "(", "name", ",", "pluginobject", ")", "{", "var", "pluginNameWithoutPrefix", "=", "util", ".", "removePluginPrefix", "(", "util", ".", "removeNameSpace", "(", "name", ")", ")", ";", "if", "(", "pluginobject", ".", "rules", ")", "{", "rules", "...
Add a plugin by passing it's configuration @param {string} name Name of the plugin. @param {Object} pluginobject Plugin configuration object. @returns {void}
[ "Add", "a", "plugin", "by", "passing", "it", "s", "configuration" ]
ef444abcc6dd08fb61d5fc8ce618598d4455e08e
https://github.com/mathieudutour/nplint/blob/ef444abcc6dd08fb61d5fc8ce618598d4455e08e/lib/cli-engine.js#L206-L212
50,652
mathieudutour/nplint
lib/cli-engine.js
function(directory) { if (!this.packageJSONFinder) { this.packageJSONFinder = new FileFinder(PACKAGE_FILENAME); } return this.packageJSONFinder.findInDirectoryOrParentsSync(directory || process.cwd()); }
javascript
function(directory) { if (!this.packageJSONFinder) { this.packageJSONFinder = new FileFinder(PACKAGE_FILENAME); } return this.packageJSONFinder.findInDirectoryOrParentsSync(directory || process.cwd()); }
[ "function", "(", "directory", ")", "{", "if", "(", "!", "this", ".", "packageJSONFinder", ")", "{", "this", ".", "packageJSONFinder", "=", "new", "FileFinder", "(", "PACKAGE_FILENAME", ")", ";", "}", "return", "this", ".", "packageJSONFinder", ".", "findInDi...
Find package.json from directory and parent directories. @param {string} directory The directory to start searching from. @returns {string[]} The paths of local config files found.
[ "Find", "package", ".", "json", "from", "directory", "and", "parent", "directories", "." ]
ef444abcc6dd08fb61d5fc8ce618598d4455e08e
https://github.com/mathieudutour/nplint/blob/ef444abcc6dd08fb61d5fc8ce618598d4455e08e/lib/cli-engine.js#L245-L251
50,653
layoutmanager/layoutmanager
build/define.js
function(moduleName, deps, callback) { //if (moduleName === "jquery/selector") { debugger; } if (!deps && !callback) { return; } // Allow deps to be optional. if (!callback && typeof deps === "function") { callback = deps; deps = undefined; } // Ensure dependencies is never falsey. deps = ...
javascript
function(moduleName, deps, callback) { //if (moduleName === "jquery/selector") { debugger; } if (!deps && !callback) { return; } // Allow deps to be optional. if (!callback && typeof deps === "function") { callback = deps; deps = undefined; } // Ensure dependencies is never falsey. deps = ...
[ "function", "(", "moduleName", ",", "deps", ",", "callback", ")", "{", "//if (moduleName === \"jquery/selector\") { debugger; }", "if", "(", "!", "deps", "&&", "!", "callback", ")", "{", "return", ";", "}", "// Allow deps to be optional.", "if", "(", "!", "callbac...
Register modules first, but do not execute the callbacks until a matching `require` has been requested for this module.
[ "Register", "modules", "first", "but", "do", "not", "execute", "the", "callbacks", "until", "a", "matching", "require", "has", "been", "requested", "for", "this", "module", "." ]
de01c901b570e3eb9f014bb43de7b363e5b22c99
https://github.com/layoutmanager/layoutmanager/blob/de01c901b570e3eb9f014bb43de7b363e5b22c99/build/define.js#L6-L40
50,654
Nazariglez/perenquen
lib/pixi/src/filters/shockwave/ShockwaveFilter.js
ShockwaveFilter
function ShockwaveFilter() { core.AbstractFilter.call(this, // vertex shader null, // fragment shader fs.readFileSync(__dirname + '/shockwave.frag', 'utf8'), // custom uniforms { center: { type: 'v2', value: { x: 0.5, y: 0.5 } }, params: { type...
javascript
function ShockwaveFilter() { core.AbstractFilter.call(this, // vertex shader null, // fragment shader fs.readFileSync(__dirname + '/shockwave.frag', 'utf8'), // custom uniforms { center: { type: 'v2', value: { x: 0.5, y: 0.5 } }, params: { type...
[ "function", "ShockwaveFilter", "(", ")", "{", "core", ".", "AbstractFilter", ".", "call", "(", "this", ",", "// vertex shader", "null", ",", "// fragment shader", "fs", ".", "readFileSync", "(", "__dirname", "+", "'/shockwave.frag'", ",", "'utf8'", ")", ",", "...
The ColorMatrixFilter class lets you apply a 4x4 matrix transformation on the RGBA color and alpha values of every pixel on your displayObject to produce a result with a new set of RGBA color and alpha values. It's pretty powerful! @class @extends AbstractFilter @memberof PIXI.filters
[ "The", "ColorMatrixFilter", "class", "lets", "you", "apply", "a", "4x4", "matrix", "transformation", "on", "the", "RGBA", "color", "and", "alpha", "values", "of", "every", "pixel", "on", "your", "displayObject", "to", "produce", "a", "result", "with", "a", "...
e023964d05afeefebdcac4e2044819fdfa3899ae
https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/filters/shockwave/ShockwaveFilter.js#L14-L28
50,655
canuc/ajaxs
ajaxs/index.js
getExtensionlessFilename
function getExtensionlessFilename( filename ) { return filename.substr( 0, filename.length - path.extname( filename ).length); }
javascript
function getExtensionlessFilename( filename ) { return filename.substr( 0, filename.length - path.extname( filename ).length); }
[ "function", "getExtensionlessFilename", "(", "filename", ")", "{", "return", "filename", ".", "substr", "(", "0", ",", "filename", ".", "length", "-", "path", ".", "extname", "(", "filename", ")", ".", "length", ")", ";", "}" ]
Synchronously retrieve the fixed filename. @param { string } filename The filename to remove the extension from
[ "Synchronously", "retrieve", "the", "fixed", "filename", "." ]
3bea19efbff83d903a9b34ccd60ade9473a95690
https://github.com/canuc/ajaxs/blob/3bea19efbff83d903a9b34ccd60ade9473a95690/ajaxs/index.js#L27-L29
50,656
canuc/ajaxs
ajaxs/index.js
templateWithArgs
function templateWithArgs( apiDir, apiName, apiFuncName ) { cacheAPIs[apiName] = { reg: (RegularCacheClient .replace(/%%api.root%%/g,apiDir) .replace(/%%api.name%%/g,apiName) .replace(/%%api.funcs%%/g,JSON.stringify(apiFuncName))), service: (ServiceCacheClient .replace(/%%api.root%%/g,apiDir) .repl...
javascript
function templateWithArgs( apiDir, apiName, apiFuncName ) { cacheAPIs[apiName] = { reg: (RegularCacheClient .replace(/%%api.root%%/g,apiDir) .replace(/%%api.name%%/g,apiName) .replace(/%%api.funcs%%/g,JSON.stringify(apiFuncName))), service: (ServiceCacheClient .replace(/%%api.root%%/g,apiDir) .repl...
[ "function", "templateWithArgs", "(", "apiDir", ",", "apiName", ",", "apiFuncName", ")", "{", "cacheAPIs", "[", "apiName", "]", "=", "{", "reg", ":", "(", "RegularCacheClient", ".", "replace", "(", "/", "%%api.root%%", "/", "g", ",", "apiDir", ")", ".", "...
Synchronously create a template
[ "Synchronously", "create", "a", "template" ]
3bea19efbff83d903a9b34ccd60ade9473a95690
https://github.com/canuc/ajaxs/blob/3bea19efbff83d903a9b34ccd60ade9473a95690/ajaxs/index.js#L34-L46
50,657
canuc/ajaxs
ajaxs/index.js
copyArgumentsArray
function copyArgumentsArray(args) { var copy = []; var index = 0; for (var i in args) { copy[index] = args[i]; index++; } return copy; }
javascript
function copyArgumentsArray(args) { var copy = []; var index = 0; for (var i in args) { copy[index] = args[i]; index++; } return copy; }
[ "function", "copyArgumentsArray", "(", "args", ")", "{", "var", "copy", "=", "[", "]", ";", "var", "index", "=", "0", ";", "for", "(", "var", "i", "in", "args", ")", "{", "copy", "[", "index", "]", "=", "args", "[", "i", "]", ";", "index", "++"...
Synchronously copy an arguments object array. @internal @param { object } args the objects array
[ "Synchronously", "copy", "an", "arguments", "object", "array", "." ]
3bea19efbff83d903a9b34ccd60ade9473a95690
https://github.com/canuc/ajaxs/blob/3bea19efbff83d903a9b34ccd60ade9473a95690/ajaxs/index.js#L53-L61
50,658
canuc/ajaxs
ajaxs/index.js
readRawBody
function readRawBody(req,res,rawBodyCallback,callbackScope) { if ( typeof req._body !== 'undefined' && req._body ) { rawBodyCallback.call(callbackScope,req,res); } else { req.rawBody = ''; req.setEncoding('utf8'); req.on('data', function(chunk) { req.rawBody += chunk; }); req.on('end', ...
javascript
function readRawBody(req,res,rawBodyCallback,callbackScope) { if ( typeof req._body !== 'undefined' && req._body ) { rawBodyCallback.call(callbackScope,req,res); } else { req.rawBody = ''; req.setEncoding('utf8'); req.on('data', function(chunk) { req.rawBody += chunk; }); req.on('end', ...
[ "function", "readRawBody", "(", "req", ",", "res", ",", "rawBodyCallback", ",", "callbackScope", ")", "{", "if", "(", "typeof", "req", ".", "_body", "!==", "'undefined'", "&&", "req", ".", "_body", ")", "{", "rawBodyCallback", ".", "call", "(", "callbackSc...
Asynchronous call to read the raw body from the request that we have deemed, as an API request. NOTE: This function implements a workaround if the middleware is placed after the body parser in the connect stack. @internal @param { object } req an expressjs http request object. @param { object } res an expressjs http ...
[ "Asynchronous", "call", "to", "read", "the", "raw", "body", "from", "the", "request", "that", "we", "have", "deemed", "as", "an", "API", "request", "." ]
3bea19efbff83d903a9b34ccd60ade9473a95690
https://github.com/canuc/ajaxs/blob/3bea19efbff83d903a9b34ccd60ade9473a95690/ajaxs/index.js#L119-L136
50,659
redisjs/jsr-conf
lib/config-error.js
ConfigError
function ConfigError(lineno, line, file, err) { this.name = ConfigError.name; Error.call(this); var fmt = '*** FATAL CONFIG FILE ERROR ***%s'; fmt += 'Reading the configuration file, at line %s%s'; fmt += '>>> %s%s'; fmt += err && err.message && !(err instanceof TypeDefError) ? err.message : 'Bad direc...
javascript
function ConfigError(lineno, line, file, err) { this.name = ConfigError.name; Error.call(this); var fmt = '*** FATAL CONFIG FILE ERROR ***%s'; fmt += 'Reading the configuration file, at line %s%s'; fmt += '>>> %s%s'; fmt += err && err.message && !(err instanceof TypeDefError) ? err.message : 'Bad direc...
[ "function", "ConfigError", "(", "lineno", ",", "line", ",", "file", ",", "err", ")", "{", "this", ".", "name", "=", "ConfigError", ".", "name", ";", "Error", ".", "call", "(", "this", ")", ";", "var", "fmt", "=", "'*** FATAL CONFIG FILE ERROR ***%s'", ";...
Represents a configuration file error. @param lineno The line number in the source file. @param line The line that triggered the error. @param file The configuration file being loaded. @param err A source error containing more detail.
[ "Represents", "a", "configuration", "file", "error", "." ]
97c5e2e77e1601c879a62dfc2d500df537eaaddd
https://github.com/redisjs/jsr-conf/blob/97c5e2e77e1601c879a62dfc2d500df537eaaddd/lib/config-error.js#L13-L26
50,660
jmjuanes/logty
lib/timestamp.js
function () { let date = new Date(); let result = {}; let regex = /(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d).\d\d\dZ/g; let current = regex.exec(date.toJSON()); if (current === null || current.length < 7) { return null; } for (let i = 0; i < 6; i++) { //The first element ...
javascript
function () { let date = new Date(); let result = {}; let regex = /(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d).\d\d\dZ/g; let current = regex.exec(date.toJSON()); if (current === null || current.length < 7) { return null; } for (let i = 0; i < 6; i++) { //The first element ...
[ "function", "(", ")", "{", "let", "date", "=", "new", "Date", "(", ")", ";", "let", "result", "=", "{", "}", ";", "let", "regex", "=", "/", "(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d).\\d\\d\\dZ", "/", "g", ";", "let", "current", "=", "regex...
Get the current time
[ "Get", "the", "current", "time" ]
47c4f9ea65f9443f54bd2ccb6a7277fb7c12201b
https://github.com/jmjuanes/logty/blob/47c4f9ea65f9443f54bd2ccb6a7277fb7c12201b/lib/timestamp.js#L10-L23
50,661
MakerCollider/upm_mc
doxy/node/generators/jsdoc/generator.js
generateDocs
function generateDocs(specjs) { var docs = GENERATE_MODULE(specjs.MODULE); docs = _.reduce(specjs.METHODS, function(memo, methodSpec, methodName) { return memo += GENERATE_METHOD(methodName, methodSpec); }, docs); docs = _.reduce(specjs.ENUMS, function(memo, enumSpec, enumName) { return memo += GENERATE...
javascript
function generateDocs(specjs) { var docs = GENERATE_MODULE(specjs.MODULE); docs = _.reduce(specjs.METHODS, function(memo, methodSpec, methodName) { return memo += GENERATE_METHOD(methodName, methodSpec); }, docs); docs = _.reduce(specjs.ENUMS, function(memo, enumSpec, enumName) { return memo += GENERATE...
[ "function", "generateDocs", "(", "specjs", ")", "{", "var", "docs", "=", "GENERATE_MODULE", "(", "specjs", ".", "MODULE", ")", ";", "docs", "=", "_", ".", "reduce", "(", "specjs", ".", "METHODS", ",", "function", "(", "memo", ",", "methodSpec", ",", "m...
generate JSDoc-style documentation
[ "generate", "JSDoc", "-", "style", "documentation" ]
525e775a17b85c30716c00435a2acb26bb198c12
https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/generators/jsdoc/generator.js#L30-L44
50,662
jamespdlynn/microjs
examples/game/lib/server.js
function(buffer){ //Deserialize binary data into a JSON object var data = micro.toJSON(buffer); var type = data._type; delete data._type; switch (type) { case "Ping" : ...
javascript
function(buffer){ //Deserialize binary data into a JSON object var data = micro.toJSON(buffer); var type = data._type; delete data._type; switch (type) { case "Ping" : ...
[ "function", "(", "buffer", ")", "{", "//Deserialize binary data into a JSON object", "var", "data", "=", "micro", ".", "toJSON", "(", "buffer", ")", ";", "var", "type", "=", "data", ".", "_type", ";", "delete", "data", ".", "_type", ";", "switch", "(", "ty...
Parse client sent binary data buffer
[ "Parse", "client", "sent", "binary", "data", "buffer" ]
780a4074de84bcd74e3ae50d0ed64144b4474166
https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/server.js#L194-L235
50,663
jamespdlynn/microjs
examples/game/lib/server.js
function(data){ data = data || {timestamps:[]}; data.timestamps.push(new Date().getTime()); send(connection, "Ping", data); }
javascript
function(data){ data = data || {timestamps:[]}; data.timestamps.push(new Date().getTime()); send(connection, "Ping", data); }
[ "function", "(", "data", ")", "{", "data", "=", "data", "||", "{", "timestamps", ":", "[", "]", "}", ";", "data", ".", "timestamps", ".", "push", "(", "new", "Date", "(", ")", ".", "getTime", "(", ")", ")", ";", "send", "(", "connection", ",", ...
Kick off the connection by pinging the client
[ "Kick", "off", "the", "connection", "by", "pinging", "the", "client" ]
780a4074de84bcd74e3ae50d0ed64144b4474166
https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/server.js#L238-L242
50,664
jamespdlynn/microjs
examples/game/lib/server.js
send
function send(conn,schemaName,json,byteLength){ var buffer = micro.toBinary(json, schemaName,byteLength); if (FAKE_LATENCY){ setTimeout(function(){ conn.sendBytes(buffer); },FAKE_LATENCY); }else{ conn.sendBytes(buffer); } }
javascript
function send(conn,schemaName,json,byteLength){ var buffer = micro.toBinary(json, schemaName,byteLength); if (FAKE_LATENCY){ setTimeout(function(){ conn.sendBytes(buffer); },FAKE_LATENCY); }else{ conn.sendBytes(buffer); } }
[ "function", "send", "(", "conn", ",", "schemaName", ",", "json", ",", "byteLength", ")", "{", "var", "buffer", "=", "micro", ".", "toBinary", "(", "json", ",", "schemaName", ",", "byteLength", ")", ";", "if", "(", "FAKE_LATENCY", ")", "{", "setTimeout", ...
Helper function that serializes a JSON data object according to a given schema, and then sends it through a given client connection @param {object} conn @param {string} schemaName @param {object} json @param {number} [byteLength]
[ "Helper", "function", "that", "serializes", "a", "JSON", "data", "object", "according", "to", "a", "given", "schema", "and", "then", "sends", "it", "through", "a", "given", "client", "connection" ]
780a4074de84bcd74e3ae50d0ed64144b4474166
https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/server.js#L259-L270
50,665
jamespdlynn/microjs
examples/game/lib/server.js
calculateLatency
function calculateLatency(timestamps){ var length = timestamps.length, sumLatency = 0; for (var i = 1; i < length; i++){ sumLatency += (timestamps[i] - timestamps[i-1])/2; } return (sumLatency/(length-1)); }
javascript
function calculateLatency(timestamps){ var length = timestamps.length, sumLatency = 0; for (var i = 1; i < length; i++){ sumLatency += (timestamps[i] - timestamps[i-1])/2; } return (sumLatency/(length-1)); }
[ "function", "calculateLatency", "(", "timestamps", ")", "{", "var", "length", "=", "timestamps", ".", "length", ",", "sumLatency", "=", "0", ";", "for", "(", "var", "i", "=", "1", ";", "i", "<", "length", ";", "i", "++", ")", "{", "sumLatency", "+=",...
Helper function that calculates the latency by getting the average of all the ping timestamps differences @param {Array.<number>} timestamps @returns {number}
[ "Helper", "function", "that", "calculates", "the", "latency", "by", "getting", "the", "average", "of", "all", "the", "ping", "timestamps", "differences" ]
780a4074de84bcd74e3ae50d0ed64144b4474166
https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/server.js#L278-L287
50,666
macbre/tap-eater
lib/tap-eater.js
eat
function eat(stream, callback) { if (!stream instanceof Stream) { throw 'eat() accepts Stream only!'; } this.callback = callback; this.consumer = new TapConsumer(); this.report = { pass: false, skip: false, fail: false, total: false, failures: [], text: '' }; // setup events this....
javascript
function eat(stream, callback) { if (!stream instanceof Stream) { throw 'eat() accepts Stream only!'; } this.callback = callback; this.consumer = new TapConsumer(); this.report = { pass: false, skip: false, fail: false, total: false, failures: [], text: '' }; // setup events this....
[ "function", "eat", "(", "stream", ",", "callback", ")", "{", "if", "(", "!", "stream", "instanceof", "Stream", ")", "{", "throw", "'eat() accepts Stream only!'", ";", "}", "this", ".", "callback", "=", "callback", ";", "this", ".", "consumer", "=", "new", ...
consumes TAP data from given stream
[ "consumes", "TAP", "data", "from", "given", "stream" ]
a4079972a021756ab1c58a433578d264305551ff
https://github.com/macbre/tap-eater/blob/a4079972a021756ab1c58a433578d264305551ff/lib/tap-eater.js#L102-L126
50,667
gethuman/pancakes-recipe
middleware/mw.service.init.js
init
function init(ctx) { var container = ctx.container; // reactors can be initialized without a promise since just attaching event handlers initReactors(container); // adapters and services may be making database calls, so do with promises return initAdapters(container) ...
javascript
function init(ctx) { var container = ctx.container; // reactors can be initialized without a promise since just attaching event handlers initReactors(container); // adapters and services may be making database calls, so do with promises return initAdapters(container) ...
[ "function", "init", "(", "ctx", ")", "{", "var", "container", "=", "ctx", ".", "container", ";", "// reactors can be initialized without a promise since just attaching event handlers", "initReactors", "(", "container", ")", ";", "// adapters and services may be making database ...
Initialize all the reactors, adapters and services @returns {Q}
[ "Initialize", "all", "the", "reactors", "adapters", "and", "services" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.service.init.js#L14-L28
50,668
gethuman/pancakes-recipe
middleware/mw.service.init.js
reactHandler
function reactHandler(reactData) { return function (eventData) { // handler should always be run asynchronously setTimeout(function () { var payload = eventData.payload; var inputData = payload.inputData; var reactor = reactors[reactData.t...
javascript
function reactHandler(reactData) { return function (eventData) { // handler should always be run asynchronously setTimeout(function () { var payload = eventData.payload; var inputData = payload.inputData; var reactor = reactors[reactData.t...
[ "function", "reactHandler", "(", "reactData", ")", "{", "return", "function", "(", "eventData", ")", "{", "// handler should always be run asynchronously", "setTimeout", "(", "function", "(", ")", "{", "var", "payload", "=", "eventData", ".", "payload", ";", "var"...
Get handler for a react event @param reactData @returns {Function}
[ "Get", "handler", "for", "a", "react", "event" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.service.init.js#L35-L69
50,669
gethuman/pancakes-recipe
middleware/mw.service.init.js
initReactors
function initReactors(container) { var isBatch = container === 'batch'; // loop through each reactor and call init if it exists _.each(reactors, function (reactor) { if (reactor.init) { reactor.init({ config: config, pancakes: pancakes }); } }); ...
javascript
function initReactors(container) { var isBatch = container === 'batch'; // loop through each reactor and call init if it exists _.each(reactors, function (reactor) { if (reactor.init) { reactor.init({ config: config, pancakes: pancakes }); } }); ...
[ "function", "initReactors", "(", "container", ")", "{", "var", "isBatch", "=", "container", "===", "'batch'", ";", "// loop through each reactor and call init if it exists", "_", ".", "each", "(", "reactors", ",", "function", "(", "reactor", ")", "{", "if", "(", ...
Call all reactor init functions and attach reactors based on reactor data within resource files. @param container
[ "Call", "all", "reactor", "init", "functions", "and", "attach", "reactors", "based", "on", "reactor", "data", "within", "resource", "files", "." ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.service.init.js#L76-L103
50,670
gethuman/pancakes-recipe
middleware/mw.service.init.js
initAdapters
function initAdapters(container) { var calls = []; if (container === 'webserver') { _.each(adapters, function (adapter) { if (adapter.webInit) { calls.push(adapter.webInit); } }); } else { _.each(ad...
javascript
function initAdapters(container) { var calls = []; if (container === 'webserver') { _.each(adapters, function (adapter) { if (adapter.webInit) { calls.push(adapter.webInit); } }); } else { _.each(ad...
[ "function", "initAdapters", "(", "container", ")", "{", "var", "calls", "=", "[", "]", ";", "if", "(", "container", "===", "'webserver'", ")", "{", "_", ".", "each", "(", "adapters", ",", "function", "(", "adapter", ")", "{", "if", "(", "adapter", "....
Initialize the adapters as long as the container is no webserver @param container @returns {*}
[ "Initialize", "the", "adapters", "as", "long", "as", "the", "container", "is", "no", "webserver" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.service.init.js#L111-L139
50,671
derdesign/protos
lib/application.js
function() { var args = [].slice.call(arguments, 0); var workerMessage, done = 0; var workerKeys = Object.keys(cluster.workers); var nextWorker = function() { if (workerKeys.length) { done++; cluster.workers[workerKeys.shift()].send(taskMessage.concat([a...
javascript
function() { var args = [].slice.call(arguments, 0); var workerMessage, done = 0; var workerKeys = Object.keys(cluster.workers); var nextWorker = function() { if (workerKeys.length) { done++; cluster.workers[workerKeys.shift()].send(taskMessage.concat([a...
[ "function", "(", ")", "{", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ",", "0", ")", ";", "var", "workerMessage", ",", "done", "=", "0", ";", "var", "workerKeys", "=", "Object", ".", "keys", "(", "cluster", ".", "w...
Master 1. Listen for worker messages and send task to all workers on receive Sends a message to all workers to run the task
[ "Master", "1", ".", "Listen", "for", "worker", "messages", "and", "send", "task", "to", "all", "workers", "on", "receive", "Sends", "a", "message", "to", "all", "workers", "to", "run", "the", "task" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L489-L508
50,672
derdesign/protos
lib/application.js
buildPartialView
function buildPartialView(path) { var self = this; var layoutPrefix = /^layout_/; var p = pathModule.basename(path); var pos = p.indexOf('.'); var ext = p.slice(pos+1); if (ext in this.enginesByExtension) { var engine = this.enginesByExtension[ext]; var func = engine.renderPartial(path)...
javascript
function buildPartialView(path) { var self = this; var layoutPrefix = /^layout_/; var p = pathModule.basename(path); var pos = p.indexOf('.'); var ext = p.slice(pos+1); if (ext in this.enginesByExtension) { var engine = this.enginesByExtension[ext]; var func = engine.renderPartial(path)...
[ "function", "buildPartialView", "(", "path", ")", "{", "var", "self", "=", "this", ";", "var", "layoutPrefix", "=", "/", "^layout_", "/", ";", "var", "p", "=", "pathModule", ".", "basename", "(", "path", ")", ";", "var", "pos", "=", "p", ".", "indexO...
Builds a partial view and caches its function
[ "Builds", "a", "partial", "view", "and", "caches", "its", "function" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L1910-L1954
50,673
derdesign/protos
lib/application.js
getDriverInstance
function getDriverInstance(driver, config) { if (!(driver in protos.drivers)) throw new Error(util.format("The '%s' driver is not loaded. Load it with app.loadDrivers('%s')", driver, driver)); return new protos.drivers[driver](config || {}); }
javascript
function getDriverInstance(driver, config) { if (!(driver in protos.drivers)) throw new Error(util.format("The '%s' driver is not loaded. Load it with app.loadDrivers('%s')", driver, driver)); return new protos.drivers[driver](config || {}); }
[ "function", "getDriverInstance", "(", "driver", ",", "config", ")", "{", "if", "(", "!", "(", "driver", "in", "protos", ".", "drivers", ")", ")", "throw", "new", "Error", "(", "util", ".", "format", "(", "\"The '%s' driver is not loaded. Load it with app.loadDri...
Returns a new driver instance
[ "Returns", "a", "new", "driver", "instance" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L1958-L1961
50,674
derdesign/protos
lib/application.js
getStorageInstance
function getStorageInstance(storage, config) { if (!(storage in protos.storages)) throw new Error(util.format("The '%s' storage is not loaded. Load it with app.loadStorages('%s')", storage, storage)); return new protos.storages[storage](config || {}); }
javascript
function getStorageInstance(storage, config) { if (!(storage in protos.storages)) throw new Error(util.format("The '%s' storage is not loaded. Load it with app.loadStorages('%s')", storage, storage)); return new protos.storages[storage](config || {}); }
[ "function", "getStorageInstance", "(", "storage", ",", "config", ")", "{", "if", "(", "!", "(", "storage", "in", "protos", ".", "storages", ")", ")", "throw", "new", "Error", "(", "util", ".", "format", "(", "\"The '%s' storage is not loaded. Load it with app.lo...
Returns a new storage instance
[ "Returns", "a", "new", "storage", "instance" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L1965-L1968
50,675
derdesign/protos
lib/application.js
loadControllers
function loadControllers() { // Note: runs on app context // Get controllers/ var cpath = this.mvcpath + 'controllers/', files = protos.util.getFiles(cpath); // Create controllers and attach to app var controllerCtor = protos.lib.controller; for (var controller, key, file, instance, className, ...
javascript
function loadControllers() { // Note: runs on app context // Get controllers/ var cpath = this.mvcpath + 'controllers/', files = protos.util.getFiles(cpath); // Create controllers and attach to app var controllerCtor = protos.lib.controller; for (var controller, key, file, instance, className, ...
[ "function", "loadControllers", "(", ")", "{", "// Note: runs on app context", "// Get controllers/", "var", "cpath", "=", "this", ".", "mvcpath", "+", "'controllers/'", ",", "files", "=", "protos", ".", "util", ".", "getFiles", "(", "cpath", ")", ";", "// Create...
Loads controllers & routes
[ "Loads", "controllers", "&", "routes" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L1972-L1997
50,676
derdesign/protos
lib/application.js
processControllerHandlers
function processControllerHandlers() { var self = this; var jsFile = this.regex.jsFile; var handlersPath = this.mvcpath + 'handlers'; var relPath = self.relPath(this.mvcpath) + 'handlers'; if (fs.existsSync(handlersPath)) { fs.readdirSync(handlersPath).forEach(function(dirname) { var dir = h...
javascript
function processControllerHandlers() { var self = this; var jsFile = this.regex.jsFile; var handlersPath = this.mvcpath + 'handlers'; var relPath = self.relPath(this.mvcpath) + 'handlers'; if (fs.existsSync(handlersPath)) { fs.readdirSync(handlersPath).forEach(function(dirname) { var dir = h...
[ "function", "processControllerHandlers", "(", ")", "{", "var", "self", "=", "this", ";", "var", "jsFile", "=", "this", ".", "regex", ".", "jsFile", ";", "var", "handlersPath", "=", "this", ".", "mvcpath", "+", "'handlers'", ";", "var", "relPath", "=", "s...
Processes controller handlers
[ "Processes", "controller", "handlers" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L2001-L2041
50,677
derdesign/protos
lib/application.js
parseConfig
function parseConfig() { // Get main config var p = this.path + '/config/', files = protos.util.getFiles(p), mainPos = files.indexOf('base.js'), jsExt = protos.regex.jsFile, configFile = this.path + '/config.js'; // If config.js is not present, use the one from skeleton to provide defa...
javascript
function parseConfig() { // Get main config var p = this.path + '/config/', files = protos.util.getFiles(p), mainPos = files.indexOf('base.js'), jsExt = protos.regex.jsFile, configFile = this.path + '/config.js'; // If config.js is not present, use the one from skeleton to provide defa...
[ "function", "parseConfig", "(", ")", "{", "// Get main config", "var", "p", "=", "this", ".", "path", "+", "'/config/'", ",", "files", "=", "protos", ".", "util", ".", "getFiles", "(", "p", ")", ",", "mainPos", "=", "files", ".", "indexOf", "(", "'base...
Parses the application configuration
[ "Parses", "the", "application", "configuration" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L2045-L2074
50,678
derdesign/protos
lib/application.js
watchPartial
function watchPartial(path, callback) { // Don't watch partials again when reloading if (this.watchPartials && RELOADING === false) { var self = this; self.debug('Watching Partial for changes: %s', self.relPath(path, 'app/views')); var watcher = chokidar.watch(path, {interval: self.confi...
javascript
function watchPartial(path, callback) { // Don't watch partials again when reloading if (this.watchPartials && RELOADING === false) { var self = this; self.debug('Watching Partial for changes: %s', self.relPath(path, 'app/views')); var watcher = chokidar.watch(path, {interval: self.confi...
[ "function", "watchPartial", "(", "path", ",", "callback", ")", "{", "// Don't watch partials again when reloading", "if", "(", "this", ".", "watchPartials", "&&", "RELOADING", "===", "false", ")", "{", "var", "self", "=", "this", ";", "self", ".", "debug", "("...
Watches a view Partial for changes
[ "Watches", "a", "view", "Partial", "for", "changes" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L2078-L2107
50,679
derdesign/protos
lib/application.js
parseDriverConfig
function parseDriverConfig() { var cfg, def, x, y, z, config = this.config.drivers, drivers = this.drivers; if (!config) config = this.config.drivers = {}; if (Object.keys(config).length === 0) return; for (x in config) { cfg = config[x]; if (x == 'default') { def = cfg; continue; } ...
javascript
function parseDriverConfig() { var cfg, def, x, y, z, config = this.config.drivers, drivers = this.drivers; if (!config) config = this.config.drivers = {}; if (Object.keys(config).length === 0) return; for (x in config) { cfg = config[x]; if (x == 'default') { def = cfg; continue; } ...
[ "function", "parseDriverConfig", "(", ")", "{", "var", "cfg", ",", "def", ",", "x", ",", "y", ",", "z", ",", "config", "=", "this", ".", "config", ".", "drivers", ",", "drivers", "=", "this", ".", "drivers", ";", "if", "(", "!", "config", ")", "c...
Parses database drivers from config
[ "Parses", "database", "drivers", "from", "config" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L2111-L2134
50,680
derdesign/protos
lib/application.js
parseStorageConfig
function parseStorageConfig() { var cfg, x, y, z, config = this.config.storages, storages = this.storages; if (!config) config = this.config.storages = {}; if (Object.keys(config).length === 0) return; for (x in config) { cfg = config[x]; for (y in cfg) { if (typeof cfg[y] == ...
javascript
function parseStorageConfig() { var cfg, x, y, z, config = this.config.storages, storages = this.storages; if (!config) config = this.config.storages = {}; if (Object.keys(config).length === 0) return; for (x in config) { cfg = config[x]; for (y in cfg) { if (typeof cfg[y] == ...
[ "function", "parseStorageConfig", "(", ")", "{", "var", "cfg", ",", "x", ",", "y", ",", "z", ",", "config", "=", "this", ".", "config", ".", "storages", ",", "storages", "=", "this", ".", "storages", ";", "if", "(", "!", "config", ")", "config", "=...
Parses storages from config
[ "Parses", "storages", "from", "config" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L2138-L2159
50,681
derdesign/protos
lib/application.js
loadAPI
function loadAPI() { var apiPath = this.fullPath(this.paths.api); if (fs.existsSync(apiPath) && fs.statSync(apiPath).isDirectory()) { var files = protos.util.ls(apiPath, this.regex.jsFile); files.forEach(function(file) { var methods = protos.require(apiPath + "/" + file, true); // Don't use module cac...
javascript
function loadAPI() { var apiPath = this.fullPath(this.paths.api); if (fs.existsSync(apiPath) && fs.statSync(apiPath).isDirectory()) { var files = protos.util.ls(apiPath, this.regex.jsFile); files.forEach(function(file) { var methods = protos.require(apiPath + "/" + file, true); // Don't use module cac...
[ "function", "loadAPI", "(", ")", "{", "var", "apiPath", "=", "this", ".", "fullPath", "(", "this", ".", "paths", ".", "api", ")", ";", "if", "(", "fs", ".", "existsSync", "(", "apiPath", ")", "&&", "fs", ".", "statSync", "(", "apiPath", ")", ".", ...
Loads the Application API
[ "Loads", "the", "Application", "API" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L2289-L2299
50,682
derdesign/protos
lib/application.js
loadHooks
function loadHooks() { var events = this._events; var jsFile = /\.js$/i; var hooksPath = this.fullPath('hook'); var loadedHooks = []; if (fs.existsSync(hooksPath)) { var files = protos.util.ls(hooksPath, jsFile); for (var cb,idx,evt,file,len=files.length,i=0; i < len; i++) { file = files[i]; ...
javascript
function loadHooks() { var events = this._events; var jsFile = /\.js$/i; var hooksPath = this.fullPath('hook'); var loadedHooks = []; if (fs.existsSync(hooksPath)) { var files = protos.util.ls(hooksPath, jsFile); for (var cb,idx,evt,file,len=files.length,i=0; i < len; i++) { file = files[i]; ...
[ "function", "loadHooks", "(", ")", "{", "var", "events", "=", "this", ".", "_events", ";", "var", "jsFile", "=", "/", "\\.js$", "/", "i", ";", "var", "hooksPath", "=", "this", ".", "fullPath", "(", "'hook'", ")", ";", "var", "loadedHooks", "=", "[", ...
Loads application hooks
[ "Loads", "application", "hooks" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L2303-L2361
50,683
derdesign/protos
lib/application.js
loadEngines
function loadEngines() { // Initialize engine properties this.enginesByExtension = {}; // Engine local variables var exts = []; var loadedEngines = this.loadedEngines = Object.keys(protos.engines); if (loadedEngines.length > 0) { // Get view engines var engine, instance, engineProps = ...
javascript
function loadEngines() { // Initialize engine properties this.enginesByExtension = {}; // Engine local variables var exts = []; var loadedEngines = this.loadedEngines = Object.keys(protos.engines); if (loadedEngines.length > 0) { // Get view engines var engine, instance, engineProps = ...
[ "function", "loadEngines", "(", ")", "{", "// Initialize engine properties", "this", ".", "enginesByExtension", "=", "{", "}", ";", "// Engine local variables", "var", "exts", "=", "[", "]", ";", "var", "loadedEngines", "=", "this", ".", "loadedEngines", "=", "O...
Loads view engines
[ "Loads", "view", "engines" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L2365-L2428
50,684
derdesign/protos
lib/application.js
buildTemplatePartial
function buildTemplatePartial(path) { var tplDir = app.mvcpath + app.paths.templates; var p = path.replace(tplDir, ''); var pos = p.indexOf('.'); var ext = p.slice(pos+1); var tpl = p.slice(0,pos); if (ext in this.enginesByExtension) { var engine = this.enginesByExtension[ext]; var func = e...
javascript
function buildTemplatePartial(path) { var tplDir = app.mvcpath + app.paths.templates; var p = path.replace(tplDir, ''); var pos = p.indexOf('.'); var ext = p.slice(pos+1); var tpl = p.slice(0,pos); if (ext in this.enginesByExtension) { var engine = this.enginesByExtension[ext]; var func = e...
[ "function", "buildTemplatePartial", "(", "path", ")", "{", "var", "tplDir", "=", "app", ".", "mvcpath", "+", "app", ".", "paths", ".", "templates", ";", "var", "p", "=", "path", ".", "replace", "(", "tplDir", ",", "''", ")", ";", "var", "pos", "=", ...
Builds a template partial
[ "Builds", "a", "template", "partial" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L2542-L2566
50,685
derdesign/protos
lib/application.js
setupViewPartials
function setupViewPartials() { // Set view path association object this.views.pathAsoc = {}; // Partial & template regexes var self = this; var exts = this.templateExtensions; var partialRegex = new RegExp('\/views\/(.+)\/partials\/[a-zA-Z0-9-_]+\\.(' + exts.join('|') + ')$'); var templateRegex = new ...
javascript
function setupViewPartials() { // Set view path association object this.views.pathAsoc = {}; // Partial & template regexes var self = this; var exts = this.templateExtensions; var partialRegex = new RegExp('\/views\/(.+)\/partials\/[a-zA-Z0-9-_]+\\.(' + exts.join('|') + ')$'); var templateRegex = new ...
[ "function", "setupViewPartials", "(", ")", "{", "// Set view path association object", "this", ".", "views", ".", "pathAsoc", "=", "{", "}", ";", "// Partial & template regexes", "var", "self", "=", "this", ";", "var", "exts", "=", "this", ".", "templateExtensions...
Configures View Partials
[ "Configures", "View", "Partials" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L2570-L2688
50,686
derdesign/protos
lib/application.js
createControllerFunction
function createControllerFunction(func) { var Handlebars = protos.require('handlebars'); var context, newFunc, compile, source, funcSrc = func.toString(); var code = funcSrc .trim() .replace(/^function\s+(.*?)(\s+)?\{(\s+)?/, '') .replace(/(\s+)?\}$/, ''); // Get source file path var...
javascript
function createControllerFunction(func) { var Handlebars = protos.require('handlebars'); var context, newFunc, compile, source, funcSrc = func.toString(); var code = funcSrc .trim() .replace(/^function\s+(.*?)(\s+)?\{(\s+)?/, '') .replace(/(\s+)?\}$/, ''); // Get source file path var...
[ "function", "createControllerFunction", "(", "func", ")", "{", "var", "Handlebars", "=", "protos", ".", "require", "(", "'handlebars'", ")", ";", "var", "context", ",", "newFunc", ",", "compile", ",", "source", ",", "funcSrc", "=", "func", ".", "toString", ...
Converts a regular function into a controller constructor
[ "Converts", "a", "regular", "function", "into", "a", "controller", "constructor" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/application.js#L2692-L2777
50,687
yefremov/aggregatejs
percentile.js
percentile
function percentile(array, k) { var length = array.length; if (length === 0) { return 0; } if (typeof k !== 'number') { throw new TypeError('k must be a number'); } if (k <= 0) { return array[0]; } if (k >= 1) { return array[length - 1]; } array.sort(function (a, b) { return...
javascript
function percentile(array, k) { var length = array.length; if (length === 0) { return 0; } if (typeof k !== 'number') { throw new TypeError('k must be a number'); } if (k <= 0) { return array[0]; } if (k >= 1) { return array[length - 1]; } array.sort(function (a, b) { return...
[ "function", "percentile", "(", "array", ",", "k", ")", "{", "var", "length", "=", "array", ".", "length", ";", "if", "(", "length", "===", "0", ")", "{", "return", "0", ";", "}", "if", "(", "typeof", "k", "!==", "'number'", ")", "{", "throw", "ne...
Returns the `k`-th percentile of values in `array`. @param {Array} array Range of data that defines relative standing. @param {number} k The percentile value that is between 0 through 1. @return {number} @example percentile([100, -100, 150, -50, 100, 250], 0.25); // => -12.5 percentile([100, -100, 150, -50, 100, 250...
[ "Returns", "the", "k", "-", "th", "percentile", "of", "values", "in", "array", "." ]
932b28a15a5707135e7095950000a838db409511
https://github.com/yefremov/aggregatejs/blob/932b28a15a5707135e7095950000a838db409511/percentile.js#L26-L59
50,688
lepisma/coelacanth
src.js
mergeObject
function mergeObject (oldObject, newObject) { let oldCopy = Object.assign({}, oldObject) function _merge (oo, no) { for (let key in no) { if (key in oo) { // Follow structure of oo if (oo[key] === Object(oo[key])) { _merge(oo[key], no[key]) } else if (no[key] !== Object(...
javascript
function mergeObject (oldObject, newObject) { let oldCopy = Object.assign({}, oldObject) function _merge (oo, no) { for (let key in no) { if (key in oo) { // Follow structure of oo if (oo[key] === Object(oo[key])) { _merge(oo[key], no[key]) } else if (no[key] !== Object(...
[ "function", "mergeObject", "(", "oldObject", ",", "newObject", ")", "{", "let", "oldCopy", "=", "Object", ".", "assign", "(", "{", "}", ",", "oldObject", ")", "function", "_merge", "(", "oo", ",", "no", ")", "{", "for", "(", "let", "key", "in", "no",...
Merge two objects with nested data
[ "Merge", "two", "objects", "with", "nested", "data" ]
fdfa70dadafe5f74850eb1f8eba41ce7a9ac56a1
https://github.com/lepisma/coelacanth/blob/fdfa70dadafe5f74850eb1f8eba41ce7a9ac56a1/src.js#L4-L25
50,689
subfuzion/snapfinder-lib
main.js
connect
function connect(mongodbUri, callback) { snapdb.connect(mongodbUri, function(err, client) { if (err) return callback(err); callback(null, client); }); }
javascript
function connect(mongodbUri, callback) { snapdb.connect(mongodbUri, function(err, client) { if (err) return callback(err); callback(null, client); }); }
[ "function", "connect", "(", "mongodbUri", ",", "callback", ")", "{", "snapdb", ".", "connect", "(", "mongodbUri", ",", "function", "(", "err", ",", "client", ")", "{", "if", "(", "err", ")", "return", "callback", "(", "err", ")", ";", "callback", "(", ...
Connect to the snapdb mongo database.
[ "Connect", "to", "the", "snapdb", "mongo", "database", "." ]
121172f10a9ec64bc5f3d749fba97662b336caae
https://github.com/subfuzion/snapfinder-lib/blob/121172f10a9ec64bc5f3d749fba97662b336caae/main.js#L16-L21
50,690
subfuzion/snapfinder-lib
main.js
findStoresInZip
function findStoresInZip(address, callback) { geo.geocode(address, function(err, georesult) { if (err) return callback(err); snapdb.findStoresInZip(georesult.zip5, function(err, stores) { if (err) return callback(err); georesult.stores = stores; return callback(null, georesult); }); }...
javascript
function findStoresInZip(address, callback) { geo.geocode(address, function(err, georesult) { if (err) return callback(err); snapdb.findStoresInZip(georesult.zip5, function(err, stores) { if (err) return callback(err); georesult.stores = stores; return callback(null, georesult); }); }...
[ "function", "findStoresInZip", "(", "address", ",", "callback", ")", "{", "geo", ".", "geocode", "(", "address", ",", "function", "(", "err", ",", "georesult", ")", "{", "if", "(", "err", ")", "return", "callback", "(", "err", ")", ";", "snapdb", ".", ...
Find stores within a zip code. @param address a valid address, address fragment, or pair of coordinates
[ "Find", "stores", "within", "a", "zip", "code", "." ]
121172f10a9ec64bc5f3d749fba97662b336caae
https://github.com/subfuzion/snapfinder-lib/blob/121172f10a9ec64bc5f3d749fba97662b336caae/main.js#L66-L76
50,691
subfuzion/snapfinder-lib
main.js
sortStoresByDistance
function sortStoresByDistance(location, stores) { var i, s; for (i = 0; i < stores.length; i++) { s = stores[i]; s.distance = geo.getDistanceInMiles(location, { lat:s.latitude, lng:s.longitude }); } stores.sort(function(a,b) { return a.distance - b.distance; }); return stores; }
javascript
function sortStoresByDistance(location, stores) { var i, s; for (i = 0; i < stores.length; i++) { s = stores[i]; s.distance = geo.getDistanceInMiles(location, { lat:s.latitude, lng:s.longitude }); } stores.sort(function(a,b) { return a.distance - b.distance; }); return stores; }
[ "function", "sortStoresByDistance", "(", "location", ",", "stores", ")", "{", "var", "i", ",", "s", ";", "for", "(", "i", "=", "0", ";", "i", "<", "stores", ".", "length", ";", "i", "++", ")", "{", "s", "=", "stores", "[", "i", "]", ";", "s", ...
Sorts the stores array in distance order from location, and also returns it. @param location an object with lat and lng properties @param stores an array of store objects
[ "Sorts", "the", "stores", "array", "in", "distance", "order", "from", "location", "and", "also", "returns", "it", "." ]
121172f10a9ec64bc5f3d749fba97662b336caae
https://github.com/subfuzion/snapfinder-lib/blob/121172f10a9ec64bc5f3d749fba97662b336caae/main.js#L83-L94
50,692
peerigon/value
lib/value.js
setup
function setup(subject) { context.subject = subject; context.subjectType = null; context.subjectConstructor = null; context.isSet = false; }
javascript
function setup(subject) { context.subject = subject; context.subjectType = null; context.subjectConstructor = null; context.isSet = false; }
[ "function", "setup", "(", "subject", ")", "{", "context", ".", "subject", "=", "subject", ";", "context", ".", "subjectType", "=", "null", ";", "context", ".", "subjectConstructor", "=", "null", ";", "context", ".", "isSet", "=", "false", ";", "}" ]
Resets all values of the context object. @private @param subject
[ "Resets", "all", "values", "of", "the", "context", "object", "." ]
5cdaad2c9c5d9431b0d123196571f1e708e42b40
https://github.com/peerigon/value/blob/5cdaad2c9c5d9431b0d123196571f1e708e42b40/lib/value.js#L211-L216
50,693
MaximTovstashev/brest
lib/utils/reject_fields.js
rejectFields
function rejectFields(result, fields) { // If result is an array, then rejection rules are applied to each array entry if (_.isArray(result)) { return _.map(result, (single_entry) => _.omit(single_entry, fields)); } return _.omit(result, fields); }
javascript
function rejectFields(result, fields) { // If result is an array, then rejection rules are applied to each array entry if (_.isArray(result)) { return _.map(result, (single_entry) => _.omit(single_entry, fields)); } return _.omit(result, fields); }
[ "function", "rejectFields", "(", "result", ",", "fields", ")", "{", "// If result is an array, then rejection rules are applied to each array entry", "if", "(", "_", ".", "isArray", "(", "result", ")", ")", "{", "return", "_", ".", "map", "(", "result", ",", "(", ...
Reject fields from result @param result @param fields @return {*}
[ "Reject", "fields", "from", "result" ]
9b0bd6ee452e55b86cd01d1647f0dff460ad191f
https://github.com/MaximTovstashev/brest/blob/9b0bd6ee452e55b86cd01d1647f0dff460ad191f/lib/utils/reject_fields.js#L9-L15
50,694
jonschlinkert/detect-conflicts
index.js
stringDiff
function stringDiff(existing, proposed, method) { method = method || 'diffJson'; lazy.diff[method](existing, proposed).forEach(function (res) { var color = utils.gray; if (res.added) color = utils.green; if (res.removed) color = utils.red; process.stdout.write(color(res.value)); }); console.log(...
javascript
function stringDiff(existing, proposed, method) { method = method || 'diffJson'; lazy.diff[method](existing, proposed).forEach(function (res) { var color = utils.gray; if (res.added) color = utils.green; if (res.removed) color = utils.red; process.stdout.write(color(res.value)); }); console.log(...
[ "function", "stringDiff", "(", "existing", ",", "proposed", ",", "method", ")", "{", "method", "=", "method", "||", "'diffJson'", ";", "lazy", ".", "diff", "[", "method", "]", "(", "existing", ",", "proposed", ")", ".", "forEach", "(", "function", "(", ...
Show a diff comparison of the existing content versus the content about to be written. @param {String} `existing` @param {String} `proposed` @param {String} method Optionally pass a specific method name from the [diff] library to use for the diff. @return {String} Visual diff comparison.
[ "Show", "a", "diff", "comparison", "of", "the", "existing", "content", "versus", "the", "content", "about", "to", "be", "written", "." ]
851acf9e57923eb791e9974ad92b4cba5c7fe44e
https://github.com/jonschlinkert/detect-conflicts/blob/851acf9e57923eb791e9974ad92b4cba5c7fe44e/index.js#L94-L103
50,695
jonschlinkert/detect-conflicts
index.js
ask
function ask(file, opts, cb) { if (typeof opts === 'function') { cb = opts; opts = {}; } opts = opts || {}; var prompt = lazy.inquirer.createPromptModule(); var fp = path.relative(process.cwd(), file.path); var questions = { name: 'action', type: 'expand', message: 'Overwrite `' + fp + ...
javascript
function ask(file, opts, cb) { if (typeof opts === 'function') { cb = opts; opts = {}; } opts = opts || {}; var prompt = lazy.inquirer.createPromptModule(); var fp = path.relative(process.cwd(), file.path); var questions = { name: 'action', type: 'expand', message: 'Overwrite `' + fp + ...
[ "function", "ask", "(", "file", ",", "opts", ",", "cb", ")", "{", "if", "(", "typeof", "opts", "===", "'function'", ")", "{", "cb", "=", "opts", ";", "opts", "=", "{", "}", ";", "}", "opts", "=", "opts", "||", "{", "}", ";", "var", "prompt", ...
Prompt the user for feedback. @param {Object} `file` @param {Function} `cb`
[ "Prompt", "the", "user", "for", "feedback", "." ]
851acf9e57923eb791e9974ad92b4cba5c7fe44e
https://github.com/jonschlinkert/detect-conflicts/blob/851acf9e57923eb791e9974ad92b4cba5c7fe44e/index.js#L112-L196
50,696
willemdewit/java.properties.js
lib/java.properties.js
splitEscaped
function splitEscaped(src, separator) { let escapeFlag = false, token = '', result = []; src.split('').forEach(letter => { if (escapeFlag) { token += letter; escapeFlag = false; } else if (letter === '\\') { escapeFlag = true; } else if...
javascript
function splitEscaped(src, separator) { let escapeFlag = false, token = '', result = []; src.split('').forEach(letter => { if (escapeFlag) { token += letter; escapeFlag = false; } else if (letter === '\\') { escapeFlag = true; } else if...
[ "function", "splitEscaped", "(", "src", ",", "separator", ")", "{", "let", "escapeFlag", "=", "false", ",", "token", "=", "''", ",", "result", "=", "[", "]", ";", "src", ".", "split", "(", "''", ")", ".", "forEach", "(", "letter", "=>", "{", "if", ...
Split a string using a separator, if not preceded by a backslash. For simplicity, this does not correctly handle two preceding backslashes @param src {String} value to parse @param separator {String} single character separator @returns []
[ "Split", "a", "string", "using", "a", "separator", "if", "not", "preceded", "by", "a", "backslash", ".", "For", "simplicity", "this", "does", "not", "correctly", "handle", "two", "preceding", "backslashes" ]
dfd733f74e8bc0d196a7238caf92bdae07a80aa5
https://github.com/willemdewit/java.properties.js/blob/dfd733f74e8bc0d196a7238caf92bdae07a80aa5/lib/java.properties.js#L33-L54
50,697
willemdewit/java.properties.js
lib/java.properties.js
combineMultiLines
function combineMultiLines(lines) { return lines.reduce((acc, cur) => { const line = acc[acc.length - 1]; if (acc.length && isLineContinued(line)) { acc[acc.length - 1] = line.replace(/\\$/, ''); acc[acc.length - 1] += cur; } else { acc.push(cur); ...
javascript
function combineMultiLines(lines) { return lines.reduce((acc, cur) => { const line = acc[acc.length - 1]; if (acc.length && isLineContinued(line)) { acc[acc.length - 1] = line.replace(/\\$/, ''); acc[acc.length - 1] += cur; } else { acc.push(cur); ...
[ "function", "combineMultiLines", "(", "lines", ")", "{", "return", "lines", ".", "reduce", "(", "(", "acc", ",", "cur", ")", "=>", "{", "const", "line", "=", "acc", "[", "acc", ".", "length", "-", "1", "]", ";", "if", "(", "acc", ".", "length", "...
Combines lines which end with a backslash with the next line @param lines {String[]} @returns {String[]}
[ "Combines", "lines", "which", "end", "with", "a", "backslash", "with", "the", "next", "line" ]
dfd733f74e8bc0d196a7238caf92bdae07a80aa5
https://github.com/willemdewit/java.properties.js/blob/dfd733f74e8bc0d196a7238caf92bdae07a80aa5/lib/java.properties.js#L120-L131
50,698
feedhenry/fh-mbaas-middleware
lib/util/mongo.js
createDb
function createDb(config, dbUser, dbUserPass, dbName, cb) { log.logger.trace({user: dbUser, pwd: dbUserPass, name: dbName}, 'creating new datatbase'); var url = config.mongoUrl; var admin = config.mongo.admin_auth.user; var admin_pass = config.mongo.admin_auth.pass; MongoClient.connect(url, function(err, db)...
javascript
function createDb(config, dbUser, dbUserPass, dbName, cb) { log.logger.trace({user: dbUser, pwd: dbUserPass, name: dbName}, 'creating new datatbase'); var url = config.mongoUrl; var admin = config.mongo.admin_auth.user; var admin_pass = config.mongo.admin_auth.pass; MongoClient.connect(url, function(err, db)...
[ "function", "createDb", "(", "config", ",", "dbUser", ",", "dbUserPass", ",", "dbName", ",", "cb", ")", "{", "log", ".", "logger", ".", "trace", "(", "{", "user", ":", "dbUser", ",", "pwd", ":", "dbUserPass", ",", "name", ":", "dbName", "}", ",", "...
create a database, including user name and pwd
[ "create", "a", "database", "including", "user", "name", "and", "pwd" ]
f906e98efbb4b0963bf5137b34b5e0589ba24e69
https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/util/mongo.js#L16-L44
50,699
feedhenry/fh-mbaas-middleware
lib/util/mongo.js
dropDb
function dropDb(config, dbUser, dbName, cb){ log.logger.trace({user: dbUser, name: dbName}, 'drop database'); var url = config.mongoUrl; var admin = config.mongo.admin_auth.user; var admin_pass = config.mongo.admin_auth.pass; MongoClient.connect(url, function(err, dbObj){ if (err) return handleError(n...
javascript
function dropDb(config, dbUser, dbName, cb){ log.logger.trace({user: dbUser, name: dbName}, 'drop database'); var url = config.mongoUrl; var admin = config.mongo.admin_auth.user; var admin_pass = config.mongo.admin_auth.pass; MongoClient.connect(url, function(err, dbObj){ if (err) return handleError(n...
[ "function", "dropDb", "(", "config", ",", "dbUser", ",", "dbName", ",", "cb", ")", "{", "log", ".", "logger", ".", "trace", "(", "{", "user", ":", "dbUser", ",", "name", ":", "dbName", "}", ",", "'drop database'", ")", ";", "var", "url", "=", "conf...
drop a database
[ "drop", "a", "database" ]
f906e98efbb4b0963bf5137b34b5e0589ba24e69
https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/util/mongo.js#L47-L73