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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47,700 | slideme/rorschach | index.js | initZooKeeper | function initZooKeeper(rorschach, connectionString, options) {
var error;
var zk = zookeeper.createClient(connectionString, options);
rorschach.zk = zk;
zk.connect();
zk.on('connected', onconnected);
zk.on('expired', setError);
zk.on('authenticationFailed', setError);
zk.on('disconnected', ondisconnec... | javascript | function initZooKeeper(rorschach, connectionString, options) {
var error;
var zk = zookeeper.createClient(connectionString, options);
rorschach.zk = zk;
zk.connect();
zk.on('connected', onconnected);
zk.on('expired', setError);
zk.on('authenticationFailed', setError);
zk.on('disconnected', ondisconnec... | [
"function",
"initZooKeeper",
"(",
"rorschach",
",",
"connectionString",
",",
"options",
")",
"{",
"var",
"error",
";",
"var",
"zk",
"=",
"zookeeper",
".",
"createClient",
"(",
"connectionString",
",",
"options",
")",
";",
"rorschach",
".",
"zk",
"=",
"zk",
... | Initialize connection with ZooKeeper.
@param {Rorschach} rorschach Rorschach instance
@param {String} connectionString Connection string
@param {Object} options ZooKeeper options. | [
"Initialize",
"connection",
"with",
"ZooKeeper",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/index.js#L183-L251 |
47,701 | zakandrewking/tinier | src/tinier.js | updateComponents | function updateComponents (address, node, state, diff, bindings, renderResult,
relativeAddress, stateCallers, opts) {
// TODO pull these out to top level
const updateRecurse = ([ d, s ], k) => {
// TODO in updateRecurse functions where k can be null, there must be a
// nicer way t... | javascript | function updateComponents (address, node, state, diff, bindings, renderResult,
relativeAddress, stateCallers, opts) {
// TODO pull these out to top level
const updateRecurse = ([ d, s ], k) => {
// TODO in updateRecurse functions where k can be null, there must be a
// nicer way t... | [
"function",
"updateComponents",
"(",
"address",
",",
"node",
",",
"state",
",",
"diff",
",",
"bindings",
",",
"renderResult",
",",
"relativeAddress",
",",
"stateCallers",
",",
"opts",
")",
"{",
"// TODO pull these out to top level",
"const",
"updateRecurse",
"=",
... | Run create, update, and destroy for component.
@param {Array} address - The location of the component in the state.
@param {Object} node - A model or a node within a model.
@param {Object} diff - The diff object for this component.
@param {Object|null} bindings -
@param {Object|null} renderResult -
@param {Object} stat... | [
"Run",
"create",
"update",
"and",
"destroy",
"for",
"component",
"."
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L444-L486 |
47,702 | zakandrewking/tinier | src/tinier.js | treeGet | function treeGet (address, tree) {
return address.reduce((accum, val) => {
return checkType(NODE, accum) ? accum.children[val] : accum[val]
}, tree)
} | javascript | function treeGet (address, tree) {
return address.reduce((accum, val) => {
return checkType(NODE, accum) ? accum.children[val] : accum[val]
}, tree)
} | [
"function",
"treeGet",
"(",
"address",
",",
"tree",
")",
"{",
"return",
"address",
".",
"reduce",
"(",
"(",
"accum",
",",
"val",
")",
"=>",
"{",
"return",
"checkType",
"(",
"NODE",
",",
"accum",
")",
"?",
"accum",
".",
"children",
"[",
"val",
"]",
... | Get the value in a tree.
@param {Array} address -
@param {Object} tree -
@return {*} - The value at the given address. | [
"Get",
"the",
"value",
"in",
"a",
"tree",
"."
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L513-L517 |
47,703 | zakandrewking/tinier | src/tinier.js | treeSet | function treeSet (address, tree, value) {
if (address.length === 0) {
return value
} else {
const [ k, rest ] = head(address)
return (typeof k === 'string' ?
{ ...tree, [k]: treeSet(rest, treeGet([ k ], tree), value) } :
[ ...tree.slice(0, k), treeSet(rest, treeGet([ k ], tree), ... | javascript | function treeSet (address, tree, value) {
if (address.length === 0) {
return value
} else {
const [ k, rest ] = head(address)
return (typeof k === 'string' ?
{ ...tree, [k]: treeSet(rest, treeGet([ k ], tree), value) } :
[ ...tree.slice(0, k), treeSet(rest, treeGet([ k ], tree), ... | [
"function",
"treeSet",
"(",
"address",
",",
"tree",
",",
"value",
")",
"{",
"if",
"(",
"address",
".",
"length",
"===",
"0",
")",
"{",
"return",
"value",
"}",
"else",
"{",
"const",
"[",
"k",
",",
"rest",
"]",
"=",
"head",
"(",
"address",
")",
"re... | Set the value in a tree; immutable.
@param {Array} address -
@param {Object} tree -
@param {*} value - The new value to set at address.
@return (*) The new tree. | [
"Set",
"the",
"value",
"in",
"a",
"tree",
";",
"immutable",
"."
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L526-L536 |
47,704 | zakandrewking/tinier | src/tinier.js | treeSetMutable | function treeSetMutable (address, tree, value) {
if (address.length === 0) {
return value
} else {
const [ rest, last ] = tail(address)
const parent = treeGet(rest, tree)
if (checkType(NODE, parent)) {
parent.children[last] = value
} else {
parent[last] = value
}
return tree
... | javascript | function treeSetMutable (address, tree, value) {
if (address.length === 0) {
return value
} else {
const [ rest, last ] = tail(address)
const parent = treeGet(rest, tree)
if (checkType(NODE, parent)) {
parent.children[last] = value
} else {
parent[last] = value
}
return tree
... | [
"function",
"treeSetMutable",
"(",
"address",
",",
"tree",
",",
"value",
")",
"{",
"if",
"(",
"address",
".",
"length",
"===",
"0",
")",
"{",
"return",
"value",
"}",
"else",
"{",
"const",
"[",
"rest",
",",
"last",
"]",
"=",
"tail",
"(",
"address",
... | Set the value in a tree; mutable.
@param {Array} address -
@param {Object} tree -
@param {*} value - The new value to set at address.
@return (*) The tree. | [
"Set",
"the",
"value",
"in",
"a",
"tree",
";",
"mutable",
"."
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L545-L558 |
47,705 | zakandrewking/tinier | src/tinier.js | diffWithModel | function diffWithModel (modelNode, state, lastState, address,
triggeringAddress) {
return match(modelNode, match_diffWithModel, null, modelNode, state,
lastState, address, triggeringAddress)
} | javascript | function diffWithModel (modelNode, state, lastState, address,
triggeringAddress) {
return match(modelNode, match_diffWithModel, null, modelNode, state,
lastState, address, triggeringAddress)
} | [
"function",
"diffWithModel",
"(",
"modelNode",
",",
"state",
",",
"lastState",
",",
"address",
",",
"triggeringAddress",
")",
"{",
"return",
"match",
"(",
"modelNode",
",",
"match_diffWithModel",
",",
"null",
",",
"modelNode",
",",
"state",
",",
"lastState",
"... | Compute the full diff tree for the model node. Calls shouldUpdate. | [
"Compute",
"the",
"full",
"diff",
"tree",
"for",
"the",
"model",
"node",
".",
"Calls",
"shouldUpdate",
"."
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L711-L715 |
47,706 | zakandrewking/tinier | src/tinier.js | singleOrAll | function singleOrAll (modelNode, address, minTreeAr) {
const getMin = indices => {
if (indices.length === 0) {
// If all elements in the array are null, return null.
return null
} else if (nonNullIndices.signals.length === 1) {
// If there is a single value, return that tree, with an updated... | javascript | function singleOrAll (modelNode, address, minTreeAr) {
const getMin = indices => {
if (indices.length === 0) {
// If all elements in the array are null, return null.
return null
} else if (nonNullIndices.signals.length === 1) {
// If there is a single value, return that tree, with an updated... | [
"function",
"singleOrAll",
"(",
"modelNode",
",",
"address",
",",
"minTreeAr",
")",
"{",
"const",
"getMin",
"=",
"indices",
"=>",
"{",
"if",
"(",
"indices",
".",
"length",
"===",
"0",
")",
"{",
"// If all elements in the array are null, return null.",
"return",
... | For an array of minSignals and minUpdate trees, return the minimal trees that
represent the whole array. | [
"For",
"an",
"array",
"of",
"minSignals",
"and",
"minUpdate",
"trees",
"return",
"the",
"minimal",
"trees",
"that",
"represent",
"the",
"whole",
"array",
"."
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L721-L768 |
47,707 | zakandrewking/tinier | src/tinier.js | makeSignalsAPI | function makeSignalsAPI (signalNames, isCollection) {
return fromPairs(signalNames.map(name => {
return [ name, makeOneSignalAPI(isCollection) ]
}))
} | javascript | function makeSignalsAPI (signalNames, isCollection) {
return fromPairs(signalNames.map(name => {
return [ name, makeOneSignalAPI(isCollection) ]
}))
} | [
"function",
"makeSignalsAPI",
"(",
"signalNames",
",",
"isCollection",
")",
"{",
"return",
"fromPairs",
"(",
"signalNames",
".",
"map",
"(",
"name",
"=>",
"{",
"return",
"[",
"name",
",",
"makeOneSignalAPI",
"(",
"isCollection",
")",
"]",
"}",
")",
")",
"}... | Implement the signals API. | [
"Implement",
"the",
"signals",
"API",
"."
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L867-L871 |
47,708 | zakandrewking/tinier | src/tinier.js | runSignalSetup | function runSignalSetup (component, address, stateCallers) {
const signalsAPI = makeSignalsAPI(component.signalNames, false)
const childSignalsAPI = makeChildSignalsAPI(component.model)
const reducers = patchReducersWithState(address, component, stateCallers.callReducer)
const signals = patchSignals(address, co... | javascript | function runSignalSetup (component, address, stateCallers) {
const signalsAPI = makeSignalsAPI(component.signalNames, false)
const childSignalsAPI = makeChildSignalsAPI(component.model)
const reducers = patchReducersWithState(address, component, stateCallers.callReducer)
const signals = patchSignals(address, co... | [
"function",
"runSignalSetup",
"(",
"component",
",",
"address",
",",
"stateCallers",
")",
"{",
"const",
"signalsAPI",
"=",
"makeSignalsAPI",
"(",
"component",
".",
"signalNames",
",",
"false",
")",
"const",
"childSignalsAPI",
"=",
"makeChildSignalsAPI",
"(",
"comp... | Run signalSetup with the component.
@param {Object} component -
@param {Array} address -
@param {Object} stateCallers -
@return {Object} Object with keys signalsAPI and childSignalsAPI. | [
"Run",
"signalSetup",
"with",
"the",
"component",
"."
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L921-L937 |
47,709 | zakandrewking/tinier | src/tinier.js | makeCallSignal | function makeCallSignal (signals, opts) {
return (address, signalName, arg) => {
if (opts.verbose) {
console.log('Called signal ' + signalName + ' at [' + address.join(', ') +
'].')
}
signals.get(address).data.signals[signalName].call(arg)
}
} | javascript | function makeCallSignal (signals, opts) {
return (address, signalName, arg) => {
if (opts.verbose) {
console.log('Called signal ' + signalName + ' at [' + address.join(', ') +
'].')
}
signals.get(address).data.signals[signalName].call(arg)
}
} | [
"function",
"makeCallSignal",
"(",
"signals",
",",
"opts",
")",
"{",
"return",
"(",
"address",
",",
"signalName",
",",
"arg",
")",
"=>",
"{",
"if",
"(",
"opts",
".",
"verbose",
")",
"{",
"console",
".",
"log",
"(",
"'Called signal '",
"+",
"signalName",
... | Return a callSignal function. | [
"Return",
"a",
"callSignal",
"function",
"."
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L1269-L1277 |
47,710 | zakandrewking/tinier | src/tinier.js | keyBy | function keyBy (arr, key) {
var obj = {}
arr.map(x => obj[x[key]] = x)
return obj
} | javascript | function keyBy (arr, key) {
var obj = {}
arr.map(x => obj[x[key]] = x)
return obj
} | [
"function",
"keyBy",
"(",
"arr",
",",
"key",
")",
"{",
"var",
"obj",
"=",
"{",
"}",
"arr",
".",
"map",
"(",
"x",
"=>",
"obj",
"[",
"x",
"[",
"key",
"]",
"]",
"=",
"x",
")",
"return",
"obj",
"}"
] | Turn an array of objects into a new object of objects where the keys are
given by the value of `key` in each child object.
@param {[Object]} arr - The array of objects.
@param {String} key - The key to look for. | [
"Turn",
"an",
"array",
"of",
"objects",
"into",
"a",
"new",
"object",
"of",
"objects",
"where",
"the",
"keys",
"are",
"given",
"by",
"the",
"value",
"of",
"key",
"in",
"each",
"child",
"object",
"."
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L1470-L1474 |
47,711 | zakandrewking/tinier | src/tinier.js | isText | function isText (o) {
return (o && typeof o === 'object' && o !== null &&
o.nodeType === 3 && typeof o.nodeName === 'string')
} | javascript | function isText (o) {
return (o && typeof o === 'object' && o !== null &&
o.nodeType === 3 && typeof o.nodeName === 'string')
} | [
"function",
"isText",
"(",
"o",
")",
"{",
"return",
"(",
"o",
"&&",
"typeof",
"o",
"===",
"'object'",
"&&",
"o",
"!==",
"null",
"&&",
"o",
".",
"nodeType",
"===",
"3",
"&&",
"typeof",
"o",
".",
"nodeName",
"===",
"'string'",
")",
"}"
] | Returns true if it is a DOM text element. | [
"Returns",
"true",
"if",
"it",
"is",
"a",
"DOM",
"text",
"element",
"."
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L1492-L1495 |
47,712 | zakandrewking/tinier | src/tinier.js | flattenElementsAr | function flattenElementsAr (ar) {
return ar.reduce((acc, el) => {
return isArray(el) ? [ ...acc, ...el ] : [ ...acc, el ]
}, []).filter(notNull) // null means ignore
} | javascript | function flattenElementsAr (ar) {
return ar.reduce((acc, el) => {
return isArray(el) ? [ ...acc, ...el ] : [ ...acc, el ]
}, []).filter(notNull) // null means ignore
} | [
"function",
"flattenElementsAr",
"(",
"ar",
")",
"{",
"return",
"ar",
".",
"reduce",
"(",
"(",
"acc",
",",
"el",
")",
"=>",
"{",
"return",
"isArray",
"(",
"el",
")",
"?",
"[",
"...",
"acc",
",",
"...",
"el",
"]",
":",
"[",
"...",
"acc",
",",
"e... | flatten the elements array | [
"flatten",
"the",
"elements",
"array"
] | 05ee87bc6a52d9f411b45d145e0a62f543039a07 | https://github.com/zakandrewking/tinier/blob/05ee87bc6a52d9f411b45d145e0a62f543039a07/src/tinier.js#L1689-L1693 |
47,713 | nodejitsu/npm-search-pagelet | client.js | redirect | function redirect(e) {
if (e && e.preventDefault) e.preventDefault();
//
// Assume that the value in the $control_input is uptodate. If not get the
// value directly through the constructor. When the selectize is still
// loading results the `getValue()` will return an empty value. This is why
... | javascript | function redirect(e) {
if (e && e.preventDefault) e.preventDefault();
//
// Assume that the value in the $control_input is uptodate. If not get the
// value directly through the constructor. When the selectize is still
// loading results the `getValue()` will return an empty value. This is why
... | [
"function",
"redirect",
"(",
"e",
")",
"{",
"if",
"(",
"e",
"&&",
"e",
".",
"preventDefault",
")",
"e",
".",
"preventDefault",
"(",
")",
";",
"//",
"// Assume that the value in the $control_input is uptodate. If not get the",
"// value directly through the constructor. Wh... | Bypass the submit functionality and just redirect manually so we don't have
to do a server callback.
@param {Event} e Optional event
@api private | [
"Bypass",
"the",
"submit",
"functionality",
"and",
"just",
"redirect",
"manually",
"so",
"we",
"don",
"t",
"have",
"to",
"do",
"a",
"server",
"callback",
"."
] | a6086c627b69c36c0cf638dc994c25f3d9d5df72 | https://github.com/nodejitsu/npm-search-pagelet/blob/a6086c627b69c36c0cf638dc994c25f3d9d5df72/client.js#L13-L28 |
47,714 | nodejitsu/npm-search-pagelet | client.js | load | function load(query, callback) {
if (!query.length) return callback();
pagelet.complete(query, function complete(err, results) {
if (err) return callback();
callback(results);
});
} | javascript | function load(query, callback) {
if (!query.length) return callback();
pagelet.complete(query, function complete(err, results) {
if (err) return callback();
callback(results);
});
} | [
"function",
"load",
"(",
"query",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"query",
".",
"length",
")",
"return",
"callback",
"(",
")",
";",
"pagelet",
".",
"complete",
"(",
"query",
",",
"function",
"complete",
"(",
"err",
",",
"results",
")",
"{"... | Load the autocomplete results through the Pagelet's RPC methods.
@param {String} query Thing that we search for
@param {Function} callback Callback
@api private | [
"Load",
"the",
"autocomplete",
"results",
"through",
"the",
"Pagelet",
"s",
"RPC",
"methods",
"."
] | a6086c627b69c36c0cf638dc994c25f3d9d5df72 | https://github.com/nodejitsu/npm-search-pagelet/blob/a6086c627b69c36c0cf638dc994c25f3d9d5df72/client.js#L46-L54 |
47,715 | nodejitsu/npm-search-pagelet | client.js | render | function render(item, escape) {
return [
'<div class="completed">',
'<strong class="name">'+ escape(item.name) +'</strong>',
'string' === typeof item.desc ? '<span class="description">'+ escape(item.desc) +'</span>' : '',
'</div>'
].join('');
} | javascript | function render(item, escape) {
return [
'<div class="completed">',
'<strong class="name">'+ escape(item.name) +'</strong>',
'string' === typeof item.desc ? '<span class="description">'+ escape(item.desc) +'</span>' : '',
'</div>'
].join('');
} | [
"function",
"render",
"(",
"item",
",",
"escape",
")",
"{",
"return",
"[",
"'<div class=\"completed\">'",
",",
"'<strong class=\"name\">'",
"+",
"escape",
"(",
"item",
".",
"name",
")",
"+",
"'</strong>'",
",",
"'string'",
"===",
"typeof",
"item",
".",
"desc",... | Custom layout renderer for items.
@param {Object} item The thing returned from the server.
@param {Function} escape Custom HTML escaper.
@returns {String}
@api private | [
"Custom",
"layout",
"renderer",
"for",
"items",
"."
] | a6086c627b69c36c0cf638dc994c25f3d9d5df72 | https://github.com/nodejitsu/npm-search-pagelet/blob/a6086c627b69c36c0cf638dc994c25f3d9d5df72/client.js#L65-L72 |
47,716 | fvsch/gulp-task-maker | helpers.js | customLog | function customLog(message) {
const trimmed = message.trim()
const limit = trimmed.indexOf('\n')
if (limit === -1) {
fancyLog(trimmed)
} else {
const title = trimmed.slice(0, limit).trim()
const details = trimmed.slice(limit).trim()
fancyLog(`${title}${('\n' + details).replace(/\n/g, '\n ')}`)
... | javascript | function customLog(message) {
const trimmed = message.trim()
const limit = trimmed.indexOf('\n')
if (limit === -1) {
fancyLog(trimmed)
} else {
const title = trimmed.slice(0, limit).trim()
const details = trimmed.slice(limit).trim()
fancyLog(`${title}${('\n' + details).replace(/\n/g, '\n ')}`)
... | [
"function",
"customLog",
"(",
"message",
")",
"{",
"const",
"trimmed",
"=",
"message",
".",
"trim",
"(",
")",
"const",
"limit",
"=",
"trimmed",
".",
"indexOf",
"(",
"'\\n'",
")",
"if",
"(",
"limit",
"===",
"-",
"1",
")",
"{",
"fancyLog",
"(",
"trimme... | Custom long log format using fancy-log
@param {string} message | [
"Custom",
"long",
"log",
"format",
"using",
"fancy",
"-",
"log"
] | 20ab4245f2d75174786ad140793e9438c025d546 | https://github.com/fvsch/gulp-task-maker/blob/20ab4245f2d75174786ad140793e9438c025d546/helpers.js#L7-L17 |
47,717 | fvsch/gulp-task-maker | helpers.js | toUniqueStrings | function toUniqueStrings(input) {
const list = (Array.isArray(input) ? input : [input])
.map(el => (typeof el === 'string' ? el.trim() : null))
.filter(Boolean)
return list.length > 1 ? Array.from(new Set(list)) : list
} | javascript | function toUniqueStrings(input) {
const list = (Array.isArray(input) ? input : [input])
.map(el => (typeof el === 'string' ? el.trim() : null))
.filter(Boolean)
return list.length > 1 ? Array.from(new Set(list)) : list
} | [
"function",
"toUniqueStrings",
"(",
"input",
")",
"{",
"const",
"list",
"=",
"(",
"Array",
".",
"isArray",
"(",
"input",
")",
"?",
"input",
":",
"[",
"input",
"]",
")",
".",
"map",
"(",
"el",
"=>",
"(",
"typeof",
"el",
"===",
"'string'",
"?",
"el",... | Return an array of unique trimmed strings,
from input which can be a string or an array of strings
@param {Array|string} input
@return {string[]} | [
"Return",
"an",
"array",
"of",
"unique",
"trimmed",
"strings",
"from",
"input",
"which",
"can",
"be",
"a",
"string",
"or",
"an",
"array",
"of",
"strings"
] | 20ab4245f2d75174786ad140793e9438c025d546 | https://github.com/fvsch/gulp-task-maker/blob/20ab4245f2d75174786ad140793e9438c025d546/helpers.js#L74-L79 |
47,718 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/forms/dialogs/select.js | removeSelectedOptions | function removeSelectedOptions( combo )
{
combo = getSelect( combo );
// Save the selected index
var iSelectedIndex = getSelectedIndex( combo );
// Remove all selected options.
for ( var i = combo.getChildren().count() - 1 ; i >= 0 ; i-- )
{
if ( combo.getChild( i ).$.selected )
combo.g... | javascript | function removeSelectedOptions( combo )
{
combo = getSelect( combo );
// Save the selected index
var iSelectedIndex = getSelectedIndex( combo );
// Remove all selected options.
for ( var i = combo.getChildren().count() - 1 ; i >= 0 ; i-- )
{
if ( combo.getChild( i ).$.selected )
combo.g... | [
"function",
"removeSelectedOptions",
"(",
"combo",
")",
"{",
"combo",
"=",
"getSelect",
"(",
"combo",
")",
";",
"// Save the selected index\r",
"var",
"iSelectedIndex",
"=",
"getSelectedIndex",
"(",
"combo",
")",
";",
"// Remove all selected options.\r",
"for",
"(",
... | Remove all selected options from a SELECT object. | [
"Remove",
"all",
"selected",
"options",
"from",
"a",
"SELECT",
"object",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/forms/dialogs/select.js#L45-L61 |
47,719 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/forms/dialogs/select.js | modifyOption | function modifyOption( combo, index, title, value )
{
combo = getSelect( combo );
if ( index < 0 )
return false;
var child = combo.getChild( index );
child.setText( title );
child.setValue( value );
return child;
} | javascript | function modifyOption( combo, index, title, value )
{
combo = getSelect( combo );
if ( index < 0 )
return false;
var child = combo.getChild( index );
child.setText( title );
child.setValue( value );
return child;
} | [
"function",
"modifyOption",
"(",
"combo",
",",
"index",
",",
"title",
",",
"value",
")",
"{",
"combo",
"=",
"getSelect",
"(",
"combo",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"return",
"false",
";",
"var",
"child",
"=",
"combo",
".",
"getChild",... | Modify option from a SELECT object. | [
"Modify",
"option",
"from",
"a",
"SELECT",
"object",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/forms/dialogs/select.js#L63-L72 |
47,720 | Froguard/json-toy | bin/main.js | dir2TreeStr | function dir2TreeStr(){
argD = Type.isBoolean(argD) ? "./" : trimAndDelQuotes(argD);
let dirJson,djOpt;
try{
djOpt = {
// preChars:{
// directory: ":open_file_folder: ",
// file:":page_facing_up: "
// },
exclude:{
ou... | javascript | function dir2TreeStr(){
argD = Type.isBoolean(argD) ? "./" : trimAndDelQuotes(argD);
let dirJson,djOpt;
try{
djOpt = {
// preChars:{
// directory: ":open_file_folder: ",
// file:":page_facing_up: "
// },
exclude:{
ou... | [
"function",
"dir2TreeStr",
"(",
")",
"{",
"argD",
"=",
"Type",
".",
"isBoolean",
"(",
"argD",
")",
"?",
"\"./\"",
":",
"trimAndDelQuotes",
"(",
"argD",
")",
";",
"let",
"dirJson",
",",
"djOpt",
";",
"try",
"{",
"djOpt",
"=",
"{",
"// preChars:{",
"// ... | convert directory to tree-string | [
"convert",
"directory",
"to",
"tree",
"-",
"string"
] | cc0549794c2200adfa2c5adce4050b8ba2012000 | https://github.com/Froguard/json-toy/blob/cc0549794c2200adfa2c5adce4050b8ba2012000/bin/main.js#L120-L156 |
47,721 | anvaka/ngraph.shremlin | lib/iterators/vertexIterator.js | VertexIterator | function VertexIterator(graph, startFrom) {
if (graph === undefined) {
throw new Error('Graph is required by VertexIterator');
}
this._graph = graph;
this._startFrom = startFrom;
this._currentIndex = 0;
this._allNodes = [];
this._initialized = false;
this._current = undefined;
} | javascript | function VertexIterator(graph, startFrom) {
if (graph === undefined) {
throw new Error('Graph is required by VertexIterator');
}
this._graph = graph;
this._startFrom = startFrom;
this._currentIndex = 0;
this._allNodes = [];
this._initialized = false;
this._current = undefined;
} | [
"function",
"VertexIterator",
"(",
"graph",
",",
"startFrom",
")",
"{",
"if",
"(",
"graph",
"===",
"undefined",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Graph is required by VertexIterator'",
")",
";",
"}",
"this",
".",
"_graph",
"=",
"graph",
";",
"this",
... | Vertex Iterator provides a simple wrapper over `graph.forEachNode`
to perform lazy iteration.
`startFrom` argument is optional and has the following meaning:
_Not passed_ - Iterate over all vertices of a `graph`:
```
var iterator = new VertexIterator(graph);
while (iterator.moveNext()) {
// prints all vertices:
cons... | [
"Vertex",
"Iterator",
"provides",
"a",
"simple",
"wrapper",
"over",
"graph",
".",
"forEachNode",
"to",
"perform",
"lazy",
"iteration",
"."
] | 98f1f7892e0b1ccc4511cf664b74e7c0276f2ce7 | https://github.com/anvaka/ngraph.shremlin/blob/98f1f7892e0b1ccc4511cf664b74e7c0276f2ce7/lib/iterators/vertexIterator.js#L58-L69 |
47,722 | saggiyogesh/nodeportal | lib/CacheStore/index.js | CacheStore | function CacheStore(options) {
if (!options.id) {
throw new IdNotDefinedError();
}
var storeType, _cache;
function parseKey(key) {
return key.replace(/[^a-z0-9]/gi, '_').replace(/^-+/, '').replace(/-+$/, '').toLowerCase();
}
/**
* Returns Cache Store object
* @returns... | javascript | function CacheStore(options) {
if (!options.id) {
throw new IdNotDefinedError();
}
var storeType, _cache;
function parseKey(key) {
return key.replace(/[^a-z0-9]/gi, '_').replace(/^-+/, '').replace(/-+$/, '').toLowerCase();
}
/**
* Returns Cache Store object
* @returns... | [
"function",
"CacheStore",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"id",
")",
"{",
"throw",
"new",
"IdNotDefinedError",
"(",
")",
";",
"}",
"var",
"storeType",
",",
"_cache",
";",
"function",
"parseKey",
"(",
"key",
")",
"{",
"return",... | Abstract function to create cache store
@param [options]
@constructor | [
"Abstract",
"function",
"to",
"create",
"cache",
"store"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/CacheStore/index.js#L41-L154 |
47,723 | kchapelier/node-glitch | index.js | function(options) {
"use strict";
stream.Transform.call(this, options);
options = options || {};
this.probability = options.probability || 0;
this.deviation = Math.abs(options.deviation || 0);
this.whiteList = options.whiteList || [];
this.blackList = options.blackList || [];
this.func = options.func... | javascript | function(options) {
"use strict";
stream.Transform.call(this, options);
options = options || {};
this.probability = options.probability || 0;
this.deviation = Math.abs(options.deviation || 0);
this.whiteList = options.whiteList || [];
this.blackList = options.blackList || [];
this.func = options.func... | [
"function",
"(",
"options",
")",
"{",
"\"use strict\"",
";",
"stream",
".",
"Transform",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"probability",
"=",
"options",
".",
"probability",
... | GlitchedStream, a Transform stream to intentionally corrupt data
@param {Object} options
@constructor | [
"GlitchedStream",
"a",
"Transform",
"stream",
"to",
"intentionally",
"corrupt",
"data"
] | 28681c573df3864d32177252523e7ca0d59c5992 | https://github.com/kchapelier/node-glitch/blob/28681c573df3864d32177252523e7ca0d59c5992/index.js#L11-L23 | |
47,724 | kchapelier/node-glitch | index.js | function(fileSrc, fileDst, probability, deviation, mode) {
"use strict";
var rstream = fs.createReadStream(fileSrc);
var woptions = mode ? { 'mode' : mode } : {};
var wstream = fs.createWriteStream(fileDst, woptions);
var gstream = new GlitchedStream({
'probability' : probability,
'deviation' : deviat... | javascript | function(fileSrc, fileDst, probability, deviation, mode) {
"use strict";
var rstream = fs.createReadStream(fileSrc);
var woptions = mode ? { 'mode' : mode } : {};
var wstream = fs.createWriteStream(fileDst, woptions);
var gstream = new GlitchedStream({
'probability' : probability,
'deviation' : deviat... | [
"function",
"(",
"fileSrc",
",",
"fileDst",
",",
"probability",
",",
"deviation",
",",
"mode",
")",
"{",
"\"use strict\"",
";",
"var",
"rstream",
"=",
"fs",
".",
"createReadStream",
"(",
"fileSrc",
")",
";",
"var",
"woptions",
"=",
"mode",
"?",
"{",
"'mo... | Read the content of a file, corrupt it and write it into another file
@param {String} fileSrc - Path of the source file
@param {String} fileDst - Path of the destination file
@param {Number} probability - Probability of deviation per byte (between 0 and 1)
@param {Number} deviation - Maximum value difference between ea... | [
"Read",
"the",
"content",
"of",
"a",
"file",
"corrupt",
"it",
"and",
"write",
"it",
"into",
"another",
"file"
] | 28681c573df3864d32177252523e7ca0d59c5992 | https://github.com/kchapelier/node-glitch/blob/28681c573df3864d32177252523e7ca0d59c5992/index.js#L87-L98 | |
47,725 | ticup/CloudTypes-paper | shared/CInt.js | CInt | function CInt(base, offset, isSet) {
this.base = base || 0;
this.offset = offset || 0;
this.isSet = isSet || false;
} | javascript | function CInt(base, offset, isSet) {
this.base = base || 0;
this.offset = offset || 0;
this.isSet = isSet || false;
} | [
"function",
"CInt",
"(",
"base",
",",
"offset",
",",
"isSet",
")",
"{",
"this",
".",
"base",
"=",
"base",
"||",
"0",
";",
"this",
".",
"offset",
"=",
"offset",
"||",
"0",
";",
"this",
".",
"isSet",
"=",
"isSet",
"||",
"false",
";",
"}"
] | Actual CInt object of which an instance represents a variable of which the property is defined with CIntDeclaration | [
"Actual",
"CInt",
"object",
"of",
"which",
"an",
"instance",
"represents",
"a",
"variable",
"of",
"which",
"the",
"property",
"is",
"defined",
"with",
"CIntDeclaration"
] | f3b6adcd60bd66a28eb0e22edfcdcd9500ef7dda | https://github.com/ticup/CloudTypes-paper/blob/f3b6adcd60bd66a28eb0e22edfcdcd9500ef7dda/shared/CInt.js#L26-L30 |
47,726 | jchook/virtual-dom-handlebars | lib/VText.js | VText | function VText(text, config) {
this.virtual = true;
extend(this, config);
// Non-overridable
this.text = [].concat(text);
this.textOnly = true;
this.simple = true;
} | javascript | function VText(text, config) {
this.virtual = true;
extend(this, config);
// Non-overridable
this.text = [].concat(text);
this.textOnly = true;
this.simple = true;
} | [
"function",
"VText",
"(",
"text",
",",
"config",
")",
"{",
"this",
".",
"virtual",
"=",
"true",
";",
"extend",
"(",
"this",
",",
"config",
")",
";",
"// Non-overridable",
"this",
".",
"text",
"=",
"[",
"]",
".",
"concat",
"(",
"text",
")",
";",
"th... | Simplest node, only text | [
"Simplest",
"node",
"only",
"text"
] | d1c2015449bad8489572114fe3d8facef2cce367 | https://github.com/jchook/virtual-dom-handlebars/blob/d1c2015449bad8489572114fe3d8facef2cce367/lib/VText.js#L6-L14 |
47,727 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js | appendColorRow | function appendColorRow( rangeA, rangeB )
{
for ( var i = rangeA ; i < rangeA + 3 ; i++ )
{
var row = table.$.insertRow( -1 );
for ( var j = rangeB ; j < rangeB + 3 ; j++ )
{
for ( var n = 0 ; n < 6 ; n++ )
{
appendColorCell( row, '#' + aColors[j] + aColors[n] + a... | javascript | function appendColorRow( rangeA, rangeB )
{
for ( var i = rangeA ; i < rangeA + 3 ; i++ )
{
var row = table.$.insertRow( -1 );
for ( var j = rangeB ; j < rangeB + 3 ; j++ )
{
for ( var n = 0 ; n < 6 ; n++ )
{
appendColorCell( row, '#' + aColors[j] + aColors[n] + a... | [
"function",
"appendColorRow",
"(",
"rangeA",
",",
"rangeB",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"rangeA",
";",
"i",
"<",
"rangeA",
"+",
"3",
";",
"i",
"++",
")",
"{",
"var",
"row",
"=",
"table",
".",
"$",
".",
"insertRow",
"(",
"-",
"1",
")"... | This function combines two ranges of three values from the color array into a row. | [
"This",
"function",
"combines",
"two",
"ranges",
"of",
"three",
"values",
"from",
"the",
"color",
"array",
"into",
"a",
"row",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js#L179-L193 |
47,728 | ticup/CloudTypes-paper | shared/CEntity.js | CEntity | function CEntity(indexes, properties, states) {
CArray.call(this, indexes, properties);
this.states = {} || states;
this.uid = 0;
} | javascript | function CEntity(indexes, properties, states) {
CArray.call(this, indexes, properties);
this.states = {} || states;
this.uid = 0;
} | [
"function",
"CEntity",
"(",
"indexes",
",",
"properties",
",",
"states",
")",
"{",
"CArray",
".",
"call",
"(",
"this",
",",
"indexes",
",",
"properties",
")",
";",
"this",
".",
"states",
"=",
"{",
"}",
"||",
"states",
";",
"this",
".",
"uid",
"=",
... | when declared in a State, the state will add itself and the declared name for this CArray as properties to the CEntity object. | [
"when",
"declared",
"in",
"a",
"State",
"the",
"state",
"will",
"add",
"itself",
"and",
"the",
"declared",
"name",
"for",
"this",
"CArray",
"as",
"properties",
"to",
"the",
"CEntity",
"object",
"."
] | f3b6adcd60bd66a28eb0e22edfcdcd9500ef7dda | https://github.com/ticup/CloudTypes-paper/blob/f3b6adcd60bd66a28eb0e22edfcdcd9500ef7dda/shared/CEntity.js#L15-L19 |
47,729 | saggiyogesh/nodeportal | plugins/manageResource/client/manageResource.js | attachMenu | function attachMenu(item) {
var menuType = item.find('a').hasClass(FOLDER_TYPE) ? "folderMenu" : "itemMenu";
item.contextMenu({
menu:menuType
},
function (action, el, pos) {
switch (action) {
case ADD_SUBFOLDER_MENU_COMMAND:
... | javascript | function attachMenu(item) {
var menuType = item.find('a').hasClass(FOLDER_TYPE) ? "folderMenu" : "itemMenu";
item.contextMenu({
menu:menuType
},
function (action, el, pos) {
switch (action) {
case ADD_SUBFOLDER_MENU_COMMAND:
... | [
"function",
"attachMenu",
"(",
"item",
")",
"{",
"var",
"menuType",
"=",
"item",
".",
"find",
"(",
"'a'",
")",
".",
"hasClass",
"(",
"FOLDER_TYPE",
")",
"?",
"\"folderMenu\"",
":",
"\"itemMenu\"",
";",
"item",
".",
"contextMenu",
"(",
"{",
"menu",
":",
... | attach menu as per type | [
"attach",
"menu",
"as",
"per",
"type"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/plugins/manageResource/client/manageResource.js#L272-L298 |
47,730 | gummesson/inject-inline-style | index.js | injectStyle | function injectStyle(obj) {
if (!obj) return ''
var selectors = Object.keys(obj)
var styles = selectors.map(function(key) {
var selector = obj[key]
var style = inlineStyle(selector)
var inline = key.concat('{').concat(style).concat('}')
return inline
})
var results = styles.join('')
inser... | javascript | function injectStyle(obj) {
if (!obj) return ''
var selectors = Object.keys(obj)
var styles = selectors.map(function(key) {
var selector = obj[key]
var style = inlineStyle(selector)
var inline = key.concat('{').concat(style).concat('}')
return inline
})
var results = styles.join('')
inser... | [
"function",
"injectStyle",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"obj",
")",
"return",
"''",
"var",
"selectors",
"=",
"Object",
".",
"keys",
"(",
"obj",
")",
"var",
"styles",
"=",
"selectors",
".",
"map",
"(",
"function",
"(",
"key",
")",
"{",
"var... | Inject `obj` as an inline CSS string.
@param {Object} obj
@return {String} | [
"Inject",
"obj",
"as",
"an",
"inline",
"CSS",
"string",
"."
] | 9e8aa759ac240390b3404c0b508d02d52e699e6b | https://github.com/gummesson/inject-inline-style/blob/9e8aa759ac240390b3404c0b508d02d52e699e6b/index.js#L21-L37 |
47,731 | BadgeUp/badgeup-browser-client | dist/src/http.js | fetchWithRetry | function fetchWithRetry(url, options) {
async function fetchWrapper() {
const response = await fetch(url, options);
// don't retry if status is 4xx
if (response.status >= 400 && response.status < 500) {
const contentType = response.headers.get('content-type');
if (con... | javascript | function fetchWithRetry(url, options) {
async function fetchWrapper() {
const response = await fetch(url, options);
// don't retry if status is 4xx
if (response.status >= 400 && response.status < 500) {
const contentType = response.headers.get('content-type');
if (con... | [
"function",
"fetchWithRetry",
"(",
"url",
",",
"options",
")",
"{",
"async",
"function",
"fetchWrapper",
"(",
")",
"{",
"const",
"response",
"=",
"await",
"fetch",
"(",
"url",
",",
"options",
")",
";",
"// don't retry if status is 4xx",
"if",
"(",
"response",
... | Performs fetch with retries in case of HTTP errors
@param url request url
@param options request options
@returns Returns a Promise that resolves with the response object | [
"Performs",
"fetch",
"with",
"retries",
"in",
"case",
"of",
"HTTP",
"errors"
] | a9ab5051b445f139a83c6ac1499e7a31c85a79f4 | https://github.com/BadgeUp/badgeup-browser-client/blob/a9ab5051b445f139a83c6ac1499e7a31c85a79f4/dist/src/http.js#L78-L95 |
47,732 | BadgeUp/badgeup-browser-client | dist/src/http.js | hydrateDates | function hydrateDates(body) {
/**
* Hydrates a string date to a Date object. Mutates input.
* @param item object potentially containing a meta object
*/
function hydrateMeta(item) {
const meta = item.meta;
if (meta && meta.created) {
// parse ISO-8601 string to Date
... | javascript | function hydrateDates(body) {
/**
* Hydrates a string date to a Date object. Mutates input.
* @param item object potentially containing a meta object
*/
function hydrateMeta(item) {
const meta = item.meta;
if (meta && meta.created) {
// parse ISO-8601 string to Date
... | [
"function",
"hydrateDates",
"(",
"body",
")",
"{",
"/**\n * Hydrates a string date to a Date object. Mutates input.\n * @param item object potentially containing a meta object\n */",
"function",
"hydrateMeta",
"(",
"item",
")",
"{",
"const",
"meta",
"=",
"item",
".",
... | Hydrates dates in response bodies. Handles paginated responses and object responses.
Mutates input.
@param body HTTP response body | [
"Hydrates",
"dates",
"in",
"response",
"bodies",
".",
"Handles",
"paginated",
"responses",
"and",
"object",
"responses",
".",
"Mutates",
"input",
"."
] | a9ab5051b445f139a83c6ac1499e7a31c85a79f4 | https://github.com/BadgeUp/badgeup-browser-client/blob/a9ab5051b445f139a83c6ac1499e7a31c85a79f4/dist/src/http.js#L101-L124 |
47,733 | BadgeUp/badgeup-browser-client | dist/src/http.js | hydrateMeta | function hydrateMeta(item) {
const meta = item.meta;
if (meta && meta.created) {
// parse ISO-8601 string to Date
meta.created = new Date(meta.created);
}
} | javascript | function hydrateMeta(item) {
const meta = item.meta;
if (meta && meta.created) {
// parse ISO-8601 string to Date
meta.created = new Date(meta.created);
}
} | [
"function",
"hydrateMeta",
"(",
"item",
")",
"{",
"const",
"meta",
"=",
"item",
".",
"meta",
";",
"if",
"(",
"meta",
"&&",
"meta",
".",
"created",
")",
"{",
"// parse ISO-8601 string to Date",
"meta",
".",
"created",
"=",
"new",
"Date",
"(",
"meta",
".",... | Hydrates a string date to a Date object. Mutates input.
@param item object potentially containing a meta object | [
"Hydrates",
"a",
"string",
"date",
"to",
"a",
"Date",
"object",
".",
"Mutates",
"input",
"."
] | a9ab5051b445f139a83c6ac1499e7a31c85a79f4 | https://github.com/BadgeUp/badgeup-browser-client/blob/a9ab5051b445f139a83c6ac1499e7a31c85a79f4/dist/src/http.js#L106-L112 |
47,734 | slideme/rorschach | lib/LeaderElection.js | LeaderElection | function LeaderElection(client, path, id) {
EventEmitter.call(this);
/**
* Ref. to client.
*
* @type {Rorschach}
*/
this.client = client;
/**
* ZooKeeper path where participants' nodes exist.
*
* @type {String}
*/
this.path = path;
/**
* Id of participant. It's kept in node.
... | javascript | function LeaderElection(client, path, id) {
EventEmitter.call(this);
/**
* Ref. to client.
*
* @type {Rorschach}
*/
this.client = client;
/**
* ZooKeeper path where participants' nodes exist.
*
* @type {String}
*/
this.path = path;
/**
* Id of participant. It's kept in node.
... | [
"function",
"LeaderElection",
"(",
"client",
",",
"path",
",",
"id",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"/**\n * Ref. to client.\n *\n * @type {Rorschach}\n */",
"this",
".",
"client",
"=",
"client",
";",
"/**\n * ZooKeeper path wh... | Leader election participant.
@constructor
@extends {EventEmitter}
@param {Rorschach} client Rorschach instance
@param {String} path Election path
@param {String} id Participant id | [
"Leader",
"election",
"participant",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/LeaderElection.js#L44-L85 |
47,735 | slideme/rorschach | lib/LeaderElection.js | handleStateChange | function handleStateChange(election, state) {
if (state === ConnectionState.RECONNECTED) {
reset(election, afterReset);
}
else if (state === ConnectionState.SUSPENDED ||
state === ConnectionState.LOST) {
setLeadership(election, false);
}
function afterReset(err) {
if (err) {
election.em... | javascript | function handleStateChange(election, state) {
if (state === ConnectionState.RECONNECTED) {
reset(election, afterReset);
}
else if (state === ConnectionState.SUSPENDED ||
state === ConnectionState.LOST) {
setLeadership(election, false);
}
function afterReset(err) {
if (err) {
election.em... | [
"function",
"handleStateChange",
"(",
"election",
",",
"state",
")",
"{",
"if",
"(",
"state",
"===",
"ConnectionState",
".",
"RECONNECTED",
")",
"{",
"reset",
"(",
"election",
",",
"afterReset",
")",
";",
"}",
"else",
"if",
"(",
"state",
"===",
"Connection... | Handle connection state change.
@param {LeaderElection} election
@param {ConnectionState} state | [
"Handle",
"connection",
"state",
"change",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/LeaderElection.js#L154-L169 |
47,736 | UsabilityDynamics/node-wordpress-client | examples/upload.js | fileUploaded | function fileUploaded( error, response ) {
this.debug( 'File Uploaded' );
console.log( require( 'util' ).inspect( error || response, { showHidden: false, colors: true, depth: 4 } ) );
} | javascript | function fileUploaded( error, response ) {
this.debug( 'File Uploaded' );
console.log( require( 'util' ).inspect( error || response, { showHidden: false, colors: true, depth: 4 } ) );
} | [
"function",
"fileUploaded",
"(",
"error",
",",
"response",
")",
"{",
"this",
".",
"debug",
"(",
"'File Uploaded'",
")",
";",
"console",
".",
"log",
"(",
"require",
"(",
"'util'",
")",
".",
"inspect",
"(",
"error",
"||",
"response",
",",
"{",
"showHidden"... | File Uploaded Callback
@param error
@param response | [
"File",
"Uploaded",
"Callback"
] | 2b47a7c5cadd3d8f2cfd255f997f36af14a5d843 | https://github.com/UsabilityDynamics/node-wordpress-client/blob/2b47a7c5cadd3d8f2cfd255f997f36af14a5d843/examples/upload.js#L22-L25 |
47,737 | saggiyogesh/nodeportal | public/ckeditor/_source/core/htmlparser/text.js | function( writer, filter )
{
var text = this.value;
if ( filter && !( text = filter.onText( text, this ) ) )
return;
writer.text( text );
} | javascript | function( writer, filter )
{
var text = this.value;
if ( filter && !( text = filter.onText( text, this ) ) )
return;
writer.text( text );
} | [
"function",
"(",
"writer",
",",
"filter",
")",
"{",
"var",
"text",
"=",
"this",
".",
"value",
";",
"if",
"(",
"filter",
"&&",
"!",
"(",
"text",
"=",
"filter",
".",
"onText",
"(",
"text",
",",
"this",
")",
")",
")",
"return",
";",
"writer",
".",
... | Writes the HTML representation of this text to a CKEDITOR.htmlWriter.
@param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
@example | [
"Writes",
"the",
"HTML",
"representation",
"of",
"this",
"text",
"to",
"a",
"CKEDITOR",
".",
"htmlWriter",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/htmlparser/text.js#L43-L51 | |
47,738 | Froguard/json-toy | lib/json-check-circular.js | checkCircular | function checkCircular(obj){
let isCcl = false;
let cclKeysArr = [];
travelJson(obj,function(k,v,kp,ts,cpl,cd,isCircular){
if(isCircular){
isCcl = true;
cclKeysArr.push({
keyPath: kp,
circularTo: v.slice(11,-1),
key: k,
... | javascript | function checkCircular(obj){
let isCcl = false;
let cclKeysArr = [];
travelJson(obj,function(k,v,kp,ts,cpl,cd,isCircular){
if(isCircular){
isCcl = true;
cclKeysArr.push({
keyPath: kp,
circularTo: v.slice(11,-1),
key: k,
... | [
"function",
"checkCircular",
"(",
"obj",
")",
"{",
"let",
"isCcl",
"=",
"false",
";",
"let",
"cclKeysArr",
"=",
"[",
"]",
";",
"travelJson",
"(",
"obj",
",",
"function",
"(",
"k",
",",
"v",
",",
"kp",
",",
"ts",
",",
"cpl",
",",
"cd",
",",
"isCir... | check circular obj
@param obj
@returns {{isCircular: boolean, circularProps: Array}} | [
"check",
"circular",
"obj"
] | cc0549794c2200adfa2c5adce4050b8ba2012000 | https://github.com/Froguard/json-toy/blob/cc0549794c2200adfa2c5adce4050b8ba2012000/lib/json-check-circular.js#L7-L25 |
47,739 | dcodeIO/node-BufferView | index.js | BufferView | function BufferView(buffer, byteOffset, byteLength) {
if (typeof byteOffset === "undefined") byteOffset = 0;
if (typeof byteLength === "undefined") byteLength = buffer.length;
this._buffer = byteOffset === 0 && byteLength === buffer.length
? buffer
: buffer.slice(byteOffset, byteLength);
} | javascript | function BufferView(buffer, byteOffset, byteLength) {
if (typeof byteOffset === "undefined") byteOffset = 0;
if (typeof byteLength === "undefined") byteLength = buffer.length;
this._buffer = byteOffset === 0 && byteLength === buffer.length
? buffer
: buffer.slice(byteOffset, byteLength);
} | [
"function",
"BufferView",
"(",
"buffer",
",",
"byteOffset",
",",
"byteLength",
")",
"{",
"if",
"(",
"typeof",
"byteOffset",
"===",
"\"undefined\"",
")",
"byteOffset",
"=",
"0",
";",
"if",
"(",
"typeof",
"byteLength",
"===",
"\"undefined\"",
")",
"byteLength",
... | Constructs a new BufferView.
@exports BufferView
@class An optimized DataView-compatible BufferView for node Buffers.
@param {!Buffer} buffer An existing Buffer to use as the storage for the new BufferView object.
@param {number=} byteOffset The offset, in bytes, to the first byte in the specified buffer for the new vi... | [
"Constructs",
"a",
"new",
"BufferView",
"."
] | 4e025d6f0ebd089f0408d3c1d3f47684aac8c965 | https://github.com/dcodeIO/node-BufferView/blob/4e025d6f0ebd089f0408d3c1d3f47684aac8c965/index.js#L16-L22 |
47,740 | Havvy/mock-net-socket | socket.js | function (message, data) {
var datastr = data === undefined ? "no-data" : inspect(data);
logfn(format(" [EMIT] %s %s", pad(message), datastr));
EEProto.emit.apply(this, arguments);
} | javascript | function (message, data) {
var datastr = data === undefined ? "no-data" : inspect(data);
logfn(format(" [EMIT] %s %s", pad(message), datastr));
EEProto.emit.apply(this, arguments);
} | [
"function",
"(",
"message",
",",
"data",
")",
"{",
"var",
"datastr",
"=",
"data",
"===",
"undefined",
"?",
"\"no-data\"",
":",
"inspect",
"(",
"data",
")",
";",
"logfn",
"(",
"format",
"(",
"\" [EMIT] %s %s\"",
",",
"pad",
"(",
"message",
")",
",",
"da... | Spying on Event Emitter methods. | [
"Spying",
"on",
"Event",
"Emitter",
"methods",
"."
] | b27404b2be835536829f1391fcd6cba4f0de3d9e | https://github.com/Havvy/mock-net-socket/blob/b27404b2be835536829f1391fcd6cba4f0de3d9e/socket.js#L86-L90 | |
47,741 | saggiyogesh/nodeportal | public/ckeditor/_source/core/dom/node.js | function( evaluator )
{
var next = this.$, retval;
do
{
next = next.nextSibling;
retval = next && new CKEDITOR.dom.node( next );
}
while ( retval && evaluator && !evaluator( retval ) )
return retval;
} | javascript | function( evaluator )
{
var next = this.$, retval;
do
{
next = next.nextSibling;
retval = next && new CKEDITOR.dom.node( next );
}
while ( retval && evaluator && !evaluator( retval ) )
return retval;
} | [
"function",
"(",
"evaluator",
")",
"{",
"var",
"next",
"=",
"this",
".",
"$",
",",
"retval",
";",
"do",
"{",
"next",
"=",
"next",
".",
"nextSibling",
";",
"retval",
"=",
"next",
"&&",
"new",
"CKEDITOR",
".",
"dom",
".",
"node",
"(",
"next",
")",
... | Gets the node that follows this element in its parent's child list.
@param {Function} evaluator Filtering the result node.
@returns {CKEDITOR.dom.node} The next node or null if not available.
@example
var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b> <i>next</i></d... | [
"Gets",
"the",
"node",
"that",
"follows",
"this",
"element",
"in",
"its",
"parent",
"s",
"child",
"list",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/node.js#L370-L380 | |
47,742 | saggiyogesh/nodeportal | public/ckeditor/_source/core/dom/node.js | function( reference, includeSelf )
{
var $ = this.$,
name;
if ( !includeSelf )
$ = $.parentNode;
while ( $ )
{
if ( $.nodeName && ( name = $.nodeName.toLowerCase(), ( typeof reference == 'string' ? name == reference : name in reference ) ) )
return new CKEDITOR.dom.node( $ );... | javascript | function( reference, includeSelf )
{
var $ = this.$,
name;
if ( !includeSelf )
$ = $.parentNode;
while ( $ )
{
if ( $.nodeName && ( name = $.nodeName.toLowerCase(), ( typeof reference == 'string' ? name == reference : name in reference ) ) )
return new CKEDITOR.dom.node( $ );... | [
"function",
"(",
"reference",
",",
"includeSelf",
")",
"{",
"var",
"$",
"=",
"this",
".",
"$",
",",
"name",
";",
"if",
"(",
"!",
"includeSelf",
")",
"$",
"=",
"$",
".",
"parentNode",
";",
"while",
"(",
"$",
")",
"{",
"if",
"(",
"$",
".",
"nodeN... | Gets the closest ancestor node of this node, specified by its name.
@param {String} reference The name of the ancestor node to search or
an object with the node names to search for.
@param {Boolean} [includeSelf] Whether to include the current
node in the search.
@returns {CKEDITOR.dom.node} The located ancestor node o... | [
"Gets",
"the",
"closest",
"ancestor",
"node",
"of",
"this",
"node",
"specified",
"by",
"its",
"name",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/node.js#L507-L523 | |
47,743 | saggiyogesh/nodeportal | public/ckeditor/_source/core/dom/node.js | function( preserveChildren )
{
var $ = this.$;
var parent = $.parentNode;
if ( parent )
{
if ( preserveChildren )
{
// Move all children before the node.
for ( var child ; ( child = $.firstChild ) ; )
{
parent.insertBefore( $.removeChild( child ), $ );
}
... | javascript | function( preserveChildren )
{
var $ = this.$;
var parent = $.parentNode;
if ( parent )
{
if ( preserveChildren )
{
// Move all children before the node.
for ( var child ; ( child = $.firstChild ) ; )
{
parent.insertBefore( $.removeChild( child ), $ );
}
... | [
"function",
"(",
"preserveChildren",
")",
"{",
"var",
"$",
"=",
"this",
".",
"$",
";",
"var",
"parent",
"=",
"$",
".",
"parentNode",
";",
"if",
"(",
"parent",
")",
"{",
"if",
"(",
"preserveChildren",
")",
"{",
"// Move all children before the node.\r",
"fo... | Removes this node from the document DOM.
@param {Boolean} [preserveChildren] Indicates that the children
elements must remain in the document, removing only the outer
tags.
@example
var element = CKEDITOR.dom.element.getById( 'MyElement' );
<strong>element.remove()</strong>; | [
"Removes",
"this",
"node",
"from",
"the",
"document",
"DOM",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/node.js#L556-L576 | |
47,744 | saggiyogesh/nodeportal | public/ckeditor/_source/core/skins.js | function()
{
if ( cssIsLoaded && jsIsLoaded )
{
// Mark the part as loaded.
part._isLoaded = 1;
// Call all pending callbacks.
for ( var i = 0 ; i < pending.length ; i++ )
{
if ( pending[ i ] )
pending[ i ]();
}
}
} | javascript | function()
{
if ( cssIsLoaded && jsIsLoaded )
{
// Mark the part as loaded.
part._isLoaded = 1;
// Call all pending callbacks.
for ( var i = 0 ; i < pending.length ; i++ )
{
if ( pending[ i ] )
pending[ i ]();
}
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"cssIsLoaded",
"&&",
"jsIsLoaded",
")",
"{",
"// Mark the part as loaded.\r",
"part",
".",
"_isLoaded",
"=",
"1",
";",
"// Call all pending callbacks.\r",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"pending",
".",
... | This is the function that will trigger the callback calls on load. | [
"This",
"is",
"the",
"function",
"that",
"will",
"trigger",
"the",
"callback",
"calls",
"on",
"load",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/skins.js#L81-L95 | |
47,745 | saggiyogesh/nodeportal | public/ckeditor/_source/core/skins.js | function( skinName, skinDefinition )
{
loaded[ skinName ] = skinDefinition;
skinDefinition.skinPath = paths[ skinName ]
|| ( paths[ skinName ] =
CKEDITOR.getUrl(
'_source/' + // @Packager.RemoveLine
'skins/' + skinName + '/' ) );
} | javascript | function( skinName, skinDefinition )
{
loaded[ skinName ] = skinDefinition;
skinDefinition.skinPath = paths[ skinName ]
|| ( paths[ skinName ] =
CKEDITOR.getUrl(
'_source/' + // @Packager.RemoveLine
'skins/' + skinName + '/' ) );
} | [
"function",
"(",
"skinName",
",",
"skinDefinition",
")",
"{",
"loaded",
"[",
"skinName",
"]",
"=",
"skinDefinition",
";",
"skinDefinition",
".",
"skinPath",
"=",
"paths",
"[",
"skinName",
"]",
"||",
"(",
"paths",
"[",
"skinName",
"]",
"=",
"CKEDITOR",
".",... | Registers a skin definition.
@param {String} skinName The skin name.
@param {Object} skinDefinition The skin definition.
@example | [
"Registers",
"a",
"skin",
"definition",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/skins.js#L145-L154 | |
47,746 | saggiyogesh/nodeportal | public/ckeditor/_source/core/skins.js | function( editor, skinPart, callback )
{
var skinName = editor.skinName,
skinPath = editor.skinPath;
if ( loaded[ skinName ] )
loadPart( editor, skinName, skinPart, callback );
else
{
paths[ skinName ] = skinPath;
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( skinPath + 'skin.js'... | javascript | function( editor, skinPart, callback )
{
var skinName = editor.skinName,
skinPath = editor.skinPath;
if ( loaded[ skinName ] )
loadPart( editor, skinName, skinPart, callback );
else
{
paths[ skinName ] = skinPath;
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( skinPath + 'skin.js'... | [
"function",
"(",
"editor",
",",
"skinPart",
",",
"callback",
")",
"{",
"var",
"skinName",
"=",
"editor",
".",
"skinName",
",",
"skinPath",
"=",
"editor",
".",
"skinPath",
";",
"if",
"(",
"loaded",
"[",
"skinName",
"]",
")",
"loadPart",
"(",
"editor",
"... | Loads a skin part. Skins are defined in parts, which are basically
separated CSS files. This function is mainly used by the core code and
should not have much use out of it.
@param {String} skinName The name of the skin to be loaded.
@param {String} skinPart The skin part to be loaded. Common skin parts
are "editor" an... | [
"Loads",
"a",
"skin",
"part",
".",
"Skins",
"are",
"defined",
"in",
"parts",
"which",
"are",
"basically",
"separated",
"CSS",
"files",
".",
"This",
"function",
"is",
"mainly",
"used",
"by",
"the",
"core",
"code",
"and",
"should",
"not",
"have",
"much",
"... | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/skins.js#L167-L182 | |
47,747 | Testlio/lambda-foundation | lib/util.js | forOwnDeep | function forOwnDeep(object, callback, prefix) {
prefix = prefix ? prefix + '.' : '';
_.forOwn(object, function(value, key) {
if (_.isString(value)) {
callback(value, prefix + key);
} else {
forOwnDeep(value, callback, prefix + key);
}
});
} | javascript | function forOwnDeep(object, callback, prefix) {
prefix = prefix ? prefix + '.' : '';
_.forOwn(object, function(value, key) {
if (_.isString(value)) {
callback(value, prefix + key);
} else {
forOwnDeep(value, callback, prefix + key);
}
});
} | [
"function",
"forOwnDeep",
"(",
"object",
",",
"callback",
",",
"prefix",
")",
"{",
"prefix",
"=",
"prefix",
"?",
"prefix",
"+",
"'.'",
":",
"''",
";",
"_",
".",
"forOwn",
"(",
"object",
",",
"function",
"(",
"value",
",",
"key",
")",
"{",
"if",
"("... | Utility function for looping deeply over an object's properties
@param object - object to loop over
@param callback - callback to call for every key-value pair found
@param prefix - prefix to use for the keys that are returned in the callback | [
"Utility",
"function",
"for",
"looping",
"deeply",
"over",
"an",
"object",
"s",
"properties"
] | d6db22ab7974b9279f17466f36f77af4d53fde01 | https://github.com/Testlio/lambda-foundation/blob/d6db22ab7974b9279f17466f36f77af4d53fde01/lib/util.js#L14-L24 |
47,748 | slideme/rorschach | lib/Lock.js | Lock | function Lock(client, basePath, lockName, lockDriver) {
if (lockName instanceof LockDriver) {
lockDriver = lockName;
lockName = null;
}
if (!lockName) {
lockName = Lock.LOCK_NAME;
}
if (!lockDriver) {
lockDriver = new LockDriver();
}
/**
* Keep ref to client as all the low-level opera... | javascript | function Lock(client, basePath, lockName, lockDriver) {
if (lockName instanceof LockDriver) {
lockDriver = lockName;
lockName = null;
}
if (!lockName) {
lockName = Lock.LOCK_NAME;
}
if (!lockDriver) {
lockDriver = new LockDriver();
}
/**
* Keep ref to client as all the low-level opera... | [
"function",
"Lock",
"(",
"client",
",",
"basePath",
",",
"lockName",
",",
"lockDriver",
")",
"{",
"if",
"(",
"lockName",
"instanceof",
"LockDriver",
")",
"{",
"lockDriver",
"=",
"lockName",
";",
"lockName",
"=",
"null",
";",
"}",
"if",
"(",
"!",
"lockNam... | Distributed lock implementation
@constructor
@param {Rorschach} client Rorschach instance
@param {String} basePath Base lock path
@param {String} [lockName] Ephemeral node name
@param {LockDriver} [lockDriver=new LockDriver()] Lock utilities | [
"Distributed",
"lock",
"implementation"
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/Lock.js#L29-L96 |
47,749 | slideme/rorschach | lib/Lock.js | attemptLock | function attemptLock(lock, timeout, callback) {
var lockPath;
var sequenceNodeName;
var timerId = null;
var start = Date.now();
createNode(lock, afterCreate);
function afterCreate(err, nodePath) {
if (err) {
return exit(err);
}
lockPath = nodePath;
sequenceNodeName = nodePath.subst... | javascript | function attemptLock(lock, timeout, callback) {
var lockPath;
var sequenceNodeName;
var timerId = null;
var start = Date.now();
createNode(lock, afterCreate);
function afterCreate(err, nodePath) {
if (err) {
return exit(err);
}
lockPath = nodePath;
sequenceNodeName = nodePath.subst... | [
"function",
"attemptLock",
"(",
"lock",
",",
"timeout",
",",
"callback",
")",
"{",
"var",
"lockPath",
";",
"var",
"sequenceNodeName",
";",
"var",
"timerId",
"=",
"null",
";",
"var",
"start",
"=",
"Date",
".",
"now",
"(",
")",
";",
"createNode",
"(",
"l... | Attempt to acquire a lock.
@private
@param {Lock} lock Instance
@param {Number} timeout Timeout
@param {Function} callback Callback function: <code>(err, lockPath)</code> | [
"Attempt",
"to",
"acquire",
"a",
"lock",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/Lock.js#L158-L277 |
47,750 | slideme/rorschach | lib/Lock.js | createNode | function createNode(lock, callback) {
var nodePath = utils.join(lock.basePath, lock.lockName);
var client = lock.client;
client
.create()
.creatingParentsIfNeeded()
.withMode(CreateMode.EPHEMERAL_SEQUENTIAL)
.forPath(nodePath, callback);
} | javascript | function createNode(lock, callback) {
var nodePath = utils.join(lock.basePath, lock.lockName);
var client = lock.client;
client
.create()
.creatingParentsIfNeeded()
.withMode(CreateMode.EPHEMERAL_SEQUENTIAL)
.forPath(nodePath, callback);
} | [
"function",
"createNode",
"(",
"lock",
",",
"callback",
")",
"{",
"var",
"nodePath",
"=",
"utils",
".",
"join",
"(",
"lock",
".",
"basePath",
",",
"lock",
".",
"lockName",
")",
";",
"var",
"client",
"=",
"lock",
".",
"client",
";",
"client",
".",
"cr... | Create lock node.
@private
@param {Lock} lock Lock instance
@param {Function} callback Callback function: `(err, nodePath)` | [
"Create",
"lock",
"node",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/Lock.js#L289-L298 |
47,751 | slideme/rorschach | lib/Lock.js | deleteNode | function deleteNode(lock, lockPath, callback) {
lock.client
.delete()
.guaranteed()
.forPath(lockPath, callback);
} | javascript | function deleteNode(lock, lockPath, callback) {
lock.client
.delete()
.guaranteed()
.forPath(lockPath, callback);
} | [
"function",
"deleteNode",
"(",
"lock",
",",
"lockPath",
",",
"callback",
")",
"{",
"lock",
".",
"client",
".",
"delete",
"(",
")",
".",
"guaranteed",
"(",
")",
".",
"forPath",
"(",
"lockPath",
",",
"callback",
")",
";",
"}"
] | Guaranteed node deletion.
@private
@param {Lock} lock Lock instance
@param {String} lockPath
@param {Function} [callback] Callback function: `(err)` | [
"Guaranteed",
"node",
"deletion",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/Lock.js#L311-L316 |
47,752 | lucastan/node-buffer-utils | lib/utils.js | dupBuffer | function dupBuffer(buf){
var cloned = new Buffer(buf.length);
buf.copy(cloned);
return cloned;
} | javascript | function dupBuffer(buf){
var cloned = new Buffer(buf.length);
buf.copy(cloned);
return cloned;
} | [
"function",
"dupBuffer",
"(",
"buf",
")",
"{",
"var",
"cloned",
"=",
"new",
"Buffer",
"(",
"buf",
".",
"length",
")",
";",
"buf",
".",
"copy",
"(",
"cloned",
")",
";",
"return",
"cloned",
";",
"}"
] | Duplicates a buffer.
@param {Buffer} buf To be duplicated.
@return {Buffer} A new buffer with the exact same size and contents.
Modifying this will NOT modify the original instance. | [
"Duplicates",
"a",
"buffer",
"."
] | 8c7d7c498c2c9ada3c217f1faf08874c3e1644ed | https://github.com/lucastan/node-buffer-utils/blob/8c7d7c498c2c9ada3c217f1faf08874c3e1644ed/lib/utils.js#L9-L13 |
47,753 | lucastan/node-buffer-utils | lib/utils.js | compare | function compare(buf1, buf2){
if (buf1.length !== buf2.length)
return buf1.length - buf2.length;
for (var i = 0; i < buf1.length; i++)
if (buf1[i] !== buf2[i])
return buf1[i] - buf2[i];
return 0;
} | javascript | function compare(buf1, buf2){
if (buf1.length !== buf2.length)
return buf1.length - buf2.length;
for (var i = 0; i < buf1.length; i++)
if (buf1[i] !== buf2[i])
return buf1[i] - buf2[i];
return 0;
} | [
"function",
"compare",
"(",
"buf1",
",",
"buf2",
")",
"{",
"if",
"(",
"buf1",
".",
"length",
"!==",
"buf2",
".",
"length",
")",
"return",
"buf1",
".",
"length",
"-",
"buf2",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"... | Compares 2 buffers, works like C's memcmp.
@return {integer} -1 if buf1 is "smaller", 0 if both are equal,
1 if buf1 is "greater". | [
"Compares",
"2",
"buffers",
"works",
"like",
"C",
"s",
"memcmp",
"."
] | 8c7d7c498c2c9ada3c217f1faf08874c3e1644ed | https://github.com/lucastan/node-buffer-utils/blob/8c7d7c498c2c9ada3c217f1faf08874c3e1644ed/lib/utils.js#L20-L29 |
47,754 | xpepermint/koa-strong-params | lib/index.js | strongify | function strongify(o) {
/**
* Cloning object.
*/
var params = _.clone(o);
/**
* Returns all object data.
*
* @return {object}
* @api public
*/
params.all = function() {
return params = _.omit(params, ['all', 'only', 'except', 'require', 'merge']);
}
/**
* Returns only listed... | javascript | function strongify(o) {
/**
* Cloning object.
*/
var params = _.clone(o);
/**
* Returns all object data.
*
* @return {object}
* @api public
*/
params.all = function() {
return params = _.omit(params, ['all', 'only', 'except', 'require', 'merge']);
}
/**
* Returns only listed... | [
"function",
"strongify",
"(",
"o",
")",
"{",
"/**\n * Cloning object.\n */",
"var",
"params",
"=",
"_",
".",
"clone",
"(",
"o",
")",
";",
"/**\n * Returns all object data.\n *\n * @return {object}\n * @api public\n */",
"params",
".",
"all",
"=",
"function",... | Returns cloned object with extends functionality.
@param {object}
@return {object}
@api private | [
"Returns",
"cloned",
"object",
"with",
"extends",
"functionality",
"."
] | 2a81065064b2a5096dc57545fc611607f122f047 | https://github.com/xpepermint/koa-strong-params/blob/2a81065064b2a5096dc57545fc611607f122f047/lib/index.js#L17-L89 |
47,755 | saggiyogesh/nodeportal | plugins/themeBuilder/client/themeBuilder.js | saveFileChanges | function saveFileChanges(themeId, folderName, fileName, text) {
io({
url:getURL("save") + "/" + themeId + "/" + folderName + "/" + fileName,
data:{
content:encodeURI(text)
},
callback:function (isSuccess, message, response) {
if (!i... | javascript | function saveFileChanges(themeId, folderName, fileName, text) {
io({
url:getURL("save") + "/" + themeId + "/" + folderName + "/" + fileName,
data:{
content:encodeURI(text)
},
callback:function (isSuccess, message, response) {
if (!i... | [
"function",
"saveFileChanges",
"(",
"themeId",
",",
"folderName",
",",
"fileName",
",",
"text",
")",
"{",
"io",
"(",
"{",
"url",
":",
"getURL",
"(",
"\"save\"",
")",
"+",
"\"/\"",
"+",
"themeId",
"+",
"\"/\"",
"+",
"folderName",
"+",
"\"/\"",
"+",
"fil... | Handler for save file changes
@param {String} themeId
@param {String} folderName
@param {String} fileName
@param {String} text | [
"Handler",
"for",
"save",
"file",
"changes"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/plugins/themeBuilder/client/themeBuilder.js#L55-L67 |
47,756 | saggiyogesh/nodeportal | plugins/themeBuilder/client/themeBuilder.js | initAceEditor | function initAceEditor(themeId, folderName, fileName, text, mode) {
hideImageHolder();
$("#" + editorId).show();
var doc = new Document(text);
var session = new EditSession(doc, "ace/mode/" + mode);
session.setUndoManager(new UndoManager());
editor.setSession(session);
... | javascript | function initAceEditor(themeId, folderName, fileName, text, mode) {
hideImageHolder();
$("#" + editorId).show();
var doc = new Document(text);
var session = new EditSession(doc, "ace/mode/" + mode);
session.setUndoManager(new UndoManager());
editor.setSession(session);
... | [
"function",
"initAceEditor",
"(",
"themeId",
",",
"folderName",
",",
"fileName",
",",
"text",
",",
"mode",
")",
"{",
"hideImageHolder",
"(",
")",
";",
"$",
"(",
"\"#\"",
"+",
"editorId",
")",
".",
"show",
"(",
")",
";",
"var",
"doc",
"=",
"new",
"Doc... | Initialize editor for each file opened
@param {String} themeId
@param {String} folderName
@param {String} fileName
@param {String} text
@param {String} mode | [
"Initialize",
"editor",
"for",
"each",
"file",
"opened"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/plugins/themeBuilder/client/themeBuilder.js#L77-L91 |
47,757 | saggiyogesh/nodeportal | plugins/themeBuilder/client/themeBuilder.js | openFile | function openFile(themeId, folderName, fileName) {
if (themeId && folderName && fileName) {
//if image then display it
if (folderName === "images") {
showImage(themeId, folderName, fileName);
return;
}
var options = {
... | javascript | function openFile(themeId, folderName, fileName) {
if (themeId && folderName && fileName) {
//if image then display it
if (folderName === "images") {
showImage(themeId, folderName, fileName);
return;
}
var options = {
... | [
"function",
"openFile",
"(",
"themeId",
",",
"folderName",
",",
"fileName",
")",
"{",
"if",
"(",
"themeId",
"&&",
"folderName",
"&&",
"fileName",
")",
"{",
"//if image then display it",
"if",
"(",
"folderName",
"===",
"\"images\"",
")",
"{",
"showImage",
"(",
... | Handler when theme file is activated in tree, calls io to show file content
@param {Number} themeId
@param {String} folderName
@param {String} fileName | [
"Handler",
"when",
"theme",
"file",
"is",
"activated",
"in",
"tree",
"calls",
"io",
"to",
"show",
"file",
"content"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/plugins/themeBuilder/client/themeBuilder.js#L100-L130 |
47,758 | saggiyogesh/nodeportal | plugins/themeBuilder/client/themeBuilder.js | renderThemeTree | function renderThemeTree(themeId, fileList, themeName) {
var getTreeNodes = function (arr) {
var ret = [];
_.each(arr, function (fileName) {
ret.push({title:fileName});
});
return ret;
};
var css = {title:validTitleName[0], isFolder... | javascript | function renderThemeTree(themeId, fileList, themeName) {
var getTreeNodes = function (arr) {
var ret = [];
_.each(arr, function (fileName) {
ret.push({title:fileName});
});
return ret;
};
var css = {title:validTitleName[0], isFolder... | [
"function",
"renderThemeTree",
"(",
"themeId",
",",
"fileList",
",",
"themeName",
")",
"{",
"var",
"getTreeNodes",
"=",
"function",
"(",
"arr",
")",
"{",
"var",
"ret",
"=",
"[",
"]",
";",
"_",
".",
"each",
"(",
"arr",
",",
"function",
"(",
"fileName",
... | Renders theme's folders as tree in left side and attach handlers on each file
@param {String} themeId
@param {Object} fileList | [
"Renders",
"theme",
"s",
"folders",
"as",
"tree",
"in",
"left",
"side",
"and",
"attach",
"handlers",
"on",
"each",
"file"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/plugins/themeBuilder/client/themeBuilder.js#L137-L165 |
47,759 | jlewczyk/git-hooks-js-win | lib/git-hooks-debug.js | function (workingDirectory) {
var gitPath = getClosestGitPath(workingDirectory);
if (!gitPath) {
throw new Error('git-hooks must be run inside a git repository');
}
var hooksPath = path.resolve(gitPath, HOOKS_DIRNAME);
var pathToGitHooks = path.join(path.relative(ho... | javascript | function (workingDirectory) {
var gitPath = getClosestGitPath(workingDirectory);
if (!gitPath) {
throw new Error('git-hooks must be run inside a git repository');
}
var hooksPath = path.resolve(gitPath, HOOKS_DIRNAME);
var pathToGitHooks = path.join(path.relative(ho... | [
"function",
"(",
"workingDirectory",
")",
"{",
"var",
"gitPath",
"=",
"getClosestGitPath",
"(",
"workingDirectory",
")",
";",
"if",
"(",
"!",
"gitPath",
")",
"{",
"throw",
"new",
"Error",
"(",
"'git-hooks must be run inside a git repository'",
")",
";",
"}",
"va... | Installs git hooks.
@param {String} [workingDirectory]
@throws {Error} | [
"Installs",
"git",
"hooks",
"."
] | e156f88ad7aec76c9180c70656c5568ad89f9de7 | https://github.com/jlewczyk/git-hooks-js-win/blob/e156f88ad7aec76c9180c70656c5568ad89f9de7/lib/git-hooks-debug.js#L51-L90 | |
47,760 | jlewczyk/git-hooks-js-win | lib/git-hooks-debug.js | function (filename, arg, callback) {
console.log('*** git-hooks.js run', filename, arg);
var hookName = path.basename(filename);
var hooksDirname = path.resolve(path.dirname(filename), '../../.githooks', hookName);
if (fsHelpers.exists(hooksDirname)) {
var list = fs.readdirSyn... | javascript | function (filename, arg, callback) {
console.log('*** git-hooks.js run', filename, arg);
var hookName = path.basename(filename);
var hooksDirname = path.resolve(path.dirname(filename), '../../.githooks', hookName);
if (fsHelpers.exists(hooksDirname)) {
var list = fs.readdirSyn... | [
"function",
"(",
"filename",
",",
"arg",
",",
"callback",
")",
"{",
"console",
".",
"log",
"(",
"'*** git-hooks.js run'",
",",
"filename",
",",
"arg",
")",
";",
"var",
"hookName",
"=",
"path",
".",
"basename",
"(",
"filename",
")",
";",
"var",
"hooksDirn... | Runs a git hook.
@param {String} filename Path to git hook.
@param {String} [arg] Git hook argument.
@param {Function} callback | [
"Runs",
"a",
"git",
"hook",
"."
] | e156f88ad7aec76c9180c70656c5568ad89f9de7 | https://github.com/jlewczyk/git-hooks-js-win/blob/e156f88ad7aec76c9180c70656c5568ad89f9de7/lib/git-hooks-debug.js#L126-L142 | |
47,761 | jlewczyk/git-hooks-js-win | lib/git-hooks-debug.js | runHooks | function runHooks(hooks, args, callback) {
console.log('*** git-hooks.js runHooks', hooks, args);
if (!hooks.length) {
callback(0);
return;
}
try {
var hook = spawnHook(hooks.shift(), args);
hook.on('close', function (code) {
if (code === 0) {
... | javascript | function runHooks(hooks, args, callback) {
console.log('*** git-hooks.js runHooks', hooks, args);
if (!hooks.length) {
callback(0);
return;
}
try {
var hook = spawnHook(hooks.shift(), args);
hook.on('close', function (code) {
if (code === 0) {
... | [
"function",
"runHooks",
"(",
"hooks",
",",
"args",
",",
"callback",
")",
"{",
"console",
".",
"log",
"(",
"'*** git-hooks.js runHooks'",
",",
"hooks",
",",
"args",
")",
";",
"if",
"(",
"!",
"hooks",
".",
"length",
")",
"{",
"callback",
"(",
"0",
")",
... | Runs hooks.
@param {String[]} hooks List of hook names to execute.
@param {String[]} args
@param {Function} callback | [
"Runs",
"hooks",
"."
] | e156f88ad7aec76c9180c70656c5568ad89f9de7 | https://github.com/jlewczyk/git-hooks-js-win/blob/e156f88ad7aec76c9180c70656c5568ad89f9de7/lib/git-hooks-debug.js#L152-L170 |
47,762 | enriched/repeating-interval | interval.js | function () {
if (this._duration) {
return this._duration;
}
if (this._start && this._end) {
return moment.duration(this._end - this._start);
}
else {
return moment.duration(0);
}
} | javascript | function () {
if (this._duration) {
return this._duration;
}
if (this._start && this._end) {
return moment.duration(this._end - this._start);
}
else {
return moment.duration(0);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_duration",
")",
"{",
"return",
"this",
".",
"_duration",
";",
"}",
"if",
"(",
"this",
".",
"_start",
"&&",
"this",
".",
"_end",
")",
"{",
"return",
"moment",
".",
"duration",
"(",
"this",
".",
... | The duration of a single repition of the interval | [
"The",
"duration",
"of",
"a",
"single",
"repition",
"of",
"the",
"interval"
] | 059173390aabbd84615fe7bc98ecca695d5d2c47 | https://github.com/enriched/repeating-interval/blob/059173390aabbd84615fe7bc98ecca695d5d2c47/interval.js#L225-L235 | |
47,763 | anvaka/ngraph.shremlin | lib/utils/filterExpression.js | createFilter | function createFilter(filterExpression) {
if (typeof filterExpression === 'undefined') {
throw new Error('Filter expression should be defined');
}
if (isSimpleType(filterExpression)) {
return simpleTypeFilter(filterExpression);
} else if (isCustomPredicate(filterExpression)) {
return customPredicat... | javascript | function createFilter(filterExpression) {
if (typeof filterExpression === 'undefined') {
throw new Error('Filter expression should be defined');
}
if (isSimpleType(filterExpression)) {
return simpleTypeFilter(filterExpression);
} else if (isCustomPredicate(filterExpression)) {
return customPredicat... | [
"function",
"createFilter",
"(",
"filterExpression",
")",
"{",
"if",
"(",
"typeof",
"filterExpression",
"===",
"'undefined'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Filter expression should be defined'",
")",
";",
"}",
"if",
"(",
"isSimpleType",
"(",
"filterExp... | This method creates custom filter predicate based on `filterExpression`
value.
When `filterExpression` is a simple type (Number, String or Boolean), then
returned predicate compares `data` property directly with that value:
```
var match42 = createFilter(42);
// this will print true:
console.log(match42({data: 42}));... | [
"This",
"method",
"creates",
"custom",
"filter",
"predicate",
"based",
"on",
"filterExpression",
"value",
"."
] | 98f1f7892e0b1ccc4511cf664b74e7c0276f2ce7 | https://github.com/anvaka/ngraph.shremlin/blob/98f1f7892e0b1ccc4511cf664b74e7c0276f2ce7/lib/utils/filterExpression.js#L81-L95 |
47,764 | rksm/ace.improved | lib/ace.ext.keys.js | toUnicode | function toUnicode(charCode) {
var result = charCode.toString(16).toUpperCase();
while (result.length < 4) result = '0' + result;
return '\\u' + result;
} | javascript | function toUnicode(charCode) {
var result = charCode.toString(16).toUpperCase();
while (result.length < 4) result = '0' + result;
return '\\u' + result;
} | [
"function",
"toUnicode",
"(",
"charCode",
")",
"{",
"var",
"result",
"=",
"charCode",
".",
"toString",
"(",
"16",
")",
".",
"toUpperCase",
"(",
")",
";",
"while",
"(",
"result",
".",
"length",
"<",
"4",
")",
"result",
"=",
"'0'",
"+",
"result",
";",
... | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- eventing stuff -=-=-=-=-=-=-=- | [
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"... | b0b5014d9e31046608a10714c850a2441223a8f3 | https://github.com/rksm/ace.improved/blob/b0b5014d9e31046608a10714c850a2441223a8f3/lib/ace.ext.keys.js#L514-L518 |
47,765 | saggiyogesh/nodeportal | lib/permissions/PermissionError.js | PermissionError | function PermissionError(message, userName, actionKey) {
this.name = "PermissionError";
this.message = message || (userName && actionKey) ? "Permission Error. User " + userName + " is not authorized to " + actionKey : "Permission Error";
this.localizedMessageKey = "permission-error";
} | javascript | function PermissionError(message, userName, actionKey) {
this.name = "PermissionError";
this.message = message || (userName && actionKey) ? "Permission Error. User " + userName + " is not authorized to " + actionKey : "Permission Error";
this.localizedMessageKey = "permission-error";
} | [
"function",
"PermissionError",
"(",
"message",
",",
"userName",
",",
"actionKey",
")",
"{",
"this",
".",
"name",
"=",
"\"PermissionError\"",
";",
"this",
".",
"message",
"=",
"message",
"||",
"(",
"userName",
"&&",
"actionKey",
")",
"?",
"\"Permission Error. U... | This error is thrown when user role is not having permission to perform any action | [
"This",
"error",
"is",
"thrown",
"when",
"user",
"role",
"is",
"not",
"having",
"permission",
"to",
"perform",
"any",
"action"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/permissions/PermissionError.js#L5-L9 |
47,766 | garanj/amphtml-autoscript | index.js | create | function create(opt_options) {
function runInclude(file, encoding, callback) {
if (file.isNull()) {
return callback(null, file);
}
if (file.isStream()) {
this.emit('error', new PluginError(PLUGIN_NAME,
'Streams not supported!'));
}
if (file.isBuffer()) {
addIncludesToFi... | javascript | function create(opt_options) {
function runInclude(file, encoding, callback) {
if (file.isNull()) {
return callback(null, file);
}
if (file.isStream()) {
this.emit('error', new PluginError(PLUGIN_NAME,
'Streams not supported!'));
}
if (file.isBuffer()) {
addIncludesToFi... | [
"function",
"create",
"(",
"opt_options",
")",
"{",
"function",
"runInclude",
"(",
"file",
",",
"encoding",
",",
"callback",
")",
"{",
"if",
"(",
"file",
".",
"isNull",
"(",
")",
")",
"{",
"return",
"callback",
"(",
"null",
",",
"file",
")",
";",
"}"... | Imports the required AMP custom-element script tags into an AMP document.
@param {Object} opt_options Configurations options, currently:
placeholder: Overrides the default placeholder.
mode: Overrides the default mode (MODES.PLACEHOLDER);
@return {!Transform} The created stream.Transform object. | [
"Imports",
"the",
"required",
"AMP",
"custom",
"-",
"element",
"script",
"tags",
"into",
"an",
"AMP",
"document",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L50-L72 |
47,767 | garanj/amphtml-autoscript | index.js | addIncludesToFile | async function addIncludesToFile(file,
opt_options) {
const overrideMap = await readComponentsMap('./amp-versions.json');
const html = file.contents.toString();
const newHtml = await addIncludesToHtml(html, overrideMap, opt_options);
file.contents = new Buffer(newHtml);
return file;
} | javascript | async function addIncludesToFile(file,
opt_options) {
const overrideMap = await readComponentsMap('./amp-versions.json');
const html = file.contents.toString();
const newHtml = await addIncludesToHtml(html, overrideMap, opt_options);
file.contents = new Buffer(newHtml);
return file;
} | [
"async",
"function",
"addIncludesToFile",
"(",
"file",
",",
"opt_options",
")",
"{",
"const",
"overrideMap",
"=",
"await",
"readComponentsMap",
"(",
"'./amp-versions.json'",
")",
";",
"const",
"html",
"=",
"file",
".",
"contents",
".",
"toString",
"(",
")",
";... | Identifies missing AMP custom-elementscript tags in an AMP HTML file and
adds them.
@param {!Vinyl} file The file to add script tags to.
@param {Object} opt_options See {@code create}.
@return {!Vinyl} The modified file. | [
"Identifies",
"missing",
"AMP",
"custom",
"-",
"elementscript",
"tags",
"in",
"an",
"AMP",
"HTML",
"file",
"and",
"adds",
"them",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L82-L89 |
47,768 | garanj/amphtml-autoscript | index.js | addIncludesToHtml | async function addIncludesToHtml(html, overrideMap,
opt_options) {
let instance = await amphtmlValidator.getInstance();
const options = opt_options || {};
if (options.updateComponentsMap) {
await updateComponentMap();
}
const versionMap = await readComponentsMap(COMPONENTS_MAP_PATH);
const result =... | javascript | async function addIncludesToHtml(html, overrideMap,
opt_options) {
let instance = await amphtmlValidator.getInstance();
const options = opt_options || {};
if (options.updateComponentsMap) {
await updateComponentMap();
}
const versionMap = await readComponentsMap(COMPONENTS_MAP_PATH);
const result =... | [
"async",
"function",
"addIncludesToHtml",
"(",
"html",
",",
"overrideMap",
",",
"opt_options",
")",
"{",
"let",
"instance",
"=",
"await",
"amphtmlValidator",
".",
"getInstance",
"(",
")",
";",
"const",
"options",
"=",
"opt_options",
"||",
"{",
"}",
";",
"if"... | Identifies missing AMP custom-element script tags in an AMP HTML test and
adds them.
This is achieved by:
1. Running the AMP validator and filtering for errors for missing extensions.
2. Creating <script> elements using versions taken from GitHub directory
listings.
@param {!Vinyl} file The file to add script tags to... | [
"Identifies",
"missing",
"AMP",
"custom",
"-",
"element",
"script",
"tags",
"in",
"an",
"AMP",
"HTML",
"test",
"and",
"adds",
"them",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L105-L168 |
47,769 | garanj/amphtml-autoscript | index.js | updateComponentMap | async function updateComponentMap() {
const response = await fetch(GITHUB_AMPHTML_TREE_URL);
const data = await response.json();
const pairs = data.tree.map((item) => item.path.match(REGEX_EXTENSION_DIR))
.filter((match) => match && !match[1].endsWith('impl'))
.map((match) => [... | javascript | async function updateComponentMap() {
const response = await fetch(GITHUB_AMPHTML_TREE_URL);
const data = await response.json();
const pairs = data.tree.map((item) => item.path.match(REGEX_EXTENSION_DIR))
.filter((match) => match && !match[1].endsWith('impl'))
.map((match) => [... | [
"async",
"function",
"updateComponentMap",
"(",
")",
"{",
"const",
"response",
"=",
"await",
"fetch",
"(",
"GITHUB_AMPHTML_TREE_URL",
")",
";",
"const",
"data",
"=",
"await",
"response",
".",
"json",
"(",
")",
";",
"const",
"pairs",
"=",
"data",
".",
"tree... | Create a map from component to version number, based on GitHub directory
structure. | [
"Create",
"a",
"map",
"from",
"component",
"to",
"version",
"number",
"based",
"on",
"GitHub",
"directory",
"structure",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L206-L219 |
47,770 | garanj/amphtml-autoscript | index.js | writeComponentsMap | function writeComponentsMap(path, componentsMap) {
return new Promise((resolve, reject) => {
const data = JSON.stringify(componentsMap);
fs.writeFile(path, data, (err) => {
if (err) {
return reject(err);
}
resolve(data.length);
});
});
} | javascript | function writeComponentsMap(path, componentsMap) {
return new Promise((resolve, reject) => {
const data = JSON.stringify(componentsMap);
fs.writeFile(path, data, (err) => {
if (err) {
return reject(err);
}
resolve(data.length);
});
});
} | [
"function",
"writeComponentsMap",
"(",
"path",
",",
"componentsMap",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"data",
"=",
"JSON",
".",
"stringify",
"(",
"componentsMap",
")",
";",
"fs",
".",
"wri... | Writes a component map to the file system.
@param {string} path The path to the file to write to.
@param {Object} componentsMap The map of components to versions.
@return {number} The length of data written. | [
"Writes",
"a",
"component",
"map",
"to",
"the",
"file",
"system",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L228-L238 |
47,771 | garanj/amphtml-autoscript | index.js | readComponentsMap | async function readComponentsMap(path) {
return new Promise((resolve, reject) => {
fs.readFile(path, (err, data) => {
if (err) {
return resolve({});
}
resolve(JSON.parse(data));
});
});
} | javascript | async function readComponentsMap(path) {
return new Promise((resolve, reject) => {
fs.readFile(path, (err, data) => {
if (err) {
return resolve({});
}
resolve(JSON.parse(data));
});
});
} | [
"async",
"function",
"readComponentsMap",
"(",
"path",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"fs",
".",
"readFile",
"(",
"path",
",",
"(",
"err",
",",
"data",
")",
"=>",
"{",
"if",
"(",
"err",
")"... | Reads a component map from the file system.
@param {string} path The path to the file to write to.
@return {Object} The map of components to versions. | [
"Reads",
"a",
"component",
"map",
"from",
"the",
"file",
"system",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L246-L255 |
47,772 | garanj/amphtml-autoscript | index.js | createAmpCustomElementTag | function createAmpCustomElementTag(tagName, version) {
const scriptType = AMP_SCRIPT_TYPE_MAP[tagName] || 'custom-element';
return `<script async ${scriptType}="${tagName}" ` +
`src="https://cdn.ampproject.org/v0/${tagName}-${version}.js"></script>`;
} | javascript | function createAmpCustomElementTag(tagName, version) {
const scriptType = AMP_SCRIPT_TYPE_MAP[tagName] || 'custom-element';
return `<script async ${scriptType}="${tagName}" ` +
`src="https://cdn.ampproject.org/v0/${tagName}-${version}.js"></script>`;
} | [
"function",
"createAmpCustomElementTag",
"(",
"tagName",
",",
"version",
")",
"{",
"const",
"scriptType",
"=",
"AMP_SCRIPT_TYPE_MAP",
"[",
"tagName",
"]",
"||",
"'custom-element'",
";",
"return",
"`",
"${",
"scriptType",
"}",
"${",
"tagName",
"}",
"`",
"+",
"`... | Builds a script tag for a custom element.
@param {string} tagName The custom element to include.
@param {number} version The version number to include.
@return {string} The <script> tag. | [
"Builds",
"a",
"script",
"tag",
"for",
"a",
"custom",
"element",
"."
] | 7361a39c9d47406e04bbc4077477fe1f84bf5e7a | https://github.com/garanj/amphtml-autoscript/blob/7361a39c9d47406e04bbc4077477fe1f84bf5e7a/index.js#L274-L278 |
47,773 | saggiyogesh/nodeportal | public/ckeditor/_source/core/dom/document.js | function( cssFileUrl )
{
if ( this.$.createStyleSheet )
this.$.createStyleSheet( cssFileUrl );
else
{
var link = new CKEDITOR.dom.element( 'link' );
link.setAttributes(
{
rel :'stylesheet',
type : 'text/css',
href : cssFileUrl
});
this.getHead().app... | javascript | function( cssFileUrl )
{
if ( this.$.createStyleSheet )
this.$.createStyleSheet( cssFileUrl );
else
{
var link = new CKEDITOR.dom.element( 'link' );
link.setAttributes(
{
rel :'stylesheet',
type : 'text/css',
href : cssFileUrl
});
this.getHead().app... | [
"function",
"(",
"cssFileUrl",
")",
"{",
"if",
"(",
"this",
".",
"$",
".",
"createStyleSheet",
")",
"this",
".",
"$",
".",
"createStyleSheet",
"(",
"cssFileUrl",
")",
";",
"else",
"{",
"var",
"link",
"=",
"new",
"CKEDITOR",
".",
"dom",
".",
"element",
... | Appends a CSS file to the document.
@param {String} cssFileUrl The CSS file URL.
@example
<b>CKEDITOR.document.appendStyleSheet( '/mystyles.css' )</b>; | [
"Appends",
"a",
"CSS",
"file",
"to",
"the",
"document",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/document.js#L37-L53 | |
47,774 | saggiyogesh/nodeportal | public/ckeditor/_source/core/dom/document.js | function()
{
var head = this.$.getElementsByTagName( 'head' )[0];
if ( !head )
head = this.getDocumentElement().append( new CKEDITOR.dom.element( 'head' ), true );
else
head = new CKEDITOR.dom.element( head );
return (
this.getHead = function()
{
return head;
})();
} | javascript | function()
{
var head = this.$.getElementsByTagName( 'head' )[0];
if ( !head )
head = this.getDocumentElement().append( new CKEDITOR.dom.element( 'head' ), true );
else
head = new CKEDITOR.dom.element( head );
return (
this.getHead = function()
{
return head;
})();
} | [
"function",
"(",
")",
"{",
"var",
"head",
"=",
"this",
".",
"$",
".",
"getElementsByTagName",
"(",
"'head'",
")",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"head",
")",
"head",
"=",
"this",
".",
"getDocumentElement",
"(",
")",
".",
"append",
"(",
"new",
... | Gets the <head> element for this document.
@returns {CKEDITOR.dom.element} The <head> element.
@example
var element = <b>CKEDITOR.document.getHead()</b>;
alert( element.getName() ); // "head" | [
"Gets",
"the",
"<",
";",
"head>",
";",
"element",
"for",
"this",
"document",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/dom/document.js#L165-L178 | |
47,775 | saggiyogesh/nodeportal | lib/permissions/PermissionDefinitionProcessor.js | isActionsExistsInPermissionActions | function isActionsExistsInPermissionActions(allActions, schemaActions) {
return utils.contains(allActions.sort().join(), schemaActions.sort().join());
} | javascript | function isActionsExistsInPermissionActions(allActions, schemaActions) {
return utils.contains(allActions.sort().join(), schemaActions.sort().join());
} | [
"function",
"isActionsExistsInPermissionActions",
"(",
"allActions",
",",
"schemaActions",
")",
"{",
"return",
"utils",
".",
"contains",
"(",
"allActions",
".",
"sort",
"(",
")",
".",
"join",
"(",
")",
",",
"schemaActions",
".",
"sort",
"(",
")",
".",
"join"... | Returns true if schemaActions exists in allActions
@param allActions {Array} all actions in defined in permission definition file
@param schemaActions {Array} actions allowed in particular schema entry in definition file | [
"Returns",
"true",
"if",
"schemaActions",
"exists",
"in",
"allActions"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/permissions/PermissionDefinitionProcessor.js#L35-L37 |
47,776 | saggiyogesh/nodeportal | lib/permissions/PermissionDefinitionProcessor.js | insertSettingsPluginsPermission | function insertSettingsPluginsPermission(app, next) {
var pluginsHome = utils.getRootPath() + "/plugins",
settingsPlugins = Object.keys(plugins.getSettingsPlugins());
var dbActionInstance = DBActions.getSimpleInstance(app, "SchemaPermissions");
var pluginInstanceHandler = require(utils.getLibPath() ... | javascript | function insertSettingsPluginsPermission(app, next) {
var pluginsHome = utils.getRootPath() + "/plugins",
settingsPlugins = Object.keys(plugins.getSettingsPlugins());
var dbActionInstance = DBActions.getSimpleInstance(app, "SchemaPermissions");
var pluginInstanceHandler = require(utils.getLibPath() ... | [
"function",
"insertSettingsPluginsPermission",
"(",
"app",
",",
"next",
")",
"{",
"var",
"pluginsHome",
"=",
"utils",
".",
"getRootPath",
"(",
")",
"+",
"\"/plugins\"",
",",
"settingsPlugins",
"=",
"Object",
".",
"keys",
"(",
"plugins",
".",
"getSettingsPlugins"... | Function used to insert settings plugin schema permissions
@param app
@param next | [
"Function",
"used",
"to",
"insert",
"settings",
"plugin",
"schema",
"permissions"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/permissions/PermissionDefinitionProcessor.js#L110-L144 |
47,777 | saggiyogesh/nodeportal | public/ckeditor/_source/core/editor.js | function()
{
this.fire( 'beforeGetData' );
var eventData = this._.data;
if ( typeof eventData != 'string' )
{
var element = this.element;
if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
eventData = element.is( 'textarea' ) ? element.getValue() : element.getHtml... | javascript | function()
{
this.fire( 'beforeGetData' );
var eventData = this._.data;
if ( typeof eventData != 'string' )
{
var element = this.element;
if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
eventData = element.is( 'textarea' ) ? element.getValue() : element.getHtml... | [
"function",
"(",
")",
"{",
"this",
".",
"fire",
"(",
"'beforeGetData'",
")",
";",
"var",
"eventData",
"=",
"this",
".",
"_",
".",
"data",
";",
"if",
"(",
"typeof",
"eventData",
"!=",
"'string'",
")",
"{",
"var",
"element",
"=",
"this",
".",
"element"... | Gets the editor data. The data will be in raw format. It is the same
data that is posted by the editor.
@type String
@returns (String) The editor data.
@example
if ( CKEDITOR.instances.editor1.<strong>getData()</strong> == '' )
alert( 'There is no data available' ); | [
"Gets",
"the",
"editor",
"data",
".",
"The",
"data",
"will",
"be",
"in",
"raw",
"format",
".",
"It",
"is",
"the",
"same",
"data",
"that",
"is",
"posted",
"by",
"the",
"editor",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/editor.js#L638-L659 | |
47,778 | saggiyogesh/nodeportal | public/ckeditor/_source/core/htmlparser/comment.js | function( writer, filter )
{
var comment = this.value;
if ( filter )
{
if ( !( comment = filter.onComment( comment, this ) ) )
return;
if ( typeof comment != 'string' )
{
comment.parent = this.parent;
comment.writeHtml( writer, filter );
return;
}
}
writer.comm... | javascript | function( writer, filter )
{
var comment = this.value;
if ( filter )
{
if ( !( comment = filter.onComment( comment, this ) ) )
return;
if ( typeof comment != 'string' )
{
comment.parent = this.parent;
comment.writeHtml( writer, filter );
return;
}
}
writer.comm... | [
"function",
"(",
"writer",
",",
"filter",
")",
"{",
"var",
"comment",
"=",
"this",
".",
"value",
";",
"if",
"(",
"filter",
")",
"{",
"if",
"(",
"!",
"(",
"comment",
"=",
"filter",
".",
"onComment",
"(",
"comment",
",",
"this",
")",
")",
")",
"ret... | Writes the HTML representation of this comment to a CKEDITOR.htmlWriter.
@param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
@example | [
"Writes",
"the",
"HTML",
"representation",
"of",
"this",
"comment",
"to",
"a",
"CKEDITOR",
".",
"htmlWriter",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/htmlparser/comment.js#L41-L59 | |
47,779 | slideme/rorschach | lib/RetryPolicy.js | RetryPolicy | function RetryPolicy(options) {
options = options || {};
if (typeof options.maxAttempts === 'number') {
this.maxAttempts = options.maxAttempts;
}
else {
this.maxAttempts = RetryPolicy.DEFAULT_MAX_ATTEMPTS;
}
if (typeof options.codes === 'function') {
this.isRetryable = options.codes;
}
els... | javascript | function RetryPolicy(options) {
options = options || {};
if (typeof options.maxAttempts === 'number') {
this.maxAttempts = options.maxAttempts;
}
else {
this.maxAttempts = RetryPolicy.DEFAULT_MAX_ATTEMPTS;
}
if (typeof options.codes === 'function') {
this.isRetryable = options.codes;
}
els... | [
"function",
"RetryPolicy",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"typeof",
"options",
".",
"maxAttempts",
"===",
"'number'",
")",
"{",
"this",
".",
"maxAttempts",
"=",
"options",
".",
"maxAttempts",
";",
"}"... | Retry policy controls behavior of Rorschach in case of errors.
@constructor
@param {Object} [options] Options:
@param {Number} options.maxAttempts Max number of attempts
@param {Array.<String>|Function} options.codes Error codes or error validation function | [
"Retry",
"policy",
"controls",
"behavior",
"of",
"Rorschach",
"in",
"case",
"of",
"errors",
"."
] | 899339baf31682f8a62b2960cdd26fbb58a9e3a1 | https://github.com/slideme/rorschach/blob/899339baf31682f8a62b2960cdd26fbb58a9e3a1/lib/RetryPolicy.js#L22-L38 |
47,780 | JoTrdl/grunt-dock | tasks/dock.js | function(command, arg) {
if (!arg) {
arg = 'default';
}
if (!commands[command]) {
grunt.fail.fatal('Command [' + command + '] not found.');
}
// Check arg
if (typeof (commands[command]) !== 'function') {
if (!commands[command][arg]) {
grunt.fail.fatal('Argument [' + a... | javascript | function(command, arg) {
if (!arg) {
arg = 'default';
}
if (!commands[command]) {
grunt.fail.fatal('Command [' + command + '] not found.');
}
// Check arg
if (typeof (commands[command]) !== 'function') {
if (!commands[command][arg]) {
grunt.fail.fatal('Argument [' + a... | [
"function",
"(",
"command",
",",
"arg",
")",
"{",
"if",
"(",
"!",
"arg",
")",
"{",
"arg",
"=",
"'default'",
";",
"}",
"if",
"(",
"!",
"commands",
"[",
"command",
"]",
")",
"{",
"grunt",
".",
"fail",
".",
"fatal",
"(",
"'Command ['",
"+",
"command... | Process the given command with arg. | [
"Process",
"the",
"given",
"command",
"with",
"arg",
"."
] | ea731dd4679c88cb7c6ae812affd1214c7eb43a9 | https://github.com/JoTrdl/grunt-dock/blob/ea731dd4679c88cb7c6ae812affd1214c7eb43a9/tasks/dock.js#L23-L57 | |
47,781 | levilindsey/physx | src/integrator/src/rk4-integrator.js | _calculateDerivative | function _calculateDerivative(out, state, job, t, dt, d) {
vec3.scaleAndAdd(state.position, state.position, d.velocity, dt);
vec3.scaleAndAdd(state.momentum, state.momentum, d.force, dt);
_geometry.scaleAndAddQuat(state.orientation, state.orientation, d.spin, dt);
vec3.scaleAndAdd(state.angularMomentum, state.a... | javascript | function _calculateDerivative(out, state, job, t, dt, d) {
vec3.scaleAndAdd(state.position, state.position, d.velocity, dt);
vec3.scaleAndAdd(state.momentum, state.momentum, d.force, dt);
_geometry.scaleAndAddQuat(state.orientation, state.orientation, d.spin, dt);
vec3.scaleAndAdd(state.angularMomentum, state.a... | [
"function",
"_calculateDerivative",
"(",
"out",
",",
"state",
",",
"job",
",",
"t",
",",
"dt",
",",
"d",
")",
"{",
"vec3",
".",
"scaleAndAdd",
"(",
"state",
".",
"position",
",",
"state",
".",
"position",
",",
"d",
".",
"velocity",
",",
"dt",
")",
... | Calculate the derivative from the given state with the given time step.
@param {PhysicsDerivative} out
@param {PhysicsState} state
@param {PhysicsJob} job
@param {number} t
@param {number} dt
@param {PhysicsDerivative} d
@private | [
"Calculate",
"the",
"derivative",
"from",
"the",
"given",
"state",
"with",
"the",
"given",
"time",
"step",
"."
] | 62df9f6968082ed34aa784a23f3db6c8feca6f3a | https://github.com/levilindsey/physx/blob/62df9f6968082ed34aa784a23f3db6c8feca6f3a/src/integrator/src/rk4-integrator.js#L83-L103 |
47,782 | backbeam/backbeamjs | cache.js | Cache | function Cache(maxSize, debug, storage) {
this.maxSize_ = maxSize || -1;
this.debug_ = debug || false;
this.storage_ = storage || new Cache.BasicCacheStorage();
this.fillFactor_ = .75;
this.stats_ = {};
this.stats_['hits'] = 0;
this.stats_['misses'] = 0;
this.log_('Initialized cache wi... | javascript | function Cache(maxSize, debug, storage) {
this.maxSize_ = maxSize || -1;
this.debug_ = debug || false;
this.storage_ = storage || new Cache.BasicCacheStorage();
this.fillFactor_ = .75;
this.stats_ = {};
this.stats_['hits'] = 0;
this.stats_['misses'] = 0;
this.log_('Initialized cache wi... | [
"function",
"Cache",
"(",
"maxSize",
",",
"debug",
",",
"storage",
")",
"{",
"this",
".",
"maxSize_",
"=",
"maxSize",
"||",
"-",
"1",
";",
"this",
".",
"debug_",
"=",
"debug",
"||",
"false",
";",
"this",
".",
"storage_",
"=",
"storage",
"||",
"new",
... | Creates a new Cache object.
@param {number} maxSize The maximum size of the cache (or -1 for no max).
@param {boolean} debug Whether to log events to the console.log.
@constructor | [
"Creates",
"a",
"new",
"Cache",
"object",
"."
] | 3d664a2edcb680da076a0f3b3afa717290f6c215 | https://github.com/backbeam/backbeamjs/blob/3d664a2edcb680da076a0f3b3afa717290f6c215/cache.js#L36-L47 |
47,783 | enquirer/prompt-autocompletion | index.js | Prompt | function Prompt() {
BasePrompt.apply(this, arguments);
if (typeof this.question.source !== 'function') {
throw new TypeError('expected source to be defined');
}
this.currentChoices = [];
this.firstRender = true;
this.selected = 0;
// Make sure no default is set (so it won't be printed)
this.questi... | javascript | function Prompt() {
BasePrompt.apply(this, arguments);
if (typeof this.question.source !== 'function') {
throw new TypeError('expected source to be defined');
}
this.currentChoices = [];
this.firstRender = true;
this.selected = 0;
// Make sure no default is set (so it won't be printed)
this.questi... | [
"function",
"Prompt",
"(",
")",
"{",
"BasePrompt",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"if",
"(",
"typeof",
"this",
".",
"question",
".",
"source",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'expected source to be ... | Create a new autocomplete `Prompt` | [
"Create",
"a",
"new",
"autocomplete",
"Prompt"
] | ea9daf347b0129e22a235de82bdc71038d34b341 | https://github.com/enquirer/prompt-autocompletion/blob/ea9daf347b0129e22a235de82bdc71038d34b341/index.js#L21-L34 |
47,784 | UsabilityDynamics/node-wordpress-client | examples/create.js | insertCallback | function insertCallback(error, data) {
console.log(require('util').inspect(error ? error.message : data, { showHidden: true, colors: true, depth: 2 }));
} | javascript | function insertCallback(error, data) {
console.log(require('util').inspect(error ? error.message : data, { showHidden: true, colors: true, depth: 2 }));
} | [
"function",
"insertCallback",
"(",
"error",
",",
"data",
")",
"{",
"console",
".",
"log",
"(",
"require",
"(",
"'util'",
")",
".",
"inspect",
"(",
"error",
"?",
"error",
".",
"message",
":",
"data",
",",
"{",
"showHidden",
":",
"true",
",",
"colors",
... | Insertion Callback.
@param error
@param data | [
"Insertion",
"Callback",
"."
] | 2b47a7c5cadd3d8f2cfd255f997f36af14a5d843 | https://github.com/UsabilityDynamics/node-wordpress-client/blob/2b47a7c5cadd3d8f2cfd255f997f36af14a5d843/examples/create.js#L13-L15 |
47,785 | JoTrdl/grunt-dock | lib/container.js | function(tag, confImage, callback) {
grunt.log.subhead(actioning[action] + ' image [' + tag + ']');
async.waterfall([
// Step 1: search for a running container with the same image
function(cb) {
docker.listContainers({
all : 1,
// filters: (action !== 'unpause') ? '{... | javascript | function(tag, confImage, callback) {
grunt.log.subhead(actioning[action] + ' image [' + tag + ']');
async.waterfall([
// Step 1: search for a running container with the same image
function(cb) {
docker.listContainers({
all : 1,
// filters: (action !== 'unpause') ? '{... | [
"function",
"(",
"tag",
",",
"confImage",
",",
"callback",
")",
"{",
"grunt",
".",
"log",
".",
"subhead",
"(",
"actioning",
"[",
"action",
"]",
"+",
"' image ['",
"+",
"tag",
"+",
"']'",
")",
";",
"async",
".",
"waterfall",
"(",
"[",
"// Step 1: search... | process 1 container with image tag | [
"process",
"1",
"container",
"with",
"image",
"tag"
] | ea731dd4679c88cb7c6ae812affd1214c7eb43a9 | https://github.com/JoTrdl/grunt-dock/blob/ea731dd4679c88cb7c6ae812affd1214c7eb43a9/lib/container.js#L159-L215 | |
47,786 | saggiyogesh/nodeportal | lib/Renderer/PluginRender.js | PluginRender | function PluginRender(pluginInstance, rendererInstance) {
this._view = "index.jade";
this._locals = {};
var ns = pluginInstance.pluginNamespace, obj = PluginHelper.getPluginIdAndIId(ns), pluginId = obj.pluginId,
req = PluginHelper.cloneRequest(rendererInstance.req, pluginId), res = rendererInstance... | javascript | function PluginRender(pluginInstance, rendererInstance) {
this._view = "index.jade";
this._locals = {};
var ns = pluginInstance.pluginNamespace, obj = PluginHelper.getPluginIdAndIId(ns), pluginId = obj.pluginId,
req = PluginHelper.cloneRequest(rendererInstance.req, pluginId), res = rendererInstance... | [
"function",
"PluginRender",
"(",
"pluginInstance",
",",
"rendererInstance",
")",
"{",
"this",
".",
"_view",
"=",
"\"index.jade\"",
";",
"this",
".",
"_locals",
"=",
"{",
"}",
";",
"var",
"ns",
"=",
"pluginInstance",
".",
"pluginNamespace",
",",
"obj",
"=",
... | Constructor to create Plugin render, which will render the plugin's html
@param pluginInstance {Object} Plugin Instance model
@param rendererInstance {PageRenderer} instance of PageRenderer
@constructor | [
"Constructor",
"to",
"create",
"Plugin",
"render",
"which",
"will",
"render",
"the",
"plugin",
"s",
"html"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/lib/Renderer/PluginRender.js#L21-L88 |
47,787 | reklatsmasters/unicast | lib/socket.js | filter | function filter(socket, message, rinfo) {
const isAllowedAddress = socket.remoteAddress === rinfo.address;
const isAllowedPort = socket.remotePort === rinfo.port;
return isAllowedAddress && isAllowedPort;
} | javascript | function filter(socket, message, rinfo) {
const isAllowedAddress = socket.remoteAddress === rinfo.address;
const isAllowedPort = socket.remotePort === rinfo.port;
return isAllowedAddress && isAllowedPort;
} | [
"function",
"filter",
"(",
"socket",
",",
"message",
",",
"rinfo",
")",
"{",
"const",
"isAllowedAddress",
"=",
"socket",
".",
"remoteAddress",
"===",
"rinfo",
".",
"address",
";",
"const",
"isAllowedPort",
"=",
"socket",
".",
"remotePort",
"===",
"rinfo",
".... | Default filter for incoming messages.
@param {Socket} socket
@param {Buffer} message
@param {{address: string, port: number}} rinfo
@returns {bool} | [
"Default",
"filter",
"for",
"incoming",
"messages",
"."
] | fe83eb884bcd8687e50a4b5163a5af584d32444b | https://github.com/reklatsmasters/unicast/blob/fe83eb884bcd8687e50a4b5163a5af584d32444b/lib/socket.js#L231-L236 |
47,788 | mdreizin/webpack-config-stream | lib/propsStream.js | propsStream | function propsStream(options) {
if (!_.isObject(options)) {
options = {};
}
return through.obj(function(chunk, enc, cb) {
var webpackOptions = chunk[FIELD_NAME] || {};
webpackOptions = _.merge(webpackOptions, options);
chunk[FIELD_NAME] = webpackOptions;
cb(null, ... | javascript | function propsStream(options) {
if (!_.isObject(options)) {
options = {};
}
return through.obj(function(chunk, enc, cb) {
var webpackOptions = chunk[FIELD_NAME] || {};
webpackOptions = _.merge(webpackOptions, options);
chunk[FIELD_NAME] = webpackOptions;
cb(null, ... | [
"function",
"propsStream",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isObject",
"(",
"options",
")",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"return",
"through",
".",
"obj",
"(",
"function",
"(",
"chunk",
",",
"enc",
",",
"cb",
"... | Overrides existing properties of each `webpack.config.js` file. Can be piped.
@function
@alias propsStream
@param {Configuration=} options
@returns {Stream} | [
"Overrides",
"existing",
"properties",
"of",
"each",
"webpack",
".",
"config",
".",
"js",
"file",
".",
"Can",
"be",
"piped",
"."
] | f8424f97837a224bc07cc18a03ecf649d708e924 | https://github.com/mdreizin/webpack-config-stream/blob/f8424f97837a224bc07cc18a03ecf649d708e924/lib/propsStream.js#L20-L34 |
47,789 | alekzonder/maf | src/Service/Config/getConfigFromConsul.js | function (logger, key, options) {
return new Promise((resolve, reject) => {
var url = `http://${options.host}:${options.port}/v1/kv/${key}`;
logger.trace(`GET ${url}`);
request.get(url)
.timeout(options.timeout)
.then((res) => {
logger.trace(`GET ${... | javascript | function (logger, key, options) {
return new Promise((resolve, reject) => {
var url = `http://${options.host}:${options.port}/v1/kv/${key}`;
logger.trace(`GET ${url}`);
request.get(url)
.timeout(options.timeout)
.then((res) => {
logger.trace(`GET ${... | [
"function",
"(",
"logger",
",",
"key",
",",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"var",
"url",
"=",
"`",
"${",
"options",
".",
"host",
"}",
"${",
"options",
".",
"port",
"}",
"${",
"... | get key form consul kv api
@param {logger} logger
@param {String} key
@param {Object} options
@private
@return {Promise} | [
"get",
"key",
"form",
"consul",
"kv",
"api"
] | 1c88ef1f8618080fa4bfd467220c938ac74c4164 | https://github.com/alekzonder/maf/blob/1c88ef1f8618080fa4bfd467220c938ac74c4164/src/Service/Config/getConfigFromConsul.js#L18-L58 | |
47,790 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/tabletools/dialogs/tableCell.js | function()
{
var heightType = this.getDialog().getContentElement( 'info', 'htmlHeightType' ),
labelElement = heightType.getElement(),
inputElement = this.getInputElement(),
ariaLabelledByAttr = inputElement.getAttribute( 'aria-labelledby' );
... | javascript | function()
{
var heightType = this.getDialog().getContentElement( 'info', 'htmlHeightType' ),
labelElement = heightType.getElement(),
inputElement = this.getInputElement(),
ariaLabelledByAttr = inputElement.getAttribute( 'aria-labelledby' );
... | [
"function",
"(",
")",
"{",
"var",
"heightType",
"=",
"this",
".",
"getDialog",
"(",
")",
".",
"getContentElement",
"(",
"'info'",
",",
"'htmlHeightType'",
")",
",",
"labelElement",
"=",
"heightType",
".",
"getElement",
"(",
")",
",",
"inputElement",
"=",
"... | Extra labelling of height unit type. | [
"Extra",
"labelling",
"of",
"height",
"unit",
"type",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/tabletools/dialogs/tableCell.js#L173-L181 | |
47,791 | anvaka/ngraph.shremlin | index.js | createGraphIterators | function createGraphIterators(graph) {
return {
/**
* Creates a vertex iterator stream. This is an entry point for all traversal
* starting with a node.
*
* @param {string|number} [startFrom] vertex id to start iteration from.
* If this argument is omitted, then all graph nodes are iter... | javascript | function createGraphIterators(graph) {
return {
/**
* Creates a vertex iterator stream. This is an entry point for all traversal
* starting with a node.
*
* @param {string|number} [startFrom] vertex id to start iteration from.
* If this argument is omitted, then all graph nodes are iter... | [
"function",
"createGraphIterators",
"(",
"graph",
")",
"{",
"return",
"{",
"/**\n * Creates a vertex iterator stream. This is an entry point for all traversal\n * starting with a node.\n *\n * @param {string|number} [startFrom] vertex id to start iteration from.\n * If this arg... | Creates a wrapper to iterate over graph. A wrapper contains methods which
allows you to begin iteration. Currently we support only vertices as iterator
starters, but in future we can easily extend this and add edges
@param {ngraph.graph|Viva.Graph.graph} graph source graph we want to iterate over | [
"Creates",
"a",
"wrapper",
"to",
"iterate",
"over",
"graph",
".",
"A",
"wrapper",
"contains",
"methods",
"which",
"allows",
"you",
"to",
"begin",
"iteration",
".",
"Currently",
"we",
"support",
"only",
"vertices",
"as",
"iterator",
"starters",
"but",
"in",
"... | 98f1f7892e0b1ccc4511cf664b74e7c0276f2ce7 | https://github.com/anvaka/ngraph.shremlin/blob/98f1f7892e0b1ccc4511cf664b74e7c0276f2ce7/index.js#L61-L81 |
47,792 | adriantoine/preact-enroute | index.js | normalizeRoute | function normalizeRoute(path, parent) {
if (path[0] === '/' || path[0] === '') {
return path; // absolute route
}
if (!parent) {
return path; // no need for a join
}
return `${parent.route}/${path}`; // join
} | javascript | function normalizeRoute(path, parent) {
if (path[0] === '/' || path[0] === '') {
return path; // absolute route
}
if (!parent) {
return path; // no need for a join
}
return `${parent.route}/${path}`; // join
} | [
"function",
"normalizeRoute",
"(",
"path",
",",
"parent",
")",
"{",
"if",
"(",
"path",
"[",
"0",
"]",
"===",
"'/'",
"||",
"path",
"[",
"0",
"]",
"===",
"''",
")",
"{",
"return",
"path",
";",
"// absolute route",
"}",
"if",
"(",
"!",
"parent",
")",
... | Normalize route based on the parent. | [
"Normalize",
"route",
"based",
"on",
"the",
"parent",
"."
] | c7923d05df4b4b6b36a7ea2014d2dfa9ad963383 | https://github.com/adriantoine/preact-enroute/blob/c7923d05df4b4b6b36a7ea2014d2dfa9ad963383/index.js#L97-L105 |
47,793 | lambtron/metalsmith-hover | lib/index.js | plugin | function plugin() {
return function(files, metalsmith, done) {
Object.keys(files).forEach(function(file) {
if (!~file.indexOf('.html')) return;
var $ = cheerio.load(files[file].contents);
var links = $('a');
for (var i = links.length - 1; i >= 0; i--) {
var url = links[i].attribs.h... | javascript | function plugin() {
return function(files, metalsmith, done) {
Object.keys(files).forEach(function(file) {
if (!~file.indexOf('.html')) return;
var $ = cheerio.load(files[file].contents);
var links = $('a');
for (var i = links.length - 1; i >= 0; i--) {
var url = links[i].attribs.h... | [
"function",
"plugin",
"(",
")",
"{",
"return",
"function",
"(",
"files",
",",
"metalsmith",
",",
"done",
")",
"{",
"Object",
".",
"keys",
"(",
"files",
")",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"if",
"(",
"!",
"~",
"file",
".",
... | Plugin to show images or gifs from anchor elements on hover.
@return {Function} | [
"Plugin",
"to",
"show",
"images",
"or",
"gifs",
"from",
"anchor",
"elements",
"on",
"hover",
"."
] | a147b8d109d88eaab8e93d20cfaac764de260b59 | https://github.com/lambtron/metalsmith-hover/blob/a147b8d109d88eaab8e93d20cfaac764de260b59/lib/index.js#L32-L47 |
47,794 | lambtron/metalsmith-hover | lib/index.js | image | function image(filename) {
if (!filename) return;
var ext = filename.split('.')[filename.split('.').length - 1];
return ~extensions.join().indexOf(ext);
} | javascript | function image(filename) {
if (!filename) return;
var ext = filename.split('.')[filename.split('.').length - 1];
return ~extensions.join().indexOf(ext);
} | [
"function",
"image",
"(",
"filename",
")",
"{",
"if",
"(",
"!",
"filename",
")",
"return",
";",
"var",
"ext",
"=",
"filename",
".",
"split",
"(",
"'.'",
")",
"[",
"filename",
".",
"split",
"(",
"'.'",
")",
".",
"length",
"-",
"1",
"]",
";",
"retu... | See if filename is image. | [
"See",
"if",
"filename",
"is",
"image",
"."
] | a147b8d109d88eaab8e93d20cfaac764de260b59 | https://github.com/lambtron/metalsmith-hover/blob/a147b8d109d88eaab8e93d20cfaac764de260b59/lib/index.js#L53-L57 |
47,795 | saggiyogesh/nodeportal | public/ckeditor/_source/core/htmlparser/filter.js | callItems | function callItems( currentEntry )
{
var isNode = currentEntry.type
|| currentEntry instanceof CKEDITOR.htmlParser.fragment;
for ( var i = 0 ; i < this.length ; i++ )
{
// Backup the node info before filtering.
if ( isNode )
{
var orgType = currentEntry.type,
orgName = currentEn... | javascript | function callItems( currentEntry )
{
var isNode = currentEntry.type
|| currentEntry instanceof CKEDITOR.htmlParser.fragment;
for ( var i = 0 ; i < this.length ; i++ )
{
// Backup the node info before filtering.
if ( isNode )
{
var orgType = currentEntry.type,
orgName = currentEn... | [
"function",
"callItems",
"(",
"currentEntry",
")",
"{",
"var",
"isNode",
"=",
"currentEntry",
".",
"type",
"||",
"currentEntry",
"instanceof",
"CKEDITOR",
".",
"htmlParser",
".",
"fragment",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
"... | Invoke filters sequentially on the array, break the iteration when it doesn't make sense to continue anymore. | [
"Invoke",
"filters",
"sequentially",
"on",
"the",
"array",
"break",
"the",
"iteration",
"when",
"it",
"doesn",
"t",
"make",
"sense",
"to",
"continue",
"anymore",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/core/htmlparser/filter.js#L232-L276 |
47,796 | building5/appdirsjs | index.js | function (dir, appname, version) {
if (appname) {
dir = path.join(dir, appname);
if (version) {
dir = path.join(dir, version);
}
}
return dir;
} | javascript | function (dir, appname, version) {
if (appname) {
dir = path.join(dir, appname);
if (version) {
dir = path.join(dir, version);
}
}
return dir;
} | [
"function",
"(",
"dir",
",",
"appname",
",",
"version",
")",
"{",
"if",
"(",
"appname",
")",
"{",
"dir",
"=",
"path",
".",
"join",
"(",
"dir",
",",
"appname",
")",
";",
"if",
"(",
"version",
")",
"{",
"dir",
"=",
"path",
".",
"join",
"(",
"dir"... | Append the name and and version to a path.
Both the appname and version are optional. The version is only appended if
the appname.
@param {string} dir Base directory.
@param {string} [appname] Optional name to append.
@param {string} [version] Optional version to append.
@returns {string} Resulting path
@private | [
"Append",
"the",
"name",
"and",
"and",
"version",
"to",
"a",
"path",
"."
] | 0c1a98efea2db40923b92e45725adb44c36f5a18 | https://github.com/building5/appdirsjs/blob/0c1a98efea2db40923b92e45725adb44c36f5a18/index.js#L40-L48 | |
47,797 | saggiyogesh/nodeportal | plugins/managePage/PageManageController.js | deletePage | function deletePage(req, res, next) {
var that = this, db = that.getDB(), DBActions = that.getDBActionsLib(),
dbAction = DBActions.getAuthInstance(req, PAGE_SCHEMA, PAGE_PERMISSION_SCHEMA_ENTRY);
var params = req.params;
var pageId = params.id;
if (!pageId) {
that.setErrorMessage(req, "N... | javascript | function deletePage(req, res, next) {
var that = this, db = that.getDB(), DBActions = that.getDBActionsLib(),
dbAction = DBActions.getAuthInstance(req, PAGE_SCHEMA, PAGE_PERMISSION_SCHEMA_ENTRY);
var params = req.params;
var pageId = params.id;
if (!pageId) {
that.setErrorMessage(req, "N... | [
"function",
"deletePage",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"that",
"=",
"this",
",",
"db",
"=",
"that",
".",
"getDB",
"(",
")",
",",
"DBActions",
"=",
"that",
".",
"getDBActionsLib",
"(",
")",
",",
"dbAction",
"=",
"DBActions",
... | only single page is deleted at a time, ie if a page doesn't have any children
@param req
@param res
@param next | [
"only",
"single",
"page",
"is",
"deleted",
"at",
"a",
"time",
"ie",
"if",
"a",
"page",
"doesn",
"t",
"have",
"any",
"children"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/plugins/managePage/PageManageController.js#L177-L243 |
47,798 | saggiyogesh/nodeportal | plugins/themeBuilder/ThemeBuilderPluginController.js | setupWatcher | function setupWatcher(app, dbAction, name) {
dbAction.get("findByName", name, function (err, theme) {
if (!err && theme) {
require(utils.getLibPath() + "/static/ThemesWatcher").cacheAndWatchTheme(app, theme);
}
});
} | javascript | function setupWatcher(app, dbAction, name) {
dbAction.get("findByName", name, function (err, theme) {
if (!err && theme) {
require(utils.getLibPath() + "/static/ThemesWatcher").cacheAndWatchTheme(app, theme);
}
});
} | [
"function",
"setupWatcher",
"(",
"app",
",",
"dbAction",
",",
"name",
")",
"{",
"dbAction",
".",
"get",
"(",
"\"findByName\"",
",",
"name",
",",
"function",
"(",
"err",
",",
"theme",
")",
"{",
"if",
"(",
"!",
"err",
"&&",
"theme",
")",
"{",
"require"... | Setup watcher for newly created theme for changes
@param app
@param dbAction
@param name | [
"Setup",
"watcher",
"for",
"newly",
"created",
"theme",
"for",
"changes"
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/plugins/themeBuilder/ThemeBuilderPluginController.js#L250-L256 |
47,799 | nicktindall/cyclon.p2p-rtc-client | lib/SignallingServerSelector.js | filterAndSortAvailableServers | function filterAndSortAvailableServers (serverArray) {
var copyOfServerArray = JSON.parse(JSON.stringify(serverArray));
copyOfServerArray.sort(function (itemOne, itemTwo) {
return sortValue(itemOne) - sortValue(itemTwo);
});
// Filter servers we've too-recently disconnected ... | javascript | function filterAndSortAvailableServers (serverArray) {
var copyOfServerArray = JSON.parse(JSON.stringify(serverArray));
copyOfServerArray.sort(function (itemOne, itemTwo) {
return sortValue(itemOne) - sortValue(itemTwo);
});
// Filter servers we've too-recently disconnected ... | [
"function",
"filterAndSortAvailableServers",
"(",
"serverArray",
")",
"{",
"var",
"copyOfServerArray",
"=",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"serverArray",
")",
")",
";",
"copyOfServerArray",
".",
"sort",
"(",
"function",
"(",
"itemOne",... | Return a copy of the known server array sorted in the order of
their last-disconnect-time. Due to the fact a failed connect is
considered a disconnect, this will cause servers to be tried in
a round robin pattern. | [
"Return",
"a",
"copy",
"of",
"the",
"known",
"server",
"array",
"sorted",
"in",
"the",
"order",
"of",
"their",
"last",
"-",
"disconnect",
"-",
"time",
".",
"Due",
"to",
"the",
"fact",
"a",
"failed",
"connect",
"is",
"considered",
"a",
"disconnect",
"this... | eb586ce288a6ad7e1b221280825037e855b03904 | https://github.com/nicktindall/cyclon.p2p-rtc-client/blob/eb586ce288a6ad7e1b221280825037e855b03904/lib/SignallingServerSelector.js#L24-L32 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.