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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
38,500 | smagch/simple-lru | simple-lru.js | function () {
var count = 0
, tail = this._tail
, head = this._head
, keys = new Array(this._len);
for (var i = tail; i < head; i++) {
var entry = this._byOrder[i];
if (entry) keys[count++] = entry.key;
}
return keys;
} | javascript | function () {
var count = 0
, tail = this._tail
, head = this._head
, keys = new Array(this._len);
for (var i = tail; i < head; i++) {
var entry = this._byOrder[i];
if (entry) keys[count++] = entry.key;
}
return keys;
} | [
"function",
"(",
")",
"{",
"var",
"count",
"=",
"0",
",",
"tail",
"=",
"this",
".",
"_tail",
",",
"head",
"=",
"this",
".",
"_head",
",",
"keys",
"=",
"new",
"Array",
"(",
"this",
".",
"_len",
")",
";",
"for",
"(",
"var",
"i",
"=",
"tail",
";... | return array of keys in least recently used order
@return {Array} | [
"return",
"array",
"of",
"keys",
"in",
"least",
"recently",
"used",
"order"
] | b32d8e55a190c969419d84669a1228c8705bfca2 | https://github.com/smagch/simple-lru/blob/b32d8e55a190c969419d84669a1228c8705bfca2/simple-lru.js#L234-L246 | |
38,501 | smagch/simple-lru | simple-lru.js | function (entry) {
// update most number to key
if (entry.index !== this._head - 1) {
var isTail = entry.index === this._tail;
delete this._byOrder[entry.index];
entry.index = this._head++;
this._byOrder[entry.index] = entry;
if (isTail) this._shift();
}
} | javascript | function (entry) {
// update most number to key
if (entry.index !== this._head - 1) {
var isTail = entry.index === this._tail;
delete this._byOrder[entry.index];
entry.index = this._head++;
this._byOrder[entry.index] = entry;
if (isTail) this._shift();
}
} | [
"function",
"(",
"entry",
")",
"{",
"// update most number to key",
"if",
"(",
"entry",
".",
"index",
"!==",
"this",
".",
"_head",
"-",
"1",
")",
"{",
"var",
"isTail",
"=",
"entry",
".",
"index",
"===",
"this",
".",
"_tail",
";",
"delete",
"this",
".",... | update least recently used index of an entry to "_head"
@param {Entry}
@api private | [
"update",
"least",
"recently",
"used",
"index",
"of",
"an",
"entry",
"to",
"_head"
] | b32d8e55a190c969419d84669a1228c8705bfca2 | https://github.com/smagch/simple-lru/blob/b32d8e55a190c969419d84669a1228c8705bfca2/simple-lru.js#L254-L263 | |
38,502 | smagch/simple-lru | simple-lru.js | function () {
var tail = this._tail
, head = this._head;
for (var i = tail; i < head; i++) {
var entry = this._byOrder[i];
if (entry) {
this._tail = i;
return entry;
}
}
} | javascript | function () {
var tail = this._tail
, head = this._head;
for (var i = tail; i < head; i++) {
var entry = this._byOrder[i];
if (entry) {
this._tail = i;
return entry;
}
}
} | [
"function",
"(",
")",
"{",
"var",
"tail",
"=",
"this",
".",
"_tail",
",",
"head",
"=",
"this",
".",
"_head",
";",
"for",
"(",
"var",
"i",
"=",
"tail",
";",
"i",
"<",
"head",
";",
"i",
"++",
")",
"{",
"var",
"entry",
"=",
"this",
".",
"_byOrde... | update tail index
@return {Entry|undefined}
@api private | [
"update",
"tail",
"index"
] | b32d8e55a190c969419d84669a1228c8705bfca2 | https://github.com/smagch/simple-lru/blob/b32d8e55a190c969419d84669a1228c8705bfca2/simple-lru.js#L282-L292 | |
38,503 | smagch/simple-lru | simple-lru.js | function () {
var tail = this._tail
, head = this._head;
for (var i = head - 1; i >= tail; i--) {
var headEntry = this._byOrder[i];
if (headEntry) {
this._head = i + 1;
return headEntry;
}
}
} | javascript | function () {
var tail = this._tail
, head = this._head;
for (var i = head - 1; i >= tail; i--) {
var headEntry = this._byOrder[i];
if (headEntry) {
this._head = i + 1;
return headEntry;
}
}
} | [
"function",
"(",
")",
"{",
"var",
"tail",
"=",
"this",
".",
"_tail",
",",
"head",
"=",
"this",
".",
"_head",
";",
"for",
"(",
"var",
"i",
"=",
"head",
"-",
"1",
";",
"i",
">=",
"tail",
";",
"i",
"--",
")",
"{",
"var",
"headEntry",
"=",
"this"... | update head index
@return {Entry|undefined}
@api private | [
"update",
"head",
"index"
] | b32d8e55a190c969419d84669a1228c8705bfca2 | https://github.com/smagch/simple-lru/blob/b32d8e55a190c969419d84669a1228c8705bfca2/simple-lru.js#L299-L309 | |
38,504 | futjs/fut-api | src/lib/mobile-login.js | generateMachineKey | async function generateMachineKey () {
let parts = await Promise.all([
randomHex(8),
randomHex(4),
randomHex(4),
randomHex(4),
randomHex(12)
])
return `${parts[0]}-${parts[1]}-${parts[2]}-${parts[3]}-${parts[4]}`
} | javascript | async function generateMachineKey () {
let parts = await Promise.all([
randomHex(8),
randomHex(4),
randomHex(4),
randomHex(4),
randomHex(12)
])
return `${parts[0]}-${parts[1]}-${parts[2]}-${parts[3]}-${parts[4]}`
} | [
"async",
"function",
"generateMachineKey",
"(",
")",
"{",
"let",
"parts",
"=",
"await",
"Promise",
".",
"all",
"(",
"[",
"randomHex",
"(",
"8",
")",
",",
"randomHex",
"(",
"4",
")",
",",
"randomHex",
"(",
"4",
")",
",",
"randomHex",
"(",
"4",
")",
... | example EEA58055-E4E8-42E6-B89D-DFFBBD37AF57 | [
"example",
"EEA58055",
"-",
"E4E8",
"-",
"42E6",
"-",
"B89D",
"-",
"DFFBBD37AF57"
] | a26d3dfa93d62b4dd4755cb57b956c503182abc3 | https://github.com/futjs/fut-api/blob/a26d3dfa93d62b4dd4755cb57b956c503182abc3/src/lib/mobile-login.js#L360-L369 |
38,505 | imbo/imboclient-js | lib/browser/crypto.js | function() {
if (typeof window.Worker === 'undefined' || typeof window.URL === 'undefined') {
return false;
}
try {
/* eslint-disable no-new */
new Worker(window.URL.createObjectURL(
new Blob([''], { type: 'text/javascript' })
));
/* eslint-enable no-new ... | javascript | function() {
if (typeof window.Worker === 'undefined' || typeof window.URL === 'undefined') {
return false;
}
try {
/* eslint-disable no-new */
new Worker(window.URL.createObjectURL(
new Blob([''], { type: 'text/javascript' })
));
/* eslint-enable no-new ... | [
"function",
"(",
")",
"{",
"if",
"(",
"typeof",
"window",
".",
"Worker",
"===",
"'undefined'",
"||",
"typeof",
"window",
".",
"URL",
"===",
"'undefined'",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"/* eslint-disable no-new */",
"new",
"Worker",
"(... | Checks if webworkers are supported
@return {Boolean} | [
"Checks",
"if",
"webworkers",
"are",
"supported"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/browser/crypto.js#L16-L32 | |
38,506 | imbo/imboclient-js | lib/browser/crypto.js | function(buffer, callback) {
if (supportsWorkers) {
// We have a worker queue, push an item into it and start processing
workerQueue.push({ buffer: buffer, callback: callback });
nextMd5Task();
} else {
// We don't have any Web Worker support,
// queue an MD5 operation on... | javascript | function(buffer, callback) {
if (supportsWorkers) {
// We have a worker queue, push an item into it and start processing
workerQueue.push({ buffer: buffer, callback: callback });
nextMd5Task();
} else {
// We don't have any Web Worker support,
// queue an MD5 operation on... | [
"function",
"(",
"buffer",
",",
"callback",
")",
"{",
"if",
"(",
"supportsWorkers",
")",
"{",
"// We have a worker queue, push an item into it and start processing",
"workerQueue",
".",
"push",
"(",
"{",
"buffer",
":",
"buffer",
",",
"callback",
":",
"callback",
"}"... | Add a new MD5 task to the queue
@param {ArrayBuffer} buffer - Buffer containing the file data
@param {Function} callback - Callback to run when the MD5 task has been completed | [
"Add",
"a",
"new",
"MD5",
"task",
"to",
"the",
"queue"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/browser/crypto.js#L64-L76 | |
38,507 | imbo/imboclient-js | lib/browser/crypto.js | function(key, data) {
var shaObj = new Sha('SHA-256', 'TEXT');
shaObj.setHMACKey(key, 'TEXT');
shaObj.update(data);
return shaObj.getHMAC('HEX');
} | javascript | function(key, data) {
var shaObj = new Sha('SHA-256', 'TEXT');
shaObj.setHMACKey(key, 'TEXT');
shaObj.update(data);
return shaObj.getHMAC('HEX');
} | [
"function",
"(",
"key",
",",
"data",
")",
"{",
"var",
"shaObj",
"=",
"new",
"Sha",
"(",
"'SHA-256'",
",",
"'TEXT'",
")",
";",
"shaObj",
".",
"setHMACKey",
"(",
"key",
",",
"'TEXT'",
")",
";",
"shaObj",
".",
"update",
"(",
"data",
")",
";",
"return"... | Generate a SHA256 HMAC hash from the given data
@param {String} key
@param {String} data
@return {String} | [
"Generate",
"a",
"SHA256",
"HMAC",
"hash",
"from",
"the",
"given",
"data"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/browser/crypto.js#L98-L103 | |
38,508 | imbo/imboclient-js | lib/browser/crypto.js | function(buffer, callback, options) {
if (options && options.type === 'url') {
readers.getContentsFromUrl(buffer, function(err, data) {
if (err) {
return callback(err);
}
module.exports.md5(data, callback, { binary: true });
... | javascript | function(buffer, callback, options) {
if (options && options.type === 'url') {
readers.getContentsFromUrl(buffer, function(err, data) {
if (err) {
return callback(err);
}
module.exports.md5(data, callback, { binary: true });
... | [
"function",
"(",
"buffer",
",",
"callback",
",",
"options",
")",
"{",
"if",
"(",
"options",
"&&",
"options",
".",
"type",
"===",
"'url'",
")",
"{",
"readers",
".",
"getContentsFromUrl",
"(",
"buffer",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",... | Generate an MD5-sum of the given ArrayBuffer
@param {ArrayBuffer} buffer
@param {Function} callback
@param {Object} [options] | [
"Generate",
"an",
"MD5",
"-",
"sum",
"of",
"the",
"given",
"ArrayBuffer"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/browser/crypto.js#L112-L135 | |
38,509 | generate/generate-contributing | generator.js | template | function template(pattern) {
return app.src(pattern, { cwd: path.join(__dirname, 'templates') })
.pipe(app.renderFile('*')).on('error', console.error)
.pipe(app.conflicts(app.cwd))
.pipe(app.dest(app.options.dest || app.cwd));
} | javascript | function template(pattern) {
return app.src(pattern, { cwd: path.join(__dirname, 'templates') })
.pipe(app.renderFile('*')).on('error', console.error)
.pipe(app.conflicts(app.cwd))
.pipe(app.dest(app.options.dest || app.cwd));
} | [
"function",
"template",
"(",
"pattern",
")",
"{",
"return",
"app",
".",
"src",
"(",
"pattern",
",",
"{",
"cwd",
":",
"path",
".",
"join",
"(",
"__dirname",
",",
"'templates'",
")",
"}",
")",
".",
"pipe",
"(",
"app",
".",
"renderFile",
"(",
"'*'",
"... | Generate a file from the template that matches the given `pattern` | [
"Generate",
"a",
"file",
"from",
"the",
"template",
"that",
"matches",
"the",
"given",
"pattern"
] | e9becbfd164ede91246446200039cf6661d8ae1e | https://github.com/generate/generate-contributing/blob/e9becbfd164ede91246446200039cf6661d8ae1e/generator.js#L117-L122 |
38,510 | angie-framework/angie | src/factories/$Compile.js | $$safeEvalFn | function $$safeEvalFn(str) {
let keyStr = '';
// Perform any parsing that needs to be performed on the scope value
for (let key in this) {
let val = this[ key ];
if (!val && val !== 0 && val !== '') {
continue;
} else if (
typeof val === 'symbol' ||
... | javascript | function $$safeEvalFn(str) {
let keyStr = '';
// Perform any parsing that needs to be performed on the scope value
for (let key in this) {
let val = this[ key ];
if (!val && val !== 0 && val !== '') {
continue;
} else if (
typeof val === 'symbol' ||
... | [
"function",
"$$safeEvalFn",
"(",
"str",
")",
"{",
"let",
"keyStr",
"=",
"''",
";",
"// Perform any parsing that needs to be performed on the scope value",
"for",
"(",
"let",
"key",
"in",
"this",
")",
"{",
"let",
"val",
"=",
"this",
"[",
"key",
"]",
";",
"if",
... | A private function to evaluate the parsed template string in the context of `scope` | [
"A",
"private",
"function",
"to",
"evaluate",
"the",
"parsed",
"template",
"string",
"in",
"the",
"context",
"of",
"scope"
] | 7d0793f6125e60e0473b17ffd40305d6d6fdbc12 | https://github.com/angie-framework/angie/blob/7d0793f6125e60e0473b17ffd40305d6d6fdbc12/src/factories/$Compile.js#L255-L281 |
38,511 | Ubudu/uBeacon-uart-lib | node/examples/mesh-remote-management.js | function(callback){
var msg = ubeacon.getCommandString( false, ubeacon.uartCmd.led, new Buffer('03','hex') , false );
ubeacon.sendMeshRemoteManagementMessage( program.destinationAddress, msg.toString(), null);
setTimeout(callback, 2000);
} | javascript | function(callback){
var msg = ubeacon.getCommandString( false, ubeacon.uartCmd.led, new Buffer('03','hex') , false );
ubeacon.sendMeshRemoteManagementMessage( program.destinationAddress, msg.toString(), null);
setTimeout(callback, 2000);
} | [
"function",
"(",
"callback",
")",
"{",
"var",
"msg",
"=",
"ubeacon",
".",
"getCommandString",
"(",
"false",
",",
"ubeacon",
".",
"uartCmd",
".",
"led",
",",
"new",
"Buffer",
"(",
"'03'",
",",
"'hex'",
")",
",",
"false",
")",
";",
"ubeacon",
".",
"sen... | Build LED-on message and send it | [
"Build",
"LED",
"-",
"on",
"message",
"and",
"send",
"it"
] | a7436f3491f61ffabb34e2bc3b2441cc048f5dfa | https://github.com/Ubudu/uBeacon-uart-lib/blob/a7436f3491f61ffabb34e2bc3b2441cc048f5dfa/node/examples/mesh-remote-management.js#L31-L35 | |
38,512 | imbo/imboclient-js | examples/browser/resources/browser-demo.js | function(org) {
var url = decodeURIComponent(org.toString());
urlOutput.empty().attr('href', url);
url = url.replace(/.*?\/users\//g, '/users/');
url = url.replace(/Token=(.{10}).*/g, 'Token=$1...');
var parts = url.split('?'), param;
var params = parts[1].replace(/t\[\... | javascript | function(org) {
var url = decodeURIComponent(org.toString());
urlOutput.empty().attr('href', url);
url = url.replace(/.*?\/users\//g, '/users/');
url = url.replace(/Token=(.{10}).*/g, 'Token=$1...');
var parts = url.split('?'), param;
var params = parts[1].replace(/t\[\... | [
"function",
"(",
"org",
")",
"{",
"var",
"url",
"=",
"decodeURIComponent",
"(",
"org",
".",
"toString",
"(",
")",
")",
";",
"urlOutput",
".",
"empty",
"(",
")",
".",
"attr",
"(",
"'href'",
",",
"url",
")",
";",
"url",
"=",
"url",
".",
"replace",
... | Demonstrating the URL helper | [
"Demonstrating",
"the",
"URL",
"helper"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/examples/browser/resources/browser-demo.js#L67-L105 | |
38,513 | imbo/imboclient-js | examples/browser/resources/browser-demo.js | function(err, imageIdentifier, res) {
// Remove progress bar
bar.css('width', '100%');
progress.animate({ opacity: 0}, {
duration: 1000,
complete: function() {
$(this).remove();
}
});
// Check for any XHR errors (200 means imag... | javascript | function(err, imageIdentifier, res) {
// Remove progress bar
bar.css('width', '100%');
progress.animate({ opacity: 0}, {
duration: 1000,
complete: function() {
$(this).remove();
}
});
// Check for any XHR errors (200 means imag... | [
"function",
"(",
"err",
",",
"imageIdentifier",
",",
"res",
")",
"{",
"// Remove progress bar",
"bar",
".",
"css",
"(",
"'width'",
",",
"'100%'",
")",
";",
"progress",
".",
"animate",
"(",
"{",
"opacity",
":",
"0",
"}",
",",
"{",
"duration",
":",
"1000... | Callback for when the image is uploaded | [
"Callback",
"for",
"when",
"the",
"image",
"is",
"uploaded"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/examples/browser/resources/browser-demo.js#L108-L159 | |
38,514 | aefty/wireframe | lib/wireframe.js | function(data, callback) {
var set = _assembleTask(data, workFlow[meth][url].merg);
if (set.err) throw new Error('Invalid workflow: ' + set.tasks);
async.series(set.tasks, function(err, results) {
return callback(err, {
'sync': data.sync,
'async': data.async,
'merg': results
});
});
} | javascript | function(data, callback) {
var set = _assembleTask(data, workFlow[meth][url].merg);
if (set.err) throw new Error('Invalid workflow: ' + set.tasks);
async.series(set.tasks, function(err, results) {
return callback(err, {
'sync': data.sync,
'async': data.async,
'merg': results
});
});
} | [
"function",
"(",
"data",
",",
"callback",
")",
"{",
"var",
"set",
"=",
"_assembleTask",
"(",
"data",
",",
"workFlow",
"[",
"meth",
"]",
"[",
"url",
"]",
".",
"merg",
")",
";",
"if",
"(",
"set",
".",
"err",
")",
"throw",
"new",
"Error",
"(",
"'Inv... | Merg - Parallel process
@param {Object} data - return values of sync and async
@param {Function} callback | [
"Merg",
"-",
"Parallel",
"process"
] | 18b894fdf2591f390040a365b836fea87760332a | https://github.com/aefty/wireframe/blob/18b894fdf2591f390040a365b836fea87760332a/lib/wireframe.js#L54-L64 | |
38,515 | visionmedia/connect-render | lib/render.js | render | function render(view, options) {
var self = this;
options = options || {};
for (var name in settings._filters) {
options[name] = settings._filters[name];
}
if (settings.helpers) {
for (var k in settings.helpers) {
var helper = settings.helpers[k];
if (typeof helper === 'function') {
... | javascript | function render(view, options) {
var self = this;
options = options || {};
for (var name in settings._filters) {
options[name] = settings._filters[name];
}
if (settings.helpers) {
for (var k in settings.helpers) {
var helper = settings.helpers[k];
if (typeof helper === 'function') {
... | [
"function",
"render",
"(",
"view",
",",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"for",
"(",
"var",
"name",
"in",
"settings",
".",
"_filters",
")",
"{",
"options",
"[",
"name",
"]",
"=",
... | Render the view fill with options
@param {String} view, view name.
@param {Object} [options=null]
- {Boolean} layout, use layout or not, default is `true`.
@return {HttpServerResponse} this | [
"Render",
"the",
"view",
"fill",
"with",
"options"
] | bbd3b562aaafb8c3f3b0c536508db3fc2568e3ce | https://github.com/visionmedia/connect-render/blob/bbd3b562aaafb8c3f3b0c536508db3fc2568e3ce/lib/render.js#L123-L172 |
38,516 | imbo/imboclient-js | gulpfile.js | browserSpecific | function browserSpecific() {
var data = '';
return through(
function(buf) {
data += buf;
},
function() {
this.queue(data.replace(/\.\/node\//g, './browser/'));
this.queue(null);
}
);
} | javascript | function browserSpecific() {
var data = '';
return through(
function(buf) {
data += buf;
},
function() {
this.queue(data.replace(/\.\/node\//g, './browser/'));
this.queue(null);
}
);
} | [
"function",
"browserSpecific",
"(",
")",
"{",
"var",
"data",
"=",
"''",
";",
"return",
"through",
"(",
"function",
"(",
"buf",
")",
"{",
"data",
"+=",
"buf",
";",
"}",
",",
"function",
"(",
")",
"{",
"this",
".",
"queue",
"(",
"data",
".",
"replace... | Replace node-specific components with browser-specific ones | [
"Replace",
"node",
"-",
"specific",
"components",
"with",
"browser",
"-",
"specific",
"ones"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/gulpfile.js#L23-L34 |
38,517 | getlackey/mongoose-ref-validator | lib/index.js | setMiddleware | function setMiddleware(Model, modelName, path) {
var RefModel;
// We only apply the middleware on the provided
// paths in the plugin options.
if (opts.onDeleteRestrict.indexOf(path) === -1) {
return;
}
RefModel = models[modelName];
RefModel.schema.... | javascript | function setMiddleware(Model, modelName, path) {
var RefModel;
// We only apply the middleware on the provided
// paths in the plugin options.
if (opts.onDeleteRestrict.indexOf(path) === -1) {
return;
}
RefModel = models[modelName];
RefModel.schema.... | [
"function",
"setMiddleware",
"(",
"Model",
",",
"modelName",
",",
"path",
")",
"{",
"var",
"RefModel",
";",
"// We only apply the middleware on the provided ",
"// paths in the plugin options.",
"if",
"(",
"opts",
".",
"onDeleteRestrict",
".",
"indexOf",
"(",
"path",
... | Sets middleware on the referenced models
@param {object} Model - The current model, where this plugin is running
@param {string} modelName - the model that is being referenced
@param {string} path - the property with the reference | [
"Sets",
"middleware",
"on",
"the",
"referenced",
"models"
] | e21ac9c19d07b908991de8c8a295ebe1ca176b08 | https://github.com/getlackey/mongoose-ref-validator/blob/e21ac9c19d07b908991de8c8a295ebe1ca176b08/lib/index.js#L81-L107 |
38,518 | seykron/json-index | lib/EntryIterator.js | function (start, end, force) {
var bytesRead;
if (end - start > config.bufferSize) {
return reject(new Error("Range exceeds the max buffer size"));
}
if (force || start < currentRange.start || (start > currentRange.end)) {
bytesRead = fs.readSync(fd, buffer, 0, config.bufferSize, start);
... | javascript | function (start, end, force) {
var bytesRead;
if (end - start > config.bufferSize) {
return reject(new Error("Range exceeds the max buffer size"));
}
if (force || start < currentRange.start || (start > currentRange.end)) {
bytesRead = fs.readSync(fd, buffer, 0, config.bufferSize, start);
... | [
"function",
"(",
"start",
",",
"end",
",",
"force",
")",
"{",
"var",
"bytesRead",
";",
"if",
"(",
"end",
"-",
"start",
">",
"config",
".",
"bufferSize",
")",
"{",
"return",
"reject",
"(",
"new",
"Error",
"(",
"\"Range exceeds the max buffer size\"",
")",
... | Synchrounously updates the cache with a new range of data if the required
range is not within the current cache.
@param {Number} start Start position of the required range. Cannot be null.
@param {Number} end End position of the required range. Cannot be null.
@param {Boolean} force Indicates whether to force the cache... | [
"Synchrounously",
"updates",
"the",
"cache",
"with",
"a",
"new",
"range",
"of",
"data",
"if",
"the",
"required",
"range",
"is",
"not",
"within",
"the",
"current",
"cache",
"."
] | b7f354197fc7129749032695e244f58954aa921d | https://github.com/seykron/json-index/blob/b7f354197fc7129749032695e244f58954aa921d/lib/EntryIterator.js#L29-L41 | |
38,519 | seykron/json-index | lib/EntryIterator.js | function (start, end) {
var offsetStart;
var offsetEnd;
loadBufferIfRequired(start, end);
offsetStart = start - currentRange.start;
offsetEnd = offsetStart + (end - start);
return buffer.slice(offsetStart, offsetEnd);
} | javascript | function (start, end) {
var offsetStart;
var offsetEnd;
loadBufferIfRequired(start, end);
offsetStart = start - currentRange.start;
offsetEnd = offsetStart + (end - start);
return buffer.slice(offsetStart, offsetEnd);
} | [
"function",
"(",
"start",
",",
"end",
")",
"{",
"var",
"offsetStart",
";",
"var",
"offsetEnd",
";",
"loadBufferIfRequired",
"(",
"start",
",",
"end",
")",
";",
"offsetStart",
"=",
"start",
"-",
"currentRange",
".",
"start",
";",
"offsetEnd",
"=",
"offsetSt... | Reads data range from the file into the buffer.
@param {Number} start Absolute start position. Cannot be null.
@param {Number} end Absolute end position. Cannot be null. | [
"Reads",
"data",
"range",
"from",
"the",
"file",
"into",
"the",
"buffer",
"."
] | b7f354197fc7129749032695e244f58954aa921d | https://github.com/seykron/json-index/blob/b7f354197fc7129749032695e244f58954aa921d/lib/EntryIterator.js#L47-L57 | |
38,520 | seykron/json-index | lib/EntryIterator.js | function (index) {
var rawItem;
var position = positions[index];
try {
rawItem = readEntry(position.start, position.end);
return JSON.parse(rawItem);
} catch (ex) {
debug("ERROR reading item: %s -> %s", ex, rawItem);
}
} | javascript | function (index) {
var rawItem;
var position = positions[index];
try {
rawItem = readEntry(position.start, position.end);
return JSON.parse(rawItem);
} catch (ex) {
debug("ERROR reading item: %s -> %s", ex, rawItem);
}
} | [
"function",
"(",
"index",
")",
"{",
"var",
"rawItem",
";",
"var",
"position",
"=",
"positions",
"[",
"index",
"]",
";",
"try",
"{",
"rawItem",
"=",
"readEntry",
"(",
"position",
".",
"start",
",",
"position",
".",
"end",
")",
";",
"return",
"JSON",
"... | Lazily retrives an item with the specified index.
@param {Number} index Required item index. Cannot be null. | [
"Lazily",
"retrives",
"an",
"item",
"with",
"the",
"specified",
"index",
"."
] | b7f354197fc7129749032695e244f58954aa921d | https://github.com/seykron/json-index/blob/b7f354197fc7129749032695e244f58954aa921d/lib/EntryIterator.js#L62-L72 | |
38,521 | rootsdev/gedcomx-js | src/atom/AtomContent.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof AtomContent)){
return new AtomContent(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(AtomContent.isInstance(json)){
ret... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof AtomContent)){
return new AtomContent(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(AtomContent.isInstance(json)){
ret... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"AtomContent",
")",
")",
"{",
"return",
"new",
"AtomContent",
"(",
"json",
")",
";",
"}",
"// If the given objec... | The content of an entry.
@see {@link https://github.com/FamilySearch/gedcomx-rs/blob/master/specifications/atom-model-specification.md#atom-json-media-type|GEDCOM X Atom JSON Spec}
@see {@link https://tools.ietf.org/html/rfc4287#section-4.1.3|RFC 4287}
@class AtomContent
@extends AtomCommon
@param {Object} [json] | [
"The",
"content",
"of",
"an",
"entry",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/atom/AtomContent.js#L16-L29 | |
38,522 | oipwg/oip-index | src/util.js | isValidWIF | function isValidWIF (key, network) {
try {
let dec = wif.decode(key);
if (network) {
return dec.version === network.wif
} else {
return true
}
} catch (e) {
console.error(e);
return false
}
} | javascript | function isValidWIF (key, network) {
try {
let dec = wif.decode(key);
if (network) {
return dec.version === network.wif
} else {
return true
}
} catch (e) {
console.error(e);
return false
}
} | [
"function",
"isValidWIF",
"(",
"key",
",",
"network",
")",
"{",
"try",
"{",
"let",
"dec",
"=",
"wif",
".",
"decode",
"(",
"key",
")",
";",
"if",
"(",
"network",
")",
"{",
"return",
"dec",
".",
"version",
"===",
"network",
".",
"wif",
"}",
"else",
... | Check if a WIF is valid for a specific CoinNetwork
@param {string} key - Base58 WIF Private Key
@param {CoinNetwork} network
@return {Boolean} | [
"Check",
"if",
"a",
"WIF",
"is",
"valid",
"for",
"a",
"specific",
"CoinNetwork"
] | 155d4883d8e2ac144f99c615ef476ae9f6cf288f | https://github.com/oipwg/oip-index/blob/155d4883d8e2ac144f99c615ef476ae9f6cf288f/src/util.js#L10-L23 |
38,523 | KapIT/observe-shim | lib/observe-shim.js | _cleanObserver | function _cleanObserver(observer) {
if (!attachedNotifierCountMap.get(observer) && !pendingChangesMap.has(observer)) {
attachedNotifierCountMap.delete(observer);
var index = observerCallbacks.indexOf(observer);
if (index !== -1) {
observerCallbacks.splice(inde... | javascript | function _cleanObserver(observer) {
if (!attachedNotifierCountMap.get(observer) && !pendingChangesMap.has(observer)) {
attachedNotifierCountMap.delete(observer);
var index = observerCallbacks.indexOf(observer);
if (index !== -1) {
observerCallbacks.splice(inde... | [
"function",
"_cleanObserver",
"(",
"observer",
")",
"{",
"if",
"(",
"!",
"attachedNotifierCountMap",
".",
"get",
"(",
"observer",
")",
"&&",
"!",
"pendingChangesMap",
".",
"has",
"(",
"observer",
")",
")",
"{",
"attachedNotifierCountMap",
".",
"delete",
"(",
... | Remove reference all reference to an observer callback, if this one is not used anymore. In the proposal the ObserverCallBack has a weak reference over observers, Without this possibility we need to clean this list to avoid memory leak | [
"Remove",
"reference",
"all",
"reference",
"to",
"an",
"observer",
"callback",
"if",
"this",
"one",
"is",
"not",
"used",
"anymore",
".",
"In",
"the",
"proposal",
"the",
"ObserverCallBack",
"has",
"a",
"weak",
"reference",
"over",
"observers",
"Without",
"this"... | 75e8ea887c38bd1540fe4989a17b6e3751d7c7e5 | https://github.com/KapIT/observe-shim/blob/75e8ea887c38bd1540fe4989a17b6e3751d7c7e5/lib/observe-shim.js#L343-L351 |
38,524 | rackerlabs/zk-ultralight | ultralight.js | function(callback) {
if (self._cxnState !== self.cxnStates.CONNECTED) {
callback(new Error("(2) Error occurred while attempting to lock "+ name));
return;
}
try {
// client doesn't like paths ending in /, so chop it off if lockpath != '/'
self._zk.mkdirp(l... | javascript | function(callback) {
if (self._cxnState !== self.cxnStates.CONNECTED) {
callback(new Error("(2) Error occurred while attempting to lock "+ name));
return;
}
try {
// client doesn't like paths ending in /, so chop it off if lockpath != '/'
self._zk.mkdirp(l... | [
"function",
"(",
"callback",
")",
"{",
"if",
"(",
"self",
".",
"_cxnState",
"!==",
"self",
".",
"cxnStates",
".",
"CONNECTED",
")",
"{",
"callback",
"(",
"new",
"Error",
"(",
"\"(2) Error occurred while attempting to lock \"",
"+",
"name",
")",
")",
";",
"re... | ensure the parent path exists | [
"ensure",
"the",
"parent",
"path",
"exists"
] | 5295f0a891df42e7fafab7442461c6fe9a8538d0 | https://github.com/rackerlabs/zk-ultralight/blob/5295f0a891df42e7fafab7442461c6fe9a8538d0/ultralight.js#L267-L278 | |
38,525 | savjs/sav-flux | examples/flux-todo-riot/bundle.js | $$ | function $$(selector, ctx) {
return Array.prototype.slice.call((ctx || document).querySelectorAll(selector))
} | javascript | function $$(selector, ctx) {
return Array.prototype.slice.call((ctx || document).querySelectorAll(selector))
} | [
"function",
"$$",
"(",
"selector",
",",
"ctx",
")",
"{",
"return",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"(",
"ctx",
"||",
"document",
")",
".",
"querySelectorAll",
"(",
"selector",
")",
")",
"}"
] | Shorter and fast way to select multiple nodes in the DOM
@param { String } selector - DOM selector
@param { Object } ctx - DOM node where the targets of our search will is located
@returns { Object } dom nodes found | [
"Shorter",
"and",
"fast",
"way",
"to",
"select",
"multiple",
"nodes",
"in",
"the",
"DOM"
] | d8f547a04467c8e3e2524bde95db0b7218b98be2 | https://github.com/savjs/sav-flux/blob/d8f547a04467c8e3e2524bde95db0b7218b98be2/examples/flux-todo-riot/bundle.js#L1416-L1418 |
38,526 | savjs/sav-flux | examples/flux-todo-riot/bundle.js | toggleVisibility | function toggleVisibility(dom, show) {
dom.style.display = show ? '' : 'none';
dom['hidden'] = show ? false : true;
} | javascript | function toggleVisibility(dom, show) {
dom.style.display = show ? '' : 'none';
dom['hidden'] = show ? false : true;
} | [
"function",
"toggleVisibility",
"(",
"dom",
",",
"show",
")",
"{",
"dom",
".",
"style",
".",
"display",
"=",
"show",
"?",
"''",
":",
"'none'",
";",
"dom",
"[",
"'hidden'",
"]",
"=",
"show",
"?",
"false",
":",
"true",
";",
"}"
] | Toggle the visibility of any DOM node
@param { Object } dom - DOM node we want to hide
@param { Boolean } show - do we want to show it? | [
"Toggle",
"the",
"visibility",
"of",
"any",
"DOM",
"node"
] | d8f547a04467c8e3e2524bde95db0b7218b98be2 | https://github.com/savjs/sav-flux/blob/d8f547a04467c8e3e2524bde95db0b7218b98be2/examples/flux-todo-riot/bundle.js#L1488-L1491 |
38,527 | savjs/sav-flux | examples/flux-todo-riot/bundle.js | setAttr | function setAttr(dom, name, val) {
var xlink = XLINK_REGEX.exec(name);
if (xlink && xlink[1])
{ dom.setAttributeNS(XLINK_NS, xlink[1], val); }
else
{ dom.setAttribute(name, val); }
} | javascript | function setAttr(dom, name, val) {
var xlink = XLINK_REGEX.exec(name);
if (xlink && xlink[1])
{ dom.setAttributeNS(XLINK_NS, xlink[1], val); }
else
{ dom.setAttribute(name, val); }
} | [
"function",
"setAttr",
"(",
"dom",
",",
"name",
",",
"val",
")",
"{",
"var",
"xlink",
"=",
"XLINK_REGEX",
".",
"exec",
"(",
"name",
")",
";",
"if",
"(",
"xlink",
"&&",
"xlink",
"[",
"1",
"]",
")",
"{",
"dom",
".",
"setAttributeNS",
"(",
"XLINK_NS",... | Set any DOM attribute
@param { Object } dom - DOM node we want to update
@param { String } name - name of the property we want to set
@param { String } val - value of the property we want to set | [
"Set",
"any",
"DOM",
"attribute"
] | d8f547a04467c8e3e2524bde95db0b7218b98be2 | https://github.com/savjs/sav-flux/blob/d8f547a04467c8e3e2524bde95db0b7218b98be2/examples/flux-todo-riot/bundle.js#L1531-L1537 |
38,528 | savjs/sav-flux | examples/flux-todo-riot/bundle.js | defineProperty | function defineProperty(el, key, value, options) {
Object.defineProperty(el, key, extend({
value: value,
enumerable: false,
writable: false,
configurable: true
}, options));
return el
} | javascript | function defineProperty(el, key, value, options) {
Object.defineProperty(el, key, extend({
value: value,
enumerable: false,
writable: false,
configurable: true
}, options));
return el
} | [
"function",
"defineProperty",
"(",
"el",
",",
"key",
",",
"value",
",",
"options",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"el",
",",
"key",
",",
"extend",
"(",
"{",
"value",
":",
"value",
",",
"enumerable",
":",
"false",
",",
"writable",
":",
... | Helper function to set an immutable property
@param { Object } el - object where the new property will be set
@param { String } key - object key where the new property will be stored
@param { * } value - value of the new property
@param { Object } options - set the propery overriding the default options
@return... | [
"Helper",
"function",
"to",
"set",
"an",
"immutable",
"property"
] | d8f547a04467c8e3e2524bde95db0b7218b98be2 | https://github.com/savjs/sav-flux/blob/d8f547a04467c8e3e2524bde95db0b7218b98be2/examples/flux-todo-riot/bundle.js#L2377-L2385 |
38,529 | savjs/sav-flux | examples/flux-todo-riot/bundle.js | handleEvent | function handleEvent(dom, handler, e) {
var ptag = this.__.parent,
item = this.__.item;
if (!item)
{ while (ptag && !item) {
item = ptag.__.item;
ptag = ptag.__.parent;
} }
// override the event properties
/* istanbul ignore next */
if (isWritable(e, 'currentTarget')) { e.currentTarg... | javascript | function handleEvent(dom, handler, e) {
var ptag = this.__.parent,
item = this.__.item;
if (!item)
{ while (ptag && !item) {
item = ptag.__.item;
ptag = ptag.__.parent;
} }
// override the event properties
/* istanbul ignore next */
if (isWritable(e, 'currentTarget')) { e.currentTarg... | [
"function",
"handleEvent",
"(",
"dom",
",",
"handler",
",",
"e",
")",
"{",
"var",
"ptag",
"=",
"this",
".",
"__",
".",
"parent",
",",
"item",
"=",
"this",
".",
"__",
".",
"item",
";",
"if",
"(",
"!",
"item",
")",
"{",
"while",
"(",
"ptag",
"&&"... | Trigger DOM events
@param { HTMLElement } dom - dom element target of the event
@param { Function } handler - user function
@param { Object } e - event object | [
"Trigger",
"DOM",
"events"
] | d8f547a04467c8e3e2524bde95db0b7218b98be2 | https://github.com/savjs/sav-flux/blob/d8f547a04467c8e3e2524bde95db0b7218b98be2/examples/flux-todo-riot/bundle.js#L2432-L2462 |
38,530 | savjs/sav-flux | examples/flux-todo-riot/bundle.js | inheritFrom | function inheritFrom(target, propsInSyncWithParent) {
var this$1 = this;
each(Object.keys(target), function (k) {
// some properties must be always in sync with the parent tag
var mustSync = !isReservedName(k) && contains(propsInSyncWithParent, k);
if (isUndefined(this$1[k]) || mustSync) {
// tr... | javascript | function inheritFrom(target, propsInSyncWithParent) {
var this$1 = this;
each(Object.keys(target), function (k) {
// some properties must be always in sync with the parent tag
var mustSync = !isReservedName(k) && contains(propsInSyncWithParent, k);
if (isUndefined(this$1[k]) || mustSync) {
// tr... | [
"function",
"inheritFrom",
"(",
"target",
",",
"propsInSyncWithParent",
")",
"{",
"var",
"this$1",
"=",
"this",
";",
"each",
"(",
"Object",
".",
"keys",
"(",
"target",
")",
",",
"function",
"(",
"k",
")",
"{",
"// some properties must be always in sync with the ... | Inherit properties from a target tag instance
@this Tag
@param { Tag } target - tag where we will inherit properties
@param { Array } propsInSyncWithParent - array of properties to sync with the target | [
"Inherit",
"properties",
"from",
"a",
"target",
"tag",
"instance"
] | d8f547a04467c8e3e2524bde95db0b7218b98be2 | https://github.com/savjs/sav-flux/blob/d8f547a04467c8e3e2524bde95db0b7218b98be2/examples/flux-todo-riot/bundle.js#L3804-L3818 |
38,531 | savjs/sav-flux | examples/flux-todo-riot/bundle.js | unmountAll | function unmountAll(expressions) {
each(expressions, function(expr) {
if (expr instanceof Tag$1) { expr.unmount(true); }
else if (expr.tagName) { expr.tag.unmount(true); }
else if (expr.unmount) { expr.unmount(); }
});
} | javascript | function unmountAll(expressions) {
each(expressions, function(expr) {
if (expr instanceof Tag$1) { expr.unmount(true); }
else if (expr.tagName) { expr.tag.unmount(true); }
else if (expr.unmount) { expr.unmount(); }
});
} | [
"function",
"unmountAll",
"(",
"expressions",
")",
"{",
"each",
"(",
"expressions",
",",
"function",
"(",
"expr",
")",
"{",
"if",
"(",
"expr",
"instanceof",
"Tag$1",
")",
"{",
"expr",
".",
"unmount",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"ex... | Trigger the unmount method on all the expressions
@param { Array } expressions - DOM expressions | [
"Trigger",
"the",
"unmount",
"method",
"on",
"all",
"the",
"expressions"
] | d8f547a04467c8e3e2524bde95db0b7218b98be2 | https://github.com/savjs/sav-flux/blob/d8f547a04467c8e3e2524bde95db0b7218b98be2/examples/flux-todo-riot/bundle.js#L3886-L3892 |
38,532 | savjs/sav-flux | examples/flux-todo-riot/bundle.js | selectTags | function selectTags(tags) {
// select all tags
if (!tags) {
var keys = Object.keys(__TAG_IMPL);
return keys + selectTags(keys)
}
return tags
.filter(function (t) { return !/[^-\w]/.test(t); })
.reduce(function (list, t) {
var name = t.trim().toLowerCase();
return list + ",[" + IS_DI... | javascript | function selectTags(tags) {
// select all tags
if (!tags) {
var keys = Object.keys(__TAG_IMPL);
return keys + selectTags(keys)
}
return tags
.filter(function (t) { return !/[^-\w]/.test(t); })
.reduce(function (list, t) {
var name = t.trim().toLowerCase();
return list + ",[" + IS_DI... | [
"function",
"selectTags",
"(",
"tags",
")",
"{",
"// select all tags",
"if",
"(",
"!",
"tags",
")",
"{",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"__TAG_IMPL",
")",
";",
"return",
"keys",
"+",
"selectTags",
"(",
"keys",
")",
"}",
"return",
"tags... | Get selectors for tags
@param { Array } tags - tag names to select
@returns { String } selector | [
"Get",
"selectors",
"for",
"tags"
] | d8f547a04467c8e3e2524bde95db0b7218b98be2 | https://github.com/savjs/sav-flux/blob/d8f547a04467c8e3e2524bde95db0b7218b98be2/examples/flux-todo-riot/bundle.js#L4082-L4095 |
38,533 | savjs/sav-flux | examples/flux-todo-riot/bundle.js | safeRegex | function safeRegex (re) {
var arguments$1 = arguments;
var src = re.source;
var opt = re.global ? 'g' : '';
if (re.ignoreCase) { opt += 'i'; }
if (re.multiline) { opt += 'm'; }
for (var i = 1; i < arguments.length; i++) {
src = src.replace('@', '\\' + arguments$1[i]);
}
return new RegExp(src, o... | javascript | function safeRegex (re) {
var arguments$1 = arguments;
var src = re.source;
var opt = re.global ? 'g' : '';
if (re.ignoreCase) { opt += 'i'; }
if (re.multiline) { opt += 'm'; }
for (var i = 1; i < arguments.length; i++) {
src = src.replace('@', '\\' + arguments$1[i]);
}
return new RegExp(src, o... | [
"function",
"safeRegex",
"(",
"re",
")",
"{",
"var",
"arguments$1",
"=",
"arguments",
";",
"var",
"src",
"=",
"re",
".",
"source",
";",
"var",
"opt",
"=",
"re",
".",
"global",
"?",
"'g'",
":",
"''",
";",
"if",
"(",
"re",
".",
"ignoreCase",
")",
"... | Compiler for riot custom tags
@version v3.2.3
istanbul ignore next | [
"Compiler",
"for",
"riot",
"custom",
"tags"
] | d8f547a04467c8e3e2524bde95db0b7218b98be2 | https://github.com/savjs/sav-flux/blob/d8f547a04467c8e3e2524bde95db0b7218b98be2/examples/flux-todo-riot/bundle.js#L4172-L4186 |
38,534 | savjs/sav-flux | examples/flux-todo-riot/bundle.js | globalEval | function globalEval (js, url) {
if (typeof js === T_STRING) {
var
node = mkEl('script'),
root = document.documentElement;
// make the source available in the "(no domain)" tab
// of Chrome DevTools, with a .js extension
if (url) { js += '\n//# sourceURL=' + url + '.js'; }
node.text =... | javascript | function globalEval (js, url) {
if (typeof js === T_STRING) {
var
node = mkEl('script'),
root = document.documentElement;
// make the source available in the "(no domain)" tab
// of Chrome DevTools, with a .js extension
if (url) { js += '\n//# sourceURL=' + url + '.js'; }
node.text =... | [
"function",
"globalEval",
"(",
"js",
",",
"url",
")",
"{",
"if",
"(",
"typeof",
"js",
"===",
"T_STRING",
")",
"{",
"var",
"node",
"=",
"mkEl",
"(",
"'script'",
")",
",",
"root",
"=",
"document",
".",
"documentElement",
";",
"// make the source available in... | evaluates a compiled tag within the global context | [
"evaluates",
"a",
"compiled",
"tag",
"within",
"the",
"global",
"context"
] | d8f547a04467c8e3e2524bde95db0b7218b98be2 | https://github.com/savjs/sav-flux/blob/d8f547a04467c8e3e2524bde95db0b7218b98be2/examples/flux-todo-riot/bundle.js#L4929-L4943 |
38,535 | matthewtoast/runiq | parser/parse.js | parse | function parse(tokens) {
var ast = [];
var current = ast;
var _line = 0;
var _char = 0;
var openCount = 0;
var closeCount = 0;
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
switch (token.type) {
case TYPES.open:
// Every tim... | javascript | function parse(tokens) {
var ast = [];
var current = ast;
var _line = 0;
var _char = 0;
var openCount = 0;
var closeCount = 0;
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
switch (token.type) {
case TYPES.open:
// Every tim... | [
"function",
"parse",
"(",
"tokens",
")",
"{",
"var",
"ast",
"=",
"[",
"]",
";",
"var",
"current",
"=",
"ast",
";",
"var",
"_line",
"=",
"0",
";",
"var",
"_char",
"=",
"0",
";",
"var",
"openCount",
"=",
"0",
";",
"var",
"closeCount",
"=",
"0",
"... | Given an array of token objects, recursively build an AST | [
"Given",
"an",
"array",
"of",
"token",
"objects",
"recursively",
"build",
"an",
"AST"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/parser/parse.js#L31-L116 |
38,536 | rootsdev/gedcomx-js | src/core/NamePart.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof NamePart)){
return new NamePart(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(NamePart.isInstance(json)){
return json;
}
this.ini... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof NamePart)){
return new NamePart(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(NamePart.isInstance(json)){
return json;
}
this.ini... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"NamePart",
")",
")",
"{",
"return",
"new",
"NamePart",
"(",
"json",
")",
";",
"}",
"// If the given object is a... | A part of a name.
@see {@link https://github.com/FamilySearch/gedcomx/blob/master/specifications/json-format-specification.md#name-part|GEDCOM X JSON Spec}
@class
@extends ExtensibleData
@param {Object} [json] | [
"A",
"part",
"of",
"a",
"name",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/core/NamePart.js#L13-L26 | |
38,537 | jeremyruppel/pathmap | index.js | pathmap | function pathmap(path, spec, callback) {
return spec.replace(regexp, function(match, replace, count, token) {
var pattern;
if (pattern = pathmap.patterns[token]) {
return pattern.call(path, replace, count, callback);
} else {
throw new Error(
'Unknown pathmap specifier ' + match + ' in... | javascript | function pathmap(path, spec, callback) {
return spec.replace(regexp, function(match, replace, count, token) {
var pattern;
if (pattern = pathmap.patterns[token]) {
return pattern.call(path, replace, count, callback);
} else {
throw new Error(
'Unknown pathmap specifier ' + match + ' in... | [
"function",
"pathmap",
"(",
"path",
",",
"spec",
",",
"callback",
")",
"{",
"return",
"spec",
".",
"replace",
"(",
"regexp",
",",
"function",
"(",
"match",
",",
"replace",
",",
"count",
",",
"token",
")",
"{",
"var",
"pattern",
";",
"if",
"(",
"patte... | Maps a path to a path spec. | [
"Maps",
"a",
"path",
"to",
"a",
"path",
"spec",
"."
] | 3c5023225c308ca078163228eda3e86043412402 | https://github.com/jeremyruppel/pathmap/blob/3c5023225c308ca078163228eda3e86043412402/index.js#L17-L27 |
38,538 | jeremyruppel/pathmap | index.js | function(replace, count, callback) {
return pathmap.replace(
pathmap.basename(this, pathmap.extname(this)), replace, callback);
} | javascript | function(replace, count, callback) {
return pathmap.replace(
pathmap.basename(this, pathmap.extname(this)), replace, callback);
} | [
"function",
"(",
"replace",
",",
"count",
",",
"callback",
")",
"{",
"return",
"pathmap",
".",
"replace",
"(",
"pathmap",
".",
"basename",
"(",
"this",
",",
"pathmap",
".",
"extname",
"(",
"this",
")",
")",
",",
"replace",
",",
"callback",
")",
";",
... | The file name of the path without its file extension. | [
"The",
"file",
"name",
"of",
"the",
"path",
"without",
"its",
"file",
"extension",
"."
] | 3c5023225c308ca078163228eda3e86043412402 | https://github.com/jeremyruppel/pathmap/blob/3c5023225c308ca078163228eda3e86043412402/index.js#L145-L148 | |
38,539 | jeremyruppel/pathmap | index.js | function(replace, count, callback) {
return pathmap.replace(
pathmap.dirname(this, count), replace, callback);
} | javascript | function(replace, count, callback) {
return pathmap.replace(
pathmap.dirname(this, count), replace, callback);
} | [
"function",
"(",
"replace",
",",
"count",
",",
"callback",
")",
"{",
"return",
"pathmap",
".",
"replace",
"(",
"pathmap",
".",
"dirname",
"(",
"this",
",",
"count",
")",
",",
"replace",
",",
"callback",
")",
";",
"}"
] | The directory list of the path. | [
"The",
"directory",
"list",
"of",
"the",
"path",
"."
] | 3c5023225c308ca078163228eda3e86043412402 | https://github.com/jeremyruppel/pathmap/blob/3c5023225c308ca078163228eda3e86043412402/index.js#L153-L156 | |
38,540 | jeremyruppel/pathmap | index.js | function(replace, count, callback) {
return pathmap.replace(
pathmap.chomp(this, pathmap.extname(this)), replace, callback);
} | javascript | function(replace, count, callback) {
return pathmap.replace(
pathmap.chomp(this, pathmap.extname(this)), replace, callback);
} | [
"function",
"(",
"replace",
",",
"count",
",",
"callback",
")",
"{",
"return",
"pathmap",
".",
"replace",
"(",
"pathmap",
".",
"chomp",
"(",
"this",
",",
"pathmap",
".",
"extname",
"(",
"this",
")",
")",
",",
"replace",
",",
"callback",
")",
";",
"}"... | Everything but the file extension. | [
"Everything",
"but",
"the",
"file",
"extension",
"."
] | 3c5023225c308ca078163228eda3e86043412402 | https://github.com/jeremyruppel/pathmap/blob/3c5023225c308ca078163228eda3e86043412402/index.js#L170-L173 | |
38,541 | rootsdev/gedcomx-js | src/core/SourceReference.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof SourceReference)){
return new SourceReference(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(SourceReference.isInstance(json)){
return js... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof SourceReference)){
return new SourceReference(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(SourceReference.isInstance(json)){
return js... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"SourceReference",
")",
")",
"{",
"return",
"new",
"SourceReference",
"(",
"json",
")",
";",
"}",
"// If the giv... | A reference to a discription of a source.
@see {@link https://github.com/FamilySearch/gedcomx/blob/master/specifications/json-format-specification.md#source-reference|GEDCOM X JSON Spec}
@class
@extends ExtensibleData
@param {Object} [json] | [
"A",
"reference",
"to",
"a",
"discription",
"of",
"a",
"source",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/core/SourceReference.js#L13-L26 | |
38,542 | jonschlinkert/gulp-middleware | index.js | middleware | function middleware(fns) {
return through.obj(function(file, enc, cb) {
eachSeries(arrayify(fns), function(fn, next) {
try {
fn(file, next);
} catch (err) {
next(err);
}
}, function(err) {
cb(err, file);
});
});
} | javascript | function middleware(fns) {
return through.obj(function(file, enc, cb) {
eachSeries(arrayify(fns), function(fn, next) {
try {
fn(file, next);
} catch (err) {
next(err);
}
}, function(err) {
cb(err, file);
});
});
} | [
"function",
"middleware",
"(",
"fns",
")",
"{",
"return",
"through",
".",
"obj",
"(",
"function",
"(",
"file",
",",
"enc",
",",
"cb",
")",
"{",
"eachSeries",
"(",
"arrayify",
"(",
"fns",
")",
",",
"function",
"(",
"fn",
",",
"next",
")",
"{",
"try"... | Run middleware in series.
```js
var middleware = require('gulp-middleware');
gulp.task('middleware', function() {
return gulp.src('*.js')
.pipe(middleware(fn('bar')))
.pipe(middleware([
fn('foo'),
fn('bar'),
fn('baz')
]))
});
function fn(name) {
return function(file, next) {
console.log(name);
next();
};
}
```
@para... | [
"Run",
"middleware",
"in",
"series",
"."
] | 04983efd8b3ab4b1dc932553159ca82078b7a6a9 | https://github.com/jonschlinkert/gulp-middleware/blob/04983efd8b3ab4b1dc932553159ca82078b7a6a9/index.js#L47-L59 |
38,543 | majorleaguesoccer/neulion | lib/neulion.js | toXML | function toXML(obj) {
var xml = ''
for (var prop in obj) {
xml += `<${prop}>${obj[prop]}</${prop}>`
}
return xml
} | javascript | function toXML(obj) {
var xml = ''
for (var prop in obj) {
xml += `<${prop}>${obj[prop]}</${prop}>`
}
return xml
} | [
"function",
"toXML",
"(",
"obj",
")",
"{",
"var",
"xml",
"=",
"''",
"for",
"(",
"var",
"prop",
"in",
"obj",
")",
"{",
"xml",
"+=",
"`",
"${",
"prop",
"}",
"${",
"obj",
"[",
"prop",
"]",
"}",
"${",
"prop",
"}",
"`",
"}",
"return",
"xml",
"}"
] | Convert an object into simple XML
@param {Object} input
@return {String} xml output | [
"Convert",
"an",
"object",
"into",
"simple",
"XML"
] | c461421d7af9bd638e241ea4f88fd40ae9bb39f2 | https://github.com/majorleaguesoccer/neulion/blob/c461421d7af9bd638e241ea4f88fd40ae9bb39f2/lib/neulion.js#L29-L35 |
38,544 | majorleaguesoccer/neulion | lib/neulion.js | go | function go() {
return new Promise(handler)
// Check for invalid `authCode`, this seems to happen at random intervals
// within the neulion API, so we will only know when a request fails
.catch(Errors.AuthenticationError, function(err) {
// Authenticate and then try one more time
... | javascript | function go() {
return new Promise(handler)
// Check for invalid `authCode`, this seems to happen at random intervals
// within the neulion API, so we will only know when a request fails
.catch(Errors.AuthenticationError, function(err) {
// Authenticate and then try one more time
... | [
"function",
"go",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"handler",
")",
"// Check for invalid `authCode`, this seems to happen at random intervals",
"// within the neulion API, so we will only know when a request fails",
".",
"catch",
"(",
"Errors",
".",
"Authentication... | Primary method runner | [
"Primary",
"method",
"runner"
] | c461421d7af9bd638e241ea4f88fd40ae9bb39f2 | https://github.com/majorleaguesoccer/neulion/blob/c461421d7af9bd638e241ea4f88fd40ae9bb39f2/lib/neulion.js#L137-L150 |
38,545 | matthewtoast/runiq | library/http.js | request | function request(meth, url, headers, query, data, cb) {
var req = SA(meth, url);
if (headers) req.set(headers);
if (query) req.query(query);
if (data) req.send(data);
return req.end(function(err, res) {
if (err) return cb(err);
return cb(null, res.text);
});
} | javascript | function request(meth, url, headers, query, data, cb) {
var req = SA(meth, url);
if (headers) req.set(headers);
if (query) req.query(query);
if (data) req.send(data);
return req.end(function(err, res) {
if (err) return cb(err);
return cb(null, res.text);
});
} | [
"function",
"request",
"(",
"meth",
",",
"url",
",",
"headers",
",",
"query",
",",
"data",
",",
"cb",
")",
"{",
"var",
"req",
"=",
"SA",
"(",
"meth",
",",
"url",
")",
";",
"if",
"(",
"headers",
")",
"req",
".",
"set",
"(",
"headers",
")",
";",
... | Execute a HTTP request
@function http.request
@example (http.request)
@returns {Anything} | [
"Execute",
"a",
"HTTP",
"request"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/library/http.js#L16-L25 |
38,546 | rootsdev/gedcomx-js | src/core/Event.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Event)){
return new Event(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Event.isInstance(json)){
return json;
}
this.init(json);
... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Event)){
return new Event(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Event.isInstance(json)){
return json;
}
this.init(json);
... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Event",
")",
")",
"{",
"return",
"new",
"Event",
"(",
"json",
")",
";",
"}",
"// If the given object is already... | An event.
@see {@link https://github.com/FamilySearch/gedcomx/blob/master/specifications/json-format-specification.md#event|GEDCOM X JSON Spec}
@class
@extends Subject
@param {Object} [json] | [
"An",
"event",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/core/Event.js#L13-L26 | |
38,547 | ndreckshage/isomorphic | lib/isomorphize.js | loadNonCriticalCSS | function loadNonCriticalCSS (href) {
var link = window.document.createElement('link');
link.rel = 'stylesheet';
link.href = href;
window.document.getElementsByTagName('head')[0].appendChild(link);
} | javascript | function loadNonCriticalCSS (href) {
var link = window.document.createElement('link');
link.rel = 'stylesheet';
link.href = href;
window.document.getElementsByTagName('head')[0].appendChild(link);
} | [
"function",
"loadNonCriticalCSS",
"(",
"href",
")",
"{",
"var",
"link",
"=",
"window",
".",
"document",
".",
"createElement",
"(",
"'link'",
")",
";",
"link",
".",
"rel",
"=",
"'stylesheet'",
";",
"link",
".",
"href",
"=",
"href",
";",
"window",
".",
"... | load non critical css async | [
"load",
"non",
"critical",
"css",
"async"
] | dc2f8220ed172aa3be82079af06a74ac29cf9b87 | https://github.com/ndreckshage/isomorphic/blob/dc2f8220ed172aa3be82079af06a74ac29cf9b87/lib/isomorphize.js#L4-L9 |
38,548 | bredele/steroid | examples/example2.js | async | function async(value, bool) {
var def = promise()
setTimeout(function() {
if(!bool) def.fulfill(value)
else def.reject('error')
}, 10)
return def.promise
} | javascript | function async(value, bool) {
var def = promise()
setTimeout(function() {
if(!bool) def.fulfill(value)
else def.reject('error')
}, 10)
return def.promise
} | [
"function",
"async",
"(",
"value",
",",
"bool",
")",
"{",
"var",
"def",
"=",
"promise",
"(",
")",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"!",
"bool",
")",
"def",
".",
"fulfill",
"(",
"value",
")",
"else",
"def",
".",
"reject",
"... | Return value after 500ms using promises.
@param {Any} value
@return {Promise}
@api private | [
"Return",
"value",
"after",
"500ms",
"using",
"promises",
"."
] | a9d2a7ae334ffcb9917a2190b9035e0a30e1bacb | https://github.com/bredele/steroid/blob/a9d2a7ae334ffcb9917a2190b9035e0a30e1bacb/examples/example2.js#L77-L84 |
38,549 | Schoonology/discovery | lib/registry.js | Registry | function Registry(options) {
if (!(this instanceof Registry)) {
return new Registry(options);
}
options = options || {};
debug('New Registry: %j', options);
this.manager = options.manager || new UdpBroadcast();
this.services = {};
this._initProperties(options);
this._initManager();
assert(thi... | javascript | function Registry(options) {
if (!(this instanceof Registry)) {
return new Registry(options);
}
options = options || {};
debug('New Registry: %j', options);
this.manager = options.manager || new UdpBroadcast();
this.services = {};
this._initProperties(options);
this._initManager();
assert(thi... | [
"function",
"Registry",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Registry",
")",
")",
"{",
"return",
"new",
"Registry",
"(",
"options",
")",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"debug",
"(",
"'New Re... | Creates a new instance of Registry with the provided `options`.
The Registry is the cornerstone of Discovery. Each node in the cluster
is expected to have at least one Registry, with that Registry being
responsible for one or more local Services. Its Manager, in turn,
synchronizes the Registry's understanding of the c... | [
"Creates",
"a",
"new",
"instance",
"of",
"Registry",
"with",
"the",
"provided",
"options",
"."
] | 9d123d74c13f8c9b6904e409f8933b09ab22e175 | https://github.com/Schoonology/discovery/blob/9d123d74c13f8c9b6904e409f8933b09ab22e175/lib/registry.js#L23-L39 |
38,550 | Schoonology/discovery | lib/managers/broadcast.js | UdpBroadcastManager | function UdpBroadcastManager(options) {
if (!(this instanceof UdpBroadcastManager)) {
return new UdpBroadcastManager(options);
}
options = options || {};
Manager.call(this, options);
debug('New UdpBroadcastManager: %j', options);
this.dgramType = options.dgramType ? String(options.dgramType).toLower... | javascript | function UdpBroadcastManager(options) {
if (!(this instanceof UdpBroadcastManager)) {
return new UdpBroadcastManager(options);
}
options = options || {};
Manager.call(this, options);
debug('New UdpBroadcastManager: %j', options);
this.dgramType = options.dgramType ? String(options.dgramType).toLower... | [
"function",
"UdpBroadcastManager",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"UdpBroadcastManager",
")",
")",
"{",
"return",
"new",
"UdpBroadcastManager",
"(",
"options",
")",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
... | Creates a new instance of UdpBroadcastManager with the provided `options`.
The UdpBroadcastManager provides a client connection to the
zero-configuration, UDP-based discovery system that is used by Discovery
by default. Because it requires zero configuration to use, it's ideal for
initial exploration and development. ... | [
"Creates",
"a",
"new",
"instance",
"of",
"UdpBroadcastManager",
"with",
"the",
"provided",
"options",
"."
] | 9d123d74c13f8c9b6904e409f8933b09ab22e175 | https://github.com/Schoonology/discovery/blob/9d123d74c13f8c9b6904e409f8933b09ab22e175/lib/managers/broadcast.js#L31-L55 |
38,551 | BeLi4L/subz-hero | src/subz-hero.js | downloadSubtitles | async function downloadSubtitles (file) {
const subtitles = await getSubtitles(file)
const { dir, name } = path.parse(file)
const subtitlesFile = path.format({ dir, name, ext: '.srt' })
await fs.writeFile(subtitlesFile, subtitles)
return subtitlesFile
} | javascript | async function downloadSubtitles (file) {
const subtitles = await getSubtitles(file)
const { dir, name } = path.parse(file)
const subtitlesFile = path.format({ dir, name, ext: '.srt' })
await fs.writeFile(subtitlesFile, subtitles)
return subtitlesFile
} | [
"async",
"function",
"downloadSubtitles",
"(",
"file",
")",
"{",
"const",
"subtitles",
"=",
"await",
"getSubtitles",
"(",
"file",
")",
"const",
"{",
"dir",
",",
"name",
"}",
"=",
"path",
".",
"parse",
"(",
"file",
")",
"const",
"subtitlesFile",
"=",
"pat... | Download subtitles for the given file and create a '.srt' file next to it,
with the same name.
@param {string} file - path to a file
@returns {Promise<string>} path to the .srt file | [
"Download",
"subtitles",
"for",
"the",
"given",
"file",
"and",
"create",
"a",
".",
"srt",
"file",
"next",
"to",
"it",
"with",
"the",
"same",
"name",
"."
] | c22c6df7c2d80c00685a9326043e1ceae3cbf53d | https://github.com/BeLi4L/subz-hero/blob/c22c6df7c2d80c00685a9326043e1ceae3cbf53d/src/subz-hero.js#L39-L49 |
38,552 | rootsdev/gedcomx-js | src/records/Field.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Field)){
return new Field(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Field.isInstance(json)){
return json;
}
... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Field)){
return new Field(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Field.isInstance(json)){
return json;
}
... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Field",
")",
")",
"{",
"return",
"new",
"Field",
"(",
"json",
")",
";",
"}",
"// If the given object is already... | Information about the fields of a record from which genealogical data is extracted.
@see {@link https://github.com/FamilySearch/gedcomx-record/blob/master/specifications/record-specification.md#field|GEDCOM X Records Spec}
@class Field
@extends ExtensibleData
@param {Object} [json] | [
"Information",
"about",
"the",
"fields",
"of",
"a",
"record",
"from",
"which",
"genealogical",
"data",
"is",
"extracted",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/records/Field.js#L14-L27 | |
38,553 | declandewet/pipep | index.js | _resolvePromises | function _resolvePromises (opts, val) {
opts = opts || {}
var duplicate = opts.duplicate
if (is(Array, val)) {
return Promise.all(duplicate ? concat([], val) : val)
} else if (duplicate && is(Object, val) && !is(Function, val.then)) {
return Object.assign({}, val)
}
return val
} | javascript | function _resolvePromises (opts, val) {
opts = opts || {}
var duplicate = opts.duplicate
if (is(Array, val)) {
return Promise.all(duplicate ? concat([], val) : val)
} else if (duplicate && is(Object, val) && !is(Function, val.then)) {
return Object.assign({}, val)
}
return val
} | [
"function",
"_resolvePromises",
"(",
"opts",
",",
"val",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
"var",
"duplicate",
"=",
"opts",
".",
"duplicate",
"if",
"(",
"is",
"(",
"Array",
",",
"val",
")",
")",
"{",
"return",
"Promise",
".",
"all",
"(... | Calls Promise.all on passed value if it is an array
Duplicates value if required.
@param {Object} opts - options
@param {*} val - value to resolve
@return {*} - if val is an array, a promise for all resolved elements, else the original value | [
"Calls",
"Promise",
".",
"all",
"on",
"passed",
"value",
"if",
"it",
"is",
"an",
"array",
"Duplicates",
"value",
"if",
"required",
"."
] | 799e168125770f950ba91266a948c381a348bd3a | https://github.com/declandewet/pipep/blob/799e168125770f950ba91266a948c381a348bd3a/index.js#L93-L102 |
38,554 | declandewet/pipep | index.js | _curry | function _curry (n, fn, args) {
args = args || []
return function partial () {
var rest = arrayFrom(arguments)
var allArgs = concat(args, rest)
return n > length(allArgs)
? _curry(n, fn, allArgs)
: _call(fn, allArgs.slice(0, n))
}
} | javascript | function _curry (n, fn, args) {
args = args || []
return function partial () {
var rest = arrayFrom(arguments)
var allArgs = concat(args, rest)
return n > length(allArgs)
? _curry(n, fn, allArgs)
: _call(fn, allArgs.slice(0, n))
}
} | [
"function",
"_curry",
"(",
"n",
",",
"fn",
",",
"args",
")",
"{",
"args",
"=",
"args",
"||",
"[",
"]",
"return",
"function",
"partial",
"(",
")",
"{",
"var",
"rest",
"=",
"arrayFrom",
"(",
"arguments",
")",
"var",
"allArgs",
"=",
"concat",
"(",
"ar... | Returns a function of n-arity partially applied with supplied arguments
@param {Number} n - arity of function to partially apply
@param {Function} fn - function to partially apply
@param {Array} args = [] - arguments to apply to new function
@return {Function} - partially-applied functi... | [
"Returns",
"a",
"function",
"of",
"n",
"-",
"arity",
"partially",
"applied",
"with",
"supplied",
"arguments"
] | 799e168125770f950ba91266a948c381a348bd3a | https://github.com/declandewet/pipep/blob/799e168125770f950ba91266a948c381a348bd3a/index.js#L187-L196 |
38,555 | ndreckshage/isomorphic | lib/gulp/utils/error.js | handleError | function handleError (task) {
return function (err) {
console.log(chalk.red(err));
notify.onError(task + ' failed, check the logs..')(err);
};
} | javascript | function handleError (task) {
return function (err) {
console.log(chalk.red(err));
notify.onError(task + ' failed, check the logs..')(err);
};
} | [
"function",
"handleError",
"(",
"task",
")",
"{",
"return",
"function",
"(",
"err",
")",
"{",
"console",
".",
"log",
"(",
"chalk",
".",
"red",
"(",
"err",
")",
")",
";",
"notify",
".",
"onError",
"(",
"task",
"+",
"' failed, check the logs..'",
")",
"(... | Log errors from Gulp
@param {string} task | [
"Log",
"errors",
"from",
"Gulp"
] | dc2f8220ed172aa3be82079af06a74ac29cf9b87 | https://github.com/ndreckshage/isomorphic/blob/dc2f8220ed172aa3be82079af06a74ac29cf9b87/lib/gulp/utils/error.js#L8-L13 |
38,556 | matthewtoast/runiq | interpreter/index.js | Interpreter | function Interpreter(library, options, storage) {
// What lengths I've gone to to use only 7-letter properties...
this.library = new Library(CloneDeep(library || {}));
this.options = Assign({}, Interpreter.DEFAULT_OPTIONS, options);
this.balance = this.options.balance;
this.timeout = Date.now() + th... | javascript | function Interpreter(library, options, storage) {
// What lengths I've gone to to use only 7-letter properties...
this.library = new Library(CloneDeep(library || {}));
this.options = Assign({}, Interpreter.DEFAULT_OPTIONS, options);
this.balance = this.options.balance;
this.timeout = Date.now() + th... | [
"function",
"Interpreter",
"(",
"library",
",",
"options",
",",
"storage",
")",
"{",
"// What lengths I've gone to to use only 7-letter properties...",
"this",
".",
"library",
"=",
"new",
"Library",
"(",
"CloneDeep",
"(",
"library",
"||",
"{",
"}",
")",
")",
";",
... | An instance of Interpreter can execute a Runiq AST. At a high level,
it performs instructions defined in the AST by mapping function
names to function entries in the passed-in Library instance
The interpreter also manages ordering operations in accordance with
the three basic control patterns available in Runiq:
- Asy... | [
"An",
"instance",
"of",
"Interpreter",
"can",
"execute",
"a",
"Runiq",
"AST",
".",
"At",
"a",
"high",
"level",
"it",
"performs",
"instructions",
"defined",
"in",
"the",
"AST",
"by",
"mapping",
"function",
"names",
"to",
"function",
"entries",
"in",
"the",
... | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L39-L55 |
38,557 | matthewtoast/runiq | interpreter/index.js | exec | function exec(inst, raw, argv, event, fin) {
var after = nextup(inst, raw, argv, event, fin);
return step(inst, raw, argv, event, passthrough(after));
} | javascript | function exec(inst, raw, argv, event, fin) {
var after = nextup(inst, raw, argv, event, fin);
return step(inst, raw, argv, event, passthrough(after));
} | [
"function",
"exec",
"(",
"inst",
",",
"raw",
",",
"argv",
",",
"event",
",",
"fin",
")",
"{",
"var",
"after",
"=",
"nextup",
"(",
"inst",
",",
"raw",
",",
"argv",
",",
"event",
",",
"fin",
")",
";",
"return",
"step",
"(",
"inst",
",",
"raw",
",... | Recursively execute a list in the context of the passed-in instance. | [
"Recursively",
"execute",
"a",
"list",
"in",
"the",
"context",
"of",
"the",
"passed",
"-",
"in",
"instance",
"."
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L151-L154 |
38,558 | matthewtoast/runiq | interpreter/index.js | nextup | function nextup(inst, orig, argv, event, cb) {
return function nextupCallback(err, data) {
if (err) return cb(err, null);
if (_isQuoted(data)) return cb(null, _unquote(data));
if (_isValue(data)) return cb(null, _entityToValue(data, inst.library));
// Remove any nulls or undefineds f... | javascript | function nextup(inst, orig, argv, event, cb) {
return function nextupCallback(err, data) {
if (err) return cb(err, null);
if (_isQuoted(data)) return cb(null, _unquote(data));
if (_isValue(data)) return cb(null, _entityToValue(data, inst.library));
// Remove any nulls or undefineds f... | [
"function",
"nextup",
"(",
"inst",
",",
"orig",
",",
"argv",
",",
"event",
",",
"cb",
")",
"{",
"return",
"function",
"nextupCallback",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"return",
"cb",
"(",
"err",
",",
"null",
")",
";",
"... | Return callback to produce a usable value, or continue execution | [
"Return",
"callback",
"to",
"produce",
"a",
"usable",
"value",
"or",
"continue",
"execution"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L157-L174 |
38,559 | matthewtoast/runiq | interpreter/index.js | step | function step(inst, raw, argv, event, fin) {
if (!_isPresent(raw)) return fin(_wrapError(_badInput(inst), inst, raw), null);
var flat = _denestList(raw);
preproc(inst, flat, argv, event, function postPreproc(err, data) {
if (err) return fin(err);
var list = _safeObject(data);
return ... | javascript | function step(inst, raw, argv, event, fin) {
if (!_isPresent(raw)) return fin(_wrapError(_badInput(inst), inst, raw), null);
var flat = _denestList(raw);
preproc(inst, flat, argv, event, function postPreproc(err, data) {
if (err) return fin(err);
var list = _safeObject(data);
return ... | [
"function",
"step",
"(",
"inst",
",",
"raw",
",",
"argv",
",",
"event",
",",
"fin",
")",
"{",
"if",
"(",
"!",
"_isPresent",
"(",
"raw",
")",
")",
"return",
"fin",
"(",
"_wrapError",
"(",
"_badInput",
"(",
"inst",
")",
",",
"inst",
",",
"raw",
")"... | Perform one step of execution to the given list, and return the AST. | [
"Perform",
"one",
"step",
"of",
"execution",
"to",
"the",
"given",
"list",
"and",
"return",
"the",
"AST",
"."
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L177-L185 |
38,560 | matthewtoast/runiq | interpreter/index.js | preproc | function preproc(inst, prog, argv, event, fin) {
var info = findPreprocs(inst, prog, [], []);
function step(procs, parts, list) {
if (!procs || procs.length < 1) {
return fin(null, list);
}
var part = parts.shift();
var proc = procs.shift();
var ctx = {
... | javascript | function preproc(inst, prog, argv, event, fin) {
var info = findPreprocs(inst, prog, [], []);
function step(procs, parts, list) {
if (!procs || procs.length < 1) {
return fin(null, list);
}
var part = parts.shift();
var proc = procs.shift();
var ctx = {
... | [
"function",
"preproc",
"(",
"inst",
",",
"prog",
",",
"argv",
",",
"event",
",",
"fin",
")",
"{",
"var",
"info",
"=",
"findPreprocs",
"(",
"inst",
",",
"prog",
",",
"[",
"]",
",",
"[",
"]",
")",
";",
"function",
"step",
"(",
"procs",
",",
"parts"... | Run any preprocessors that are present in the program, please | [
"Run",
"any",
"preprocessors",
"that",
"are",
"present",
"in",
"the",
"program",
"please"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L188-L209 |
38,561 | matthewtoast/runiq | interpreter/index.js | findPreprocs | function findPreprocs(inst, list, procs, parts) {
if (Array.isArray(list)) {
while (list.length > 0) {
var part = list.shift();
// Preprocessors must be the first elements in the list;
// if we hit any non-preprocessors, immediately assume
// we're done prepro... | javascript | function findPreprocs(inst, list, procs, parts) {
if (Array.isArray(list)) {
while (list.length > 0) {
var part = list.shift();
// Preprocessors must be the first elements in the list;
// if we hit any non-preprocessors, immediately assume
// we're done prepro... | [
"function",
"findPreprocs",
"(",
"inst",
",",
"list",
",",
"procs",
",",
"parts",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"list",
")",
")",
"{",
"while",
"(",
"list",
".",
"length",
">",
"0",
")",
"{",
"var",
"part",
"=",
"list",
".",
... | Find all preprocessors in the given program | [
"Find",
"all",
"preprocessors",
"in",
"the",
"given",
"program"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L212-L242 |
38,562 | matthewtoast/runiq | interpreter/index.js | branch | function branch(inst, list, argv, event, fin) {
if (argv.length > 0) {
// Append the argv for programs that return
// a list that accepts them as parameters
list = list.concat(argv.splice(0));
}
// HACK HACK HACK. OK, so, when dealing with deeply recursive
// functions in Runiq, ... | javascript | function branch(inst, list, argv, event, fin) {
if (argv.length > 0) {
// Append the argv for programs that return
// a list that accepts them as parameters
list = list.concat(argv.splice(0));
}
// HACK HACK HACK. OK, so, when dealing with deeply recursive
// functions in Runiq, ... | [
"function",
"branch",
"(",
"inst",
",",
"list",
",",
"argv",
",",
"event",
",",
"fin",
")",
"{",
"if",
"(",
"argv",
".",
"length",
">",
"0",
")",
"{",
"// Append the argv for programs that return",
"// a list that accepts them as parameters",
"list",
"=",
"list"... | Force flow through a set timeout prior to executing the given list | [
"Force",
"flow",
"through",
"a",
"set",
"timeout",
"prior",
"to",
"executing",
"the",
"given",
"list"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L245-L270 |
38,563 | matthewtoast/runiq | interpreter/index.js | quote | function quote(inst, list, argv, event, fin) {
// Remember to charge for the 'quote' function as a transaction
if (!ok(inst, inst.options.quoteTransaction)) return exit(inst, list, fin);
var entity = list[list.length - 1];
if (_isValue(entity)) return fin(null, entity);
var quotation = {};
quota... | javascript | function quote(inst, list, argv, event, fin) {
// Remember to charge for the 'quote' function as a transaction
if (!ok(inst, inst.options.quoteTransaction)) return exit(inst, list, fin);
var entity = list[list.length - 1];
if (_isValue(entity)) return fin(null, entity);
var quotation = {};
quota... | [
"function",
"quote",
"(",
"inst",
",",
"list",
",",
"argv",
",",
"event",
",",
"fin",
")",
"{",
"// Remember to charge for the 'quote' function as a transaction",
"if",
"(",
"!",
"ok",
"(",
"inst",
",",
"inst",
".",
"options",
".",
"quoteTransaction",
")",
")"... | Given a quote list, return a quote object for later use | [
"Given",
"a",
"quote",
"list",
"return",
"a",
"quote",
"object",
"for",
"later",
"use"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L288-L296 |
38,564 | matthewtoast/runiq | interpreter/index.js | sequence | function sequence(inst, elems, argv, event, fin) {
if (elems.length < 1) return fin(null, elems);
// Running a sequence also costs some amount per element to sequence
if (!ok(inst, inst.options.sequenceTransaction * elems.length)) {
return exit(inst, list, fin);
}
return parallel(inst, elems... | javascript | function sequence(inst, elems, argv, event, fin) {
if (elems.length < 1) return fin(null, elems);
// Running a sequence also costs some amount per element to sequence
if (!ok(inst, inst.options.sequenceTransaction * elems.length)) {
return exit(inst, list, fin);
}
return parallel(inst, elems... | [
"function",
"sequence",
"(",
"inst",
",",
"elems",
",",
"argv",
",",
"event",
",",
"fin",
")",
"{",
"if",
"(",
"elems",
".",
"length",
"<",
"1",
")",
"return",
"fin",
"(",
"null",
",",
"elems",
")",
";",
"// Running a sequence also costs some amount per el... | Get values for each list element. Subproc any elements that are lists | [
"Get",
"values",
"for",
"each",
"list",
"element",
".",
"Subproc",
"any",
"elements",
"that",
"are",
"lists"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L386-L393 |
38,565 | matthewtoast/runiq | interpreter/index.js | parallel | function parallel(inst, elems, argv, event, fin, _postSequence) {
var total = elems.length;
var complete = 0;
function check(err, list) {
if (total === ++complete) {
if (!_isFunc(list)) return _postSequence(list, fin);
return fin(err, list);
}
}
for (var i = 0... | javascript | function parallel(inst, elems, argv, event, fin, _postSequence) {
var total = elems.length;
var complete = 0;
function check(err, list) {
if (total === ++complete) {
if (!_isFunc(list)) return _postSequence(list, fin);
return fin(err, list);
}
}
for (var i = 0... | [
"function",
"parallel",
"(",
"inst",
",",
"elems",
",",
"argv",
",",
"event",
",",
"fin",
",",
"_postSequence",
")",
"{",
"var",
"total",
"=",
"elems",
".",
"length",
";",
"var",
"complete",
"=",
"0",
";",
"function",
"check",
"(",
"err",
",",
"list"... | Run the sequence in parallel | [
"Run",
"the",
"sequence",
"in",
"parallel"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L396-L414 |
38,566 | matthewtoast/runiq | interpreter/index.js | postSequence | function postSequence(elems, fin) {
// Treat the final value of a sequence as its return value
var toReturn = elems[elems.length - 1];
return fin(null, toReturn);
} | javascript | function postSequence(elems, fin) {
// Treat the final value of a sequence as its return value
var toReturn = elems[elems.length - 1];
return fin(null, toReturn);
} | [
"function",
"postSequence",
"(",
"elems",
",",
"fin",
")",
"{",
"// Treat the final value of a sequence as its return value",
"var",
"toReturn",
"=",
"elems",
"[",
"elems",
".",
"length",
"-",
"1",
"]",
";",
"return",
"fin",
"(",
"null",
",",
"toReturn",
")",
... | Fire this function after completing a sequence of lists | [
"Fire",
"this",
"function",
"after",
"completing",
"a",
"sequence",
"of",
"lists"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L417-L421 |
38,567 | matthewtoast/runiq | interpreter/index.js | edit | function edit(inst, list, index, argv, event, fin) {
return function editCallback(err, data) {
if (err) return fin(err);
list[index] = data;
return fin(null, list);
};
} | javascript | function edit(inst, list, index, argv, event, fin) {
return function editCallback(err, data) {
if (err) return fin(err);
list[index] = data;
return fin(null, list);
};
} | [
"function",
"edit",
"(",
"inst",
",",
"list",
",",
"index",
",",
"argv",
",",
"event",
",",
"fin",
")",
"{",
"return",
"function",
"editCallback",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"return",
"fin",
"(",
"err",
")",
";",
"l... | Return a function to patch a subroutine result into a parent list | [
"Return",
"a",
"function",
"to",
"patch",
"a",
"subroutine",
"result",
"into",
"a",
"parent",
"list"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L424-L430 |
38,568 | matthewtoast/runiq | interpreter/index.js | _valuefyArgs | function _valuefyArgs(args, lib) {
for (var i = 0; i < args.length; i++) {
args[i] = _entityToValue(args[i], lib);
}
} | javascript | function _valuefyArgs(args, lib) {
for (var i = 0; i < args.length; i++) {
args[i] = _entityToValue(args[i], lib);
}
} | [
"function",
"_valuefyArgs",
"(",
"args",
",",
"lib",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"args",
".",
"length",
";",
"i",
"++",
")",
"{",
"args",
"[",
"i",
"]",
"=",
"_entityToValue",
"(",
"args",
"[",
"i",
"]",
",",
"l... | Convert 'const' args to their values when they are defined | [
"Convert",
"const",
"args",
"to",
"their",
"values",
"when",
"they",
"are",
"defined"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L433-L437 |
38,569 | matthewtoast/runiq | interpreter/index.js | _unquoteArgs | function _unquoteArgs(args) {
for (var i = 0; i < args.length; i++) {
if (_isQuoted(args[i])) args[i] = _unquote(args[i]);
}
} | javascript | function _unquoteArgs(args) {
for (var i = 0; i < args.length; i++) {
if (_isQuoted(args[i])) args[i] = _unquote(args[i]);
}
} | [
"function",
"_unquoteArgs",
"(",
"args",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"args",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"_isQuoted",
"(",
"args",
"[",
"i",
"]",
")",
")",
"args",
"[",
"i",
"]",
"=",
"... | Unquote the arguments. This modifies the arguments in place | [
"Unquote",
"the",
"arguments",
".",
"This",
"modifies",
"the",
"arguments",
"in",
"place"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L440-L444 |
38,570 | matthewtoast/runiq | interpreter/index.js | _entityToValue | function _entityToValue(item, lib) {
if (typeof item === JS_STRING_TYPE) {
// Only JSON-serializable entities may be put into a list
var constant = lib.lookupConstant(item);
if (constant !== undefined) return constant;
}
// Also unquote any item we got that also happens to be a quote... | javascript | function _entityToValue(item, lib) {
if (typeof item === JS_STRING_TYPE) {
// Only JSON-serializable entities may be put into a list
var constant = lib.lookupConstant(item);
if (constant !== undefined) return constant;
}
// Also unquote any item we got that also happens to be a quote... | [
"function",
"_entityToValue",
"(",
"item",
",",
"lib",
")",
"{",
"if",
"(",
"typeof",
"item",
"===",
"JS_STRING_TYPE",
")",
"{",
"// Only JSON-serializable entities may be put into a list",
"var",
"constant",
"=",
"lib",
".",
"lookupConstant",
"(",
"item",
")",
";... | Convert a given entity to a value, if one is defined in the lib | [
"Convert",
"a",
"given",
"entity",
"to",
"a",
"value",
"if",
"one",
"is",
"defined",
"in",
"the",
"lib"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/interpreter/index.js#L447-L458 |
38,571 | moshekarmel1/node-sql | index.js | exec | function exec(query, config, done) {
if(!query || (typeof query != 'string')){
throw new Error('Node-SQL: query was not in the correct format.');
return;
}
if(!config || (typeof config != 'object')){
throw new Error('Node-SQL: config was not in the correct format.');
return;
}
if(!done || (typ... | javascript | function exec(query, config, done) {
if(!query || (typeof query != 'string')){
throw new Error('Node-SQL: query was not in the correct format.');
return;
}
if(!config || (typeof config != 'object')){
throw new Error('Node-SQL: config was not in the correct format.');
return;
}
if(!done || (typ... | [
"function",
"exec",
"(",
"query",
",",
"config",
",",
"done",
")",
"{",
"if",
"(",
"!",
"query",
"||",
"(",
"typeof",
"query",
"!=",
"'string'",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Node-SQL: query was not in the correct format.'",
")",
";",
"ret... | Executes a sql query
@param {string} query -- good old query string
@param {Object} config -- standard tedious config object
@param {Function} done -- standard node callback | [
"Executes",
"a",
"sql",
"query"
] | 59cd089cbef4845baf777adfa5aaf332276e022d | https://github.com/moshekarmel1/node-sql/blob/59cd089cbef4845baf777adfa5aaf332276e022d/index.js#L20-L58 |
38,572 | rootsdev/gedcomx-js | src/core/Person.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Person)){
return new Person(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Person.isInstance(json)){
return json;
}
this.init(json... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Person)){
return new Person(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Person.isInstance(json)){
return json;
}
this.init(json... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Person",
")",
")",
"{",
"return",
"new",
"Person",
"(",
"json",
")",
";",
"}",
"// If the given object is alrea... | A person.
@see {@link https://github.com/FamilySearch/gedcomx/blob/master/specifications/json-format-specification.md#person|GEDCOM X JSON Spec}
@class
@extends Subject
@param {Object} [json] | [
"A",
"person",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/core/Person.js#L13-L26 | |
38,573 | dciccale/css2stylus.js | lib/css2stylus.js | function (str, n) {
n = window.parseInt(n, 10);
return new Array(n + 1).join(str);
} | javascript | function (str, n) {
n = window.parseInt(n, 10);
return new Array(n + 1).join(str);
} | [
"function",
"(",
"str",
",",
"n",
")",
"{",
"n",
"=",
"window",
".",
"parseInt",
"(",
"n",
",",
"10",
")",
";",
"return",
"new",
"Array",
"(",
"n",
"+",
"1",
")",
".",
"join",
"(",
"str",
")",
";",
"}"
] | _repeat same string n times | [
"_repeat",
"same",
"string",
"n",
"times"
] | 86b3fa92bfe0d59eb3390ce41cc8d90bd751afac | https://github.com/dciccale/css2stylus.js/blob/86b3fa92bfe0d59eb3390ce41cc8d90bd751afac/lib/css2stylus.js#L261-L264 | |
38,574 | Ubudu/uBeacon-uart-lib | node/examples/eddystone-setter.js | function(callback){
ubeacon.setEddystoneURL( program.url , function(data, error){
console.log('Set URL to', data );
callback(error);
});
} | javascript | function(callback){
ubeacon.setEddystoneURL( program.url , function(data, error){
console.log('Set URL to', data );
callback(error);
});
} | [
"function",
"(",
"callback",
")",
"{",
"ubeacon",
".",
"setEddystoneURL",
"(",
"program",
".",
"url",
",",
"function",
"(",
"data",
",",
"error",
")",
"{",
"console",
".",
"log",
"(",
"'Set URL to'",
",",
"data",
")",
";",
"callback",
"(",
"error",
")"... | Set new url | [
"Set",
"new",
"url"
] | a7436f3491f61ffabb34e2bc3b2441cc048f5dfa | https://github.com/Ubudu/uBeacon-uart-lib/blob/a7436f3491f61ffabb34e2bc3b2441cc048f5dfa/node/examples/eddystone-setter.js#L31-L36 | |
38,575 | seykron/json-index | lib/JsonIndex.js | function () {
return new Promise((resolve, reject) => {
var startTime = Date.now();
var size = fs.statSync(dataFile).size;
var next = (readInfo, position) => {
var jobs = [readNextChunk(readInfo)];
if (position) {
jobs.push(readAndIndex(position, readInfo.readBuffer));
... | javascript | function () {
return new Promise((resolve, reject) => {
var startTime = Date.now();
var size = fs.statSync(dataFile).size;
var next = (readInfo, position) => {
var jobs = [readNextChunk(readInfo)];
if (position) {
jobs.push(readAndIndex(position, readInfo.readBuffer));
... | [
"function",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"var",
"startTime",
"=",
"Date",
".",
"now",
"(",
")",
";",
"var",
"size",
"=",
"fs",
".",
"statSync",
"(",
"dataFile",
")",
".",
"size",
"... | Creates the index. The index consist of a map from a user-specific key to
the position within the buffer where the item starts and ends. Items are
read lazily when it is required. | [
"Creates",
"the",
"index",
".",
"The",
"index",
"consist",
"of",
"a",
"map",
"from",
"a",
"user",
"-",
"specific",
"key",
"to",
"the",
"position",
"within",
"the",
"buffer",
"where",
"the",
"item",
"starts",
"and",
"ends",
".",
"Items",
"are",
"read",
... | b7f354197fc7129749032695e244f58954aa921d | https://github.com/seykron/json-index/blob/b7f354197fc7129749032695e244f58954aa921d/lib/JsonIndex.js#L261-L297 | |
38,576 | seykron/json-index | lib/JsonIndex.js | function (indexName, key) {
return new Promise((resolve, reject) => {
if (index[indexName]) {
resolve(index[indexName][key] || null);
} else {
debug("opening index %s", indexName);
storage.openIndex(indexName).then(index => {
index[indexName] = index;
resolve(... | javascript | function (indexName, key) {
return new Promise((resolve, reject) => {
if (index[indexName]) {
resolve(index[indexName][key] || null);
} else {
debug("opening index %s", indexName);
storage.openIndex(indexName).then(index => {
index[indexName] = index;
resolve(... | [
"function",
"(",
"indexName",
",",
"key",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"if",
"(",
"index",
"[",
"indexName",
"]",
")",
"{",
"resolve",
"(",
"index",
"[",
"indexName",
"]",
"[",
"key",
"]"... | Returns an item from the index.
@param {String} indexName Name of the index to query. Cannot be null.
@param {String} key Unique key of the required item. Cannot be null. | [
"Returns",
"an",
"item",
"from",
"the",
"index",
"."
] | b7f354197fc7129749032695e244f58954aa921d | https://github.com/seykron/json-index/blob/b7f354197fc7129749032695e244f58954aa921d/lib/JsonIndex.js#L303-L315 | |
38,577 | WebReflection/sob | build/sob.max.amd.js | function (id) {
return typeof id === 'number' ?
clear(id) :
void(
drop(qframe, id) ||
drop(qidle, id) ||
drop(qframex, id) ||
drop(qidlex, id)
);
} | javascript | function (id) {
return typeof id === 'number' ?
clear(id) :
void(
drop(qframe, id) ||
drop(qidle, id) ||
drop(qframex, id) ||
drop(qidlex, id)
);
} | [
"function",
"(",
"id",
")",
"{",
"return",
"typeof",
"id",
"===",
"'number'",
"?",
"clear",
"(",
"id",
")",
":",
"void",
"(",
"drop",
"(",
"qframe",
",",
"id",
")",
"||",
"drop",
"(",
"qidle",
",",
"id",
")",
"||",
"drop",
"(",
"qframex",
",",
... | remove a scheduled frame, idle, or timer operation | [
"remove",
"a",
"scheduled",
"frame",
"idle",
"or",
"timer",
"operation"
] | 8f62b2dd3454ea4955f27c6cdce0dab64142288a | https://github.com/WebReflection/sob/blob/8f62b2dd3454ea4955f27c6cdce0dab64142288a/build/sob.max.amd.js#L87-L96 | |
38,578 | WebReflection/sob | build/sob.max.amd.js | animationLoop | function animationLoop() {
var
// grab current time
t = time(),
// calculate how many millisends we have
fps = 1000 / next.minFPS,
// used to flag overtime in case we exceed milliseconds
overTime = false,
// take current frame queue length
length = getLength(qframe, qframex)
;
// i... | javascript | function animationLoop() {
var
// grab current time
t = time(),
// calculate how many millisends we have
fps = 1000 / next.minFPS,
// used to flag overtime in case we exceed milliseconds
overTime = false,
// take current frame queue length
length = getLength(qframe, qframex)
;
// i... | [
"function",
"animationLoop",
"(",
")",
"{",
"var",
"// grab current time",
"t",
"=",
"time",
"(",
")",
",",
"// calculate how many millisends we have",
"fps",
"=",
"1000",
"/",
"next",
".",
"minFPS",
",",
"// used to flag overtime in case we exceed milliseconds",
"overT... | responsible for centralized requestAnimationFrame operations | [
"responsible",
"for",
"centralized",
"requestAnimationFrame",
"operations"
] | 8f62b2dd3454ea4955f27c6cdce0dab64142288a | https://github.com/WebReflection/sob/blob/8f62b2dd3454ea4955f27c6cdce0dab64142288a/build/sob.max.amd.js#L158-L193 |
38,579 | WebReflection/sob | build/sob.max.amd.js | create | function create(callback) {
/* jslint validthis: true */
for (var
queue = this,
args = [],
info = {
id: {},
fn: callback,
ar: args
},
i = 1; i < arguments.length; i++
) args[i - 1] = arguments[i];
return infoId(queue, info) || (queue.push(info), info.id);
} | javascript | function create(callback) {
/* jslint validthis: true */
for (var
queue = this,
args = [],
info = {
id: {},
fn: callback,
ar: args
},
i = 1; i < arguments.length; i++
) args[i - 1] = arguments[i];
return infoId(queue, info) || (queue.push(info), info.id);
} | [
"function",
"create",
"(",
"callback",
")",
"{",
"/* jslint validthis: true */",
"for",
"(",
"var",
"queue",
"=",
"this",
",",
"args",
"=",
"[",
"]",
",",
"info",
"=",
"{",
"id",
":",
"{",
"}",
",",
"fn",
":",
"callback",
",",
"ar",
":",
"args",
"}... | create a unique id and returns it if the callback with same extra arguments was already scheduled, then returns same id | [
"create",
"a",
"unique",
"id",
"and",
"returns",
"it",
"if",
"the",
"callback",
"with",
"same",
"extra",
"arguments",
"was",
"already",
"scheduled",
"then",
"returns",
"same",
"id"
] | 8f62b2dd3454ea4955f27c6cdce0dab64142288a | https://github.com/WebReflection/sob/blob/8f62b2dd3454ea4955f27c6cdce0dab64142288a/build/sob.max.amd.js#L198-L211 |
38,580 | WebReflection/sob | build/sob.max.amd.js | drop | function drop(queue, id) {
var
i = findIndex(queue, id),
found = -1 < i
;
if (found) queue.splice(i, 1);
return found;
} | javascript | function drop(queue, id) {
var
i = findIndex(queue, id),
found = -1 < i
;
if (found) queue.splice(i, 1);
return found;
} | [
"function",
"drop",
"(",
"queue",
",",
"id",
")",
"{",
"var",
"i",
"=",
"findIndex",
"(",
"queue",
",",
"id",
")",
",",
"found",
"=",
"-",
"1",
"<",
"i",
";",
"if",
"(",
"found",
")",
"queue",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"r... | remove a scheduled id from a queue | [
"remove",
"a",
"scheduled",
"id",
"from",
"a",
"queue"
] | 8f62b2dd3454ea4955f27c6cdce0dab64142288a | https://github.com/WebReflection/sob/blob/8f62b2dd3454ea4955f27c6cdce0dab64142288a/build/sob.max.amd.js#L231-L238 |
38,581 | WebReflection/sob | build/sob.max.amd.js | findIndex | function findIndex(queue, id) {
var i = queue.length;
while (i-- && queue[i].id !== id);
return i;
} | javascript | function findIndex(queue, id) {
var i = queue.length;
while (i-- && queue[i].id !== id);
return i;
} | [
"function",
"findIndex",
"(",
"queue",
",",
"id",
")",
"{",
"var",
"i",
"=",
"queue",
".",
"length",
";",
"while",
"(",
"i",
"--",
"&&",
"queue",
"[",
"i",
"]",
".",
"id",
"!==",
"id",
")",
";",
"return",
"i",
";",
"}"
] | find queue index by id | [
"find",
"queue",
"index",
"by",
"id"
] | 8f62b2dd3454ea4955f27c6cdce0dab64142288a | https://github.com/WebReflection/sob/blob/8f62b2dd3454ea4955f27c6cdce0dab64142288a/build/sob.max.amd.js#L246-L250 |
38,582 | WebReflection/sob | build/sob.max.amd.js | getLength | function getLength(queue, queuex) {
// if previous call didn't execute all callbacks
return queuex.length ?
// reprioritize the queue putting those in front
queue.unshift.apply(queue, queuex) :
queue.length;
} | javascript | function getLength(queue, queuex) {
// if previous call didn't execute all callbacks
return queuex.length ?
// reprioritize the queue putting those in front
queue.unshift.apply(queue, queuex) :
queue.length;
} | [
"function",
"getLength",
"(",
"queue",
",",
"queuex",
")",
"{",
"// if previous call didn't execute all callbacks",
"return",
"queuex",
".",
"length",
"?",
"// reprioritize the queue putting those in front",
"queue",
".",
"unshift",
".",
"apply",
"(",
"queue",
",",
"que... | return the right queue length to consider re-prioritizing scheduled callbacks | [
"return",
"the",
"right",
"queue",
"length",
"to",
"consider",
"re",
"-",
"prioritizing",
"scheduled",
"callbacks"
] | 8f62b2dd3454ea4955f27c6cdce0dab64142288a | https://github.com/WebReflection/sob/blob/8f62b2dd3454ea4955f27c6cdce0dab64142288a/build/sob.max.amd.js#L254-L260 |
38,583 | WebReflection/sob | build/sob.max.amd.js | idleLoop | function idleLoop(deadline) {
var
length = getLength(qidle, qidlex),
didTimeout = deadline.didTimeout
;
if (length) {
// reschedule upfront next idle callback
requestIdleCallback(idleLoop, {timeout: next.maxIdle});
// this prevents the need for a try/catch within the while loop
// reassign... | javascript | function idleLoop(deadline) {
var
length = getLength(qidle, qidlex),
didTimeout = deadline.didTimeout
;
if (length) {
// reschedule upfront next idle callback
requestIdleCallback(idleLoop, {timeout: next.maxIdle});
// this prevents the need for a try/catch within the while loop
// reassign... | [
"function",
"idleLoop",
"(",
"deadline",
")",
"{",
"var",
"length",
"=",
"getLength",
"(",
"qidle",
",",
"qidlex",
")",
",",
"didTimeout",
"=",
"deadline",
".",
"didTimeout",
";",
"if",
"(",
"length",
")",
"{",
"// reschedule upfront next idle callback",
"requ... | responsible for centralized requestIdleCallback operations | [
"responsible",
"for",
"centralized",
"requestIdleCallback",
"operations"
] | 8f62b2dd3454ea4955f27c6cdce0dab64142288a | https://github.com/WebReflection/sob/blob/8f62b2dd3454ea4955f27c6cdce0dab64142288a/build/sob.max.amd.js#L263-L281 |
38,584 | WebReflection/sob | build/sob.max.amd.js | infoId | function infoId(queue, info) {
for (var i = 0, length = queue.length, tmp; i < length; i++) {
tmp = queue[i];
if (
tmp.fn === info.fn &&
sameValues(tmp.ar, info.ar)
) return tmp.id;
}
return null;
} | javascript | function infoId(queue, info) {
for (var i = 0, length = queue.length, tmp; i < length; i++) {
tmp = queue[i];
if (
tmp.fn === info.fn &&
sameValues(tmp.ar, info.ar)
) return tmp.id;
}
return null;
} | [
"function",
"infoId",
"(",
"queue",
",",
"info",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"length",
"=",
"queue",
".",
"length",
",",
"tmp",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"tmp",
"=",
"queue",
"[",
"i",
"]",
";",
... | return a scheduled unique id through similar info | [
"return",
"a",
"scheduled",
"unique",
"id",
"through",
"similar",
"info"
] | 8f62b2dd3454ea4955f27c6cdce0dab64142288a | https://github.com/WebReflection/sob/blob/8f62b2dd3454ea4955f27c6cdce0dab64142288a/build/sob.max.amd.js#L284-L293 |
38,585 | WebReflection/sob | build/sob.max.amd.js | sameValues | function sameValues(a, b) {
var
i = a.length,
j = b.length,
k = i === j
;
if (k) {
while (i--) {
if (a[i] !== b[i]) {
return !k;
}
}
}
return k;
} | javascript | function sameValues(a, b) {
var
i = a.length,
j = b.length,
k = i === j
;
if (k) {
while (i--) {
if (a[i] !== b[i]) {
return !k;
}
}
}
return k;
} | [
"function",
"sameValues",
"(",
"a",
",",
"b",
")",
"{",
"var",
"i",
"=",
"a",
".",
"length",
",",
"j",
"=",
"b",
".",
"length",
",",
"k",
"=",
"i",
"===",
"j",
";",
"if",
"(",
"k",
")",
"{",
"while",
"(",
"i",
"--",
")",
"{",
"if",
"(",
... | compare two arrays values | [
"compare",
"two",
"arrays",
"values"
] | 8f62b2dd3454ea4955f27c6cdce0dab64142288a | https://github.com/WebReflection/sob/blob/8f62b2dd3454ea4955f27c6cdce0dab64142288a/build/sob.max.amd.js#L307-L321 |
38,586 | apparebit/js-junction | packages/knowledge/json-ld/state.js | asPath | function asPath({ ancestors }) {
const path = [];
for (const { key } of ancestors) {
if (key != null) {
if (typeof key === 'number') {
path.push(`[${key}]`);
} else {
path.push(`['${stringify(key).slice(1, -1)}']`);
}
}
}
return path.join('');
} | javascript | function asPath({ ancestors }) {
const path = [];
for (const { key } of ancestors) {
if (key != null) {
if (typeof key === 'number') {
path.push(`[${key}]`);
} else {
path.push(`['${stringify(key).slice(1, -1)}']`);
}
}
}
return path.join('');
} | [
"function",
"asPath",
"(",
"{",
"ancestors",
"}",
")",
"{",
"const",
"path",
"=",
"[",
"]",
";",
"for",
"(",
"const",
"{",
"key",
"}",
"of",
"ancestors",
")",
"{",
"if",
"(",
"key",
"!=",
"null",
")",
"{",
"if",
"(",
"typeof",
"key",
"===",
"'n... | Based on `key` in ancestral records, format property path to offending entity. | [
"Based",
"on",
"key",
"in",
"ancestral",
"records",
"format",
"property",
"path",
"to",
"offending",
"entity",
"."
] | 240b15961c35f19c3a1effd9df51e0bf8e0bbffc | https://github.com/apparebit/js-junction/blob/240b15961c35f19c3a1effd9df51e0bf8e0bbffc/packages/knowledge/json-ld/state.js#L11-L25 |
38,587 | jaredhanson/junction-disco | lib/junction-disco/elements/identity.js | Identity | function Identity(category, type, name) {
Element.call(this, 'identity', 'http://jabber.org/protocol/disco#info');
this.category = category;
this.type = type;
this.displayName = name;
} | javascript | function Identity(category, type, name) {
Element.call(this, 'identity', 'http://jabber.org/protocol/disco#info');
this.category = category;
this.type = type;
this.displayName = name;
} | [
"function",
"Identity",
"(",
"category",
",",
"type",
",",
"name",
")",
"{",
"Element",
".",
"call",
"(",
"this",
",",
"'identity'",
",",
"'http://jabber.org/protocol/disco#info'",
")",
";",
"this",
".",
"category",
"=",
"category",
";",
"this",
".",
"type",... | Initialize a new `Identity` element.
@param {String} category
@param {String} type
@param {String} name
@api public | [
"Initialize",
"a",
"new",
"Identity",
"element",
"."
] | 89f2d222518b3b0f282d54b25d6405b5e35c1383 | https://github.com/jaredhanson/junction-disco/blob/89f2d222518b3b0f282d54b25d6405b5e35c1383/lib/junction-disco/elements/identity.js#L15-L20 |
38,588 | observing/exception | index.js | Exception | function Exception(err, options) {
if (!(this instanceof Exception)) return new Exception(err, options);
if ('string' === typeof err) err = {
stack: (new Error(err)).stack,
message: err
};
debug('generating a new exception for: %s', err.message);
options = options || {};
this.initialize(options);
... | javascript | function Exception(err, options) {
if (!(this instanceof Exception)) return new Exception(err, options);
if ('string' === typeof err) err = {
stack: (new Error(err)).stack,
message: err
};
debug('generating a new exception for: %s', err.message);
options = options || {};
this.initialize(options);
... | [
"function",
"Exception",
"(",
"err",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Exception",
")",
")",
"return",
"new",
"Exception",
"(",
"err",
",",
"options",
")",
";",
"if",
"(",
"'string'",
"===",
"typeof",
"err",
")",
"... | Generates a new Exception.
Options:
- timeout: Timeout for remote saving data before we call the supplied
abortion callback.
- human: Provide a human readable console output.
@constructor
@param {Error} err The error that caused the exception.
@param {Object} options Configuration.
@api public | [
"Generates",
"a",
"new",
"Exception",
"."
] | f6a89b51710ee858b32d6640706ae41f9bb87270 | https://github.com/observing/exception/blob/f6a89b51710ee858b32d6640706ae41f9bb87270/index.js#L37-L61 |
38,589 | observing/exception | index.js | bytes | function bytes(b) {
if (!readable) return b;
var tb = ((1 << 30) * 1024)
, gb = 1 << 30
, mb = 1 << 20
, kb = 1 << 10
, abs = Math.abs(b);
if (abs >= tb) return (Math.round(b / tb * 100) / 100) + 'tb';
if (abs >= gb) return (Math.round(b / gb * 100) / 100) + 'gb';
if (abs >... | javascript | function bytes(b) {
if (!readable) return b;
var tb = ((1 << 30) * 1024)
, gb = 1 << 30
, mb = 1 << 20
, kb = 1 << 10
, abs = Math.abs(b);
if (abs >= tb) return (Math.round(b / tb * 100) / 100) + 'tb';
if (abs >= gb) return (Math.round(b / gb * 100) / 100) + 'gb';
if (abs >... | [
"function",
"bytes",
"(",
"b",
")",
"{",
"if",
"(",
"!",
"readable",
")",
"return",
"b",
";",
"var",
"tb",
"=",
"(",
"(",
"1",
"<<",
"30",
")",
"*",
"1024",
")",
",",
"gb",
"=",
"1",
"<<",
"30",
",",
"mb",
"=",
"1",
"<<",
"20",
",",
"kb",... | Make the bytes human readable if needed.
@param {Number} b Bytes
@returns {String|Number}
@api private | [
"Make",
"the",
"bytes",
"human",
"readable",
"if",
"needed",
"."
] | f6a89b51710ee858b32d6640706ae41f9bb87270 | https://github.com/observing/exception/blob/f6a89b51710ee858b32d6640706ae41f9bb87270/index.js#L140-L155 |
38,590 | BeLi4L/subz-hero | src/util/file-util.js | readBytes | async function readBytes ({ file, start, chunkSize }) {
const buffer = Buffer.alloc(chunkSize)
const fileDescriptor = await fs.open(file, 'r')
const { bytesRead } = await fs.read(
fileDescriptor,
buffer, // buffer to write to
0, // offset in the buffer to start writing at
... | javascript | async function readBytes ({ file, start, chunkSize }) {
const buffer = Buffer.alloc(chunkSize)
const fileDescriptor = await fs.open(file, 'r')
const { bytesRead } = await fs.read(
fileDescriptor,
buffer, // buffer to write to
0, // offset in the buffer to start writing at
... | [
"async",
"function",
"readBytes",
"(",
"{",
"file",
",",
"start",
",",
"chunkSize",
"}",
")",
"{",
"const",
"buffer",
"=",
"Buffer",
".",
"alloc",
"(",
"chunkSize",
")",
"const",
"fileDescriptor",
"=",
"await",
"fs",
".",
"open",
"(",
"file",
",",
"'r'... | Read `chunkSize` bytes from the given `file`, starting from byte number `start`.
@param {string} file - path to a file
@param {number} start - byte to start reading from
@param {number} chunkSize - number of bytes to read
@returns {Promise<Buffer>} | [
"Read",
"chunkSize",
"bytes",
"from",
"the",
"given",
"file",
"starting",
"from",
"byte",
"number",
"start",
"."
] | c22c6df7c2d80c00685a9326043e1ceae3cbf53d | https://github.com/BeLi4L/subz-hero/blob/c22c6df7c2d80c00685a9326043e1ceae3cbf53d/src/util/file-util.js#L22-L37 |
38,591 | rootsdev/gedcomx-js | src/atom/AtomGenerator.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof AtomGenerator)){
return new AtomGenerator(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(AtomGenerator.isInstance(json)){
... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof AtomGenerator)){
return new AtomGenerator(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(AtomGenerator.isInstance(json)){
... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"AtomGenerator",
")",
")",
"{",
"return",
"new",
"AtomGenerator",
"(",
"json",
")",
";",
"}",
"// If the given o... | The agent used to generate a feed
@see {@link https://github.com/FamilySearch/gedcomx-rs/blob/master/specifications/atom-model-specification.md#atom-json-media-type|GEDCOM X Atom JSON Spec}
@see {@link https://tools.ietf.org/html/rfc4287#section-4.2.4|RFC 4287}
@class AtomGenerator
@extends AtomCommon
@param {Object}... | [
"The",
"agent",
"used",
"to",
"generate",
"a",
"feed"
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/atom/AtomGenerator.js#L16-L29 | |
38,592 | rootsdev/gedcomx-js | src/core/Relationship.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Relationship)){
return new Relationship(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Relationship.isInstance(json)){
return json;
}
... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Relationship)){
return new Relationship(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Relationship.isInstance(json)){
return json;
}
... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Relationship",
")",
")",
"{",
"return",
"new",
"Relationship",
"(",
"json",
")",
";",
"}",
"// If the given obj... | A relationship.
@see {@link https://github.com/FamilySearch/gedcomx/blob/master/specifications/json-format-specification.md#relationship|GEDCOM X JSON Spec}
@class
@extends Subject
@param {Object} [json] | [
"A",
"relationship",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/core/Relationship.js#L13-L26 | |
38,593 | chromaway/blockchainjs | lib/storage/localstorage.js | LocalStorage | function LocalStorage (opts) {
if (!isLocalStorageSupported()) {
console.warn('localStorage not supported! (data will be stored in memory)')
}
var self = this
Storage.call(self, opts)
opts = _.extend({
keyName: 'blockchainjs_' + self.networkName
}, opts)
if (!this.compactMode) {
throw new e... | javascript | function LocalStorage (opts) {
if (!isLocalStorageSupported()) {
console.warn('localStorage not supported! (data will be stored in memory)')
}
var self = this
Storage.call(self, opts)
opts = _.extend({
keyName: 'blockchainjs_' + self.networkName
}, opts)
if (!this.compactMode) {
throw new e... | [
"function",
"LocalStorage",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"isLocalStorageSupported",
"(",
")",
")",
"{",
"console",
".",
"warn",
"(",
"'localStorage not supported! (data will be stored in memory)'",
")",
"}",
"var",
"self",
"=",
"this",
"Storage",
".",
... | Only compactMode supported
@class LocalStorage
@extends Storage
@param {Object} [opts]
@param {string} [opts.networkName=livenet]
@param {boolean} [opts.compactMode=false]
@param {string} [opts.keyName] Recommended for use with network name | [
"Only",
"compactMode",
"supported"
] | 82ae80147cc24cca42f1e1b6113ea41c45e6aae8 | https://github.com/chromaway/blockchainjs/blob/82ae80147cc24cca42f1e1b6113ea41c45e6aae8/lib/storage/localstorage.js#L80-L106 |
38,594 | rootsdev/gedcomx-js | src/rs/Links.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Links)){
return new Links(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Links.isInstance(json)){
return json;
}
... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Links)){
return new Links(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Links.isInstance(json)){
return json;
}
... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Links",
")",
")",
"{",
"return",
"new",
"Links",
"(",
"json",
")",
";",
"}",
"// If the given object is already... | A list of Links
{@link https://github.com/FamilySearch/gedcomx-rs/blob/master/specifications/rs-specification.md#json-type-member|GEDCOM X RS Spec}
@class Links
@extends Base
@param {Object} [json] | [
"A",
"list",
"of",
"Links"
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/rs/Links.js#L15-L28 | |
38,595 | rootsdev/gedcomx-js | src/rs/PlaceDisplayProperties.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof PlaceDisplayProperties)){
return new PlaceDisplayProperties(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(PlaceDisplayProper... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof PlaceDisplayProperties)){
return new PlaceDisplayProperties(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(PlaceDisplayProper... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"PlaceDisplayProperties",
")",
")",
"{",
"return",
"new",
"PlaceDisplayProperties",
"(",
"json",
")",
";",
"}",
... | A set of properties for convenience in displaying a summary of a place.
@see {@link https://github.com/FamilySearch/gedcomx-rs/blob/master/specifications/rs-specification.md#place-display-properties-data-type|GEDCOM X RS Spec}
@class PlaceDisplayProperties
@extends Base
@param {Object} [json] | [
"A",
"set",
"of",
"properties",
"for",
"convenience",
"in",
"displaying",
"a",
"summary",
"of",
"a",
"place",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/rs/PlaceDisplayProperties.js#L15-L28 | |
38,596 | eduardoportilho/trafikverket | src/train-announcement.js | getDepartures | function getDepartures (fromStationId, toStationId, fromTime, toTime) {
fromTime = fromTime || '-00:30:00'
toTime = toTime || '03:00:00'
let optionalFilters = ''
if (toStationId) {
optionalFilters += '<OR>' +
`<EQ name="ViaToLocation.LocationName" value="${toStationId}"/>` +
`<EQ name="ToLocati... | javascript | function getDepartures (fromStationId, toStationId, fromTime, toTime) {
fromTime = fromTime || '-00:30:00'
toTime = toTime || '03:00:00'
let optionalFilters = ''
if (toStationId) {
optionalFilters += '<OR>' +
`<EQ name="ViaToLocation.LocationName" value="${toStationId}"/>` +
`<EQ name="ToLocati... | [
"function",
"getDepartures",
"(",
"fromStationId",
",",
"toStationId",
",",
"fromTime",
",",
"toTime",
")",
"{",
"fromTime",
"=",
"fromTime",
"||",
"'-00:30:00'",
"toTime",
"=",
"toTime",
"||",
"'03:00:00'",
"let",
"optionalFilters",
"=",
"''",
"if",
"(",
"toS... | Query the departures from a station
@param {string} fromStationId Id of the station of departure
@param {string} toStationId Id of a station on the route of the train (optional)
@param {string} fromTime HH:mm:ss Includes trains leaving how long AFTER the current time? (default: -00:30:00)
- If the value is ne... | [
"Query",
"the",
"departures",
"from",
"a",
"station"
] | da4d4c68838ca83b29fa621e9812587d55020e0b | https://github.com/eduardoportilho/trafikverket/blob/da4d4c68838ca83b29fa621e9812587d55020e0b/src/train-announcement.js#L33-L71 |
38,597 | rootsdev/gedcomx-js | src/core/Gender.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Gender)){
return new Gender(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Gender.isInstance(json)){
return json;
}
this.init(json... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Gender)){
return new Gender(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Gender.isInstance(json)){
return json;
}
this.init(json... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Gender",
")",
")",
"{",
"return",
"new",
"Gender",
"(",
"json",
")",
";",
"}",
"// If the given object is alrea... | A gender conclusion.
@see {@link https://github.com/FamilySearch/gedcomx/blob/master/specifications/json-format-specification.md#gender-conclusion|GEDCOM X JSON Spec}
@class
@extends Conclusion
@param {Object} [json] | [
"A",
"gender",
"conclusion",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/core/Gender.js#L13-L26 | |
38,598 | AppGeo/cartodb | lib/joinclause.js | on | function on(first, operator, second) {
var data,
bool = this._bool();
switch (arguments.length) {
case 1:
{
if (typeof first === 'object' && typeof first.toSQL !== 'function') {
var i = -1,
keys = Object.keys(first);
var method = bool === '... | javascript | function on(first, operator, second) {
var data,
bool = this._bool();
switch (arguments.length) {
case 1:
{
if (typeof first === 'object' && typeof first.toSQL !== 'function') {
var i = -1,
keys = Object.keys(first);
var method = bool === '... | [
"function",
"on",
"(",
"first",
",",
"operator",
",",
"second",
")",
"{",
"var",
"data",
",",
"bool",
"=",
"this",
".",
"_bool",
"(",
")",
";",
"switch",
"(",
"arguments",
".",
"length",
")",
"{",
"case",
"1",
":",
"{",
"if",
"(",
"typeof",
"firs... | Adds an "on" clause to the current join object. | [
"Adds",
"an",
"on",
"clause",
"to",
"the",
"current",
"join",
"object",
"."
] | 4cc624975d359800961bf34cb74de97488d2efb5 | https://github.com/AppGeo/cartodb/blob/4cc624975d359800961bf34cb74de97488d2efb5/lib/joinclause.js#L24-L51 |
38,599 | rootsdev/gedcomx-js | src/records/RecordDescriptor.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof RecordDescriptor)){
return new RecordDescriptor(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(RecordDescriptor.isInstance(js... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof RecordDescriptor)){
return new RecordDescriptor(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(RecordDescriptor.isInstance(js... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"RecordDescriptor",
")",
")",
"{",
"return",
"new",
"RecordDescriptor",
"(",
"json",
")",
";",
"}",
"// If the g... | Metadata about the structure and layout of a record, as well as the expected
data to be extracted from a record.
@see {@link https://github.com/FamilySearch/gedcomx-record/blob/master/specifications/record-specification.md#record-descriptor|GEDCOM X Records Spec}
@class RecordDescriptor
@extends ExtensibleData
@param... | [
"Metadata",
"about",
"the",
"structure",
"and",
"layout",
"of",
"a",
"record",
"as",
"well",
"as",
"the",
"expected",
"data",
"to",
"be",
"extracted",
"from",
"a",
"record",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/records/RecordDescriptor.js#L15-L28 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.