id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47,300 | BlackWaspTech/wasp-graphql | _internal/configureFetch.js | configureFetch | function configureFetch(init) {
// If the user only provided a query string
if (typeof init === 'string') {
var request = {
method: init.method || 'POST',
headers: init.headers || {
'Content-Type': 'application/json',
Accept: 'application/json'
},
body: JSON.stri... | javascript | function configureFetch(init) {
// If the user only provided a query string
if (typeof init === 'string') {
var request = {
method: init.method || 'POST',
headers: init.headers || {
'Content-Type': 'application/json',
Accept: 'application/json'
},
body: JSON.stri... | [
"function",
"configureFetch",
"(",
"init",
")",
"{",
"// If the user only provided a query string\r",
"if",
"(",
"typeof",
"init",
"===",
"'string'",
")",
"{",
"var",
"request",
"=",
"{",
"method",
":",
"init",
".",
"method",
"||",
"'POST'",
",",
"headers",
":... | Generates the settings necessary for a successful GraphQL request.
@param {(string|Object)} init - Option(s) provided by the user
@returns {string} - A parsable JSON string | [
"Generates",
"the",
"settings",
"necessary",
"for",
"a",
"successful",
"GraphQL",
"request",
"."
] | 5857b82b6eda9bb5dea5f0a881cd910b1bb3944a | https://github.com/BlackWaspTech/wasp-graphql/blob/5857b82b6eda9bb5dea5f0a881cd910b1bb3944a/_internal/configureFetch.js#L11-L52 |
47,301 | feedhenry-raincatcher/raincatcher-angularjs | demo/mobile/src/app/sync/syncGlobalManager.js | createGlobalManagerService | function createGlobalManagerService($http, authService) {
//Init the sync service
syncNetworkInit.initSync($http).catch(function(error) {
logger.getLogger().error("Failed to initialize sync", error);
});
var syncManager = new SyncManager();
authService.setLoginListener(function(profileData) {
syncMana... | javascript | function createGlobalManagerService($http, authService) {
//Init the sync service
syncNetworkInit.initSync($http).catch(function(error) {
logger.getLogger().error("Failed to initialize sync", error);
});
var syncManager = new SyncManager();
authService.setLoginListener(function(profileData) {
syncMana... | [
"function",
"createGlobalManagerService",
"(",
"$http",
",",
"authService",
")",
"{",
"//Init the sync service",
"syncNetworkInit",
".",
"initSync",
"(",
"$http",
")",
".",
"catch",
"(",
"function",
"(",
"error",
")",
"{",
"logger",
".",
"getLogger",
"(",
")",
... | Service to manage init all of the sync data sets.
@param $q
@returns {{}}
@constructor | [
"Service",
"to",
"manage",
"init",
"all",
"of",
"the",
"sync",
"data",
"sets",
"."
] | b394689227901e18871ad9edd0ec226c5e6839e1 | https://github.com/feedhenry-raincatcher/raincatcher-angularjs/blob/b394689227901e18871ad9edd0ec226c5e6839e1/demo/mobile/src/app/sync/syncGlobalManager.js#L117-L131 |
47,302 | chjj/rondo | lib/io.js | function(path) {
var loc = window.location;
if (path[path.length-1] === '/') {
path = path.slice(0, -1);
}
if (~path.indexOf('//')) {
return path;
}
var auth = /^[^:\/]+:\/\/[^\/]+/.exec(loc.href)[0];
if (path[0] === '/') {
path = auth + path;
} else {
path = path.replace(/^\.?\//, ... | javascript | function(path) {
var loc = window.location;
if (path[path.length-1] === '/') {
path = path.slice(0, -1);
}
if (~path.indexOf('//')) {
return path;
}
var auth = /^[^:\/]+:\/\/[^\/]+/.exec(loc.href)[0];
if (path[0] === '/') {
path = auth + path;
} else {
path = path.replace(/^\.?\//, ... | [
"function",
"(",
"path",
")",
"{",
"var",
"loc",
"=",
"window",
".",
"location",
";",
"if",
"(",
"path",
"[",
"path",
".",
"length",
"-",
"1",
"]",
"===",
"'/'",
")",
"{",
"path",
"=",
"path",
".",
"slice",
"(",
"0",
",",
"-",
"1",
")",
";",
... | XXX this needs cleaning, add a parsePath method | [
"XXX",
"this",
"needs",
"cleaning",
"add",
"a",
"parsePath",
"method"
] | 5a0643a2e4ce74e25240517e1cf423df5a188008 | https://github.com/chjj/rondo/blob/5a0643a2e4ce74e25240517e1cf423df5a188008/lib/io.js#L51-L73 | |
47,303 | alexyoung/pop | lib/file_map.js | FileMap | function FileMap(config) {
this.config = config || {};
this.config.exclude = config && config.exclude ? config.exclude : [];
this.config.exclude.push('/_site');
this.ignoreDotFiles = true;
this.root = config.root;
this.files = [];
this.events = new EventEmitter();
this.filesLeft = 0;
this.dirsLeft = 1... | javascript | function FileMap(config) {
this.config = config || {};
this.config.exclude = config && config.exclude ? config.exclude : [];
this.config.exclude.push('/_site');
this.ignoreDotFiles = true;
this.root = config.root;
this.files = [];
this.events = new EventEmitter();
this.filesLeft = 0;
this.dirsLeft = 1... | [
"function",
"FileMap",
"(",
"config",
")",
"{",
"this",
".",
"config",
"=",
"config",
"||",
"{",
"}",
";",
"this",
".",
"config",
".",
"exclude",
"=",
"config",
"&&",
"config",
".",
"exclude",
"?",
"config",
".",
"exclude",
":",
"[",
"]",
";",
"thi... | Initialize `FileMap` with a config object.
@param {Object} options
@api public | [
"Initialize",
"FileMap",
"with",
"a",
"config",
"object",
"."
] | 8a0b3f2605cb58e8ae6b34f1373dde00610e9858 | https://github.com/alexyoung/pop/blob/8a0b3f2605cb58e8ae6b34f1373dde00610e9858/lib/file_map.js#L21-L31 |
47,304 | diosney/json2pot | utils.js | dotFlatten | function dotFlatten(object, optSep) {
let flattenedMap = {};
if (!object) {
throw new Error('`object` should be a proper Object non null nor undefined.');
}
let sep = optSep || '.';
dotFlattenFn(object, sep, flattenedMap);
return flattenedMap;
} | javascript | function dotFlatten(object, optSep) {
let flattenedMap = {};
if (!object) {
throw new Error('`object` should be a proper Object non null nor undefined.');
}
let sep = optSep || '.';
dotFlattenFn(object, sep, flattenedMap);
return flattenedMap;
} | [
"function",
"dotFlatten",
"(",
"object",
",",
"optSep",
")",
"{",
"let",
"flattenedMap",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"object",
")",
"{",
"throw",
"new",
"Error",
"(",
"'`object` should be a proper Object non null nor undefined.'",
")",
";",
"}",
"let",... | Flattens an object tree down to an object of only one level with property
names with the dotted full path to the leave data.
Ex: { 'a.b.c.d': 23, 'a.b.c.e': 54 }
Usage: `dotFlatten(object)`
Usage: `dotFlatten(object, ',')`
@param {Object} object - The object to process.
@param {String} [optSep] ... | [
"Flattens",
"an",
"object",
"tree",
"down",
"to",
"an",
"object",
"of",
"only",
"one",
"level",
"with",
"property",
"names",
"with",
"the",
"dotted",
"full",
"path",
"to",
"the",
"leave",
"data",
"."
] | a46c8dc0f479141824d05330d7b31cf72a5e8aa1 | https://github.com/diosney/json2pot/blob/a46c8dc0f479141824d05330d7b31cf72a5e8aa1/utils.js#L19-L29 |
47,305 | diosney/json2pot | utils.js | dotFlattenFn | function dotFlattenFn(object, sep, flattenedMap, optPathSoFar) {
let levelKeys = Object.keys(object);
for (let i = 0, j = levelKeys.length; i < j; i++) {
let key = levelKeys[i];
let value = object[key];
let pathSoFar = cloneDeep(optPathSoFar) || [];
pathSoFar.push(key);
if (isPlainO... | javascript | function dotFlattenFn(object, sep, flattenedMap, optPathSoFar) {
let levelKeys = Object.keys(object);
for (let i = 0, j = levelKeys.length; i < j; i++) {
let key = levelKeys[i];
let value = object[key];
let pathSoFar = cloneDeep(optPathSoFar) || [];
pathSoFar.push(key);
if (isPlainO... | [
"function",
"dotFlattenFn",
"(",
"object",
",",
"sep",
",",
"flattenedMap",
",",
"optPathSoFar",
")",
"{",
"let",
"levelKeys",
"=",
"Object",
".",
"keys",
"(",
"object",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"j",
"=",
"levelKeys",
".",
"le... | The real workhorse of the `dotFlatten` function.
A recursive function that fills a map when found the object leaves.
@param {Object} object
@param {String} sep - The separator between nested properties.
@param {Object} flattenedMap - The resulting object map of the flattening process.
@param {Ar... | [
"The",
"real",
"workhorse",
"of",
"the",
"dotFlatten",
"function",
".",
"A",
"recursive",
"function",
"that",
"fills",
"a",
"map",
"when",
"found",
"the",
"object",
"leaves",
"."
] | a46c8dc0f479141824d05330d7b31cf72a5e8aa1 | https://github.com/diosney/json2pot/blob/a46c8dc0f479141824d05330d7b31cf72a5e8aa1/utils.js#L41-L58 |
47,306 | chovy/shapeshift | index.js | get | function get(url, opts){
opts = opts || {};
return requestp(_.extend(defaults, opts, {
url: url
}));
} | javascript | function get(url, opts){
opts = opts || {};
return requestp(_.extend(defaults, opts, {
url: url
}));
} | [
"function",
"get",
"(",
"url",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"return",
"requestp",
"(",
"_",
".",
"extend",
"(",
"defaults",
",",
"opts",
",",
"{",
"url",
":",
"url",
"}",
")",
")",
";",
"}"
] | todo add support for callbacks instead of promises with options arg | [
"todo",
"add",
"support",
"for",
"callbacks",
"instead",
"of",
"promises",
"with",
"options",
"arg"
] | f6699fc7df74e10bf8fe79ee81bce5d72a47df54 | https://github.com/chovy/shapeshift/blob/f6699fc7df74e10bf8fe79ee81bce5d72a47df54/index.js#L13-L19 |
47,307 | smfoote/tornado | src/compiler/visitors/visitor.js | normalizeFns | function normalizeFns(fns) {
Object.keys(fns).forEach(function(key) {
var handler = fns[key];
if (typeof handler === 'function') {
fns[key] = {
enter: handler,
leave: noop
};
}
});
} | javascript | function normalizeFns(fns) {
Object.keys(fns).forEach(function(key) {
var handler = fns[key];
if (typeof handler === 'function') {
fns[key] = {
enter: handler,
leave: noop
};
}
});
} | [
"function",
"normalizeFns",
"(",
"fns",
")",
"{",
"Object",
".",
"keys",
"(",
"fns",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"var",
"handler",
"=",
"fns",
"[",
"key",
"]",
";",
"if",
"(",
"typeof",
"handler",
"===",
"'function'",
... | visit can be an object with enter leave or a function if it is a function, run this on enter | [
"visit",
"can",
"be",
"an",
"object",
"with",
"enter",
"leave",
"or",
"a",
"function",
"if",
"it",
"is",
"a",
"function",
"run",
"this",
"on",
"enter"
] | e70f35c56ee9887390843cce96ee8bf5fa491501 | https://github.com/smfoote/tornado/blob/e70f35c56ee9887390843cce96ee8bf5fa491501/src/compiler/visitors/visitor.js#L15-L25 |
47,308 | kengz/poly-socketio | src/global-client.js | init | function init(options) {
options = options || {}
var port = options.port || 6466
global.client = global.client || socketIOClient(`http://localhost:${port}`)
client = global.client
log.debug(`Started global js socketIO client for ${process.env.ADAPTER} at ${port}`)
client.emit('join', ioid) // first join for... | javascript | function init(options) {
options = options || {}
var port = options.port || 6466
global.client = global.client || socketIOClient(`http://localhost:${port}`)
client = global.client
log.debug(`Started global js socketIO client for ${process.env.ADAPTER} at ${port}`)
client.emit('join', ioid) // first join for... | [
"function",
"init",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
"var",
"port",
"=",
"options",
".",
"port",
"||",
"6466",
"global",
".",
"client",
"=",
"global",
".",
"client",
"||",
"socketIOClient",
"(",
"`",
"${",
"port",
... | init a global client at port | [
"init",
"a",
"global",
"client",
"at",
"port"
] | 261f84d3b4267a6d1a36eadd6526ddb45369973e | https://github.com/kengz/poly-socketio/blob/261f84d3b4267a6d1a36eadd6526ddb45369973e/src/global-client.js#L12-L26 |
47,309 | kengz/poly-socketio | src/global-client.js | pass | function pass(to, input) {
var defer = cdefer()
clientPass(defer.resolve, to, input)
return defer.promise.catch((err) => {
console.log(`global-client-js promise exception with input: ${input}, to: ${JSON.stringify(to)}`)
})
} | javascript | function pass(to, input) {
var defer = cdefer()
clientPass(defer.resolve, to, input)
return defer.promise.catch((err) => {
console.log(`global-client-js promise exception with input: ${input}, to: ${JSON.stringify(to)}`)
})
} | [
"function",
"pass",
"(",
"to",
",",
"input",
")",
"{",
"var",
"defer",
"=",
"cdefer",
"(",
")",
"clientPass",
"(",
"defer",
".",
"resolve",
",",
"to",
",",
"input",
")",
"return",
"defer",
".",
"promise",
".",
"catch",
"(",
"(",
"err",
")",
"=>",
... | Pass that returns a promise for getting client replies conveniently.
Has promise timeout of 60s; is properly binded.
@param {string|JSON} to Name of the to script, or a JSON msg containing at least to, input
@param {*} input Input for the client to pass
@return {Promise} The promise object that will be re... | [
"Pass",
"that",
"returns",
"a",
"promise",
"for",
"getting",
"client",
"replies",
"conveniently",
".",
"Has",
"promise",
"timeout",
"of",
"60s",
";",
"is",
"properly",
"binded",
"."
] | 261f84d3b4267a6d1a36eadd6526ddb45369973e | https://github.com/kengz/poly-socketio/blob/261f84d3b4267a6d1a36eadd6526ddb45369973e/src/global-client.js#L35-L41 |
47,310 | kengz/poly-socketio | src/global-client.js | cdefer | function cdefer() {
const maxWait = 20000
var resolve, reject
var promise = new Promise((...args) => {
resolve = args[0]
reject = args[1]
})
.timeout(maxWait)
return {
resolve: resolve,
reject: reject,
promise: promise
}
} | javascript | function cdefer() {
const maxWait = 20000
var resolve, reject
var promise = new Promise((...args) => {
resolve = args[0]
reject = args[1]
})
.timeout(maxWait)
return {
resolve: resolve,
reject: reject,
promise: promise
}
} | [
"function",
"cdefer",
"(",
")",
"{",
"const",
"maxWait",
"=",
"20000",
"var",
"resolve",
",",
"reject",
"var",
"promise",
"=",
"new",
"Promise",
"(",
"(",
"...",
"args",
")",
"=>",
"{",
"resolve",
"=",
"args",
"[",
"0",
"]",
"reject",
"=",
"args",
... | Promise constructor using defer pattern to expose its promise, resolve, reject. Has a timeout of 60s.
@return {defer} The Promise.defer legacy msg.
/* istanbul ignore next | [
"Promise",
"constructor",
"using",
"defer",
"pattern",
"to",
"expose",
"its",
"promise",
"resolve",
"reject",
".",
"Has",
"a",
"timeout",
"of",
"60s",
"."
] | 261f84d3b4267a6d1a36eadd6526ddb45369973e | https://github.com/kengz/poly-socketio/blob/261f84d3b4267a6d1a36eadd6526ddb45369973e/src/global-client.js#L88-L101 |
47,311 | simbo/metalsmith-better-excerpts | lib/index.js | getExcerptByMoreTag | function getExcerptByMoreTag(file, regExp) {
var excerpt = false,
contents = file.contents.toString();
contents = cheerio.load('<root>' + contents + '</root>', {decodeEntities: false})('root').html();
var match = contents.search(regExp);
if (match > -1) {
excerpt = contents.slice(0, matc... | javascript | function getExcerptByMoreTag(file, regExp) {
var excerpt = false,
contents = file.contents.toString();
contents = cheerio.load('<root>' + contents + '</root>', {decodeEntities: false})('root').html();
var match = contents.search(regExp);
if (match > -1) {
excerpt = contents.slice(0, matc... | [
"function",
"getExcerptByMoreTag",
"(",
"file",
",",
"regExp",
")",
"{",
"var",
"excerpt",
"=",
"false",
",",
"contents",
"=",
"file",
".",
"contents",
".",
"toString",
"(",
")",
";",
"contents",
"=",
"cheerio",
".",
"load",
"(",
"'<root>'",
"+",
"conten... | retrieve excerpt from file object by extracting contents until a 'more' tag
@param {Object} file file object
@param {RegExp} regExp 'more' tag regexp
@return {mixed} excerpt string or false | [
"retrieve",
"excerpt",
"from",
"file",
"object",
"by",
"extracting",
"contents",
"until",
"a",
"more",
"tag"
] | ccc9535ec8e8491eda50fabc2d433c8053435924 | https://github.com/simbo/metalsmith-better-excerpts/blob/ccc9535ec8e8491eda50fabc2d433c8053435924/lib/index.js#L57-L67 |
47,312 | simbo/metalsmith-better-excerpts | lib/index.js | getExcerptByFirstParagraph | function getExcerptByFirstParagraph(file) {
var $ = cheerio.load(file.contents.toString(), {decodeEntities: false}),
p = $('p').first(),
excerpt = p.length ? p.html().trim() : false;
if (excerpt) {
excerpt = v.unescapeHtml(excerpt);
}
return excerpt;
} | javascript | function getExcerptByFirstParagraph(file) {
var $ = cheerio.load(file.contents.toString(), {decodeEntities: false}),
p = $('p').first(),
excerpt = p.length ? p.html().trim() : false;
if (excerpt) {
excerpt = v.unescapeHtml(excerpt);
}
return excerpt;
} | [
"function",
"getExcerptByFirstParagraph",
"(",
"file",
")",
"{",
"var",
"$",
"=",
"cheerio",
".",
"load",
"(",
"file",
".",
"contents",
".",
"toString",
"(",
")",
",",
"{",
"decodeEntities",
":",
"false",
"}",
")",
",",
"p",
"=",
"$",
"(",
"'p'",
")"... | retrieve excerpt from file object by extracting the first p's contents
@param {Object} file file object
@return {mixed} excerpt string or false | [
"retrieve",
"excerpt",
"from",
"file",
"object",
"by",
"extracting",
"the",
"first",
"p",
"s",
"contents"
] | ccc9535ec8e8491eda50fabc2d433c8053435924 | https://github.com/simbo/metalsmith-better-excerpts/blob/ccc9535ec8e8491eda50fabc2d433c8053435924/lib/index.js#L76-L84 |
47,313 | quorrajs/Positron | lib/support/str.js | is | function is(pattern, value) {
if (pattern == value) return true;
pattern = regexQuote(pattern);
// Asterisks are translated into zero-or-more regular expression wildcards
// to make it convenient to check if the strings starts with the given
// pattern such as "library/*", making any string check ... | javascript | function is(pattern, value) {
if (pattern == value) return true;
pattern = regexQuote(pattern);
// Asterisks are translated into zero-or-more regular expression wildcards
// to make it convenient to check if the strings starts with the given
// pattern such as "library/*", making any string check ... | [
"function",
"is",
"(",
"pattern",
",",
"value",
")",
"{",
"if",
"(",
"pattern",
"==",
"value",
")",
"return",
"true",
";",
"pattern",
"=",
"regexQuote",
"(",
"pattern",
")",
";",
"// Asterisks are translated into zero-or-more regular expression wildcards",
"// to ma... | Determine if a given string matches a given pattern.
@param {string} pattern
@param {string} value
@return bool | [
"Determine",
"if",
"a",
"given",
"string",
"matches",
"a",
"given",
"pattern",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/support/str.js#L25-L37 |
47,314 | quorrajs/Positron | lib/support/str.js | quickRandom | function quickRandom(length) {
length = length || 16;
var pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
return str_shuffle(pool.repeat(5)).substr(0, length);
} | javascript | function quickRandom(length) {
length = length || 16;
var pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
return str_shuffle(pool.repeat(5)).substr(0, length);
} | [
"function",
"quickRandom",
"(",
"length",
")",
"{",
"length",
"=",
"length",
"||",
"16",
";",
"var",
"pool",
"=",
"'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'",
";",
"return",
"str_shuffle",
"(",
"pool",
".",
"repeat",
"(",
"5",
")",
")",
".... | Generate a "random" alpha-numeric string.
Should not be considered sufficient for cryptography, etc.
@param {number} [length]
@return {string} | [
"Generate",
"a",
"random",
"alpha",
"-",
"numeric",
"string",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/support/str.js#L77-L82 |
47,315 | Kurento/kurento-module-chroma-js | lib/complexTypes/WindowParam.js | WindowParam | function WindowParam(windowParamDict){
if(!(this instanceof WindowParam))
return new WindowParam(windowParamDict)
windowParamDict = windowParamDict || {}
// Check windowParamDict has the required fields
//
// checkType('int', 'windowParamDict.topRightCornerX', windowParamDict.topRightCornerX, {required... | javascript | function WindowParam(windowParamDict){
if(!(this instanceof WindowParam))
return new WindowParam(windowParamDict)
windowParamDict = windowParamDict || {}
// Check windowParamDict has the required fields
//
// checkType('int', 'windowParamDict.topRightCornerX', windowParamDict.topRightCornerX, {required... | [
"function",
"WindowParam",
"(",
"windowParamDict",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"WindowParam",
")",
")",
"return",
"new",
"WindowParam",
"(",
"windowParamDict",
")",
"windowParamDict",
"=",
"windowParamDict",
"||",
"{",
"}",
"// Check win... | Parameter representing a window in a video stream.
It is used in command and constructor for media elements.
All units are in pixels, X runs from left to right, Y from top to bottom.
@constructor module:chroma/complexTypes.WindowParam
@property {external:Integer} topRightCornerX
X coordinate of the left upper point o... | [
"Parameter",
"representing",
"a",
"window",
"in",
"a",
"video",
"stream",
".",
"It",
"is",
"used",
"in",
"command",
"and",
"constructor",
"for",
"media",
"elements",
".",
"All",
"units",
"are",
"in",
"pixels",
"X",
"runs",
"from",
"left",
"to",
"right",
... | 4cd3a7504016bfb4cfd469be751a016a644fc0ba | https://github.com/Kurento/kurento-module-chroma-js/blob/4cd3a7504016bfb4cfd469be751a016a644fc0ba/lib/complexTypes/WindowParam.js#L45-L88 |
47,316 | brewster/imagine | lib/imagine/source_downloader.js | function () {
// Create request options from parsed source URL
var options = url.parse(this.source, false);
// Add on some defaults
extend(options, {
method: 'get',
headers: {
host: options.host,
accept: 'image/*'
}
});
// Determine https/http from source URL
... | javascript | function () {
// Create request options from parsed source URL
var options = url.parse(this.source, false);
// Add on some defaults
extend(options, {
method: 'get',
headers: {
host: options.host,
accept: 'image/*'
}
});
// Determine https/http from source URL
... | [
"function",
"(",
")",
"{",
"// Create request options from parsed source URL",
"var",
"options",
"=",
"url",
".",
"parse",
"(",
"this",
".",
"source",
",",
"false",
")",
";",
"// Add on some defaults",
"extend",
"(",
"options",
",",
"{",
"method",
":",
"'get'",
... | Simply start the request when we're ready to go | [
"Simply",
"start",
"the",
"request",
"when",
"we",
"re",
"ready",
"to",
"go"
] | 42782ff6365f225f1fb9d90d3a654791286ef023 | https://github.com/brewster/imagine/blob/42782ff6365f225f1fb9d90d3a654791286ef023/lib/imagine/source_downloader.js#L18-L43 | |
47,317 | excellalabs/ngComponentRouter | angular_1_router.js | normalizeRouteConfig | function normalizeRouteConfig(config, registry) {
if (config instanceof route_config_decorator_1.AsyncRoute) {
var wrappedLoader = wrapLoaderToReconfigureRegistry(config.loader, registry);
return new route_config_decorator_1.AsyncRoute({
path: config.path,
loader: wrappedLoad... | javascript | function normalizeRouteConfig(config, registry) {
if (config instanceof route_config_decorator_1.AsyncRoute) {
var wrappedLoader = wrapLoaderToReconfigureRegistry(config.loader, registry);
return new route_config_decorator_1.AsyncRoute({
path: config.path,
loader: wrappedLoad... | [
"function",
"normalizeRouteConfig",
"(",
"config",
",",
"registry",
")",
"{",
"if",
"(",
"config",
"instanceof",
"route_config_decorator_1",
".",
"AsyncRoute",
")",
"{",
"var",
"wrappedLoader",
"=",
"wrapLoaderToReconfigureRegistry",
"(",
"config",
".",
"loader",
",... | Given a JS Object that represents a route config, returns a corresponding Route, AsyncRoute,
AuxRoute or Redirect object.
Also wraps an AsyncRoute's loader function to add the loaded component's route config to the
`RouteRegistry`. | [
"Given",
"a",
"JS",
"Object",
"that",
"represents",
"a",
"route",
"config",
"returns",
"a",
"corresponding",
"Route",
"AsyncRoute",
"AuxRoute",
"or",
"Redirect",
"object",
"."
] | b2240385bf542987916e07aa0d8712c962963f2d | https://github.com/excellalabs/ngComponentRouter/blob/b2240385bf542987916e07aa0d8712c962963f2d/angular_1_router.js#L1134-L1201 |
47,318 | excellalabs/ngComponentRouter | angular_1_router.js | ParamRoutePath | function ParamRoutePath(routePath) {
this.routePath = routePath;
this.terminal = true;
this._assertValidPath(routePath);
this._parsePathString(routePath);
this.specificity = this._calculateSpecificity();
this.hash = this._calculateHash();
var lastSegment = this._s... | javascript | function ParamRoutePath(routePath) {
this.routePath = routePath;
this.terminal = true;
this._assertValidPath(routePath);
this._parsePathString(routePath);
this.specificity = this._calculateSpecificity();
this.hash = this._calculateHash();
var lastSegment = this._s... | [
"function",
"ParamRoutePath",
"(",
"routePath",
")",
"{",
"this",
".",
"routePath",
"=",
"routePath",
";",
"this",
".",
"terminal",
"=",
"true",
";",
"this",
".",
"_assertValidPath",
"(",
"routePath",
")",
";",
"this",
".",
"_parsePathString",
"(",
"routePat... | Takes a string representing the matcher DSL | [
"Takes",
"a",
"string",
"representing",
"the",
"matcher",
"DSL"
] | b2240385bf542987916e07aa0d8712c962963f2d | https://github.com/excellalabs/ngComponentRouter/blob/b2240385bf542987916e07aa0d8712c962963f2d/angular_1_router.js#L1610-L1619 |
47,319 | gurmukhp/gulp-svg-json-spritesheet | index.js | convertToJson | function convertToJson(callback) {
var output = new File(file);
output.contents = new Buffer(JSON.stringify(spritesheet, null, '\t'));
output.path = file;
this.push(output);
callback();
} | javascript | function convertToJson(callback) {
var output = new File(file);
output.contents = new Buffer(JSON.stringify(spritesheet, null, '\t'));
output.path = file;
this.push(output);
callback();
} | [
"function",
"convertToJson",
"(",
"callback",
")",
"{",
"var",
"output",
"=",
"new",
"File",
"(",
"file",
")",
";",
"output",
".",
"contents",
"=",
"new",
"Buffer",
"(",
"JSON",
".",
"stringify",
"(",
"spritesheet",
",",
"null",
",",
"'\\t'",
")",
")",... | Once all files have been compressed, return compressed JSON file.
@param {Function} callback | [
"Once",
"all",
"files",
"have",
"been",
"compressed",
"return",
"compressed",
"JSON",
"file",
"."
] | 393f629cad491365c0fc65b290b81f036432d50a | https://github.com/gurmukhp/gulp-svg-json-spritesheet/blob/393f629cad491365c0fc65b290b81f036432d50a/index.js#L64-L70 |
47,320 | freshout-dev/thulium | lib/Thulium/Parser.js | function( callback ){
var tm = this;
setTimeout(function () {
var returnValue;
//check for template existance.
if (tm.template) {
tm._tokenize();
returnValue = tm._tokens;
// execute callback.
if (callback) {
callback( returnValu... | javascript | function( callback ){
var tm = this;
setTimeout(function () {
var returnValue;
//check for template existance.
if (tm.template) {
tm._tokenize();
returnValue = tm._tokens;
// execute callback.
if (callback) {
callback( returnValu... | [
"function",
"(",
"callback",
")",
"{",
"var",
"tm",
"=",
"this",
";",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"var",
"returnValue",
";",
"//check for template existance.",
"if",
"(",
"tm",
".",
"template",
")",
"{",
"tm",
".",
"_tokenize",
"(",
")"... | Creates the token array and sends them to a callback | [
"Creates",
"the",
"token",
"array",
"and",
"sends",
"them",
"to",
"a",
"callback"
] | ba3173e700fbe810ce13063e7ad46e9b05bb49e7 | https://github.com/freshout-dev/thulium/blob/ba3173e700fbe810ce13063e7ad46e9b05bb49e7/lib/Thulium/Parser.js#L75-L94 | |
47,321 | freshout-dev/thulium | lib/Thulium/Parser.js | function () {
var i;
i = this._openPrints.indexOf(this._openBrackets);
// if print indicators where found
if (i >= 0) {
// close it
this._tokens.push({
type : "closePrintIndicator"
});
// remove the print from the stack
this._openPrints.splice(i... | javascript | function () {
var i;
i = this._openPrints.indexOf(this._openBrackets);
// if print indicators where found
if (i >= 0) {
// close it
this._tokens.push({
type : "closePrintIndicator"
});
// remove the print from the stack
this._openPrints.splice(i... | [
"function",
"(",
")",
"{",
"var",
"i",
";",
"i",
"=",
"this",
".",
"_openPrints",
".",
"indexOf",
"(",
"this",
".",
"_openBrackets",
")",
";",
"// if print indicators where found",
"if",
"(",
"i",
">=",
"0",
")",
"{",
"// close it",
"this",
".",
"_tokens... | Remove the printIndicator buffer if no open brackets were found. | [
"Remove",
"the",
"printIndicator",
"buffer",
"if",
"no",
"open",
"brackets",
"were",
"found",
"."
] | ba3173e700fbe810ce13063e7ad46e9b05bb49e7 | https://github.com/freshout-dev/thulium/blob/ba3173e700fbe810ce13063e7ad46e9b05bb49e7/lib/Thulium/Parser.js#L249-L262 | |
47,322 | mgcrea/gulp-nginclude | src/index.js | readSource | function readSource(src) {
var cwd = path.dirname(file.path);
if (options.assetsDirs && options.assetsDirs.length) {
var basename = path.basename(cwd);
if (options.assetsDirs.indexOf(basename) === -1) {
options.assetsDirs.unshift(path.basename(cwd));
}
src = path.jo... | javascript | function readSource(src) {
var cwd = path.dirname(file.path);
if (options.assetsDirs && options.assetsDirs.length) {
var basename = path.basename(cwd);
if (options.assetsDirs.indexOf(basename) === -1) {
options.assetsDirs.unshift(path.basename(cwd));
}
src = path.jo... | [
"function",
"readSource",
"(",
"src",
")",
"{",
"var",
"cwd",
"=",
"path",
".",
"dirname",
"(",
"file",
".",
"path",
")",
";",
"if",
"(",
"options",
".",
"assetsDirs",
"&&",
"options",
".",
"assetsDirs",
".",
"length",
")",
"{",
"var",
"basename",
"=... | This function receives an ng-include src and tries to read it from the filesystem | [
"This",
"function",
"receives",
"an",
"ng",
"-",
"include",
"src",
"and",
"tries",
"to",
"read",
"it",
"from",
"the",
"filesystem"
] | d9bfbf6c5d0f120f67827aa42fdb98ddc9177862 | https://github.com/mgcrea/gulp-nginclude/blob/d9bfbf6c5d0f120f67827aa42fdb98ddc9177862/src/index.js#L25-L38 |
47,323 | edus44/express-deliver | lib/response/success.js | normalizeResult | function normalizeResult(result){
if (!result || result._isResponseData !== true)
return ResponseData(result,{default:true})
return result
} | javascript | function normalizeResult(result){
if (!result || result._isResponseData !== true)
return ResponseData(result,{default:true})
return result
} | [
"function",
"normalizeResult",
"(",
"result",
")",
"{",
"if",
"(",
"!",
"result",
"||",
"result",
".",
"_isResponseData",
"!==",
"true",
")",
"return",
"ResponseData",
"(",
"result",
",",
"{",
"default",
":",
"true",
"}",
")",
"return",
"result",
"}"
] | Tries to return a ResponseData object
@param {any} result
@return {ResponseData} | [
"Tries",
"to",
"return",
"a",
"ResponseData",
"object"
] | 895abfaf2e5e48a00b4fef943dccaffcbf244780 | https://github.com/edus44/express-deliver/blob/895abfaf2e5e48a00b4fef943dccaffcbf244780/lib/response/success.js#L25-L29 |
47,324 | edus44/express-deliver | lib/response/success.js | defaultTransformSuccess | function defaultTransformSuccess(value,options){
if (options.default === true){
return {
status:true,
data:value
}
}
if (options.appendStatus !== false){
let obj = typeof value == 'object' ? value : {}
return Object.assign(obj,{status:true})
}... | javascript | function defaultTransformSuccess(value,options){
if (options.default === true){
return {
status:true,
data:value
}
}
if (options.appendStatus !== false){
let obj = typeof value == 'object' ? value : {}
return Object.assign(obj,{status:true})
}... | [
"function",
"defaultTransformSuccess",
"(",
"value",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"default",
"===",
"true",
")",
"{",
"return",
"{",
"status",
":",
"true",
",",
"data",
":",
"value",
"}",
"}",
"if",
"(",
"options",
".",
"appendS... | Transform the responseData
@param {any} value
@param {Object} options
@param {Request} req
@returns {Object} | [
"Transform",
"the",
"responseData"
] | 895abfaf2e5e48a00b4fef943dccaffcbf244780 | https://github.com/edus44/express-deliver/blob/895abfaf2e5e48a00b4fef943dccaffcbf244780/lib/response/success.js#L40-L54 |
47,325 | fibo/strict-mode | index.js | strictMode | function strictMode (callback) {
'use strict'
// The module api is in *Locked* state, so it will not change
// see http://nodejs.org/api/modules.html
// that is why I just copyed and pasted the orig module wrapper.
//
// By the way, in test.js there is a test that checks if the content of
// *origWrapper... | javascript | function strictMode (callback) {
'use strict'
// The module api is in *Locked* state, so it will not change
// see http://nodejs.org/api/modules.html
// that is why I just copyed and pasted the orig module wrapper.
//
// By the way, in test.js there is a test that checks if the content of
// *origWrapper... | [
"function",
"strictMode",
"(",
"callback",
")",
"{",
"'use strict'",
"// The module api is in *Locked* state, so it will not change",
"// see http://nodejs.org/api/modules.html",
"// that is why I just copyed and pasted the orig module wrapper.",
"//",
"// By the way, in test.js there is a tes... | Wraps module `exports`
See [Usage](http://g14n.info/strict-mode#usage)
@param {Function} callback containing caller package's exports statements | [
"Wraps",
"module",
"exports"
] | f0039a08bdd7835af64610cafdd2caab554cd700 | https://github.com/fibo/strict-mode/blob/f0039a08bdd7835af64610cafdd2caab554cd700/index.js#L9-L50 |
47,326 | sapegin/textlint-rule-diacritics | index.js | getWords | function getWords(words) {
const defaults = loadJson('./words.json');
const extras = typeof words === 'string' ? loadJson(words) : words;
return defaults.concat(extras);
} | javascript | function getWords(words) {
const defaults = loadJson('./words.json');
const extras = typeof words === 'string' ? loadJson(words) : words;
return defaults.concat(extras);
} | [
"function",
"getWords",
"(",
"words",
")",
"{",
"const",
"defaults",
"=",
"loadJson",
"(",
"'./words.json'",
")",
";",
"const",
"extras",
"=",
"typeof",
"words",
"===",
"'string'",
"?",
"loadJson",
"(",
"words",
")",
":",
"words",
";",
"return",
"defaults"... | Load all default words joined with additional worsd from a config file
@param {string|string[]} words
@return {string[]} | [
"Load",
"all",
"default",
"words",
"joined",
"with",
"additional",
"worsd",
"from",
"a",
"config",
"file"
] | 5dcb40c9ec128bc147325783ed4859fa66baaecf | https://github.com/sapegin/textlint-rule-diacritics/blob/5dcb40c9ec128bc147325783ed4859fa66baaecf/index.js#L54-L58 |
47,327 | sapegin/textlint-rule-diacritics | index.js | loadJson | function loadJson(filepath) {
const json = fs.readFileSync(require.resolve(filepath), 'utf8');
return JSON.parse(stripJsonComments(json));
} | javascript | function loadJson(filepath) {
const json = fs.readFileSync(require.resolve(filepath), 'utf8');
return JSON.parse(stripJsonComments(json));
} | [
"function",
"loadJson",
"(",
"filepath",
")",
"{",
"const",
"json",
"=",
"fs",
".",
"readFileSync",
"(",
"require",
".",
"resolve",
"(",
"filepath",
")",
",",
"'utf8'",
")",
";",
"return",
"JSON",
".",
"parse",
"(",
"stripJsonComments",
"(",
"json",
")",... | Load JSON file, strip comments.
@param {string} filepath
@return {object} | [
"Load",
"JSON",
"file",
"strip",
"comments",
"."
] | 5dcb40c9ec128bc147325783ed4859fa66baaecf | https://github.com/sapegin/textlint-rule-diacritics/blob/5dcb40c9ec128bc147325783ed4859fa66baaecf/index.js#L66-L69 |
47,328 | sapegin/textlint-rule-diacritics | index.js | getCorrection | function getCorrection(words, match) {
for (const word of words) {
const pattern = getPattern(word);
if (!getRegExp([pattern]).test(match)) {
continue;
}
const corrected = match.replace(new RegExp(`\\b${pattern}`, 'i'), word);
return matchCasing(corrected, match);
}
return false;
} | javascript | function getCorrection(words, match) {
for (const word of words) {
const pattern = getPattern(word);
if (!getRegExp([pattern]).test(match)) {
continue;
}
const corrected = match.replace(new RegExp(`\\b${pattern}`, 'i'), word);
return matchCasing(corrected, match);
}
return false;
} | [
"function",
"getCorrection",
"(",
"words",
",",
"match",
")",
"{",
"for",
"(",
"const",
"word",
"of",
"words",
")",
"{",
"const",
"pattern",
"=",
"getPattern",
"(",
"word",
")",
";",
"if",
"(",
"!",
"getRegExp",
"(",
"[",
"pattern",
"]",
")",
".",
... | Return a correct word based on found incorrect word.
Keeps case and suffix of an original word.
@param {string[]} words
@param {string} match
@return {string|boolean} | [
"Return",
"a",
"correct",
"word",
"based",
"on",
"found",
"incorrect",
"word",
".",
"Keeps",
"case",
"and",
"suffix",
"of",
"an",
"original",
"word",
"."
] | 5dcb40c9ec128bc147325783ed4859fa66baaecf | https://github.com/sapegin/textlint-rule-diacritics/blob/5dcb40c9ec128bc147325783ed4859fa66baaecf/index.js#L127-L139 |
47,329 | brewster/imagine | lib/imagine/server.js | function () {
// Determine https vs. http
this.server = this.ssl ?
https.createServer(this.ssl) :
http.createServer();
// Bind to the request
this.server.on('request', this.handle.bind(this));
} | javascript | function () {
// Determine https vs. http
this.server = this.ssl ?
https.createServer(this.ssl) :
http.createServer();
// Bind to the request
this.server.on('request', this.handle.bind(this));
} | [
"function",
"(",
")",
"{",
"// Determine https vs. http",
"this",
".",
"server",
"=",
"this",
".",
"ssl",
"?",
"https",
".",
"createServer",
"(",
"this",
".",
"ssl",
")",
":",
"http",
".",
"createServer",
"(",
")",
";",
"// Bind to the request",
"this",
".... | Create a new server | [
"Create",
"a",
"new",
"server"
] | 42782ff6365f225f1fb9d90d3a654791286ef023 | https://github.com/brewster/imagine/blob/42782ff6365f225f1fb9d90d3a654791286ef023/lib/imagine/server.js#L43-L51 | |
47,330 | partageit/vegetables | lib/generate.js | function(folder, dest) {
try {
fs.mkdirSync(dest, '0755');
} catch (e) {}
var files = fs.readdirSync(folder);
var indexFile = templatesManager.getFolderIndex(files);
logger.debug('Index file for "%s": "%s"', folder, indexFile);
files.forEach(function(file) {
if (config.exclude.indexOf(file) === -1) {
... | javascript | function(folder, dest) {
try {
fs.mkdirSync(dest, '0755');
} catch (e) {}
var files = fs.readdirSync(folder);
var indexFile = templatesManager.getFolderIndex(files);
logger.debug('Index file for "%s": "%s"', folder, indexFile);
files.forEach(function(file) {
if (config.exclude.indexOf(file) === -1) {
... | [
"function",
"(",
"folder",
",",
"dest",
")",
"{",
"try",
"{",
"fs",
".",
"mkdirSync",
"(",
"dest",
",",
"'0755'",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"}",
"var",
"files",
"=",
"fs",
".",
"readdirSync",
"(",
"folder",
")",
";",
"var",
"i... | filename => filename, path, versions Function to discover Markdown files and copy media files | [
"filename",
"=",
">",
"filename",
"path",
"versions",
"Function",
"to",
"discover",
"Markdown",
"files",
"and",
"copy",
"media",
"files"
] | 1aca3ee726885427974e3f0f88e6c2f5fe884e74 | https://github.com/partageit/vegetables/blob/1aca3ee726885427974e3f0f88e6c2f5fe884e74/lib/generate.js#L28-L62 | |
47,331 | partageit/vegetables | lib/generate.js | function(commands) {
if (!commands || (commands.length === 0)) {
return true;
}
if (typeof commands === 'string') {
commands = [commands];
}
return commands.every(function(command) {
logger.info('Starting command "%s"...', command);
var result = exec(
command,
{cwd: path.resolve('.')}
)... | javascript | function(commands) {
if (!commands || (commands.length === 0)) {
return true;
}
if (typeof commands === 'string') {
commands = [commands];
}
return commands.every(function(command) {
logger.info('Starting command "%s"...', command);
var result = exec(
command,
{cwd: path.resolve('.')}
)... | [
"function",
"(",
"commands",
")",
"{",
"if",
"(",
"!",
"commands",
"||",
"(",
"commands",
".",
"length",
"===",
"0",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"typeof",
"commands",
"===",
"'string'",
")",
"{",
"commands",
"=",
"[",
"com... | Function to start before and after commands | [
"Function",
"to",
"start",
"before",
"and",
"after",
"commands"
] | 1aca3ee726885427974e3f0f88e6c2f5fe884e74 | https://github.com/partageit/vegetables/blob/1aca3ee726885427974e3f0f88e6c2f5fe884e74/lib/generate.js#L65-L86 | |
47,332 | edloidas/roll-parser | src/roller.js | rollClassic | function rollClassic( roll ) {
const data = roll instanceof Roll ? roll : convertToRoll( roll );
const { dice, count, modifier } = data;
const rolls = [ ...new Array( count ) ].map(() => randomRoll( dice ));
const summ = rolls.reduce(( prev, curr ) => prev + curr, 0 );
const result = normalizeRollResult( sum... | javascript | function rollClassic( roll ) {
const data = roll instanceof Roll ? roll : convertToRoll( roll );
const { dice, count, modifier } = data;
const rolls = [ ...new Array( count ) ].map(() => randomRoll( dice ));
const summ = rolls.reduce(( prev, curr ) => prev + curr, 0 );
const result = normalizeRollResult( sum... | [
"function",
"rollClassic",
"(",
"roll",
")",
"{",
"const",
"data",
"=",
"roll",
"instanceof",
"Roll",
"?",
"roll",
":",
"convertToRoll",
"(",
"roll",
")",
";",
"const",
"{",
"dice",
",",
"count",
",",
"modifier",
"}",
"=",
"data",
";",
"const",
"rolls"... | Rolls the dice from `Roll` object.
@func
@since v2.0.0
@param {Roll} roll - `Roll` object or similar
@return {Result}
@see roll
@see rollWod
@example
rollClassic(new Roll(10, 2, -1)); //=> { notation: '2d10-1', value: 14, rolls: [ 7, 8 ] }
rollClassic({ dice: 6 }); //=> { notation: 'd6', value: 4, rolls: [ 4 ] } | [
"Rolls",
"the",
"dice",
"from",
"Roll",
"object",
"."
] | 38912b298edb0a4d67ba1c796d7ac159ebaf7901 | https://github.com/edloidas/roll-parser/blob/38912b298edb0a4d67ba1c796d7ac159ebaf7901/src/roller.js#L22-L31 |
47,333 | edloidas/roll-parser | src/roller.js | rollWod | function rollWod( roll ) {
const data = roll instanceof WodRoll ? roll : convertToWodRoll( roll );
const { dice, count, again, success, fail } = data;
const rolls = [];
let i = count;
while ( i > 0 ) {
const value = randomRoll( dice );
rolls.push( value );
// Check for "10 Again" flag
// `re... | javascript | function rollWod( roll ) {
const data = roll instanceof WodRoll ? roll : convertToWodRoll( roll );
const { dice, count, again, success, fail } = data;
const rolls = [];
let i = count;
while ( i > 0 ) {
const value = randomRoll( dice );
rolls.push( value );
// Check for "10 Again" flag
// `re... | [
"function",
"rollWod",
"(",
"roll",
")",
"{",
"const",
"data",
"=",
"roll",
"instanceof",
"WodRoll",
"?",
"roll",
":",
"convertToWodRoll",
"(",
"roll",
")",
";",
"const",
"{",
"dice",
",",
"count",
",",
"again",
",",
"success",
",",
"fail",
"}",
"=",
... | Rolls the dice from `WodRoll` object.
@func
@since v2.0.0
@param {WodRoll} roll - `WodRoll` object or similar
@return {Result}
@see roll
@see rollClassic
@example
rollWod(new WodRoll(10, 4, true, 8)); //=> { notation: '4d10!>8', value: 2, rolls: [3,10,7,9,5] }
rollWod({ dice: 8, count: 3 }); //=> { notation: '3d8>6', ... | [
"Rolls",
"the",
"dice",
"from",
"WodRoll",
"object",
"."
] | 38912b298edb0a4d67ba1c796d7ac159ebaf7901 | https://github.com/edloidas/roll-parser/blob/38912b298edb0a4d67ba1c796d7ac159ebaf7901/src/roller.js#L46-L74 |
47,334 | edloidas/roll-parser | src/roller.js | rollAny | function rollAny( roll ) {
if ( roll instanceof Roll ) {
return rollClassic( roll );
} else if ( roll instanceof WodRoll ) {
return rollWod( roll );
}
return isDefined( roll ) ? rollAny( convertToAnyRoll( roll )) : null;
} | javascript | function rollAny( roll ) {
if ( roll instanceof Roll ) {
return rollClassic( roll );
} else if ( roll instanceof WodRoll ) {
return rollWod( roll );
}
return isDefined( roll ) ? rollAny( convertToAnyRoll( roll )) : null;
} | [
"function",
"rollAny",
"(",
"roll",
")",
"{",
"if",
"(",
"roll",
"instanceof",
"Roll",
")",
"{",
"return",
"rollClassic",
"(",
"roll",
")",
";",
"}",
"else",
"if",
"(",
"roll",
"instanceof",
"WodRoll",
")",
"{",
"return",
"rollWod",
"(",
"roll",
")",
... | Rolls the dice from `Roll` or `WodRoll` objects.
@func
@alias roll
@since v2.0.0
@param {Roll|WodRoll|Object} roll - `Roll`, `WodRoll` or similar object.
@return {Result} Returns `Result` for defined parameters, otherwise returns `null`.
@see rollClassic
@see rollWod
@example
roll(new Roll(10, 2, -1)); //=> { notation... | [
"Rolls",
"the",
"dice",
"from",
"Roll",
"or",
"WodRoll",
"objects",
"."
] | 38912b298edb0a4d67ba1c796d7ac159ebaf7901 | https://github.com/edloidas/roll-parser/blob/38912b298edb0a4d67ba1c796d7ac159ebaf7901/src/roller.js#L93-L100 |
47,335 | luoyjx/koa-rest-mongoose | lib/index.js | KoaRestMongoose | function KoaRestMongoose(options) {
if (!(this instanceof KoaRestMongoose)) {
return new KoaRestMongoose(options);
}
options = options || {};
debug('options: ', options);
// api url prefix
this.prefix = null;
if (options.prefix !== null && typeof options.prefix !== 'undefined') {
// add `/` if... | javascript | function KoaRestMongoose(options) {
if (!(this instanceof KoaRestMongoose)) {
return new KoaRestMongoose(options);
}
options = options || {};
debug('options: ', options);
// api url prefix
this.prefix = null;
if (options.prefix !== null && typeof options.prefix !== 'undefined') {
// add `/` if... | [
"function",
"KoaRestMongoose",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"KoaRestMongoose",
")",
")",
"{",
"return",
"new",
"KoaRestMongoose",
"(",
"options",
")",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"debu... | Create a KoaRestMongoose instance.
@param {Object} options | [
"Create",
"a",
"KoaRestMongoose",
"instance",
"."
] | 322e4b6623ff0f708df383c7dd76bee76e90be81 | https://github.com/luoyjx/koa-rest-mongoose/blob/322e4b6623ff0f708df383c7dd76bee76e90be81/lib/index.js#L21-L64 |
47,336 | fex-team/yog-bigpipe | scripts/bigpipe.js | function () {
var i, len;
// eval scripts.
if (data.scripts && data.scripts.length) {
for (i = 0, len = data.scripts.length; i < len; i++) {
Util.globalEval(data.scripts[i]);
}
... | javascript | function () {
var i, len;
// eval scripts.
if (data.scripts && data.scripts.length) {
for (i = 0, len = data.scripts.length; i < len; i++) {
Util.globalEval(data.scripts[i]);
}
... | [
"function",
"(",
")",
"{",
"var",
"i",
",",
"len",
";",
"// eval scripts.",
"if",
"(",
"data",
".",
"scripts",
"&&",
"data",
".",
"scripts",
".",
"length",
")",
"{",
"for",
"(",
"i",
"=",
"0",
",",
"len",
"=",
"data",
".",
"scripts",
".",
"length... | exec data.scripts | [
"exec",
"data",
".",
"scripts"
] | 5c9c761d1940f1ea5b4d46b9f1ed3da8a20db21d | https://github.com/fex-team/yog-bigpipe/blob/5c9c761d1940f1ea5b4d46b9f1ed3da8a20db21d/scripts/bigpipe.js#L419-L430 | |
47,337 | fex-team/yog-bigpipe | scripts/bigpipe.js | function (obj) {
if (!resourceChecked) {
Util.saveLoadedRes();
resourceChecked = true;
}
currReqID = obj.reqID;
// console.log('arrive', obj.id);
this.trigger('pageletarrive', obj);
va... | javascript | function (obj) {
if (!resourceChecked) {
Util.saveLoadedRes();
resourceChecked = true;
}
currReqID = obj.reqID;
// console.log('arrive', obj.id);
this.trigger('pageletarrive', obj);
va... | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"resourceChecked",
")",
"{",
"Util",
".",
"saveLoadedRes",
"(",
")",
";",
"resourceChecked",
"=",
"true",
";",
"}",
"currReqID",
"=",
"obj",
".",
"reqID",
";",
"// console.log('arrive', obj.id);",
"this",
"... | This is method will be executed automaticlly. - after chunk output pagelet. - after async load quickling pagelet. | [
"This",
"is",
"method",
"will",
"be",
"executed",
"automaticlly",
".",
"-",
"after",
"chunk",
"output",
"pagelet",
".",
"-",
"after",
"async",
"load",
"quickling",
"pagelet",
"."
] | 5c9c761d1940f1ea5b4d46b9f1ed3da8a20db21d | https://github.com/fex-team/yog-bigpipe/blob/5c9c761d1940f1ea5b4d46b9f1ed3da8a20db21d/scripts/bigpipe.js#L465-L493 | |
47,338 | willmark/file-compare | index.js | checkCommonArgs | function checkCommonArgs(args) {
if (args.length < 2) throw new Error("File1, File2, and callback required");
if (typeof args.at(1) != "string") throw new Error("File2 required");
if (typeof args.at(0) != "string") throw new Error("File1 required");
if (!args.callbackGiven()) throw new E... | javascript | function checkCommonArgs(args) {
if (args.length < 2) throw new Error("File1, File2, and callback required");
if (typeof args.at(1) != "string") throw new Error("File2 required");
if (typeof args.at(0) != "string") throw new Error("File1 required");
if (!args.callbackGiven()) throw new E... | [
"function",
"checkCommonArgs",
"(",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
"<",
"2",
")",
"throw",
"new",
"Error",
"(",
"\"File1, File2, and callback required\"",
")",
";",
"if",
"(",
"typeof",
"args",
".",
"at",
"(",
"1",
")",
"!=",
"\"stri... | Common argument checking for crop and resize | [
"Common",
"argument",
"checking",
"for",
"crop",
"and",
"resize"
] | 1878fef8d54c527a5106e1995c4557251d9bd550 | https://github.com/willmark/file-compare/blob/1878fef8d54c527a5106e1995c4557251d9bd550/index.js#L19-L24 |
47,339 | willmark/file-compare | index.js | computeHash | function computeHash(filename, algo, callback) {
var crypto = require('crypto');
var fs = require('fs');
var chksum = crypto.createHash(algo);
var s = fs.ReadStream(filename);
s.on('error', function (err) {
//no file, hash will be zero
callback(0, err);
});
s.on('data', fun... | javascript | function computeHash(filename, algo, callback) {
var crypto = require('crypto');
var fs = require('fs');
var chksum = crypto.createHash(algo);
var s = fs.ReadStream(filename);
s.on('error', function (err) {
//no file, hash will be zero
callback(0, err);
});
s.on('data', fun... | [
"function",
"computeHash",
"(",
"filename",
",",
"algo",
",",
"callback",
")",
"{",
"var",
"crypto",
"=",
"require",
"(",
"'crypto'",
")",
";",
"var",
"fs",
"=",
"require",
"(",
"'fs'",
")",
";",
"var",
"chksum",
"=",
"crypto",
".",
"createHash",
"(",
... | Create a new hash of given file name | [
"Create",
"a",
"new",
"hash",
"of",
"given",
"file",
"name"
] | 1878fef8d54c527a5106e1995c4557251d9bd550 | https://github.com/willmark/file-compare/blob/1878fef8d54c527a5106e1995c4557251d9bd550/index.js#L54-L74 |
47,340 | edloidas/roll-parser | src/object/WodRoll.js | WodRoll | function WodRoll( dice = 10, count = 1, again = false, success = 6, fail ) {
this.dice = positiveInteger( dice );
this.count = positiveInteger( count );
this.again = !!again;
[ this.fail, this.success ] = normalizeWodBorders( fail, success, this.dice );
} | javascript | function WodRoll( dice = 10, count = 1, again = false, success = 6, fail ) {
this.dice = positiveInteger( dice );
this.count = positiveInteger( count );
this.again = !!again;
[ this.fail, this.success ] = normalizeWodBorders( fail, success, this.dice );
} | [
"function",
"WodRoll",
"(",
"dice",
"=",
"10",
",",
"count",
"=",
"1",
",",
"again",
"=",
"false",
",",
"success",
"=",
"6",
",",
"fail",
")",
"{",
"this",
".",
"dice",
"=",
"positiveInteger",
"(",
"dice",
")",
";",
"this",
".",
"count",
"=",
"po... | A class that represents a dice roll from World of Darkness setting
@class
@classdesc A class that represents a dice roll from World of Darkness setting
@since v2.0.0
@param {Number} dice - A number of dice faces
@param {Number} count - A number of dices
@param {Boolean} again - A flag for "10 Again" rolls policy
@param... | [
"A",
"class",
"that",
"represents",
"a",
"dice",
"roll",
"from",
"World",
"of",
"Darkness",
"setting"
] | 38912b298edb0a4d67ba1c796d7ac159ebaf7901 | https://github.com/edloidas/roll-parser/blob/38912b298edb0a4d67ba1c796d7ac159ebaf7901/src/object/WodRoll.js#L18-L23 |
47,341 | bestander/pong-box2d | physics/box2dPhysics.js | Physics | function Physics(width, height, ballRadius) {
this._height = height;
this._width = width;
this._ballRadius = ballRadius || 0.2;
this._world = null;
this._ballScored = function () {
};
this._paddleFixtures = {};
this._init();
} | javascript | function Physics(width, height, ballRadius) {
this._height = height;
this._width = width;
this._ballRadius = ballRadius || 0.2;
this._world = null;
this._ballScored = function () {
};
this._paddleFixtures = {};
this._init();
} | [
"function",
"Physics",
"(",
"width",
",",
"height",
",",
"ballRadius",
")",
"{",
"this",
".",
"_height",
"=",
"height",
";",
"this",
".",
"_width",
"=",
"width",
";",
"this",
".",
"_ballRadius",
"=",
"ballRadius",
"||",
"0.2",
";",
"this",
".",
"_world... | Initialize physics environment
@param width field width
@param height field height
@param ballRadius ball game radius
@constructor | [
"Initialize",
"physics",
"environment"
] | 18e6d14a38d4bb552a22a19b0c00b05e02d2cc5b | https://github.com/bestander/pong-box2d/blob/18e6d14a38d4bb552a22a19b0c00b05e02d2cc5b/physics/box2dPhysics.js#L37-L46 |
47,342 | amobiz/json-normalizer | lib/deref.js | deref | function deref(theSchema, optionalOptions, callbackFn) {
var root, loaders, error, options, callback;
options = optionalOptions || {};
if (typeof options === 'function') {
callback = options;
} else {
callback = callbackFn;
}
root = _.cloneDeep(theSchema);
loaders = _loaders(require('./loader/local'), opt... | javascript | function deref(theSchema, optionalOptions, callbackFn) {
var root, loaders, error, options, callback;
options = optionalOptions || {};
if (typeof options === 'function') {
callback = options;
} else {
callback = callbackFn;
}
root = _.cloneDeep(theSchema);
loaders = _loaders(require('./loader/local'), opt... | [
"function",
"deref",
"(",
"theSchema",
",",
"optionalOptions",
",",
"callbackFn",
")",
"{",
"var",
"root",
",",
"loaders",
",",
"error",
",",
"options",
",",
"callback",
";",
"options",
"=",
"optionalOptions",
"||",
"{",
"}",
";",
"if",
"(",
"typeof",
"o... | Dereference a schema that using JSON references.
Default implementation supports only local references,
i.e. references that starts with “#“.
Custom loaders can be provided via the options object.
@context don't care.
@param theSchema: string
@param optionalOptions.loader | optionalOptions.loaders: function | [functi... | [
"Dereference",
"a",
"schema",
"that",
"using",
"JSON",
"references",
"."
] | 76a8ab1db2da4600dbd28c5c6c7fd11e43c0dd55 | https://github.com/amobiz/json-normalizer/blob/76a8ab1db2da4600dbd28c5c6c7fd11e43c0dd55/lib/deref.js#L26-L83 |
47,343 | mrfishie/detect-log | index.js | logAll | function logAll(files, cb) {
_walkAll(files, function(err, node) {
if (err) {
exports.log(err.name + ': ' + err.message + ' in ' + err.file + ':' + err.line + ':' + err.column);
if (cb) cb(err);
}
exports.log('Found console.' + node.type + ' at ' + node.file + ':' + ... | javascript | function logAll(files, cb) {
_walkAll(files, function(err, node) {
if (err) {
exports.log(err.name + ': ' + err.message + ' in ' + err.file + ':' + err.line + ':' + err.column);
if (cb) cb(err);
}
exports.log('Found console.' + node.type + ' at ' + node.file + ':' + ... | [
"function",
"logAll",
"(",
"files",
",",
"cb",
")",
"{",
"_walkAll",
"(",
"files",
",",
"function",
"(",
"err",
",",
"node",
")",
"{",
"if",
"(",
"err",
")",
"{",
"exports",
".",
"log",
"(",
"err",
".",
"name",
"+",
"': '",
"+",
"err",
".",
"me... | Logs all found instances of console.log and calls the callback specifying if there were any instances, or an error
if one occurred
@param {String} files A file glob
@param {Function?} cb Called with arguments <Error, Array>. If there was an error it will not be called again,
otherwise it will be called at the end with... | [
"Logs",
"all",
"found",
"instances",
"of",
"console",
".",
"log",
"and",
"calls",
"the",
"callback",
"specifying",
"if",
"there",
"were",
"any",
"instances",
"or",
"an",
"error",
"if",
"one",
"occurred"
] | 7a42e0a727fd57edf908423bf17e74c639788b9d | https://github.com/mrfishie/detect-log/blob/7a42e0a727fd57edf908423bf17e74c639788b9d/index.js#L38-L50 |
47,344 | mrfishie/detect-log | index.js | getAll | function getAll(files, cb) {
walkAll(files)
.then(function(allNodes) {
if (cb) cb(null, allNodes);
})
.catch(function(err) {
if (cb) cb(err, []);
});
} | javascript | function getAll(files, cb) {
walkAll(files)
.then(function(allNodes) {
if (cb) cb(null, allNodes);
})
.catch(function(err) {
if (cb) cb(err, []);
});
} | [
"function",
"getAll",
"(",
"files",
",",
"cb",
")",
"{",
"walkAll",
"(",
"files",
")",
".",
"then",
"(",
"function",
"(",
"allNodes",
")",
"{",
"if",
"(",
"cb",
")",
"cb",
"(",
"null",
",",
"allNodes",
")",
";",
"}",
")",
".",
"catch",
"(",
"fu... | Gets a list of all found console.logs
@param {String} files A file glob
@param {Function?} cb Called with arguments <Error, Array>. If an error occurred the error will be passed with an
empty array, otherwise error will be null and an array will be passed. | [
"Gets",
"a",
"list",
"of",
"all",
"found",
"console",
".",
"logs"
] | 7a42e0a727fd57edf908423bf17e74c639788b9d | https://github.com/mrfishie/detect-log/blob/7a42e0a727fd57edf908423bf17e74c639788b9d/index.js#L61-L69 |
47,345 | quorrajs/Positron | lib/foundation/Application.js | App | function App() {
require('colors');
/**
* All of the developer defined middlewares.
*
* @var {Array}
* @protected
*/
this.__middlewares = [];
/**
* The filter instance
* @var {Object}
*/
this.filter;
/**
* The list of loaded service providers.
... | javascript | function App() {
require('colors');
/**
* All of the developer defined middlewares.
*
* @var {Array}
* @protected
*/
this.__middlewares = [];
/**
* The filter instance
* @var {Object}
*/
this.filter;
/**
* The list of loaded service providers.
... | [
"function",
"App",
"(",
")",
"{",
"require",
"(",
"'colors'",
")",
";",
"/**\n * All of the developer defined middlewares.\n *\n * @var {Array}\n * @protected\n */",
"this",
".",
"__middlewares",
"=",
"[",
"]",
";",
"/**\n * The filter instance\n * @va... | Create a Quorra application.
@extend Container
@return {Function}
@api public | [
"Create",
"a",
"Quorra",
"application",
"."
] | a4bad5a5f581743d1885405c11ae26600fb957af | https://github.com/quorrajs/Positron/blob/a4bad5a5f581743d1885405c11ae26600fb957af/lib/foundation/Application.js#L47-L138 |
47,346 | gribnoysup/nfield-api | api.js | checkRequiredParameter | function checkRequiredParameter (param) {
return (
typeof param === 'function' || typeof param === 'undefined' || param === '' || param === null || (typeof param === 'number' && isNaN(param))
);
} | javascript | function checkRequiredParameter (param) {
return (
typeof param === 'function' || typeof param === 'undefined' || param === '' || param === null || (typeof param === 'number' && isNaN(param))
);
} | [
"function",
"checkRequiredParameter",
"(",
"param",
")",
"{",
"return",
"(",
"typeof",
"param",
"===",
"'function'",
"||",
"typeof",
"param",
"===",
"'undefined'",
"||",
"param",
"===",
"''",
"||",
"param",
"===",
"null",
"||",
"(",
"typeof",
"param",
"===",... | Check if specific required request parameter is valid | [
"Check",
"if",
"specific",
"required",
"request",
"parameter",
"is",
"valid"
] | fcd635255fad2fc483d0e9045ecf7faba04378d9 | https://github.com/gribnoysup/nfield-api/blob/fcd635255fad2fc483d0e9045ecf7faba04378d9/api.js#L26-L30 |
47,347 | gribnoysup/nfield-api | api.js | checkIfOnlyOneRequired | function checkIfOnlyOneRequired (defaultParams) {
var keys = Object.keys(defaultParams);
var i, key;
var onlyOne = '';
for (i = 0; i < keys.length; i++){
key = keys[i];
if (defaultParams[key] === '') {
if (onlyOne !== '') return false;
onlyOne = key;
}
}
return onlyOne;
} | javascript | function checkIfOnlyOneRequired (defaultParams) {
var keys = Object.keys(defaultParams);
var i, key;
var onlyOne = '';
for (i = 0; i < keys.length; i++){
key = keys[i];
if (defaultParams[key] === '') {
if (onlyOne !== '') return false;
onlyOne = key;
}
}
return onlyOne;
} | [
"function",
"checkIfOnlyOneRequired",
"(",
"defaultParams",
")",
"{",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"defaultParams",
")",
";",
"var",
"i",
",",
"key",
";",
"var",
"onlyOne",
"=",
"''",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
... | Check if default parameters has only one required param
Returns false if there are more than one, or a param name if there is only one | [
"Check",
"if",
"default",
"parameters",
"has",
"only",
"one",
"required",
"param"
] | fcd635255fad2fc483d0e9045ecf7faba04378d9 | https://github.com/gribnoysup/nfield-api/blob/fcd635255fad2fc483d0e9045ecf7faba04378d9/api.js#L37-L51 |
47,348 | gribnoysup/nfield-api | api.js | normalizeRequestParameters | function normalizeRequestParameters (defaultsObject, paramsName, requestParams) {
var promise = new Promise(function (resolve, reject) {
var defaultParams;
var onlyOne;
// First check if we have a default parameters object with this name
if (typeof defaultsObject[paramsName] !== 'object') reject(ne... | javascript | function normalizeRequestParameters (defaultsObject, paramsName, requestParams) {
var promise = new Promise(function (resolve, reject) {
var defaultParams;
var onlyOne;
// First check if we have a default parameters object with this name
if (typeof defaultsObject[paramsName] !== 'object') reject(ne... | [
"function",
"normalizeRequestParameters",
"(",
"defaultsObject",
",",
"paramsName",
",",
"requestParams",
")",
"{",
"var",
"promise",
"=",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"defaultParams",
";",
"var",
"onlyOne",
... | Return a promise with normalized request parameters or an error | [
"Return",
"a",
"promise",
"with",
"normalized",
"request",
"parameters",
"or",
"an",
"error"
] | fcd635255fad2fc483d0e9045ecf7faba04378d9 | https://github.com/gribnoysup/nfield-api/blob/fcd635255fad2fc483d0e9045ecf7faba04378d9/api.js#L56-L96 |
47,349 | gribnoysup/nfield-api | api.js | signIn | function signIn (defOptions, credentials, callback) {
var promise = normalizeRequestParameters(defaults, 'SignIn', credentials).then(function (credentials) {
var options = {
method : 'POST',
uri : 'v1/SignIn',
json : credentials
};
extend(true, options, defOptions);
return... | javascript | function signIn (defOptions, credentials, callback) {
var promise = normalizeRequestParameters(defaults, 'SignIn', credentials).then(function (credentials) {
var options = {
method : 'POST',
uri : 'v1/SignIn',
json : credentials
};
extend(true, options, defOptions);
return... | [
"function",
"signIn",
"(",
"defOptions",
",",
"credentials",
",",
"callback",
")",
"{",
"var",
"promise",
"=",
"normalizeRequestParameters",
"(",
"defaults",
",",
"'SignIn'",
",",
"credentials",
")",
".",
"then",
"(",
"function",
"(",
"credentials",
")",
"{",
... | Sign in to Nfield API
{@link https://api.nfieldmr.com/help/api/post-v1-signin} | [
"Sign",
"in",
"to",
"Nfield",
"API"
] | fcd635255fad2fc483d0e9045ecf7faba04378d9 | https://github.com/gribnoysup/nfield-api/blob/fcd635255fad2fc483d0e9045ecf7faba04378d9/api.js#L103-L119 |
47,350 | gribnoysup/nfield-api | api.js | requestWithTokenCheck | function requestWithTokenCheck (defOptions, credentials, token, options, callback) {
var returnedPromise;
options.headers = options.headers || {};
extend(true, options, defOptions);
if (Date.now() - token.Timestamp > tokenUpdateTime) {
returnedPromise = signIn(defOptions, credentials).then(function (d... | javascript | function requestWithTokenCheck (defOptions, credentials, token, options, callback) {
var returnedPromise;
options.headers = options.headers || {};
extend(true, options, defOptions);
if (Date.now() - token.Timestamp > tokenUpdateTime) {
returnedPromise = signIn(defOptions, credentials).then(function (d... | [
"function",
"requestWithTokenCheck",
"(",
"defOptions",
",",
"credentials",
",",
"token",
",",
"options",
",",
"callback",
")",
"{",
"var",
"returnedPromise",
";",
"options",
".",
"headers",
"=",
"options",
".",
"headers",
"||",
"{",
"}",
";",
"extend",
"(",... | Wrapper function for all Nfield API requests that checks if API token is not outdated, and refreshes it otherwise | [
"Wrapper",
"function",
"for",
"all",
"Nfield",
"API",
"requests",
"that",
"checks",
"if",
"API",
"token",
"is",
"not",
"outdated",
"and",
"refreshes",
"it",
"otherwise"
] | fcd635255fad2fc483d0e9045ecf7faba04378d9 | https://github.com/gribnoysup/nfield-api/blob/fcd635255fad2fc483d0e9045ecf7faba04378d9/api.js#L124-L148 |
47,351 | gribnoysup/nfield-api | api.js | removeSurveyLanguages | function removeSurveyLanguages (defOptions, credentials, token, requestParams, callback) {
var promise = normalizeRequestParameters(defaults, 'RemoveSurveyLanguages', requestParams).then(function (params) {
var options = {
method : 'DELETE',
uri : `v1/Surveys/${params.SurveyId}/Languages/${p... | javascript | function removeSurveyLanguages (defOptions, credentials, token, requestParams, callback) {
var promise = normalizeRequestParameters(defaults, 'RemoveSurveyLanguages', requestParams).then(function (params) {
var options = {
method : 'DELETE',
uri : `v1/Surveys/${params.SurveyId}/Languages/${p... | [
"function",
"removeSurveyLanguages",
"(",
"defOptions",
",",
"credentials",
",",
"token",
",",
"requestParams",
",",
"callback",
")",
"{",
"var",
"promise",
"=",
"normalizeRequestParameters",
"(",
"defaults",
",",
"'RemoveSurveyLanguages'",
",",
"requestParams",
")",
... | Remove existing language
{@link https://api.nfieldmr.com/help/api/delete-v1-surveys-surveyid-languages-languageid} | [
"Remove",
"existing",
"language"
] | fcd635255fad2fc483d0e9045ecf7faba04378d9 | https://github.com/gribnoysup/nfield-api/blob/fcd635255fad2fc483d0e9045ecf7faba04378d9/api.js#L393-L407 |
47,352 | gribnoysup/nfield-api | api.js | getSurveySettings | function getSurveySettings (defOptions, credentials, token, surveyId, callback) {
if (typeof surveyId === 'function') callback = surveyId;
if (checkRequiredParameter(surveyId)) return Promise.reject(Error(`Missing required parameter 'SurveyId'`)).nodeify(callback);
var options = {
method : 'GET',
ur... | javascript | function getSurveySettings (defOptions, credentials, token, surveyId, callback) {
if (typeof surveyId === 'function') callback = surveyId;
if (checkRequiredParameter(surveyId)) return Promise.reject(Error(`Missing required parameter 'SurveyId'`)).nodeify(callback);
var options = {
method : 'GET',
ur... | [
"function",
"getSurveySettings",
"(",
"defOptions",
",",
"credentials",
",",
"token",
",",
"surveyId",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"surveyId",
"===",
"'function'",
")",
"callback",
"=",
"surveyId",
";",
"if",
"(",
"checkRequiredParameter",
... | Retrieve survey settings
{@link https://api.nfieldmr.com/help/api/get-v1-surveys-surveyid-settings} | [
"Retrieve",
"survey",
"settings"
] | fcd635255fad2fc483d0e9045ecf7faba04378d9 | https://github.com/gribnoysup/nfield-api/blob/fcd635255fad2fc483d0e9045ecf7faba04378d9/api.js#L414-L425 |
47,353 | andreypopp/react-app-middleware | index.js | evaluatePromise | function evaluatePromise() {
var promise = kew.defer();
var args = utils.toArray(arguments);
args.push(promise.makeNodeResolver());
/*jshint validthis:true */
evaluate.apply(this, args);
return promise;
} | javascript | function evaluatePromise() {
var promise = kew.defer();
var args = utils.toArray(arguments);
args.push(promise.makeNodeResolver());
/*jshint validthis:true */
evaluate.apply(this, args);
return promise;
} | [
"function",
"evaluatePromise",
"(",
")",
"{",
"var",
"promise",
"=",
"kew",
".",
"defer",
"(",
")",
";",
"var",
"args",
"=",
"utils",
".",
"toArray",
"(",
"arguments",
")",
";",
"args",
".",
"push",
"(",
"promise",
".",
"makeNodeResolver",
"(",
")",
... | Like evaluate from react-app-server-runtime but exposes Promise API | [
"Like",
"evaluate",
"from",
"react",
"-",
"app",
"-",
"server",
"-",
"runtime",
"but",
"exposes",
"Promise",
"API"
] | 20288fde7916894b84f01ef5640b3dadd98a0bfb | https://github.com/andreypopp/react-app-middleware/blob/20288fde7916894b84f01ef5640b3dadd98a0bfb/index.js#L46-L53 |
47,354 | andreypopp/react-app-middleware | index.js | makeLocation | function makeLocation(req, origin) {
var protocol = !!req.connection.verifyPeer ? 'https://' : 'http://',
reqOrigin = origin || (protocol + req.headers.host);
return url.parse(reqOrigin + req.originalUrl);
} | javascript | function makeLocation(req, origin) {
var protocol = !!req.connection.verifyPeer ? 'https://' : 'http://',
reqOrigin = origin || (protocol + req.headers.host);
return url.parse(reqOrigin + req.originalUrl);
} | [
"function",
"makeLocation",
"(",
"req",
",",
"origin",
")",
"{",
"var",
"protocol",
"=",
"!",
"!",
"req",
".",
"connection",
".",
"verifyPeer",
"?",
"'https://'",
":",
"'http://'",
",",
"reqOrigin",
"=",
"origin",
"||",
"(",
"protocol",
"+",
"req",
".",
... | Create window.location-like object from express request
@param {ExpressRequest} req
@param {String} origin | [
"Create",
"window",
".",
"location",
"-",
"like",
"object",
"from",
"express",
"request"
] | 20288fde7916894b84f01ef5640b3dadd98a0bfb | https://github.com/andreypopp/react-app-middleware/blob/20288fde7916894b84f01ef5640b3dadd98a0bfb/index.js#L61-L65 |
47,355 | andreypopp/react-app-middleware | index.js | servePage | function servePage(bundle, opts) {
opts = opts || {};
if (typeof bundle !== 'function') {
bundle = bundler.create(bundle, opts);
}
return function(req, res, next) {
var location = makeLocation(req, opts.origin);
var clientReq = request.createRequestFromLocation(location);
bundle()
.then(... | javascript | function servePage(bundle, opts) {
opts = opts || {};
if (typeof bundle !== 'function') {
bundle = bundler.create(bundle, opts);
}
return function(req, res, next) {
var location = makeLocation(req, opts.origin);
var clientReq = request.createRequestFromLocation(location);
bundle()
.then(... | [
"function",
"servePage",
"(",
"bundle",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"if",
"(",
"typeof",
"bundle",
"!==",
"'function'",
")",
"{",
"bundle",
"=",
"bundler",
".",
"create",
"(",
"bundle",
",",
"opts",
")",
";",
"}... | Middleware for serving pre-rendered React UI
@param {Bundler|Browserify|ModuleId} bundle
@param {Options} opts | [
"Middleware",
"for",
"serving",
"pre",
"-",
"rendered",
"React",
"UI"
] | 20288fde7916894b84f01ef5640b3dadd98a0bfb | https://github.com/andreypopp/react-app-middleware/blob/20288fde7916894b84f01ef5640b3dadd98a0bfb/index.js#L73-L106 |
47,356 | 75lb/argv-tools | index.js | expandCombinedShortArg | function expandCombinedShortArg (arg) {
/* remove initial hypen */
arg = arg.slice(1)
return arg.split('').map(letter => '-' + letter)
} | javascript | function expandCombinedShortArg (arg) {
/* remove initial hypen */
arg = arg.slice(1)
return arg.split('').map(letter => '-' + letter)
} | [
"function",
"expandCombinedShortArg",
"(",
"arg",
")",
"{",
"/* remove initial hypen */",
"arg",
"=",
"arg",
".",
"slice",
"(",
"1",
")",
"return",
"arg",
".",
"split",
"(",
"''",
")",
".",
"map",
"(",
"letter",
"=>",
"'-'",
"+",
"letter",
")",
"}"
] | Expand a combined short option.
@param {string} - the string to expand, e.g. `-ab`
@returns {string[]}
@static | [
"Expand",
"a",
"combined",
"short",
"option",
"."
] | 624e9249623003a1cadb4cbecd2c428366039e80 | https://github.com/75lb/argv-tools/blob/624e9249623003a1cadb4cbecd2c428366039e80/index.js#L102-L106 |
47,357 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/panel/plugin.js | function( index )
{
if ( index == -1 )
return;
var links = this.element.getElementsByTag( 'a' );
var item = links.getItem( this._.focusIndex = index );
// Safari need focus on the iframe window first(#3389), but we need
// lock the blur to avoid hiding the panel.
if ( CKEDITOR.env.webk... | javascript | function( index )
{
if ( index == -1 )
return;
var links = this.element.getElementsByTag( 'a' );
var item = links.getItem( this._.focusIndex = index );
// Safari need focus on the iframe window first(#3389), but we need
// lock the blur to avoid hiding the panel.
if ( CKEDITOR.env.webk... | [
"function",
"(",
"index",
")",
"{",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"return",
";",
"var",
"links",
"=",
"this",
".",
"element",
".",
"getElementsByTag",
"(",
"'a'",
")",
";",
"var",
"item",
"=",
"links",
".",
"getItem",
"(",
"this",
".",
... | Mark the item specified by the index as current activated. | [
"Mark",
"the",
"item",
"specified",
"by",
"the",
"index",
"as",
"current",
"activated",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/panel/plugin.js#L305-L319 | |
47,358 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | subscribe | function subscribe (state, topic, subscription, options, context) {
assert(typeof topic, 'string', 'Arbiter.subscribe', 'strings', 'topics');
options = merge(state.options, options);
var
ancestor = addTopicLine(
topic, ancestorTopicSearch(topic, state._topics)
),
node = insert(
... | javascript | function subscribe (state, topic, subscription, options, context) {
assert(typeof topic, 'string', 'Arbiter.subscribe', 'strings', 'topics');
options = merge(state.options, options);
var
ancestor = addTopicLine(
topic, ancestorTopicSearch(topic, state._topics)
),
node = insert(
... | [
"function",
"subscribe",
"(",
"state",
",",
"topic",
",",
"subscription",
",",
"options",
",",
"context",
")",
"{",
"assert",
"(",
"typeof",
"topic",
",",
"'string'",
",",
"'Arbiter.subscribe'",
",",
"'strings'",
",",
"'topics'",
")",
";",
"options",
"=",
... | `Arbiter.subscribe` registers a subscription to a topic and its
descendants. When a publication occurs it will be notified. The behavior
can be modified by using the options parameter. `options.priority`
establishes the order to notify subscribers when multiple subscribers
exist. The other option is `ignorePersisted`. ... | [
"Arbiter",
".",
"subscribe",
"registers",
"a",
"subscription",
"to",
"a",
"topic",
"and",
"its",
"descendants",
".",
"When",
"a",
"publication",
"occurs",
"it",
"will",
"be",
"notified",
".",
"The",
"behavior",
"can",
"be",
"modified",
"by",
"using",
"the",
... | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L127-L164 |
47,359 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | publish | function publish (state, topic, data, options) {
assert(typeof topic, 'string', 'Arbiter.publish', 'strings', 'topics');
options = merge(state.options, options);
var args = [state, topic, data, options];
if (options.sync) {
return hierarchicalTopicDispatcher(state, topic, data, options);
}
... | javascript | function publish (state, topic, data, options) {
assert(typeof topic, 'string', 'Arbiter.publish', 'strings', 'topics');
options = merge(state.options, options);
var args = [state, topic, data, options];
if (options.sync) {
return hierarchicalTopicDispatcher(state, topic, data, options);
}
... | [
"function",
"publish",
"(",
"state",
",",
"topic",
",",
"data",
",",
"options",
")",
"{",
"assert",
"(",
"typeof",
"topic",
",",
"'string'",
",",
"'Arbiter.publish'",
",",
"'strings'",
",",
"'topics'",
")",
";",
"options",
"=",
"merge",
"(",
"state",
"."... | `Arbiter.publish` notifies all subscribers of a publication by invoking
their subscription function with the data and topic associated with the
publication.
@function publish
@memberof Arbiter
@param {Topic} topic All subscribers to this topic, will be notified of
the publication
@param {Object} [data] This data is t... | [
"Arbiter",
".",
"publish",
"notifies",
"all",
"subscribers",
"of",
"a",
"publication",
"by",
"invoking",
"their",
"subscription",
"function",
"with",
"the",
"data",
"and",
"topic",
"associated",
"with",
"the",
"publication",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L224-L234 |
47,360 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | unsubscribe | function unsubscribe (state, tokens, suspend) {
tokens = typeof tokens === 'string' ? tokens.split(/,\s*/) : tokens;
tokens = !tokens.length ? [tokens] : tokens;
var result = curryMap(
{topics: state._topics, suspend: suspend}, removeSubscriber, tokens
);
return result.length === 1 ? result[... | javascript | function unsubscribe (state, tokens, suspend) {
tokens = typeof tokens === 'string' ? tokens.split(/,\s*/) : tokens;
tokens = !tokens.length ? [tokens] : tokens;
var result = curryMap(
{topics: state._topics, suspend: suspend}, removeSubscriber, tokens
);
return result.length === 1 ? result[... | [
"function",
"unsubscribe",
"(",
"state",
",",
"tokens",
",",
"suspend",
")",
"{",
"tokens",
"=",
"typeof",
"tokens",
"===",
"'string'",
"?",
"tokens",
".",
"split",
"(",
"/",
",\\s*",
"/",
")",
":",
"tokens",
";",
"tokens",
"=",
"!",
"tokens",
".",
"... | `Arbiter.unsubscribe` removes the subscribers associated with a token or
a topic. This prevents them from being notified when a publication
occurs. By default these cannot be recovered, however this also allows
us to temporarily suspend them instead.
@function unsubscribe
@memberof Arbiter
@param {Token|Topic} token ... | [
"Arbiter",
".",
"unsubscribe",
"removes",
"the",
"subscribers",
"associated",
"with",
"a",
"token",
"or",
"a",
"topic",
".",
"This",
"prevents",
"them",
"from",
"being",
"notified",
"when",
"a",
"publication",
"occurs",
".",
"By",
"default",
"these",
"cannot",... | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L265-L274 |
47,361 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | resubscribe | function resubscribe (state, tokens) {
tokens = typeof tokens === 'string' ? tokens.split(/,\s*/) : tokens;
tokens = !tokens.length ? [tokens] : tokens;
var result = curryMap(state._topics, unsuspendSubscriber, tokens);
return result.length === 1 ? result[0] : result;
} | javascript | function resubscribe (state, tokens) {
tokens = typeof tokens === 'string' ? tokens.split(/,\s*/) : tokens;
tokens = !tokens.length ? [tokens] : tokens;
var result = curryMap(state._topics, unsuspendSubscriber, tokens);
return result.length === 1 ? result[0] : result;
} | [
"function",
"resubscribe",
"(",
"state",
",",
"tokens",
")",
"{",
"tokens",
"=",
"typeof",
"tokens",
"===",
"'string'",
"?",
"tokens",
".",
"split",
"(",
"/",
",\\s*",
"/",
")",
":",
"tokens",
";",
"tokens",
"=",
"!",
"tokens",
".",
"length",
"?",
"[... | Reactivates all subscriptions associated with a token or all
subscriptions that are descendants of a topic.
@function resubscribe
@memberof Arbiter
@param {Token|Topic} token The token or topic to reactivates
@return {Boolean} Returns false if the token's subscription cannot be
located and true otherwise. This return... | [
"Reactivates",
"all",
"subscriptions",
"associated",
"with",
"a",
"token",
"or",
"all",
"subscriptions",
"that",
"are",
"descendants",
"of",
"a",
"topic",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L294-L301 |
47,362 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | create | function create () {
/**
* Arbiter has a few options to affect the way that subscribers are
* notified and PublicationPromises are resolved.
*
* @typedef Options
* @memberof Arbiter
*
* @property {boolean} persist=false When true, subscribers are notified
* of past messages... | javascript | function create () {
/**
* Arbiter has a few options to affect the way that subscribers are
* notified and PublicationPromises are resolved.
*
* @typedef Options
* @memberof Arbiter
*
* @property {boolean} persist=false When true, subscribers are notified
* of past messages... | [
"function",
"create",
"(",
")",
"{",
"/**\n * Arbiter has a few options to affect the way that subscribers are\n * notified and PublicationPromises are resolved.\n *\n * @typedef Options\n * @memberof Arbiter\n *\n * @property {boolean} persist=false When true, subscribers are ... | Creates a new instance of Arbiter that is completely separate from the
original. It has its own set of topics, subscribers, and options.
@function create
@memberof Arbiter
@return {Arbiter} The new instance.
@example
var arbiter = Arbiter.create();
Arbiter.subscribe('a', function a () {});
arbiter.publish('a'); // ... | [
"Creates",
"a",
"new",
"instance",
"of",
"Arbiter",
"that",
"is",
"completely",
"separate",
"from",
"the",
"original",
".",
"It",
"has",
"its",
"own",
"set",
"of",
"topics",
"subscribers",
"and",
"options",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L363-L428 |
47,363 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | hierarchicalTopicDispatcher | function hierarchicalTopicDispatcher (state, topic, data, options) {
var
lineage = findLineage(getTopic, isAncestorTopic, topic, state._topics),
topicNode = lineage[lineage.length - 1],
subscriptions = options.preventBubble
? topicNode.topic === topic ? topicNode.subscriptions : []
... | javascript | function hierarchicalTopicDispatcher (state, topic, data, options) {
var
lineage = findLineage(getTopic, isAncestorTopic, topic, state._topics),
topicNode = lineage[lineage.length - 1],
subscriptions = options.preventBubble
? topicNode.topic === topic ? topicNode.subscriptions : []
... | [
"function",
"hierarchicalTopicDispatcher",
"(",
"state",
",",
"topic",
",",
"data",
",",
"options",
")",
"{",
"var",
"lineage",
"=",
"findLineage",
"(",
"getTopic",
",",
"isAncestorTopic",
",",
"topic",
",",
"state",
".",
"_topics",
")",
",",
"topicNode",
"=... | Takes care of all the heavy lifting of publishing a message. This includes locating all topics, their subscribers, publishing the data and, if necessary, storing the message for late subscribers. | [
"Takes",
"care",
"of",
"all",
"the",
"heavy",
"lifting",
"of",
"publishing",
"a",
"message",
".",
"This",
"includes",
"locating",
"all",
"topics",
"their",
"subscribers",
"publishing",
"the",
"data",
"and",
"if",
"necessary",
"storing",
"the",
"message",
"for"... | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L437-L462 |
47,364 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | resumeSubscriptionDispatcher | function resumeSubscriptionDispatcher (
topic, data, options, subscriptions, resolver, fulfill, reject
) {
var
promise = resolver.promise,
subscription;
for (
;
resolver.i >= 0 && promise.pending < options.semaphor;
resolver.i -= 1
) {
subscription = subscriptions... | javascript | function resumeSubscriptionDispatcher (
topic, data, options, subscriptions, resolver, fulfill, reject
) {
var
promise = resolver.promise,
subscription;
for (
;
resolver.i >= 0 && promise.pending < options.semaphor;
resolver.i -= 1
) {
subscription = subscriptions... | [
"function",
"resumeSubscriptionDispatcher",
"(",
"topic",
",",
"data",
",",
"options",
",",
"subscriptions",
",",
"resolver",
",",
"fulfill",
",",
"reject",
")",
"{",
"var",
"promise",
"=",
"resolver",
".",
"promise",
",",
"subscription",
";",
"for",
"(",
";... | Invokes the next set of subscriptions | [
"Invokes",
"the",
"next",
"set",
"of",
"subscriptions"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L465-L484 |
47,365 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | removePersistedDispatcher | function removePersistedDispatcher (state, tokens) {
tokens = tokens && tokens.token || tokens || '';
tokens = typeof tokens === 'string' ? tokens.split(/,\s*/) : tokens;
tokens = !tokens.length ? [tokens] : tokens;
var result = curryMap(state._topics, removePersisted, tokens);
return result.lengt... | javascript | function removePersistedDispatcher (state, tokens) {
tokens = tokens && tokens.token || tokens || '';
tokens = typeof tokens === 'string' ? tokens.split(/,\s*/) : tokens;
tokens = !tokens.length ? [tokens] : tokens;
var result = curryMap(state._topics, removePersisted, tokens);
return result.lengt... | [
"function",
"removePersistedDispatcher",
"(",
"state",
",",
"tokens",
")",
"{",
"tokens",
"=",
"tokens",
"&&",
"tokens",
".",
"token",
"||",
"tokens",
"||",
"''",
";",
"tokens",
"=",
"typeof",
"tokens",
"===",
"'string'",
"?",
"tokens",
".",
"split",
"(",
... | Takes care of sending all the requests on their way | [
"Takes",
"care",
"of",
"sending",
"all",
"the",
"requests",
"on",
"their",
"way"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L487-L495 |
47,366 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | subscriptionDispatcher | function subscriptionDispatcher (topic, data, options, subscriptions) {
var
resolver = createResolver(),
fulfill = resolveUse('fulfilledValues', 'fulfilled', options, resolver),
reject = resolveUse('rejectedValues', 'rejected', options, resolver);
resolver.i = subscriptions.length - 1;
re... | javascript | function subscriptionDispatcher (topic, data, options, subscriptions) {
var
resolver = createResolver(),
fulfill = resolveUse('fulfilledValues', 'fulfilled', options, resolver),
reject = resolveUse('rejectedValues', 'rejected', options, resolver);
resolver.i = subscriptions.length - 1;
re... | [
"function",
"subscriptionDispatcher",
"(",
"topic",
",",
"data",
",",
"options",
",",
"subscriptions",
")",
"{",
"var",
"resolver",
"=",
"createResolver",
"(",
")",
",",
"fulfill",
"=",
"resolveUse",
"(",
"'fulfilledValues'",
",",
"'fulfilled'",
",",
"options",
... | Invokes all the subscriptions according to `options` and returns a promise that resolves according to `options`. | [
"Invokes",
"all",
"the",
"subscriptions",
"according",
"to",
"options",
"and",
"returns",
"a",
"promise",
"that",
"resolves",
"according",
"to",
"options",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L499-L520 |
47,367 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | resolveUse | function resolveUse (appendList, increment, options, resolver) {
return function resolveUseClosure (value) {
// TODO This should state.options('update..
// TODO look at all of options.xxxx
if (resolver.settled && !options.updateAfterSettlement) {
return;
}
var promise = resolv... | javascript | function resolveUse (appendList, increment, options, resolver) {
return function resolveUseClosure (value) {
// TODO This should state.options('update..
// TODO look at all of options.xxxx
if (resolver.settled && !options.updateAfterSettlement) {
return;
}
var promise = resolv... | [
"function",
"resolveUse",
"(",
"appendList",
",",
"increment",
",",
"options",
",",
"resolver",
")",
"{",
"return",
"function",
"resolveUseClosure",
"(",
"value",
")",
"{",
"// TODO This should state.options('update..",
"// TODO look at all of options.xxxx",
"if",
"(",
... | Takes care all the bookkeeping work surrounding a subscriber resolving resolving. | [
"Takes",
"care",
"all",
"the",
"bookkeeping",
"work",
"surrounding",
"a",
"subscriber",
"resolving",
"resolving",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L524-L549 |
47,368 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | evaluateLatch | function evaluateLatch (resolver, options) {
var
settlementLatch = options.settlementLatch,
latch = options.latch,
promise = resolver.promise,
fulfilled = promise.fulfilled,
pending = promise.pending,
rejected = promise.rejected,
settled = fulfilled + rejected,
maxFul... | javascript | function evaluateLatch (resolver, options) {
var
settlementLatch = options.settlementLatch,
latch = options.latch,
promise = resolver.promise,
fulfilled = promise.fulfilled,
pending = promise.pending,
rejected = promise.rejected,
settled = fulfilled + rejected,
maxFul... | [
"function",
"evaluateLatch",
"(",
"resolver",
",",
"options",
")",
"{",
"var",
"settlementLatch",
"=",
"options",
".",
"settlementLatch",
",",
"latch",
"=",
"options",
".",
"latch",
",",
"promise",
"=",
"resolver",
".",
"promise",
",",
"fulfilled",
"=",
"pro... | Resolves the latch according to `options`. Computes the hypothetical max and resolves if is not met. | [
"Resolves",
"the",
"latch",
"according",
"to",
"options",
".",
"Computes",
"the",
"hypothetical",
"max",
"and",
"resolves",
"if",
"is",
"not",
"met",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L553-L591 |
47,369 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | subscriptionInvoker | function subscriptionInvoker (subscription, data, topic) {
var result;
if (subscription.fn.length === 3) {
return new Promise(function promiseResolver (fulfill, reject) {
subscription.fn.call(
subscription.context, data, topic, function callback (err, succ) {
return err ? re... | javascript | function subscriptionInvoker (subscription, data, topic) {
var result;
if (subscription.fn.length === 3) {
return new Promise(function promiseResolver (fulfill, reject) {
subscription.fn.call(
subscription.context, data, topic, function callback (err, succ) {
return err ? re... | [
"function",
"subscriptionInvoker",
"(",
"subscription",
",",
"data",
",",
"topic",
")",
"{",
"var",
"result",
";",
"if",
"(",
"subscription",
".",
"fn",
".",
"length",
"===",
"3",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"promiseResolver",
"(... | Invokes a subscription with the required parameters and acts as an adapter for the different asynchronous mechanisms behavior. i.e. node-style callbacks and promises. | [
"Invokes",
"a",
"subscription",
"with",
"the",
"required",
"parameters",
"and",
"acts",
"as",
"an",
"adapter",
"for",
"the",
"different",
"asynchronous",
"mechanisms",
"behavior",
".",
"i",
".",
"e",
".",
"node",
"-",
"style",
"callbacks",
"and",
"promises",
... | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L596-L620 |
47,370 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | subscribeDispatcher | function subscribeDispatcher (state, topic, subscriptions, options, context) {
topic = typeof topic === 'string' ? topic.split(/,\s*/) : topic;
topic = topic && topic.length ? topic : [topic];
var result = curryMap(
[state, null, subscriptions, options, context],
subscribeTopicApplier,
to... | javascript | function subscribeDispatcher (state, topic, subscriptions, options, context) {
topic = typeof topic === 'string' ? topic.split(/,\s*/) : topic;
topic = topic && topic.length ? topic : [topic];
var result = curryMap(
[state, null, subscriptions, options, context],
subscribeTopicApplier,
to... | [
"function",
"subscribeDispatcher",
"(",
"state",
",",
"topic",
",",
"subscriptions",
",",
"options",
",",
"context",
")",
"{",
"topic",
"=",
"typeof",
"topic",
"===",
"'string'",
"?",
"topic",
".",
"split",
"(",
"/",
",\\s*",
"/",
")",
":",
"topic",
";",... | This coverts `topic`, which can represent multiple subscriptions and serializes them into individual topics for use with the `subscription` | [
"This",
"coverts",
"topic",
"which",
"can",
"represent",
"multiple",
"subscriptions",
"and",
"serializes",
"them",
"into",
"individual",
"topics",
"for",
"use",
"with",
"the",
"subscription"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L624-L635 |
47,371 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | applyTopicDescendents | function applyTopicDescendents (f, property, topic, topics) {
var node = ancestorTopicSearch(topic, topics);
if (node.topic === topic) {
return curryMap(property, f, descendents(node));
}
return null;
} | javascript | function applyTopicDescendents (f, property, topic, topics) {
var node = ancestorTopicSearch(topic, topics);
if (node.topic === topic) {
return curryMap(property, f, descendents(node));
}
return null;
} | [
"function",
"applyTopicDescendents",
"(",
"f",
",",
"property",
",",
"topic",
",",
"topics",
")",
"{",
"var",
"node",
"=",
"ancestorTopicSearch",
"(",
"topic",
",",
"topics",
")",
";",
"if",
"(",
"node",
".",
"topic",
"===",
"topic",
")",
"{",
"return",
... | For all descendants of `topic` remove all elements of `node[property`. | [
"For",
"all",
"descendants",
"of",
"topic",
"remove",
"all",
"elements",
"of",
"node",
"[",
"property",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L645-L652 |
47,372 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | unsuspendSubscriber | function unsuspendSubscriber (topic, token) {
if (typeof token === 'string') {
return !!applyTopicDescendents(
unsuspendTopic, 'subscriptions', token, topic
);
}
var node = ancestorTopicSearch(token.topic, topic);
if (node.topic !== token.topic) {
return false;
}
var ... | javascript | function unsuspendSubscriber (topic, token) {
if (typeof token === 'string') {
return !!applyTopicDescendents(
unsuspendTopic, 'subscriptions', token, topic
);
}
var node = ancestorTopicSearch(token.topic, topic);
if (node.topic !== token.topic) {
return false;
}
var ... | [
"function",
"unsuspendSubscriber",
"(",
"topic",
",",
"token",
")",
"{",
"if",
"(",
"typeof",
"token",
"===",
"'string'",
")",
"{",
"return",
"!",
"!",
"applyTopicDescendents",
"(",
"unsuspendTopic",
",",
"'subscriptions'",
",",
"token",
",",
"topic",
")",
"... | Finds the subscription associated with a token and unsuspendes it. Returns false if it was removed and true it was unsuspended. | [
"Finds",
"the",
"subscription",
"associated",
"with",
"a",
"token",
"and",
"unsuspendes",
"it",
".",
"Returns",
"false",
"if",
"it",
"was",
"removed",
"and",
"true",
"it",
"was",
"unsuspended",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L656-L680 |
47,373 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | removeSubscriber | function removeSubscriber (args, token) {
var
topics = args.topics,
suspendSubs = args.suspend;
if (typeof token === 'string') {
return !!applyTopicDescendents(
suspendSubs ? suspendTopic : empty, 'subscriptions', token, topics
);
}
var node = ancestorTopicSearch(token.... | javascript | function removeSubscriber (args, token) {
var
topics = args.topics,
suspendSubs = args.suspend;
if (typeof token === 'string') {
return !!applyTopicDescendents(
suspendSubs ? suspendTopic : empty, 'subscriptions', token, topics
);
}
var node = ancestorTopicSearch(token.... | [
"function",
"removeSubscriber",
"(",
"args",
",",
"token",
")",
"{",
"var",
"topics",
"=",
"args",
".",
"topics",
",",
"suspendSubs",
"=",
"args",
".",
"suspend",
";",
"if",
"(",
"typeof",
"token",
"===",
"'string'",
")",
"{",
"return",
"!",
"!",
"appl... | Finds the subscription associated with a token and removes or suspends is. If the subscription associated with a token cannot be found then this returns false. This usually means that the token was already removed. | [
"Finds",
"the",
"subscription",
"associated",
"with",
"a",
"token",
"and",
"removes",
"or",
"suspends",
"is",
".",
"If",
"the",
"subscription",
"associated",
"with",
"a",
"token",
"cannot",
"be",
"found",
"then",
"this",
"returns",
"false",
".",
"This",
"usu... | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L685-L717 |
47,374 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | addTopicLine | function addTopicLine (topic, ancestor) {
var
ancestorTopic = ancestor.topic,
additionalTopics = [];
if (ancestorTopic !== topic) {
// All of the generations to add seeded by the youngest existing ancestor
additionalTopics = reduce(
appendPrefixedTopic, [ancestorTopic],
... | javascript | function addTopicLine (topic, ancestor) {
var
ancestorTopic = ancestor.topic,
additionalTopics = [];
if (ancestorTopic !== topic) {
// All of the generations to add seeded by the youngest existing ancestor
additionalTopics = reduce(
appendPrefixedTopic, [ancestorTopic],
... | [
"function",
"addTopicLine",
"(",
"topic",
",",
"ancestor",
")",
"{",
"var",
"ancestorTopic",
"=",
"ancestor",
".",
"topic",
",",
"additionalTopics",
"=",
"[",
"]",
";",
"if",
"(",
"ancestorTopic",
"!==",
"topic",
")",
"{",
"// All of the generations to add seede... | Takes a topic and an ancestor and adds all of the generations from the ancestor to the topic returning the topic that represents the node. | [
"Takes",
"a",
"topic",
"and",
"an",
"ancestor",
"and",
"adds",
"all",
"of",
"the",
"generations",
"from",
"the",
"ancestor",
"to",
"the",
"topic",
"returning",
"the",
"topic",
"that",
"represents",
"the",
"node",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L726-L743 |
47,375 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | isAncestorTopic | function isAncestorTopic (topic, node) {
var nodeTopic = getTopic(node);
return topic === nodeTopic
|| startsWith(topic, nodeTopic + '.')
|| nodeTopic === '';
} | javascript | function isAncestorTopic (topic, node) {
var nodeTopic = getTopic(node);
return topic === nodeTopic
|| startsWith(topic, nodeTopic + '.')
|| nodeTopic === '';
} | [
"function",
"isAncestorTopic",
"(",
"topic",
",",
"node",
")",
"{",
"var",
"nodeTopic",
"=",
"getTopic",
"(",
"node",
")",
";",
"return",
"topic",
"===",
"nodeTopic",
"||",
"startsWith",
"(",
"topic",
",",
"nodeTopic",
"+",
"'.'",
")",
"||",
"nodeTopic",
... | Finds the Ancestor of the specified topic or undefined | [
"Finds",
"the",
"Ancestor",
"of",
"the",
"specified",
"topic",
"or",
"undefined"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L764-L770 |
47,376 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | getFingerArrayOrder | function getFingerArrayOrder (fingerArray) {
var item = getPointedFinger(fingerArray);
return item !== SYMBOL_NOTHING ? getOrder(item) : Infinity;
} | javascript | function getFingerArrayOrder (fingerArray) {
var item = getPointedFinger(fingerArray);
return item !== SYMBOL_NOTHING ? getOrder(item) : Infinity;
} | [
"function",
"getFingerArrayOrder",
"(",
"fingerArray",
")",
"{",
"var",
"item",
"=",
"getPointedFinger",
"(",
"fingerArray",
")",
";",
"return",
"item",
"!==",
"SYMBOL_NOTHING",
"?",
"getOrder",
"(",
"item",
")",
":",
"Infinity",
";",
"}"
] | Given a fingerArray, return the order of current item | [
"Given",
"a",
"fingerArray",
"return",
"the",
"order",
"of",
"current",
"item"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L773-L776 |
47,377 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | getFingerArrayPriority | function getFingerArrayPriority (fingerArray) {
var item = getPointedFinger(fingerArray);
return item !== SYMBOL_NOTHING ? getPriority(item) : Infinity;
} | javascript | function getFingerArrayPriority (fingerArray) {
var item = getPointedFinger(fingerArray);
return item !== SYMBOL_NOTHING ? getPriority(item) : Infinity;
} | [
"function",
"getFingerArrayPriority",
"(",
"fingerArray",
")",
"{",
"var",
"item",
"=",
"getPointedFinger",
"(",
"fingerArray",
")",
";",
"return",
"item",
"!==",
"SYMBOL_NOTHING",
"?",
"getPriority",
"(",
"item",
")",
":",
"Infinity",
";",
"}"
] | Given a fingerArray, return the priority of current item | [
"Given",
"a",
"fingerArray",
"return",
"the",
"priority",
"of",
"current",
"item"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L779-L782 |
47,378 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | createResolver | function createResolver () {
var
resolver = {
settled: false,
fulfilledValues: [],
rejectedValues: []
},
promise = new Promise(function promiseResolver (fulfill, reject) {
resolver.fulfill = fulfill;
resolver.reject = reject;
});
promise.fulfilled... | javascript | function createResolver () {
var
resolver = {
settled: false,
fulfilledValues: [],
rejectedValues: []
},
promise = new Promise(function promiseResolver (fulfill, reject) {
resolver.fulfill = fulfill;
resolver.reject = reject;
});
promise.fulfilled... | [
"function",
"createResolver",
"(",
")",
"{",
"var",
"resolver",
"=",
"{",
"settled",
":",
"false",
",",
"fulfilledValues",
":",
"[",
"]",
",",
"rejectedValues",
":",
"[",
"]",
"}",
",",
"promise",
"=",
"new",
"Promise",
"(",
"function",
"promiseResolver",
... | Creates a resolver object that keeps track of promise related values | [
"Creates",
"a",
"resolver",
"object",
"that",
"keeps",
"track",
"of",
"promise",
"related",
"values"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L837-L855 |
47,379 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | createSubscription | function createSubscription (state, fn, options, context) {
return {
id: state.id(),
fn: typeof fn === 'function' ? fn : noop,
suspended: false,
priority: +options.priority || 0,
context: context || null
};
} | javascript | function createSubscription (state, fn, options, context) {
return {
id: state.id(),
fn: typeof fn === 'function' ? fn : noop,
suspended: false,
priority: +options.priority || 0,
context: context || null
};
} | [
"function",
"createSubscription",
"(",
"state",
",",
"fn",
",",
"options",
",",
"context",
")",
"{",
"return",
"{",
"id",
":",
"state",
".",
"id",
"(",
")",
",",
"fn",
":",
"typeof",
"fn",
"===",
"'function'",
"?",
"fn",
":",
"noop",
",",
"suspended"... | Creates a subscription object | [
"Creates",
"a",
"subscription",
"object"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L858-L866 |
47,380 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | addChild | function addChild (getValue, newChild, tree) {
tree.children.splice(
binaryIndexBy(getValue, getValue(newChild), tree.children),
0, newChild
);
return newChild;
} | javascript | function addChild (getValue, newChild, tree) {
tree.children.splice(
binaryIndexBy(getValue, getValue(newChild), tree.children),
0, newChild
);
return newChild;
} | [
"function",
"addChild",
"(",
"getValue",
",",
"newChild",
",",
"tree",
")",
"{",
"tree",
".",
"children",
".",
"splice",
"(",
"binaryIndexBy",
"(",
"getValue",
",",
"getValue",
"(",
"newChild",
")",
",",
"tree",
".",
"children",
")",
",",
"0",
",",
"ne... | Adds a node child into the tree in order according to `getValue` | [
"Adds",
"a",
"node",
"child",
"into",
"the",
"tree",
"in",
"order",
"according",
"to",
"getValue"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L937-L944 |
47,381 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | insert | function insert (getValue, item, list) {
var index = binaryIndexBy(getValue, getValue(item), list);
list.splice(index, 0, item);
return item;
} | javascript | function insert (getValue, item, list) {
var index = binaryIndexBy(getValue, getValue(item), list);
list.splice(index, 0, item);
return item;
} | [
"function",
"insert",
"(",
"getValue",
",",
"item",
",",
"list",
")",
"{",
"var",
"index",
"=",
"binaryIndexBy",
"(",
"getValue",
",",
"getValue",
"(",
"item",
")",
",",
"list",
")",
";",
"list",
".",
"splice",
"(",
"index",
",",
"0",
",",
"item",
... | Inserts an item in ascending order according to `getValue`. | [
"Inserts",
"an",
"item",
"in",
"ascending",
"order",
"according",
"to",
"getValue",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L968-L973 |
47,382 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | minBy | function minBy (valueComputer, list) {
var
idx = 0,
winner = list[idx],
computedWinner = valueComputer(winner),
computedCurrent;
while (++idx < list.length) {
computedCurrent = valueComputer(list[idx]);
if (computedCurrent < computedWinner) {
computedWinner = compu... | javascript | function minBy (valueComputer, list) {
var
idx = 0,
winner = list[idx],
computedWinner = valueComputer(winner),
computedCurrent;
while (++idx < list.length) {
computedCurrent = valueComputer(list[idx]);
if (computedCurrent < computedWinner) {
computedWinner = compu... | [
"function",
"minBy",
"(",
"valueComputer",
",",
"list",
")",
"{",
"var",
"idx",
"=",
"0",
",",
"winner",
"=",
"list",
"[",
"idx",
"]",
",",
"computedWinner",
"=",
"valueComputer",
"(",
"winner",
")",
",",
"computedCurrent",
";",
"while",
"(",
"++",
"id... | Finds the `minimum` element of an array according to the `valueComputer` function. | [
"Finds",
"the",
"minimum",
"element",
"of",
"an",
"array",
"according",
"to",
"the",
"valueComputer",
"function",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L1035-L1053 |
47,383 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | getPointedFinger | function getPointedFinger (fArray) {
var
pointer = fArray.pointer,
array = fArray.array;
return array.length > pointer ? array[pointer] : SYMBOL_NOTHING;
} | javascript | function getPointedFinger (fArray) {
var
pointer = fArray.pointer,
array = fArray.array;
return array.length > pointer ? array[pointer] : SYMBOL_NOTHING;
} | [
"function",
"getPointedFinger",
"(",
"fArray",
")",
"{",
"var",
"pointer",
"=",
"fArray",
".",
"pointer",
",",
"array",
"=",
"fArray",
".",
"array",
";",
"return",
"array",
".",
"length",
">",
"pointer",
"?",
"array",
"[",
"pointer",
"]",
":",
"SYMBOL_NO... | Retrieves the element that is the current focus and apply a | [
"Retrieves",
"the",
"element",
"that",
"is",
"the",
"current",
"focus",
"and",
"apply",
"a"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L1056-L1062 |
47,384 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | partial1 | function partial1 (f, x) {
return function partiallyApplied1 () {
// Using slice or splice on `arguments` causes the function to be
// unoptimizable. Who doesn't like optimization?
var args = map(identity, arguments);
args.unshift(x);
return f.apply(null, args);
};
} | javascript | function partial1 (f, x) {
return function partiallyApplied1 () {
// Using slice or splice on `arguments` causes the function to be
// unoptimizable. Who doesn't like optimization?
var args = map(identity, arguments);
args.unshift(x);
return f.apply(null, args);
};
} | [
"function",
"partial1",
"(",
"f",
",",
"x",
")",
"{",
"return",
"function",
"partiallyApplied1",
"(",
")",
"{",
"// Using slice or splice on `arguments` causes the function to be",
"// unoptimizable. Who doesn't like optimization?",
"var",
"args",
"=",
"map",
"(",
"identity... | Partially applies 1 argument to a function. | [
"Partially",
"applies",
"1",
"argument",
"to",
"a",
"function",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L1102-L1111 |
47,385 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | merge | function merge (a, b) {
var result = {};
var x;
for (x in a) {
if (a.hasOwnProperty(x)) {
result[x] = a[x];
}
}
for (x in b) {
if (b.hasOwnProperty(x)) {
result[x] = b[x];
}
}
return result;
} | javascript | function merge (a, b) {
var result = {};
var x;
for (x in a) {
if (a.hasOwnProperty(x)) {
result[x] = a[x];
}
}
for (x in b) {
if (b.hasOwnProperty(x)) {
result[x] = b[x];
}
}
return result;
} | [
"function",
"merge",
"(",
"a",
",",
"b",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"var",
"x",
";",
"for",
"(",
"x",
"in",
"a",
")",
"{",
"if",
"(",
"a",
".",
"hasOwnProperty",
"(",
"x",
")",
")",
"{",
"result",
"[",
"x",
"]",
"=",
"... | Returns a new object will all the properties of `a` and `b` giving b the priority. | [
"Returns",
"a",
"new",
"object",
"will",
"all",
"the",
"properties",
"of",
"a",
"and",
"b",
"giving",
"b",
"the",
"priority",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L1115-L1132 |
47,386 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | reduce | function reduce (f, seed, arr) {
var result = seed, i, n;
for (i = 0, n = arr.length; i < n; i++) {
result = f(result, arr[i]);
}
return result;
} | javascript | function reduce (f, seed, arr) {
var result = seed, i, n;
for (i = 0, n = arr.length; i < n; i++) {
result = f(result, arr[i]);
}
return result;
} | [
"function",
"reduce",
"(",
"f",
",",
"seed",
",",
"arr",
")",
"{",
"var",
"result",
"=",
"seed",
",",
"i",
",",
"n",
";",
"for",
"(",
"i",
"=",
"0",
",",
"n",
"=",
"arr",
".",
"length",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"resul... | Array.prototype.reduce has similar performance to Array.prototype.map, so we define a custom reduce function to increase performance | [
"Array",
".",
"prototype",
".",
"reduce",
"has",
"similar",
"performance",
"to",
"Array",
".",
"prototype",
".",
"map",
"so",
"we",
"define",
"a",
"custom",
"reduce",
"function",
"to",
"increase",
"performance"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L1136-L1142 |
47,387 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | curryMap | function curryMap (args, f, arr) {
var result = [], i, n;
for (i = 0, n = arr.length; i < n; i++) {
result.push(f(args, arr[i]));
}
return result;
} | javascript | function curryMap (args, f, arr) {
var result = [], i, n;
for (i = 0, n = arr.length; i < n; i++) {
result.push(f(args, arr[i]));
}
return result;
} | [
"function",
"curryMap",
"(",
"args",
",",
"f",
",",
"arr",
")",
"{",
"var",
"result",
"=",
"[",
"]",
",",
"i",
",",
"n",
";",
"for",
"(",
"i",
"=",
"0",
",",
"n",
"=",
"arr",
".",
"length",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
... | A special version of map to get around the performance hit for creating closures as a form of currying | [
"A",
"special",
"version",
"of",
"map",
"to",
"get",
"around",
"the",
"performance",
"hit",
"for",
"creating",
"closures",
"as",
"a",
"form",
"of",
"currying"
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L1146-L1152 |
47,388 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | map | function map (f, arr) {
var result = [], i, n;
for (i = 0, n = arr.length; i < n; i++) {
result.push(f(arr[i]));
}
return result;
} | javascript | function map (f, arr) {
var result = [], i, n;
for (i = 0, n = arr.length; i < n; i++) {
result.push(f(arr[i]));
}
return result;
} | [
"function",
"map",
"(",
"f",
",",
"arr",
")",
"{",
"var",
"result",
"=",
"[",
"]",
",",
"i",
",",
"n",
";",
"for",
"(",
"i",
"=",
"0",
",",
"n",
"=",
"arr",
".",
"length",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"result",
".",
"pu... | Array.prototype.map is supeeeeer slow. In fact, it is slower than a custom map function, which is usually slower than an inline for loop, but is more maintainable. | [
"Array",
".",
"prototype",
".",
"map",
"is",
"supeeeeer",
"slow",
".",
"In",
"fact",
"it",
"is",
"slower",
"than",
"a",
"custom",
"map",
"function",
"which",
"is",
"usually",
"slower",
"than",
"an",
"inline",
"for",
"loop",
"but",
"is",
"more",
"maintain... | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L1157-L1163 |
47,389 | taylor1791/promissory-arbiter | src/promissory-arbiter.js | startsWith | function startsWith (haystack, needle, startPosition) {
startPosition = startPosition || 0;
return haystack.lastIndexOf(needle, startPosition) === startPosition;
} | javascript | function startsWith (haystack, needle, startPosition) {
startPosition = startPosition || 0;
return haystack.lastIndexOf(needle, startPosition) === startPosition;
} | [
"function",
"startsWith",
"(",
"haystack",
",",
"needle",
",",
"startPosition",
")",
"{",
"startPosition",
"=",
"startPosition",
"||",
"0",
";",
"return",
"haystack",
".",
"lastIndexOf",
"(",
"needle",
",",
"startPosition",
")",
"===",
"startPosition",
";",
"}... | Determines whether a string begins with the characters of another string, returning true or false as appropriate. | [
"Determines",
"whether",
"a",
"string",
"begins",
"with",
"the",
"characters",
"of",
"another",
"string",
"returning",
"true",
"or",
"false",
"as",
"appropriate",
"."
] | 6327b87efd9ee997cbfaa009164dac266d9e16c2 | https://github.com/taylor1791/promissory-arbiter/blob/6327b87efd9ee997cbfaa009164dac266d9e16c2/src/promissory-arbiter.js#L1167-L1170 |
47,390 | DavideDaniel/npm-link-extra | lib/index.js | checkNpmVersion | function checkNpmVersion() {
return execa.shell('npm -v')
.then(({ stdout }) => stdout)
.then((v) => {
if (v && !(v.indexOf('3') === 0)) {
log('Use npm v3.10.10 for unobtrusive symlinks: npm i -g npm@3.10.10');
}
});
} | javascript | function checkNpmVersion() {
return execa.shell('npm -v')
.then(({ stdout }) => stdout)
.then((v) => {
if (v && !(v.indexOf('3') === 0)) {
log('Use npm v3.10.10 for unobtrusive symlinks: npm i -g npm@3.10.10');
}
});
} | [
"function",
"checkNpmVersion",
"(",
")",
"{",
"return",
"execa",
".",
"shell",
"(",
"'npm -v'",
")",
".",
"then",
"(",
"(",
"{",
"stdout",
"}",
")",
"=>",
"stdout",
")",
".",
"then",
"(",
"(",
"v",
")",
"=>",
"{",
"if",
"(",
"v",
"&&",
"!",
"("... | check npm version and show warning if needed | [
"check",
"npm",
"version",
"and",
"show",
"warning",
"if",
"needed"
] | 049112dc145b4325052f4ddf0ceadfa1e206c154 | https://github.com/DavideDaniel/npm-link-extra/blob/049112dc145b4325052f4ddf0ceadfa1e206c154/lib/index.js#L18-L26 |
47,391 | DavideDaniel/npm-link-extra | lib/index.js | linkPackages | function linkPackages(pathToPkgs) {
const pkgs = pathToPkgs.join(' ');
return execa
.shell(`npm link ${pkgs}`)
.then(() => log('Succesfully linked'));
} | javascript | function linkPackages(pathToPkgs) {
const pkgs = pathToPkgs.join(' ');
return execa
.shell(`npm link ${pkgs}`)
.then(() => log('Succesfully linked'));
} | [
"function",
"linkPackages",
"(",
"pathToPkgs",
")",
"{",
"const",
"pkgs",
"=",
"pathToPkgs",
".",
"join",
"(",
"' '",
")",
";",
"return",
"execa",
".",
"shell",
"(",
"`",
"${",
"pkgs",
"}",
"`",
")",
".",
"then",
"(",
"(",
")",
"=>",
"log",
"(",
... | Execa functions link packages | [
"Execa",
"functions",
"link",
"packages"
] | 049112dc145b4325052f4ddf0ceadfa1e206c154 | https://github.com/DavideDaniel/npm-link-extra/blob/049112dc145b4325052f4ddf0ceadfa1e206c154/lib/index.js#L84-L89 |
47,392 | DavideDaniel/npm-link-extra | lib/index.js | getSharedDepDirs | function getSharedDepDirs(pkgs, hash) {
return pkgs.map(({ name, dir }) => {
if (hash[name]) {
return dir;
}
return false;
}).filter(Boolean);
} | javascript | function getSharedDepDirs(pkgs, hash) {
return pkgs.map(({ name, dir }) => {
if (hash[name]) {
return dir;
}
return false;
}).filter(Boolean);
} | [
"function",
"getSharedDepDirs",
"(",
"pkgs",
",",
"hash",
")",
"{",
"return",
"pkgs",
".",
"map",
"(",
"(",
"{",
"name",
",",
"dir",
"}",
")",
"=>",
"{",
"if",
"(",
"hash",
"[",
"name",
"]",
")",
"{",
"return",
"dir",
";",
"}",
"return",
"false",... | getSharedDepDirs selects an array of shared and linked packages
@param {Array} pkgs An array of dependencies
@param {Object} hash A hash map of our deps
@return {Array} A filtered list of shared pkg dirs | [
"getSharedDepDirs",
"selects",
"an",
"array",
"of",
"shared",
"and",
"linked",
"packages"
] | 049112dc145b4325052f4ddf0ceadfa1e206c154 | https://github.com/DavideDaniel/npm-link-extra/blob/049112dc145b4325052f4ddf0ceadfa1e206c154/lib/index.js#L117-L124 |
47,393 | DavideDaniel/npm-link-extra | lib/index.js | getSharedLinked | function getSharedLinked(pkgs, hash) {
return pkgs.map((name) => {
const module = hash[name];
if (module && module.isLinked) {
return name;
}
return false;
}).filter(Boolean);
} | javascript | function getSharedLinked(pkgs, hash) {
return pkgs.map((name) => {
const module = hash[name];
if (module && module.isLinked) {
return name;
}
return false;
}).filter(Boolean);
} | [
"function",
"getSharedLinked",
"(",
"pkgs",
",",
"hash",
")",
"{",
"return",
"pkgs",
".",
"map",
"(",
"(",
"name",
")",
"=>",
"{",
"const",
"module",
"=",
"hash",
"[",
"name",
"]",
";",
"if",
"(",
"module",
"&&",
"module",
".",
"isLinked",
")",
"{"... | getSharedLinked selects an array of shared and linked packages
@param {Array} pkgs An array of dependencies
@param {Object} hash A hash map of our deps
@return {Array} A filtered list of packages | [
"getSharedLinked",
"selects",
"an",
"array",
"of",
"shared",
"and",
"linked",
"packages"
] | 049112dc145b4325052f4ddf0ceadfa1e206c154 | https://github.com/DavideDaniel/npm-link-extra/blob/049112dc145b4325052f4ddf0ceadfa1e206c154/lib/index.js#L133-L141 |
47,394 | DavideDaniel/npm-link-extra | lib/index.js | getSharedDeps | function getSharedDeps(pkgs, hash) {
return pkgs.map(({ name }) => {
if (hash[name]) {
return name;
}
return false;
}).filter(Boolean);
} | javascript | function getSharedDeps(pkgs, hash) {
return pkgs.map(({ name }) => {
if (hash[name]) {
return name;
}
return false;
}).filter(Boolean);
} | [
"function",
"getSharedDeps",
"(",
"pkgs",
",",
"hash",
")",
"{",
"return",
"pkgs",
".",
"map",
"(",
"(",
"{",
"name",
"}",
")",
"=>",
"{",
"if",
"(",
"hash",
"[",
"name",
"]",
")",
"{",
"return",
"name",
";",
"}",
"return",
"false",
";",
"}",
"... | getSharedDeps will show any shared dependencies between project & target dir
@param {Array} pkgs An array of dependencies
@param {Object} hash A hash map of our deps
@return {Array} Array of shared dep names | [
"getSharedDeps",
"will",
"show",
"any",
"shared",
"dependencies",
"between",
"project",
"&",
"target",
"dir"
] | 049112dc145b4325052f4ddf0ceadfa1e206c154 | https://github.com/DavideDaniel/npm-link-extra/blob/049112dc145b4325052f4ddf0ceadfa1e206c154/lib/index.js#L149-L156 |
47,395 | DavideDaniel/npm-link-extra | lib/index.js | getLinkedDeps | function getLinkedDeps(pkgs) {
return pkgs.map((name) => {
const isLinked = checkForLink(name);
return isLinked ? name : false;
}).filter(Boolean);
} | javascript | function getLinkedDeps(pkgs) {
return pkgs.map((name) => {
const isLinked = checkForLink(name);
return isLinked ? name : false;
}).filter(Boolean);
} | [
"function",
"getLinkedDeps",
"(",
"pkgs",
")",
"{",
"return",
"pkgs",
".",
"map",
"(",
"(",
"name",
")",
"=>",
"{",
"const",
"isLinked",
"=",
"checkForLink",
"(",
"name",
")",
";",
"return",
"isLinked",
"?",
"name",
":",
"false",
";",
"}",
")",
".",
... | getLinkedDeps returns a list of linked dependencies
@param {Array} pkgs An array of dependencies
@return {Array} Array of linked dep names | [
"getLinkedDeps",
"returns",
"a",
"list",
"of",
"linked",
"dependencies"
] | 049112dc145b4325052f4ddf0ceadfa1e206c154 | https://github.com/DavideDaniel/npm-link-extra/blob/049112dc145b4325052f4ddf0ceadfa1e206c154/lib/index.js#L163-L168 |
47,396 | DavideDaniel/npm-link-extra | lib/index.js | showLinkedDeps | function showLinkedDeps() {
const linkedDeps = getLinkedDeps(packageKeys, packageHash);
if (linkedDeps.length) {
logPkgsMsg('Linked', linkedDeps);
} else {
log('No linked dependencies found');
}
} | javascript | function showLinkedDeps() {
const linkedDeps = getLinkedDeps(packageKeys, packageHash);
if (linkedDeps.length) {
logPkgsMsg('Linked', linkedDeps);
} else {
log('No linked dependencies found');
}
} | [
"function",
"showLinkedDeps",
"(",
")",
"{",
"const",
"linkedDeps",
"=",
"getLinkedDeps",
"(",
"packageKeys",
",",
"packageHash",
")",
";",
"if",
"(",
"linkedDeps",
".",
"length",
")",
"{",
"logPkgsMsg",
"(",
"'Linked'",
",",
"linkedDeps",
")",
";",
"}",
"... | show all linked dependencies in your node_modules | [
"show",
"all",
"linked",
"dependencies",
"in",
"your",
"node_modules"
] | 049112dc145b4325052f4ddf0ceadfa1e206c154 | https://github.com/DavideDaniel/npm-link-extra/blob/049112dc145b4325052f4ddf0ceadfa1e206c154/lib/index.js#L203-L210 |
47,397 | saggiyogesh/nodeportal | public/ckeditor/_source/plugins/scayt/dialogs/options.js | function( option, list )
{
var label = doc.createElement( 'label' );
label.setAttribute( 'for', 'cke_option' + option );
label.setHtml( list[ option ] );
if ( dialog.sLang == option ) // Current.
dialog.chosed_lang = option;
var div = doc.createElement( 'div' );
var radio = CKEDITOR.... | javascript | function( option, list )
{
var label = doc.createElement( 'label' );
label.setAttribute( 'for', 'cke_option' + option );
label.setHtml( list[ option ] );
if ( dialog.sLang == option ) // Current.
dialog.chosed_lang = option;
var div = doc.createElement( 'div' );
var radio = CKEDITOR.... | [
"function",
"(",
"option",
",",
"list",
")",
"{",
"var",
"label",
"=",
"doc",
".",
"createElement",
"(",
"'label'",
")",
";",
"label",
".",
"setAttribute",
"(",
"'for'",
",",
"'cke_option'",
"+",
"option",
")",
";",
"label",
".",
"setHtml",
"(",
"list"... | Create languages tab. | [
"Create",
"languages",
"tab",
"."
] | cfd5b340f259d3a57c20892a1e2c95b133fe99ee | https://github.com/saggiyogesh/nodeportal/blob/cfd5b340f259d3a57c20892a1e2c95b133fe99ee/public/ckeditor/_source/plugins/scayt/dialogs/options.js#L262-L291 | |
47,398 | Kurento/kurento-module-pointerdetector-js | lib/complexTypes/PointerDetectorWindowMediaParam.js | PointerDetectorWindowMediaParam | function PointerDetectorWindowMediaParam(pointerDetectorWindowMediaParamDict){
if(!(this instanceof PointerDetectorWindowMediaParam))
return new PointerDetectorWindowMediaParam(pointerDetectorWindowMediaParamDict)
pointerDetectorWindowMediaParamDict = pointerDetectorWindowMediaParamDict || {}
// Check point... | javascript | function PointerDetectorWindowMediaParam(pointerDetectorWindowMediaParamDict){
if(!(this instanceof PointerDetectorWindowMediaParam))
return new PointerDetectorWindowMediaParam(pointerDetectorWindowMediaParamDict)
pointerDetectorWindowMediaParamDict = pointerDetectorWindowMediaParamDict || {}
// Check point... | [
"function",
"PointerDetectorWindowMediaParam",
"(",
"pointerDetectorWindowMediaParamDict",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"PointerDetectorWindowMediaParam",
")",
")",
"return",
"new",
"PointerDetectorWindowMediaParam",
"(",
"pointerDetectorWindowMediaParam... | Data structure for UI Pointer detection in video streams.
All the coordinates are in pixels. X is horizontal, Y is vertical, running
from the top of the window. Thus, 0,0 corresponds to the topleft corner.
@constructor module:pointerdetector/complexTypes.PointerDetectorWindowMediaParam
@property {external:String} id
... | [
"Data",
"structure",
"for",
"UI",
"Pointer",
"detection",
"in",
"video",
"streams",
".",
"All",
"the",
"coordinates",
"are",
"in",
"pixels",
".",
"X",
"is",
"horizontal",
"Y",
"is",
"vertical",
"running",
"from",
"the",
"top",
"of",
"the",
"window",
".",
... | b5bce99fcd7087f12d14c39584edd6093099437e | https://github.com/Kurento/kurento-module-pointerdetector-js/blob/b5bce99fcd7087f12d14c39584edd6093099437e/lib/complexTypes/PointerDetectorWindowMediaParam.js#L55-L126 |
47,399 | ohager/stappo | gulpfile.js | renderTemplate | function renderTemplate(impl, targetFile){
var stappoImpl = fs.readFileSync(impl, "utf8");
return gulp.src([targetFile])
.pipe(replace('/*__stappo_impl__*/', stappoImpl));
} | javascript | function renderTemplate(impl, targetFile){
var stappoImpl = fs.readFileSync(impl, "utf8");
return gulp.src([targetFile])
.pipe(replace('/*__stappo_impl__*/', stappoImpl));
} | [
"function",
"renderTemplate",
"(",
"impl",
",",
"targetFile",
")",
"{",
"var",
"stappoImpl",
"=",
"fs",
".",
"readFileSync",
"(",
"impl",
",",
"\"utf8\"",
")",
";",
"return",
"gulp",
".",
"src",
"(",
"[",
"targetFile",
"]",
")",
".",
"pipe",
"(",
"repl... | web-only implementation | [
"web",
"-",
"only",
"implementation"
] | 1e89154e003d99975eeb1ee6ab0d456aea58b7d1 | https://github.com/ohager/stappo/blob/1e89154e003d99975eeb1ee6ab0d456aea58b7d1/gulpfile.js#L17-L21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.