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,200 | edappy/seneca-context | index.js | getContext | function getContext(seneca) {
var transactionId = seneca.fixedargs.tx$;
var context = seneca.fixedargs.context$;
if (typeof context === 'undefined') {
try {
context = seneca.fixedargs.context$ = JSON.parse(URLSafeBase64.decode(transactionId).toString('utf8'));
debug('context loaded from tx$ and c... | javascript | function getContext(seneca) {
var transactionId = seneca.fixedargs.tx$;
var context = seneca.fixedargs.context$;
if (typeof context === 'undefined') {
try {
context = seneca.fixedargs.context$ = JSON.parse(URLSafeBase64.decode(transactionId).toString('utf8'));
debug('context loaded from tx$ and c... | [
"function",
"getContext",
"(",
"seneca",
")",
"{",
"var",
"transactionId",
"=",
"seneca",
".",
"fixedargs",
".",
"tx$",
";",
"var",
"context",
"=",
"seneca",
".",
"fixedargs",
".",
"context$",
";",
"if",
"(",
"typeof",
"context",
"===",
"'undefined'",
")",... | Loads the context from the seneca transaction ID.
@param {seneca} seneca The seneca object, which is the context of a running action.
@returns {Object} A context object | [
"Loads",
"the",
"context",
"from",
"the",
"seneca",
"transaction",
"ID",
"."
] | 1e0c8d36c5be4b661b062754c01f064de47873c4 | https://github.com/edappy/seneca-context/blob/1e0c8d36c5be4b661b062754c01f064de47873c4/index.js#L17-L34 |
45,201 | edappy/seneca-context | index.js | setContext | function setContext(seneca, context) {
seneca.fixedargs.tx$ = URLSafeBase64.encode(new Buffer(JSON.stringify(context)));
seneca.fixedargs.context$ = context;
debug('context saved', seneca.fixedargs.tx$, context);
} | javascript | function setContext(seneca, context) {
seneca.fixedargs.tx$ = URLSafeBase64.encode(new Buffer(JSON.stringify(context)));
seneca.fixedargs.context$ = context;
debug('context saved', seneca.fixedargs.tx$, context);
} | [
"function",
"setContext",
"(",
"seneca",
",",
"context",
")",
"{",
"seneca",
".",
"fixedargs",
".",
"tx$",
"=",
"URLSafeBase64",
".",
"encode",
"(",
"new",
"Buffer",
"(",
"JSON",
".",
"stringify",
"(",
"context",
")",
")",
")",
";",
"seneca",
".",
"fix... | Saves the specified context inside the seneca transaction ID.
@param {seneca} seneca The seneca object, which is the context of a running action.
@param {Object} context A context object | [
"Saves",
"the",
"specified",
"context",
"inside",
"the",
"seneca",
"transaction",
"ID",
"."
] | 1e0c8d36c5be4b661b062754c01f064de47873c4 | https://github.com/edappy/seneca-context/blob/1e0c8d36c5be4b661b062754c01f064de47873c4/index.js#L42-L46 |
45,202 | cfpb/AtomicComponent | src/utilities/transition/BaseTransition.js | setElement | function setElement( targetElement ) {
// If the element has already been set,
// clear the transition classes from the old element.
if ( _dom ) {
remove();
animateOn();
}
_dom = targetElement;
_dom.classList.add( _classes.BASE_CLASS );
_transitionEndEvent = _getTransitionEndEven... | javascript | function setElement( targetElement ) {
// If the element has already been set,
// clear the transition classes from the old element.
if ( _dom ) {
remove();
animateOn();
}
_dom = targetElement;
_dom.classList.add( _classes.BASE_CLASS );
_transitionEndEvent = _getTransitionEndEven... | [
"function",
"setElement",
"(",
"targetElement",
")",
"{",
"// If the element has already been set,",
"// clear the transition classes from the old element.",
"if",
"(",
"_dom",
")",
"{",
"remove",
"(",
")",
";",
"animateOn",
"(",
")",
";",
"}",
"_dom",
"=",
"targetEle... | Set the HTML element target of this transition.
@param {HTMLNode} targetElement - The target of the transition. | [
"Set",
"the",
"HTML",
"element",
"target",
"of",
"this",
"transition",
"."
] | f45d7ded6687672c8b701c9910ddfe90c7ede742 | https://github.com/cfpb/AtomicComponent/blob/f45d7ded6687672c8b701c9910ddfe90c7ede742/src/utilities/transition/BaseTransition.js#L47-L57 |
45,203 | cfpb/AtomicComponent | src/utilities/transition/BaseTransition.js | halt | function halt() {
if ( !_isAnimating ) { return; }
_dom.style.webkitTransitionDuration = '0';
_dom.style.mozTransitionDuration = '0';
_dom.style.oTransitionDuration = '0';
_dom.style.transitionDuration = '0';
_dom.removeEventListener( _transitionEndEvent,
_transitio... | javascript | function halt() {
if ( !_isAnimating ) { return; }
_dom.style.webkitTransitionDuration = '0';
_dom.style.mozTransitionDuration = '0';
_dom.style.oTransitionDuration = '0';
_dom.style.transitionDuration = '0';
_dom.removeEventListener( _transitionEndEvent,
_transitio... | [
"function",
"halt",
"(",
")",
"{",
"if",
"(",
"!",
"_isAnimating",
")",
"{",
"return",
";",
"}",
"_dom",
".",
"style",
".",
"webkitTransitionDuration",
"=",
"'0'",
";",
"_dom",
".",
"style",
".",
"mozTransitionDuration",
"=",
"'0'",
";",
"_dom",
".",
"... | Halt an in-progress animation and call the complete event immediately. | [
"Halt",
"an",
"in",
"-",
"progress",
"animation",
"and",
"call",
"the",
"complete",
"event",
"immediately",
"."
] | f45d7ded6687672c8b701c9910ddfe90c7ede742 | https://github.com/cfpb/AtomicComponent/blob/f45d7ded6687672c8b701c9910ddfe90c7ede742/src/utilities/transition/BaseTransition.js#L93-L106 |
45,204 | cfpb/AtomicComponent | src/utilities/transition/BaseTransition.js | _addEventListener | function _addEventListener() {
_isAnimating = true;
// If transition is not supported, call handler directly (IE9/OperaMini).
if ( _transitionEndEvent ) {
_dom.addEventListener( _transitionEndEvent,
_transitionCompleteBinded );
this.trigger( BaseTransition.BEGIN_EVEN... | javascript | function _addEventListener() {
_isAnimating = true;
// If transition is not supported, call handler directly (IE9/OperaMini).
if ( _transitionEndEvent ) {
_dom.addEventListener( _transitionEndEvent,
_transitionCompleteBinded );
this.trigger( BaseTransition.BEGIN_EVEN... | [
"function",
"_addEventListener",
"(",
")",
"{",
"_isAnimating",
"=",
"true",
";",
"// If transition is not supported, call handler directly (IE9/OperaMini).",
"if",
"(",
"_transitionEndEvent",
")",
"{",
"_dom",
".",
"addEventListener",
"(",
"_transitionEndEvent",
",",
"_tra... | Add an event listener to the transition, or call the transition
complete handler immediately if transition not supported. | [
"Add",
"an",
"event",
"listener",
"to",
"the",
"transition",
"or",
"call",
"the",
"transition",
"complete",
"handler",
"immediately",
"if",
"transition",
"not",
"supported",
"."
] | f45d7ded6687672c8b701c9910ddfe90c7ede742 | https://github.com/cfpb/AtomicComponent/blob/f45d7ded6687672c8b701c9910ddfe90c7ede742/src/utilities/transition/BaseTransition.js#L112-L123 |
45,205 | cfpb/AtomicComponent | src/utilities/transition/BaseTransition.js | _flush | function _flush() {
for ( const prop in _classes ) {
if ( _classes.hasOwnProperty( prop ) &&
_classes[prop] !== _classes.BASE_CLASS &&
_dom.classList.contains( _classes[prop] ) ) {
_dom.classList.remove( _classes[prop] );
}
}
} | javascript | function _flush() {
for ( const prop in _classes ) {
if ( _classes.hasOwnProperty( prop ) &&
_classes[prop] !== _classes.BASE_CLASS &&
_dom.classList.contains( _classes[prop] ) ) {
_dom.classList.remove( _classes[prop] );
}
}
} | [
"function",
"_flush",
"(",
")",
"{",
"for",
"(",
"const",
"prop",
"in",
"_classes",
")",
"{",
"if",
"(",
"_classes",
".",
"hasOwnProperty",
"(",
"prop",
")",
"&&",
"_classes",
"[",
"prop",
"]",
"!==",
"_classes",
".",
"BASE_CLASS",
"&&",
"_dom",
".",
... | Search for and remove initial BaseTransition classes that have
already been applied to this BaseTransition's target element. | [
"Search",
"for",
"and",
"remove",
"initial",
"BaseTransition",
"classes",
"that",
"have",
"already",
"been",
"applied",
"to",
"this",
"BaseTransition",
"s",
"target",
"element",
"."
] | f45d7ded6687672c8b701c9910ddfe90c7ede742 | https://github.com/cfpb/AtomicComponent/blob/f45d7ded6687672c8b701c9910ddfe90c7ede742/src/utilities/transition/BaseTransition.js#L145-L153 |
45,206 | cfpb/AtomicComponent | src/utilities/transition/BaseTransition.js | remove | function remove() {
if ( _dom ) {
halt();
_dom.classList.remove( _classes.BASE_CLASS );
_flush();
return true;
}
return false;
} | javascript | function remove() {
if ( _dom ) {
halt();
_dom.classList.remove( _classes.BASE_CLASS );
_flush();
return true;
}
return false;
} | [
"function",
"remove",
"(",
")",
"{",
"if",
"(",
"_dom",
")",
"{",
"halt",
"(",
")",
";",
"_dom",
".",
"classList",
".",
"remove",
"(",
"_classes",
".",
"BASE_CLASS",
")",
";",
"_flush",
"(",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
... | Remove all transition classes, if transition is initialized.
@returns {boolean}
True, if the element's CSS classes were touched, false otherwise. | [
"Remove",
"all",
"transition",
"classes",
"if",
"transition",
"is",
"initialized",
"."
] | f45d7ded6687672c8b701c9910ddfe90c7ede742 | https://github.com/cfpb/AtomicComponent/blob/f45d7ded6687672c8b701c9910ddfe90c7ede742/src/utilities/transition/BaseTransition.js#L160-L169 |
45,207 | henrytseng/angular-state-router | src/services/queue-handler.js | function(handler, priority) {
if(handler && handler.constructor === Array) {
handler.forEach(function(layer) {
layer.priority = typeof layer.priority === 'undefined' ? 1 : layer.priority;
});
_list = _list.concat(handler);
} else {
handler.priority = p... | javascript | function(handler, priority) {
if(handler && handler.constructor === Array) {
handler.forEach(function(layer) {
layer.priority = typeof layer.priority === 'undefined' ? 1 : layer.priority;
});
_list = _list.concat(handler);
} else {
handler.priority = p... | [
"function",
"(",
"handler",
",",
"priority",
")",
"{",
"if",
"(",
"handler",
"&&",
"handler",
".",
"constructor",
"===",
"Array",
")",
"{",
"handler",
".",
"forEach",
"(",
"function",
"(",
"layer",
")",
"{",
"layer",
".",
"priority",
"=",
"typeof",
"la... | Add a handler
@param {Mixed} handler A Function or an Array of Functions to add to the queue
@return {Queue} Itself; chainable | [
"Add",
"a",
"handler"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/queue-handler.js#L20-L31 | |
45,208 | henrytseng/angular-state-router | src/services/queue-handler.js | function(callback) {
var nextHandler;
var executionList = _list.slice(0).sort(function(a, b) {
return Math.max(-1, Math.min(1, b.priority - a.priority));
});
nextHandler = function() {
$rootScope.$evalAsync(function() {
var handler = executionList.shift()... | javascript | function(callback) {
var nextHandler;
var executionList = _list.slice(0).sort(function(a, b) {
return Math.max(-1, Math.min(1, b.priority - a.priority));
});
nextHandler = function() {
$rootScope.$evalAsync(function() {
var handler = executionList.shift()... | [
"function",
"(",
"callback",
")",
"{",
"var",
"nextHandler",
";",
"var",
"executionList",
"=",
"_list",
".",
"slice",
"(",
"0",
")",
".",
"sort",
"(",
"function",
"(",
"a",
",",
"b",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"-",
"1",
",",
"Ma... | Begin execution and trigger callback at the end
@param {Function} callback A callback, function(err)
@return {Queue} Itself; chainable | [
"Begin",
"execution",
"and",
"trigger",
"callback",
"at",
"the",
"end"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/queue-handler.js#L50-L82 | |
45,209 | glaunay/ms-jobmanager | build/index.js | isSpecs | function isSpecs(opt) {
//logger.debug('???');
//logger.debug(`${opt.cacheDir}`);
//let b:any = opt.cacheDir instanceof(String)
if (!path.isAbsolute(opt.cacheDir)) {
logger.error('cacheDir parameter must be an absolute path');
return false;
}
if ('cacheDir' in opt && 'tcp' in opt... | javascript | function isSpecs(opt) {
//logger.debug('???');
//logger.debug(`${opt.cacheDir}`);
//let b:any = opt.cacheDir instanceof(String)
if (!path.isAbsolute(opt.cacheDir)) {
logger.error('cacheDir parameter must be an absolute path');
return false;
}
if ('cacheDir' in opt && 'tcp' in opt... | [
"function",
"isSpecs",
"(",
"opt",
")",
"{",
"//logger.debug('???');",
"//logger.debug(`${opt.cacheDir}`);",
"//let b:any = opt.cacheDir instanceof(String)",
"if",
"(",
"!",
"path",
".",
"isAbsolute",
"(",
"opt",
".",
"cacheDir",
")",
")",
"{",
"logger",
".",
"error",... | VR change typeguard to warehouse | [
"VR",
"change",
"typeguard",
"to",
"warehouse"
] | 997d4fb25fd1d2b41acfae1dd576b33f2c92bd15 | https://github.com/glaunay/ms-jobmanager/blob/997d4fb25fd1d2b41acfae1dd576b33f2c92bd15/build/index.js#L50-L63 |
45,210 | glaunay/ms-jobmanager | build/index.js | pushMS | function pushMS(data, socket) {
logger.debug(`newJob Packet arrived w/ ${util.format(data)}`);
logger.silly(` Memory size vs nWorker :: ${liveMemory.size()} <<>> ${nWorker}`);
if (liveMemory.size("notBound") >= nWorker) {
logger.debug("must refuse packet, max pool size reached");
jmServer.bo... | javascript | function pushMS(data, socket) {
logger.debug(`newJob Packet arrived w/ ${util.format(data)}`);
logger.silly(` Memory size vs nWorker :: ${liveMemory.size()} <<>> ${nWorker}`);
if (liveMemory.size("notBound") >= nWorker) {
logger.debug("must refuse packet, max pool size reached");
jmServer.bo... | [
"function",
"pushMS",
"(",
"data",
",",
"socket",
")",
"{",
"logger",
".",
"debug",
"(",
"`",
"${",
"util",
".",
"format",
"(",
"data",
")",
"}",
"`",
")",
";",
"logger",
".",
"silly",
"(",
"`",
"${",
"liveMemory",
".",
"size",
"(",
")",
"}",
"... | New job packet arrived on MS socket, 1st arg is streamMap, 2nd the socket | [
"New",
"job",
"packet",
"arrived",
"on",
"MS",
"socket",
"1st",
"arg",
"is",
"streamMap",
"2nd",
"the",
"socket"
] | 997d4fb25fd1d2b41acfae1dd576b33f2c92bd15 | https://github.com/glaunay/ms-jobmanager/blob/997d4fb25fd1d2b41acfae1dd576b33f2c92bd15/build/index.js#L271-L289 |
45,211 | jrmerz/node-ckan | index.js | addFileResource | function addFileResource(cmd, file, params, callback) {
if( !file ) return callback({error:true,message:"no file provided"});
if( !fs.existsSync(file) ) return callback({error:true,message:"no file found: "+file});
if( !fs.statSync(file).isFile() ) return callback({error:true,message:"not a file: "+file});
... | javascript | function addFileResource(cmd, file, params, callback) {
if( !file ) return callback({error:true,message:"no file provided"});
if( !fs.existsSync(file) ) return callback({error:true,message:"no file found: "+file});
if( !fs.statSync(file).isFile() ) return callback({error:true,message:"not a file: "+file});
... | [
"function",
"addFileResource",
"(",
"cmd",
",",
"file",
",",
"params",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"file",
")",
"return",
"callback",
"(",
"{",
"error",
":",
"true",
",",
"message",
":",
"\"no file provided\"",
"}",
")",
";",
"if",
"(",
... | todo, check for read access | [
"todo",
"check",
"for",
"read",
"access"
] | 55f6bb1ece7f57ccd5ba57be7888e4d3941bc659 | https://github.com/jrmerz/node-ckan/blob/55f6bb1ece7f57ccd5ba57be7888e4d3941bc659/index.js#L112-L154 |
45,212 | rBurgett/simple-sort | src/main.js | function(locale) {
this.intCol = (Intl && Intl.Collator) ? new Intl.Collator(locale) : new CollatorPolyfill(locale);
} | javascript | function(locale) {
this.intCol = (Intl && Intl.Collator) ? new Intl.Collator(locale) : new CollatorPolyfill(locale);
} | [
"function",
"(",
"locale",
")",
"{",
"this",
".",
"intCol",
"=",
"(",
"Intl",
"&&",
"Intl",
".",
"Collator",
")",
"?",
"new",
"Intl",
".",
"Collator",
"(",
"locale",
")",
":",
"new",
"CollatorPolyfill",
"(",
"locale",
")",
";",
"}"
] | Constructs a sorter instance.
@constructor Sorter
@param {string} [locale] - the locale to sort by (e.g. 'en-US') | [
"Constructs",
"a",
"sorter",
"instance",
"."
] | 1c27912b3dce1e581b2817dbe599fdfe7b8d1781 | https://github.com/rBurgett/simple-sort/blob/1c27912b3dce1e581b2817dbe599fdfe7b8d1781/src/main.js#L13-L15 | |
45,213 | ryb73/dealers-choice-meta | packages/server/lib/game-managers/choice-provider/handle-bidding.js | giveAnswer | function giveAnswer(answeringPlayer, answer) {
if(answeringPlayer === seller) return;
if(answer <= currentBid) return;
buyer = answeringPlayer;
currentBid = answer;
resetTimer();
notify(false);
} | javascript | function giveAnswer(answeringPlayer, answer) {
if(answeringPlayer === seller) return;
if(answer <= currentBid) return;
buyer = answeringPlayer;
currentBid = answer;
resetTimer();
notify(false);
} | [
"function",
"giveAnswer",
"(",
"answeringPlayer",
",",
"answer",
")",
"{",
"if",
"(",
"answeringPlayer",
"===",
"seller",
")",
"return",
";",
"if",
"(",
"answer",
"<=",
"currentBid",
")",
"return",
";",
"buyer",
"=",
"answeringPlayer",
";",
"currentBid",
"="... | answer is the bid amount | [
"answer",
"is",
"the",
"bid",
"amount"
] | 4632e8897c832b01d944a340cf87d5c807809925 | https://github.com/ryb73/dealers-choice-meta/blob/4632e8897c832b01d944a340cf87d5c807809925/packages/server/lib/game-managers/choice-provider/handle-bidding.js#L74-L83 |
45,214 | sham-ui/sham-ui | src/options/decorator.js | hoistingOptions | function hoistingOptions( target ) {
if ( !target.hasOwnProperty( '_options' ) ) {
let options;
if ( undefined === target._options ) {
options = {};
} else {
// Create copy with descriptors
options = Object.create(
null,
Ob... | javascript | function hoistingOptions( target ) {
if ( !target.hasOwnProperty( '_options' ) ) {
let options;
if ( undefined === target._options ) {
options = {};
} else {
// Create copy with descriptors
options = Object.create(
null,
Ob... | [
"function",
"hoistingOptions",
"(",
"target",
")",
"{",
"if",
"(",
"!",
"target",
".",
"hasOwnProperty",
"(",
"'_options'",
")",
")",
"{",
"let",
"options",
";",
"if",
"(",
"undefined",
"===",
"target",
".",
"_options",
")",
"{",
"options",
"=",
"{",
"... | Hoisting options in prototype chain
@param {Object} target | [
"Hoisting",
"options",
"in",
"prototype",
"chain"
] | d4a1a43deac246575557c5cca86fc5a7e7a1dd9f | https://github.com/sham-ui/sham-ui/blob/d4a1a43deac246575557c5cca86fc5a7e7a1dd9f/src/options/decorator.js#L5-L24 |
45,215 | mikolalysenko/overlay-pslg | overlay-pslg.js | markCells | function markCells(cells, adj, edges) {
//Initialize active/next queues and flags
var flags = new Array(cells.length)
var constraint = new Array(3*cells.length)
for(var i=0; i<3*cells.length; ++i) {
constraint[i] = false
}
var active = []
var next = []
for(var i=0; i<cells.length; ++i) {
var ... | javascript | function markCells(cells, adj, edges) {
//Initialize active/next queues and flags
var flags = new Array(cells.length)
var constraint = new Array(3*cells.length)
for(var i=0; i<3*cells.length; ++i) {
constraint[i] = false
}
var active = []
var next = []
for(var i=0; i<cells.length; ++i) {
var ... | [
"function",
"markCells",
"(",
"cells",
",",
"adj",
",",
"edges",
")",
"{",
"//Initialize active/next queues and flags",
"var",
"flags",
"=",
"new",
"Array",
"(",
"cells",
".",
"length",
")",
"var",
"constraint",
"=",
"new",
"Array",
"(",
"3",
"*",
"cells",
... | Classify all cells within boundary | [
"Classify",
"all",
"cells",
"within",
"boundary"
] | 7f6490b5c44ecf2078dc17cbce252a190b734cbc | https://github.com/mikolalysenko/overlay-pslg/blob/7f6490b5c44ecf2078dc17cbce252a190b734cbc/overlay-pslg.js#L108-L169 |
45,216 | writetome51/array-has | dist/privy/arrayHasAny.js | arrayHasAny | function arrayHasAny(values, array) {
error_if_not_array_1.errorIfNotArray(values);
var i = -1;
while (++i < values.length) {
if (arrayHas_1.arrayHas(values[i], array))
return true;
}
return false;
} | javascript | function arrayHasAny(values, array) {
error_if_not_array_1.errorIfNotArray(values);
var i = -1;
while (++i < values.length) {
if (arrayHas_1.arrayHas(values[i], array))
return true;
}
return false;
} | [
"function",
"arrayHasAny",
"(",
"values",
",",
"array",
")",
"{",
"error_if_not_array_1",
".",
"errorIfNotArray",
"(",
"values",
")",
";",
"var",
"i",
"=",
"-",
"1",
";",
"while",
"(",
"++",
"i",
"<",
"values",
".",
"length",
")",
"{",
"if",
"(",
"ar... | values cannot contain object. | [
"values",
"cannot",
"contain",
"object",
"."
] | 8ced3fda5818940b814bbcdc37e03c65f285a965 | https://github.com/writetome51/array-has/blob/8ced3fda5818940b814bbcdc37e03c65f285a965/dist/privy/arrayHasAny.js#L6-L14 |
45,217 | RainBirdAi/rainbird-linter | report.js | setJSHint | function setJSHint(path, done) {
var opts = JSON.parse(fs.readFileSync(path, 'utf8'));
jsHintOptions.config = opts;
done();
} | javascript | function setJSHint(path, done) {
var opts = JSON.parse(fs.readFileSync(path, 'utf8'));
jsHintOptions.config = opts;
done();
} | [
"function",
"setJSHint",
"(",
"path",
",",
"done",
")",
"{",
"var",
"opts",
"=",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"path",
",",
"'utf8'",
")",
")",
";",
"jsHintOptions",
".",
"config",
"=",
"opts",
";",
"done",
"(",
")",
";... | Plato uses the `jshintrc` as is, whereas JSHint-Build needs the options inserted into its own options. | [
"Plato",
"uses",
"the",
"jshintrc",
"as",
"is",
"whereas",
"JSHint",
"-",
"Build",
"needs",
"the",
"options",
"inserted",
"into",
"its",
"own",
"options",
"."
] | 2831a0286bfe3fb956b5188f0508752c6d16a4de | https://github.com/RainBirdAi/rainbird-linter/blob/2831a0286bfe3fb956b5188f0508752c6d16a4de/report.js#L50-L55 |
45,218 | RainBirdAi/rainbird-linter | report.js | checkJSHint | function checkJSHint(done) {
if(!options.jshint) {
options.jshint = path.join(__dirname, '.jshintrc');
}
checkPath(options.jshint, setJSHint, done);
} | javascript | function checkJSHint(done) {
if(!options.jshint) {
options.jshint = path.join(__dirname, '.jshintrc');
}
checkPath(options.jshint, setJSHint, done);
} | [
"function",
"checkJSHint",
"(",
"done",
")",
"{",
"if",
"(",
"!",
"options",
".",
"jshint",
")",
"{",
"options",
".",
"jshint",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'.jshintrc'",
")",
";",
"}",
"checkPath",
"(",
"options",
".",
"jshint",
... | The default `jshintrc` from the linter package can be overridden with the `jshint` option. The provided file is checked to ensure it exists before it's used. | [
"The",
"default",
"jshintrc",
"from",
"the",
"linter",
"package",
"can",
"be",
"overridden",
"with",
"the",
"jshint",
"option",
".",
"The",
"provided",
"file",
"is",
"checked",
"to",
"ensure",
"it",
"exists",
"before",
"it",
"s",
"used",
"."
] | 2831a0286bfe3fb956b5188f0508752c6d16a4de | https://github.com/RainBirdAi/rainbird-linter/blob/2831a0286bfe3fb956b5188f0508752c6d16a4de/report.js#L61-L67 |
45,219 | RainBirdAi/rainbird-linter | report.js | setFilesets | function setFilesets(path, done) {
var config = JSON.parse(fs.readFileSync(path, 'utf8'));
/* jshint sub: true */
var includeFiles = config['includeFiles'];
var excludeFiles = config['excludeFiles'];
var filterFiles = config['lintOnly'];
/* jshint sub: false */
if (filterFiles && !Array.is... | javascript | function setFilesets(path, done) {
var config = JSON.parse(fs.readFileSync(path, 'utf8'));
/* jshint sub: true */
var includeFiles = config['includeFiles'];
var excludeFiles = config['excludeFiles'];
var filterFiles = config['lintOnly'];
/* jshint sub: false */
if (filterFiles && !Array.is... | [
"function",
"setFilesets",
"(",
"path",
",",
"done",
")",
"{",
"var",
"config",
"=",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"path",
",",
"'utf8'",
")",
")",
";",
"/* jshint sub: true */",
"var",
"includeFiles",
"=",
"config",
"[",
"'i... | Set the filesets from those defined in the provided configuration file. If a given fileset isn't defined then a warning will be output. The `lintOnly` fileset is an optional fileset that will be excluded from the Plato fileset. | [
"Set",
"the",
"filesets",
"from",
"those",
"defined",
"in",
"the",
"provided",
"configuration",
"file",
".",
"If",
"a",
"given",
"fileset",
"isn",
"t",
"defined",
"then",
"a",
"warning",
"will",
"be",
"output",
".",
"The",
"lintOnly",
"fileset",
"is",
"an"... | 2831a0286bfe3fb956b5188f0508752c6d16a4de | https://github.com/RainBirdAi/rainbird-linter/blob/2831a0286bfe3fb956b5188f0508752c6d16a4de/report.js#L73-L100 |
45,220 | RainBirdAi/rainbird-linter | report.js | runReports | function runReports(err) {
if (err) { console.log(chalk.red('Error running reports: %s'), err); }
var excludes = filesets.platoExcludes();
if (excludes) {
platoOptions.exclude = excludes;
}
jsHintOptions.ignore = filesets.jshintExcludes();
jsHintOptions.reporter = reporter.reporter;
... | javascript | function runReports(err) {
if (err) { console.log(chalk.red('Error running reports: %s'), err); }
var excludes = filesets.platoExcludes();
if (excludes) {
platoOptions.exclude = excludes;
}
jsHintOptions.ignore = filesets.jshintExcludes();
jsHintOptions.reporter = reporter.reporter;
... | [
"function",
"runReports",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"console",
".",
"log",
"(",
"chalk",
".",
"red",
"(",
"'Error running reports: %s'",
")",
",",
"err",
")",
";",
"}",
"var",
"excludes",
"=",
"filesets",
".",
"platoExcludes",
"... | Run the actual reports. The plato reports are run first, then the JSHint report. The output is annotated with headers and details on where the reports are stored. | [
"Run",
"the",
"actual",
"reports",
".",
"The",
"plato",
"reports",
"are",
"run",
"first",
"then",
"the",
"JSHint",
"report",
".",
"The",
"output",
"is",
"annotated",
"with",
"headers",
"and",
"details",
"on",
"where",
"the",
"reports",
"are",
"stored",
"."... | 2831a0286bfe3fb956b5188f0508752c6d16a4de | https://github.com/RainBirdAi/rainbird-linter/blob/2831a0286bfe3fb956b5188f0508752c6d16a4de/report.js#L120-L145 |
45,221 | gabmontes/node-coindesk-api | lib/index.js | getHistoricalClosePrices | function getHistoricalClosePrices(options = {}) {
const { index, currency, start, end, yesterday } = options
return request(`/historical/close.json`, {
index,
currency,
start: start && end && formatDate(start) || undefined,
end: start && end && formatDate(end) || undefined,
for: yesterday ? 'ye... | javascript | function getHistoricalClosePrices(options = {}) {
const { index, currency, start, end, yesterday } = options
return request(`/historical/close.json`, {
index,
currency,
start: start && end && formatDate(start) || undefined,
end: start && end && formatDate(end) || undefined,
for: yesterday ? 'ye... | [
"function",
"getHistoricalClosePrices",
"(",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"{",
"index",
",",
"currency",
",",
"start",
",",
"end",
",",
"yesterday",
"}",
"=",
"options",
"return",
"request",
"(",
"`",
"`",
",",
"{",
"index",
",",
"curre... | memoize 1' TTL 15" | [
"memoize",
"1",
"TTL",
"15"
] | 9f7a54c24d6edb493723bf52cd5db54952f62125 | https://github.com/gabmontes/node-coindesk-api/blob/9f7a54c24d6edb493723bf52cd5db54952f62125/lib/index.js#L23-L33 |
45,222 | MiguelCastillo/bit-loader | example/asyncfile/src/fileReader.js | fileReader | function fileReader(moduleMeta) {
// Read file from disk and return a module meta
return pstream(readFile(moduleMeta.path))
.then(function(text) {
return {
source: text
};
}, log2console);
} | javascript | function fileReader(moduleMeta) {
// Read file from disk and return a module meta
return pstream(readFile(moduleMeta.path))
.then(function(text) {
return {
source: text
};
}, log2console);
} | [
"function",
"fileReader",
"(",
"moduleMeta",
")",
"{",
"// Read file from disk and return a module meta",
"return",
"pstream",
"(",
"readFile",
"(",
"moduleMeta",
".",
"path",
")",
")",
".",
"then",
"(",
"function",
"(",
"text",
")",
"{",
"return",
"{",
"source"... | Function that reads file from disk
@param {object} moduleMeta - Module meta with information about the module being loaded | [
"Function",
"that",
"reads",
"file",
"from",
"disk"
] | da9d18952d87014fdb09e7a8320a24cbf1c2b436 | https://github.com/MiguelCastillo/bit-loader/blob/da9d18952d87014fdb09e7a8320a24cbf1c2b436/example/asyncfile/src/fileReader.js#L11-L19 |
45,223 | briancsparks/serverassist | lib/helpers.js | function(guess, filename) {
var ct = guess;
// Someone else just defaulted to octet-stream?
if (!ct || ct === 'application/octet-stream') {
ct = sg.mimeType(filename) || ct;
}
return ct || 'application/octet-stream';
} | javascript | function(guess, filename) {
var ct = guess;
// Someone else just defaulted to octet-stream?
if (!ct || ct === 'application/octet-stream') {
ct = sg.mimeType(filename) || ct;
}
return ct || 'application/octet-stream';
} | [
"function",
"(",
"guess",
",",
"filename",
")",
"{",
"var",
"ct",
"=",
"guess",
";",
"// Someone else just defaulted to octet-stream?",
"if",
"(",
"!",
"ct",
"||",
"ct",
"===",
"'application/octet-stream'",
")",
"{",
"ct",
"=",
"sg",
".",
"mimeType",
"(",
"f... | Returns the Content-Type. | [
"Returns",
"the",
"Content",
"-",
"Type",
"."
] | f966832aae287f502cce53a71f5129b962ada8a3 | https://github.com/briancsparks/serverassist/blob/f966832aae287f502cce53a71f5129b962ada8a3/lib/helpers.js#L222-L231 | |
45,224 | MiguelCastillo/bit-loader | src/module.js | Module | function Module(options) {
options = options || {};
if (types.isString(options)) {
options = {
name: options
};
}
if (!types.isString(options.name) && !types.isString(options.source)) {
throw new TypeError("Must provide a name or source for the module");
}
this.deps = options.deps ? opt... | javascript | function Module(options) {
options = options || {};
if (types.isString(options)) {
options = {
name: options
};
}
if (!types.isString(options.name) && !types.isString(options.source)) {
throw new TypeError("Must provide a name or source for the module");
}
this.deps = options.deps ? opt... | [
"function",
"Module",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"types",
".",
"isString",
"(",
"options",
")",
")",
"{",
"options",
"=",
"{",
"name",
":",
"options",
"}",
";",
"}",
"if",
"(",
"!",
"types... | Intermediate representation of a Module which contains the information that is processed
in the different pipelines in order to generate a Module instance.
@class
@memberof Module
@property {string} id - Module id
@property {string} name - Module name
@property {string[]} deps - Array of module dependencies
@property... | [
"Intermediate",
"representation",
"of",
"a",
"Module",
"which",
"contains",
"the",
"information",
"that",
"is",
"processed",
"in",
"the",
"different",
"pipelines",
"in",
"order",
"to",
"generate",
"a",
"Module",
"instance",
"."
] | da9d18952d87014fdb09e7a8320a24cbf1c2b436 | https://github.com/MiguelCastillo/bit-loader/blob/da9d18952d87014fdb09e7a8320a24cbf1c2b436/src/module.js#L106-L122 |
45,225 | onecommons/base | lib/utils.js | function(doRecentCheck, req, res, next) {
var app = req.app;
var config = app.loadConfig('auth');
var failed = !req.isAuthenticated();
if (!failed && doRecentCheck && !req.session.impersonated) {
//skip recent check if login is impersonated
//note: loginTime maybe a string since sessions are serialized... | javascript | function(doRecentCheck, req, res, next) {
var app = req.app;
var config = app.loadConfig('auth');
var failed = !req.isAuthenticated();
if (!failed && doRecentCheck && !req.session.impersonated) {
//skip recent check if login is impersonated
//note: loginTime maybe a string since sessions are serialized... | [
"function",
"(",
"doRecentCheck",
",",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"app",
"=",
"req",
".",
"app",
";",
"var",
"config",
"=",
"app",
".",
"loadConfig",
"(",
"'auth'",
")",
";",
"var",
"failed",
"=",
"!",
"req",
".",
"isAuthentic... | route middleware to make sure a user is logged in | [
"route",
"middleware",
"to",
"make",
"sure",
"a",
"user",
"is",
"logged",
"in"
] | 4f35d9f714d0367b0622a3504802363404290246 | https://github.com/onecommons/base/blob/4f35d9f714d0367b0622a3504802363404290246/lib/utils.js#L34-L73 | |
45,226 | styonsk/elmongoose | lib/sync.js | function (next) {
// index creation options
var body = {
settings: {
number_of_shards : 3,
number_of_replicas : 2,
analysis: {
// analyzer definitions go here
analyzer: {
... | javascript | function (next) {
// index creation options
var body = {
settings: {
number_of_shards : 3,
number_of_replicas : 2,
analysis: {
// analyzer definitions go here
analyzer: {
... | [
"function",
"(",
"next",
")",
"{",
"// index creation options",
"var",
"body",
"=",
"{",
"settings",
":",
"{",
"number_of_shards",
":",
"3",
",",
"number_of_replicas",
":",
"2",
",",
"analysis",
":",
"{",
"// analyzer definitions go here",
"analyzer",
":",
"{",
... | create an elasticsearch index, versioned with the current timestamp | [
"create",
"an",
"elasticsearch",
"index",
"versioned",
"with",
"the",
"current",
"timestamp"
] | b83f7dd67330c7288e7f17866d3e67f12a2adc1d | https://github.com/styonsk/elmongoose/blob/b83f7dd67330c7288e7f17866d3e67f12a2adc1d/lib/sync.js#L45-L139 | |
45,227 | styonsk/elmongoose | lib/sync.js | function (next) {
self.count().exec(function (err, count) {
if (err) {
return next(err)
}
docsToIndex = count
return next()
})
} | javascript | function (next) {
self.count().exec(function (err, count) {
if (err) {
return next(err)
}
docsToIndex = count
return next()
})
} | [
"function",
"(",
"next",
")",
"{",
"self",
".",
"count",
"(",
")",
".",
"exec",
"(",
"function",
"(",
"err",
",",
"count",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"next",
"(",
"err",
")",
"}",
"docsToIndex",
"=",
"count",
"return",
"next"... | get a count of how many documents we have to index | [
"get",
"a",
"count",
"of",
"how",
"many",
"documents",
"we",
"have",
"to",
"index"
] | b83f7dd67330c7288e7f17866d3e67f12a2adc1d | https://github.com/styonsk/elmongoose/blob/b83f7dd67330c7288e7f17866d3e67f12a2adc1d/lib/sync.js#L141-L151 | |
45,228 | styonsk/elmongoose | lib/sync.js | function (next) {
// if no documents to index, skip population
if (!docsToIndex) {
return next()
}
// stream docs - and upload in batches of size BATCH_SIZE
var docStream = self.find().stream()
// elasticsearch commands to perform... | javascript | function (next) {
// if no documents to index, skip population
if (!docsToIndex) {
return next()
}
// stream docs - and upload in batches of size BATCH_SIZE
var docStream = self.find().stream()
// elasticsearch commands to perform... | [
"function",
"(",
"next",
")",
"{",
"// if no documents to index, skip population",
"if",
"(",
"!",
"docsToIndex",
")",
"{",
"return",
"next",
"(",
")",
"}",
"// stream docs - and upload in batches of size BATCH_SIZE",
"var",
"docStream",
"=",
"self",
".",
"find",
"(",... | populate the newly created index with this collection's documents | [
"populate",
"the",
"newly",
"created",
"index",
"with",
"this",
"collection",
"s",
"documents"
] | b83f7dd67330c7288e7f17866d3e67f12a2adc1d | https://github.com/styonsk/elmongoose/blob/b83f7dd67330c7288e7f17866d3e67f12a2adc1d/lib/sync.js#L153-L227 | |
45,229 | styonsk/elmongoose | lib/sync.js | function (next) {
var reqOpts = {
method: 'GET',
url: helpers.makeAliasUri(options)
}
if(options.auth) {
reqOpts.auth = {
user: options.auth.user,
pass: options.auth.password,
... | javascript | function (next) {
var reqOpts = {
method: 'GET',
url: helpers.makeAliasUri(options)
}
if(options.auth) {
reqOpts.auth = {
user: options.auth.user,
pass: options.auth.password,
... | [
"function",
"(",
"next",
")",
"{",
"var",
"reqOpts",
"=",
"{",
"method",
":",
"'GET'",
",",
"url",
":",
"helpers",
".",
"makeAliasUri",
"(",
"options",
")",
"}",
"if",
"(",
"options",
".",
"auth",
")",
"{",
"reqOpts",
".",
"auth",
"=",
"{",
"user",... | atomically replace existing aliases for this collection with the new one we just created | [
"atomically",
"replace",
"existing",
"aliases",
"for",
"this",
"collection",
"with",
"the",
"new",
"one",
"we",
"just",
"created"
] | b83f7dd67330c7288e7f17866d3e67f12a2adc1d | https://github.com/styonsk/elmongoose/blob/b83f7dd67330c7288e7f17866d3e67f12a2adc1d/lib/sync.js#L259-L345 | |
45,230 | ryb73/dealers-choice-meta | packages/server/lib/game-managers/pending-game-manager.js | addPlayer | function addPlayer(userId, callbacks) {
let player = factory.addPlayer();
if(!player) return null;
self._callbacks.set(player, callbacks);
// If the game didn't have an owner, it does now
// This should only happen when the game is first created
// and the initial playe... | javascript | function addPlayer(userId, callbacks) {
let player = factory.addPlayer();
if(!player) return null;
self._callbacks.set(player, callbacks);
// If the game didn't have an owner, it does now
// This should only happen when the game is first created
// and the initial playe... | [
"function",
"addPlayer",
"(",
"userId",
",",
"callbacks",
")",
"{",
"let",
"player",
"=",
"factory",
".",
"addPlayer",
"(",
")",
";",
"if",
"(",
"!",
"player",
")",
"return",
"null",
";",
"self",
".",
"_callbacks",
".",
"set",
"(",
"player",
",",
"ca... | callback is used to send messages to the players in the game | [
"callback",
"is",
"used",
"to",
"send",
"messages",
"to",
"the",
"players",
"in",
"the",
"game"
] | 4632e8897c832b01d944a340cf87d5c807809925 | https://github.com/ryb73/dealers-choice-meta/blob/4632e8897c832b01d944a340cf87d5c807809925/packages/server/lib/game-managers/pending-game-manager.js#L39-L54 |
45,231 | uvworkspace/uvwlib | lib/utils/slice.js | slice | function slice (args, start, end) {
var len = args.length;
start = start > 0 ? start : 0;
end = end >= 0 && end < len ? end : len;
var n = end - start;
if (n <= 0) return [];
var ret = new Array(n);
for (var i = 0; i < n; ++i) {
ret[i] = args[i + start];
}
return ret;
} | javascript | function slice (args, start, end) {
var len = args.length;
start = start > 0 ? start : 0;
end = end >= 0 && end < len ? end : len;
var n = end - start;
if (n <= 0) return [];
var ret = new Array(n);
for (var i = 0; i < n; ++i) {
ret[i] = args[i + start];
}
return ret;
} | [
"function",
"slice",
"(",
"args",
",",
"start",
",",
"end",
")",
"{",
"var",
"len",
"=",
"args",
".",
"length",
";",
"start",
"=",
"start",
">",
"0",
"?",
"start",
":",
"0",
";",
"end",
"=",
"end",
">=",
"0",
"&&",
"end",
"<",
"len",
"?",
"en... | force copying to avoid leaking arguments | [
"force",
"copying",
"to",
"avoid",
"leaking",
"arguments"
] | ef1893e0c9cdcaa321186dd5dc17fc2c9bd9e641 | https://github.com/uvworkspace/uvwlib/blob/ef1893e0c9cdcaa321186dd5dc17fc2c9bd9e641/lib/utils/slice.js#L4-L17 |
45,232 | aheckmann/mongodb-schema-miner | lib/index.js | read | function read (stream, opts, db, cb) {
var schema = new exports.Schema;
if (opts.onType) {
schema.onType = opts.onType;
}
stream.once('error', function (err) {
debug('aborting with error: ' + err);
db.close(cb.bind(err));
});
stream.on('data', function (doc) {
var err = schema.consume(doc... | javascript | function read (stream, opts, db, cb) {
var schema = new exports.Schema;
if (opts.onType) {
schema.onType = opts.onType;
}
stream.once('error', function (err) {
debug('aborting with error: ' + err);
db.close(cb.bind(err));
});
stream.on('data', function (doc) {
var err = schema.consume(doc... | [
"function",
"read",
"(",
"stream",
",",
"opts",
",",
"db",
",",
"cb",
")",
"{",
"var",
"schema",
"=",
"new",
"exports",
".",
"Schema",
";",
"if",
"(",
"opts",
".",
"onType",
")",
"{",
"schema",
".",
"onType",
"=",
"opts",
".",
"onType",
";",
"}",... | process documents from the stream | [
"process",
"documents",
"from",
"the",
"stream"
] | c56220bd527d82f6a1712f90b45f10828290961f | https://github.com/aheckmann/mongodb-schema-miner/blob/c56220bd527d82f6a1712f90b45f10828290961f/lib/index.js#L38-L62 |
45,233 | aheckmann/mongodb-schema-miner | lib/index.js | abort | function abort (err, stream, db, cb) {
debug('aborting with error: ' + err);
stream.destroy();
db.close(function () {
cb(err);
})
} | javascript | function abort (err, stream, db, cb) {
debug('aborting with error: ' + err);
stream.destroy();
db.close(function () {
cb(err);
})
} | [
"function",
"abort",
"(",
"err",
",",
"stream",
",",
"db",
",",
"cb",
")",
"{",
"debug",
"(",
"'aborting with error: '",
"+",
"err",
")",
";",
"stream",
".",
"destroy",
"(",
")",
";",
"db",
".",
"close",
"(",
"function",
"(",
")",
"{",
"cb",
"(",
... | abort the stream | [
"abort",
"the",
"stream"
] | c56220bd527d82f6a1712f90b45f10828290961f | https://github.com/aheckmann/mongodb-schema-miner/blob/c56220bd527d82f6a1712f90b45f10828290961f/lib/index.js#L68-L74 |
45,234 | aheckmann/mongodb-schema-miner | lib/index.js | validate | function validate (uri, collection, cb) {
if ('function' != typeof cb) {
throw new TypeError('cb must be a function');
}
if ('string' != typeof collection) {
throw new TypeError('collection must be a string');
}
if ('string' != typeof uri) {
throw new TypeError('uri must be a string');
}
} | javascript | function validate (uri, collection, cb) {
if ('function' != typeof cb) {
throw new TypeError('cb must be a function');
}
if ('string' != typeof collection) {
throw new TypeError('collection must be a string');
}
if ('string' != typeof uri) {
throw new TypeError('uri must be a string');
}
} | [
"function",
"validate",
"(",
"uri",
",",
"collection",
",",
"cb",
")",
"{",
"if",
"(",
"'function'",
"!=",
"typeof",
"cb",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'cb must be a function'",
")",
";",
"}",
"if",
"(",
"'string'",
"!=",
"typeof",
"colle... | validate "miner" arguments | [
"validate",
"miner",
"arguments"
] | c56220bd527d82f6a1712f90b45f10828290961f | https://github.com/aheckmann/mongodb-schema-miner/blob/c56220bd527d82f6a1712f90b45f10828290961f/lib/index.js#L80-L92 |
45,235 | gavagai-corp/gavagai-node | lib/tonality.js | function (texts, options, callback) {
if (typeof(options) === 'function') {
callback = options;
options = {};
}
if (Array.isArray(texts)) {
texts = texts.map(function (text, i) {
return textObj(text, i);
});
} else if (typ... | javascript | function (texts, options, callback) {
if (typeof(options) === 'function') {
callback = options;
options = {};
}
if (Array.isArray(texts)) {
texts = texts.map(function (text, i) {
return textObj(text, i);
});
} else if (typ... | [
"function",
"(",
"texts",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"(",
"options",
")",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"... | Given a set of documents, return their tonality based on lexical analysis in multiple dimensions.
The tonality is calculated on a document level, that is, the response will return the tonality of
each document.
@param {Array|string} texts - an array of document objects or strings to be analyzed.
@param {object} [optio... | [
"Given",
"a",
"set",
"of",
"documents",
"return",
"their",
"tonality",
"based",
"on",
"lexical",
"analysis",
"in",
"multiple",
"dimensions",
".",
"The",
"tonality",
"is",
"calculated",
"on",
"a",
"document",
"level",
"that",
"is",
"the",
"response",
"will",
... | d3f5e3f59f25d9c3ebbf6fd3a3ecb70b3a4047eb | https://github.com/gavagai-corp/gavagai-node/blob/d3f5e3f59f25d9c3ebbf6fd3a3ecb70b3a4047eb/lib/tonality.js#L18-L51 | |
45,236 | theboyWhoCriedWoolf/transition-manager | example/example.js | clickRegion | function clickRegion( e ) {
let pos = {
x : e.clientX,
y : e.clientY
},
region = '',
dividant = 4,
right = window.innerWidth - (window.innerWidth / dividant),
left = (window.innerWidth / dividant),
top = (window.innerHeight / dividant),
bottom = window.innerHeight - (window.innerHeight /... | javascript | function clickRegion( e ) {
let pos = {
x : e.clientX,
y : e.clientY
},
region = '',
dividant = 4,
right = window.innerWidth - (window.innerWidth / dividant),
left = (window.innerWidth / dividant),
top = (window.innerHeight / dividant),
bottom = window.innerHeight - (window.innerHeight /... | [
"function",
"clickRegion",
"(",
"e",
")",
"{",
"let",
"pos",
"=",
"{",
"x",
":",
"e",
".",
"clientX",
",",
"y",
":",
"e",
".",
"clientY",
"}",
",",
"region",
"=",
"''",
",",
"dividant",
"=",
"4",
",",
"right",
"=",
"window",
".",
"innerWidth",
... | get click quadrant based on mouse position | [
"get",
"click",
"quadrant",
"based",
"on",
"mouse",
"position"
] | a20fda0bb07c0098bf709ea03770b1ee2a855655 | https://github.com/theboyWhoCriedWoolf/transition-manager/blob/a20fda0bb07c0098bf709ea03770b1ee2a855655/example/example.js#L54-L74 |
45,237 | edappy/seneca-context | plugins/getContext.js | getContextPlugin | function getContextPlugin(options) {
var seneca = this;
var plugin = 'get-context';
seneca.wrap(options.pin, function (message, done) {
var seneca = this;
message.context$ = getContext(seneca);
seneca.prior(message, done);
});
return {name: plugin};
} | javascript | function getContextPlugin(options) {
var seneca = this;
var plugin = 'get-context';
seneca.wrap(options.pin, function (message, done) {
var seneca = this;
message.context$ = getContext(seneca);
seneca.prior(message, done);
});
return {name: plugin};
} | [
"function",
"getContextPlugin",
"(",
"options",
")",
"{",
"var",
"seneca",
"=",
"this",
";",
"var",
"plugin",
"=",
"'get-context'",
";",
"seneca",
".",
"wrap",
"(",
"options",
".",
"pin",
",",
"function",
"(",
"message",
",",
"done",
")",
"{",
"var",
"... | A seneca plugin, which automatically exposes the context as a property of the incoming message.
@param {{
pin: string|Object // a seneca pattern to which this plugin should be applied
}} options | [
"A",
"seneca",
"plugin",
"which",
"automatically",
"exposes",
"the",
"context",
"as",
"a",
"property",
"of",
"the",
"incoming",
"message",
"."
] | 1e0c8d36c5be4b661b062754c01f064de47873c4 | https://github.com/edappy/seneca-context/blob/1e0c8d36c5be4b661b062754c01f064de47873c4/plugins/getContext.js#L14-L25 |
45,238 | fknussel/custom-scripts | scripts/build.js | build | function build() {
console.log('Creating an optimized production build...\n');
webpack(config)
.run((err, stats) => {
if (err) {
printErrors('Failed to compile.', [err]);
process.exit(1);
}
if (stats.compilation.errors.length) {
printErrors('Failed to compile.', stats... | javascript | function build() {
console.log('Creating an optimized production build...\n');
webpack(config)
.run((err, stats) => {
if (err) {
printErrors('Failed to compile.', [err]);
process.exit(1);
}
if (stats.compilation.errors.length) {
printErrors('Failed to compile.', stats... | [
"function",
"build",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'Creating an optimized production build...\\n'",
")",
";",
"webpack",
"(",
"config",
")",
".",
"run",
"(",
"(",
"err",
",",
"stats",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"printErrors... | Create a production build | [
"Create",
"a",
"production",
"build"
] | 801ad6f42bcde265e317d427b7ee0f371eeb0e9b | https://github.com/fknussel/custom-scripts/blob/801ad6f42bcde265e317d427b7ee0f371eeb0e9b/scripts/build.js#L26-L53 |
45,239 | onecommons/base | routes/crud.js | addToFooter | function addToFooter(schema, path, unwind) {
Object.keys(schema).forEach(function(name) {
if (name.slice(0,2) == '__')
return true;
if (!path && (name == 'id' || name == '_id'))
return;
if (model.schema.nested[path+name]) {
addToFooter(schema[name], path+name+'.', '')
... | javascript | function addToFooter(schema, path, unwind) {
Object.keys(schema).forEach(function(name) {
if (name.slice(0,2) == '__')
return true;
if (!path && (name == 'id' || name == '_id'))
return;
if (model.schema.nested[path+name]) {
addToFooter(schema[name], path+name+'.', '')
... | [
"function",
"addToFooter",
"(",
"schema",
",",
"path",
",",
"unwind",
")",
"{",
"Object",
".",
"keys",
"(",
"schema",
")",
".",
"forEach",
"(",
"function",
"(",
"name",
")",
"{",
"if",
"(",
"name",
".",
"slice",
"(",
"0",
",",
"2",
")",
"==",
"'_... | only include leaves | [
"only",
"include",
"leaves"
] | 4f35d9f714d0367b0622a3504802363404290246 | https://github.com/onecommons/base/blob/4f35d9f714d0367b0622a3504802363404290246/routes/crud.js#L514-L539 |
45,240 | vid/SenseBase | lib/content.js | diffContentItems | function diffContentItems(lhs, rhs) {
var d = diff(lhs, rhs, function(key, value) {
return value === 'visitors' || value === 'headers';
});
return d;
} | javascript | function diffContentItems(lhs, rhs) {
var d = diff(lhs, rhs, function(key, value) {
return value === 'visitors' || value === 'headers';
});
return d;
} | [
"function",
"diffContentItems",
"(",
"lhs",
",",
"rhs",
")",
"{",
"var",
"d",
"=",
"diff",
"(",
"lhs",
",",
"rhs",
",",
"function",
"(",
"key",
",",
"value",
")",
"{",
"return",
"value",
"===",
"'visitors'",
"||",
"value",
"===",
"'headers'",
";",
"}... | Compare two content items, returning any difference | [
"Compare",
"two",
"content",
"items",
"returning",
"any",
"difference"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/content.js#L247-L252 |
45,241 | vid/SenseBase | lib/content.js | extractContent | function extractContent(desc) {
/*
// search all possible matches, returning first find
var founds = sites.findMatch(desc.uri);
if (founds.length) {
var $ = cheerio.load(desc.content);
// use first found extractor
founds.forEach(function(found) {
if ($(found.selector)) {
var content = $... | javascript | function extractContent(desc) {
/*
// search all possible matches, returning first find
var founds = sites.findMatch(desc.uri);
if (founds.length) {
var $ = cheerio.load(desc.content);
// use first found extractor
founds.forEach(function(found) {
if ($(found.selector)) {
var content = $... | [
"function",
"extractContent",
"(",
"desc",
")",
"{",
"/*\n // search all possible matches, returning first find\n var founds = sites.findMatch(desc.uri);\n\n if (founds.length) {\n var $ = cheerio.load(desc.content);\n // use first found extractor\n founds.forEach(function(found) {\n if (... | find finer content areas if available extract content based on site definitions | [
"find",
"finer",
"content",
"areas",
"if",
"available",
"extract",
"content",
"based",
"on",
"site",
"definitions"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/content.js#L348-L370 |
45,242 | vid/SenseBase | lib/content.js | getTitle | function getTitle(content, tag) {
if (!content) {
return;
}
var ts = content.indexOf(tag);
if (ts < 0) {
return;
}
var te = content.indexOf('>', ts);
var cs = content.indexOf('<', te + 1);
var title = content.substring(te + 1, cs);
return title.trim();
} | javascript | function getTitle(content, tag) {
if (!content) {
return;
}
var ts = content.indexOf(tag);
if (ts < 0) {
return;
}
var te = content.indexOf('>', ts);
var cs = content.indexOf('<', te + 1);
var title = content.substring(te + 1, cs);
return title.trim();
} | [
"function",
"getTitle",
"(",
"content",
",",
"tag",
")",
"{",
"if",
"(",
"!",
"content",
")",
"{",
"return",
";",
"}",
"var",
"ts",
"=",
"content",
".",
"indexOf",
"(",
"tag",
")",
";",
"if",
"(",
"ts",
"<",
"0",
")",
"{",
"return",
";",
"}",
... | Get an HTML title the old-fashioned way. | [
"Get",
"an",
"HTML",
"title",
"the",
"old",
"-",
"fashioned",
"way",
"."
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/content.js#L373-L385 |
45,243 | henrytseng/angular-state-router | example/app.js | function() {
var i = Math.floor(_listing.length-1 * Math.random());
return $q.when(_listing[i]);
} | javascript | function() {
var i = Math.floor(_listing.length-1 * Math.random());
return $q.when(_listing[i]);
} | [
"function",
"(",
")",
"{",
"var",
"i",
"=",
"Math",
".",
"floor",
"(",
"_listing",
".",
"length",
"-",
"1",
"*",
"Math",
".",
"random",
"(",
")",
")",
";",
"return",
"$q",
".",
"when",
"(",
"_listing",
"[",
"i",
"]",
")",
";",
"}"
] | Get random item | [
"Get",
"random",
"item"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/example/app.js#L299-L302 | |
45,244 | henrytseng/angular-state-router | example/app.js | function(criteria) {
var results = [];
criteria = angular.isArray(criteria) ? criteria : [criteria];
// Search through each
criteria.forEach(function(q) {
if(q && q !== '') {
_listing.forEach(function(item) {
for(var name in item) {
... | javascript | function(criteria) {
var results = [];
criteria = angular.isArray(criteria) ? criteria : [criteria];
// Search through each
criteria.forEach(function(q) {
if(q && q !== '') {
_listing.forEach(function(item) {
for(var name in item) {
... | [
"function",
"(",
"criteria",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"criteria",
"=",
"angular",
".",
"isArray",
"(",
"criteria",
")",
"?",
"criteria",
":",
"[",
"criteria",
"]",
";",
"// Search through each",
"criteria",
".",
"forEach",
"(",
"fu... | Search for a product | [
"Search",
"for",
"a",
"product"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/example/app.js#L305-L325 | |
45,245 | benaston/partial-application | dist/partial-application.js | partialWithArityOfOne | function partialWithArityOfOne(fn) {
var args = arguments;
return function(a) {
return partial.apply(this, args).apply(this, arguments);
};
} | javascript | function partialWithArityOfOne(fn) {
var args = arguments;
return function(a) {
return partial.apply(this, args).apply(this, arguments);
};
} | [
"function",
"partialWithArityOfOne",
"(",
"fn",
")",
"{",
"var",
"args",
"=",
"arguments",
";",
"return",
"function",
"(",
"a",
")",
"{",
"return",
"partial",
".",
"apply",
"(",
"this",
",",
"args",
")",
".",
"apply",
"(",
"this",
",",
"arguments",
")"... | Partially apply a function, but ensure the returned function has an arity of one.
@param {Function} fn The function to partially apply.
@return {Function} The partially applied function. | [
"Partially",
"apply",
"a",
"function",
"but",
"ensure",
"the",
"returned",
"function",
"has",
"an",
"arity",
"of",
"one",
"."
] | bfb79abc7d6a81f2ad5c237bc618c261051692d3 | https://github.com/benaston/partial-application/blob/bfb79abc7d6a81f2ad5c237bc618c261051692d3/dist/partial-application.js#L39-L45 |
45,246 | binduwavell/generator-alfresco-common | lib/maven-archetype-metadata.js | _getFileSet | function _getFileSet (fileSetElement) {
var filtered = utils.toBoolean(fileSetElement.getAttribute('filtered'), false);
var packaged = utils.toBoolean(fileSetElement.getAttribute('packaged'), false);
var encoding = fileSetElement.getAttribute('encoding');
var directory = domutils.getChild(fileSetElement... | javascript | function _getFileSet (fileSetElement) {
var filtered = utils.toBoolean(fileSetElement.getAttribute('filtered'), false);
var packaged = utils.toBoolean(fileSetElement.getAttribute('packaged'), false);
var encoding = fileSetElement.getAttribute('encoding');
var directory = domutils.getChild(fileSetElement... | [
"function",
"_getFileSet",
"(",
"fileSetElement",
")",
"{",
"var",
"filtered",
"=",
"utils",
".",
"toBoolean",
"(",
"fileSetElement",
".",
"getAttribute",
"(",
"'filtered'",
")",
",",
"false",
")",
";",
"var",
"packaged",
"=",
"utils",
".",
"toBoolean",
"(",... | Produces a JavaScript object representing a fileSet.
@param {Element} fileSetElement
@returns {{filtered: (boolean|undefined), packaged: (boolean|undefined), encoding: (string|*), directory, includes: Array, excludes: Array}}
@private | [
"Produces",
"a",
"JavaScript",
"object",
"representing",
"a",
"fileSet",
"."
] | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/maven-archetype-metadata.js#L91-L108 |
45,247 | binduwavell/generator-alfresco-common | lib/maven-archetype-metadata.js | _getModule | function _getModule (moduleElement) {
var id = moduleElement.getAttribute('id');
var dir = moduleElement.getAttribute('dir');
var name = moduleElement.getAttribute('name');
var fileSets = domutils.getChild(moduleElement, 'desc', 'fileSets');
var modules = domutils.getChild(moduleElement, 'desc', 'mo... | javascript | function _getModule (moduleElement) {
var id = moduleElement.getAttribute('id');
var dir = moduleElement.getAttribute('dir');
var name = moduleElement.getAttribute('name');
var fileSets = domutils.getChild(moduleElement, 'desc', 'fileSets');
var modules = domutils.getChild(moduleElement, 'desc', 'mo... | [
"function",
"_getModule",
"(",
"moduleElement",
")",
"{",
"var",
"id",
"=",
"moduleElement",
".",
"getAttribute",
"(",
"'id'",
")",
";",
"var",
"dir",
"=",
"moduleElement",
".",
"getAttribute",
"(",
"'dir'",
")",
";",
"var",
"name",
"=",
"moduleElement",
"... | Produces a JavaScript object representing a module.
@param {!Element} moduleElement
@returns {{id: (string|*), dir: (string|*), name: (string|*), fileSets: Array, modules: Array}}
@private | [
"Produces",
"a",
"JavaScript",
"object",
"representing",
"a",
"module",
"."
] | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/maven-archetype-metadata.js#L134-L156 |
45,248 | jldec/pub-generator | generator.js | unload | function unload() {
u.each(opts.sources, function(source) {
if (source.src && source.src.unref) { source.src.unref(); }
if (source.cache && source.cache.unref) { source.cache.unref(); }
});
u.each(opts.outputs, function(output) {
if (output.output && output.output.cancel) { output.output.c... | javascript | function unload() {
u.each(opts.sources, function(source) {
if (source.src && source.src.unref) { source.src.unref(); }
if (source.cache && source.cache.unref) { source.cache.unref(); }
});
u.each(opts.outputs, function(output) {
if (output.output && output.output.cancel) { output.output.c... | [
"function",
"unload",
"(",
")",
"{",
"u",
".",
"each",
"(",
"opts",
".",
"sources",
",",
"function",
"(",
"source",
")",
"{",
"if",
"(",
"source",
".",
"src",
"&&",
"source",
".",
"src",
".",
"unref",
")",
"{",
"source",
".",
"src",
".",
"unref",... | disconnect all sources and cancel all throttled functions | [
"disconnect",
"all",
"sources",
"and",
"cancel",
"all",
"throttled",
"functions"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/generator.js#L140-L150 |
45,249 | jldec/pub-generator | generator.js | redirect | function redirect(url) {
var path = u.urlPath(url);
var params = u.urlParams(url);
var pg = generator.aliase$[path];
if (pg) return { status:301, url:pg._href + params };
pg = generator.redirect$[path];
if (pg) return { status:302, url:pg._href + params };
// customRedirects return params... | javascript | function redirect(url) {
var path = u.urlPath(url);
var params = u.urlParams(url);
var pg = generator.aliase$[path];
if (pg) return { status:301, url:pg._href + params };
pg = generator.redirect$[path];
if (pg) return { status:302, url:pg._href + params };
// customRedirects return params... | [
"function",
"redirect",
"(",
"url",
")",
"{",
"var",
"path",
"=",
"u",
".",
"urlPath",
"(",
"url",
")",
";",
"var",
"params",
"=",
"u",
".",
"urlParams",
"(",
"url",
")",
";",
"var",
"pg",
"=",
"generator",
".",
"aliase$",
"[",
"path",
"]",
";",
... | compute alias or custom redirect for a url - returns falsy if none 302 redirects are temporary - browsers won't try to remember them 301 redirects are permanent - browsers will cache and avoid re-requesting | [
"compute",
"alias",
"or",
"custom",
"redirect",
"for",
"a",
"url",
"-",
"returns",
"falsy",
"if",
"none",
"302",
"redirects",
"are",
"temporary",
"-",
"browsers",
"won",
"t",
"try",
"to",
"remember",
"them",
"301",
"redirects",
"are",
"permanent",
"-",
"br... | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/generator.js#L238-L251 |
45,250 | UNLOQIO/unloq-node-client | lib/api.js | UnloqApi | function UnloqApi(authObj) {
if(typeof authObj !== 'object' || authObj === null) {
throw new Error('Unloq.Api: First constructor argument must be an instance of unloq.Auth');
}
// If we receive only the object with configuration, we try and create the auth object.
if(authObj.__type !== 'auth') {
... | javascript | function UnloqApi(authObj) {
if(typeof authObj !== 'object' || authObj === null) {
throw new Error('Unloq.Api: First constructor argument must be an instance of unloq.Auth');
}
// If we receive only the object with configuration, we try and create the auth object.
if(authObj.__type !== 'auth') {
... | [
"function",
"UnloqApi",
"(",
"authObj",
")",
"{",
"if",
"(",
"typeof",
"authObj",
"!==",
"'object'",
"||",
"authObj",
"===",
"null",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Unloq.Api: First constructor argument must be an instance of unloq.Auth'",
")",
";",
"}",
... | this is an unloq.Auth instance. | [
"this",
"is",
"an",
"unloq",
".",
"Auth",
"instance",
"."
] | f88adeb7f0d3c729c6b578bff4aa5f548b84133b | https://github.com/UNLOQIO/unloq-node-client/blob/f88adeb7f0d3c729c6b578bff4aa5f548b84133b/lib/api.js#L12-L22 |
45,251 | DScheglov/merest | lib/middlewares/register-api.js | registerApi | function registerApi(isApp, apiObject) {
if (isApp) {
return function (req, res, next) {
res.__api = apiObject;
return next();
};
};
return function (req, res, next) {
res.__modelAPI = apiObject;
return next();
};
} | javascript | function registerApi(isApp, apiObject) {
if (isApp) {
return function (req, res, next) {
res.__api = apiObject;
return next();
};
};
return function (req, res, next) {
res.__modelAPI = apiObject;
return next();
};
} | [
"function",
"registerApi",
"(",
"isApp",
",",
"apiObject",
")",
"{",
"if",
"(",
"isApp",
")",
"{",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"res",
".",
"__api",
"=",
"apiObject",
";",
"return",
"next",
"(",
")",
";",
"}"... | registerApi - the factory for middleware that registers api in response object
@param {ModelAPIRouter|ModelAPIExpress} apiObject the ModelAPIRouter or ModelAPIRouter
@return {Function} description | [
"registerApi",
"-",
"the",
"factory",
"for",
"middleware",
"that",
"registers",
"api",
"in",
"response",
"object"
] | d39e7ef0d56236247773467e9bfe83cb128ebc01 | https://github.com/DScheglov/merest/blob/d39e7ef0d56236247773467e9bfe83cb128ebc01/lib/middlewares/register-api.js#L10-L23 |
45,252 | vadr-vr/VR-Analytics-JSCore | js/timeManager.js | init | function init(){
frameUnixTime = utils.getUnixTimeInMilliseconds();
frameDuration = 0;
frameDurationClone = 0;
timeSinceStart = 0;
playTimeSinceStart = 0;
appActive = true;
appPlaying = true;
videoDuration = 0;
videoPlaying = false;
} | javascript | function init(){
frameUnixTime = utils.getUnixTimeInMilliseconds();
frameDuration = 0;
frameDurationClone = 0;
timeSinceStart = 0;
playTimeSinceStart = 0;
appActive = true;
appPlaying = true;
videoDuration = 0;
videoPlaying = false;
} | [
"function",
"init",
"(",
")",
"{",
"frameUnixTime",
"=",
"utils",
".",
"getUnixTimeInMilliseconds",
"(",
")",
";",
"frameDuration",
"=",
"0",
";",
"frameDurationClone",
"=",
"0",
";",
"timeSinceStart",
"=",
"0",
";",
"playTimeSinceStart",
"=",
"0",
";",
"app... | Init the time manager, sets frameUnixTime to current value
@memberof TimeManager | [
"Init",
"the",
"time",
"manager",
"sets",
"frameUnixTime",
"to",
"current",
"value"
] | 7e4a493c824c2c1716360dcb6a3bfecfede5df3b | https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/timeManager.js#L30-L42 |
45,253 | vadr-vr/VR-Analytics-JSCore | js/timeManager.js | tick | function tick(frameTime){
let newFrameUnixTime = utils.getUnixTimeInMilliseconds();
if (frameTime)
frameDuration = frameTime;
else
frameDuration = newFrameUnixTime - frameUnixTime;
// dont consider frame duration if app is not active
frameDurationClone = appActive ? frameDurat... | javascript | function tick(frameTime){
let newFrameUnixTime = utils.getUnixTimeInMilliseconds();
if (frameTime)
frameDuration = frameTime;
else
frameDuration = newFrameUnixTime - frameUnixTime;
// dont consider frame duration if app is not active
frameDurationClone = appActive ? frameDurat... | [
"function",
"tick",
"(",
"frameTime",
")",
"{",
"let",
"newFrameUnixTime",
"=",
"utils",
".",
"getUnixTimeInMilliseconds",
"(",
")",
";",
"if",
"(",
"frameTime",
")",
"frameDuration",
"=",
"frameTime",
";",
"else",
"frameDuration",
"=",
"newFrameUnixTime",
"-",
... | Updates the application timings.
Calculates frameTime as the difference of current
frame time and the previous frame time. In case app was not active the previous frame,
sets the frame time to 0. Correspondingly calculates timeSinceStart and
playTimeSinceStart
@memberof TimeManager
@param {number} frameTime specify the... | [
"Updates",
"the",
"application",
"timings",
".",
"Calculates",
"frameTime",
"as",
"the",
"difference",
"of",
"current",
"frame",
"time",
"and",
"the",
"previous",
"frame",
"time",
".",
"In",
"case",
"app",
"was",
"not",
"active",
"the",
"previous",
"frame",
... | 7e4a493c824c2c1716360dcb6a3bfecfede5df3b | https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/timeManager.js#L53-L80 |
45,254 | OpenSmartEnvironment/ose | lib/field/wrap.js | init | function init(owner, field, layout, val, children) { // {{{2
/**
* Field wrapper constructor
*
* @param owner {Object} Owning wrap list
* @param field {Object} Field description object
* @param layout {Object} Layout
* @param val {*} Field value
*
* @method constructor
*/
this.owner = owner;
owner.fields... | javascript | function init(owner, field, layout, val, children) { // {{{2
/**
* Field wrapper constructor
*
* @param owner {Object} Owning wrap list
* @param field {Object} Field description object
* @param layout {Object} Layout
* @param val {*} Field value
*
* @method constructor
*/
this.owner = owner;
owner.fields... | [
"function",
"init",
"(",
"owner",
",",
"field",
",",
"layout",
",",
"val",
",",
"children",
")",
"{",
"// {{{2",
"/**\n * Field wrapper constructor\n *\n * @param owner {Object} Owning wrap list\n * @param field {Object} Field description object\n * @param layout {Object} Layout\n * @p... | Optional error returned from field.unformat
@property editError
@type Object
Public {{{1 | [
"Optional",
"error",
"returned",
"from",
"field",
".",
"unformat"
] | 2ab051d9db6e77341c40abb9cbdae6ce586917e0 | https://github.com/OpenSmartEnvironment/ose/blob/2ab051d9db6e77341c40abb9cbdae6ce586917e0/lib/field/wrap.js#L88-L108 |
45,255 | primus/condenseify | index.js | condenseify | function condenseify(file, options) {
if (/\.json$/.test(file)) return through();
var appendNewLine = true
, regex = /^[ \t]+$/
, isBlank = false
, eol ='\n';
options = options || {};
function transform(line, encoding, next) {
if (!line.length) {
isBlank = true;
return next();
... | javascript | function condenseify(file, options) {
if (/\.json$/.test(file)) return through();
var appendNewLine = true
, regex = /^[ \t]+$/
, isBlank = false
, eol ='\n';
options = options || {};
function transform(line, encoding, next) {
if (!line.length) {
isBlank = true;
return next();
... | [
"function",
"condenseify",
"(",
"file",
",",
"options",
")",
"{",
"if",
"(",
"/",
"\\.json$",
"/",
".",
"test",
"(",
"file",
")",
")",
"return",
"through",
"(",
")",
";",
"var",
"appendNewLine",
"=",
"true",
",",
"regex",
"=",
"/",
"^[ \\t]+$",
"/",
... | Browserify transform to condense multiple blank lines
into a single blank line.
@param {String} file File name
@param {Object} [options] Options object
@returns {Stream} Transform stream
@api public | [
"Browserify",
"transform",
"to",
"condense",
"multiple",
"blank",
"lines",
"into",
"a",
"single",
"blank",
"line",
"."
] | 1330ead68f7d5cdbcf4f08ad8fc4138920eb4c54 | https://github.com/primus/condenseify/blob/1330ead68f7d5cdbcf4f08ad8fc4138920eb4c54/index.js#L21-L55 |
45,256 | sembaye/numberconverter | index.js | removezeros | function removezeros(bin){
var i = 0;
while((i < bin.length) && (!bin[i])){i++;}
if(i == bin.length){
return filledarray(false, 1);
}else{
return bin.slice(i);
}
} | javascript | function removezeros(bin){
var i = 0;
while((i < bin.length) && (!bin[i])){i++;}
if(i == bin.length){
return filledarray(false, 1);
}else{
return bin.slice(i);
}
} | [
"function",
"removezeros",
"(",
"bin",
")",
"{",
"var",
"i",
"=",
"0",
";",
"while",
"(",
"(",
"i",
"<",
"bin",
".",
"length",
")",
"&&",
"(",
"!",
"bin",
"[",
"i",
"]",
")",
")",
"{",
"i",
"++",
";",
"}",
"if",
"(",
"i",
"==",
"bin",
"."... | Removes all prefixing zeros from the binary array. | [
"Removes",
"all",
"prefixing",
"zeros",
"from",
"the",
"binary",
"array",
"."
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L4-L12 |
45,257 | sembaye/numberconverter | index.js | decinputtobin | function decinputtobin(decinput){
var len = decinput.length;
if(len == 0){return filledarray(false, 1);}
var bin = new Array();
var digit = new Array(4);
for (var i = 0; i < len; i++){
switch (decinput[i]){
case '0': digit[0] = false; digit[1] = false; digit[2] = false; digit[3] = false; break;
ca... | javascript | function decinputtobin(decinput){
var len = decinput.length;
if(len == 0){return filledarray(false, 1);}
var bin = new Array();
var digit = new Array(4);
for (var i = 0; i < len; i++){
switch (decinput[i]){
case '0': digit[0] = false; digit[1] = false; digit[2] = false; digit[3] = false; break;
ca... | [
"function",
"decinputtobin",
"(",
"decinput",
")",
"{",
"var",
"len",
"=",
"decinput",
".",
"length",
";",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
"filledarray",
"(",
"false",
",",
"1",
")",
";",
"}",
"var",
"bin",
"=",
"new",
"Array",
"("... | Computes a binary array out of a decimal input string | [
"Computes",
"a",
"binary",
"array",
"out",
"of",
"a",
"decimal",
"input",
"string"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L15-L37 |
45,258 | sembaye/numberconverter | index.js | bininputtobin | function bininputtobin(bininput){
var len = bininput.length;
if(len == 0){return filledarray(false, 1);}
var bin = new Array(len);
var j = 0;
for (var i = 0; i < len; i++){
switch (bininput[i]){
case '0': bin[j++] = false; break;
case '1': bin[j++] = true; break;
default: break;
}
}
re... | javascript | function bininputtobin(bininput){
var len = bininput.length;
if(len == 0){return filledarray(false, 1);}
var bin = new Array(len);
var j = 0;
for (var i = 0; i < len; i++){
switch (bininput[i]){
case '0': bin[j++] = false; break;
case '1': bin[j++] = true; break;
default: break;
}
}
re... | [
"function",
"bininputtobin",
"(",
"bininput",
")",
"{",
"var",
"len",
"=",
"bininput",
".",
"length",
";",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
"filledarray",
"(",
"false",
",",
"1",
")",
";",
"}",
"var",
"bin",
"=",
"new",
"Array",
"("... | Computes a binary array out of a binary input string | [
"Computes",
"a",
"binary",
"array",
"out",
"of",
"a",
"binary",
"input",
"string"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L70-L83 |
45,259 | sembaye/numberconverter | index.js | octinputtobin | function octinputtobin(octinput){
var len = octinput.length;
if(len == 0){return filledarray(false, 1);}
var bin = new Array(len * 3);
var j = 0;
for (var i = 0; i < len; i++){
switch (octinput[i]){
case '0': bin[j+0] = false; bin[j+1] = false; bin[j+2] = false; j+=3; break;
case '1': bin[j+0] = f... | javascript | function octinputtobin(octinput){
var len = octinput.length;
if(len == 0){return filledarray(false, 1);}
var bin = new Array(len * 3);
var j = 0;
for (var i = 0; i < len; i++){
switch (octinput[i]){
case '0': bin[j+0] = false; bin[j+1] = false; bin[j+2] = false; j+=3; break;
case '1': bin[j+0] = f... | [
"function",
"octinputtobin",
"(",
"octinput",
")",
"{",
"var",
"len",
"=",
"octinput",
".",
"length",
";",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
"filledarray",
"(",
"false",
",",
"1",
")",
";",
"}",
"var",
"bin",
"=",
"new",
"Array",
"("... | Computes a binary array out of an octal input string | [
"Computes",
"a",
"binary",
"array",
"out",
"of",
"an",
"octal",
"input",
"string"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L86-L105 |
45,260 | sembaye/numberconverter | index.js | bintodecoutput | function bintodecoutput(bin){
var len = bin.length;
var decoutput = String();
var work = new Array(len);
var outputlen = 0;
for(var i=0; i<len; i++){work[i] = bin[i];}
while(len){
// as long as a remaining value exists
var lead = false;
var bit0;
var bit1;
var bit2;
var bit3;
var... | javascript | function bintodecoutput(bin){
var len = bin.length;
var decoutput = String();
var work = new Array(len);
var outputlen = 0;
for(var i=0; i<len; i++){work[i] = bin[i];}
while(len){
// as long as a remaining value exists
var lead = false;
var bit0;
var bit1;
var bit2;
var bit3;
var... | [
"function",
"bintodecoutput",
"(",
"bin",
")",
"{",
"var",
"len",
"=",
"bin",
".",
"length",
";",
"var",
"decoutput",
"=",
"String",
"(",
")",
";",
"var",
"work",
"=",
"new",
"Array",
"(",
"len",
")",
";",
"var",
"outputlen",
"=",
"0",
";",
"for",
... | Formats the given binary array to a decimal output string | [
"Formats",
"the",
"given",
"binary",
"array",
"to",
"a",
"decimal",
"output",
"string"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L108-L176 |
45,261 | sembaye/numberconverter | index.js | bintohexoutput | function bintohexoutput(bin){
var len = bin.length;
var hexoutput = String();
for(var i=0; i<len; i+=4){
if((i > 0) && !(i%8)){hexoutput = " " + hexoutput;}
var value = 0;
if(bin[len - 1 - i - 0]){value+=1;}
if(bin[len - 1 - i - 1]){value+=2;}
if(bin[len - 1 - i - 2]){value+=4;}
if(bin[len... | javascript | function bintohexoutput(bin){
var len = bin.length;
var hexoutput = String();
for(var i=0; i<len; i+=4){
if((i > 0) && !(i%8)){hexoutput = " " + hexoutput;}
var value = 0;
if(bin[len - 1 - i - 0]){value+=1;}
if(bin[len - 1 - i - 1]){value+=2;}
if(bin[len - 1 - i - 2]){value+=4;}
if(bin[len... | [
"function",
"bintohexoutput",
"(",
"bin",
")",
"{",
"var",
"len",
"=",
"bin",
".",
"length",
";",
"var",
"hexoutput",
"=",
"String",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"+=",
"4",
")",
"{",
"if",
"... | Formats the given binary array to a hexadecimal output string | [
"Formats",
"the",
"given",
"binary",
"array",
"to",
"a",
"hexadecimal",
"output",
"string"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L179-L211 |
45,262 | sembaye/numberconverter | index.js | bintobinoutput | function bintobinoutput(bin){
var len = bin.length;
var binoutput = String();
for(var i=0; i<len; i++){
if((i > 0) && !(i%8)){binoutput = " " + binoutput;}
if(bin[len - 1 - i]){binoutput = "1" + binoutput;}else{binoutput = "0" + binoutput;}
}
// todo: make faster
return binoutput;
} | javascript | function bintobinoutput(bin){
var len = bin.length;
var binoutput = String();
for(var i=0; i<len; i++){
if((i > 0) && !(i%8)){binoutput = " " + binoutput;}
if(bin[len - 1 - i]){binoutput = "1" + binoutput;}else{binoutput = "0" + binoutput;}
}
// todo: make faster
return binoutput;
} | [
"function",
"bintobinoutput",
"(",
"bin",
")",
"{",
"var",
"len",
"=",
"bin",
".",
"length",
";",
"var",
"binoutput",
"=",
"String",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"... | Formats the given binary array to a binary output string | [
"Formats",
"the",
"given",
"binary",
"array",
"to",
"a",
"binary",
"output",
"string"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L214-L223 |
45,263 | sembaye/numberconverter | index.js | bintooctoutput | function bintooctoutput(bin){
var len = bin.length;
var octoutput = String();
for(var i=0; i<len; i+=3){
if((i > 0) && !(i%24)){octoutput = " " + octoutput;}
var value = 0;
if(bin[len - 1 - i - 0]){value+=1;}
if(bin[len - 1 - i - 1]){value+=2;}
if(bin[len - 1 - i - 2]){value+=4;}
switch(va... | javascript | function bintooctoutput(bin){
var len = bin.length;
var octoutput = String();
for(var i=0; i<len; i+=3){
if((i > 0) && !(i%24)){octoutput = " " + octoutput;}
var value = 0;
if(bin[len - 1 - i - 0]){value+=1;}
if(bin[len - 1 - i - 1]){value+=2;}
if(bin[len - 1 - i - 2]){value+=4;}
switch(va... | [
"function",
"bintooctoutput",
"(",
"bin",
")",
"{",
"var",
"len",
"=",
"bin",
".",
"length",
";",
"var",
"octoutput",
"=",
"String",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"+=",
"3",
")",
"{",
"if",
"... | Formats the given binary array to a octal output string | [
"Formats",
"the",
"given",
"binary",
"array",
"to",
"a",
"octal",
"output",
"string"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L226-L249 |
45,264 | sembaye/numberconverter | index.js | filledarray | function filledarray(value, size){
var a = new Array(size);
for(var i=0; i<size; i++){a[i] = value;}
return a;
} | javascript | function filledarray(value, size){
var a = new Array(size);
for(var i=0; i<size; i++){a[i] = value;}
return a;
} | [
"function",
"filledarray",
"(",
"value",
",",
"size",
")",
"{",
"var",
"a",
"=",
"new",
"Array",
"(",
"size",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"a",
"[",
"i",
"]",
"=",
"value",
";"... | Returns an array of a given size filled with the given value. | [
"Returns",
"an",
"array",
"of",
"a",
"given",
"size",
"filled",
"with",
"the",
"given",
"value",
"."
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L252-L256 |
45,265 | sembaye/numberconverter | index.js | binadd | function binadd(bin1, bin2){
var i1 = bin1.length;
var i2 = bin2.length;
var i3 = (i1 > i2) ? (i1 + 1) : (i2 + 1);
var result = new Array(i3);
var c = 0;
// Add the two arrays as long as there exist elements in the arrays
while((i1 > 0) && (i2 > 0)){
i1--;
i2--;
i3--;
if(bin1[i1]){c++;}
... | javascript | function binadd(bin1, bin2){
var i1 = bin1.length;
var i2 = bin2.length;
var i3 = (i1 > i2) ? (i1 + 1) : (i2 + 1);
var result = new Array(i3);
var c = 0;
// Add the two arrays as long as there exist elements in the arrays
while((i1 > 0) && (i2 > 0)){
i1--;
i2--;
i3--;
if(bin1[i1]){c++;}
... | [
"function",
"binadd",
"(",
"bin1",
",",
"bin2",
")",
"{",
"var",
"i1",
"=",
"bin1",
".",
"length",
";",
"var",
"i2",
"=",
"bin2",
".",
"length",
";",
"var",
"i3",
"=",
"(",
"i1",
">",
"i2",
")",
"?",
"(",
"i1",
"+",
"1",
")",
":",
"(",
"i2"... | Addition of two binary arrays | [
"Addition",
"of",
"two",
"binary",
"arrays"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L259-L295 |
45,266 | sembaye/numberconverter | index.js | binaddone | function binaddone(bin){
var len = bin.length;
var result = new Array(len + 1);
var c = true; // carry bit
var i = len; // i points at the bit in bin one after the untouched bit
while(c && (i > 0)){
i--;
c = bin[i];
result[i+1] = !c;
}
if(i){
// Return remaining untouched bin concatena... | javascript | function binaddone(bin){
var len = bin.length;
var result = new Array(len + 1);
var c = true; // carry bit
var i = len; // i points at the bit in bin one after the untouched bit
while(c && (i > 0)){
i--;
c = bin[i];
result[i+1] = !c;
}
if(i){
// Return remaining untouched bin concatena... | [
"function",
"binaddone",
"(",
"bin",
")",
"{",
"var",
"len",
"=",
"bin",
".",
"length",
";",
"var",
"result",
"=",
"new",
"Array",
"(",
"len",
"+",
"1",
")",
";",
"var",
"c",
"=",
"true",
";",
"// carry bit",
"var",
"i",
"=",
"len",
";",
"// i po... | Addition of 1 to a binary array | [
"Addition",
"of",
"1",
"to",
"a",
"binary",
"array"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L298-L321 |
45,267 | sembaye/numberconverter | index.js | bintruncate | function bintruncate(bin, size){
var len = bin.length;
if(len < size){
return filledarray(false, size-len).concat(bin);
}else{
return bin.slice(len - size);
}
} | javascript | function bintruncate(bin, size){
var len = bin.length;
if(len < size){
return filledarray(false, size-len).concat(bin);
}else{
return bin.slice(len - size);
}
} | [
"function",
"bintruncate",
"(",
"bin",
",",
"size",
")",
"{",
"var",
"len",
"=",
"bin",
".",
"length",
";",
"if",
"(",
"len",
"<",
"size",
")",
"{",
"return",
"filledarray",
"(",
"false",
",",
"size",
"-",
"len",
")",
".",
"concat",
"(",
"bin",
"... | Either truncates the binary array or fills the MSBs with 0 to fit the size. | [
"Either",
"truncates",
"the",
"binary",
"array",
"or",
"fills",
"the",
"MSBs",
"with",
"0",
"to",
"fit",
"the",
"size",
"."
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L353-L360 |
45,268 | sembaye/numberconverter | index.js | onescomplement | function onescomplement(bin){
var len = bin.length;
var onebin = new Array(len);
for (var i=0; i<len; i++){onebin[i] = !bin[i];}
return onebin;
} | javascript | function onescomplement(bin){
var len = bin.length;
var onebin = new Array(len);
for (var i=0; i<len; i++){onebin[i] = !bin[i];}
return onebin;
} | [
"function",
"onescomplement",
"(",
"bin",
")",
"{",
"var",
"len",
"=",
"bin",
".",
"length",
";",
"var",
"onebin",
"=",
"new",
"Array",
"(",
"len",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"o... | Computes the one's complement of the binary number | [
"Computes",
"the",
"one",
"s",
"complement",
"of",
"the",
"binary",
"number"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L363-L368 |
45,269 | sembaye/numberconverter | index.js | updatedec | function updatedec(){
var dec = decinputfield;
if(decinputvalue != dec){
updateall(decinputtobin(dec));
clearallinputs();
decinputfield = dec;
decinputvalue = dec;
}
} | javascript | function updatedec(){
var dec = decinputfield;
if(decinputvalue != dec){
updateall(decinputtobin(dec));
clearallinputs();
decinputfield = dec;
decinputvalue = dec;
}
} | [
"function",
"updatedec",
"(",
")",
"{",
"var",
"dec",
"=",
"decinputfield",
";",
"if",
"(",
"decinputvalue",
"!=",
"dec",
")",
"{",
"updateall",
"(",
"decinputtobin",
"(",
"dec",
")",
")",
";",
"clearallinputs",
"(",
")",
";",
"decinputfield",
"=",
"dec"... | The decimal input field has been changed | [
"The",
"decimal",
"input",
"field",
"has",
"been",
"changed"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L388-L396 |
45,270 | sembaye/numberconverter | index.js | updatehex | function updatehex(){
var hex = hexinputfield;
if(hexinputvalue != hex){
updateall(hexinputtobin(hex));
clearallinputs();
hexinputfield = hex;
hexinputvalue = hex;
}
} | javascript | function updatehex(){
var hex = hexinputfield;
if(hexinputvalue != hex){
updateall(hexinputtobin(hex));
clearallinputs();
hexinputfield = hex;
hexinputvalue = hex;
}
} | [
"function",
"updatehex",
"(",
")",
"{",
"var",
"hex",
"=",
"hexinputfield",
";",
"if",
"(",
"hexinputvalue",
"!=",
"hex",
")",
"{",
"updateall",
"(",
"hexinputtobin",
"(",
"hex",
")",
")",
";",
"clearallinputs",
"(",
")",
";",
"hexinputfield",
"=",
"hex"... | The hexadecimal input field has been changed | [
"The",
"hexadecimal",
"input",
"field",
"has",
"been",
"changed"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L399-L407 |
45,271 | sembaye/numberconverter | index.js | updatebin | function updatebin(){
var bin = bininputfield;
if(bininputvalue != bin){
updateall(bininputtobin(bin));
clearallinputs();
bininputfield = bin;
bininputvalue = bin;
}
} | javascript | function updatebin(){
var bin = bininputfield;
if(bininputvalue != bin){
updateall(bininputtobin(bin));
clearallinputs();
bininputfield = bin;
bininputvalue = bin;
}
} | [
"function",
"updatebin",
"(",
")",
"{",
"var",
"bin",
"=",
"bininputfield",
";",
"if",
"(",
"bininputvalue",
"!=",
"bin",
")",
"{",
"updateall",
"(",
"bininputtobin",
"(",
"bin",
")",
")",
";",
"clearallinputs",
"(",
")",
";",
"bininputfield",
"=",
"bin"... | The binary input field has been changed | [
"The",
"binary",
"input",
"field",
"has",
"been",
"changed"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L410-L418 |
45,272 | sembaye/numberconverter | index.js | updateoct | function updateoct(){
var oct = octinputfield;
if(octinputvalue != oct){
updateall(octinputtobin(oct));
clearallinputs();
octinputfield = oct;
octinputvalue = oct;
}
} | javascript | function updateoct(){
var oct = octinputfield;
if(octinputvalue != oct){
updateall(octinputtobin(oct));
clearallinputs();
octinputfield = oct;
octinputvalue = oct;
}
} | [
"function",
"updateoct",
"(",
")",
"{",
"var",
"oct",
"=",
"octinputfield",
";",
"if",
"(",
"octinputvalue",
"!=",
"oct",
")",
"{",
"updateall",
"(",
"octinputtobin",
"(",
"oct",
")",
")",
";",
"clearallinputs",
"(",
")",
";",
"octinputfield",
"=",
"oct"... | The octal input field has been changed | [
"The",
"octal",
"input",
"field",
"has",
"been",
"changed"
] | c3cd4c0c567e520354e0e4fb60a669fd5f07877a | https://github.com/sembaye/numberconverter/blob/c3cd4c0c567e520354e0e4fb60a669fd5f07877a/index.js#L421-L429 |
45,273 | ryb73/dealers-choice-meta | packages/front-end/src/components/dc-game-canvas/animation-throttler.js | AnimationThrottler | function AnimationThrottler(delay) {
if(!delay) delay = DELAY;
// Anim is considered active if it's running or queued
var currentDelay = 0;
// func: Function that takes no params and returns a promise
function requestAnim(func) {
var result = q.delay(currentDelay)
.thenResolve(func)
.then(st... | javascript | function AnimationThrottler(delay) {
if(!delay) delay = DELAY;
// Anim is considered active if it's running or queued
var currentDelay = 0;
// func: Function that takes no params and returns a promise
function requestAnim(func) {
var result = q.delay(currentDelay)
.thenResolve(func)
.then(st... | [
"function",
"AnimationThrottler",
"(",
"delay",
")",
"{",
"if",
"(",
"!",
"delay",
")",
"delay",
"=",
"DELAY",
";",
"// Anim is considered active if it's running or queued",
"var",
"currentDelay",
"=",
"0",
";",
"// func: Function that takes no params and returns a promise"... | Manges a queue of pending animates so that, if many are requested, not all of them run at once. An example of a situation where many animations would be requested at once is at the beginning of the game when cards are being dealt. | [
"Manges",
"a",
"queue",
"of",
"pending",
"animates",
"so",
"that",
"if",
"many",
"are",
"requested",
"not",
"all",
"of",
"them",
"run",
"at",
"once",
".",
"An",
"example",
"of",
"a",
"situation",
"where",
"many",
"animations",
"would",
"be",
"requested",
... | 4632e8897c832b01d944a340cf87d5c807809925 | https://github.com/ryb73/dealers-choice-meta/blob/4632e8897c832b01d944a340cf87d5c807809925/packages/front-end/src/components/dc-game-canvas/animation-throttler.js#L14-L44 |
45,274 | chapmanu/hb | lib/hummingbird.js | function(service, credentials) {
Services.load(service);
process.nextTick(function() {
Services.boot(service, credentials);
}.bind(this));
} | javascript | function(service, credentials) {
Services.load(service);
process.nextTick(function() {
Services.boot(service, credentials);
}.bind(this));
} | [
"function",
"(",
"service",
",",
"credentials",
")",
"{",
"Services",
".",
"load",
"(",
"service",
")",
";",
"process",
".",
"nextTick",
"(",
"function",
"(",
")",
"{",
"Services",
".",
"boot",
"(",
"service",
",",
"credentials",
")",
";",
"}",
".",
... | Add a service to be streamed
@param {string} service - identifier of service, 'twitter', 'instagram', etc.
@param {object} credentials - API credentials for the service | [
"Add",
"a",
"service",
"to",
"be",
"streamed"
] | 5edd8de89c7c5fdffc3df0c627513889220f7d51 | https://github.com/chapmanu/hb/blob/5edd8de89c7c5fdffc3df0c627513889220f7d51/lib/hummingbird.js#L38-L43 | |
45,275 | DScheglov/merest | lib/controllers/update.js | update | function update(req, res, next) {
res.__apiMethod = 'update';
const self = this;
const id = req.params.id;
let filter = this.option('update', 'filter');
const fields = this.option('update', 'fields');
const populate = this.option('update', 'populate');
const readonly = this.option('update', 'readon... | javascript | function update(req, res, next) {
res.__apiMethod = 'update';
const self = this;
const id = req.params.id;
let filter = this.option('update', 'filter');
const fields = this.option('update', 'fields');
const populate = this.option('update', 'populate');
const readonly = this.option('update', 'readon... | [
"function",
"update",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"res",
".",
"__apiMethod",
"=",
"'update'",
";",
"const",
"self",
"=",
"this",
";",
"const",
"id",
"=",
"req",
".",
"params",
".",
"id",
";",
"let",
"filter",
"=",
"this",
".",
... | update - controller that updates a model instance
@param {express.Request} req Request
@param {express.Response} res Response
@param {Function} next Callback to pass a thrown exception
@throws ModelAPIError(404, '...')
@throws ModelAPIError(422, '...')
@memberof ModelAPIRouter | [
"update",
"-",
"controller",
"that",
"updates",
"a",
"model",
"instance"
] | d39e7ef0d56236247773467e9bfe83cb128ebc01 | https://github.com/DScheglov/merest/blob/d39e7ef0d56236247773467e9bfe83cb128ebc01/lib/controllers/update.js#L18-L71 |
45,276 | cheminfo-js/peaks-similarity | src/index.js | getOverlapTrapezoid | function getOverlapTrapezoid(x1, y1, x2, y2) {
var factor = 2 / (widthTop + widthBottom); // correction for surface=1
if (y1 === 0 || y2 === 0) return 0;
if (x1 === x2) { // they have the same position
return Math.min(y1, y2);
}
var diff = Math.abs(x1 - x2);
if (diff >= widthBottom) retur... | javascript | function getOverlapTrapezoid(x1, y1, x2, y2) {
var factor = 2 / (widthTop + widthBottom); // correction for surface=1
if (y1 === 0 || y2 === 0) return 0;
if (x1 === x2) { // they have the same position
return Math.min(y1, y2);
}
var diff = Math.abs(x1 - x2);
if (diff >= widthBottom) retur... | [
"function",
"getOverlapTrapezoid",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")",
"{",
"var",
"factor",
"=",
"2",
"/",
"(",
"widthTop",
"+",
"widthBottom",
")",
";",
"// correction for surface=1",
"if",
"(",
"y1",
"===",
"0",
"||",
"y2",
"===",
"0",
... | This is the old trapezoid similarity | [
"This",
"is",
"the",
"old",
"trapezoid",
"similarity"
] | d1b011072c953458f05d3aa1f18d420a67cf717f | https://github.com/cheminfo-js/peaks-similarity/blob/d1b011072c953458f05d3aa1f18d420a67cf717f/src/index.js#L157-L213 |
45,277 | cheminfo-js/peaks-similarity | src/index.js | calculateDiff | function calculateDiff() {
// we need to take 2 pointers
// and travel progressively between them ...
var newFirst = [
[].concat(array1Extract[0]),
[].concat(array1Extract[1])
];
var newSecond = [
[].concat(array2Extract[0]),
[].concat(array2Extract[1])
];
var array1L... | javascript | function calculateDiff() {
// we need to take 2 pointers
// and travel progressively between them ...
var newFirst = [
[].concat(array1Extract[0]),
[].concat(array1Extract[1])
];
var newSecond = [
[].concat(array2Extract[0]),
[].concat(array2Extract[1])
];
var array1L... | [
"function",
"calculateDiff",
"(",
")",
"{",
"// we need to take 2 pointers",
"// and travel progressively between them ...",
"var",
"newFirst",
"=",
"[",
"[",
"]",
".",
"concat",
"(",
"array1Extract",
"[",
"0",
"]",
")",
",",
"[",
"]",
".",
"concat",
"(",
"array... | this method calculates the total diff. The sum of positive value will yield to overlap | [
"this",
"method",
"calculates",
"the",
"total",
"diff",
".",
"The",
"sum",
"of",
"positive",
"value",
"will",
"yield",
"to",
"overlap"
] | d1b011072c953458f05d3aa1f18d420a67cf717f | https://github.com/cheminfo-js/peaks-similarity/blob/d1b011072c953458f05d3aa1f18d420a67cf717f/src/index.js#L217-L262 |
45,278 | cheminfo-js/peaks-similarity | src/index.js | commonExtractAndNormalize | function commonExtractAndNormalize(array1, array2, width, from, to, common) {
if (!(Array.isArray(array1)) || !(Array.isArray(array2))) {
return {
info: undefined,
data: undefined
};
}
var extract1 = extract(array1, from, to);
var extract2 = extract(array2, from, to);
var common1, common2,... | javascript | function commonExtractAndNormalize(array1, array2, width, from, to, common) {
if (!(Array.isArray(array1)) || !(Array.isArray(array2))) {
return {
info: undefined,
data: undefined
};
}
var extract1 = extract(array1, from, to);
var extract2 = extract(array2, from, to);
var common1, common2,... | [
"function",
"commonExtractAndNormalize",
"(",
"array1",
",",
"array2",
",",
"width",
",",
"from",
",",
"to",
",",
"common",
")",
"{",
"if",
"(",
"!",
"(",
"Array",
".",
"isArray",
"(",
"array1",
")",
")",
"||",
"!",
"(",
"Array",
".",
"isArray",
"(",... | this method will systematically take care of both array | [
"this",
"method",
"will",
"systematically",
"take",
"care",
"of",
"both",
"array"
] | d1b011072c953458f05d3aa1f18d420a67cf717f | https://github.com/cheminfo-js/peaks-similarity/blob/d1b011072c953458f05d3aa1f18d420a67cf717f/src/index.js#L396-L427 |
45,279 | henrytseng/angular-state-router | src/services/state-router.js | function(nameParams) {
if(nameParams && nameParams.match(/^[a-zA-Z0-9_\.]*\(.*\)$/)) {
var npart = nameParams.substring(0, nameParams.indexOf('('));
var ppart = Parameters( nameParams.substring(nameParams.indexOf('(')+1, nameParams.lastIndexOf(')')) );
return {
name: npart,
params... | javascript | function(nameParams) {
if(nameParams && nameParams.match(/^[a-zA-Z0-9_\.]*\(.*\)$/)) {
var npart = nameParams.substring(0, nameParams.indexOf('('));
var ppart = Parameters( nameParams.substring(nameParams.indexOf('(')+1, nameParams.lastIndexOf(')')) );
return {
name: npart,
params... | [
"function",
"(",
"nameParams",
")",
"{",
"if",
"(",
"nameParams",
"&&",
"nameParams",
".",
"match",
"(",
"/",
"^[a-zA-Z0-9_\\.]*\\(.*\\)$",
"/",
")",
")",
"{",
"var",
"npart",
"=",
"nameParams",
".",
"substring",
"(",
"0",
",",
"nameParams",
".",
"indexOf"... | Parse state notation name-params.
Assume all parameter values are strings
@param {String} nameParams A name-params string
@return {Object} A name string and param Object | [
"Parse",
"state",
"notation",
"name",
"-",
"params",
"."
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L33-L49 | |
45,280 | henrytseng/angular-state-router | src/services/state-router.js | function(name) {
name = name || '';
// TODO optimize with RegExp
var nameChain = name.split('.');
for(var i=0; i<nameChain.length; i++) {
if(!nameChain[i].match(/[a-zA-Z0-9_]+/)) {
return false;
}
}
return true;
} | javascript | function(name) {
name = name || '';
// TODO optimize with RegExp
var nameChain = name.split('.');
for(var i=0; i<nameChain.length; i++) {
if(!nameChain[i].match(/[a-zA-Z0-9_]+/)) {
return false;
}
}
return true;
} | [
"function",
"(",
"name",
")",
"{",
"name",
"=",
"name",
"||",
"''",
";",
"// TODO optimize with RegExp",
"var",
"nameChain",
"=",
"name",
".",
"split",
"(",
"'.'",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"nameChain",
".",
"length",... | Validate state name
@param {String} name A unique identifier for the state; using dot-notation
@return {Boolean} True if name is valid, false if not | [
"Validate",
"state",
"name"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L70-L83 | |
45,281 | henrytseng/angular-state-router | src/services/state-router.js | function(query) {
query = query || '';
// TODO optimize with RegExp
var nameChain = query.split('.');
for(var i=0; i<nameChain.length; i++) {
if(!nameChain[i].match(/(\*(\*)?|[a-zA-Z0-9_]+)/)) {
return false;
}
}
return true;
} | javascript | function(query) {
query = query || '';
// TODO optimize with RegExp
var nameChain = query.split('.');
for(var i=0; i<nameChain.length; i++) {
if(!nameChain[i].match(/(\*(\*)?|[a-zA-Z0-9_]+)/)) {
return false;
}
}
return true;
} | [
"function",
"(",
"query",
")",
"{",
"query",
"=",
"query",
"||",
"''",
";",
"// TODO optimize with RegExp",
"var",
"nameChain",
"=",
"query",
".",
"split",
"(",
"'.'",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"nameChain",
".",
"leng... | Validate state query
@param {String} query A query for the state; using dot-notation
@return {Boolean} True if name is valid, false if not | [
"Validate",
"state",
"query"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L91-L104 | |
45,282 | henrytseng/angular-state-router | src/services/state-router.js | function(a, b) {
a = a || {};
b = b || {};
return a.name === b.name && angular.equals(a.params, b.params);
} | javascript | function(a, b) {
a = a || {};
b = b || {};
return a.name === b.name && angular.equals(a.params, b.params);
} | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"a",
"=",
"a",
"||",
"{",
"}",
";",
"b",
"=",
"b",
"||",
"{",
"}",
";",
"return",
"a",
".",
"name",
"===",
"b",
".",
"name",
"&&",
"angular",
".",
"equals",
"(",
"a",
".",
"params",
",",
"b",
".",... | Compare two states, compares values.
@return {Boolean} True if states are the same, false if states are different | [
"Compare",
"two",
"states",
"compares",
"values",
"."
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L111-L115 | |
45,283 | henrytseng/angular-state-router | src/services/state-router.js | function(name) {
var nameList = name.split('.');
return nameList
.map(function(item, i, list) {
return list.slice(0, i+1).join('.');
})
.filter(function(item) {
return item !== null;
});
} | javascript | function(name) {
var nameList = name.split('.');
return nameList
.map(function(item, i, list) {
return list.slice(0, i+1).join('.');
})
.filter(function(item) {
return item !== null;
});
} | [
"function",
"(",
"name",
")",
"{",
"var",
"nameList",
"=",
"name",
".",
"split",
"(",
"'.'",
")",
";",
"return",
"nameList",
".",
"map",
"(",
"function",
"(",
"item",
",",
"i",
",",
"list",
")",
"{",
"return",
"list",
".",
"slice",
"(",
"0",
",",... | Get a list of parent states
@param {String} name A unique identifier for the state; using dot-notation
@return {Array} An Array of parent states | [
"Get",
"a",
"list",
"of",
"parent",
"states"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L123-L133 | |
45,284 | henrytseng/angular-state-router | src/services/state-router.js | function(name) {
name = name || '';
var state = null;
// Only use valid state queries
if(!_validateStateName(name)) {
return null;
// Use cache if exists
} else if(_stateCache[name]) {
return _stateCache[name];
}
var nameChain = _getNameChain(name);
var stateChain... | javascript | function(name) {
name = name || '';
var state = null;
// Only use valid state queries
if(!_validateStateName(name)) {
return null;
// Use cache if exists
} else if(_stateCache[name]) {
return _stateCache[name];
}
var nameChain = _getNameChain(name);
var stateChain... | [
"function",
"(",
"name",
")",
"{",
"name",
"=",
"name",
"||",
"''",
";",
"var",
"state",
"=",
"null",
";",
"// Only use valid state queries",
"if",
"(",
"!",
"_validateStateName",
"(",
"name",
")",
")",
"{",
"return",
"null",
";",
"// Use cache if exists",
... | Internal method to crawl library heirarchy
@param {String} name A unique identifier for the state; using state-notation
@return {Object} A state data Object | [
"Internal",
"method",
"to",
"crawl",
"library",
"heirarchy"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L141-L179 | |
45,285 | henrytseng/angular-state-router | src/services/state-router.js | function(name, data) {
if(name === null || typeof name === 'undefined') {
throw new Error('Name cannot be null.');
// Only use valid state names
} else if(!_validateStateName(name)) {
throw new Error('Invalid state name.');
}
// Create state
var state = angular.copy(data);
... | javascript | function(name, data) {
if(name === null || typeof name === 'undefined') {
throw new Error('Name cannot be null.');
// Only use valid state names
} else if(!_validateStateName(name)) {
throw new Error('Invalid state name.');
}
// Create state
var state = angular.copy(data);
... | [
"function",
"(",
"name",
",",
"data",
")",
"{",
"if",
"(",
"name",
"===",
"null",
"||",
"typeof",
"name",
"===",
"'undefined'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Name cannot be null.'",
")",
";",
"// Only use valid state names",
"}",
"else",
"if",
... | Internal method to store a state definition. Parameters should be included in data Object not state name.
@param {String} name A unique identifier for the state; using state-notation
@param {Object} data A state definition data Object
@return {Object} A state data Object | [
"Internal",
"method",
"to",
"store",
"a",
"state",
"definition",
".",
"Parameters",
"should",
"be",
"included",
"in",
"data",
"Object",
"not",
"state",
"name",
"."
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L188-L218 | |
45,286 | henrytseng/angular-state-router | src/services/state-router.js | function(data) {
// Keep the last n states (e.g. - defaults 5)
var historyLength = _options.historyLength || 5;
if(data) {
_history.push(data);
}
// Update length
if(_history.length > historyLength) {
_history.splice(0, _history.length - historyLength);
}
... | javascript | function(data) {
// Keep the last n states (e.g. - defaults 5)
var historyLength = _options.historyLength || 5;
if(data) {
_history.push(data);
}
// Update length
if(_history.length > historyLength) {
_history.splice(0, _history.length - historyLength);
}
... | [
"function",
"(",
"data",
")",
"{",
"// Keep the last n states (e.g. - defaults 5)",
"var",
"historyLength",
"=",
"_options",
".",
"historyLength",
"||",
"5",
";",
"if",
"(",
"data",
")",
"{",
"_history",
".",
"push",
"(",
"data",
")",
";",
"}",
"// Update leng... | Internal method to add history and correct length
@param {Object} data An Object | [
"Internal",
"method",
"to",
"add",
"history",
"and",
"correct",
"length"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L290-L302 | |
45,287 | henrytseng/angular-state-router | src/services/state-router.js | function(name, params) {
return _changeState(name, params).then(function() {
$rootScope.$broadcast('$stateChangeComplete', null, _current);
}, function(err) {
$rootScope.$broadcast('$stateChangeComplete', err, _current);
});
} | javascript | function(name, params) {
return _changeState(name, params).then(function() {
$rootScope.$broadcast('$stateChangeComplete', null, _current);
}, function(err) {
$rootScope.$broadcast('$stateChangeComplete', err, _current);
});
} | [
"function",
"(",
"name",
",",
"params",
")",
"{",
"return",
"_changeState",
"(",
"name",
",",
"params",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"$rootScope",
".",
"$broadcast",
"(",
"'$stateChangeComplete'",
",",
"null",
",",
"_current",
")",
"... | Internal method to change to state and broadcast completion
@param {String} name A unique identifier for the state; using state-notation including optional parameters
@param {Object} params A data object of params
@return {Promise} A promise fulfilled when state change occurs | [
"Internal",
"method",
"to",
"change",
"to",
"state",
"and",
"broadcast",
"completion"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L414-L420 | |
45,288 | henrytseng/angular-state-router | src/services/state-router.js | function() {
var deferred = $q.defer();
$rootScope.$evalAsync(function() {
var n = _current.name;
var p = angular.copy(_current.params);
if(!_current.params) {
_current.params = {};
}
_current.params.deprecated = true;
// Notify
$rootScope.... | javascript | function() {
var deferred = $q.defer();
$rootScope.$evalAsync(function() {
var n = _current.name;
var p = angular.copy(_current.params);
if(!_current.params) {
_current.params = {};
}
_current.params.deprecated = true;
// Notify
$rootScope.... | [
"function",
"(",
")",
"{",
"var",
"deferred",
"=",
"$q",
".",
"defer",
"(",
")",
";",
"$rootScope",
".",
"$evalAsync",
"(",
"function",
"(",
")",
"{",
"var",
"n",
"=",
"_current",
".",
"name",
";",
"var",
"p",
"=",
"angular",
".",
"copy",
"(",
"_... | Reloads the current state
@return {Promise} A promise fulfilled when state change occurs | [
"Reloads",
"the",
"current",
"state"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L427-L449 | |
45,289 | henrytseng/angular-state-router | src/services/state-router.js | function(handler, priority) {
if(typeof handler !== 'function') {
throw new Error('Middleware must be a function.');
}
if(typeof priority !== 'undefined') handler.priority = priority;
_layerList.push(handler);
return _inst;
} | javascript | function(handler, priority) {
if(typeof handler !== 'function') {
throw new Error('Middleware must be a function.');
}
if(typeof priority !== 'undefined') handler.priority = priority;
_layerList.push(handler);
return _inst;
} | [
"function",
"(",
"handler",
",",
"priority",
")",
"{",
"if",
"(",
"typeof",
"handler",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Middleware must be a function.'",
")",
";",
"}",
"if",
"(",
"typeof",
"priority",
"!==",
"'undefined'",
")",... | Internal method to add middleware; called during state transition
@param {Function} handler A callback, function(request, next)
@param {Number} priority A number denoting priority
@return {$state} Itself; chainable | [
"Internal",
"method",
"to",
"add",
"middleware",
";",
"called",
"during",
"state",
"transition"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L496-L504 | |
45,290 | henrytseng/angular-state-router | src/services/state-router.js | function(query, params) {
query = query || '';
// No state
if(!_current) {
return false;
// Use RegExp matching
} else if(query instanceof RegExp) {
return !!_current.name.match(query);
// String; state dot-notation
} else if(typeof ... | javascript | function(query, params) {
query = query || '';
// No state
if(!_current) {
return false;
// Use RegExp matching
} else if(query instanceof RegExp) {
return !!_current.name.match(query);
// String; state dot-notation
} else if(typeof ... | [
"function",
"(",
"query",
",",
"params",
")",
"{",
"query",
"=",
"query",
"||",
"''",
";",
"// No state",
"if",
"(",
"!",
"_current",
")",
"{",
"return",
"false",
";",
"// Use RegExp matching",
"}",
"else",
"if",
"(",
"query",
"instanceof",
"RegExp",
")"... | Check query against current state
@param {Mixed} query A string using state notation or a RegExp
@param {Object} params A parameters data object
@return {Boolean} A true if state is parent to current state | [
"Check",
"query",
"against",
"current",
"state"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/state-router.js#L635-L675 | |
45,291 | bikejs/bike | src/bike.js | support | function support (name) {
try {
return BIKE.require(BIKEname + '-' + name);
}
catch (e) {
return BIKE.require(name);
}
} | javascript | function support (name) {
try {
return BIKE.require(BIKEname + '-' + name);
}
catch (e) {
return BIKE.require(name);
}
} | [
"function",
"support",
"(",
"name",
")",
"{",
"try",
"{",
"return",
"BIKE",
".",
"require",
"(",
"BIKEname",
"+",
"'-'",
"+",
"name",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"BIKE",
".",
"require",
"(",
"name",
")",
";",
"}",
"}"
] | Retreive a submodule
@param {String} name Submodule's name
@return {Mixied} Found object | [
"Retreive",
"a",
"submodule"
] | 90c014b7a2cf8f8b92c945b934db526c2ae7e37c | https://github.com/bikejs/bike/blob/90c014b7a2cf8f8b92c945b934db526c2ae7e37c/src/bike.js#L20-L27 |
45,292 | nodejitsu/contour | pagelets/button.js | define | function define() {
var type = this.data.type || this.defaults.type
, collection = this.collection;
this.data.use = collection[type].class;
this.data.text = this.data.text || collection[type].text;
this.data.href = this.data.href || collection[type].href;
return this;
} | javascript | function define() {
var type = this.data.type || this.defaults.type
, collection = this.collection;
this.data.use = collection[type].class;
this.data.text = this.data.text || collection[type].text;
this.data.href = this.data.href || collection[type].href;
return this;
} | [
"function",
"define",
"(",
")",
"{",
"var",
"type",
"=",
"this",
".",
"data",
".",
"type",
"||",
"this",
".",
"defaults",
".",
"type",
",",
"collection",
"=",
"this",
".",
"collection",
";",
"this",
".",
"data",
".",
"use",
"=",
"collection",
"[",
... | Define the class and text that are on the button. Called by set on default.
@returns {Pagelet}
@api private | [
"Define",
"the",
"class",
"and",
"text",
"that",
"are",
"on",
"the",
"button",
".",
"Called",
"by",
"set",
"on",
"default",
"."
] | 0828e9bd25ef1eeb97ea231c447118d9867021b6 | https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/button.js#L62-L71 |
45,293 | chapmanu/hb | lib/services/wordpress/stream.js | function(service, credentials, accounts, keywords) {
Stream.call(this, service, credentials, accounts, keywords);
// Initialize responder
this.responder = new Responder();
} | javascript | function(service, credentials, accounts, keywords) {
Stream.call(this, service, credentials, accounts, keywords);
// Initialize responder
this.responder = new Responder();
} | [
"function",
"(",
"service",
",",
"credentials",
",",
"accounts",
",",
"keywords",
")",
"{",
"Stream",
".",
"call",
"(",
"this",
",",
"service",
",",
"credentials",
",",
"accounts",
",",
"keywords",
")",
";",
"// Initialize responder",
"this",
".",
"responder... | Manages the streaming connection to Wordpress
@constructor
@extends Stream | [
"Manages",
"the",
"streaming",
"connection",
"to",
"Wordpress"
] | 5edd8de89c7c5fdffc3df0c627513889220f7d51 | https://github.com/chapmanu/hb/blob/5edd8de89c7c5fdffc3df0c627513889220f7d51/lib/services/wordpress/stream.js#L13-L19 | |
45,294 | feilaoda/power | public/javascripts/vendor/javascripts/moment.js | getLangDefinition | function getLangDefinition(m) {
var langKey = (typeof m === 'string') && m ||
m && m._lang ||
null;
return langKey ? (languages[langKey] || loadLang(langKey)) : moment;
} | javascript | function getLangDefinition(m) {
var langKey = (typeof m === 'string') && m ||
m && m._lang ||
null;
return langKey ? (languages[langKey] || loadLang(langKey)) : moment;
} | [
"function",
"getLangDefinition",
"(",
"m",
")",
"{",
"var",
"langKey",
"=",
"(",
"typeof",
"m",
"===",
"'string'",
")",
"&&",
"m",
"||",
"m",
"&&",
"m",
".",
"_lang",
"||",
"null",
";",
"return",
"langKey",
"?",
"(",
"languages",
"[",
"langKey",
"]",... | Determines which language definition to use and returns it. With no parameters, it will return the global language. If you pass in a language key, such as 'en', it will return the definition for 'en', so long as 'en' has already been loaded using moment.lang. If you pass in a moment or duration instance, it will dec... | [
"Determines",
"which",
"language",
"definition",
"to",
"use",
"and",
"returns",
"it",
".",
"With",
"no",
"parameters",
"it",
"will",
"return",
"the",
"global",
"language",
".",
"If",
"you",
"pass",
"in",
"a",
"language",
"key",
"such",
"as",
"en",
"it",
... | 89432e5b8e455eceef5f5098d479ad94c88acc59 | https://github.com/feilaoda/power/blob/89432e5b8e455eceef5f5098d479ad94c88acc59/public/javascripts/vendor/javascripts/moment.js#L414-L420 |
45,295 | godaddy/node-gd-assets | lib/config.js | _flatten | function _flatten(groups, groupName, alreadySeen)
{
alreadySeen = alreadySeen || [];
var ret = {};
// Intialize each key to empty so we don't have to check if they exist later
HANDLER_KEYS.forEach(function(key) {
ret[key] = [];
});
var thisGroup = groups[groupName];
if ( !thisGroup )
throw new ... | javascript | function _flatten(groups, groupName, alreadySeen)
{
alreadySeen = alreadySeen || [];
var ret = {};
// Intialize each key to empty so we don't have to check if they exist later
HANDLER_KEYS.forEach(function(key) {
ret[key] = [];
});
var thisGroup = groups[groupName];
if ( !thisGroup )
throw new ... | [
"function",
"_flatten",
"(",
"groups",
",",
"groupName",
",",
"alreadySeen",
")",
"{",
"alreadySeen",
"=",
"alreadySeen",
"||",
"[",
"]",
";",
"var",
"ret",
"=",
"{",
"}",
";",
"// Intialize each key to empty so we don't have to check if they exist later",
"HANDLER_KE... | Flatten a single group into a list of files required for it | [
"Flatten",
"a",
"single",
"group",
"into",
"a",
"list",
"of",
"files",
"required",
"for",
"it"
] | 14723940592090855b95ea5d20abe6291f1a5696 | https://github.com/godaddy/node-gd-assets/blob/14723940592090855b95ea5d20abe6291f1a5696/lib/config.js#L117-L168 |
45,296 | godaddy/node-gd-assets | lib/config.js | resolveFile | function resolveFile(baseDirs, addType, fileName, type, cb)
{
// The label this file will have in the output
// For hbs views, this is the name that it will be save as into the template array.
var label = pathlib.basename(fileName);
// Label can be overridden with entries of the form: "label:file-name-or-path"... | javascript | function resolveFile(baseDirs, addType, fileName, type, cb)
{
// The label this file will have in the output
// For hbs views, this is the name that it will be save as into the template array.
var label = pathlib.basename(fileName);
// Label can be overridden with entries of the form: "label:file-name-or-path"... | [
"function",
"resolveFile",
"(",
"baseDirs",
",",
"addType",
",",
"fileName",
",",
"type",
",",
"cb",
")",
"{",
"// The label this file will have in the output",
"// For hbs views, this is the name that it will be save as into the template array.",
"var",
"label",
"=",
"pathlib"... | Resolve a file name into an absolute path Async if called with a cb, synchronous if not | [
"Resolve",
"a",
"file",
"name",
"into",
"an",
"absolute",
"path",
"Async",
"if",
"called",
"with",
"a",
"cb",
"synchronous",
"if",
"not"
] | 14723940592090855b95ea5d20abe6291f1a5696 | https://github.com/godaddy/node-gd-assets/blob/14723940592090855b95ea5d20abe6291f1a5696/lib/config.js#L184-L242 |
45,297 | Krinkle/node-colorfactory | src/ColorHelper.js | makeStrProtoFn | function makeStrProtoFn(method) {
return function () {
// Convert `arguments` into an array (usually empty or has 1 parameter)
var args = slice.call(arguments, 0);
// Add the current string as the first argument
args.unshift(this);
return ColorHelper[method].apply(ColorHelper, args);
};
} | javascript | function makeStrProtoFn(method) {
return function () {
// Convert `arguments` into an array (usually empty or has 1 parameter)
var args = slice.call(arguments, 0);
// Add the current string as the first argument
args.unshift(this);
return ColorHelper[method].apply(ColorHelper, args);
};
} | [
"function",
"makeStrProtoFn",
"(",
"method",
")",
"{",
"return",
"function",
"(",
")",
"{",
"// Convert `arguments` into an array (usually empty or has 1 parameter)",
"var",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
";",
"// Add the current s... | Can't be used inline in the for-loop, because of variable scope.
Otherwise all methods would be pointing to the method as put in
the variable that lives on until after the loop itself. | [
"Can",
"t",
"be",
"used",
"inline",
"in",
"the",
"for",
"-",
"loop",
"because",
"of",
"variable",
"scope",
".",
"Otherwise",
"all",
"methods",
"would",
"be",
"pointing",
"to",
"the",
"method",
"as",
"put",
"in",
"the",
"variable",
"that",
"lives",
"on",
... | 4c9cec8f3f8e95a3fa402233ceef2dd9c2b040b0 | https://github.com/Krinkle/node-colorfactory/blob/4c9cec8f3f8e95a3fa402233ceef2dd9c2b040b0/src/ColorHelper.js#L208-L216 |
45,298 | naomiaro/fade-curves | index.js | sCurve | function sCurve(length, rotation) {
var curve = new Float32Array(length),
i,
phase = rotation > 0 ? Math.PI / 2 : -(Math.PI / 2);
for (i = 0; i < length; ++i) {
curve[i] = Math.sin(Math.PI * i / length - phase) / 2 + 0.5;
}
return curve;
} | javascript | function sCurve(length, rotation) {
var curve = new Float32Array(length),
i,
phase = rotation > 0 ? Math.PI / 2 : -(Math.PI / 2);
for (i = 0; i < length; ++i) {
curve[i] = Math.sin(Math.PI * i / length - phase) / 2 + 0.5;
}
return curve;
} | [
"function",
"sCurve",
"(",
"length",
",",
"rotation",
")",
"{",
"var",
"curve",
"=",
"new",
"Float32Array",
"(",
"length",
")",
",",
"i",
",",
"phase",
"=",
"rotation",
">",
"0",
"?",
"Math",
".",
"PI",
"/",
"2",
":",
"-",
"(",
"Math",
".",
"PI",... | creating a curve to simulate an S-curve with setValueCurveAtTime. | [
"creating",
"a",
"curve",
"to",
"simulate",
"an",
"S",
"-",
"curve",
"with",
"setValueCurveAtTime",
"."
] | 795ed73fe0cbc110287c2d48a01afdb6b4a49512 | https://github.com/naomiaro/fade-curves/blob/795ed73fe0cbc110287c2d48a01afdb6b4a49512/index.js#L47-L56 |
45,299 | naomiaro/fade-curves | index.js | logarithmic | function logarithmic(length, base, rotation) {
var curve = new Float32Array(length),
index,
x = 0,
i;
for (i = 0; i < length; i++) {
//index for the curve array.
index = rotation > 0 ? i : length - 1 - i;
x = i / length;
curve[index] = Math.log(1 + base ... | javascript | function logarithmic(length, base, rotation) {
var curve = new Float32Array(length),
index,
x = 0,
i;
for (i = 0; i < length; i++) {
//index for the curve array.
index = rotation > 0 ? i : length - 1 - i;
x = i / length;
curve[index] = Math.log(1 + base ... | [
"function",
"logarithmic",
"(",
"length",
",",
"base",
",",
"rotation",
")",
"{",
"var",
"curve",
"=",
"new",
"Float32Array",
"(",
"length",
")",
",",
"index",
",",
"x",
"=",
"0",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"length",... | creating a curve to simulate a logarithmic curve with setValueCurveAtTime. | [
"creating",
"a",
"curve",
"to",
"simulate",
"a",
"logarithmic",
"curve",
"with",
"setValueCurveAtTime",
"."
] | 795ed73fe0cbc110287c2d48a01afdb6b4a49512 | https://github.com/naomiaro/fade-curves/blob/795ed73fe0cbc110287c2d48a01afdb6b4a49512/index.js#L59-L74 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.