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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
45,500 | henrytseng/angular-state-view | src/services/view-manager.js | function(callback) {
// Activate current
var current = $state.current();
if(current) {
// Reset
_resetActive().then(function() {
// Render
var viewsPromised = {};
var templates = current.templates || {};
var controllers = current.controllers || {};
angu... | javascript | function(callback) {
// Activate current
var current = $state.current();
if(current) {
// Reset
_resetActive().then(function() {
// Render
var viewsPromised = {};
var templates = current.templates || {};
var controllers = current.controllers || {};
angu... | [
"function",
"(",
"callback",
")",
"{",
"// Activate current",
"var",
"current",
"=",
"$state",
".",
"current",
"(",
")",
";",
"if",
"(",
"current",
")",
"{",
"// Reset",
"_resetActive",
"(",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"// Render",
... | Update rendered views
@param {Function} callback A completion callback, function(err) | [
"Update",
"rendered",
"views"
] | cf27c3a5cf65289501957e4dce3b75e7abef4def | https://github.com/henrytseng/angular-state-view/blob/cf27c3a5cf65289501957e4dce3b75e7abef4def/src/services/view-manager.js#L72-L104 | |
45,501 | henrytseng/angular-state-view | src/services/view-manager.js | function(id, view) {
// No id
if(!id) {
throw new Error('View requires an id.');
// Require unique id
} else if(_viewHash[id]) {
throw new Error('View requires a unique id');
// Add
} else {
_viewHash[id] = view;
}
// Check if view is currently active
var current... | javascript | function(id, view) {
// No id
if(!id) {
throw new Error('View requires an id.');
// Require unique id
} else if(_viewHash[id]) {
throw new Error('View requires a unique id');
// Add
} else {
_viewHash[id] = view;
}
// Check if view is currently active
var current... | [
"function",
"(",
"id",
",",
"view",
")",
"{",
"// No id",
"if",
"(",
"!",
"id",
")",
"{",
"throw",
"new",
"Error",
"(",
"'View requires an id.'",
")",
";",
"// Require unique id",
"}",
"else",
"if",
"(",
"_viewHash",
"[",
"id",
"]",
")",
"{",
"throw",
... | Register a view, also implements destroy method on view to unregister from manager
@param {String} id Unique identifier for view
@param {View} view A view instance
@return {$viewManager} Itself, chainable | [
"Register",
"a",
"view",
"also",
"implements",
"destroy",
"method",
"on",
"view",
"to",
"unregister",
"from",
"manager"
] | cf27c3a5cf65289501957e4dce3b75e7abef4def | https://github.com/henrytseng/angular-state-view/blob/cf27c3a5cf65289501957e4dce3b75e7abef4def/src/services/view-manager.js#L124-L152 | |
45,502 | synder/xpress | demo/body-parser/lib/read.js | read | function read (req, res, next, parse, debug, options) {
var length
var opts = options || {}
var stream
// flag as parsed
req._body = true
// read options
var encoding = opts.encoding !== null
? opts.encoding || 'utf-8'
: null
var verify = opts.verify
try {
// get the content stream
... | javascript | function read (req, res, next, parse, debug, options) {
var length
var opts = options || {}
var stream
// flag as parsed
req._body = true
// read options
var encoding = opts.encoding !== null
? opts.encoding || 'utf-8'
: null
var verify = opts.verify
try {
// get the content stream
... | [
"function",
"read",
"(",
"req",
",",
"res",
",",
"next",
",",
"parse",
",",
"debug",
",",
"options",
")",
"{",
"var",
"length",
"var",
"opts",
"=",
"options",
"||",
"{",
"}",
"var",
"stream",
"// flag as parsed",
"req",
".",
"_body",
"=",
"true",
"//... | Read a request into a buffer and parse.
@param {object} req
@param {object} res
@param {function} next
@param {function} parse
@param {function} debug
@param {object} [options]
@api private | [
"Read",
"a",
"request",
"into",
"a",
"buffer",
"and",
"parse",
"."
] | 4b1e89208b6f34cd78ce90b8a858592115b6ccb5 | https://github.com/synder/xpress/blob/4b1e89208b6f34cd78ce90b8a858592115b6ccb5/demo/body-parser/lib/read.js#L38-L131 |
45,503 | synder/xpress | demo/body-parser/lib/read.js | contentstream | function contentstream (req, debug, inflate) {
var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
var length = req.headers['content-length']
var stream
debug('content-encoding "%s"', encoding)
if (inflate === false && encoding !== 'identity') {
throw createError(415, 'content e... | javascript | function contentstream (req, debug, inflate) {
var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
var length = req.headers['content-length']
var stream
debug('content-encoding "%s"', encoding)
if (inflate === false && encoding !== 'identity') {
throw createError(415, 'content e... | [
"function",
"contentstream",
"(",
"req",
",",
"debug",
",",
"inflate",
")",
"{",
"var",
"encoding",
"=",
"(",
"req",
".",
"headers",
"[",
"'content-encoding'",
"]",
"||",
"'identity'",
")",
".",
"toLowerCase",
"(",
")",
"var",
"length",
"=",
"req",
".",
... | Get the content stream of the request.
@param {object} req
@param {function} debug
@param {boolean} [inflate=true]
@return {object}
@api private | [
"Get",
"the",
"content",
"stream",
"of",
"the",
"request",
"."
] | 4b1e89208b6f34cd78ce90b8a858592115b6ccb5 | https://github.com/synder/xpress/blob/4b1e89208b6f34cd78ce90b8a858592115b6ccb5/demo/body-parser/lib/read.js#L143-L176 |
45,504 | synder/xpress | demo/body-parser/lib/read.js | setErrorStatus | function setErrorStatus (error, status) {
if (!error.status && !error.statusCode) {
error.status = status
error.statusCode = status
}
} | javascript | function setErrorStatus (error, status) {
if (!error.status && !error.statusCode) {
error.status = status
error.statusCode = status
}
} | [
"function",
"setErrorStatus",
"(",
"error",
",",
"status",
")",
"{",
"if",
"(",
"!",
"error",
".",
"status",
"&&",
"!",
"error",
".",
"statusCode",
")",
"{",
"error",
".",
"status",
"=",
"status",
"error",
".",
"statusCode",
"=",
"status",
"}",
"}"
] | Set a status on an error object, if ones does not exist
@private | [
"Set",
"a",
"status",
"on",
"an",
"error",
"object",
"if",
"ones",
"does",
"not",
"exist"
] | 4b1e89208b6f34cd78ce90b8a858592115b6ccb5 | https://github.com/synder/xpress/blob/4b1e89208b6f34cd78ce90b8a858592115b6ccb5/demo/body-parser/lib/read.js#L183-L188 |
45,505 | jonschlinkert/file-contents | utils.js | syncContents | function syncContents(file, val) {
switch (utils.typeOf(val)) {
case 'buffer':
file._contents = val;
file._content = val.toString();
break;
case 'string':
file._contents = new Buffer(val);
file._content = val;
break;
case 'stream':
file._contents = val;
file... | javascript | function syncContents(file, val) {
switch (utils.typeOf(val)) {
case 'buffer':
file._contents = val;
file._content = val.toString();
break;
case 'string':
file._contents = new Buffer(val);
file._content = val;
break;
case 'stream':
file._contents = val;
file... | [
"function",
"syncContents",
"(",
"file",
",",
"val",
")",
"{",
"switch",
"(",
"utils",
".",
"typeOf",
"(",
"val",
")",
")",
"{",
"case",
"'buffer'",
":",
"file",
".",
"_contents",
"=",
"val",
";",
"file",
".",
"_content",
"=",
"val",
".",
"toString",... | Sync the _content and _contents properties on a view to ensure
both are set when setting either.
@param {Object} `view` instance of a `View`
@param {String|Buffer|Stream|null} `contents` contents to set on both properties | [
"Sync",
"the",
"_content",
"and",
"_contents",
"properties",
"on",
"a",
"view",
"to",
"ensure",
"both",
"are",
"set",
"when",
"setting",
"either",
"."
] | a53dcc62a1a529fc5f8b1dc0fa2a76a3196236fa | https://github.com/jonschlinkert/file-contents/blob/a53dcc62a1a529fc5f8b1dc0fa2a76a3196236fa/utils.js#L121-L143 |
45,506 | mchalapuk/hyper-text-slider | lib/utils/elements.spec-helper.js | createElement | function createElement(nodeName) {
var elem = document.createElement(nodeName);
elem.className = [].join.call(arguments, ' ');
return elem;
} | javascript | function createElement(nodeName) {
var elem = document.createElement(nodeName);
elem.className = [].join.call(arguments, ' ');
return elem;
} | [
"function",
"createElement",
"(",
"nodeName",
")",
"{",
"var",
"elem",
"=",
"document",
".",
"createElement",
"(",
"nodeName",
")",
";",
"elem",
".",
"className",
"=",
"[",
"]",
".",
"join",
".",
"call",
"(",
"arguments",
",",
"' '",
")",
";",
"return"... | Creates element with given nodeName and className. | [
"Creates",
"element",
"with",
"given",
"nodeName",
"and",
"className",
"."
] | 2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4 | https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/utils/elements.spec-helper.js#L25-L29 |
45,507 | mchalapuk/hyper-text-slider | lib/utils/elements.spec-helper.js | createSliderElement | function createSliderElement(slidesCount) {
var sliderElement = createElement('div', Layout.SLIDER);
for (var i = 0; i < slidesCount; ++i) {
sliderElement.appendChild(createElement('div', Layout.SLIDE));
}
return sliderElement;
} | javascript | function createSliderElement(slidesCount) {
var sliderElement = createElement('div', Layout.SLIDER);
for (var i = 0; i < slidesCount; ++i) {
sliderElement.appendChild(createElement('div', Layout.SLIDE));
}
return sliderElement;
} | [
"function",
"createSliderElement",
"(",
"slidesCount",
")",
"{",
"var",
"sliderElement",
"=",
"createElement",
"(",
"'div'",
",",
"Layout",
".",
"SLIDER",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"slidesCount",
";",
"++",
"i",
")",
"{... | Creates valid slider element containing slides of given count. | [
"Creates",
"valid",
"slider",
"element",
"containing",
"slides",
"of",
"given",
"count",
"."
] | 2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4 | https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/utils/elements.spec-helper.js#L34-L40 |
45,508 | abarth500/density-clustering-kdtree-doping | OPTICS-KDTREE.js | OPTICS | function OPTICS(dataset, epsilon, minPts, distanceFunction) {
this.tree = null;
/** @type {number} */
this.epsilon = 1;
/** @type {number} */
this.minPts = 1;
/** @type {function} */
this.distance = this._euclideanDistance;
// temporary variables used during computation
/** @type {... | javascript | function OPTICS(dataset, epsilon, minPts, distanceFunction) {
this.tree = null;
/** @type {number} */
this.epsilon = 1;
/** @type {number} */
this.minPts = 1;
/** @type {function} */
this.distance = this._euclideanDistance;
// temporary variables used during computation
/** @type {... | [
"function",
"OPTICS",
"(",
"dataset",
",",
"epsilon",
",",
"minPts",
",",
"distanceFunction",
")",
"{",
"this",
".",
"tree",
"=",
"null",
";",
"/** @type {number} */",
"this",
".",
"epsilon",
"=",
"1",
";",
"/** @type {number} */",
"this",
".",
"minPts",
"="... | OPTICS - Ordering points to identify the clustering structure
@author Lukasz Krawczyk <contact@lukaszkrawczyk.eu>
@copyright MIT
OPTICS class constructor
@constructor
@param {Array} dataset
@param {number} epsilon
@param {number} minPts
@param {function} distanceFunction
@returns {OPTICS} | [
"OPTICS",
"-",
"Ordering",
"points",
"to",
"identify",
"the",
"clustering",
"structure"
] | 48cfdd75a1f71a65738e5ae016488109109bf308 | https://github.com/abarth500/density-clustering-kdtree-doping/blob/48cfdd75a1f71a65738e5ae016488109109bf308/OPTICS-KDTREE.js#L21-L42 |
45,509 | abramz/gulp-render-react | lib/render-react.js | createElement | function createElement(filePath, props) {
if (!filePath || typeof filePath !== 'string' || filePath.length === 0) {
throw new Error('Expected filePath to be a string');
}
// clear the require cache if we have already imported the file (if we are watching it)
if (require.cache[filePath]) {
delete requir... | javascript | function createElement(filePath, props) {
if (!filePath || typeof filePath !== 'string' || filePath.length === 0) {
throw new Error('Expected filePath to be a string');
}
// clear the require cache if we have already imported the file (if we are watching it)
if (require.cache[filePath]) {
delete requir... | [
"function",
"createElement",
"(",
"filePath",
",",
"props",
")",
"{",
"if",
"(",
"!",
"filePath",
"||",
"typeof",
"filePath",
"!==",
"'string'",
"||",
"filePath",
".",
"length",
"===",
"0",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Expected filePath to be a ... | Requires a file containing a React component and create an instance of it
@param {String} filePath file path to the React component to render
@param {Object} props properties to apply to the element
@return {Element} the created React element
/*! Gulp Render React | MIT License | [
"Requires",
"a",
"file",
"containing",
"a",
"React",
"component",
"and",
"create",
"an",
"instance",
"of",
"it"
] | eff4c10f0070837e704aa766b82221127ef315fd | https://github.com/abramz/gulp-render-react/blob/eff4c10f0070837e704aa766b82221127ef315fd/lib/render-react.js#L14-L28 |
45,510 | MatAtBread/nodent-transform | arboriculture.js | transformForIn | function transformForIn(node, path) {
var label = node.$label;
delete node.$label;
var idx = ident(generateSymbol("idx"));
var inArray = ident(generateSymbol("in"));
var declVars = parsePart("var $0,$1 = [];for ($0 in $2) $1.push($0)", [idx,
inArray,node.right]).body;... | javascript | function transformForIn(node, path) {
var label = node.$label;
delete node.$label;
var idx = ident(generateSymbol("idx"));
var inArray = ident(generateSymbol("in"));
var declVars = parsePart("var $0,$1 = [];for ($0 in $2) $1.push($0)", [idx,
inArray,node.right]).body;... | [
"function",
"transformForIn",
"(",
"node",
",",
"path",
")",
"{",
"var",
"label",
"=",
"node",
".",
"$label",
";",
"delete",
"node",
".",
"$label",
";",
"var",
"idx",
"=",
"ident",
"(",
"generateSymbol",
"(",
"\"idx\"",
")",
")",
";",
"var",
"inArray",... | Transform a for..in into it's iterative equivalent | [
"Transform",
"a",
"for",
"..",
"in",
"into",
"it",
"s",
"iterative",
"equivalent"
] | 40d61ad20b0a87fb83d420fd98ba01adbff73cac | https://github.com/MatAtBread/nodent-transform/blob/40d61ad20b0a87fb83d420fd98ba01adbff73cac/arboriculture.js#L1152-L1170 |
45,511 | MatAtBread/nodent-transform | arboriculture.js | iterizeForOf | function iterizeForOf(node, path) {
if (node.body.type !== 'BlockStatement') {
node.body = {
type: 'BlockStatement',
body: [node.body]
};
}
var index, iterator, initIterator = parsePart("[$0[Symbol.iterator]()]", [node.right]).expr;
... | javascript | function iterizeForOf(node, path) {
if (node.body.type !== 'BlockStatement') {
node.body = {
type: 'BlockStatement',
body: [node.body]
};
}
var index, iterator, initIterator = parsePart("[$0[Symbol.iterator]()]", [node.right]).expr;
... | [
"function",
"iterizeForOf",
"(",
"node",
",",
"path",
")",
"{",
"if",
"(",
"node",
".",
"body",
".",
"type",
"!==",
"'BlockStatement'",
")",
"{",
"node",
".",
"body",
"=",
"{",
"type",
":",
"'BlockStatement'",
",",
"body",
":",
"[",
"node",
".",
"bod... | Transform a for..of into it's iterative equivalent | [
"Transform",
"a",
"for",
"..",
"of",
"into",
"it",
"s",
"iterative",
"equivalent"
] | 40d61ad20b0a87fb83d420fd98ba01adbff73cac | https://github.com/MatAtBread/nodent-transform/blob/40d61ad20b0a87fb83d420fd98ba01adbff73cac/arboriculture.js#L1173-L1222 |
45,512 | MatAtBread/nodent-transform | arboriculture.js | mappableLoop | function mappableLoop(n) {
return n.type === 'AwaitExpression' && !n.$hidden || inAsyncLoop && (n.type === 'BreakStatement' || n.type === 'ContinueStatement') && n.label;
} | javascript | function mappableLoop(n) {
return n.type === 'AwaitExpression' && !n.$hidden || inAsyncLoop && (n.type === 'BreakStatement' || n.type === 'ContinueStatement') && n.label;
} | [
"function",
"mappableLoop",
"(",
"n",
")",
"{",
"return",
"n",
".",
"type",
"===",
"'AwaitExpression'",
"&&",
"!",
"n",
".",
"$hidden",
"||",
"inAsyncLoop",
"&&",
"(",
"n",
".",
"type",
"===",
"'BreakStatement'",
"||",
"n",
".",
"type",
"===",
"'Continue... | Check if the loop contains an await, or a labelled exit if we're inside an async loop | [
"Check",
"if",
"the",
"loop",
"contains",
"an",
"await",
"or",
"a",
"labelled",
"exit",
"if",
"we",
"re",
"inside",
"an",
"async",
"loop"
] | 40d61ad20b0a87fb83d420fd98ba01adbff73cac | https://github.com/MatAtBread/nodent-transform/blob/40d61ad20b0a87fb83d420fd98ba01adbff73cac/arboriculture.js#L1238-L1240 |
45,513 | MatAtBread/nodent-transform | arboriculture.js | function (label) {
return {
type: 'ReturnStatement',
argument: {
type: 'UnaryExpression',
operator: 'void',
prefix: true,
argument: {
... | javascript | function (label) {
return {
type: 'ReturnStatement',
argument: {
type: 'UnaryExpression',
operator: 'void',
prefix: true,
argument: {
... | [
"function",
"(",
"label",
")",
"{",
"return",
"{",
"type",
":",
"'ReturnStatement'",
",",
"argument",
":",
"{",
"type",
":",
"'UnaryExpression'",
",",
"operator",
":",
"'void'",
",",
"prefix",
":",
"true",
",",
"argument",
":",
"{",
"type",
":",
"'CallEx... | How to exit the loop | [
"How",
"to",
"exit",
"the",
"loop"
] | 40d61ad20b0a87fb83d420fd98ba01adbff73cac | https://github.com/MatAtBread/nodent-transform/blob/40d61ad20b0a87fb83d420fd98ba01adbff73cac/arboriculture.js#L1544-L1558 | |
45,514 | fknussel/custom-scripts | utils/index.js | checkRequiredFiles | function checkRequiredFiles() {
const indexHtmlExists = fse.existsSync(paths.indexHtml);
const indexJsExists = fse.existsSync(paths.indexJs);
if (!indexHtmlExists || !indexJsExists) {
logError('\nSome required files couldn\'t be found. Make sure these all exist:\n');
logError(`\t- ${paths.indexHtml}`);
... | javascript | function checkRequiredFiles() {
const indexHtmlExists = fse.existsSync(paths.indexHtml);
const indexJsExists = fse.existsSync(paths.indexJs);
if (!indexHtmlExists || !indexJsExists) {
logError('\nSome required files couldn\'t be found. Make sure these all exist:\n');
logError(`\t- ${paths.indexHtml}`);
... | [
"function",
"checkRequiredFiles",
"(",
")",
"{",
"const",
"indexHtmlExists",
"=",
"fse",
".",
"existsSync",
"(",
"paths",
".",
"indexHtml",
")",
";",
"const",
"indexJsExists",
"=",
"fse",
".",
"existsSync",
"(",
"paths",
".",
"indexJs",
")",
";",
"if",
"("... | Warn and crash if required files are missing. | [
"Warn",
"and",
"crash",
"if",
"required",
"files",
"are",
"missing",
"."
] | 801ad6f42bcde265e317d427b7ee0f371eeb0e9b | https://github.com/fknussel/custom-scripts/blob/801ad6f42bcde265e317d427b7ee0f371eeb0e9b/utils/index.js#L41-L52 |
45,515 | fknussel/custom-scripts | utils/index.js | printErrors | function printErrors(summary, errors) {
logError(`${summary}\n`);
errors.forEach(err => {
logError(`\t- ${err.message || err}`);
});
console.log();
} | javascript | function printErrors(summary, errors) {
logError(`${summary}\n`);
errors.forEach(err => {
logError(`\t- ${err.message || err}`);
});
console.log();
} | [
"function",
"printErrors",
"(",
"summary",
",",
"errors",
")",
"{",
"logError",
"(",
"`",
"${",
"summary",
"}",
"\\n",
"`",
")",
";",
"errors",
".",
"forEach",
"(",
"err",
"=>",
"{",
"logError",
"(",
"`",
"\\t",
"${",
"err",
".",
"message",
"||",
"... | Print out a list of errors to the terminal. | [
"Print",
"out",
"a",
"list",
"of",
"errors",
"to",
"the",
"terminal",
"."
] | 801ad6f42bcde265e317d427b7ee0f371eeb0e9b | https://github.com/fknussel/custom-scripts/blob/801ad6f42bcde265e317d427b7ee0f371eeb0e9b/utils/index.js#L77-L85 |
45,516 | vid/SenseBase | lib/pubsub.js | changeAnnotationState | function changeAnnotationState(combo, username) {
combo.annotations.forEach(function(anno) {
anno.state = combo.state;
});
contentLib.indexContentItem({uri: combo.uri}, { member: username , annotations: combo.annotations} );
} | javascript | function changeAnnotationState(combo, username) {
combo.annotations.forEach(function(anno) {
anno.state = combo.state;
});
contentLib.indexContentItem({uri: combo.uri}, { member: username , annotations: combo.annotations} );
} | [
"function",
"changeAnnotationState",
"(",
"combo",
",",
"username",
")",
"{",
"combo",
".",
"annotations",
".",
"forEach",
"(",
"function",
"(",
"anno",
")",
"{",
"anno",
".",
"state",
"=",
"combo",
".",
"state",
";",
"}",
")",
";",
"contentLib",
".",
... | Annotations functions FIXME change the state of annotations | [
"Annotations",
"functions",
"FIXME",
"change",
"the",
"state",
"of",
"annotations"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/pubsub.js#L320-L326 |
45,517 | vid/SenseBase | lib/pubsub.js | publishUpdate | function publishUpdate(combo) {
GLOBAL.svc.indexer.retrieveByURI(combo.uri, function(err, res) {
if (!err && res && res._source) {
res = res._source;
combo.selector = 'body';
combo.text = res.text;
combo.content = res.content;
fayeClient.publish('/item/annotations/annotat... | javascript | function publishUpdate(combo) {
GLOBAL.svc.indexer.retrieveByURI(combo.uri, function(err, res) {
if (!err && res && res._source) {
res = res._source;
combo.selector = 'body';
combo.text = res.text;
combo.content = res.content;
fayeClient.publish('/item/annotations/annotat... | [
"function",
"publishUpdate",
"(",
"combo",
")",
"{",
"GLOBAL",
".",
"svc",
".",
"indexer",
".",
"retrieveByURI",
"(",
"combo",
".",
"uri",
",",
"function",
"(",
"err",
",",
"res",
")",
"{",
"if",
"(",
"!",
"err",
"&&",
"res",
"&&",
"res",
".",
"_so... | Request an update for this URI, optionally from a specific member | [
"Request",
"an",
"update",
"for",
"this",
"URI",
"optionally",
"from",
"a",
"specific",
"member"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/pubsub.js#L329-L342 |
45,518 | vid/SenseBase | lib/pubsub.js | debounceUpdate | function debounceUpdate(combo) {
bouncedUpdates[combo.uri] = combo;
if (Object.keys(bouncedUpdates).length < bounceHold) {
clearTimeout(bounceTimeout);
bounceTimeout = setTimeout(function() {
var toDebounce = Object.keys(bouncedUpdates).map(function(b) { return bouncedUpdates[b]; }... | javascript | function debounceUpdate(combo) {
bouncedUpdates[combo.uri] = combo;
if (Object.keys(bouncedUpdates).length < bounceHold) {
clearTimeout(bounceTimeout);
bounceTimeout = setTimeout(function() {
var toDebounce = Object.keys(bouncedUpdates).map(function(b) { return bouncedUpdates[b]; }... | [
"function",
"debounceUpdate",
"(",
"combo",
")",
"{",
"bouncedUpdates",
"[",
"combo",
".",
"uri",
"]",
"=",
"combo",
";",
"if",
"(",
"Object",
".",
"keys",
"(",
"bouncedUpdates",
")",
".",
"length",
"<",
"bounceHold",
")",
"{",
"clearTimeout",
"(",
"boun... | batch updates per a size or time frame. note bounceHold may be exceeded due to the delay. | [
"batch",
"updates",
"per",
"a",
"size",
"or",
"time",
"frame",
".",
"note",
"bounceHold",
"may",
"be",
"exceeded",
"due",
"to",
"the",
"delay",
"."
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/pubsub.js#L345-L355 |
45,519 | vid/SenseBase | lib/pubsub.js | adjureAnnotators | function adjureAnnotators(uris, annotators) {
GLOBAL.info('/item/annotations/adjure annotators'.yellow, uris, JSON.stringify(annotators));
uris.forEach(function(uri) {
annotators.forEach(function(member) {
publishUpdate({ uri: uri, member: member});
});
});
} | javascript | function adjureAnnotators(uris, annotators) {
GLOBAL.info('/item/annotations/adjure annotators'.yellow, uris, JSON.stringify(annotators));
uris.forEach(function(uri) {
annotators.forEach(function(member) {
publishUpdate({ uri: uri, member: member});
});
});
} | [
"function",
"adjureAnnotators",
"(",
"uris",
",",
"annotators",
")",
"{",
"GLOBAL",
".",
"info",
"(",
"'/item/annotations/adjure annotators'",
".",
"yellow",
",",
"uris",
",",
"JSON",
".",
"stringify",
"(",
"annotators",
")",
")",
";",
"uris",
".",
"forEach",
... | Publish annotation requests for specific annotators for the uris | [
"Publish",
"annotation",
"requests",
"for",
"specific",
"annotators",
"for",
"the",
"uris"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/pubsub.js#L358-L365 |
45,520 | vid/SenseBase | lib/pubsub.js | adjureAnnotations | function adjureAnnotations(uris, annotations, username) {
GLOBAL.info('/item/annotations/adjure annotations'.yellow, username.blue, uris, annotations.length);
try {
var user = GLOBAL.svc.auth.getUserByUsername(username);
if (!user) {
throw new Error("no user " + username);
}
uris... | javascript | function adjureAnnotations(uris, annotations, username) {
GLOBAL.info('/item/annotations/adjure annotations'.yellow, username.blue, uris, annotations.length);
try {
var user = GLOBAL.svc.auth.getUserByUsername(username);
if (!user) {
throw new Error("no user " + username);
}
uris... | [
"function",
"adjureAnnotations",
"(",
"uris",
",",
"annotations",
",",
"username",
")",
"{",
"GLOBAL",
".",
"info",
"(",
"'/item/annotations/adjure annotations'",
".",
"yellow",
",",
"username",
".",
"blue",
",",
"uris",
",",
"annotations",
".",
"length",
")",
... | apply annotations for the uris | [
"apply",
"annotations",
"for",
"the",
"uris"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/pubsub.js#L368-L402 |
45,521 | vid/SenseBase | lib/pubsub.js | publish | function publish(channel, data, clientID) {
if (clientID) {
channel += '/' + clientID;
}
fayeClient.publish(channel, data);
} | javascript | function publish(channel, data, clientID) {
if (clientID) {
channel += '/' + clientID;
}
fayeClient.publish(channel, data);
} | [
"function",
"publish",
"(",
"channel",
",",
"data",
",",
"clientID",
")",
"{",
"if",
"(",
"clientID",
")",
"{",
"channel",
"+=",
"'/'",
"+",
"clientID",
";",
"}",
"fayeClient",
".",
"publish",
"(",
"channel",
",",
"data",
")",
";",
"}"
] | Publish data to a general or client specific channel if clientID is present. | [
"Publish",
"data",
"to",
"a",
"general",
"or",
"client",
"specific",
"channel",
"if",
"clientID",
"is",
"present",
"."
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/pubsub.js#L405-L410 |
45,522 | feedhenry/fh-mbaas-client | lib/MbaasClient.js | MbaasClient | function MbaasClient(envId, mbaasConf) {
this.envId = envId;
this.mbaasConfig = mbaasConf;
this.setMbaasUrl();
this.app = {};
this.admin = {};
proxy(this.app, app, this.mbaasConfig);
proxy(this.admin, admin, this.mbaasConfig);
} | javascript | function MbaasClient(envId, mbaasConf) {
this.envId = envId;
this.mbaasConfig = mbaasConf;
this.setMbaasUrl();
this.app = {};
this.admin = {};
proxy(this.app, app, this.mbaasConfig);
proxy(this.admin, admin, this.mbaasConfig);
} | [
"function",
"MbaasClient",
"(",
"envId",
",",
"mbaasConf",
")",
"{",
"this",
".",
"envId",
"=",
"envId",
";",
"this",
".",
"mbaasConfig",
"=",
"mbaasConf",
";",
"this",
".",
"setMbaasUrl",
"(",
")",
";",
"this",
".",
"app",
"=",
"{",
"}",
";",
"this"... | Create a new instance of MbaasClient
@param envId the id of the environment
@param mbaasConf the mbaas configuration
@constructor | [
"Create",
"a",
"new",
"instance",
"of",
"MbaasClient"
] | 2d5a9cbb32e1b2464d71ffa18513358fea388859 | https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/MbaasClient.js#L12-L20 |
45,523 | rat-nest/big-rat | to-float.js | roundRat | function roundRat (f) {
var a = f[0]
var b = f[1]
if (a.cmpn(0) === 0) {
return 0
}
var h = a.abs().divmod(b.abs())
var iv = h.div
var x = bn2num(iv)
var ir = h.mod
var sgn = (a.negative !== b.negative) ? -1 : 1
if (ir.cmpn(0) === 0) {
return sgn * x
}
if (x) {
var s = ctz(x) + 4
... | javascript | function roundRat (f) {
var a = f[0]
var b = f[1]
if (a.cmpn(0) === 0) {
return 0
}
var h = a.abs().divmod(b.abs())
var iv = h.div
var x = bn2num(iv)
var ir = h.mod
var sgn = (a.negative !== b.negative) ? -1 : 1
if (ir.cmpn(0) === 0) {
return sgn * x
}
if (x) {
var s = ctz(x) + 4
... | [
"function",
"roundRat",
"(",
"f",
")",
"{",
"var",
"a",
"=",
"f",
"[",
"0",
"]",
"var",
"b",
"=",
"f",
"[",
"1",
"]",
"if",
"(",
"a",
".",
"cmpn",
"(",
"0",
")",
"===",
"0",
")",
"{",
"return",
"0",
"}",
"var",
"h",
"=",
"a",
".",
"abs"... | Round a rational to the closest float | [
"Round",
"a",
"rational",
"to",
"the",
"closest",
"float"
] | 09aabcf6d51a326dce0e4bdeedb159c9ce6b0efa | https://github.com/rat-nest/big-rat/blob/09aabcf6d51a326dce0e4bdeedb159c9ce6b0efa/to-float.js#L9-L36 |
45,524 | onecommons/base | lib/passport.js | function(req, token, refreshToken, profile, done) {
// asynchronous
process.nextTick(function() {
var User = app.userModel;
// find the user in the database based on their facebook id
User.findOne({ 'facebook.id' : profile.id }, function(err, user) {
... | javascript | function(req, token, refreshToken, profile, done) {
// asynchronous
process.nextTick(function() {
var User = app.userModel;
// find the user in the database based on their facebook id
User.findOne({ 'facebook.id' : profile.id }, function(err, user) {
... | [
"function",
"(",
"req",
",",
"token",
",",
"refreshToken",
",",
"profile",
",",
"done",
")",
"{",
"// asynchronous",
"process",
".",
"nextTick",
"(",
"function",
"(",
")",
"{",
"var",
"User",
"=",
"app",
".",
"userModel",
";",
"// find the user in the databa... | facebook will send back the token and profile | [
"facebook",
"will",
"send",
"back",
"the",
"token",
"and",
"profile"
] | 4f35d9f714d0367b0622a3504802363404290246 | https://github.com/onecommons/base/blob/4f35d9f714d0367b0622a3504802363404290246/lib/passport.js#L291-L339 | |
45,525 | feedhenry/fh-mbaas-client | lib/admin/alerts/notifications.js | listNotifications | function listNotifications(params, cb) {
params.resourcePath = config.addURIParams(constants.NOTIFICATIONS_BASE_PATH, params);
params.method = 'GET';
params.data = params.data || {};
mbaasRequest.admin(params, cb);
} | javascript | function listNotifications(params, cb) {
params.resourcePath = config.addURIParams(constants.NOTIFICATIONS_BASE_PATH, params);
params.method = 'GET';
params.data = params.data || {};
mbaasRequest.admin(params, cb);
} | [
"function",
"listNotifications",
"(",
"params",
",",
"cb",
")",
"{",
"params",
".",
"resourcePath",
"=",
"config",
".",
"addURIParams",
"(",
"constants",
".",
"NOTIFICATIONS_BASE_PATH",
",",
"params",
")",
";",
"params",
".",
"method",
"=",
"'GET'",
";",
"pa... | List Notifications on an MBaaS
@param params
@param cb | [
"List",
"Notifications",
"on",
"an",
"MBaaS"
] | 2d5a9cbb32e1b2464d71ffa18513358fea388859 | https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/admin/alerts/notifications.js#L10-L16 |
45,526 | mchalapuk/hyper-text-slider | lib/core/boot.js | boot | function boot(containerElement) {
check(containerElement, 'containerElement').is.anInstanceOf(Element)();
var containerOptions = getEnabledOptions(containerElement);
var sliderElems = concatUnique(
[].slice.call(containerElement.querySelectorAll('.'+ Layout.SLIDER)),
[].slice.call(containerElement.qu... | javascript | function boot(containerElement) {
check(containerElement, 'containerElement').is.anInstanceOf(Element)();
var containerOptions = getEnabledOptions(containerElement);
var sliderElems = concatUnique(
[].slice.call(containerElement.querySelectorAll('.'+ Layout.SLIDER)),
[].slice.call(containerElement.qu... | [
"function",
"boot",
"(",
"containerElement",
")",
"{",
"check",
"(",
"containerElement",
",",
"'containerElement'",
")",
".",
"is",
".",
"anInstanceOf",
"(",
"Element",
")",
"(",
")",
";",
"var",
"containerOptions",
"=",
"getEnabledOptions",
"(",
"containerEleme... | Default HyperText Slider boot procedure.
For each element with ${link Layout.SLIDER} class name found in passed container
(typically document's `<body>`):
1. Adds ${link Option options class names} found on container element,
1. Creates ${link Slider} object,
2. Invokes its ${link Slider.prototype.start} method.
If ... | [
"Default",
"HyperText",
"Slider",
"boot",
"procedure",
"."
] | 2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4 | https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/boot.js#L53-L75 |
45,527 | mchalapuk/hyper-text-slider | lib/core/boot.js | getEnabledOptions | function getEnabledOptions(element) {
var retVal = [];
Object.values(Option).forEach(function(option) {
if (element.classList.contains(option)) {
retVal.push(option);
}
});
return retVal;
} | javascript | function getEnabledOptions(element) {
var retVal = [];
Object.values(Option).forEach(function(option) {
if (element.classList.contains(option)) {
retVal.push(option);
}
});
return retVal;
} | [
"function",
"getEnabledOptions",
"(",
"element",
")",
"{",
"var",
"retVal",
"=",
"[",
"]",
";",
"Object",
".",
"values",
"(",
"Option",
")",
".",
"forEach",
"(",
"function",
"(",
"option",
")",
"{",
"if",
"(",
"element",
".",
"classList",
".",
"contain... | finds option class names on passed element | [
"finds",
"option",
"class",
"names",
"on",
"passed",
"element"
] | 2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4 | https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/boot.js#L78-L86 |
45,528 | openmason/brook | index.js | publisher | function publisher(port) {
var socket = zeromq.socket('pub');
socket.identity = 'pub' + process.pid;
socket.connect(port);
console.log('publisher connected to ' + port);
// lets count messages / sec
var totalMessages=0;
setInterval(function() {
console.log('total messages sent = '+totalMessages);
... | javascript | function publisher(port) {
var socket = zeromq.socket('pub');
socket.identity = 'pub' + process.pid;
socket.connect(port);
console.log('publisher connected to ' + port);
// lets count messages / sec
var totalMessages=0;
setInterval(function() {
console.log('total messages sent = '+totalMessages);
... | [
"function",
"publisher",
"(",
"port",
")",
"{",
"var",
"socket",
"=",
"zeromq",
".",
"socket",
"(",
"'pub'",
")",
";",
"socket",
".",
"identity",
"=",
"'pub'",
"+",
"process",
".",
"pid",
";",
"socket",
".",
"connect",
"(",
"port",
")",
";",
"console... | lets do the publisher here | [
"lets",
"do",
"the",
"publisher",
"here"
] | 6d4e12d6c27e71948baab91d3e778fbae5a47245 | https://github.com/openmason/brook/blob/6d4e12d6c27e71948baab91d3e778fbae5a47245/index.js#L25-L45 |
45,529 | openmason/brook | index.js | subscriber | function subscriber(port) {
var socket = zeromq.socket('sub');
socket.identity = 'sub' + process.pid;
// have to subscribe, otherwise nothing would show up
// subscribe to everything
socket.subscribe('');
var totalMessages=0;
// receive messages
socket.on('message', function(data) {
//console.log... | javascript | function subscriber(port) {
var socket = zeromq.socket('sub');
socket.identity = 'sub' + process.pid;
// have to subscribe, otherwise nothing would show up
// subscribe to everything
socket.subscribe('');
var totalMessages=0;
// receive messages
socket.on('message', function(data) {
//console.log... | [
"function",
"subscriber",
"(",
"port",
")",
"{",
"var",
"socket",
"=",
"zeromq",
".",
"socket",
"(",
"'sub'",
")",
";",
"socket",
".",
"identity",
"=",
"'sub'",
"+",
"process",
".",
"pid",
";",
"// have to subscribe, otherwise nothing would show up",
"// subscri... | lets do the subscriber here | [
"lets",
"do",
"the",
"subscriber",
"here"
] | 6d4e12d6c27e71948baab91d3e778fbae5a47245 | https://github.com/openmason/brook/blob/6d4e12d6c27e71948baab91d3e778fbae5a47245/index.js#L48-L73 |
45,530 | openmason/brook | index.js | forwarder | function forwarder(frontPort, backPort) {
var frontSocket = zeromq.socket('sub'),
backSocket = zeromq.socket('pub');
frontSocket.identity = 'sub' + process.pid;
backSocket.identity = 'pub' + process.pid;
frontSocket.subscribe('');
frontSocket.bind(frontPort, function (err) {
console.log('bound', f... | javascript | function forwarder(frontPort, backPort) {
var frontSocket = zeromq.socket('sub'),
backSocket = zeromq.socket('pub');
frontSocket.identity = 'sub' + process.pid;
backSocket.identity = 'pub' + process.pid;
frontSocket.subscribe('');
frontSocket.bind(frontPort, function (err) {
console.log('bound', f... | [
"function",
"forwarder",
"(",
"frontPort",
",",
"backPort",
")",
"{",
"var",
"frontSocket",
"=",
"zeromq",
".",
"socket",
"(",
"'sub'",
")",
",",
"backSocket",
"=",
"zeromq",
".",
"socket",
"(",
"'pub'",
")",
";",
"frontSocket",
".",
"identity",
"=",
"'s... | create a forwarder device | [
"create",
"a",
"forwarder",
"device"
] | 6d4e12d6c27e71948baab91d3e778fbae5a47245 | https://github.com/openmason/brook/blob/6d4e12d6c27e71948baab91d3e778fbae5a47245/index.js#L76-L106 |
45,531 | odogono/elsinore-js | src/util/loader_ex.js | createComponent | function createComponent(loader, obj) {
const entitySet = loader.entitySet;
// determine whether any attributes are refering to marked pois
obj = resolveMarkReferences(loader, obj);
// the alternative form is to use @uri
if (obj[CMD_COMPONENT_URI]) {
obj[CMD_COMPONENT] = obj[CMD_COMPONENT_... | javascript | function createComponent(loader, obj) {
const entitySet = loader.entitySet;
// determine whether any attributes are refering to marked pois
obj = resolveMarkReferences(loader, obj);
// the alternative form is to use @uri
if (obj[CMD_COMPONENT_URI]) {
obj[CMD_COMPONENT] = obj[CMD_COMPONENT_... | [
"function",
"createComponent",
"(",
"loader",
",",
"obj",
")",
"{",
"const",
"entitySet",
"=",
"loader",
".",
"entitySet",
";",
"// determine whether any attributes are refering to marked pois",
"obj",
"=",
"resolveMarkReferences",
"(",
"loader",
",",
"obj",
")",
";",... | return value; } | [
"return",
"value",
";",
"}"
] | 1ecce67ad0022646419a740def029b1ba92dd558 | https://github.com/odogono/elsinore-js/blob/1ecce67ad0022646419a740def029b1ba92dd558/src/util/loader_ex.js#L333-L365 |
45,532 | odogono/elsinore-js | src/util/loader_ex.js | retrieveEntityByAttribute | async function retrieveEntityByAttribute(
entitySet,
componentID,
attribute,
value
) {
// Log.debug('[retrieveEntityByAttribute]', componentID, 'where', attribute, 'equals', value);
const query = Q => [
Q.all(componentID).where(Q.attr(attribute).equals(value)),
Q.limit(1)
];
... | javascript | async function retrieveEntityByAttribute(
entitySet,
componentID,
attribute,
value
) {
// Log.debug('[retrieveEntityByAttribute]', componentID, 'where', attribute, 'equals', value);
const query = Q => [
Q.all(componentID).where(Q.attr(attribute).equals(value)),
Q.limit(1)
];
... | [
"async",
"function",
"retrieveEntityByAttribute",
"(",
"entitySet",
",",
"componentID",
",",
"attribute",
",",
"value",
")",
"{",
"// Log.debug('[retrieveEntityByAttribute]', componentID, 'where', attribute, 'equals', value);",
"const",
"query",
"=",
"Q",
"=>",
"[",
"Q",
".... | Retrieves the first entity which has the specified component attribute value | [
"Retrieves",
"the",
"first",
"entity",
"which",
"has",
"the",
"specified",
"component",
"attribute",
"value"
] | 1ecce67ad0022646419a740def029b1ba92dd558 | https://github.com/odogono/elsinore-js/blob/1ecce67ad0022646419a740def029b1ba92dd558/src/util/loader_ex.js#L533-L564 |
45,533 | webida/webida-restful-api | src/api/SessionApi.js | function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* Callback function to receive the result of the closeSessions operation.
* @callback module:api/SessionApi~closeSessionsCallback
* @param {String} error Error message, if any.
* @param {module:model/RestOK} data T... | javascript | function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* Callback function to receive the result of the closeSessions operation.
* @callback module:api/SessionApi~closeSessionsCallback
* @param {String} error Error message, if any.
* @param {module:model/RestOK} data T... | [
"function",
"(",
"apiClient",
")",
"{",
"this",
".",
"apiClient",
"=",
"apiClient",
"||",
"ApiClient",
".",
"instance",
";",
"/**\n * Callback function to receive the result of the closeSessions operation.\n * @callback module:api/SessionApi~closeSessionsCallback\n * @param... | Session service.
@module api/SessionApi
@version 0.7.1
Constructs a new SessionApi.
@alias module:api/SessionApi
@class
@param {module:ApiClient} apiClient Optional API client implementation to use,
default to {@link module:ApiClient#instance} if unspecified. | [
"Session",
"service",
"."
] | a14385ebe0de025b66fd4ee9655e962313528e28 | https://github.com/webida/webida-restful-api/blob/a14385ebe0de025b66fd4ee9655e962313528e28/src/api/SessionApi.js#L55-L169 | |
45,534 | yo-components/yo-utils | lib/templating.js | relativePathTo | function relativePathTo(from, to, strip) {
var relPath = path.relative(from.replace(path.basename(from), ''), to);
if (relPath.match(/^\.\.?(\/|\\)/) === null) { relPath = './' + relPath; }
if (strip) { return relPath.replace(/((\/|\\)index\.js|\.js)$/, ''); }
return relPath;
} | javascript | function relativePathTo(from, to, strip) {
var relPath = path.relative(from.replace(path.basename(from), ''), to);
if (relPath.match(/^\.\.?(\/|\\)/) === null) { relPath = './' + relPath; }
if (strip) { return relPath.replace(/((\/|\\)index\.js|\.js)$/, ''); }
return relPath;
} | [
"function",
"relativePathTo",
"(",
"from",
",",
"to",
",",
"strip",
")",
"{",
"var",
"relPath",
"=",
"path",
".",
"relative",
"(",
"from",
".",
"replace",
"(",
"path",
".",
"basename",
"(",
"from",
")",
",",
"''",
")",
",",
"to",
")",
";",
"if",
... | Templating related utilities
@module yo-utils/lib/templating
Returns a relative path used to require the 'to' file in the 'from' file
@alias module:yo-utils/lib/templating.relativePathTo
@param {String} from - file path to the from file
@param {String} to - file path to the to file
@param {Boolean} strip - w... | [
"Templating",
"related",
"utilities"
] | 975801cee23886debf0b43e43cd76e43705f321d | https://github.com/yo-components/yo-utils/blob/975801cee23886debf0b43e43cd76e43705f321d/lib/templating.js#L26-L31 |
45,535 | yo-components/yo-utils | lib/templating.js | filterFile | function filterFile(template) {
// Find matches for parans
var filterMatches = template.match(/\(([^)]+)\)/g);
var filters = [];
if (filterMatches) {
filterMatches.forEach(function(filter) {
filters.push(filter.replace('(', '').replace(')', ''));
template = template.replace(filter, '');
});
... | javascript | function filterFile(template) {
// Find matches for parans
var filterMatches = template.match(/\(([^)]+)\)/g);
var filters = [];
if (filterMatches) {
filterMatches.forEach(function(filter) {
filters.push(filter.replace('(', '').replace(')', ''));
template = template.replace(filter, '');
});
... | [
"function",
"filterFile",
"(",
"template",
")",
"{",
"// Find matches for parans",
"var",
"filterMatches",
"=",
"template",
".",
"match",
"(",
"/",
"\\(([^)]+)\\)",
"/",
"g",
")",
";",
"var",
"filters",
"=",
"[",
"]",
";",
"if",
"(",
"filterMatches",
")",
... | Parse a filtered filename and return the processed name and filters
@param {String} template - the file path to the template
@return {Object} - contains the processed name and filters array | [
"Parse",
"a",
"filtered",
"filename",
"and",
"return",
"the",
"processed",
"name",
"and",
"filters"
] | 975801cee23886debf0b43e43cd76e43705f321d | https://github.com/yo-components/yo-utils/blob/975801cee23886debf0b43e43cd76e43705f321d/lib/templating.js#L161-L173 |
45,536 | yo-components/yo-utils | lib/templating.js | templateIsUsable | function templateIsUsable(self, filteredFile) {
var filters = self.config.get('filters');
var enabledFilters = [];
for (var key in filters) {
if (filters[key]) { enabledFilters.push(key); }
}
var matchedFilters = self._.intersection(filteredFile.filters, enabledFilters);
// check that all filters on fil... | javascript | function templateIsUsable(self, filteredFile) {
var filters = self.config.get('filters');
var enabledFilters = [];
for (var key in filters) {
if (filters[key]) { enabledFilters.push(key); }
}
var matchedFilters = self._.intersection(filteredFile.filters, enabledFilters);
// check that all filters on fil... | [
"function",
"templateIsUsable",
"(",
"self",
",",
"filteredFile",
")",
"{",
"var",
"filters",
"=",
"self",
".",
"config",
".",
"get",
"(",
"'filters'",
")",
";",
"var",
"enabledFilters",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"filters",
")... | Check whether or not a template is usable based on filters
@param {Object} self - the generator
@param {Object} filteredFile - the processed template object
@return {Boolean} - whether the template is usable based on filters | [
"Check",
"whether",
"or",
"not",
"a",
"template",
"is",
"usable",
"based",
"on",
"filters"
] | 975801cee23886debf0b43e43cd76e43705f321d | https://github.com/yo-components/yo-utils/blob/975801cee23886debf0b43e43cd76e43705f321d/lib/templating.js#L181-L193 |
45,537 | synder/xpress | demo/content-disposition/index.js | format | function format(obj) {
var parameters = obj.parameters
var type = obj.type
if (!type || typeof type !== 'string' || !tokenRegExp.test(type)) {
throw new TypeError('invalid type')
}
// start with normalized type
var string = String(type).toLowerCase()
// append parameters
if (parameters && typeof ... | javascript | function format(obj) {
var parameters = obj.parameters
var type = obj.type
if (!type || typeof type !== 'string' || !tokenRegExp.test(type)) {
throw new TypeError('invalid type')
}
// start with normalized type
var string = String(type).toLowerCase()
// append parameters
if (parameters && typeof ... | [
"function",
"format",
"(",
"obj",
")",
"{",
"var",
"parameters",
"=",
"obj",
".",
"parameters",
"var",
"type",
"=",
"obj",
".",
"type",
"if",
"(",
"!",
"type",
"||",
"typeof",
"type",
"!==",
"'string'",
"||",
"!",
"tokenRegExp",
".",
"test",
"(",
"ty... | Format object to Content-Disposition header.
@param {object} obj
@param {string} obj.type
@param {object} [obj.parameters]
@return {string}
@api private | [
"Format",
"object",
"to",
"Content",
"-",
"Disposition",
"header",
"."
] | 4b1e89208b6f34cd78ce90b8a858592115b6ccb5 | https://github.com/synder/xpress/blob/4b1e89208b6f34cd78ce90b8a858592115b6ccb5/demo/content-disposition/index.js#L216-L244 |
45,538 | synder/xpress | demo/content-disposition/index.js | pencode | function pencode(char) {
var hex = String(char)
.charCodeAt(0)
.toString(16)
.toUpperCase()
return hex.length === 1
? '%0' + hex
: '%' + hex
} | javascript | function pencode(char) {
var hex = String(char)
.charCodeAt(0)
.toString(16)
.toUpperCase()
return hex.length === 1
? '%0' + hex
: '%' + hex
} | [
"function",
"pencode",
"(",
"char",
")",
"{",
"var",
"hex",
"=",
"String",
"(",
"char",
")",
".",
"charCodeAt",
"(",
"0",
")",
".",
"toString",
"(",
"16",
")",
".",
"toUpperCase",
"(",
")",
"return",
"hex",
".",
"length",
"===",
"1",
"?",
"'%0'",
... | Percent encode a single character.
@param {string} char
@return {string}
@api private | [
"Percent",
"encode",
"a",
"single",
"character",
"."
] | 4b1e89208b6f34cd78ce90b8a858592115b6ccb5 | https://github.com/synder/xpress/blob/4b1e89208b6f34cd78ce90b8a858592115b6ccb5/demo/content-disposition/index.js#L396-L404 |
45,539 | nodejitsu/contour | index.js | Contour | function Contour(options) {
var contour = this
, assets;
this.fuse();
//
// Add the pagelets of the required framework.
//
options = options || {};
//
// Load and optimize the pagelets, extend contour but acknowledge external
// listeners when all pagelets have been fully initialized.
//
as... | javascript | function Contour(options) {
var contour = this
, assets;
this.fuse();
//
// Add the pagelets of the required framework.
//
options = options || {};
//
// Load and optimize the pagelets, extend contour but acknowledge external
// listeners when all pagelets have been fully initialized.
//
as... | [
"function",
"Contour",
"(",
"options",
")",
"{",
"var",
"contour",
"=",
"this",
",",
"assets",
";",
"this",
".",
"fuse",
"(",
")",
";",
"//",
"// Add the pagelets of the required framework.",
"//",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"//",
"// ... | Contour will register several default HTML5 templates of Nodejitsu. These
templates can used from inside views of other projects.
Options that can be supplied
- brand {String} framework or brand to use, e.g nodejitsu or opsmezzo
- mode {String} bigpipe or standalone, defaults to bigpipe
@Constructor
@param {Object} o... | [
"Contour",
"will",
"register",
"several",
"default",
"HTML5",
"templates",
"of",
"Nodejitsu",
".",
"These",
"templates",
"can",
"used",
"from",
"inside",
"views",
"of",
"other",
"projects",
"."
] | 0828e9bd25ef1eeb97ea231c447118d9867021b6 | https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/index.js#L25-L43 |
45,540 | NiklasGollenstede/pbq | require.js | defaultGetCallingScript | function defaultGetCallingScript(offset = 0) {
const stack = (new Error).stack.split(/$/m);
const line = stack[(/^Error/).test(stack[0]) + 1 + offset];
const parts = line.split(/@(?![^/]*?\.xpi)|\(|\s+/g);
return parts[parts.length - 1].replace(/:\d+(?::\d+)?\)?$/, '');
} | javascript | function defaultGetCallingScript(offset = 0) {
const stack = (new Error).stack.split(/$/m);
const line = stack[(/^Error/).test(stack[0]) + 1 + offset];
const parts = line.split(/@(?![^/]*?\.xpi)|\(|\s+/g);
return parts[parts.length - 1].replace(/:\d+(?::\d+)?\)?$/, '');
} | [
"function",
"defaultGetCallingScript",
"(",
"offset",
"=",
"0",
")",
"{",
"const",
"stack",
"=",
"(",
"new",
"Error",
")",
".",
"stack",
".",
"split",
"(",
"/",
"$",
"/",
"m",
")",
";",
"const",
"line",
"=",
"stack",
"[",
"(",
"/",
"^Error",
"/",
... | the other values in `loadConfig` will be interpreted later
string parsers | [
"the",
"other",
"values",
"in",
"loadConfig",
"will",
"be",
"interpreted",
"later",
"string",
"parsers"
] | bf63f17d63dc6030567a94a61490bec6254d3064 | https://github.com/NiklasGollenstede/pbq/blob/bf63f17d63dc6030567a94a61490bec6254d3064/require.js#L62-L67 |
45,541 | NiklasGollenstede/pbq | require.js | next | function next(exp) {
exp.lastIndex = index;
const match = exp.exec(code)[0];
index = exp.lastIndex;
return match;
} | javascript | function next(exp) {
exp.lastIndex = index;
const match = exp.exec(code)[0];
index = exp.lastIndex;
return match;
} | [
"function",
"next",
"(",
"exp",
")",
"{",
"exp",
".",
"lastIndex",
"=",
"index",
";",
"const",
"match",
"=",
"exp",
".",
"exec",
"(",
"code",
")",
"[",
"0",
"]",
";",
"index",
"=",
"exp",
".",
"lastIndex",
";",
"return",
"match",
";",
"}"
] | the next position of interest | [
"the",
"next",
"position",
"of",
"interest"
] | bf63f17d63dc6030567a94a61490bec6254d3064 | https://github.com/NiklasGollenstede/pbq/blob/bf63f17d63dc6030567a94a61490bec6254d3064/require.js#L77-L82 |
45,542 | nodejitsu/contour | assets.js | Assets | function Assets(brand, mode) {
var readable = Assets.predefine(this, Assets.predefine.READABLE)
, enumerable = Assets.predefine(this, { configurable: false })
, self = this
, i = 0
, files;
/**
* Callback to emit optimized event after all Pagelets have been optimized.
*
* @param {Error} er... | javascript | function Assets(brand, mode) {
var readable = Assets.predefine(this, Assets.predefine.READABLE)
, enumerable = Assets.predefine(this, { configurable: false })
, self = this
, i = 0
, files;
/**
* Callback to emit optimized event after all Pagelets have been optimized.
*
* @param {Error} er... | [
"function",
"Assets",
"(",
"brand",
",",
"mode",
")",
"{",
"var",
"readable",
"=",
"Assets",
".",
"predefine",
"(",
"this",
",",
"Assets",
".",
"predefine",
".",
"READABLE",
")",
",",
"enumerable",
"=",
"Assets",
".",
"predefine",
"(",
"this",
",",
"{"... | Create new collection of assets from a specific brand.
@param {String} brand nodejitsu by default.
@param {String} mode standalone || bigpipe, defaults to bigpipe.
@api public | [
"Create",
"new",
"collection",
"of",
"assets",
"from",
"a",
"specific",
"brand",
"."
] | 0828e9bd25ef1eeb97ea231c447118d9867021b6 | https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/assets.js#L23-L61 |
45,543 | nodejitsu/contour | assets.js | next | function next(error) {
if (error) return self.emit('error', error);
if (++i === files.length) self.emit('optimized');
} | javascript | function next(error) {
if (error) return self.emit('error', error);
if (++i === files.length) self.emit('optimized');
} | [
"function",
"next",
"(",
"error",
")",
"{",
"if",
"(",
"error",
")",
"return",
"self",
".",
"emit",
"(",
"'error'",
",",
"error",
")",
";",
"if",
"(",
"++",
"i",
"===",
"files",
".",
"length",
")",
"self",
".",
"emit",
"(",
"'optimized'",
")",
";... | Callback to emit optimized event after all Pagelets have been optimized.
@param {Error} error
@api private | [
"Callback",
"to",
"emit",
"optimized",
"event",
"after",
"all",
"Pagelets",
"have",
"been",
"optimized",
"."
] | 0828e9bd25ef1eeb97ea231c447118d9867021b6 | https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/assets.js#L36-L39 |
45,544 | jillix/flow-api | lib/_remove.js | getIn | function getIn (client, from, nodes, callback, remove) {
remove = remove || [];
const outNodes = [];
const nodeIndex = {};
const fromIndex = {};
if (from instanceof Array) {
from.forEach((node) => {fromIndex[node] = true});
} else {
from = null;
}
nodes.forEach((node)... | javascript | function getIn (client, from, nodes, callback, remove) {
remove = remove || [];
const outNodes = [];
const nodeIndex = {};
const fromIndex = {};
if (from instanceof Array) {
from.forEach((node) => {fromIndex[node] = true});
} else {
from = null;
}
nodes.forEach((node)... | [
"function",
"getIn",
"(",
"client",
",",
"from",
",",
"nodes",
",",
"callback",
",",
"remove",
")",
"{",
"remove",
"=",
"remove",
"||",
"[",
"]",
";",
"const",
"outNodes",
"=",
"[",
"]",
";",
"const",
"nodeIndex",
"=",
"{",
"}",
";",
"const",
"from... | -> from network | [
"-",
">",
"from",
"network"
] | 8c80bacbd6ab27a72000dbeaf454800e8e817efa | https://github.com/jillix/flow-api/blob/8c80bacbd6ab27a72000dbeaf454800e8e817efa/lib/_remove.js#L157-L216 |
45,545 | FinalDevStudio/fi-khipu | lib/index.js | createPayment | function createPayment(data, callback) {
var client = new this.clients.Payments();
client.create(data, callback);
} | javascript | function createPayment(data, callback) {
var client = new this.clients.Payments();
client.create(data, callback);
} | [
"function",
"createPayment",
"(",
"data",
",",
"callback",
")",
"{",
"var",
"client",
"=",
"new",
"this",
".",
"clients",
".",
"Payments",
"(",
")",
";",
"client",
".",
"create",
"(",
"data",
",",
"callback",
")",
";",
"}"
] | Creates a new payment.
@param {Object} data - The payment fields.
@param {Function} callback - The callback method. | [
"Creates",
"a",
"new",
"payment",
"."
] | 76f5ec38e88dc2053502c320e309b74039b4d517 | https://github.com/FinalDevStudio/fi-khipu/blob/76f5ec38e88dc2053502c320e309b74039b4d517/lib/index.js#L49-L52 |
45,546 | FinalDevStudio/fi-khipu | lib/index.js | getPaymentById | function getPaymentById(id, callback) {
var client = new this.clients.Payments();
client.getById(id, callback);
} | javascript | function getPaymentById(id, callback) {
var client = new this.clients.Payments();
client.getById(id, callback);
} | [
"function",
"getPaymentById",
"(",
"id",
",",
"callback",
")",
"{",
"var",
"client",
"=",
"new",
"this",
".",
"clients",
".",
"Payments",
"(",
")",
";",
"client",
".",
"getById",
"(",
"id",
",",
"callback",
")",
";",
"}"
] | Obtains a payment by its ID.
@param {String} id - The payment ID.
@param {Function} callback - The callback method. | [
"Obtains",
"a",
"payment",
"by",
"its",
"ID",
"."
] | 76f5ec38e88dc2053502c320e309b74039b4d517 | https://github.com/FinalDevStudio/fi-khipu/blob/76f5ec38e88dc2053502c320e309b74039b4d517/lib/index.js#L60-L63 |
45,547 | FinalDevStudio/fi-khipu | lib/index.js | getPaymentByNotificationToken | function getPaymentByNotificationToken(token, callback) {
var client = new this.clients.Payments();
client.getByNotificationToken(token, callback);
} | javascript | function getPaymentByNotificationToken(token, callback) {
var client = new this.clients.Payments();
client.getByNotificationToken(token, callback);
} | [
"function",
"getPaymentByNotificationToken",
"(",
"token",
",",
"callback",
")",
"{",
"var",
"client",
"=",
"new",
"this",
".",
"clients",
".",
"Payments",
"(",
")",
";",
"client",
".",
"getByNotificationToken",
"(",
"token",
",",
"callback",
")",
";",
"}"
] | Obtains a payment by its notification token.
@param {String} id - The payment ID.
@param {Function} callback - The callback method. | [
"Obtains",
"a",
"payment",
"by",
"its",
"notification",
"token",
"."
] | 76f5ec38e88dc2053502c320e309b74039b4d517 | https://github.com/FinalDevStudio/fi-khipu/blob/76f5ec38e88dc2053502c320e309b74039b4d517/lib/index.js#L71-L74 |
45,548 | FinalDevStudio/fi-khipu | lib/index.js | refundPayment | function refundPayment(id, callback) {
var client = new this.clients.Payments();
client.refund(id, callback);
} | javascript | function refundPayment(id, callback) {
var client = new this.clients.Payments();
client.refund(id, callback);
} | [
"function",
"refundPayment",
"(",
"id",
",",
"callback",
")",
"{",
"var",
"client",
"=",
"new",
"this",
".",
"clients",
".",
"Payments",
"(",
")",
";",
"client",
".",
"refund",
"(",
"id",
",",
"callback",
")",
";",
"}"
] | Refunds a payment by its ID.
@param {String} id - The payment's ID.
@param {Function} callback - The callback method. | [
"Refunds",
"a",
"payment",
"by",
"its",
"ID",
"."
] | 76f5ec38e88dc2053502c320e309b74039b4d517 | https://github.com/FinalDevStudio/fi-khipu/blob/76f5ec38e88dc2053502c320e309b74039b4d517/lib/index.js#L82-L85 |
45,549 | linyngfly/omelo-scheduler | lib/cronTrigger.js | function(trigger, job){
this.trigger = this.decodeTrigger(trigger);
this.nextTime = this.nextExcuteTime(Date.now());
this.job = job;
} | javascript | function(trigger, job){
this.trigger = this.decodeTrigger(trigger);
this.nextTime = this.nextExcuteTime(Date.now());
this.job = job;
} | [
"function",
"(",
"trigger",
",",
"job",
")",
"{",
"this",
".",
"trigger",
"=",
"this",
".",
"decodeTrigger",
"(",
"trigger",
")",
";",
"this",
".",
"nextTime",
"=",
"this",
".",
"nextExcuteTime",
"(",
"Date",
".",
"now",
"(",
")",
")",
";",
"this",
... | The constructor of the CronTrigger
@param trigger The trigger str used to build the cronTrigger instance | [
"The",
"constructor",
"of",
"the",
"CronTrigger"
] | aa7775eb2b8b31160669c8fedccd84e2108797eb | https://github.com/linyngfly/omelo-scheduler/blob/aa7775eb2b8b31160669c8fedccd84e2108797eb/lib/cronTrigger.js#L19-L25 | |
45,550 | linyngfly/omelo-scheduler | lib/cronTrigger.js | timeMatch | function timeMatch(value, cronTime){
if(typeof(cronTime) == 'number'){
if(cronTime == -1)
return true;
if(value == cronTime)
return true;
return false;
}else if(typeof(cronTime) == 'object' && cronTime instanceof Array){
if(value < cronTime[0] || value > cronTime[cronTime.length -1])
... | javascript | function timeMatch(value, cronTime){
if(typeof(cronTime) == 'number'){
if(cronTime == -1)
return true;
if(value == cronTime)
return true;
return false;
}else if(typeof(cronTime) == 'object' && cronTime instanceof Array){
if(value < cronTime[0] || value > cronTime[cronTime.length -1])
... | [
"function",
"timeMatch",
"(",
"value",
",",
"cronTime",
")",
"{",
"if",
"(",
"typeof",
"(",
"cronTime",
")",
"==",
"'number'",
")",
"{",
"if",
"(",
"cronTime",
"==",
"-",
"1",
")",
"return",
"true",
";",
"if",
"(",
"value",
"==",
"cronTime",
")",
"... | Match the given value to the cronTime
@param value The given value
@param cronTime The cronTime
@return The match result | [
"Match",
"the",
"given",
"value",
"to",
"the",
"cronTime"
] | aa7775eb2b8b31160669c8fedccd84e2108797eb | https://github.com/linyngfly/omelo-scheduler/blob/aa7775eb2b8b31160669c8fedccd84e2108797eb/lib/cronTrigger.js#L186-L205 |
45,551 | linyngfly/omelo-scheduler | lib/cronTrigger.js | decodeRangeTime | function decodeRangeTime(map, timeStr){
let times = timeStr.split('-');
times[0] = Number(times[0]);
times[1] = Number(times[1]);
if(times[0] > times[1]){
console.log("Error time range");
return null;
}
for(let i = times[0]; i <= times[1]; i++){
map[i] = i;
}
} | javascript | function decodeRangeTime(map, timeStr){
let times = timeStr.split('-');
times[0] = Number(times[0]);
times[1] = Number(times[1]);
if(times[0] > times[1]){
console.log("Error time range");
return null;
}
for(let i = times[0]; i <= times[1]; i++){
map[i] = i;
}
} | [
"function",
"decodeRangeTime",
"(",
"map",
",",
"timeStr",
")",
"{",
"let",
"times",
"=",
"timeStr",
".",
"split",
"(",
"'-'",
")",
";",
"times",
"[",
"0",
"]",
"=",
"Number",
"(",
"times",
"[",
"0",
"]",
")",
";",
"times",
"[",
"1",
"]",
"=",
... | Decode time range
@param map The decode map
@param timeStr The range string, like 2-5 | [
"Decode",
"time",
"range"
] | aa7775eb2b8b31160669c8fedccd84e2108797eb | https://github.com/linyngfly/omelo-scheduler/blob/aa7775eb2b8b31160669c8fedccd84e2108797eb/lib/cronTrigger.js#L285-L298 |
45,552 | linyngfly/omelo-scheduler | lib/cronTrigger.js | decodePeriodTime | function decodePeriodTime(map, timeStr, type){
let times = timeStr.split('/');
let min = Limit[type][0];
let max = Limit[type][1];
let remind = Number(times[0]);
let period = Number(times[1]);
if(period==0)
return;
for(let i = min; i <= max; i++){
if(i%period == remind)
map[i] = i;
}
} | javascript | function decodePeriodTime(map, timeStr, type){
let times = timeStr.split('/');
let min = Limit[type][0];
let max = Limit[type][1];
let remind = Number(times[0]);
let period = Number(times[1]);
if(period==0)
return;
for(let i = min; i <= max; i++){
if(i%period == remind)
map[i] = i;
}
} | [
"function",
"decodePeriodTime",
"(",
"map",
",",
"timeStr",
",",
"type",
")",
"{",
"let",
"times",
"=",
"timeStr",
".",
"split",
"(",
"'/'",
")",
";",
"let",
"min",
"=",
"Limit",
"[",
"type",
"]",
"[",
"0",
"]",
";",
"let",
"max",
"=",
"Limit",
"... | Compute the period timer | [
"Compute",
"the",
"period",
"timer"
] | aa7775eb2b8b31160669c8fedccd84e2108797eb | https://github.com/linyngfly/omelo-scheduler/blob/aa7775eb2b8b31160669c8fedccd84e2108797eb/lib/cronTrigger.js#L303-L318 |
45,553 | linyngfly/omelo-scheduler | lib/cronTrigger.js | checkNum | function checkNum(nums, min, max){
if(nums == null)
return false;
if(nums == -1)
return true;
for(let i = 0; i < nums.length; i++){
if(nums[i]<min || nums[i]>max)
return false;
}
return true;
} | javascript | function checkNum(nums, min, max){
if(nums == null)
return false;
if(nums == -1)
return true;
for(let i = 0; i < nums.length; i++){
if(nums[i]<min || nums[i]>max)
return false;
}
return true;
} | [
"function",
"checkNum",
"(",
"nums",
",",
"min",
",",
"max",
")",
"{",
"if",
"(",
"nums",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"nums",
"==",
"-",
"1",
")",
"return",
"true",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<... | Check if the numbers are valid
@param nums The numbers array need to check
@param min Minimus value
@param max Maximam value
@return If all the numbers are in the data range | [
"Check",
"if",
"the",
"numbers",
"are",
"valid"
] | aa7775eb2b8b31160669c8fedccd84e2108797eb | https://github.com/linyngfly/omelo-scheduler/blob/aa7775eb2b8b31160669c8fedccd84e2108797eb/lib/cronTrigger.js#L327-L340 |
45,554 | vid/SenseBase | web/lib/search.js | setupCronInput | function setupCronInput(val) {
$('input.cron').jqCron({
enabled_minute: true,
multiple_dom: true,
multiple_month: true,
multiple_mins: true,
multiple_dow: true,
multiple_time_hours: true,
multiple_time_minutes: true,
default_period: 'week',
default_value: val ||... | javascript | function setupCronInput(val) {
$('input.cron').jqCron({
enabled_minute: true,
multiple_dom: true,
multiple_month: true,
multiple_mins: true,
multiple_dow: true,
multiple_time_hours: true,
multiple_time_minutes: true,
default_period: 'week',
default_value: val ||... | [
"function",
"setupCronInput",
"(",
"val",
")",
"{",
"$",
"(",
"'input.cron'",
")",
".",
"jqCron",
"(",
"{",
"enabled_minute",
":",
"true",
",",
"multiple_dom",
":",
"true",
",",
"multiple_month",
":",
"true",
",",
"multiple_mins",
":",
"true",
",",
"multip... | set up the cron scheduler input | [
"set",
"up",
"the",
"cron",
"scheduler",
"input"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/web/lib/search.js#L120-L134 |
45,555 | vid/SenseBase | web/lib/search.js | getSearchInput | function getSearchInput() {
var cronValue = $('#scheduleSearch').prop('checked') ? $('input.cron').val() : null, searchName = $('#searchName').val(), targetResults = $('#targetResults').val(), input = $('#searchInput').val(), searchContinue = $('#searchContinue').val(), searchCategories = $('#searchCategories').val... | javascript | function getSearchInput() {
var cronValue = $('#scheduleSearch').prop('checked') ? $('input.cron').val() : null, searchName = $('#searchName').val(), targetResults = $('#targetResults').val(), input = $('#searchInput').val(), searchContinue = $('#searchContinue').val(), searchCategories = $('#searchCategories').val... | [
"function",
"getSearchInput",
"(",
")",
"{",
"var",
"cronValue",
"=",
"$",
"(",
"'#scheduleSearch'",
")",
".",
"prop",
"(",
"'checked'",
")",
"?",
"$",
"(",
"'input.cron'",
")",
".",
"val",
"(",
")",
":",
"null",
",",
"searchName",
"=",
"$",
"(",
"'#... | convert the form values to data | [
"convert",
"the",
"form",
"values",
"to",
"data"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/web/lib/search.js#L137-L140 |
45,556 | vid/SenseBase | web/lib/search.js | submitSearch | function submitSearch() {
var searchInput = getSearchInput();
// FIXME: SUI validation for select2 field
if (!searchInput.valid) {
alert('Please select team members');
return;
}
console.log('publishing', searchInput);
$('.search.message').html('Search results:');
$('.search.mes... | javascript | function submitSearch() {
var searchInput = getSearchInput();
// FIXME: SUI validation for select2 field
if (!searchInput.valid) {
alert('Please select team members');
return;
}
console.log('publishing', searchInput);
$('.search.message').html('Search results:');
$('.search.mes... | [
"function",
"submitSearch",
"(",
")",
"{",
"var",
"searchInput",
"=",
"getSearchInput",
"(",
")",
";",
"// FIXME: SUI validation for select2 field",
"if",
"(",
"!",
"searchInput",
".",
"valid",
")",
"{",
"alert",
"(",
"'Please select team members'",
")",
";",
"ret... | submit a new search | [
"submit",
"a",
"new",
"search"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/web/lib/search.js#L143-L168 |
45,557 | jonschlinkert/load-helpers | index.js | Loader | function Loader(options) {
if (!(this instanceof Loader)) {
return new Loader(options);
}
this.options = options || {};
this.cache = this.options.helpers || {};
} | javascript | function Loader(options) {
if (!(this instanceof Loader)) {
return new Loader(options);
}
this.options = options || {};
this.cache = this.options.helpers || {};
} | [
"function",
"Loader",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Loader",
")",
")",
"{",
"return",
"new",
"Loader",
"(",
"options",
")",
";",
"}",
"this",
".",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
... | Create an instance of `Loader` with the given `options`.
```js
var Loader = require('load-helpers');
var loader = new Loader();
```
@param {Object} `options`
@api public | [
"Create",
"an",
"instance",
"of",
"Loader",
"with",
"the",
"given",
"options",
"."
] | 271351dfafeae911495465b83a4811f8532ad249 | https://github.com/jonschlinkert/load-helpers/blob/271351dfafeae911495465b83a4811f8532ad249/index.js#L24-L30 |
45,558 | vadr-vr/VR-Analytics-JSCore | js/utils.js | deepClone | function deepClone(inputDict){
if (!inputDict)
return null;
const clonedDict = {};
for (let key in inputDict){
if (typeof(inputDict[key]) == 'object'){
clonedDict[key] = deepClone(inputDict[key]);
}
else{
clonedDict[key] = inputDict[key]... | javascript | function deepClone(inputDict){
if (!inputDict)
return null;
const clonedDict = {};
for (let key in inputDict){
if (typeof(inputDict[key]) == 'object'){
clonedDict[key] = deepClone(inputDict[key]);
}
else{
clonedDict[key] = inputDict[key]... | [
"function",
"deepClone",
"(",
"inputDict",
")",
"{",
"if",
"(",
"!",
"inputDict",
")",
"return",
"null",
";",
"const",
"clonedDict",
"=",
"{",
"}",
";",
"for",
"(",
"let",
"key",
"in",
"inputDict",
")",
"{",
"if",
"(",
"typeof",
"(",
"inputDict",
"["... | Deep clones dictionary
@memberof Utils
@param {object} inputDict Dictionary to clone
@returns {object} cloned dictionary | [
"Deep",
"clones",
"dictionary"
] | 7e4a493c824c2c1716360dcb6a3bfecfede5df3b | https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/utils.js#L81-L105 |
45,559 | vadr-vr/VR-Analytics-JSCore | js/utils.js | setCookie | function setCookie(cookieName, value, validity, useAppPrefix = true){
const appPrefix = useAppPrefix ? _getAppPrefix() : '';
const cookieString = appPrefix + cookieName + '=' + value + ';' + 'expires=' +
validity.toUTCString();
document.cookie = cookieString;
} | javascript | function setCookie(cookieName, value, validity, useAppPrefix = true){
const appPrefix = useAppPrefix ? _getAppPrefix() : '';
const cookieString = appPrefix + cookieName + '=' + value + ';' + 'expires=' +
validity.toUTCString();
document.cookie = cookieString;
} | [
"function",
"setCookie",
"(",
"cookieName",
",",
"value",
",",
"validity",
",",
"useAppPrefix",
"=",
"true",
")",
"{",
"const",
"appPrefix",
"=",
"useAppPrefix",
"?",
"_getAppPrefix",
"(",
")",
":",
"''",
";",
"const",
"cookieString",
"=",
"appPrefix",
"+",
... | Sets the cookie with the given name, value and validity. Appends appId and version information
in the cookie name automatically
@memberof Utils
@param {string} cookieName name of the cookie
@param {string} value value of the cookie
@param {Date} validity valid till date object | [
"Sets",
"the",
"cookie",
"with",
"the",
"given",
"name",
"value",
"and",
"validity",
".",
"Appends",
"appId",
"and",
"version",
"information",
"in",
"the",
"cookie",
"name",
"automatically"
] | 7e4a493c824c2c1716360dcb6a3bfecfede5df3b | https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/utils.js#L130-L139 |
45,560 | tmorin/ceb | dist/systemjs/builder/template.js | findContentNode | function findContentNode(el) {
if (!el) {
return;
}
var oldCebContentId = el.getAttribute(OLD_CONTENT_ID_ATTR_NAME);
if (oldCebContentId) {
return findContentNode(el.querySelector('[' + oldCebContentId + ']')) || el;
}
return el;
} | javascript | function findContentNode(el) {
if (!el) {
return;
}
var oldCebContentId = el.getAttribute(OLD_CONTENT_ID_ATTR_NAME);
if (oldCebContentId) {
return findContentNode(el.querySelector('[' + oldCebContentId + ']')) || el;
}
return el;
} | [
"function",
"findContentNode",
"(",
"el",
")",
"{",
"if",
"(",
"!",
"el",
")",
"{",
"return",
";",
"}",
"var",
"oldCebContentId",
"=",
"el",
".",
"getAttribute",
"(",
"OLD_CONTENT_ID_ATTR_NAME",
")",
";",
"if",
"(",
"oldCebContentId",
")",
"{",
"return",
... | Try to find a light DOM node
@param {!HTMLElement} el the custom element
@returns {HTMLElement} the light DOM node if found otherwise it's the given HTML Element | [
"Try",
"to",
"find",
"a",
"light",
"DOM",
"node"
] | 7cc0904b482aa99e5123302c5de4401f7a80af02 | https://github.com/tmorin/ceb/blob/7cc0904b482aa99e5123302c5de4401f7a80af02/dist/systemjs/builder/template.js#L61-L70 |
45,561 | tmorin/ceb | dist/systemjs/builder/template.js | cleanOldContentNode | function cleanOldContentNode(el) {
var oldContentNode = el.lightDOM,
lightFrag = document.createDocumentFragment();
while (oldContentNode.childNodes.length > 0) {
lightFrag.appendChild(oldContentNode.removeChild(oldContentNode.childNodes[0]));
}
return lightFrag;
... | javascript | function cleanOldContentNode(el) {
var oldContentNode = el.lightDOM,
lightFrag = document.createDocumentFragment();
while (oldContentNode.childNodes.length > 0) {
lightFrag.appendChild(oldContentNode.removeChild(oldContentNode.childNodes[0]));
}
return lightFrag;
... | [
"function",
"cleanOldContentNode",
"(",
"el",
")",
"{",
"var",
"oldContentNode",
"=",
"el",
".",
"lightDOM",
",",
"lightFrag",
"=",
"document",
".",
"createDocumentFragment",
"(",
")",
";",
"while",
"(",
"oldContentNode",
".",
"childNodes",
".",
"length",
">",... | Remove and return the children of the light DOM node.
@param {!HTMLElement} el the custom element
@returns {DocumentFragment} the light DOM fragment | [
"Remove",
"and",
"return",
"the",
"children",
"of",
"the",
"light",
"DOM",
"node",
"."
] | 7cc0904b482aa99e5123302c5de4401f7a80af02 | https://github.com/tmorin/ceb/blob/7cc0904b482aa99e5123302c5de4401f7a80af02/dist/systemjs/builder/template.js#L77-L84 |
45,562 | tmorin/ceb | dist/systemjs/builder/template.js | applyTemplate | function applyTemplate(el, tpl) {
var lightFrag = void 0,
handleContentNode = hasContent(tpl);
if (handleContentNode) {
var newCebContentId = 'ceb-content-' + counter++;
lightFrag = cleanOldContentNode(el);
tpl = replaceContent(tpl, newCebContentId);
... | javascript | function applyTemplate(el, tpl) {
var lightFrag = void 0,
handleContentNode = hasContent(tpl);
if (handleContentNode) {
var newCebContentId = 'ceb-content-' + counter++;
lightFrag = cleanOldContentNode(el);
tpl = replaceContent(tpl, newCebContentId);
... | [
"function",
"applyTemplate",
"(",
"el",
",",
"tpl",
")",
"{",
"var",
"lightFrag",
"=",
"void",
"0",
",",
"handleContentNode",
"=",
"hasContent",
"(",
"tpl",
")",
";",
"if",
"(",
"handleContentNode",
")",
"{",
"var",
"newCebContentId",
"=",
"'ceb-content-'",
... | Apply the template to the element.
@param {!HTMLElement} el the custom element
@param {!string} tpl the template | [
"Apply",
"the",
"template",
"to",
"the",
"element",
"."
] | 7cc0904b482aa99e5123302c5de4401f7a80af02 | https://github.com/tmorin/ceb/blob/7cc0904b482aa99e5123302c5de4401f7a80af02/dist/systemjs/builder/template.js#L91-L109 |
45,563 | ngenerio/smsghjs | lib/message.js | isAnImportantParamMissing | function isAnImportantParamMissing (obj) {
var i = 0
var l = Message._importantParams.length
for (; i < l; i++) {
var value = obj[Message._importantParams[i]]
if (value === null || value === undefined) {
return true
}
}
} | javascript | function isAnImportantParamMissing (obj) {
var i = 0
var l = Message._importantParams.length
for (; i < l; i++) {
var value = obj[Message._importantParams[i]]
if (value === null || value === undefined) {
return true
}
}
} | [
"function",
"isAnImportantParamMissing",
"(",
"obj",
")",
"{",
"var",
"i",
"=",
"0",
"var",
"l",
"=",
"Message",
".",
"_importantParams",
".",
"length",
"for",
"(",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"var",
"value",
"=",
"obj",
"[",
"Mes... | To check whether the given object contains the necssary params to send a message
@param {Object} obj
@return {Boolean} | [
"To",
"check",
"whether",
"the",
"given",
"object",
"contains",
"the",
"necssary",
"params",
"to",
"send",
"a",
"message"
] | cfb33bb6b5b02d54125bed67365a5b174a1ad562 | https://github.com/ngenerio/smsghjs/blob/cfb33bb6b5b02d54125bed67365a5b174a1ad562/lib/message.js#L8-L18 |
45,564 | ngenerio/smsghjs | lib/message.js | Message | function Message (opts) {
if (!(this instanceof Message)) return new Message(opts)
this.type = opts.type || 0
this.clientReference = opts.clientReference || null
this.direction = opts.direction || 'out'
this.flashMessage = opts.flash || null
this.messageId = opts.messageId || null
this.networkId = opts.n... | javascript | function Message (opts) {
if (!(this instanceof Message)) return new Message(opts)
this.type = opts.type || 0
this.clientReference = opts.clientReference || null
this.direction = opts.direction || 'out'
this.flashMessage = opts.flash || null
this.messageId = opts.messageId || null
this.networkId = opts.n... | [
"function",
"Message",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Message",
")",
")",
"return",
"new",
"Message",
"(",
"opts",
")",
"this",
".",
"type",
"=",
"opts",
".",
"type",
"||",
"0",
"this",
".",
"clientReference",
"=",... | The message object used in the send message api
@param {Object} opts Contains the params to be sent using the message api | [
"The",
"message",
"object",
"used",
"in",
"the",
"send",
"message",
"api"
] | cfb33bb6b5b02d54125bed67365a5b174a1ad562 | https://github.com/ngenerio/smsghjs/blob/cfb33bb6b5b02d54125bed67365a5b174a1ad562/lib/message.js#L24-L50 |
45,565 | socialally/air | lib/air/val.js | val | function val(value) {
var first = this.get(0);
function getValue(el) {
var nm = el.tagName.toLowerCase()
, type = el.getAttribute('type');
if(nm === SELECT) {
return getSelectValues(el).join(
el.getAttribute('data-delimiter') || ',');
}else if(type === CHECKBOX) {
return Boole... | javascript | function val(value) {
var first = this.get(0);
function getValue(el) {
var nm = el.tagName.toLowerCase()
, type = el.getAttribute('type');
if(nm === SELECT) {
return getSelectValues(el).join(
el.getAttribute('data-delimiter') || ',');
}else if(type === CHECKBOX) {
return Boole... | [
"function",
"val",
"(",
"value",
")",
"{",
"var",
"first",
"=",
"this",
".",
"get",
"(",
"0",
")",
";",
"function",
"getValue",
"(",
"el",
")",
"{",
"var",
"nm",
"=",
"el",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
",",
"type",
"=",
"el",
"... | Get the current value of the first element in the set of
matched elements or set the value of every matched element. | [
"Get",
"the",
"current",
"value",
"of",
"the",
"first",
"element",
"in",
"the",
"set",
"of",
"matched",
"elements",
"or",
"set",
"the",
"value",
"of",
"every",
"matched",
"element",
"."
] | a3d94de58aaa4930a425fbcc7266764bf6ca8ca6 | https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/val.js#L36-L78 |
45,566 | goliatone/core.io-express-server | lib/getView.js | getView | function getView(app, viewName, defaultView='error'){
/*
* views could be an array...
*/
let views = app.get('views');
const ext = app.get('view engine');
if(!Array.isArray(views)) views = [views];
let view;
for(var i = 0; i < views.length; i++){
view = path.join(views[i], vi... | javascript | function getView(app, viewName, defaultView='error'){
/*
* views could be an array...
*/
let views = app.get('views');
const ext = app.get('view engine');
if(!Array.isArray(views)) views = [views];
let view;
for(var i = 0; i < views.length; i++){
view = path.join(views[i], vi... | [
"function",
"getView",
"(",
"app",
",",
"viewName",
",",
"defaultView",
"=",
"'error'",
")",
"{",
"/*\n * views could be an array...\n */",
"let",
"views",
"=",
"app",
".",
"get",
"(",
"'views'",
")",
";",
"const",
"ext",
"=",
"app",
".",
"get",
"(",... | This function will try to return a valid path to
a view.
It will recursively call itself while the provided
express instance has a `parent` attribute.
@TODO: Move to it's own package.
@param {Object} app Express instance
@param {String} viewName View name without ext
@param {String}... | [
"This",
"function",
"will",
"try",
"to",
"return",
"a",
"valid",
"path",
"to",
"a",
"view",
"."
] | 920225b923eaf1f142cd0ee1db78a208f8ecdbe2 | https://github.com/goliatone/core.io-express-server/blob/920225b923eaf1f142cd0ee1db78a208f8ecdbe2/lib/getView.js#L19-L37 |
45,567 | SME-FE/sme-log | src/index.js | logSome | function logSome(env = 'dev', level = 'none') {
let levelNum = 3
const theme = {
normal: '#92e6e6',
error: '#ff5335',
info: '#2994b2',
warn: '#ffb400'
}
const setLevel = level => {
switch (level) {
case 'error':
levelNum = 1
break
case 'warn':
levelNum = 2... | javascript | function logSome(env = 'dev', level = 'none') {
let levelNum = 3
const theme = {
normal: '#92e6e6',
error: '#ff5335',
info: '#2994b2',
warn: '#ffb400'
}
const setLevel = level => {
switch (level) {
case 'error':
levelNum = 1
break
case 'warn':
levelNum = 2... | [
"function",
"logSome",
"(",
"env",
"=",
"'dev'",
",",
"level",
"=",
"'none'",
")",
"{",
"let",
"levelNum",
"=",
"3",
"const",
"theme",
"=",
"{",
"normal",
":",
"'#92e6e6'",
",",
"error",
":",
"'#ff5335'",
",",
"info",
":",
"'#2994b2'",
",",
"warn",
"... | more pretty log for console.log
and only log on dev mode
always log if force is true | [
"more",
"pretty",
"log",
"for",
"console",
".",
"log",
"and",
"only",
"log",
"on",
"dev",
"mode",
"always",
"log",
"if",
"force",
"is",
"true"
] | 02f5cdbffae01a29761856c47fc528430260b8e0 | https://github.com/SME-FE/sme-log/blob/02f5cdbffae01a29761856c47fc528430260b8e0/src/index.js#L7-L67 |
45,568 | nodecraft/spawnpoint-express | spawnpoint-express.js | function(err){
if(!err){
var address = app[serverNS].address();
if(config.port){
app.info('Server online at %s:%s', address.address, address.port);
}else if(config.file){
app.info('Server online via %s', config.file);
}else{
app.info('Server online!');
}
}
app.emit('app.regi... | javascript | function(err){
if(!err){
var address = app[serverNS].address();
if(config.port){
app.info('Server online at %s:%s', address.address, address.port);
}else if(config.file){
app.info('Server online via %s', config.file);
}else{
app.info('Server online!');
}
}
app.emit('app.regi... | [
"function",
"(",
"err",
")",
"{",
"if",
"(",
"!",
"err",
")",
"{",
"var",
"address",
"=",
"app",
"[",
"serverNS",
"]",
".",
"address",
"(",
")",
";",
"if",
"(",
"config",
".",
"port",
")",
"{",
"app",
".",
"info",
"(",
"'Server online at %s:%s'",
... | register express with spawnpoint | [
"register",
"express",
"with",
"spawnpoint"
] | 82ebf14f9d8490f2581032ff79dcb40eeffdadd6 | https://github.com/nodecraft/spawnpoint-express/blob/82ebf14f9d8490f2581032ff79dcb40eeffdadd6/spawnpoint-express.js#L78-L92 | |
45,569 | rat-nest/big-rat | lib/ctz.js | ctzNumber | function ctzNumber(x) {
var l = ctz(db.lo(x))
if(l < 32) {
return l
}
var h = ctz(db.hi(x))
if(h > 20) {
return 52
}
return h + 32
} | javascript | function ctzNumber(x) {
var l = ctz(db.lo(x))
if(l < 32) {
return l
}
var h = ctz(db.hi(x))
if(h > 20) {
return 52
}
return h + 32
} | [
"function",
"ctzNumber",
"(",
"x",
")",
"{",
"var",
"l",
"=",
"ctz",
"(",
"db",
".",
"lo",
"(",
"x",
")",
")",
"if",
"(",
"l",
"<",
"32",
")",
"{",
"return",
"l",
"}",
"var",
"h",
"=",
"ctz",
"(",
"db",
".",
"hi",
"(",
"x",
")",
")",
"i... | Counts the number of trailing zeros | [
"Counts",
"the",
"number",
"of",
"trailing",
"zeros"
] | 09aabcf6d51a326dce0e4bdeedb159c9ce6b0efa | https://github.com/rat-nest/big-rat/blob/09aabcf6d51a326dce0e4bdeedb159c9ce6b0efa/lib/ctz.js#L9-L19 |
45,570 | jaredhanson/passport-familysearch | lib/passport-familysearch/legacy-strategy.js | Strategy | function Strategy(options, verify) {
options = options || {};
options.requestTokenURL = options.requestTokenURL || 'https://api.familysearch.org/identity/v2/request_token';
options.accessTokenURL = options.accessTokenURL || 'https://api.familysearch.org/identity/v2/access_token';
options.userAuthorizationURL = ... | javascript | function Strategy(options, verify) {
options = options || {};
options.requestTokenURL = options.requestTokenURL || 'https://api.familysearch.org/identity/v2/request_token';
options.accessTokenURL = options.accessTokenURL || 'https://api.familysearch.org/identity/v2/access_token';
options.userAuthorizationURL = ... | [
"function",
"Strategy",
"(",
"options",
",",
"verify",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"options",
".",
"requestTokenURL",
"=",
"options",
".",
"requestTokenURL",
"||",
"'https://api.familysearch.org/identity/v2/request_token'",
";",
"option... | Legacy `Strategy` constructor.
The FamilySearch legacy authentication strategy authenticates requests by delegating
to FamilySearch using the OAuth 1.0 protocol.
Applications must supply a `verify` callback which accepts a `token`,
`tokenSecret` and service-specific `profile`, and then calls the `done`
callback suppl... | [
"Legacy",
"Strategy",
"constructor",
"."
] | eeb7588ee21b9523c49622aaaffb3a45570dd40f | https://github.com/jaredhanson/passport-familysearch/blob/eeb7588ee21b9523c49622aaaffb3a45570dd40f/lib/passport-familysearch/legacy-strategy.js#L43-L97 |
45,571 | ex-machine/ng-classified | src/ng-classified.js | injectorInjectInvokers | function injectorInjectInvokers(injector) {
var invoke_ = injector.invoke;
injector.instantiate = instantiate;
injector.invoke = invoke;
return injector;
// pasted method that picks up patched 'invoke'
function instantiate(Type, locals, serviceName) {
var instance = Object.create((Array.isArray(Typ... | javascript | function injectorInjectInvokers(injector) {
var invoke_ = injector.invoke;
injector.instantiate = instantiate;
injector.invoke = invoke;
return injector;
// pasted method that picks up patched 'invoke'
function instantiate(Type, locals, serviceName) {
var instance = Object.create((Array.isArray(Typ... | [
"function",
"injectorInjectInvokers",
"(",
"injector",
")",
"{",
"var",
"invoke_",
"=",
"injector",
".",
"invoke",
";",
"injector",
".",
"instantiate",
"=",
"instantiate",
";",
"injector",
".",
"invoke",
"=",
"invoke",
";",
"return",
"injector",
";",
"// paste... | Invoker injects invokee,
Injector invokes injectee,
Morrow instantiates. | [
"Invoker",
"injects",
"invokee",
"Injector",
"invokes",
"injectee",
"Morrow",
"instantiates",
"."
] | 039eb956582ea10d64574bc1d3f047a0abcbd343 | https://github.com/ex-machine/ng-classified/blob/039eb956582ea10d64574bc1d3f047a0abcbd343/src/ng-classified.js#L26-L94 |
45,572 | Whitebolt/require-extra | src/fs.js | _addReadCallback | function _addReadCallback(filename) {
return new Promise((resolve, reject)=> {
readFileCallbacks.get(filename).add((err, data)=> {
if (err) return reject(err);
return resolve(data);
});
});
} | javascript | function _addReadCallback(filename) {
return new Promise((resolve, reject)=> {
readFileCallbacks.get(filename).add((err, data)=> {
if (err) return reject(err);
return resolve(data);
});
});
} | [
"function",
"_addReadCallback",
"(",
"filename",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"readFileCallbacks",
".",
"get",
"(",
"filename",
")",
".",
"add",
"(",
"(",
"err",
",",
"data",
")",
"=>",
"{",
... | Add a callback for reading of given file.
@private
@param {string} filename File to set callback for.
@returns {Promise.<Buffer|*>} The file contents, once loaded. | [
"Add",
"a",
"callback",
"for",
"reading",
"of",
"given",
"file",
"."
] | 2a8f737aab67305c9fda3ee56aa7953e97cee859 | https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L176-L183 |
45,573 | Whitebolt/require-extra | src/fs.js | _addReadCallbacks | function _addReadCallbacks(filename, cache) {
const callbacks = new Set();
cache.set(filename, true);
readFileCallbacks.set(filename, callbacks);
return callbacks;
} | javascript | function _addReadCallbacks(filename, cache) {
const callbacks = new Set();
cache.set(filename, true);
readFileCallbacks.set(filename, callbacks);
return callbacks;
} | [
"function",
"_addReadCallbacks",
"(",
"filename",
",",
"cache",
")",
"{",
"const",
"callbacks",
"=",
"new",
"Set",
"(",
")",
";",
"cache",
".",
"set",
"(",
"filename",
",",
"true",
")",
";",
"readFileCallbacks",
".",
"set",
"(",
"filename",
",",
"callbac... | Add callbacks set for given file
@private
@param {string} filename File to add for.
@param {Map} cache Cache to use.
@returns {Set} The callbacks. | [
"Add",
"callbacks",
"set",
"for",
"given",
"file"
] | 2a8f737aab67305c9fda3ee56aa7953e97cee859 | https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L193-L198 |
45,574 | Whitebolt/require-extra | src/fs.js | _fireReadFileCallbacks | function _fireReadFileCallbacks(filename, data, error=false) {
const callbacks = readFileCallbacks.get(filename);
if (callbacks) {
if (callbacks.size) callbacks.forEach(callback=>error?callback(data, null):callback(null, data));
callbacks.clear();
readFileCallbacks.delete(filename);
}
} | javascript | function _fireReadFileCallbacks(filename, data, error=false) {
const callbacks = readFileCallbacks.get(filename);
if (callbacks) {
if (callbacks.size) callbacks.forEach(callback=>error?callback(data, null):callback(null, data));
callbacks.clear();
readFileCallbacks.delete(filename);
}
} | [
"function",
"_fireReadFileCallbacks",
"(",
"filename",
",",
"data",
",",
"error",
"=",
"false",
")",
"{",
"const",
"callbacks",
"=",
"readFileCallbacks",
".",
"get",
"(",
"filename",
")",
";",
"if",
"(",
"callbacks",
")",
"{",
"if",
"(",
"callbacks",
".",
... | Fire any awaiting callbacks for given file data.
@private
@param {string} filename The filename to fire callbacks on.
@param {Buffer|Error} data The received data.
@param {boolean} [error=false] Is this an error or file data? | [
"Fire",
"any",
"awaiting",
"callbacks",
"for",
"given",
"file",
"data",
"."
] | 2a8f737aab67305c9fda3ee56aa7953e97cee859 | https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L221-L228 |
45,575 | Whitebolt/require-extra | src/fs.js | _runFileQueue | function _runFileQueue() {
if (!settings) settings = require('./settings');
const simultaneous = settings.get('load-simultaneously') || 10;
if ((loading < simultaneous) && (fileQueue.length)) {
loading++;
fileQueue.shift()();
}
} | javascript | function _runFileQueue() {
if (!settings) settings = require('./settings');
const simultaneous = settings.get('load-simultaneously') || 10;
if ((loading < simultaneous) && (fileQueue.length)) {
loading++;
fileQueue.shift()();
}
} | [
"function",
"_runFileQueue",
"(",
")",
"{",
"if",
"(",
"!",
"settings",
")",
"settings",
"=",
"require",
"(",
"'./settings'",
")",
";",
"const",
"simultaneous",
"=",
"settings",
".",
"get",
"(",
"'load-simultaneously'",
")",
"||",
"10",
";",
"if",
"(",
"... | File queue handler.
@private | [
"File",
"queue",
"handler",
"."
] | 2a8f737aab67305c9fda3ee56aa7953e97cee859 | https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L235-L243 |
45,576 | Whitebolt/require-extra | src/fs.js | _readFileOnEnd | function _readFileOnEnd(filename, contents, cache) {
loading--;
const data = Buffer.concat(contents);
cache.set(filename, data);
_fireReadFileCallbacks(filename, data);
_runFileQueue();
} | javascript | function _readFileOnEnd(filename, contents, cache) {
loading--;
const data = Buffer.concat(contents);
cache.set(filename, data);
_fireReadFileCallbacks(filename, data);
_runFileQueue();
} | [
"function",
"_readFileOnEnd",
"(",
"filename",
",",
"contents",
",",
"cache",
")",
"{",
"loading",
"--",
";",
"const",
"data",
"=",
"Buffer",
".",
"concat",
"(",
"contents",
")",
";",
"cache",
".",
"set",
"(",
"filename",
",",
"data",
")",
";",
"_fireR... | On end listener for readFile.
@private
@param {string} filename The filename.
@param {Array.<Buffer>} contents The file contents as a series of buffers.
@param {Map} cache The file cache. | [
"On",
"end",
"listener",
"for",
"readFile",
"."
] | 2a8f737aab67305c9fda3ee56aa7953e97cee859 | https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L253-L259 |
45,577 | Whitebolt/require-extra | src/fs.js | readFile | function readFile(filename, cache, encoding=null) {
if (cache.has(filename)) return _handleFileInCache(filename, cache);
_addReadCallbacks(filename, cache);
fileQueue.push(()=>{
const contents = [];
fs.createReadStream(filename, {encoding})
.on('data', chunk=>contents.push(chunk))
.on('end', (... | javascript | function readFile(filename, cache, encoding=null) {
if (cache.has(filename)) return _handleFileInCache(filename, cache);
_addReadCallbacks(filename, cache);
fileQueue.push(()=>{
const contents = [];
fs.createReadStream(filename, {encoding})
.on('data', chunk=>contents.push(chunk))
.on('end', (... | [
"function",
"readFile",
"(",
"filename",
",",
"cache",
",",
"encoding",
"=",
"null",
")",
"{",
"if",
"(",
"cache",
".",
"has",
"(",
"filename",
")",
")",
"return",
"_handleFileInCache",
"(",
"filename",
",",
"cache",
")",
";",
"_addReadCallbacks",
"(",
"... | Load a file synchronously using a cache.
@public
@param {string} filename The file to load.
@param {Map} cache The cache to use.
@param {null|string} [encoding=null] The encoding to load as.
@returns {Promise.<Buffer|*>} The load results. | [
"Load",
"a",
"file",
"synchronously",
"using",
"a",
"cache",
"."
] | 2a8f737aab67305c9fda3ee56aa7953e97cee859 | https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L283-L295 |
45,578 | Whitebolt/require-extra | src/fs.js | readFileSync | function readFileSync(filename, cache, encoding=null) {
if (cache.has(filename) && (cache.get(filename) !== true)) return cache.get(filename);
const data = fs.readFileSync(filename, encoding);
cache.set(filename, data);
return data;
} | javascript | function readFileSync(filename, cache, encoding=null) {
if (cache.has(filename) && (cache.get(filename) !== true)) return cache.get(filename);
const data = fs.readFileSync(filename, encoding);
cache.set(filename, data);
return data;
} | [
"function",
"readFileSync",
"(",
"filename",
",",
"cache",
",",
"encoding",
"=",
"null",
")",
"{",
"if",
"(",
"cache",
".",
"has",
"(",
"filename",
")",
"&&",
"(",
"cache",
".",
"get",
"(",
"filename",
")",
"!==",
"true",
")",
")",
"return",
"cache",... | Read a file synchronously using file cache.
@param {string} filename The filename to load.
@param {Map} cache The cache to use.
@param {null|strin} [encoding=null] The encoding to use.
@returns {Buffer\*} The file contents as a buffer. | [
"Read",
"a",
"file",
"synchronously",
"using",
"file",
"cache",
"."
] | 2a8f737aab67305c9fda3ee56aa7953e97cee859 | https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L319-L324 |
45,579 | binduwavell/generator-alfresco-common | lib/prompt-filters.js | function (input) {
debug('booleanFilter(%s)', input);
if (_.isBoolean(input)) return input;
if (_.isString(input)) {
var lc = input.toLocaleLowerCase();
var pos = ['false', 'true'].indexOf(lc);
if (pos > -1) return (pos > 0);
}
return undefined;
} | javascript | function (input) {
debug('booleanFilter(%s)', input);
if (_.isBoolean(input)) return input;
if (_.isString(input)) {
var lc = input.toLocaleLowerCase();
var pos = ['false', 'true'].indexOf(lc);
if (pos > -1) return (pos > 0);
}
return undefined;
} | [
"function",
"(",
"input",
")",
"{",
"debug",
"(",
"'booleanFilter(%s)'",
",",
"input",
")",
";",
"if",
"(",
"_",
".",
"isBoolean",
"(",
"input",
")",
")",
"return",
"input",
";",
"if",
"(",
"_",
".",
"isString",
"(",
"input",
")",
")",
"{",
"var",
... | If we are given a boolean value return it.
If we are given a string with the value 'false' return false
If we are given a string with the value 'true' return true
Otherwise return undefined
@param {(boolean|string|undefined|null)} input
@returns {(true|false|undefined)} | [
"If",
"we",
"are",
"given",
"a",
"boolean",
"value",
"return",
"it",
".",
"If",
"we",
"are",
"given",
"a",
"string",
"with",
"the",
"value",
"false",
"return",
"false",
"If",
"we",
"are",
"given",
"a",
"string",
"with",
"the",
"value",
"true",
"return"... | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L28-L37 | |
45,580 | binduwavell/generator-alfresco-common | lib/prompt-filters.js | function (input) {
debug('booleanTextFilter(%s)', input);
var retv = module.exports.booleanFilter(input);
return (retv === undefined
? undefined
: (retv === false
? 'false'
: 'true'));
} | javascript | function (input) {
debug('booleanTextFilter(%s)', input);
var retv = module.exports.booleanFilter(input);
return (retv === undefined
? undefined
: (retv === false
? 'false'
: 'true'));
} | [
"function",
"(",
"input",
")",
"{",
"debug",
"(",
"'booleanTextFilter(%s)'",
",",
"input",
")",
";",
"var",
"retv",
"=",
"module",
".",
"exports",
".",
"booleanFilter",
"(",
"input",
")",
";",
"return",
"(",
"retv",
"===",
"undefined",
"?",
"undefined",
... | Same as booleanFilter but but return 'true' and 'false'
in place of true and false respectively.
@param {(boolean|string|undefined|null)} input
@returns {('true'|'false'|undefined)} | [
"Same",
"as",
"booleanFilter",
"but",
"but",
"return",
"true",
"and",
"false",
"in",
"place",
"of",
"true",
"and",
"false",
"respectively",
"."
] | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L46-L54 | |
45,581 | binduwavell/generator-alfresco-common | lib/prompt-filters.js | function (input, list) {
debug('chooseOneFilter(%s, %s)', input, JSON.stringify(list));
if (input === true) return undefined;
if (_.isString(input)) {
if (_.isEmpty(input)) return undefined;
var ilc = input.toLocaleLowerCase();
for (var idx = 0; idx < list.length; idx++) {
var item... | javascript | function (input, list) {
debug('chooseOneFilter(%s, %s)', input, JSON.stringify(list));
if (input === true) return undefined;
if (_.isString(input)) {
if (_.isEmpty(input)) return undefined;
var ilc = input.toLocaleLowerCase();
for (var idx = 0; idx < list.length; idx++) {
var item... | [
"function",
"(",
"input",
",",
"list",
")",
"{",
"debug",
"(",
"'chooseOneFilter(%s, %s)'",
",",
"input",
",",
"JSON",
".",
"stringify",
"(",
"list",
")",
")",
";",
"if",
"(",
"input",
"===",
"true",
")",
"return",
"undefined",
";",
"if",
"(",
"_",
"... | Check if input exists in list in a case insensitive manner. Will return
the value from the list rather than the user input so the list can control
the final case.
NOTE 1: The list may not contain, undefined, null or the empty string.
NOTE 2: If there are multiple matches, the first one wins.
@param {(string|boolean|u... | [
"Check",
"if",
"input",
"exists",
"in",
"list",
"in",
"a",
"case",
"insensitive",
"manner",
".",
"Will",
"return",
"the",
"value",
"from",
"the",
"list",
"rather",
"than",
"the",
"user",
"input",
"so",
"the",
"list",
"can",
"control",
"the",
"final",
"ca... | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L68-L80 | |
45,582 | binduwavell/generator-alfresco-common | lib/prompt-filters.js | function (input, list) {
debug('chooseOneStartsWithFilter(%s, %s)', input, JSON.stringify(list));
if (input === true) return undefined;
var retv;
if (_.isString(input)) {
if (input === '') return undefined;
var ilc = input.toLocaleLowerCase();
_.forEach(list, function (item) {
... | javascript | function (input, list) {
debug('chooseOneStartsWithFilter(%s, %s)', input, JSON.stringify(list));
if (input === true) return undefined;
var retv;
if (_.isString(input)) {
if (input === '') return undefined;
var ilc = input.toLocaleLowerCase();
_.forEach(list, function (item) {
... | [
"function",
"(",
"input",
",",
"list",
")",
"{",
"debug",
"(",
"'chooseOneStartsWithFilter(%s, %s)'",
",",
"input",
",",
"JSON",
".",
"stringify",
"(",
"list",
")",
")",
";",
"if",
"(",
"input",
"===",
"true",
")",
"return",
"undefined",
";",
"var",
"ret... | Check if any items in the list start with the input in a case insensitive
manner. Will return the value from the list rather than the user input so
the list can control the final case.
NOTE 1: The list may not contain, undefined, null or the empty string.
NOTE 2: If there are multiple partial matches, the first one wi... | [
"Check",
"if",
"any",
"items",
"in",
"the",
"list",
"start",
"with",
"the",
"input",
"in",
"a",
"case",
"insensitive",
"manner",
".",
"Will",
"return",
"the",
"value",
"from",
"the",
"list",
"rather",
"than",
"the",
"user",
"input",
"so",
"the",
"list",
... | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L101-L115 | |
45,583 | binduwavell/generator-alfresco-common | lib/prompt-filters.js | function (input, map) {
// TODO(bwavell): write tests
debug('chooseOneMapStartsWithFilter(%s, %s)', input, JSON.stringify(map));
if (input === true) return undefined;
var retv;
if (_.isString(input)) {
if (input === '') return undefined;
var ilc = input.toLocaleLowerCase();
_.forOw... | javascript | function (input, map) {
// TODO(bwavell): write tests
debug('chooseOneMapStartsWithFilter(%s, %s)', input, JSON.stringify(map));
if (input === true) return undefined;
var retv;
if (_.isString(input)) {
if (input === '') return undefined;
var ilc = input.toLocaleLowerCase();
_.forOw... | [
"function",
"(",
"input",
",",
"map",
")",
"{",
"// TODO(bwavell): write tests",
"debug",
"(",
"'chooseOneMapStartsWithFilter(%s, %s)'",
",",
"input",
",",
"JSON",
".",
"stringify",
"(",
"map",
")",
")",
";",
"if",
"(",
"input",
"===",
"true",
")",
"return",
... | Check if any keys in the map start with the input in a case insensitive
manner. Will return the value from the map rather than the user input so
the map can control the final case. If there is an exact case insensitive
match to a value, the value will be returned.
NOTE 1: The map may not contain, undefined, null or th... | [
"Check",
"if",
"any",
"keys",
"in",
"the",
"map",
"start",
"with",
"the",
"input",
"in",
"a",
"case",
"insensitive",
"manner",
".",
"Will",
"return",
"the",
"value",
"from",
"the",
"map",
"rather",
"than",
"the",
"user",
"input",
"so",
"the",
"map",
"c... | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L174-L191 | |
45,584 | binduwavell/generator-alfresco-common | lib/prompt-filters.js | function (input) {
debug('optionalTextFilter(%s)', input);
if (_.isString(input)) return input;
if (_.isBoolean(input)) return (input ? '' : undefined);
if (_.isNumber(input)) return '' + input;
return undefined;
} | javascript | function (input) {
debug('optionalTextFilter(%s)', input);
if (_.isString(input)) return input;
if (_.isBoolean(input)) return (input ? '' : undefined);
if (_.isNumber(input)) return '' + input;
return undefined;
} | [
"function",
"(",
"input",
")",
"{",
"debug",
"(",
"'optionalTextFilter(%s)'",
",",
"input",
")",
";",
"if",
"(",
"_",
".",
"isString",
"(",
"input",
")",
")",
"return",
"input",
";",
"if",
"(",
"_",
".",
"isBoolean",
"(",
"input",
")",
")",
"return",... | Given some text or the empty string return it.
If we receive true return empty string.
If we receive a number convert it to a string and return it.
Otherwise return undefined.
@param {(string|boolean|number|undefined|null)} input
@returns {(string|undefined)} | [
"Given",
"some",
"text",
"or",
"the",
"empty",
"string",
"return",
"it",
".",
"If",
"we",
"receive",
"true",
"return",
"empty",
"string",
".",
"If",
"we",
"receive",
"a",
"number",
"convert",
"it",
"to",
"a",
"string",
"and",
"return",
"it",
".",
"Othe... | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L208-L214 | |
45,585 | binduwavell/generator-alfresco-common | lib/prompt-filters.js | function (input) {
debug('requiredTextFilter(%s)', input);
if (_.isString(input) && !_.isEmpty(input)) return input;
if (_.isNumber(input)) return '' + input;
return undefined;
} | javascript | function (input) {
debug('requiredTextFilter(%s)', input);
if (_.isString(input) && !_.isEmpty(input)) return input;
if (_.isNumber(input)) return '' + input;
return undefined;
} | [
"function",
"(",
"input",
")",
"{",
"debug",
"(",
"'requiredTextFilter(%s)'",
",",
"input",
")",
";",
"if",
"(",
"_",
".",
"isString",
"(",
"input",
")",
"&&",
"!",
"_",
".",
"isEmpty",
"(",
"input",
")",
")",
"return",
"input",
";",
"if",
"(",
"_"... | Given some none empty text return it.
If we receive a number convert it to a string and return it.
Otherwise return undefined.
@param {(string|boolean|undefined|null)} input
@returns {(string|undefined)} | [
"Given",
"some",
"none",
"empty",
"text",
"return",
"it",
".",
"If",
"we",
"receive",
"a",
"number",
"convert",
"it",
"to",
"a",
"string",
"and",
"return",
"it",
".",
"Otherwise",
"return",
"undefined",
"."
] | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L224-L229 | |
45,586 | binduwavell/generator-alfresco-common | lib/prompt-filters.js | function (input, sep, choices) {
debug('requiredTextListFilter(%s, %s, %s)', input, sep, (choices ? JSON.stringify(choices) : 'undefined'));
// if we already have a list, just return it. We may
// want to add validation that the items are in the
// choices list
if (_.isArray(input) && input.length >... | javascript | function (input, sep, choices) {
debug('requiredTextListFilter(%s, %s, %s)', input, sep, (choices ? JSON.stringify(choices) : 'undefined'));
// if we already have a list, just return it. We may
// want to add validation that the items are in the
// choices list
if (_.isArray(input) && input.length >... | [
"function",
"(",
"input",
",",
"sep",
",",
"choices",
")",
"{",
"debug",
"(",
"'requiredTextListFilter(%s, %s, %s)'",
",",
"input",
",",
"sep",
",",
"(",
"choices",
"?",
"JSON",
".",
"stringify",
"(",
"choices",
")",
":",
"'undefined'",
")",
")",
";",
"/... | Given some input text, a separator and an optional list of
choices, we split the input using the separator. We remove
any empty items from the list.
If choices are provided then we only provide values that
match the choices in a case insensitive way and we return
in the order provided in the choices list and using the... | [
"Given",
"some",
"input",
"text",
"a",
"separator",
"and",
"an",
"optional",
"list",
"of",
"choices",
"we",
"split",
"the",
"input",
"using",
"the",
"separator",
".",
"We",
"remove",
"any",
"empty",
"items",
"from",
"the",
"list",
"."
] | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L248-L273 | |
45,587 | binduwavell/generator-alfresco-common | lib/prompt-filters.js | function (input, sep, choices) {
debug('requiredTextStartsWithListFilter(%s, %s, %s)', input, sep, (choices ? JSON.stringify(choices) : 'undefined'));
// if we already have a list, just return it. We may
// want to add validation that the items are in the
// choices list
if (_.isArray(input) && inpu... | javascript | function (input, sep, choices) {
debug('requiredTextStartsWithListFilter(%s, %s, %s)', input, sep, (choices ? JSON.stringify(choices) : 'undefined'));
// if we already have a list, just return it. We may
// want to add validation that the items are in the
// choices list
if (_.isArray(input) && inpu... | [
"function",
"(",
"input",
",",
"sep",
",",
"choices",
")",
"{",
"debug",
"(",
"'requiredTextStartsWithListFilter(%s, %s, %s)'",
",",
"input",
",",
"sep",
",",
"(",
"choices",
"?",
"JSON",
".",
"stringify",
"(",
"choices",
")",
":",
"'undefined'",
")",
")",
... | Given some input text, a separator and a list of choices, we
split the input using the separator. We remove any empty items
from the list.
We provide all choices that start-with in a case-insensitive
manner one of the inputs. We return in the order provided in
the choices list and using the case provided in the choice... | [
"Given",
"some",
"input",
"text",
"a",
"separator",
"and",
"a",
"list",
"of",
"choices",
"we",
"split",
"the",
"input",
"using",
"the",
"separator",
".",
"We",
"remove",
"any",
"empty",
"items",
"from",
"the",
"list",
"."
] | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L296-L320 | |
45,588 | binduwavell/generator-alfresco-common | lib/prompt-filters.js | function (input) {
debug('requiredTextFilter(%s)', input);
if (_.isString(input) && !_.isEmpty(input)) {
if (_.startsWith(input, 'VERSION-')) {
return input.substr(8);
}
return input;
}
if (_.isNumber(input)) return '' + input;
return undefined;
} | javascript | function (input) {
debug('requiredTextFilter(%s)', input);
if (_.isString(input) && !_.isEmpty(input)) {
if (_.startsWith(input, 'VERSION-')) {
return input.substr(8);
}
return input;
}
if (_.isNumber(input)) return '' + input;
return undefined;
} | [
"function",
"(",
"input",
")",
"{",
"debug",
"(",
"'requiredTextFilter(%s)'",
",",
"input",
")",
";",
"if",
"(",
"_",
".",
"isString",
"(",
"input",
")",
"&&",
"!",
"_",
".",
"isEmpty",
"(",
"input",
")",
")",
"{",
"if",
"(",
"_",
".",
"startsWith"... | Given some none empty text return it.
If the text starts with "VERSION-", remove that text
This is a stupid hack because Yeoman is messing
with our numeric options.
If we receive a number convert it to a string and return it.
Otherwise return undefined.
@param {(string|boolean|undefined|null)} input
@returns {(string|... | [
"Given",
"some",
"none",
"empty",
"text",
"return",
"it",
".",
"If",
"the",
"text",
"starts",
"with",
"VERSION",
"-",
"remove",
"that",
"text",
"This",
"is",
"a",
"stupid",
"hack",
"because",
"Yeoman",
"is",
"messing",
"with",
"our",
"numeric",
"options",
... | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L338-L348 | |
45,589 | binduwavell/generator-alfresco-common | lib/prompt-filters.js | function (filterArray) {
return function (input) {
return filterArray.reduce(function (previousValue, filter) {
return filter.call(this, previousValue);
}.bind(this), input);
};
} | javascript | function (filterArray) {
return function (input) {
return filterArray.reduce(function (previousValue, filter) {
return filter.call(this, previousValue);
}.bind(this), input);
};
} | [
"function",
"(",
"filterArray",
")",
"{",
"return",
"function",
"(",
"input",
")",
"{",
"return",
"filterArray",
".",
"reduce",
"(",
"function",
"(",
"previousValue",
",",
"filter",
")",
"{",
"return",
"filter",
".",
"call",
"(",
"this",
",",
"previousValu... | Given some input text and a array of filters,
we sequentially apply the filters to get the final value
@param filterArray
@returns function | [
"Given",
"some",
"input",
"text",
"and",
"a",
"array",
"of",
"filters",
"we",
"sequentially",
"apply",
"the",
"filters",
"to",
"get",
"the",
"final",
"value"
] | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L406-L412 | |
45,590 | Sobesednik/wrote | es5/src/read-dir.js | filterFiles | function filterFiles(files, recursive) {
var fileOrDir = function fileOrDir(lstat) {
return lstat.isFile() || lstat.isDirectory();
};
return files.filter(function (_ref) {
var lstat = _ref.lstat;
return recursive ? fileOrDir(lstat) : lstat.isFile();
});
} | javascript | function filterFiles(files, recursive) {
var fileOrDir = function fileOrDir(lstat) {
return lstat.isFile() || lstat.isDirectory();
};
return files.filter(function (_ref) {
var lstat = _ref.lstat;
return recursive ? fileOrDir(lstat) : lstat.isFile();
});
} | [
"function",
"filterFiles",
"(",
"files",
",",
"recursive",
")",
"{",
"var",
"fileOrDir",
"=",
"function",
"fileOrDir",
"(",
"lstat",
")",
"{",
"return",
"lstat",
".",
"isFile",
"(",
")",
"||",
"lstat",
".",
"isDirectory",
"(",
")",
";",
"}",
";",
"retu... | Filter lstat results, taking only files if recursive is false.
@param {lstat[]} files An array with lstat results
@param {boolean} [recursive = false] Whether recursive mode is on
@returns {lstat[]} Filtered array. | [
"Filter",
"lstat",
"results",
"taking",
"only",
"files",
"if",
"recursive",
"is",
"false",
"."
] | 24992ad3bba4e5959dfb617b6c1f22d9a1306ab9 | https://github.com/Sobesednik/wrote/blob/24992ad3bba4e5959dfb617b6c1f22d9a1306ab9/es5/src/read-dir.js#L16-L25 |
45,591 | plum-css/plum-fixture | lib/generator.js | extractFolders | function extractFolders( files ) {
return files.data.files.map( function extractPath( file ) {
return path.parse( file ).dir;
}).filter( function extractUnique( path, index, array ) {
return array.indexOf( path ) === index;
});
} | javascript | function extractFolders( files ) {
return files.data.files.map( function extractPath( file ) {
return path.parse( file ).dir;
}).filter( function extractUnique( path, index, array ) {
return array.indexOf( path ) === index;
});
} | [
"function",
"extractFolders",
"(",
"files",
")",
"{",
"return",
"files",
".",
"data",
".",
"files",
".",
"map",
"(",
"function",
"extractPath",
"(",
"file",
")",
"{",
"return",
"path",
".",
"parse",
"(",
"file",
")",
".",
"dir",
";",
"}",
")",
".",
... | Parses retrieved KSS meta data and extracts a list of folders to create fixtures for.
@param {array} files - a list of all the files retrieved from the KSS meta data.
@returns {array} a list of all the folders to create fixtures for. | [
"Parses",
"retrieved",
"KSS",
"meta",
"data",
"and",
"extracts",
"a",
"list",
"of",
"folders",
"to",
"create",
"fixtures",
"for",
"."
] | 2cd69772c7888f2c787641e2ef65d54cb1af839f | https://github.com/plum-css/plum-fixture/blob/2cd69772c7888f2c787641e2ef65d54cb1af839f/lib/generator.js#L71-L77 |
45,592 | plum-css/plum-fixture | lib/generator.js | createFixtures | function createFixtures( path ) {
return parseKSS( path )
.then( extractFixturesData )
.then( function( data ) {
return saveFixture( data[0].name, data, path );
})
} | javascript | function createFixtures( path ) {
return parseKSS( path )
.then( extractFixturesData )
.then( function( data ) {
return saveFixture( data[0].name, data, path );
})
} | [
"function",
"createFixtures",
"(",
"path",
")",
"{",
"return",
"parseKSS",
"(",
"path",
")",
".",
"then",
"(",
"extractFixturesData",
")",
".",
"then",
"(",
"function",
"(",
"data",
")",
"{",
"return",
"saveFixture",
"(",
"data",
"[",
"0",
"]",
".",
"n... | Parses a folder of stylesheets containing KSS meta data and creates and saves a fixture.
@param {string} path - build and save a fixture for this path. | [
"Parses",
"a",
"folder",
"of",
"stylesheets",
"containing",
"KSS",
"meta",
"data",
"and",
"creates",
"and",
"saves",
"a",
"fixture",
"."
] | 2cd69772c7888f2c787641e2ef65d54cb1af839f | https://github.com/plum-css/plum-fixture/blob/2cd69772c7888f2c787641e2ef65d54cb1af839f/lib/generator.js#L84-L90 |
45,593 | plum-css/plum-fixture | lib/generator.js | extractFixturesData | function extractFixturesData( data ) {
return Promise.map( data.section(), function( section ) {
var markup = section.markup();
var ext = path.extname( markup );
var testDir = data.data.files[0].split("/")
.filter(function(dir, i) {
return i <= 2;
})
... | javascript | function extractFixturesData( data ) {
return Promise.map( data.section(), function( section ) {
var markup = section.markup();
var ext = path.extname( markup );
var testDir = data.data.files[0].split("/")
.filter(function(dir, i) {
return i <= 2;
})
... | [
"function",
"extractFixturesData",
"(",
"data",
")",
"{",
"return",
"Promise",
".",
"map",
"(",
"data",
".",
"section",
"(",
")",
",",
"function",
"(",
"section",
")",
"{",
"var",
"markup",
"=",
"section",
".",
"markup",
"(",
")",
";",
"var",
"ext",
... | Builds an object out of KSS meta data that can be used to populate a template.
@param {object} - kss meta data object
@returns {Promise.array} array of fixture data that can be used to populate a template. | [
"Builds",
"an",
"object",
"out",
"of",
"KSS",
"meta",
"data",
"that",
"can",
"be",
"used",
"to",
"populate",
"a",
"template",
"."
] | 2cd69772c7888f2c787641e2ef65d54cb1af839f | https://github.com/plum-css/plum-fixture/blob/2cd69772c7888f2c787641e2ef65d54cb1af839f/lib/generator.js#L98-L116 |
45,594 | plum-css/plum-fixture | lib/generator.js | saveFixture | function saveFixture( name, data, directory ) {
return fs.readFileAsync( template, 'utf8' )
.then( function renderTemplate( template ) {
return mustache.render( template, { stylesheets: stylesheets, sections: data } );
}).then( function saveTemplate( templateData ) {
return fs.outputFile... | javascript | function saveFixture( name, data, directory ) {
return fs.readFileAsync( template, 'utf8' )
.then( function renderTemplate( template ) {
return mustache.render( template, { stylesheets: stylesheets, sections: data } );
}).then( function saveTemplate( templateData ) {
return fs.outputFile... | [
"function",
"saveFixture",
"(",
"name",
",",
"data",
",",
"directory",
")",
"{",
"return",
"fs",
".",
"readFileAsync",
"(",
"template",
",",
"'utf8'",
")",
".",
"then",
"(",
"function",
"renderTemplate",
"(",
"template",
")",
"{",
"return",
"mustache",
"."... | Populates a template and saves it as a fixture file.
@param {object} name - the name of the data sections.
@param {array} data - template data array.
@param {string} directory - parent directory to save the fixture to.
@returns {Promise} | [
"Populates",
"a",
"template",
"and",
"saves",
"it",
"as",
"a",
"fixture",
"file",
"."
] | 2cd69772c7888f2c787641e2ef65d54cb1af839f | https://github.com/plum-css/plum-fixture/blob/2cd69772c7888f2c787641e2ef65d54cb1af839f/lib/generator.js#L126-L133 |
45,595 | syntax-tree/hast-util-to-dom | src/index.js | root | function root(node, options = {}) {
const {
fragment,
namespace: optionsNamespace,
} = options;
const { children = [] } = node;
const { length: childrenLength } = children;
let namespace = optionsNamespace;
let rootIsDocument = childrenLength === 0;
for (let i = 0; i < childrenLength; i += 1) {
... | javascript | function root(node, options = {}) {
const {
fragment,
namespace: optionsNamespace,
} = options;
const { children = [] } = node;
const { length: childrenLength } = children;
let namespace = optionsNamespace;
let rootIsDocument = childrenLength === 0;
for (let i = 0; i < childrenLength; i += 1) {
... | [
"function",
"root",
"(",
"node",
",",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"{",
"fragment",
",",
"namespace",
":",
"optionsNamespace",
",",
"}",
"=",
"options",
";",
"const",
"{",
"children",
"=",
"[",
"]",
"}",
"=",
"node",
";",
"const",
"... | Transform a document | [
"Transform",
"a",
"document"
] | f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62 | https://github.com/syntax-tree/hast-util-to-dom/blob/f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62/src/index.js#L29-L81 |
45,596 | syntax-tree/hast-util-to-dom | src/index.js | doctype | function doctype(node) {
return document.implementation.createDocumentType(
node.name || 'html',
node.public || '',
node.system || '',
);
} | javascript | function doctype(node) {
return document.implementation.createDocumentType(
node.name || 'html',
node.public || '',
node.system || '',
);
} | [
"function",
"doctype",
"(",
"node",
")",
"{",
"return",
"document",
".",
"implementation",
".",
"createDocumentType",
"(",
"node",
".",
"name",
"||",
"'html'",
",",
"node",
".",
"public",
"||",
"''",
",",
"node",
".",
"system",
"||",
"''",
",",
")",
";... | Transform a DOCTYPE | [
"Transform",
"a",
"DOCTYPE"
] | f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62 | https://github.com/syntax-tree/hast-util-to-dom/blob/f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62/src/index.js#L86-L92 |
45,597 | syntax-tree/hast-util-to-dom | src/index.js | element | function element(node, options = {}) {
const { namespace } = options;
const { tagName, properties, children = [] } = node;
const el = typeof namespace !== 'undefined'
? document.createElementNS(namespace, tagName)
: document.createElement(tagName);
// Add HTML attributes
const props = Object.keys(pro... | javascript | function element(node, options = {}) {
const { namespace } = options;
const { tagName, properties, children = [] } = node;
const el = typeof namespace !== 'undefined'
? document.createElementNS(namespace, tagName)
: document.createElement(tagName);
// Add HTML attributes
const props = Object.keys(pro... | [
"function",
"element",
"(",
"node",
",",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"{",
"namespace",
"}",
"=",
"options",
";",
"const",
"{",
"tagName",
",",
"properties",
",",
"children",
"=",
"[",
"]",
"}",
"=",
"node",
";",
"const",
"el",
"=",... | Transform an element | [
"Transform",
"an",
"element"
] | f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62 | https://github.com/syntax-tree/hast-util-to-dom/blob/f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62/src/index.js#L111-L187 |
45,598 | CollinEstes/astro-cli | src/processCommands.js | processCommand | function processCommand (cmd, options) {
var module = checkForModule(cmd);
// execute module if exists
if (module) {
return executeModule(module, options);
} else {
processInstallCommands(['install', cmd], options, function (err) {
if (err) {
noModuleFound(cmd);
}
module = checkForModule(cmd);
... | javascript | function processCommand (cmd, options) {
var module = checkForModule(cmd);
// execute module if exists
if (module) {
return executeModule(module, options);
} else {
processInstallCommands(['install', cmd], options, function (err) {
if (err) {
noModuleFound(cmd);
}
module = checkForModule(cmd);
... | [
"function",
"processCommand",
"(",
"cmd",
",",
"options",
")",
"{",
"var",
"module",
"=",
"checkForModule",
"(",
"cmd",
")",
";",
"// execute module if exists",
"if",
"(",
"module",
")",
"{",
"return",
"executeModule",
"(",
"module",
",",
"options",
")",
";"... | process the command | [
"process",
"the",
"command"
] | 261cdecade954f9b4277ccf968b577513edda587 | https://github.com/CollinEstes/astro-cli/blob/261cdecade954f9b4277ccf968b577513edda587/src/processCommands.js#L38-L57 |
45,599 | mchalapuk/hyper-text-slider | lib/core/phaser.js | Phaser | function Phaser(element) {
check(element, 'element').is.anInstanceOf(Element)();
var priv = {};
priv.elem = element;
priv.phase = null;
priv.listeners = [];
priv.phaseTriggers = new MultiMap();
priv.started = false;
var pub = {};
var methods = [
getPhase,
nextPhase,
addPhaseListener,
... | javascript | function Phaser(element) {
check(element, 'element').is.anInstanceOf(Element)();
var priv = {};
priv.elem = element;
priv.phase = null;
priv.listeners = [];
priv.phaseTriggers = new MultiMap();
priv.started = false;
var pub = {};
var methods = [
getPhase,
nextPhase,
addPhaseListener,
... | [
"function",
"Phaser",
"(",
"element",
")",
"{",
"check",
"(",
"element",
",",
"'element'",
")",
".",
"is",
".",
"anInstanceOf",
"(",
"Element",
")",
"(",
")",
";",
"var",
"priv",
"=",
"{",
"}",
";",
"priv",
".",
"elem",
"=",
"element",
";",
"priv",... | Creates Phaser.
This constructor has no side-effects. This means that no ${link Phase phase class name}
is set on given **element** and no eventlistener is set after calling it. For phaser to start
doing some work, ${link Phaser.prototype.setPhase}, ${link Phaser.prototype.startTransition}
or ${link Phaser.prototype.a... | [
"Creates",
"Phaser",
"."
] | 2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4 | https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/phaser.js#L81-L109 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.