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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
56,200 | el-fuego/grunt-concat-properties | tasks/lib/reader.js | addProperty | function addProperty(sourceData, propertiesGroups, filePath) {
var group = propertiesUtils.getGroup(sourceData[2], propertiesGroups),
propertyName,
data,
propertyDefinitionWithoutObjectName;
if (!group) {
grunt.log.error('Object ' + sourceData[2] + ' wit... | javascript | function addProperty(sourceData, propertiesGroups, filePath) {
var group = propertiesUtils.getGroup(sourceData[2], propertiesGroups),
propertyName,
data,
propertyDefinitionWithoutObjectName;
if (!group) {
grunt.log.error('Object ' + sourceData[2] + ' wit... | [
"function",
"addProperty",
"(",
"sourceData",
",",
"propertiesGroups",
",",
"filePath",
")",
"{",
"var",
"group",
"=",
"propertiesUtils",
".",
"getGroup",
"(",
"sourceData",
"[",
"2",
"]",
",",
"propertiesGroups",
")",
",",
"propertyName",
",",
"data",
",",
... | Add property data to their properties group
@param sourceData {String}
@param propertiesGroups [{Object}]
@param filePath {String}
@returns {Object} | [
"Add",
"property",
"data",
"to",
"their",
"properties",
"group"
] | a7efad68106d81aec262deee12190c75952f09b3 | https://github.com/el-fuego/grunt-concat-properties/blob/a7efad68106d81aec262deee12190c75952f09b3/tasks/lib/reader.js#L64-L93 |
56,201 | el-fuego/grunt-concat-properties | tasks/lib/reader.js | addJSONProperties | function addJSONProperties(jsonData, propertiesGroups, filePath, currentNamesPath) {
var i,
group,
propertyDefinition,
propertyDefinitionWithoutObjectName,
propertyName,
data;
if (currentNamesPath === undefined) {
currentNamesPath... | javascript | function addJSONProperties(jsonData, propertiesGroups, filePath, currentNamesPath) {
var i,
group,
propertyDefinition,
propertyDefinitionWithoutObjectName,
propertyName,
data;
if (currentNamesPath === undefined) {
currentNamesPath... | [
"function",
"addJSONProperties",
"(",
"jsonData",
",",
"propertiesGroups",
",",
"filePath",
",",
"currentNamesPath",
")",
"{",
"var",
"i",
",",
"group",
",",
"propertyDefinition",
",",
"propertyDefinitionWithoutObjectName",
",",
"propertyName",
",",
"data",
";",
"if... | Add JSON properties values to their properties group
@param jsonData {String}
@param propertiesGroups [{Object}]
@param filePath {String}
@param currentNamesPath {String}
@returns {Object} | [
"Add",
"JSON",
"properties",
"values",
"to",
"their",
"properties",
"group"
] | a7efad68106d81aec262deee12190c75952f09b3 | https://github.com/el-fuego/grunt-concat-properties/blob/a7efad68106d81aec262deee12190c75952f09b3/tasks/lib/reader.js#L104-L177 |
56,202 | Gozala/fs-reduce | reader.js | onChunk | function onChunk(count) {
// If chunk read has no bytes than there is nothing left, so end a
// collection.
if (count === 0) return next(end)
// Move a offset `position` with `count` towards the end unless
// position was a `null` in which case we just keep it (`null` means
// from ... | javascript | function onChunk(count) {
// If chunk read has no bytes than there is nothing left, so end a
// collection.
if (count === 0) return next(end)
// Move a offset `position` with `count` towards the end unless
// position was a `null` in which case we just keep it (`null` means
// from ... | [
"function",
"onChunk",
"(",
"count",
")",
"{",
"// If chunk read has no bytes than there is nothing left, so end a",
"// collection.",
"if",
"(",
"count",
"===",
"0",
")",
"return",
"next",
"(",
"end",
")",
"// Move a offset `position` with `count` towards the end unless",
"/... | Function is used to read out given `count` bytes from the file starting from the current position. Note that `position` is captured. `onChunk` handler is invoked after reading a chunk of a file. | [
"Function",
"is",
"used",
"to",
"read",
"out",
"given",
"count",
"bytes",
"from",
"the",
"file",
"starting",
"from",
"the",
"current",
"position",
".",
"Note",
"that",
"position",
"is",
"captured",
".",
"onChunk",
"handler",
"is",
"invoked",
"after",
"readin... | 4b59070f0ccba17ce35ce419c27e83a2ec152d98 | https://github.com/Gozala/fs-reduce/blob/4b59070f0ccba17ce35ce419c27e83a2ec152d98/reader.js#L49-L65 |
56,203 | Gozala/fs-reduce | reader.js | onDrain | function onDrain(value) {
state = value
// If value is marked as `reduced` no further reads should take place,
// as consumer has finished consumption.
if (isReduced(value)) return next(end)
// If current `position` has reached or passed `finish` mark end a
// collection.
else ... | javascript | function onDrain(value) {
state = value
// If value is marked as `reduced` no further reads should take place,
// as consumer has finished consumption.
if (isReduced(value)) return next(end)
// If current `position` has reached or passed `finish` mark end a
// collection.
else ... | [
"function",
"onDrain",
"(",
"value",
")",
"{",
"state",
"=",
"value",
"// If value is marked as `reduced` no further reads should take place,",
"// as consumer has finished consumption.",
"if",
"(",
"isReduced",
"(",
"value",
")",
")",
"return",
"next",
"(",
"end",
")",
... | Handler is invoked whenever consumer of the collection finished consumption of the previous chunk and can accept more data. It's also passed a new state value that is being accumulated. | [
"Handler",
"is",
"invoked",
"whenever",
"consumer",
"of",
"the",
"collection",
"finished",
"consumption",
"of",
"the",
"previous",
"chunk",
"and",
"can",
"accept",
"more",
"data",
".",
"It",
"s",
"also",
"passed",
"a",
"new",
"state",
"value",
"that",
"is",
... | 4b59070f0ccba17ce35ce419c27e83a2ec152d98 | https://github.com/Gozala/fs-reduce/blob/4b59070f0ccba17ce35ce419c27e83a2ec152d98/reader.js#L70-L86 |
56,204 | RnbWd/parse-browserify | lib/relation.js | function(objects) {
if (!_.isArray(objects)) {
objects = [objects];
}
var change = new Parse.Op.Relation(objects, []);
this.parent.set(this.key, change);
this.targetClassName = change._targetClassName;
} | javascript | function(objects) {
if (!_.isArray(objects)) {
objects = [objects];
}
var change = new Parse.Op.Relation(objects, []);
this.parent.set(this.key, change);
this.targetClassName = change._targetClassName;
} | [
"function",
"(",
"objects",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isArray",
"(",
"objects",
")",
")",
"{",
"objects",
"=",
"[",
"objects",
"]",
";",
"}",
"var",
"change",
"=",
"new",
"Parse",
".",
"Op",
".",
"Relation",
"(",
"objects",
",",
"[",
... | Adds a Parse.Object or an array of Parse.Objects to the relation.
@param {} objects The item or items to add. | [
"Adds",
"a",
"Parse",
".",
"Object",
"or",
"an",
"array",
"of",
"Parse",
".",
"Objects",
"to",
"the",
"relation",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/relation.js#L45-L53 | |
56,205 | RnbWd/parse-browserify | lib/relation.js | function() {
var targetClass;
var query;
if (!this.targetClassName) {
targetClass = Parse.Object._getSubclass(this.parent.className);
query = new Parse.Query(targetClass);
query._extraOptions.redirectClassNameForKey = this.key;
} else {
targetClass = Parse.Object.... | javascript | function() {
var targetClass;
var query;
if (!this.targetClassName) {
targetClass = Parse.Object._getSubclass(this.parent.className);
query = new Parse.Query(targetClass);
query._extraOptions.redirectClassNameForKey = this.key;
} else {
targetClass = Parse.Object.... | [
"function",
"(",
")",
"{",
"var",
"targetClass",
";",
"var",
"query",
";",
"if",
"(",
"!",
"this",
".",
"targetClassName",
")",
"{",
"targetClass",
"=",
"Parse",
".",
"Object",
".",
"_getSubclass",
"(",
"this",
".",
"parent",
".",
"className",
")",
";"... | Returns a Parse.Query that is limited to objects in this
relation.
@return {Parse.Query} | [
"Returns",
"a",
"Parse",
".",
"Query",
"that",
"is",
"limited",
"to",
"objects",
"in",
"this",
"relation",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/relation.js#L82-L97 | |
56,206 | blake-regalia/rapunzel.js | lib/main/index.js | function(s_line, s_close_delim, z_merge_delim) {
// open block
add(
s_line || '',
z_merge_delim,
true
);
// set close delim
s_close = ('string' === typeof s_close_delim)? s_close_delim: a_closers.slice(-1)[0];
a_closers.push(s_close);
// increase indentation
add.tabs +=... | javascript | function(s_line, s_close_delim, z_merge_delim) {
// open block
add(
s_line || '',
z_merge_delim,
true
);
// set close delim
s_close = ('string' === typeof s_close_delim)? s_close_delim: a_closers.slice(-1)[0];
a_closers.push(s_close);
// increase indentation
add.tabs +=... | [
"function",
"(",
"s_line",
",",
"s_close_delim",
",",
"z_merge_delim",
")",
"{",
"// open block",
"add",
"(",
"s_line",
"||",
"''",
",",
"z_merge_delim",
",",
"true",
")",
";",
"// set close delim",
"s_close",
"=",
"(",
"'string'",
"===",
"typeof",
"s_close_de... | block open helper | [
"block",
"open",
"helper"
] | bc8e231bf248eeaec6aa86f5c9f073d1fe615c1c | https://github.com/blake-regalia/rapunzel.js/blob/bc8e231bf248eeaec6aa86f5c9f073d1fe615c1c/lib/main/index.js#L176-L191 | |
56,207 | adiwidjaja/frontend-pagebuilder | js/tinymce/plugins/paste/plugin.js | trimHtml | function trimHtml(html) {
function trimSpaces(all, s1, s2) {
// WebKit meant to preserve multiple spaces but instead inserted around all inline tags,
// including the spans with inline styles created on paste
if (!s1 && !s2) {
return ' ';
}
return '\u00a0'... | javascript | function trimHtml(html) {
function trimSpaces(all, s1, s2) {
// WebKit meant to preserve multiple spaces but instead inserted around all inline tags,
// including the spans with inline styles created on paste
if (!s1 && !s2) {
return ' ';
}
return '\u00a0'... | [
"function",
"trimHtml",
"(",
"html",
")",
"{",
"function",
"trimSpaces",
"(",
"all",
",",
"s1",
",",
"s2",
")",
"{",
"// WebKit meant to preserve multiple spaces but instead inserted around all inline tags,",
"// including the spans with inline styles created on paste",
"i... | Trims the specified HTML by removing all WebKit fragments, all elements wrapping the body trailing BR elements etc.
@param {String} html Html string to trim contents on.
@return {String} Html contents that got trimmed. | [
"Trims",
"the",
"specified",
"HTML",
"by",
"removing",
"all",
"WebKit",
"fragments",
"all",
"elements",
"wrapping",
"the",
"body",
"trailing",
"BR",
"elements",
"etc",
"."
] | a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f | https://github.com/adiwidjaja/frontend-pagebuilder/blob/a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f/js/tinymce/plugins/paste/plugin.js#L392-L412 |
56,208 | adiwidjaja/frontend-pagebuilder | js/tinymce/plugins/paste/plugin.js | getDataTransferItems | function getDataTransferItems(dataTransfer) {
var items = {};
if (dataTransfer) {
// Use old WebKit/IE API
if (dataTransfer.getData) {
var legacyText = dataTransfer.getData('Text');
if (legacyText && legacyText.length > 0) {
if (legacyText.index... | javascript | function getDataTransferItems(dataTransfer) {
var items = {};
if (dataTransfer) {
// Use old WebKit/IE API
if (dataTransfer.getData) {
var legacyText = dataTransfer.getData('Text');
if (legacyText && legacyText.length > 0) {
if (legacyText.index... | [
"function",
"getDataTransferItems",
"(",
"dataTransfer",
")",
"{",
"var",
"items",
"=",
"{",
"}",
";",
"if",
"(",
"dataTransfer",
")",
"{",
"// Use old WebKit/IE API",
"if",
"(",
"dataTransfer",
".",
"getData",
")",
"{",
"var",
"legacyText",
"=",
"dataTransfer... | Gets various content types out of a datatransfer object.
@param {DataTransfer} dataTransfer Event fired on paste.
@return {Object} Object with mime types and data for those mime types. | [
"Gets",
"various",
"content",
"types",
"out",
"of",
"a",
"datatransfer",
"object",
"."
] | a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f | https://github.com/adiwidjaja/frontend-pagebuilder/blob/a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f/js/tinymce/plugins/paste/plugin.js#L1033-L1060 |
56,209 | floriancargoet/jasmine-async-errors | index.js | function (originalIt) {
return function it(desc, cb) {
if (cb.length === 0) {
originalIt(desc, cb);
} else {
originalIt(desc, wrapInTryCatch(cb));
}
};
} | javascript | function (originalIt) {
return function it(desc, cb) {
if (cb.length === 0) {
originalIt(desc, cb);
} else {
originalIt(desc, wrapInTryCatch(cb));
}
};
} | [
"function",
"(",
"originalIt",
")",
"{",
"return",
"function",
"it",
"(",
"desc",
",",
"cb",
")",
"{",
"if",
"(",
"cb",
".",
"length",
"===",
"0",
")",
"{",
"originalIt",
"(",
"desc",
",",
"cb",
")",
";",
"}",
"else",
"{",
"originalIt",
"(",
"des... | wrap jasmine's "it" function so that each
test is wrapped in a trycatch handler | [
"wrap",
"jasmine",
"s",
"it",
"function",
"so",
"that",
"each",
"test",
"is",
"wrapped",
"in",
"a",
"trycatch",
"handler"
] | 496bccb0f6c7feb803bf2767cf7762d3cb0c5198 | https://github.com/floriancargoet/jasmine-async-errors/blob/496bccb0f6c7feb803bf2767cf7762d3cb0c5198/index.js#L28-L36 | |
56,210 | michaelpb/elmoed | lib/adaptors/riotjs.js | mount | function mount(mountLocation, tagname, props) {
// return riot.mount(mountLocation, tagname, props)[0];
const id = makeUID(`riotjs_mount_${tagname}`);
const fauxTag = `<${tagname} data-elmoed-editor="${tagname}" id="${id}">
</${tagname}>`;
// Loop through all sub-mounted editors that might alre... | javascript | function mount(mountLocation, tagname, props) {
// return riot.mount(mountLocation, tagname, props)[0];
const id = makeUID(`riotjs_mount_${tagname}`);
const fauxTag = `<${tagname} data-elmoed-editor="${tagname}" id="${id}">
</${tagname}>`;
// Loop through all sub-mounted editors that might alre... | [
"function",
"mount",
"(",
"mountLocation",
",",
"tagname",
",",
"props",
")",
"{",
"// return riot.mount(mountLocation, tagname, props)[0];",
"const",
"id",
"=",
"makeUID",
"(",
"`",
"${",
"tagname",
"}",
"`",
")",
";",
"const",
"fauxTag",
"=",
"`",
"${",
"tag... | riot.js adaptor | [
"riot",
".",
"js",
"adaptor"
] | f1f51a06fb5c9703dcd36e320472572b311e2649 | https://github.com/michaelpb/elmoed/blob/f1f51a06fb5c9703dcd36e320472572b311e2649/lib/adaptors/riotjs.js#L25-L58 |
56,211 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/indent/plugin.js | function( editor, name, isIndent ) {
this.name = name;
this.editor = editor;
/**
* An object of jobs handled by the command. Each job consists
* of two functions: `refresh` and `exec` as well as the execution priority.
*
* * The `refresh` function determines whether a job is doable for... | javascript | function( editor, name, isIndent ) {
this.name = name;
this.editor = editor;
/**
* An object of jobs handled by the command. Each job consists
* of two functions: `refresh` and `exec` as well as the execution priority.
*
* * The `refresh` function determines whether a job is doable for... | [
"function",
"(",
"editor",
",",
"name",
",",
"isIndent",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"editor",
"=",
"editor",
";",
"/**\r\n\t\t\t * An object of jobs handled by the command. Each job consists\r\n\t\t\t * of two functions: `refresh` and `exe... | A base class for specific indentation command definitions responsible for
handling a pre-defined set of elements i.e. indentlist for lists or
indentblock for text block elements.
Commands of this class perform indentation operations and modify the DOM structure.
They listen for events fired by {@link CKEDITOR.plugins.... | [
"A",
"base",
"class",
"for",
"specific",
"indentation",
"command",
"definitions",
"responsible",
"for",
"handling",
"a",
"pre",
"-",
"defined",
"set",
"of",
"elements",
"i",
".",
"e",
".",
"indentlist",
"for",
"lists",
"or",
"indentblock",
"for",
"text",
"bl... | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/indent/plugin.js#L143-L236 | |
56,212 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/indent/plugin.js | function( editor, commands ) {
editor.on( 'pluginsLoaded', function() {
for ( var name in commands ) {
( function( editor, command ) {
var relatedGlobal = editor.getCommand( command.relatedGlobal );
for ( var priority in command.jobs ) {
// Observe generic exec event and execute c... | javascript | function( editor, commands ) {
editor.on( 'pluginsLoaded', function() {
for ( var name in commands ) {
( function( editor, command ) {
var relatedGlobal = editor.getCommand( command.relatedGlobal );
for ( var priority in command.jobs ) {
// Observe generic exec event and execute c... | [
"function",
"(",
"editor",
",",
"commands",
")",
"{",
"editor",
".",
"on",
"(",
"'pluginsLoaded'",
",",
"function",
"(",
")",
"{",
"for",
"(",
"var",
"name",
"in",
"commands",
")",
"{",
"(",
"function",
"(",
"editor",
",",
"command",
")",
"{",
"var",... | Registers content-specific commands as a part of the indentation system
directed by generic commands. Once a command is registered,
it listens for events of a related generic command.
CKEDITOR.plugins.indent.registerCommands( editor, {
'indentlist': new indentListCommand( editor, 'indentlist' ),
'outdentlist': new ind... | [
"Registers",
"content",
"-",
"specific",
"commands",
"as",
"a",
"part",
"of",
"the",
"indentation",
"system",
"directed",
"by",
"generic",
"commands",
".",
"Once",
"a",
"command",
"is",
"registered",
"it",
"listens",
"for",
"events",
"of",
"a",
"related",
"g... | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/indent/plugin.js#L261-L308 | |
56,213 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/indent/plugin.js | function( editor, priority ) {
var job = this.jobs[ priority ];
if ( job.state != TRISTATE_DISABLED )
return job.exec.call( this, editor );
} | javascript | function( editor, priority ) {
var job = this.jobs[ priority ];
if ( job.state != TRISTATE_DISABLED )
return job.exec.call( this, editor );
} | [
"function",
"(",
"editor",
",",
"priority",
")",
"{",
"var",
"job",
"=",
"this",
".",
"jobs",
"[",
"priority",
"]",
";",
"if",
"(",
"job",
".",
"state",
"!=",
"TRISTATE_DISABLED",
")",
"return",
"job",
".",
"exec",
".",
"call",
"(",
"this",
",",
"e... | Executes the content-specific procedure if the context is correct.
It calls the `exec` function of a job of the given `priority`
that modifies the DOM.
@param {CKEDITOR.editor} editor The editor instance this command
will be applied to.
@param {Number} priority The priority of the job to be executed.
@returns {Boolean... | [
"Executes",
"the",
"content",
"-",
"specific",
"procedure",
"if",
"the",
"context",
"is",
"correct",
".",
"It",
"calls",
"the",
"exec",
"function",
"of",
"a",
"job",
"of",
"the",
"given",
"priority",
"that",
"modifies",
"the",
"DOM",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/indent/plugin.js#L328-L333 | |
56,214 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/indent/plugin.js | setupGenericListeners | function setupGenericListeners( editor, command ) {
var selection, bookmarks;
// Set the command state according to content-specific
// command states.
command.on( 'refresh', function( evt ) {
// If no state comes with event data, disable command.
var states = [ TRISTATE_DISABLED ];
for ( va... | javascript | function setupGenericListeners( editor, command ) {
var selection, bookmarks;
// Set the command state according to content-specific
// command states.
command.on( 'refresh', function( evt ) {
// If no state comes with event data, disable command.
var states = [ TRISTATE_DISABLED ];
for ( va... | [
"function",
"setupGenericListeners",
"(",
"editor",
",",
"command",
")",
"{",
"var",
"selection",
",",
"bookmarks",
";",
"// Set the command state according to content-specific\r",
"// command states.\r",
"command",
".",
"on",
"(",
"'refresh'",
",",
"function",
"(",
"ev... | Attaches event listeners for this generic command. Since the indentation
system is event-oriented, generic commands communicate with
content-specific commands using the `exec` and `refresh` events.
Listener priorities are crucial. Different indentation phases
are executed with different priorities.
For the `exec` eve... | [
"Attaches",
"event",
"listeners",
"for",
"this",
"generic",
"command",
".",
"Since",
"the",
"indentation",
"system",
"is",
"event",
"-",
"oriented",
"generic",
"commands",
"communicate",
"with",
"content",
"-",
"specific",
"commands",
"using",
"the",
"exec",
"an... | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/indent/plugin.js#L424-L461 |
56,215 | j-/ok | ok.js | function (event, fn, context) {
this._events = this._events || {};
var e = this._events[event] || (this._events[event] = []);
e.push([fn, context]);
} | javascript | function (event, fn, context) {
this._events = this._events || {};
var e = this._events[event] || (this._events[event] = []);
e.push([fn, context]);
} | [
"function",
"(",
"event",
",",
"fn",
",",
"context",
")",
"{",
"this",
".",
"_events",
"=",
"this",
".",
"_events",
"||",
"{",
"}",
";",
"var",
"e",
"=",
"this",
".",
"_events",
"[",
"event",
"]",
"||",
"(",
"this",
".",
"_events",
"[",
"event",
... | Adds a callback to the event queue which is executed when an event fires
@param {string} event Event name
@param {Function} fn Callback function. Executed when event fires.
@param {*=} context Optional context to apply to callback | [
"Adds",
"a",
"callback",
"to",
"the",
"event",
"queue",
"which",
"is",
"executed",
"when",
"an",
"event",
"fires"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L442-L446 | |
56,216 | j-/ok | ok.js | function (obj, event, fn, context) {
var listeningTo = this._listeningTo || (this._listeningTo = {});
var id = obj._listenId || (obj._listenId = eventIndex++);
listeningTo[id] = obj;
if (!fn && typeof event === 'object') {
fn = this;
}
if (!context) {
context = this;
}
obj.on(event, fn, context);
... | javascript | function (obj, event, fn, context) {
var listeningTo = this._listeningTo || (this._listeningTo = {});
var id = obj._listenId || (obj._listenId = eventIndex++);
listeningTo[id] = obj;
if (!fn && typeof event === 'object') {
fn = this;
}
if (!context) {
context = this;
}
obj.on(event, fn, context);
... | [
"function",
"(",
"obj",
",",
"event",
",",
"fn",
",",
"context",
")",
"{",
"var",
"listeningTo",
"=",
"this",
".",
"_listeningTo",
"||",
"(",
"this",
".",
"_listeningTo",
"=",
"{",
"}",
")",
";",
"var",
"id",
"=",
"obj",
".",
"_listenId",
"||",
"("... | Observe another object by adding a callback to its event queue which is
executed when an event fires
@param {Events} obj Object to listen to
@param {string} event Event name
@param {Function} fn Callback function. Executed when event fires.
@param {*=} context Optional context to apply to callback | [
"Observe",
"another",
"object",
"by",
"adding",
"a",
"callback",
"to",
"its",
"event",
"queue",
"which",
"is",
"executed",
"when",
"an",
"event",
"fires"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L455-L466 | |
56,217 | j-/ok | ok.js | function (event, fn) {
this._events = this._events || {};
var e = this._events[event];
if (e) {
for (var i = 0, l = e.length; i < l; i++) {
if (e[i][0] === fn) {
e.splice(i, 1);
i--;
l--;
}
}
}
} | javascript | function (event, fn) {
this._events = this._events || {};
var e = this._events[event];
if (e) {
for (var i = 0, l = e.length; i < l; i++) {
if (e[i][0] === fn) {
e.splice(i, 1);
i--;
l--;
}
}
}
} | [
"function",
"(",
"event",
",",
"fn",
")",
"{",
"this",
".",
"_events",
"=",
"this",
".",
"_events",
"||",
"{",
"}",
";",
"var",
"e",
"=",
"this",
".",
"_events",
"[",
"event",
"]",
";",
"if",
"(",
"e",
")",
"{",
"for",
"(",
"var",
"i",
"=",
... | Removes a callback from the event queue
@param {string} event Event name
@param {Function} fn Callback function. No longer executed when event
fires. | [
"Removes",
"a",
"callback",
"from",
"the",
"event",
"queue"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L473-L485 | |
56,218 | j-/ok | ok.js | function (obj, event, fn) {
var listeningTo = this._listeningTo;
if (!listeningTo) {
return;
}
var remove = !event && !fn;
if (!fn && typeof event === 'object') {
fn = this;
}
if (obj) {
(listeningTo = {})[obj._listenId] = obj;
}
for (var id in listeningTo) {
obj = listeningTo[id];
obj.... | javascript | function (obj, event, fn) {
var listeningTo = this._listeningTo;
if (!listeningTo) {
return;
}
var remove = !event && !fn;
if (!fn && typeof event === 'object') {
fn = this;
}
if (obj) {
(listeningTo = {})[obj._listenId] = obj;
}
for (var id in listeningTo) {
obj = listeningTo[id];
obj.... | [
"function",
"(",
"obj",
",",
"event",
",",
"fn",
")",
"{",
"var",
"listeningTo",
"=",
"this",
".",
"_listeningTo",
";",
"if",
"(",
"!",
"listeningTo",
")",
"{",
"return",
";",
"}",
"var",
"remove",
"=",
"!",
"event",
"&&",
"!",
"fn",
";",
"if",
"... | Stop observing another object
@param {Events=} obj Object to stop observing. Omit to stop observing all
objects.
@param {string=} event Event name. Omit to stop observing all events on
this object.
@param {Function} fn Callback function. Stops this function executing
when `event` is triggered. | [
"Stop",
"observing",
"another",
"object"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L495-L514 | |
56,219 | j-/ok | ok.js | function (event/*, args... */) {
this._events = this._events || {};
var e = this._events[event];
if (e) {
for (var i = 0, l = e.length; i < l; i++){
e[i][0].apply(e[i][1] || this, slice(arguments, 1));
}
}
} | javascript | function (event/*, args... */) {
this._events = this._events || {};
var e = this._events[event];
if (e) {
for (var i = 0, l = e.length; i < l; i++){
e[i][0].apply(e[i][1] || this, slice(arguments, 1));
}
}
} | [
"function",
"(",
"event",
"/*, args... */",
")",
"{",
"this",
".",
"_events",
"=",
"this",
".",
"_events",
"||",
"{",
"}",
";",
"var",
"e",
"=",
"this",
".",
"_events",
"[",
"event",
"]",
";",
"if",
"(",
"e",
")",
"{",
"for",
"(",
"var",
"i",
"... | Trigger an event and execute all callbacks in the event queue
@param {string} event Event name
@param {...*} args Event arguments passed through to all callbacks | [
"Trigger",
"an",
"event",
"and",
"execute",
"all",
"callbacks",
"in",
"the",
"event",
"queue"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L520-L528 | |
56,220 | j-/ok | ok.js | Property | function Property (initValue) {
if (arguments.length) {
this.set(initValue);
}
else {
this.set(this.defaultValue);
}
ok.Data.apply(this, arguments);
} | javascript | function Property (initValue) {
if (arguments.length) {
this.set(initValue);
}
else {
this.set(this.defaultValue);
}
ok.Data.apply(this, arguments);
} | [
"function",
"Property",
"(",
"initValue",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
")",
"{",
"this",
".",
"set",
"(",
"initValue",
")",
";",
"}",
"else",
"{",
"this",
".",
"set",
"(",
"this",
".",
"defaultValue",
")",
";",
"}",
"ok",
".",
... | Optionally initialize this property with a value
@param {*=} initValue Initial value for this property | [
"Optionally",
"initialize",
"this",
"property",
"with",
"a",
"value"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L701-L709 |
56,221 | j-/ok | ok.js | function (newValue) {
var oldValue = this._value;
if (oldValue !== newValue) {
this._value = newValue;
this.trigger(EVENT_CHANGE, this, newValue, oldValue);
}
} | javascript | function (newValue) {
var oldValue = this._value;
if (oldValue !== newValue) {
this._value = newValue;
this.trigger(EVENT_CHANGE, this, newValue, oldValue);
}
} | [
"function",
"(",
"newValue",
")",
"{",
"var",
"oldValue",
"=",
"this",
".",
"_value",
";",
"if",
"(",
"oldValue",
"!==",
"newValue",
")",
"{",
"this",
".",
"_value",
"=",
"newValue",
";",
"this",
".",
"trigger",
"(",
"EVENT_CHANGE",
",",
"this",
",",
... | Replace the internal property with a new value and trigger a 'change'
@param {*} newValue New property value
@fires change | [
"Replace",
"the",
"internal",
"property",
"with",
"a",
"new",
"value",
"and",
"trigger",
"a",
"change"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L722-L728 | |
56,222 | j-/ok | ok.js | function () {
var properties = this.properties;
_.forEach(properties, function (prop, name) {
prop = this.getProperty(name);
this.stopListening(prop, EVENT_CHANGE);
}, this);
} | javascript | function () {
var properties = this.properties;
_.forEach(properties, function (prop, name) {
prop = this.getProperty(name);
this.stopListening(prop, EVENT_CHANGE);
}, this);
} | [
"function",
"(",
")",
"{",
"var",
"properties",
"=",
"this",
".",
"properties",
";",
"_",
".",
"forEach",
"(",
"properties",
",",
"function",
"(",
"prop",
",",
"name",
")",
"{",
"prop",
"=",
"this",
".",
"getProperty",
"(",
"name",
")",
";",
"this",
... | Remove all events listeners
@deprecated Use {@link #stopListening} (with no arguments) instead | [
"Remove",
"all",
"events",
"listeners"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L796-L802 | |
56,223 | j-/ok | ok.js | function (properties) {
properties = properties || {};
_.forEach(properties, function (property, name) {
this.initProperty(name, property);
}, this);
} | javascript | function (properties) {
properties = properties || {};
_.forEach(properties, function (property, name) {
this.initProperty(name, property);
}, this);
} | [
"function",
"(",
"properties",
")",
"{",
"properties",
"=",
"properties",
"||",
"{",
"}",
";",
"_",
".",
"forEach",
"(",
"properties",
",",
"function",
"(",
"property",
",",
"name",
")",
"{",
"this",
".",
"initProperty",
"(",
"name",
",",
"property",
"... | Declare the values of a hash of properties
@param {Object} properties Hash of properties and values | [
"Declare",
"the",
"values",
"of",
"a",
"hash",
"of",
"properties"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L820-L825 | |
56,224 | j-/ok | ok.js | function (name, value) {
var prop = this.getProperty(name);
var Constructor;
if (!prop) {
Constructor = this.getConstructor(name, value);
prop = new Constructor();
prop = this.setProperty(name, prop);
}
if (typeof value !== 'undefined') {
prop.set(value);
}
return prop;
} | javascript | function (name, value) {
var prop = this.getProperty(name);
var Constructor;
if (!prop) {
Constructor = this.getConstructor(name, value);
prop = new Constructor();
prop = this.setProperty(name, prop);
}
if (typeof value !== 'undefined') {
prop.set(value);
}
return prop;
} | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"var",
"prop",
"=",
"this",
".",
"getProperty",
"(",
"name",
")",
";",
"var",
"Constructor",
";",
"if",
"(",
"!",
"prop",
")",
"{",
"Constructor",
"=",
"this",
".",
"getConstructor",
"(",
"name",
",",
... | Declare the value of a single property
@param {string} name Property name
@param {*} value Property value
@return {module:ok.Property} New property instance | [
"Declare",
"the",
"value",
"of",
"a",
"single",
"property"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L832-L844 | |
56,225 | j-/ok | ok.js | function (name) {
var args = arguments;
var len = args.length;
if (len === 0) {
return this.getMap();
}
else if (len === 1) {
return this.getValue(name);
}
else {
return this.getValues.apply(this, args);
}
} | javascript | function (name) {
var args = arguments;
var len = args.length;
if (len === 0) {
return this.getMap();
}
else if (len === 1) {
return this.getValue(name);
}
else {
return this.getValues.apply(this, args);
}
} | [
"function",
"(",
"name",
")",
"{",
"var",
"args",
"=",
"arguments",
";",
"var",
"len",
"=",
"args",
".",
"length",
";",
"if",
"(",
"len",
"===",
"0",
")",
"{",
"return",
"this",
".",
"getMap",
"(",
")",
";",
"}",
"else",
"if",
"(",
"len",
"==="... | Get the values of one or more properties
@param {...string=} name Optional property names. If omitted, a map of
all properties will be returned. If one property name is given then the
value of that property will be returned. Otherwise, if more than one
property name is given, the values of those properties will be retu... | [
"Get",
"the",
"values",
"of",
"one",
"or",
"more",
"properties"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L875-L887 | |
56,226 | j-/ok | ok.js | function () {
var map = this.properties;
var pairs = _.map(map, function (prop, name) {
return [name, prop.get()];
});
var result = _.object(pairs);
return result;
} | javascript | function () {
var map = this.properties;
var pairs = _.map(map, function (prop, name) {
return [name, prop.get()];
});
var result = _.object(pairs);
return result;
} | [
"function",
"(",
")",
"{",
"var",
"map",
"=",
"this",
".",
"properties",
";",
"var",
"pairs",
"=",
"_",
".",
"map",
"(",
"map",
",",
"function",
"(",
"prop",
",",
"name",
")",
"{",
"return",
"[",
"name",
",",
"prop",
".",
"get",
"(",
")",
"]",
... | Get the values of all properties
@return {Object} Map of all properties. Each property has had its `get`
function invoked. | [
"Get",
"the",
"values",
"of",
"all",
"properties"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L893-L900 | |
56,227 | j-/ok | ok.js | function () {
var result = [];
var args = arguments;
var l = args.length;
var name, value;
for (var i = 0; i < l; i++) {
name = args[i];
value = this.getValue(name);
result.push(value);
}
return result;
} | javascript | function () {
var result = [];
var args = arguments;
var l = args.length;
var name, value;
for (var i = 0; i < l; i++) {
name = args[i];
value = this.getValue(name);
result.push(value);
}
return result;
} | [
"function",
"(",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"var",
"args",
"=",
"arguments",
";",
"var",
"l",
"=",
"args",
".",
"length",
";",
"var",
"name",
",",
"value",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"l",
";",
... | Get the value of multiple properties
@param {...string} names Property names
@return {Array} Array of values from each property's `get` function | [
"Get",
"the",
"value",
"of",
"multiple",
"properties"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L915-L926 | |
56,228 | j-/ok | ok.js | function (name, newValue) {
if (arguments.length > 1) {
this.setValue(name, newValue);
}
else {
var attrs = name;
this.setMap(attrs);
}
} | javascript | function (name, newValue) {
if (arguments.length > 1) {
this.setValue(name, newValue);
}
else {
var attrs = name;
this.setMap(attrs);
}
} | [
"function",
"(",
"name",
",",
"newValue",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
">",
"1",
")",
"{",
"this",
".",
"setValue",
"(",
"name",
",",
"newValue",
")",
";",
"}",
"else",
"{",
"var",
"attrs",
"=",
"name",
";",
"this",
".",
"setM... | Set the value of one or more properties
@method module:ok.Map#set
@param {Object} attrs Hash of property names and values to set
Set the value of a single property
@param {string} name Property name
@param {*} newValue Property value | [
"Set",
"the",
"value",
"of",
"one",
"or",
"more",
"properties"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L953-L961 | |
56,229 | j-/ok | ok.js | function (attrs) {
attrs = attrs || {};
_.forEach(attrs, function (val, name) {
this.setValue(name, val);
}, this);
} | javascript | function (attrs) {
attrs = attrs || {};
_.forEach(attrs, function (val, name) {
this.setValue(name, val);
}, this);
} | [
"function",
"(",
"attrs",
")",
"{",
"attrs",
"=",
"attrs",
"||",
"{",
"}",
";",
"_",
".",
"forEach",
"(",
"attrs",
",",
"function",
"(",
"val",
",",
"name",
")",
"{",
"this",
".",
"setValue",
"(",
"name",
",",
"val",
")",
";",
"}",
",",
"this",... | Set values of properties using an object
@param {Object} attrs Hash of property names and values to set | [
"Set",
"values",
"of",
"properties",
"using",
"an",
"object"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L966-L971 | |
56,230 | j-/ok | ok.js | function (name, newValue) {
var property = this.getProperty(name);
if (!property) {
this.initProperty(name, newValue);
}
else {
property.set(newValue);
}
} | javascript | function (name, newValue) {
var property = this.getProperty(name);
if (!property) {
this.initProperty(name, newValue);
}
else {
property.set(newValue);
}
} | [
"function",
"(",
"name",
",",
"newValue",
")",
"{",
"var",
"property",
"=",
"this",
".",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"!",
"property",
")",
"{",
"this",
".",
"initProperty",
"(",
"name",
",",
"newValue",
")",
";",
"}",
"else",
"... | Set the value of a single property
@param {string} name Property name
@param {*} newValue Property value | [
"Set",
"the",
"value",
"of",
"a",
"single",
"property"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L977-L985 | |
56,231 | j-/ok | ok.js | function (name, prop) {
this.unsetProperty(name);
this.properties[name] = prop;
this.listenTo(prop, EVENT_CHANGE, this.change);
return prop;
} | javascript | function (name, prop) {
this.unsetProperty(name);
this.properties[name] = prop;
this.listenTo(prop, EVENT_CHANGE, this.change);
return prop;
} | [
"function",
"(",
"name",
",",
"prop",
")",
"{",
"this",
".",
"unsetProperty",
"(",
"name",
")",
";",
"this",
".",
"properties",
"[",
"name",
"]",
"=",
"prop",
";",
"this",
".",
"listenTo",
"(",
"prop",
",",
"EVENT_CHANGE",
",",
"this",
".",
"change",... | Set a single property to a new value
@param {string} name Property name
@param {module:ok.Property} prop Property object
@return {module:ok.Property} The new property | [
"Set",
"a",
"single",
"property",
"to",
"a",
"new",
"value"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L992-L997 | |
56,232 | j-/ok | ok.js | function (name) {
var prop = this.properties[name];
if (prop) {
this.stopListening(prop, EVENT_CHANGE, this.change);
delete this.properties[name];
return prop;
}
return null;
} | javascript | function (name) {
var prop = this.properties[name];
if (prop) {
this.stopListening(prop, EVENT_CHANGE, this.change);
delete this.properties[name];
return prop;
}
return null;
} | [
"function",
"(",
"name",
")",
"{",
"var",
"prop",
"=",
"this",
".",
"properties",
"[",
"name",
"]",
";",
"if",
"(",
"prop",
")",
"{",
"this",
".",
"stopListening",
"(",
"prop",
",",
"EVENT_CHANGE",
",",
"this",
".",
"change",
")",
";",
"delete",
"t... | Remove a single property from the map
@param {String} name Property name
@return {?module:ok.Property} Removed property or `null` | [
"Remove",
"a",
"single",
"property",
"from",
"the",
"map"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1003-L1011 | |
56,233 | j-/ok | ok.js | function (/* items... */) {
var items = slice(arguments);
var item;
for (var i = 0, l = items.length; i < l; i++) {
item = items[i];
$Array.push.call(this, item);
this.trigger(EVENT_ADD, item, this.length);
}
return this.length;
} | javascript | function (/* items... */) {
var items = slice(arguments);
var item;
for (var i = 0, l = items.length; i < l; i++) {
item = items[i];
$Array.push.call(this, item);
this.trigger(EVENT_ADD, item, this.length);
}
return this.length;
} | [
"function",
"(",
"/* items... */",
")",
"{",
"var",
"items",
"=",
"slice",
"(",
"arguments",
")",
";",
"var",
"item",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"items",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
... | Push new items to the top of the stack
@param {...*} New items to push
@return {int} New length after items have been pushed
@fires add | [
"Push",
"new",
"items",
"to",
"the",
"top",
"of",
"the",
"stack"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1046-L1055 | |
56,234 | j-/ok | ok.js | function (start, length) {
var removed, item;
if (arguments.length < 1) {
start = 0;
}
if (arguments.length < 2) {
length = this.length - start;
}
removed = [];
while (start < this.length && length-- > 0) {
item = this[start];
$Array.splice.call(this, start, 1);
this.trigger(EVENT_REMOVE, i... | javascript | function (start, length) {
var removed, item;
if (arguments.length < 1) {
start = 0;
}
if (arguments.length < 2) {
length = this.length - start;
}
removed = [];
while (start < this.length && length-- > 0) {
item = this[start];
$Array.splice.call(this, start, 1);
this.trigger(EVENT_REMOVE, i... | [
"function",
"(",
"start",
",",
"length",
")",
"{",
"var",
"removed",
",",
"item",
";",
"if",
"(",
"arguments",
".",
"length",
"<",
"1",
")",
"{",
"start",
"=",
"0",
";",
"}",
"if",
"(",
"arguments",
".",
"length",
"<",
"2",
")",
"{",
"length",
... | Remove items from the array
@param {int=} start Start index. If omitted, will start at 0.
@param {int=} length Number of items to remove. If omitted, will remove
all items until the end of the array.
@return {Array} Collection of removed items
@fires remove | [
"Remove",
"items",
"from",
"the",
"array"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1122-L1138 | |
56,235 | j-/ok | ok.js | function (start/*, items... */) {
var items = slice(arguments, 1);
var item, index;
for (var i = 0, l = items.length; i < l; i++) {
item = items[i];
index = start + i;
$Array.splice.call(this, index, 0, item);
this.trigger(EVENT_ADD, item, index);
}
return this.length;
} | javascript | function (start/*, items... */) {
var items = slice(arguments, 1);
var item, index;
for (var i = 0, l = items.length; i < l; i++) {
item = items[i];
index = start + i;
$Array.splice.call(this, index, 0, item);
this.trigger(EVENT_ADD, item, index);
}
return this.length;
} | [
"function",
"(",
"start",
"/*, items... */",
")",
"{",
"var",
"items",
"=",
"slice",
"(",
"arguments",
",",
"1",
")",
";",
"var",
"item",
",",
"index",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"items",
".",
"length",
";",
"i",
"<",
... | Insert items into the array
@param {int} start Starting index
@param {...*} items New items to insert
@return {int} New length after items have been added
@fires add | [
"Insert",
"items",
"into",
"the",
"array"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1155-L1165 | |
56,236 | j-/ok | ok.js | function (items) {
var args = slice(items);
args.unshift(0);
this.empty();
this.insert.apply(this, args);
return this.length;
} | javascript | function (items) {
var args = slice(items);
args.unshift(0);
this.empty();
this.insert.apply(this, args);
return this.length;
} | [
"function",
"(",
"items",
")",
"{",
"var",
"args",
"=",
"slice",
"(",
"items",
")",
";",
"args",
".",
"unshift",
"(",
"0",
")",
";",
"this",
".",
"empty",
"(",
")",
";",
"this",
".",
"insert",
".",
"apply",
"(",
"this",
",",
"args",
")",
";",
... | Set the contents of this array. Empties it first.
@param {Array} items New contents of array
@return {int} New length after items have been added
@fires remove
@fires add | [
"Set",
"the",
"contents",
"of",
"this",
"array",
".",
"Empties",
"it",
"first",
"."
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1173-L1179 | |
56,237 | j-/ok | ok.js | function (index) {
if (arguments.length < 1) {
return this;
}
if (index < 0) {
index = this.length + index;
}
if (hasProperty(this, index)) {
return this[index];
}
return null;
} | javascript | function (index) {
if (arguments.length < 1) {
return this;
}
if (index < 0) {
index = this.length + index;
}
if (hasProperty(this, index)) {
return this[index];
}
return null;
} | [
"function",
"(",
"index",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"<",
"1",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"index",
"=",
"this",
".",
"length",
"+",
"index",
";",
"}",
"if",
"(",
"hasPrope... | Get the item at a given index. Can be negative. If no index is given, a
reference to the array will be returned.
@param {int=} Index of item to get
@return {?ok.Items|*} Item at given index or whole array | [
"Get",
"the",
"item",
"at",
"a",
"given",
"index",
".",
"Can",
"be",
"negative",
".",
"If",
"no",
"index",
"is",
"given",
"a",
"reference",
"to",
"the",
"array",
"will",
"be",
"returned",
"."
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1186-L1197 | |
56,238 | j-/ok | ok.js | Collection | function Collection (items) {
this.items = new ok.Items();
this.start();
if (items) {
this.add(items);
}
this.init();
} | javascript | function Collection (items) {
this.items = new ok.Items();
this.start();
if (items) {
this.add(items);
}
this.init();
} | [
"function",
"Collection",
"(",
"items",
")",
"{",
"this",
".",
"items",
"=",
"new",
"ok",
".",
"Items",
"(",
")",
";",
"this",
".",
"start",
"(",
")",
";",
"if",
"(",
"items",
")",
"{",
"this",
".",
"add",
"(",
"items",
")",
";",
"}",
"this",
... | Initialize with items | [
"Initialize",
"with",
"items"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1280-L1287 |
56,239 | j-/ok | ok.js | function () {
this.stop();
this.listenTo(this.items, EVENT_ADD, this.triggerAdd);
this.listenTo(this.items, EVENT_REMOVE, this.triggerRemove);
this.listenTo(this.items, EVENT_SORT, this.triggerSort);
this.listenTo(this.items, EVENT_ADD, this.updateLength);
this.listenTo(this.items, EVENT_REMOVE, this.update... | javascript | function () {
this.stop();
this.listenTo(this.items, EVENT_ADD, this.triggerAdd);
this.listenTo(this.items, EVENT_REMOVE, this.triggerRemove);
this.listenTo(this.items, EVENT_SORT, this.triggerSort);
this.listenTo(this.items, EVENT_ADD, this.updateLength);
this.listenTo(this.items, EVENT_REMOVE, this.update... | [
"function",
"(",
")",
"{",
"this",
".",
"stop",
"(",
")",
";",
"this",
".",
"listenTo",
"(",
"this",
".",
"items",
",",
"EVENT_ADD",
",",
"this",
".",
"triggerAdd",
")",
";",
"this",
".",
"listenTo",
"(",
"this",
".",
"items",
",",
"EVENT_REMOVE",
... | Begin listening to changes on the internal items storage array | [
"Begin",
"listening",
"to",
"changes",
"on",
"the",
"internal",
"items",
"storage",
"array"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1291-L1300 | |
56,240 | j-/ok | ok.js | function () {
var items = _.flatten(arguments);
for (var i = 0, l = items.length; i < l; i++) {
this.addItem(items[i], this.items.length);
}
} | javascript | function () {
var items = _.flatten(arguments);
for (var i = 0, l = items.length; i < l; i++) {
this.addItem(items[i], this.items.length);
}
} | [
"function",
"(",
")",
"{",
"var",
"items",
"=",
"_",
".",
"flatten",
"(",
"arguments",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"items",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"this",
".",
"addItem",
... | Add one or more items
@param {*|Array.<*>} items A single item or array of items which will be
added to this collection
@fires add | [
"Add",
"one",
"or",
"more",
"items"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1357-L1362 | |
56,241 | j-/ok | ok.js | function (item/*, index*/) {
var old = item;
var Constructor;
if (!(item instanceof ok.Base)) {
Constructor = this.getConstructor(item);
item = new Constructor(item);
}
var identified = this.identify(item);
if (identified) {
identified.set(old);
}
else {
var index = this.findInsertIndex(item... | javascript | function (item/*, index*/) {
var old = item;
var Constructor;
if (!(item instanceof ok.Base)) {
Constructor = this.getConstructor(item);
item = new Constructor(item);
}
var identified = this.identify(item);
if (identified) {
identified.set(old);
}
else {
var index = this.findInsertIndex(item... | [
"function",
"(",
"item",
"/*, index*/",
")",
"{",
"var",
"old",
"=",
"item",
";",
"var",
"Constructor",
";",
"if",
"(",
"!",
"(",
"item",
"instanceof",
"ok",
".",
"Base",
")",
")",
"{",
"Constructor",
"=",
"this",
".",
"getConstructor",
"(",
"item",
... | Add a single item to this collection
@param {*} item Item to add to collection
@param {int} index Position to add the item
@fires add | [
"Add",
"a",
"single",
"item",
"to",
"this",
"collection"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1369-L1384 | |
56,242 | j-/ok | ok.js | function (item) {
var index = -1;
this.items.forEach(function (comparedTo, newIndex) {
if (this.comparator(comparedTo, item) <= 0) {
index = newIndex;
return false;
}
}, this);
return index;
} | javascript | function (item) {
var index = -1;
this.items.forEach(function (comparedTo, newIndex) {
if (this.comparator(comparedTo, item) <= 0) {
index = newIndex;
return false;
}
}, this);
return index;
} | [
"function",
"(",
"item",
")",
"{",
"var",
"index",
"=",
"-",
"1",
";",
"this",
".",
"items",
".",
"forEach",
"(",
"function",
"(",
"comparedTo",
",",
"newIndex",
")",
"{",
"if",
"(",
"this",
".",
"comparator",
"(",
"comparedTo",
",",
"item",
")",
"... | Determine where a newly inserted item would fit in this collection. Find
the index of the item to insert after, or -1 to insert at the first
index.
@param {*} item Item to be added to collection
@return {int} Index of the item to insert after
@todo Rephrase | [
"Determine",
"where",
"a",
"newly",
"inserted",
"item",
"would",
"fit",
"in",
"this",
"collection",
".",
"Find",
"the",
"index",
"of",
"the",
"item",
"to",
"insert",
"after",
"or",
"-",
"1",
"to",
"insert",
"at",
"the",
"first",
"index",
"."
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1407-L1416 | |
56,243 | j-/ok | ok.js | function (item) {
var items = this.items;
var removed = 0;
for (var i = 0, l = items.length; i < l; i++) {
if (items[i] === item) {
items.splice(i, 1);
i--;
removed++;
}
}
return removed;
} | javascript | function (item) {
var items = this.items;
var removed = 0;
for (var i = 0, l = items.length; i < l; i++) {
if (items[i] === item) {
items.splice(i, 1);
i--;
removed++;
}
}
return removed;
} | [
"function",
"(",
"item",
")",
"{",
"var",
"items",
"=",
"this",
".",
"items",
";",
"var",
"removed",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"items",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",... | Remove a specific item from the collection
@param {*} item Item to remove
@return {int} Number of items which have been removed
@fires remove | [
"Remove",
"a",
"specific",
"item",
"from",
"the",
"collection"
] | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1431-L1442 | |
56,244 | j-/ok | ok.js | function () {
var message = this.message;
var name = this.name;
var url = this.url;
var result = name;
if (message) {
result += ': ' + message;
}
if (url) {
result += ' (' + url + ')';
}
return result;
} | javascript | function () {
var message = this.message;
var name = this.name;
var url = this.url;
var result = name;
if (message) {
result += ': ' + message;
}
if (url) {
result += ' (' + url + ')';
}
return result;
} | [
"function",
"(",
")",
"{",
"var",
"message",
"=",
"this",
".",
"message",
";",
"var",
"name",
"=",
"this",
".",
"name",
";",
"var",
"url",
"=",
"this",
".",
"url",
";",
"var",
"result",
"=",
"name",
";",
"if",
"(",
"message",
")",
"{",
"result",
... | Display the contents of this error. Always shows the name. If the message
exists it is also displayed. A URL to, for example, help documentation
can be displayed as well.
@return {String} Contents of this error | [
"Display",
"the",
"contents",
"of",
"this",
"error",
".",
"Always",
"shows",
"the",
"name",
".",
"If",
"the",
"message",
"exists",
"it",
"is",
"also",
"displayed",
".",
"A",
"URL",
"to",
"for",
"example",
"help",
"documentation",
"can",
"be",
"displayed",
... | f1e4d9af3565574c5fdeccf4313972f2428cf3f8 | https://github.com/j-/ok/blob/f1e4d9af3565574c5fdeccf4313972f2428cf3f8/ok.js#L1591-L1603 | |
56,245 | cubbles/cubx-grunt-webpackage-upload | tasks/cubx_webpackage_bulk_upload.js | function (err, files) {
if (err) {
grunt.fail.fatal(err);
}
files.forEach(function (file) {
var pathName = path.join(workspacePath, file);
if (fs.statSync(pathName).isDirectory()) {
if (file === activeWebpackage && choices.length > 0) {
choices.splice(0, 0... | javascript | function (err, files) {
if (err) {
grunt.fail.fatal(err);
}
files.forEach(function (file) {
var pathName = path.join(workspacePath, file);
if (fs.statSync(pathName).isDirectory()) {
if (file === activeWebpackage && choices.length > 0) {
choices.splice(0, 0... | [
"function",
"(",
"err",
",",
"files",
")",
"{",
"if",
"(",
"err",
")",
"{",
"grunt",
".",
"fail",
".",
"fatal",
"(",
"err",
")",
";",
"}",
"files",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"var",
"pathName",
"=",
"path",
".",
"jo... | get all webpackages | [
"get",
"all",
"webpackages"
] | 3fb7075fc9de2185475ade21c3be8d31f0f56e1d | https://github.com/cubbles/cubx-grunt-webpackage-upload/blob/3fb7075fc9de2185475ade21c3be8d31f0f56e1d/tasks/cubx_webpackage_bulk_upload.js#L33-L82 | |
56,246 | duzun/onemit | onemit.js | EmitEvent | function EmitEvent(props) {
const event = this;
if ( !(event instanceof EmitEvent) ) {
return new EmitEvent(props);
}
if ( props == undefined ) {
props = '';
}
if ( typeof props == 'string' ) {
props = { type: props };
}
... | javascript | function EmitEvent(props) {
const event = this;
if ( !(event instanceof EmitEvent) ) {
return new EmitEvent(props);
}
if ( props == undefined ) {
props = '';
}
if ( typeof props == 'string' ) {
props = { type: props };
}
... | [
"function",
"EmitEvent",
"(",
"props",
")",
"{",
"const",
"event",
"=",
"this",
";",
"if",
"(",
"!",
"(",
"event",
"instanceof",
"EmitEvent",
")",
")",
"{",
"return",
"new",
"EmitEvent",
"(",
"props",
")",
";",
"}",
"if",
"(",
"props",
"==",
"undefin... | Event constructor.
@param (Object) props - { type: "eventName", ... } or just "eventName" | [
"Event",
"constructor",
"."
] | 12360553cf36379e9fc91d36c40d519a822d4987 | https://github.com/duzun/onemit/blob/12360553cf36379e9fc91d36c40d519a822d4987/onemit.js#L112-L125 |
56,247 | duzun/onemit | onemit.js | _extend | function _extend(obj, from) {
for ( let key in from ) if ( hop.call(from, key) ) {
obj[key] = from[key];
}
return obj;
} | javascript | function _extend(obj, from) {
for ( let key in from ) if ( hop.call(from, key) ) {
obj[key] = from[key];
}
return obj;
} | [
"function",
"_extend",
"(",
"obj",
",",
"from",
")",
"{",
"for",
"(",
"let",
"key",
"in",
"from",
")",
"if",
"(",
"hop",
".",
"call",
"(",
"from",
",",
"key",
")",
")",
"{",
"obj",
"[",
"key",
"]",
"=",
"from",
"[",
"key",
"]",
";",
"}",
"r... | Copy properties to `obj` from `from`
@param (Object) obj
@param (Object) from - source object
@return (Object) obj
@api private | [
"Copy",
"properties",
"to",
"obj",
"from",
"from"
] | 12360553cf36379e9fc91d36c40d519a822d4987 | https://github.com/duzun/onemit/blob/12360553cf36379e9fc91d36c40d519a822d4987/onemit.js#L522-L527 |
56,248 | duzun/onemit | onemit.js | _append | function _append(array, args/*, ...*/) {
var i = array.length
, j
, k = 1
, l
, m = arguments.length
, a
;
for(; k < m; ++k) {
a = arguments[k];
array.length =
l = i + a.length;
for(j = 0; i < l; ++... | javascript | function _append(array, args/*, ...*/) {
var i = array.length
, j
, k = 1
, l
, m = arguments.length
, a
;
for(; k < m; ++k) {
a = arguments[k];
array.length =
l = i + a.length;
for(j = 0; i < l; ++... | [
"function",
"_append",
"(",
"array",
",",
"args",
"/*, ...*/",
")",
"{",
"var",
"i",
"=",
"array",
".",
"length",
",",
"j",
",",
"k",
"=",
"1",
",",
"l",
",",
"m",
"=",
"arguments",
".",
"length",
",",
"a",
";",
"for",
"(",
";",
"k",
"<",
"m"... | Append elements of `args` to `array`.
This function is similar to `array.concat(args)`,
but also works on non-Array `args` as if it where an Array,
and it modifies the original `array`.
@param (Array) array - an array or array-like object
@param (Array) args - an array or array-like object to append to `array`
@ret... | [
"Append",
"elements",
"of",
"args",
"to",
"array",
"."
] | 12360553cf36379e9fc91d36c40d519a822d4987 | https://github.com/duzun/onemit/blob/12360553cf36379e9fc91d36c40d519a822d4987/onemit.js#L541-L558 |
56,249 | byu-oit/aws-scatter-gather | bin/response.js | function (data, circuitbreakerState, callback) {
const responder = (circuitbreakerState===CB.OPEN) ? config.bypass : config.handler;
// call the handler using its expected paradigm
const promise = responder.length > 1
? new Promise(function(resolve, reject) {
respon... | javascript | function (data, circuitbreakerState, callback) {
const responder = (circuitbreakerState===CB.OPEN) ? config.bypass : config.handler;
// call the handler using its expected paradigm
const promise = responder.length > 1
? new Promise(function(resolve, reject) {
respon... | [
"function",
"(",
"data",
",",
"circuitbreakerState",
",",
"callback",
")",
"{",
"const",
"responder",
"=",
"(",
"circuitbreakerState",
"===",
"CB",
".",
"OPEN",
")",
"?",
"config",
".",
"bypass",
":",
"config",
".",
"handler",
";",
"// call the handler using i... | define the response function wrapper | [
"define",
"the",
"response",
"function",
"wrapper"
] | 708e7caa6bea706276d55b3678d8468438d6d163 | https://github.com/byu-oit/aws-scatter-gather/blob/708e7caa6bea706276d55b3678d8468438d6d163/bin/response.js#L48-L68 | |
56,250 | paukan-org/core | common/index.js | serviceConfig | function serviceConfig() {
var arg = ld.values(arguments), cfg = {};
// try to load file from global directory
if(typeof arg[0] === 'string') {
var path = arg.shift();
try {
cfg = require('/etc/paukan/'+path+'.json');
} catch (err) { // try to load file directly if glob... | javascript | function serviceConfig() {
var arg = ld.values(arguments), cfg = {};
// try to load file from global directory
if(typeof arg[0] === 'string') {
var path = arg.shift();
try {
cfg = require('/etc/paukan/'+path+'.json');
} catch (err) { // try to load file directly if glob... | [
"function",
"serviceConfig",
"(",
")",
"{",
"var",
"arg",
"=",
"ld",
".",
"values",
"(",
"arguments",
")",
",",
"cfg",
"=",
"{",
"}",
";",
"// try to load file from global directory",
"if",
"(",
"typeof",
"arg",
"[",
"0",
"]",
"===",
"'string'",
")",
"{"... | Take configuration files and service specific info from package.json
@params {string|object}
- if first parameter is string - will be added config from /etc/paukan/<name>.json
- second parameter is confguration object with default settings
- last (third, or second if name is not specified - object from package.json wh... | [
"Take",
"configuration",
"files",
"and",
"service",
"specific",
"info",
"from",
"package",
".",
"json"
] | e6ff0667d50bc9b25ab5678852316e89521942ad | https://github.com/paukan-org/core/blob/e6ff0667d50bc9b25ab5678852316e89521942ad/common/index.js#L15-L45 |
56,251 | paukan-org/core | common/index.js | StreamConsole | function StreamConsole(cfg) {
cfg = cfg || {};
this.color = cfg.color || true;
this.timestamp = (typeof cfg.timestamp === 'undefined') ? 'HH:mm:ss ' : cfg.timestamp;
} | javascript | function StreamConsole(cfg) {
cfg = cfg || {};
this.color = cfg.color || true;
this.timestamp = (typeof cfg.timestamp === 'undefined') ? 'HH:mm:ss ' : cfg.timestamp;
} | [
"function",
"StreamConsole",
"(",
"cfg",
")",
"{",
"cfg",
"=",
"cfg",
"||",
"{",
"}",
";",
"this",
".",
"color",
"=",
"cfg",
".",
"color",
"||",
"true",
";",
"this",
".",
"timestamp",
"=",
"(",
"typeof",
"cfg",
".",
"timestamp",
"===",
"'undefined'",... | Stream to console for bunyan logger | [
"Stream",
"to",
"console",
"for",
"bunyan",
"logger"
] | e6ff0667d50bc9b25ab5678852316e89521942ad | https://github.com/paukan-org/core/blob/e6ff0667d50bc9b25ab5678852316e89521942ad/common/index.js#L50-L54 |
56,252 | JGAntunes/ampersand-infinite-scroll | ampersand-infinite-scroll.js | InfiniteScrollSetup | function InfiniteScrollSetup (options) {
options || (options = {});
var self = this;
var gap = (options.gap || 20); // defaults to 20
self.events = self.events || {};
assign(self.events, {scroll: 'infiniteScroll'});
self.infiniteScroll = function () {
if (this.el.scrollHeight - this.el.scrollTop <= th... | javascript | function InfiniteScrollSetup (options) {
options || (options = {});
var self = this;
var gap = (options.gap || 20); // defaults to 20
self.events = self.events || {};
assign(self.events, {scroll: 'infiniteScroll'});
self.infiniteScroll = function () {
if (this.el.scrollHeight - this.el.scrollTop <= th... | [
"function",
"InfiniteScrollSetup",
"(",
"options",
")",
"{",
"options",
"||",
"(",
"options",
"=",
"{",
"}",
")",
";",
"var",
"self",
"=",
"this",
";",
"var",
"gap",
"=",
"(",
"options",
".",
"gap",
"||",
"20",
")",
";",
"// defaults to 20",
"self",
... | Setup the closure function for the Infinite Scroll callback
@param {Object} options - the valid options are:
.gap - the pixel margin to fire the request | [
"Setup",
"the",
"closure",
"function",
"for",
"the",
"Infinite",
"Scroll",
"callback"
] | 6d3906eb1905fb2087199ba7daa64e93b06f7d5f | https://github.com/JGAntunes/ampersand-infinite-scroll/blob/6d3906eb1905fb2087199ba7daa64e93b06f7d5f/ampersand-infinite-scroll.js#L11-L24 |
56,253 | JGAntunes/ampersand-infinite-scroll | ampersand-infinite-scroll.js | InfiniteScrollView | function InfiniteScrollView (options) {
options || (options = {});
BaseView.call(this, options);
InfiniteScrollSetup.call(this, options);
} | javascript | function InfiniteScrollView (options) {
options || (options = {});
BaseView.call(this, options);
InfiniteScrollSetup.call(this, options);
} | [
"function",
"InfiniteScrollView",
"(",
"options",
")",
"{",
"options",
"||",
"(",
"options",
"=",
"{",
"}",
")",
";",
"BaseView",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"InfiniteScrollSetup",
".",
"call",
"(",
"this",
",",
"options",
")",
... | Infinite Scroll View constructor
@param {Object} options - the valid options according to the `ampersand-view`
and this module | [
"Infinite",
"Scroll",
"View",
"constructor"
] | 6d3906eb1905fb2087199ba7daa64e93b06f7d5f | https://github.com/JGAntunes/ampersand-infinite-scroll/blob/6d3906eb1905fb2087199ba7daa64e93b06f7d5f/ampersand-infinite-scroll.js#L37-L41 |
56,254 | directiv/data-hyper-repeat | index.js | hyperRepeat | function hyperRepeat(store) {
this.compile = compile;
this.state = function(config, state) {
var res = store.get(config.path, state);
if (!res.completed) return false;
return state.set(config.source, res.value);
};
this.children = function(config, state, children) {
var items = state.get(confi... | javascript | function hyperRepeat(store) {
this.compile = compile;
this.state = function(config, state) {
var res = store.get(config.path, state);
if (!res.completed) return false;
return state.set(config.source, res.value);
};
this.children = function(config, state, children) {
var items = state.get(confi... | [
"function",
"hyperRepeat",
"(",
"store",
")",
"{",
"this",
".",
"compile",
"=",
"compile",
";",
"this",
".",
"state",
"=",
"function",
"(",
"config",
",",
"state",
")",
"{",
"var",
"res",
"=",
"store",
".",
"get",
"(",
"config",
".",
"path",
",",
"... | Initialize the 'hyper-repeat' directive
Examples:
user <- users
user <- users[0,2..8]
user <- [.featured[0..2] .famous[0..2] .others[0..2]]
@param {StoreHyper} | [
"Initialize",
"the",
"hyper",
"-",
"repeat",
"directive"
] | 2f2aab31d2f9db4ca83765a793ad6f0c795c3f58 | https://github.com/directiv/data-hyper-repeat/blob/2f2aab31d2f9db4ca83765a793ad6f0c795c3f58/index.js#L28-L60 |
56,255 | directiv/data-hyper-repeat | index.js | compile | function compile(input) {
var res = input.match(REGEX);
if (!res) throw new Error('Invalid expression: "' + input + '"');
var range = res[3];
var parsedRange;
if (range) {
parsedRange = parser(range);
if (parsedRange === null) throw new Error('Invalid range expression: "' + range + '" in "' + input +... | javascript | function compile(input) {
var res = input.match(REGEX);
if (!res) throw new Error('Invalid expression: "' + input + '"');
var range = res[3];
var parsedRange;
if (range) {
parsedRange = parser(range);
if (parsedRange === null) throw new Error('Invalid range expression: "' + range + '" in "' + input +... | [
"function",
"compile",
"(",
"input",
")",
"{",
"var",
"res",
"=",
"input",
".",
"match",
"(",
"REGEX",
")",
";",
"if",
"(",
"!",
"res",
")",
"throw",
"new",
"Error",
"(",
"'Invalid expression: \"'",
"+",
"input",
"+",
"'\"'",
")",
";",
"var",
"range"... | Compile a 'hyper-repeat' expression | [
"Compile",
"a",
"hyper",
"-",
"repeat",
"expression"
] | 2f2aab31d2f9db4ca83765a793ad6f0c795c3f58 | https://github.com/directiv/data-hyper-repeat/blob/2f2aab31d2f9db4ca83765a793ad6f0c795c3f58/index.js#L72-L95 |
56,256 | RnbWd/parse-browserify | lib/file.js | function(file, type) {
var promise = new Parse.Promise();
if (typeof(FileReader) === "undefined") {
return Parse.Promise.error(new Parse.Error(
Parse.Error.FILE_READ_ERROR,
"Attempted to use a FileReader on an unsupported browser."));
}
var reader = new FileReader();
read... | javascript | function(file, type) {
var promise = new Parse.Promise();
if (typeof(FileReader) === "undefined") {
return Parse.Promise.error(new Parse.Error(
Parse.Error.FILE_READ_ERROR,
"Attempted to use a FileReader on an unsupported browser."));
}
var reader = new FileReader();
read... | [
"function",
"(",
"file",
",",
"type",
")",
"{",
"var",
"promise",
"=",
"new",
"Parse",
".",
"Promise",
"(",
")",
";",
"if",
"(",
"typeof",
"(",
"FileReader",
")",
"===",
"\"undefined\"",
")",
"{",
"return",
"Parse",
".",
"Promise",
".",
"error",
"(",... | Reads a File using a FileReader.
@param file {File} the File to read.
@param type {String} (optional) the mimetype to override with.
@return {Parse.Promise} A Promise that will be fulfilled with a
base64-encoded string of the data and its mime type. | [
"Reads",
"a",
"File",
"using",
"a",
"FileReader",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/file.js#L253-L284 | |
56,257 | RnbWd/parse-browserify | lib/file.js | function(options) {
options= options || {};
var self = this;
if (!self._previousSave) {
self._previousSave = self._source.then(function(base64, type) {
var data = {
base64: base64,
_ContentType: type
};
return Parse._request({
... | javascript | function(options) {
options= options || {};
var self = this;
if (!self._previousSave) {
self._previousSave = self._source.then(function(base64, type) {
var data = {
base64: base64,
_ContentType: type
};
return Parse._request({
... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"self",
".",
"_previousSave",
")",
"{",
"self",
".",
"_previousSave",
"=",
"self",
".",
"_source",
".",
"then",
"... | Saves the file to the Parse cloud.
@param {Object} options A Backbone-style options object.
@return {Parse.Promise} Promise that is resolved when the save finishes. | [
"Saves",
"the",
"file",
"to",
"the",
"Parse",
"cloud",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/file.js#L374-L399 | |
56,258 | Zenedith/npm-my-restify-api | lib/public/swagger/swagger-ui.js | function (operation, parameter) {
// TODO the reference to operation.api is not available
if (operation.api && operation.api.parameterMacro) {
return operation.api.parameterMacro(operation, parameter);
} else {
return parameter.defaultValue;
}
} | javascript | function (operation, parameter) {
// TODO the reference to operation.api is not available
if (operation.api && operation.api.parameterMacro) {
return operation.api.parameterMacro(operation, parameter);
} else {
return parameter.defaultValue;
}
} | [
"function",
"(",
"operation",
",",
"parameter",
")",
"{",
"// TODO the reference to operation.api is not available",
"if",
"(",
"operation",
".",
"api",
"&&",
"operation",
".",
"api",
".",
"parameterMacro",
")",
"{",
"return",
"operation",
".",
"api",
".",
"parame... | allows override of the default value based on the parameter being
supplied | [
"allows",
"override",
"of",
"the",
"default",
"value",
"based",
"on",
"the",
"parameter",
"being",
"supplied"
] | 946e40ede37124f6f4acaea19d73ab3c9d5074d9 | https://github.com/Zenedith/npm-my-restify-api/blob/946e40ede37124f6f4acaea19d73ab3c9d5074d9/lib/public/swagger/swagger-ui.js#L2650-L2657 | |
56,259 | Zenedith/npm-my-restify-api | lib/public/swagger/swagger-ui.js | function (model, property) {
// TODO the reference to model.api is not available
if (model.api && model.api.modelPropertyMacro) {
return model.api.modelPropertyMacro(model, property);
} else {
return property.default;
}
} | javascript | function (model, property) {
// TODO the reference to model.api is not available
if (model.api && model.api.modelPropertyMacro) {
return model.api.modelPropertyMacro(model, property);
} else {
return property.default;
}
} | [
"function",
"(",
"model",
",",
"property",
")",
"{",
"// TODO the reference to model.api is not available",
"if",
"(",
"model",
".",
"api",
"&&",
"model",
".",
"api",
".",
"modelPropertyMacro",
")",
"{",
"return",
"model",
".",
"api",
".",
"modelPropertyMacro",
... | allows overriding the default value of an model property | [
"allows",
"overriding",
"the",
"default",
"value",
"of",
"an",
"model",
"property"
] | 946e40ede37124f6f4acaea19d73ab3c9d5074d9 | https://github.com/Zenedith/npm-my-restify-api/blob/946e40ede37124f6f4acaea19d73ab3c9d5074d9/lib/public/swagger/swagger-ui.js#L2662-L2669 | |
56,260 | Zenedith/npm-my-restify-api | lib/public/swagger/swagger-ui.js | baseIsEqual | function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
// Exit early for identical values.
if (value === other) {
// Treat `+0` vs. `-0` as not equal.
return value !== 0 || (1 / value == 1 / other);
}
var valType = typeof value,
othType = typeof other;
// Exit early for unlik... | javascript | function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
// Exit early for identical values.
if (value === other) {
// Treat `+0` vs. `-0` as not equal.
return value !== 0 || (1 / value == 1 / other);
}
var valType = typeof value,
othType = typeof other;
// Exit early for unlik... | [
"function",
"baseIsEqual",
"(",
"value",
",",
"other",
",",
"customizer",
",",
"isLoose",
",",
"stackA",
",",
"stackB",
")",
"{",
"// Exit early for identical values.",
"if",
"(",
"value",
"===",
"other",
")",
"{",
"// Treat `+0` vs. `-0` as not equal.",
"return",
... | The base implementation of `_.isEqual` without support for `this` binding
`customizer` functions.
@private
@param {*} value The value to compare.
@param {*} other The other value to compare.
@param {Function} [customizer] The function to customize comparing values.
@param {boolean} [isLoose] Specify performing partial... | [
"The",
"base",
"implementation",
"of",
"_",
".",
"isEqual",
"without",
"support",
"for",
"this",
"binding",
"customizer",
"functions",
"."
] | 946e40ede37124f6f4acaea19d73ab3c9d5074d9 | https://github.com/Zenedith/npm-my-restify-api/blob/946e40ede37124f6f4acaea19d73ab3c9d5074d9/lib/public/swagger/swagger-ui.js#L16021-L16037 |
56,261 | Zenedith/npm-my-restify-api | lib/public/swagger/swagger-ui.js | baseMatchesProperty | function baseMatchesProperty(key, value) {
if (isStrictComparable(value)) {
return function(object) {
return object != null && object[key] === value &&
(typeof value != 'undefined' || (key in toObject(object)));
};
}
return function(object) {
return object != null && baseIsEqual(value, o... | javascript | function baseMatchesProperty(key, value) {
if (isStrictComparable(value)) {
return function(object) {
return object != null && object[key] === value &&
(typeof value != 'undefined' || (key in toObject(object)));
};
}
return function(object) {
return object != null && baseIsEqual(value, o... | [
"function",
"baseMatchesProperty",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"isStrictComparable",
"(",
"value",
")",
")",
"{",
"return",
"function",
"(",
"object",
")",
"{",
"return",
"object",
"!=",
"null",
"&&",
"object",
"[",
"key",
"]",
"===",
... | The base implementation of `_.matchesProperty` which does not coerce `key`
to a string.
@private
@param {string} key The key of the property to get.
@param {*} value The value to compare.
@returns {Function} Returns the new function. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"matchesProperty",
"which",
"does",
"not",
"coerce",
"key",
"to",
"a",
"string",
"."
] | 946e40ede37124f6f4acaea19d73ab3c9d5074d9 | https://github.com/Zenedith/npm-my-restify-api/blob/946e40ede37124f6f4acaea19d73ab3c9d5074d9/lib/public/swagger/swagger-ui.js#L16314-L16324 |
56,262 | Zenedith/npm-my-restify-api | lib/public/swagger/swagger-ui.js | createBaseEach | function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
var length = collection ? collection.length : 0;
if (!isLength(length)) {
return eachFunc(collection, iteratee);
}
var index = fromRight ? length : -1,
iterable = toObject(collection);
while ((fro... | javascript | function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
var length = collection ? collection.length : 0;
if (!isLength(length)) {
return eachFunc(collection, iteratee);
}
var index = fromRight ? length : -1,
iterable = toObject(collection);
while ((fro... | [
"function",
"createBaseEach",
"(",
"eachFunc",
",",
"fromRight",
")",
"{",
"return",
"function",
"(",
"collection",
",",
"iteratee",
")",
"{",
"var",
"length",
"=",
"collection",
"?",
"collection",
".",
"length",
":",
"0",
";",
"if",
"(",
"!",
"isLength",
... | Creates a `baseEach` or `baseEachRight` function.
@private
@param {Function} eachFunc The function to iterate over a collection.
@param {boolean} [fromRight] Specify iterating from right to left.
@returns {Function} Returns the new base function. | [
"Creates",
"a",
"baseEach",
"or",
"baseEachRight",
"function",
"."
] | 946e40ede37124f6f4acaea19d73ab3c9d5074d9 | https://github.com/Zenedith/npm-my-restify-api/blob/946e40ede37124f6f4acaea19d73ab3c9d5074d9/lib/public/swagger/swagger-ui.js#L16664-L16680 |
56,263 | phun-ky/patsy | lib/config.js | function(config,callback,patsy){
patsy = typeof config === 'function' && typeof callback === 'object' ? callback : patsy;
callback = typeof config === 'function' ? config : callback;
config = typeof config === 'function' ? undefined : config;
if(typeof config !== 'undefined' && type... | javascript | function(config,callback,patsy){
patsy = typeof config === 'function' && typeof callback === 'object' ? callback : patsy;
callback = typeof config === 'function' ? config : callback;
config = typeof config === 'function' ? undefined : config;
if(typeof config !== 'undefined' && type... | [
"function",
"(",
"config",
",",
"callback",
",",
"patsy",
")",
"{",
"patsy",
"=",
"typeof",
"config",
"===",
"'function'",
"&&",
"typeof",
"callback",
"===",
"'object'",
"?",
"callback",
":",
"patsy",
";",
"callback",
"=",
"typeof",
"config",
"===",
"'func... | Function to create a config file with given configuration object
@param Object config
@param Funciton callback | [
"Function",
"to",
"create",
"a",
"config",
"file",
"with",
"given",
"configuration",
"object"
] | b2bf3e6c72e17c38d9b2cf2fa4306478fc3858a5 | https://github.com/phun-ky/patsy/blob/b2bf3e6c72e17c38d9b2cf2fa4306478fc3858a5/lib/config.js#L75-L110 | |
56,264 | phun-ky/patsy | lib/config.js | function(patsy, project_path){
if(opts.verbose){
util.print('>>'.cyan + ' Loading project configuration...');
}
if(typeof project_path === 'undefined'){
if(opts.verbose){
patsy.utils.notice();
patsy.utils.notice('No project path set, declaring path to ... | javascript | function(patsy, project_path){
if(opts.verbose){
util.print('>>'.cyan + ' Loading project configuration...');
}
if(typeof project_path === 'undefined'){
if(opts.verbose){
patsy.utils.notice();
patsy.utils.notice('No project path set, declaring path to ... | [
"function",
"(",
"patsy",
",",
"project_path",
")",
"{",
"if",
"(",
"opts",
".",
"verbose",
")",
"{",
"util",
".",
"print",
"(",
"'>>'",
".",
"cyan",
"+",
"' Loading project configuration...'",
")",
";",
"}",
"if",
"(",
"typeof",
"project_path",
"===",
"... | Function to load patsy configuration
@param Object patsy
@param String projectPath
@return Object | [
"Function",
"to",
"load",
"patsy",
"configuration"
] | b2bf3e6c72e17c38d9b2cf2fa4306478fc3858a5 | https://github.com/phun-ky/patsy/blob/b2bf3e6c72e17c38d9b2cf2fa4306478fc3858a5/lib/config.js#L265-L374 | |
56,265 | phun-ky/patsy | lib/config.js | function () {
var defaultConfig = JSON.parse(fs.readFileSync(__dirname + '/../patsy.default.json', 'utf8'));
var projectSpecificSettings = {
"project": {
"details" : {
"name" : path.basename(process.cwd())
},
"environment": {
"root" : path.basen... | javascript | function () {
var defaultConfig = JSON.parse(fs.readFileSync(__dirname + '/../patsy.default.json', 'utf8'));
var projectSpecificSettings = {
"project": {
"details" : {
"name" : path.basename(process.cwd())
},
"environment": {
"root" : path.basen... | [
"function",
"(",
")",
"{",
"var",
"defaultConfig",
"=",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"__dirname",
"+",
"'/../patsy.default.json'",
",",
"'utf8'",
")",
")",
";",
"var",
"projectSpecificSettings",
"=",
"{",
"\"project\"",
":",
"{"... | Generates a default patsy.json configuration file in the root of the current project.
@var Object | [
"Generates",
"a",
"default",
"patsy",
".",
"json",
"configuration",
"file",
"in",
"the",
"root",
"of",
"the",
"current",
"project",
"."
] | b2bf3e6c72e17c38d9b2cf2fa4306478fc3858a5 | https://github.com/phun-ky/patsy/blob/b2bf3e6c72e17c38d9b2cf2fa4306478fc3858a5/lib/config.js#L380-L401 | |
56,266 | ltoussaint/node-bootstrap-core | application.js | dispatch | function dispatch(request, response) {
return Promise.resolve()
.then(resolveRouters.bind(this, request))
.then(callAction.bind(this, request, response));
} | javascript | function dispatch(request, response) {
return Promise.resolve()
.then(resolveRouters.bind(this, request))
.then(callAction.bind(this, request, response));
} | [
"function",
"dispatch",
"(",
"request",
",",
"response",
")",
"{",
"return",
"Promise",
".",
"resolve",
"(",
")",
".",
"then",
"(",
"resolveRouters",
".",
"bind",
"(",
"this",
",",
"request",
")",
")",
".",
"then",
"(",
"callAction",
".",
"bind",
"(",
... | Dispatch request in good action using routers
@param request
@param response
@returns {Promise} | [
"Dispatch",
"request",
"in",
"good",
"action",
"using",
"routers"
] | b083b320900ed068007e58af2249825b8da24c79 | https://github.com/ltoussaint/node-bootstrap-core/blob/b083b320900ed068007e58af2249825b8da24c79/application.js#L105-L109 |
56,267 | ltoussaint/node-bootstrap-core | application.js | resolveRouters | function resolveRouters(request) {
for (var i = 0, l = routers.length; i < l; i++) {
var callback = routers[i].resolve(request);
if (null != callback) {
return Promise.resolve(callback);
}
}
return Promise.reject('Route not defined for "' + request.url + '"');
} | javascript | function resolveRouters(request) {
for (var i = 0, l = routers.length; i < l; i++) {
var callback = routers[i].resolve(request);
if (null != callback) {
return Promise.resolve(callback);
}
}
return Promise.reject('Route not defined for "' + request.url + '"');
} | [
"function",
"resolveRouters",
"(",
"request",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"routers",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"var",
"callback",
"=",
"routers",
"[",
"i",
"]",
".",
"resolve",
"... | Resolve uri using routers
@param request
@returns {Promise} | [
"Resolve",
"uri",
"using",
"routers"
] | b083b320900ed068007e58af2249825b8da24c79 | https://github.com/ltoussaint/node-bootstrap-core/blob/b083b320900ed068007e58af2249825b8da24c79/application.js#L116-L124 |
56,268 | ltoussaint/node-bootstrap-core | application.js | callAction | function callAction(request, response, callback) {
if (typeof callback == 'function') {
return Promive.resolve()
.then(callback.bind(null, request, response));
}
try {
var Action = require(ACTION_PATH + '/' + callback.action + '.js');
} catch (error) {
if (error.message == 'Ca... | javascript | function callAction(request, response, callback) {
if (typeof callback == 'function') {
return Promive.resolve()
.then(callback.bind(null, request, response));
}
try {
var Action = require(ACTION_PATH + '/' + callback.action + '.js');
} catch (error) {
if (error.message == 'Ca... | [
"function",
"callAction",
"(",
"request",
",",
"response",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"callback",
"==",
"'function'",
")",
"{",
"return",
"Promive",
".",
"resolve",
"(",
")",
".",
"then",
"(",
"callback",
".",
"bind",
"(",
"null",
... | Call action and method form resolved route
@param request
@param response
@param callback
@returns {*} | [
"Call",
"action",
"and",
"method",
"form",
"resolved",
"route"
] | b083b320900ed068007e58af2249825b8da24c79 | https://github.com/ltoussaint/node-bootstrap-core/blob/b083b320900ed068007e58af2249825b8da24c79/application.js#L133-L176 |
56,269 | ltoussaint/node-bootstrap-core | application.js | postDecode | function postDecode(request) {
return new Promise(function promisePostDecode(resolve) {
var postData = '';
if (request.method === 'POST') {
request.on('data', function (chunk) {
// append the current chunk of data to the fullBody variable
postData += chunk.toString();
... | javascript | function postDecode(request) {
return new Promise(function promisePostDecode(resolve) {
var postData = '';
if (request.method === 'POST') {
request.on('data', function (chunk) {
// append the current chunk of data to the fullBody variable
postData += chunk.toString();
... | [
"function",
"postDecode",
"(",
"request",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"promisePostDecode",
"(",
"resolve",
")",
"{",
"var",
"postData",
"=",
"''",
";",
"if",
"(",
"request",
".",
"method",
"===",
"'POST'",
")",
"{",
"request",
... | Decode post data and add input into request
@param request
@returns {Promise} | [
"Decode",
"post",
"data",
"and",
"add",
"input",
"into",
"request"
] | b083b320900ed068007e58af2249825b8da24c79 | https://github.com/ltoussaint/node-bootstrap-core/blob/b083b320900ed068007e58af2249825b8da24c79/application.js#L183-L201 |
56,270 | ltoussaint/node-bootstrap-core | application.js | runHooks | function runHooks(request, response, hooks) {
var promise = Promise.resolve();
for (var i = 0; i < hooks.length; i++) {
promise = promise.then(hooks[i].bind(this, request, response));
}
return promise;
} | javascript | function runHooks(request, response, hooks) {
var promise = Promise.resolve();
for (var i = 0; i < hooks.length; i++) {
promise = promise.then(hooks[i].bind(this, request, response));
}
return promise;
} | [
"function",
"runHooks",
"(",
"request",
",",
"response",
",",
"hooks",
")",
"{",
"var",
"promise",
"=",
"Promise",
".",
"resolve",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"hooks",
".",
"length",
";",
"i",
"++",
")",
"{",
... | Run given hooks
@param request
@param response
@param hooks
@returns {Promise} | [
"Run",
"given",
"hooks"
] | b083b320900ed068007e58af2249825b8da24c79 | https://github.com/ltoussaint/node-bootstrap-core/blob/b083b320900ed068007e58af2249825b8da24c79/application.js#L210-L216 |
56,271 | forfuturellc/node-simple-argparse | index.js | pad | function pad(text, width) {
var space = (width - text.length) + 5;
return text + Array(space).join(" ");
} | javascript | function pad(text, width) {
var space = (width - text.length) + 5;
return text + Array(space).join(" ");
} | [
"function",
"pad",
"(",
"text",
",",
"width",
")",
"{",
"var",
"space",
"=",
"(",
"width",
"-",
"text",
".",
"length",
")",
"+",
"5",
";",
"return",
"text",
"+",
"Array",
"(",
"space",
")",
".",
"join",
"(",
"\" \"",
")",
";",
"}"
] | Appends padding space to some text.
@param {String} text
@param {Number} width - width of column
@return {String} padded text | [
"Appends",
"padding",
"space",
"to",
"some",
"text",
"."
] | 11f5d49cec5c891fb344c8a6a1e413b535dad331 | https://github.com/forfuturellc/node-simple-argparse/blob/11f5d49cec5c891fb344c8a6a1e413b535dad331/index.js#L37-L40 |
56,272 | hillscottc/nostra | dist/index.js | generate | function generate() {
var rnum = Math.floor(Math.random() * 10);
var mood = rnum <= 8 ? "good" : "bad";
var sentences = [_sentence_mgr2.default.feeling(mood), _word_library2.default.warning(), nu.chooseFrom([_sentence_mgr2.default.relationship(mood), _sentence_mgr2.default.encounter(mood)])];
// rand... | javascript | function generate() {
var rnum = Math.floor(Math.random() * 10);
var mood = rnum <= 8 ? "good" : "bad";
var sentences = [_sentence_mgr2.default.feeling(mood), _word_library2.default.warning(), nu.chooseFrom([_sentence_mgr2.default.relationship(mood), _sentence_mgr2.default.encounter(mood)])];
// rand... | [
"function",
"generate",
"(",
")",
"{",
"var",
"rnum",
"=",
"Math",
".",
"floor",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"10",
")",
";",
"var",
"mood",
"=",
"rnum",
"<=",
"8",
"?",
"\"good\"",
":",
"\"bad\"",
";",
"var",
"sentences",
"=",
"[",... | Generate a three to four sentence horoscope.
@returns {*[]} | [
"Generate",
"a",
"three",
"to",
"four",
"sentence",
"horoscope",
"."
] | 1801c8e19f7fab91dd29fea07195789d41624915 | https://github.com/hillscottc/nostra/blob/1801c8e19f7fab91dd29fea07195789d41624915/dist/index.js#L28-L47 |
56,273 | raincatcher-beta/raincatcher-file-angular | lib/file-list/file-list-controller.js | FileListController | function FileListController($scope, mediator, $stateParams, $window, userClient, fileMediatorService, $timeout, mobileCamera, desktopCamera, FILE_CONFIG) {
var self = this;
self.files = null;
var _files;
self.uploadEnabled = FILE_CONFIG.uploadEnabled;
userClient.getProfile().then(function(profileData){
va... | javascript | function FileListController($scope, mediator, $stateParams, $window, userClient, fileMediatorService, $timeout, mobileCamera, desktopCamera, FILE_CONFIG) {
var self = this;
self.files = null;
var _files;
self.uploadEnabled = FILE_CONFIG.uploadEnabled;
userClient.getProfile().then(function(profileData){
va... | [
"function",
"FileListController",
"(",
"$scope",
",",
"mediator",
",",
"$stateParams",
",",
"$window",
",",
"userClient",
",",
"fileMediatorService",
",",
"$timeout",
",",
"mobileCamera",
",",
"desktopCamera",
",",
"FILE_CONFIG",
")",
"{",
"var",
"self",
"=",
"t... | Controller for listing Files | [
"Controller",
"for",
"listing",
"Files"
] | a76d406ca62d6c29da3caf94cc9db75f343ec797 | https://github.com/raincatcher-beta/raincatcher-file-angular/blob/a76d406ca62d6c29da3caf94cc9db75f343ec797/lib/file-list/file-list-controller.js#L8-L72 |
56,274 | JimmyRobz/grunt-mokuai-coffee | tasks/mokuai-coffee.js | optionResult | function optionResult(options, option){
var result = options[option];
// If the returned value is a function, call it with the dest option parameter
if(_.isFunction(result)){
result = result(options.dest);
}
return result;
} | javascript | function optionResult(options, option){
var result = options[option];
// If the returned value is a function, call it with the dest option parameter
if(_.isFunction(result)){
result = result(options.dest);
}
return result;
} | [
"function",
"optionResult",
"(",
"options",
",",
"option",
")",
"{",
"var",
"result",
"=",
"options",
"[",
"option",
"]",
";",
"// If the returned value is a function, call it with the dest option parameter",
"if",
"(",
"_",
".",
"isFunction",
"(",
"result",
")",
")... | Get option result from options | [
"Get",
"option",
"result",
"from",
"options"
] | 163a4cdea0a5451832444dfd1570e9b5daf3d2f8 | https://github.com/JimmyRobz/grunt-mokuai-coffee/blob/163a4cdea0a5451832444dfd1570e9b5daf3d2f8/tasks/mokuai-coffee.js#L19-L26 |
56,275 | reklatsmasters/win-ps | index.js | build_shell | function build_shell(fields) {
var $fields = Array.isArray(fields) ? normalizeFields(fields) : ['ProcessId','Name','Path','ParentProcessId','Priority'];
var args = command.shell_arg.split(' ');
args.push(`${command.ps} | ${command.select} ${ $fields.join(',') } | ${command.convert}`);
return shell(command.shell,... | javascript | function build_shell(fields) {
var $fields = Array.isArray(fields) ? normalizeFields(fields) : ['ProcessId','Name','Path','ParentProcessId','Priority'];
var args = command.shell_arg.split(' ');
args.push(`${command.ps} | ${command.select} ${ $fields.join(',') } | ${command.convert}`);
return shell(command.shell,... | [
"function",
"build_shell",
"(",
"fields",
")",
"{",
"var",
"$fields",
"=",
"Array",
".",
"isArray",
"(",
"fields",
")",
"?",
"normalizeFields",
"(",
"fields",
")",
":",
"[",
"'ProcessId'",
",",
"'Name'",
",",
"'Path'",
",",
"'ParentProcessId'",
",",
"'Prio... | Build shell command
@param {Array} fields
@return {Object} child_process instance | [
"Build",
"shell",
"command"
] | ea5f7e5978b3a8620556a0d898000429e5baeb4f | https://github.com/reklatsmasters/win-ps/blob/ea5f7e5978b3a8620556a0d898000429e5baeb4f/index.js#L45-L52 |
56,276 | MCluck90/clairvoyant | src/main.js | function(options) {
options = extend({
src: '',
output: '',
is3d: false,
failOnWarn: false,
overwrite: false,
reporter: 'default'
}, options);
if (!options.src || !options.output) {
throw new Error('Must specify source file and output directory');
... | javascript | function(options) {
options = extend({
src: '',
output: '',
is3d: false,
failOnWarn: false,
overwrite: false,
reporter: 'default'
}, options);
if (!options.src || !options.output) {
throw new Error('Must specify source file and output directory');
... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"extend",
"(",
"{",
"src",
":",
"''",
",",
"output",
":",
"''",
",",
"is3d",
":",
"false",
",",
"failOnWarn",
":",
"false",
",",
"overwrite",
":",
"false",
",",
"reporter",
":",
"'default'",
"}",
... | Exposes Clairvoyant as a module to use programatically
@param {object} options
@param {string} options.src - Source file
@param {string} options.output - Path to the file to place the project in
@param {boolean} [options.is3d=false] - If true, will compile for Psykick3D
@param... | [
"Exposes",
"Clairvoyant",
"as",
"a",
"module",
"to",
"use",
"programatically"
] | 4c347499c5fe0f561a53e180d141884b1fa8c21b | https://github.com/MCluck90/clairvoyant/blob/4c347499c5fe0f561a53e180d141884b1fa8c21b/src/main.js#L24-L58 | |
56,277 | relief-melone/limitpromises | src/services/service.handleRejects.js | handleRejects | function handleRejects(PromiseFunc, Obj, Err, Options){
var rejectOpts = Options.Reject || rejectConfig;
switch(rejectOpts.rejectBehaviour){
case "reject":
// Every time a promise finishes start the first one from the currentPromiseArrays[typeKey]Array that hasnt been started yet; ... | javascript | function handleRejects(PromiseFunc, Obj, Err, Options){
var rejectOpts = Options.Reject || rejectConfig;
switch(rejectOpts.rejectBehaviour){
case "reject":
// Every time a promise finishes start the first one from the currentPromiseArrays[typeKey]Array that hasnt been started yet; ... | [
"function",
"handleRejects",
"(",
"PromiseFunc",
",",
"Obj",
",",
"Err",
",",
"Options",
")",
"{",
"var",
"rejectOpts",
"=",
"Options",
".",
"Reject",
"||",
"rejectConfig",
";",
"switch",
"(",
"rejectOpts",
".",
"rejectBehaviour",
")",
"{",
"case",
"\"reject... | Handle rejects will determine how a promise is beeing handled after it the PromiseFunc has been rejected
@param {Function} PromiseFunc Function that returns a Promise with one InputParameter that is used
@param {Object} Obj Current Object to be treated
@param {Error} Err The error returned by the PromiseFunction
@p... | [
"Handle",
"rejects",
"will",
"determine",
"how",
"a",
"promise",
"is",
"beeing",
"handled",
"after",
"it",
"the",
"PromiseFunc",
"has",
"been",
"rejected"
] | 1735b92749740204b597c1c6026257d54ade8200 | https://github.com/relief-melone/limitpromises/blob/1735b92749740204b597c1c6026257d54ade8200/src/services/service.handleRejects.js#L13-L29 |
56,278 | imlucas/node-stor | adapters/backbone.js | getHandler | function getHandler(method){
var taxonomy = {
create: store.set,
read: store.get,
update: store.set,
'delete': store.remove,
patch: store.set,
findAll: store.all,
findById: store.get
};
return store[method] || taxonomy[method];
} | javascript | function getHandler(method){
var taxonomy = {
create: store.set,
read: store.get,
update: store.set,
'delete': store.remove,
patch: store.set,
findAll: store.all,
findById: store.get
};
return store[method] || taxonomy[method];
} | [
"function",
"getHandler",
"(",
"method",
")",
"{",
"var",
"taxonomy",
"=",
"{",
"create",
":",
"store",
".",
"set",
",",
"read",
":",
"store",
".",
"get",
",",
"update",
":",
"store",
".",
"set",
",",
"'delete'",
":",
"store",
".",
"remove",
",",
"... | normalize the api taxonomy with a convenience that returns the correct function for a store. | [
"normalize",
"the",
"api",
"taxonomy",
"with",
"a",
"convenience",
"that",
"returns",
"the",
"correct",
"function",
"for",
"a",
"store",
"."
] | 6b74af52bf160873658bc3570db716d44c33f335 | https://github.com/imlucas/node-stor/blob/6b74af52bf160873658bc3570db716d44c33f335/adapters/backbone.js#L5-L16 |
56,279 | weisjohn/tessel-apple-remote | index.js | valid_leader | function valid_leader(durations) {
var on = durations[0];
var off = durations[1];
return (8900 < on && on < 9200) && (-4600 < off && off < -4350);
} | javascript | function valid_leader(durations) {
var on = durations[0];
var off = durations[1];
return (8900 < on && on < 9200) && (-4600 < off && off < -4350);
} | [
"function",
"valid_leader",
"(",
"durations",
")",
"{",
"var",
"on",
"=",
"durations",
"[",
"0",
"]",
";",
"var",
"off",
"=",
"durations",
"[",
"1",
"]",
";",
"return",
"(",
"8900",
"<",
"on",
"&&",
"on",
"<",
"9200",
")",
"&&",
"(",
"-",
"4600",... | validate the leader bit | [
"validate",
"the",
"leader",
"bit"
] | 0b29abe595f53059eebd021c70b13c9d8720ac8d | https://github.com/weisjohn/tessel-apple-remote/blob/0b29abe595f53059eebd021c70b13c9d8720ac8d/index.js#L35-L39 |
56,280 | weisjohn/tessel-apple-remote | index.js | command_id_from_buffer | function command_id_from_buffer(data) {
var durations = command_durations_from_hex_buffer(data);
if (!valid_leader(durations)) return;
var binary = binary_from_durations(durations);
if (!valid_binary(binary)) return;
var bytes = bytes_from_binary(binary);
if (!valid_bytes(bytes)) return;
... | javascript | function command_id_from_buffer(data) {
var durations = command_durations_from_hex_buffer(data);
if (!valid_leader(durations)) return;
var binary = binary_from_durations(durations);
if (!valid_binary(binary)) return;
var bytes = bytes_from_binary(binary);
if (!valid_bytes(bytes)) return;
... | [
"function",
"command_id_from_buffer",
"(",
"data",
")",
"{",
"var",
"durations",
"=",
"command_durations_from_hex_buffer",
"(",
"data",
")",
";",
"if",
"(",
"!",
"valid_leader",
"(",
"durations",
")",
")",
"return",
";",
"var",
"binary",
"=",
"binary_from_durati... | a small implementation of the whole flow | [
"a",
"small",
"implementation",
"of",
"the",
"whole",
"flow"
] | 0b29abe595f53059eebd021c70b13c9d8720ac8d | https://github.com/weisjohn/tessel-apple-remote/blob/0b29abe595f53059eebd021c70b13c9d8720ac8d/index.js#L111-L125 |
56,281 | weisjohn/tessel-apple-remote | index.js | continue_from_buffer | function continue_from_buffer(data) {
var durations = continue_durations_from_hex_buffer(data);
var on = durations[0];
var off = durations[1];
var stop = durations[2];
return (8900 < on && on < 9200) &&
(-2350 < off && off < -2100) &&
(500 < stop && stop < 650);
} | javascript | function continue_from_buffer(data) {
var durations = continue_durations_from_hex_buffer(data);
var on = durations[0];
var off = durations[1];
var stop = durations[2];
return (8900 < on && on < 9200) &&
(-2350 < off && off < -2100) &&
(500 < stop && stop < 650);
} | [
"function",
"continue_from_buffer",
"(",
"data",
")",
"{",
"var",
"durations",
"=",
"continue_durations_from_hex_buffer",
"(",
"data",
")",
";",
"var",
"on",
"=",
"durations",
"[",
"0",
"]",
";",
"var",
"off",
"=",
"durations",
"[",
"1",
"]",
";",
"var",
... | determine whether or not the buffer is a valid continuation code | [
"determine",
"whether",
"or",
"not",
"the",
"buffer",
"is",
"a",
"valid",
"continuation",
"code"
] | 0b29abe595f53059eebd021c70b13c9d8720ac8d | https://github.com/weisjohn/tessel-apple-remote/blob/0b29abe595f53059eebd021c70b13c9d8720ac8d/index.js#L129-L140 |
56,282 | Swaagie/npm-probe | probes/delta.js | versions | function versions(a, b) {
if (!a || !b) return false;
a = Array.isArray(a) ? a : Object.keys(a);
b = Array.isArray(a) ? a : Object.keys(a);
return a.length === b.length && a.reduce(function has(memo, item) {
return memo && ~b.indexOf(item);
}, true);
} | javascript | function versions(a, b) {
if (!a || !b) return false;
a = Array.isArray(a) ? a : Object.keys(a);
b = Array.isArray(a) ? a : Object.keys(a);
return a.length === b.length && a.reduce(function has(memo, item) {
return memo && ~b.indexOf(item);
}, true);
} | [
"function",
"versions",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"!",
"a",
"||",
"!",
"b",
")",
"return",
"false",
";",
"a",
"=",
"Array",
".",
"isArray",
"(",
"a",
")",
"?",
"a",
":",
"Object",
".",
"keys",
"(",
"a",
")",
";",
"b",
"=",
... | Unpublished modules will have no versions, modified time should be equal. | [
"Unpublished",
"modules",
"will",
"have",
"no",
"versions",
"modified",
"time",
"should",
"be",
"equal",
"."
] | e9b717934ff3e3eb4f7c7a15f39728c380f1925e | https://github.com/Swaagie/npm-probe/blob/e9b717934ff3e3eb4f7c7a15f39728c380f1925e/probes/delta.js#L48-L57 |
56,283 | oori/gulp-jsonschema-deref | index.js | dereference | function dereference(file, opts, cb) {
parser.dereference(file.path, opts, (err, schema) => {
if (err) {
this.emit('error', new gutil.PluginError('gulp-jsonschema-deref', err, {fileName: file.path}));
} else {
file.contents = Buffer.from(JSON.stringify(schema));
this.push(file);
}
cb();
});
} | javascript | function dereference(file, opts, cb) {
parser.dereference(file.path, opts, (err, schema) => {
if (err) {
this.emit('error', new gutil.PluginError('gulp-jsonschema-deref', err, {fileName: file.path}));
} else {
file.contents = Buffer.from(JSON.stringify(schema));
this.push(file);
}
cb();
});
} | [
"function",
"dereference",
"(",
"file",
",",
"opts",
",",
"cb",
")",
"{",
"parser",
".",
"dereference",
"(",
"file",
".",
"path",
",",
"opts",
",",
"(",
"err",
",",
"schema",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"this",
".",
"emit",
"(",
... | Dereference a jsonschema | [
"Dereference",
"a",
"jsonschema"
] | 51b6a8af2039fe3bac9af0d10b61320fc57ae122 | https://github.com/oori/gulp-jsonschema-deref/blob/51b6a8af2039fe3bac9af0d10b61320fc57ae122/index.js#L9-L19 |
56,284 | rumkin/keyget | index.js | breadcrumbs | function breadcrumbs(target, path) {
path = pathToArray(path);
const result = [target];
let part;
let value = target;
if (! isObject(value)) {
return result;
}
for (let i = 0, l = path.length; i < l; i++) {
part = path[i];
if (! value.hasOwnProperty(part)) {
break;
}
result.... | javascript | function breadcrumbs(target, path) {
path = pathToArray(path);
const result = [target];
let part;
let value = target;
if (! isObject(value)) {
return result;
}
for (let i = 0, l = path.length; i < l; i++) {
part = path[i];
if (! value.hasOwnProperty(part)) {
break;
}
result.... | [
"function",
"breadcrumbs",
"(",
"target",
",",
"path",
")",
"{",
"path",
"=",
"pathToArray",
"(",
"path",
")",
";",
"const",
"result",
"=",
"[",
"target",
"]",
";",
"let",
"part",
";",
"let",
"value",
"=",
"target",
";",
"if",
"(",
"!",
"isObject",
... | breadcrumbs - Extract nested value by path and return as array. If target is not an object
or path is empty returns empty array.
@param {*} target Value.
@param {Path} path Path to value.
@return {*[]} Values for path components.
@example
breadcrumbs({a: b: {1}}, ['a', 'b']); // -> [{b:1}, 1]; | [
"breadcrumbs",
"-",
"Extract",
"nested",
"value",
"by",
"path",
"and",
"return",
"as",
"array",
".",
"If",
"target",
"is",
"not",
"an",
"object",
"or",
"path",
"is",
"empty",
"returns",
"empty",
"array",
"."
] | 3198d6cfb22d10f98552b7cee0be6b1dab79b5fd | https://github.com/rumkin/keyget/blob/3198d6cfb22d10f98552b7cee0be6b1dab79b5fd/index.js#L39-L63 |
56,285 | rumkin/keyget | index.js | hasPath | function hasPath(target, path) {
path = pathToArray(path);
const result = breadcrumbs(target, path);
return result.length === path.length + 1;
} | javascript | function hasPath(target, path) {
path = pathToArray(path);
const result = breadcrumbs(target, path);
return result.length === path.length + 1;
} | [
"function",
"hasPath",
"(",
"target",
",",
"path",
")",
"{",
"path",
"=",
"pathToArray",
"(",
"path",
")",
";",
"const",
"result",
"=",
"breadcrumbs",
"(",
"target",
",",
"path",
")",
";",
"return",
"result",
".",
"length",
"===",
"path",
".",
"length"... | hasPath - Set deeply nested value into target object. If nested properties
are not an objects or not exists creates them.
@param {Object} target Parent object.
@param {Path} path Array of path segments.
@return {Boolean} Returns true if object contains `path`. | [
"hasPath",
"-",
"Set",
"deeply",
"nested",
"value",
"into",
"target",
"object",
".",
"If",
"nested",
"properties",
"are",
"not",
"an",
"objects",
"or",
"not",
"exists",
"creates",
"them",
"."
] | 3198d6cfb22d10f98552b7cee0be6b1dab79b5fd | https://github.com/rumkin/keyget/blob/3198d6cfb22d10f98552b7cee0be6b1dab79b5fd/index.js#L73-L79 |
56,286 | rumkin/keyget | index.js | setByPath | function setByPath(target, path, value) {
path = pathToArray(path);
if (! path.length) {
return value;
}
const key = path[0];
if (isNumber(key)) {
if (! Array.isArray(target)) {
target = [];
}
}
else if (! isObject(target)) {
target = {};
}
if (path.length > 1) {
target[ke... | javascript | function setByPath(target, path, value) {
path = pathToArray(path);
if (! path.length) {
return value;
}
const key = path[0];
if (isNumber(key)) {
if (! Array.isArray(target)) {
target = [];
}
}
else if (! isObject(target)) {
target = {};
}
if (path.length > 1) {
target[ke... | [
"function",
"setByPath",
"(",
"target",
",",
"path",
",",
"value",
")",
"{",
"path",
"=",
"pathToArray",
"(",
"path",
")",
";",
"if",
"(",
"!",
"path",
".",
"length",
")",
"{",
"return",
"value",
";",
"}",
"const",
"key",
"=",
"path",
"[",
"0",
"... | setByPath - Set deeply nested value into target object. If nested properties
are not an objects or not exists creates them.
@param {Object} target Parent object.
@param {Path} path Array of path segments.
@param {*} value Value to set.
@return {void} | [
"setByPath",
"-",
"Set",
"deeply",
"nested",
"value",
"into",
"target",
"object",
".",
"If",
"nested",
"properties",
"are",
"not",
"an",
"objects",
"or",
"not",
"exists",
"creates",
"them",
"."
] | 3198d6cfb22d10f98552b7cee0be6b1dab79b5fd | https://github.com/rumkin/keyget/blob/3198d6cfb22d10f98552b7cee0be6b1dab79b5fd/index.js#L90-L115 |
56,287 | rumkin/keyget | index.js | pushByPath | function pushByPath(target, path, value) {
path = pathToArray(path);
if (! path.length) {
if (! Array.isArray(target)) {
return [value];
}
else {
target.push(value);
return target;
}
}
if (! isObject(target)) {
target = {};
}
return at(target, path, function(finalTar... | javascript | function pushByPath(target, path, value) {
path = pathToArray(path);
if (! path.length) {
if (! Array.isArray(target)) {
return [value];
}
else {
target.push(value);
return target;
}
}
if (! isObject(target)) {
target = {};
}
return at(target, path, function(finalTar... | [
"function",
"pushByPath",
"(",
"target",
",",
"path",
",",
"value",
")",
"{",
"path",
"=",
"pathToArray",
"(",
"path",
")",
";",
"if",
"(",
"!",
"path",
".",
"length",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"target",
")",
")",
"{... | Push deeply nested value into target object. If nested properties are not an
objects or not exists creates them.
@param {*} target Parent object.
@param {Path} path Array of path segments.
@param {*} value Value to set.
@return {Object|Array} Returns updated `target`. | [
"Push",
"deeply",
"nested",
"value",
"into",
"target",
"object",
".",
"If",
"nested",
"properties",
"are",
"not",
"an",
"objects",
"or",
"not",
"exists",
"creates",
"them",
"."
] | 3198d6cfb22d10f98552b7cee0be6b1dab79b5fd | https://github.com/rumkin/keyget/blob/3198d6cfb22d10f98552b7cee0be6b1dab79b5fd/index.js#L126-L153 |
56,288 | rumkin/keyget | index.js | getByPath | function getByPath(target, path) {
path = pathToArray(path);
const values = breadcrumbs(target, path);
return values[values.length - 1];
} | javascript | function getByPath(target, path) {
path = pathToArray(path);
const values = breadcrumbs(target, path);
return values[values.length - 1];
} | [
"function",
"getByPath",
"(",
"target",
",",
"path",
")",
"{",
"path",
"=",
"pathToArray",
"(",
"path",
")",
";",
"const",
"values",
"=",
"breadcrumbs",
"(",
"target",
",",
"path",
")",
";",
"return",
"values",
"[",
"values",
".",
"length",
"-",
"1",
... | getByPath - Get value from `target` by `path`.
@param {*} target Nested object or anything else.
@param {Path} path Path to nested property.
@return {*} Returns value or undefined. | [
"getByPath",
"-",
"Get",
"value",
"from",
"target",
"by",
"path",
"."
] | 3198d6cfb22d10f98552b7cee0be6b1dab79b5fd | https://github.com/rumkin/keyget/blob/3198d6cfb22d10f98552b7cee0be6b1dab79b5fd/index.js#L204-L210 |
56,289 | rumkin/keyget | index.js | methodByPath | function methodByPath(target, path) {
path = pathToArray(path);
const values = breadcrumbs(target, path);
if (values.length < path.length) {
return noop;
}
if (typeof values[values.length - 1] !== 'function') {
return noop;
}
if (values.length > 1) {
return values[values.length - 1].bind(v... | javascript | function methodByPath(target, path) {
path = pathToArray(path);
const values = breadcrumbs(target, path);
if (values.length < path.length) {
return noop;
}
if (typeof values[values.length - 1] !== 'function') {
return noop;
}
if (values.length > 1) {
return values[values.length - 1].bind(v... | [
"function",
"methodByPath",
"(",
"target",
",",
"path",
")",
"{",
"path",
"=",
"pathToArray",
"(",
"path",
")",
";",
"const",
"values",
"=",
"breadcrumbs",
"(",
"target",
",",
"path",
")",
";",
"if",
"(",
"values",
".",
"length",
"<",
"path",
".",
"l... | methodByPath - Receive method from deeply nested object as function with
captured context as the method's owner object.
@param {*} target Deeply nested object or anything else.
@param {Path} path Path to the method.
@return {Function} Returns function. | [
"methodByPath",
"-",
"Receive",
"method",
"from",
"deeply",
"nested",
"object",
"as",
"function",
"with",
"captured",
"context",
"as",
"the",
"method",
"s",
"owner",
"object",
"."
] | 3198d6cfb22d10f98552b7cee0be6b1dab79b5fd | https://github.com/rumkin/keyget/blob/3198d6cfb22d10f98552b7cee0be6b1dab79b5fd/index.js#L220-L239 |
56,290 | rumkin/keyget | index.js | callByPath | function callByPath(target, path, args) {
var fn = methodByPath(target, path);
if (! fn) {
return;
}
return fn.apply(null, args);
} | javascript | function callByPath(target, path, args) {
var fn = methodByPath(target, path);
if (! fn) {
return;
}
return fn.apply(null, args);
} | [
"function",
"callByPath",
"(",
"target",
",",
"path",
",",
"args",
")",
"{",
"var",
"fn",
"=",
"methodByPath",
"(",
"target",
",",
"path",
")",
";",
"if",
"(",
"!",
"fn",
")",
"{",
"return",
";",
"}",
"return",
"fn",
".",
"apply",
"(",
"null",
",... | callByPath - Call method by it's path in nested object.
@param {*} target Nested object or anything else.
@param {Path} path Path to nested property.
@param {*[]} args Arguments of function call.
@return {*} Result of function call or undefined if method not exists. | [
"callByPath",
"-",
"Call",
"method",
"by",
"it",
"s",
"path",
"in",
"nested",
"object",
"."
] | 3198d6cfb22d10f98552b7cee0be6b1dab79b5fd | https://github.com/rumkin/keyget/blob/3198d6cfb22d10f98552b7cee0be6b1dab79b5fd/index.js#L249-L256 |
56,291 | RnbWd/parse-browserify | lib/geopoint.js | function(point) {
var d2r = Math.PI / 180.0;
var lat1rad = this.latitude * d2r;
var long1rad = this.longitude * d2r;
var lat2rad = point.latitude * d2r;
var long2rad = point.longitude * d2r;
var deltaLat = lat1rad - lat2rad;
var deltaLong = long1rad - long2rad;
var sinDel... | javascript | function(point) {
var d2r = Math.PI / 180.0;
var lat1rad = this.latitude * d2r;
var long1rad = this.longitude * d2r;
var lat2rad = point.latitude * d2r;
var long2rad = point.longitude * d2r;
var deltaLat = lat1rad - lat2rad;
var deltaLong = long1rad - long2rad;
var sinDel... | [
"function",
"(",
"point",
")",
"{",
"var",
"d2r",
"=",
"Math",
".",
"PI",
"/",
"180.0",
";",
"var",
"lat1rad",
"=",
"this",
".",
"latitude",
"*",
"d2r",
";",
"var",
"long1rad",
"=",
"this",
".",
"longitude",
"*",
"d2r",
";",
"var",
"lat2rad",
"=",
... | Returns the distance from this GeoPoint to another in radians.
@param {Parse.GeoPoint} point the other Parse.GeoPoint.
@return {Number} | [
"Returns",
"the",
"distance",
"from",
"this",
"GeoPoint",
"to",
"another",
"in",
"radians",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/geopoint.js#L136-L152 | |
56,292 | allanmboyd/exceptions | lib/exceptions.js | throwError | function throwError(name, message) {
var error = new Error(message);
error.name = name;
error.stack = formaterrors.stackFilter(error.stack, ["exceptions.js"], false);
throw error;
} | javascript | function throwError(name, message) {
var error = new Error(message);
error.name = name;
error.stack = formaterrors.stackFilter(error.stack, ["exceptions.js"], false);
throw error;
} | [
"function",
"throwError",
"(",
"name",
",",
"message",
")",
"{",
"var",
"error",
"=",
"new",
"Error",
"(",
"message",
")",
";",
"error",
".",
"name",
"=",
"name",
";",
"error",
".",
"stack",
"=",
"formaterrors",
".",
"stackFilter",
"(",
"error",
".",
... | Throw an error. This method ensures that no exceptions.js lines are included in the stack trace of the thrown
error.
@private
@param {String} name the name of the Error to throw.
@param {String} message the message part of the error to throw. | [
"Throw",
"an",
"error",
".",
"This",
"method",
"ensures",
"that",
"no",
"exceptions",
".",
"js",
"lines",
"are",
"included",
"in",
"the",
"stack",
"trace",
"of",
"the",
"thrown",
"error",
"."
] | ea093be65aba73ededd98fccbf24e16e38f9629b | https://github.com/allanmboyd/exceptions/blob/ea093be65aba73ededd98fccbf24e16e38f9629b/lib/exceptions.js#L56-L63 |
56,293 | imlucas/node-regret | index.js | regret | function regret(name, input){
var matchers, res = null, re, matches, matcher;
if(typeof name.exec === 'function'){
matchers = Object.keys(regret.matchers).filter(function(m){
return name.test(m);
}).map(function(m){
return regret.matchers[m];
});
}
else {
matchers = regret.matchers[n... | javascript | function regret(name, input){
var matchers, res = null, re, matches, matcher;
if(typeof name.exec === 'function'){
matchers = Object.keys(regret.matchers).filter(function(m){
return name.test(m);
}).map(function(m){
return regret.matchers[m];
});
}
else {
matchers = regret.matchers[n... | [
"function",
"regret",
"(",
"name",
",",
"input",
")",
"{",
"var",
"matchers",
",",
"res",
"=",
"null",
",",
"re",
",",
"matches",
",",
"matcher",
";",
"if",
"(",
"typeof",
"name",
".",
"exec",
"===",
"'function'",
")",
"{",
"matchers",
"=",
"Object",... | Don't let the regex party get out of control. | [
"Don",
"t",
"let",
"the",
"regex",
"party",
"get",
"out",
"of",
"control",
"."
] | 7e304af8575a9480028fc75fe62a3e1c5d893551 | https://github.com/imlucas/node-regret/blob/7e304af8575a9480028fc75fe62a3e1c5d893551/index.js#L4-L38 |
56,294 | antonycourtney/tabli-core | lib/js/utils.js | seqActions | function seqActions(actions, seed, onCompleted) {
var index = 0;
function invokeNext(v) {
var action = actions[index];
action(v, function (res) {
index = index + 1;
if (index < actions.length) {
invokeNext(res);
} else {
onCompleted(res);
}
});
}
invokeNext(... | javascript | function seqActions(actions, seed, onCompleted) {
var index = 0;
function invokeNext(v) {
var action = actions[index];
action(v, function (res) {
index = index + 1;
if (index < actions.length) {
invokeNext(res);
} else {
onCompleted(res);
}
});
}
invokeNext(... | [
"function",
"seqActions",
"(",
"actions",
",",
"seed",
",",
"onCompleted",
")",
"{",
"var",
"index",
"=",
"0",
";",
"function",
"invokeNext",
"(",
"v",
")",
"{",
"var",
"action",
"=",
"actions",
"[",
"index",
"]",
";",
"action",
"(",
"v",
",",
"funct... | chain a sequence of asynchronous actions | [
"chain",
"a",
"sequence",
"of",
"asynchronous",
"actions"
] | 76cc540891421bc6c8bdcf00f277ebb6e716fdd9 | https://github.com/antonycourtney/tabli-core/blob/76cc540891421bc6c8bdcf00f277ebb6e716fdd9/lib/js/utils.js#L56-L72 |
56,295 | stdarg/json-rest-api | index.js | RestApi | function RestApi(config, cb) {
var self = this;
self.routes = {};
self.bindTo = (config && config.bindTo) ? config.bindTo : undefined;
self.port = (config && config.port) ? config.port : DEFAULT_PORT;
// create the HTTP server object and on every request, try to match the
// request with a kno... | javascript | function RestApi(config, cb) {
var self = this;
self.routes = {};
self.bindTo = (config && config.bindTo) ? config.bindTo : undefined;
self.port = (config && config.port) ? config.port : DEFAULT_PORT;
// create the HTTP server object and on every request, try to match the
// request with a kno... | [
"function",
"RestApi",
"(",
"config",
",",
"cb",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"routes",
"=",
"{",
"}",
";",
"self",
".",
"bindTo",
"=",
"(",
"config",
"&&",
"config",
".",
"bindTo",
")",
"?",
"config",
".",
"bindTo",
":... | RestApi constructor. Creates the HTTP server objects and starts listening on
the socket.
@param {Object} [config] An optional configuration object to configure the
RestApi. Possible properties are: port and bindTo to specify the listening
port and the address to bind to. If no port is specified the default is 44401
and... | [
"RestApi",
"constructor",
".",
"Creates",
"the",
"HTTP",
"server",
"objects",
"and",
"starts",
"listening",
"on",
"the",
"socket",
"."
] | 25e47f4d26d9391f6a8a3de37545029130e39d45 | https://github.com/stdarg/json-rest-api/blob/25e47f4d26d9391f6a8a3de37545029130e39d45/index.js#L31-L69 |
56,296 | pierrec/node-atok | lib/rule.js | Rule | function Rule (subrules, type, handler, props, groupProps, encoding) {
var self = this
var n = subrules.length
this.props = props
this.debug = false
// Used for cloning
this.subrules = subrules
// Required by Atok#_resolveRules
for (var p in groupProps)
this[p] = groupProps[p]
// Runtime valu... | javascript | function Rule (subrules, type, handler, props, groupProps, encoding) {
var self = this
var n = subrules.length
this.props = props
this.debug = false
// Used for cloning
this.subrules = subrules
// Required by Atok#_resolveRules
for (var p in groupProps)
this[p] = groupProps[p]
// Runtime valu... | [
"function",
"Rule",
"(",
"subrules",
",",
"type",
",",
"handler",
",",
"props",
",",
"groupProps",
",",
"encoding",
")",
"{",
"var",
"self",
"=",
"this",
"var",
"n",
"=",
"subrules",
".",
"length",
"this",
".",
"props",
"=",
"props",
"this",
".",
"de... | Atok Rule constructor
@param {array} list of subrules
@param {string|number|null} rule type (set if handler is not)
@param {function} rule handler (set if type is not)
@param {Object} atok instance
@constructor
@api private | [
"Atok",
"Rule",
"constructor"
] | abe139e7fa8c092d87e528289b6abd9083df2323 | https://github.com/pierrec/node-atok/blob/abe139e7fa8c092d87e528289b6abd9083df2323/lib/rule.js#L23-L98 |
56,297 | donavon/storeit | lib/Storeit.js | initializeItemSerializer | function initializeItemSerializer(hasItems) {
// Is there is a itemSerializer specified, we MUST use it.
// If existing data and no itemSerializer specified, this is an old JSON database,
// so "fake" the compatible JSON serializer
var providerInfo = storageProvider.getMetadata(namespace... | javascript | function initializeItemSerializer(hasItems) {
// Is there is a itemSerializer specified, we MUST use it.
// If existing data and no itemSerializer specified, this is an old JSON database,
// so "fake" the compatible JSON serializer
var providerInfo = storageProvider.getMetadata(namespace... | [
"function",
"initializeItemSerializer",
"(",
"hasItems",
")",
"{",
"// Is there is a itemSerializer specified, we MUST use it.",
"// If existing data and no itemSerializer specified, this is an old JSON database,",
"// so \"fake\" the compatible JSON serializer",
"var",
"providerInfo",
"=",
... | Read in the base namespace key. | [
"Read",
"in",
"the",
"base",
"namespace",
"key",
"."
] | f896ddd81394626073494c800076272b694d7ec8 | https://github.com/donavon/storeit/blob/f896ddd81394626073494c800076272b694d7ec8/lib/Storeit.js#L211-L219 |
56,298 | react-components/onus | index.js | _yield | function _yield(name, context) {
var prop = this.props[name || 'children'];
if (typeof prop !== 'function') return prop;
var args = Array.prototype.slice.call(arguments, 2);
return prop.apply(context, args);
} | javascript | function _yield(name, context) {
var prop = this.props[name || 'children'];
if (typeof prop !== 'function') return prop;
var args = Array.prototype.slice.call(arguments, 2);
return prop.apply(context, args);
} | [
"function",
"_yield",
"(",
"name",
",",
"context",
")",
"{",
"var",
"prop",
"=",
"this",
".",
"props",
"[",
"name",
"||",
"'children'",
"]",
";",
"if",
"(",
"typeof",
"prop",
"!==",
"'function'",
")",
"return",
"prop",
";",
"var",
"args",
"=",
"Array... | Wrap the yield function | [
"Wrap",
"the",
"yield",
"function"
] | ebe1884a8e70b3ca9d1e95e05c373525f7f5d71b | https://github.com/react-components/onus/blob/ebe1884a8e70b3ca9d1e95e05c373525f7f5d71b/index.js#L238-L244 |
56,299 | ruifortes/json-deref | src/index.js | getJsonResource | function getJsonResource(url) {
var protocol = url.match(/^(.*?):/)
protocol = (protocol && protocol[1]) || 'file'
const defaultLoader = defaultOptions.loaders[protocol]
const loader = options.loaders[protocol]
return Promise.resolve(cache[url])
.then(cached => {
if(cached) {
re... | javascript | function getJsonResource(url) {
var protocol = url.match(/^(.*?):/)
protocol = (protocol && protocol[1]) || 'file'
const defaultLoader = defaultOptions.loaders[protocol]
const loader = options.loaders[protocol]
return Promise.resolve(cache[url])
.then(cached => {
if(cached) {
re... | [
"function",
"getJsonResource",
"(",
"url",
")",
"{",
"var",
"protocol",
"=",
"url",
".",
"match",
"(",
"/",
"^(.*?):",
"/",
")",
"protocol",
"=",
"(",
"protocol",
"&&",
"protocol",
"[",
"1",
"]",
")",
"||",
"'file'",
"const",
"defaultLoader",
"=",
"def... | Gets raw and parsed json from cache
@param {object} url - uri-js object
@param {object} params - ...rest of the json-reference object
@returns {Object}
Returns an object containing raw, parsed and id | [
"Gets",
"raw",
"and",
"parsed",
"json",
"from",
"cache"
] | 1d534d68e5067b3de4bc98080f6e989187a684ca | https://github.com/ruifortes/json-deref/blob/1d534d68e5067b3de4bc98080f6e989187a684ca/src/index.js#L87-L104 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.