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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
55,500 | infonl/delegator | index.js | Delegator | function Delegator(id, events, capture, bubble, contextDocument) {
this.bubble = bubble;
this.capture = capture;
this.document = contextDocument;
this.documentElement = contextDocument.documentElement;
this.events = events;
this.id = id;
this.registry = {};
} | javascript | function Delegator(id, events, capture, bubble, contextDocument) {
this.bubble = bubble;
this.capture = capture;
this.document = contextDocument;
this.documentElement = contextDocument.documentElement;
this.events = events;
this.id = id;
this.registry = {};
} | [
"function",
"Delegator",
"(",
"id",
",",
"events",
",",
"capture",
",",
"bubble",
",",
"contextDocument",
")",
"{",
"this",
".",
"bubble",
"=",
"bubble",
";",
"this",
".",
"capture",
"=",
"capture",
";",
"this",
".",
"document",
"=",
"contextDocument",
"... | Generic delegator for user interaction events,
intended to be consumed by an encapsulation module
that exposes an API that addresses concerns like
proper usage, privacy, sensible defaults and such.
@param {String} id
@param {Array} events
@param {Array} capture
@param {Array} bubble
@param {Document} contextDocument
@... | [
"Generic",
"delegator",
"for",
"user",
"interaction",
"events",
"intended",
"to",
"be",
"consumed",
"by",
"an",
"encapsulation",
"module",
"that",
"exposes",
"an",
"API",
"that",
"addresses",
"concerns",
"like",
"proper",
"usage",
"privacy",
"sensible",
"defaults"... | 3ed07c189109ec7f6e1475cca3313ded9a72a75a | https://github.com/infonl/delegator/blob/3ed07c189109ec7f6e1475cca3313ded9a72a75a/index.js#L16-L24 |
55,501 | infonl/delegator | index.js | function (event) {
var trigger = event.target;
var probe = function (type) {
if ((type !== event.type) || (1 !== trigger.nodeType)) {
return false;
}
var attribute = ['data', this.id, type].join('-');
var key = trigger.getAttribute(attribu... | javascript | function (event) {
var trigger = event.target;
var probe = function (type) {
if ((type !== event.type) || (1 !== trigger.nodeType)) {
return false;
}
var attribute = ['data', this.id, type].join('-');
var key = trigger.getAttribute(attribu... | [
"function",
"(",
"event",
")",
"{",
"var",
"trigger",
"=",
"event",
".",
"target",
";",
"var",
"probe",
"=",
"function",
"(",
"type",
")",
"{",
"if",
"(",
"(",
"type",
"!==",
"event",
".",
"type",
")",
"||",
"(",
"1",
"!==",
"trigger",
".",
"node... | Delegate the event.
@param {Event} event | [
"Delegate",
"the",
"event",
"."
] | 3ed07c189109ec7f6e1475cca3313ded9a72a75a | https://github.com/infonl/delegator/blob/3ed07c189109ec7f6e1475cca3313ded9a72a75a/index.js#L33-L62 | |
55,502 | infonl/delegator | index.js | function (map) {
Object.keys(map).forEach(function (key) {
if (!this.registry.hasOwnProperty(key)) {
this.registry[key] = map[key];
}
}, this);
return this;
} | javascript | function (map) {
Object.keys(map).forEach(function (key) {
if (!this.registry.hasOwnProperty(key)) {
this.registry[key] = map[key];
}
}, this);
return this;
} | [
"function",
"(",
"map",
")",
"{",
"Object",
".",
"keys",
"(",
"map",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"!",
"this",
".",
"registry",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"this",
".",
"registry",
"... | Add handlers to the registry.
@param {Object} map
@returns {Delegator} | [
"Add",
"handlers",
"to",
"the",
"registry",
"."
] | 3ed07c189109ec7f6e1475cca3313ded9a72a75a | https://github.com/infonl/delegator/blob/3ed07c189109ec7f6e1475cca3313ded9a72a75a/index.js#L83-L90 | |
55,503 | LOKE/loke-config | lib/loke-config.js | LokeConfig | function LokeConfig(appName, options) {
options = options || {};
// check args
if (typeof appName !== 'string' || appName === '') {
throw new Error('LokeConfig requires appName to be provided');
}
if (Array.isArray(options)) {
// Support original argument format:
if (options.length === 0) {
... | javascript | function LokeConfig(appName, options) {
options = options || {};
// check args
if (typeof appName !== 'string' || appName === '') {
throw new Error('LokeConfig requires appName to be provided');
}
if (Array.isArray(options)) {
// Support original argument format:
if (options.length === 0) {
... | [
"function",
"LokeConfig",
"(",
"appName",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"// check args",
"if",
"(",
"typeof",
"appName",
"!==",
"'string'",
"||",
"appName",
"===",
"''",
")",
"{",
"throw",
"new",
"Error",
"(",
... | Creates a new LOKE config instance
@param {String} appName The application name or ID.
Should match where the config files are placed/
@param {String} [options.appPath]
@param {[String]} [options.paths] An array of full paths to search for files.
The first file on the list should be the defaults and specify all values. | [
"Creates",
"a",
"new",
"LOKE",
"config",
"instance"
] | 84c207b2724c919bc6dde5efd7e7328591908cce | https://github.com/LOKE/loke-config/blob/84c207b2724c919bc6dde5efd7e7328591908cce/lib/loke-config.js#L18-L66 |
55,504 | adiwidjaja/frontend-pagebuilder | js/tinymce/plugins/bbcode/plugin.js | function (s) {
s = Tools.trim(s);
function rep(re, str) {
s = s.replace(re, str);
}
// example: <strong> to [b]
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi, "[url=$1]$2[/url]");
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi... | javascript | function (s) {
s = Tools.trim(s);
function rep(re, str) {
s = s.replace(re, str);
}
// example: <strong> to [b]
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi, "[url=$1]$2[/url]");
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi... | [
"function",
"(",
"s",
")",
"{",
"s",
"=",
"Tools",
".",
"trim",
"(",
"s",
")",
";",
"function",
"rep",
"(",
"re",
",",
"str",
")",
"{",
"s",
"=",
"s",
".",
"replace",
"(",
"re",
",",
"str",
")",
";",
"}",
"// example: <strong> to [b]",
"rep",
"... | Private methods HTML -> BBCode in PunBB dialect | [
"Private",
"methods",
"HTML",
"-",
">",
"BBCode",
"in",
"PunBB",
"dialect"
] | a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f | https://github.com/adiwidjaja/frontend-pagebuilder/blob/a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f/js/tinymce/plugins/bbcode/plugin.js#L182-L229 | |
55,505 | adiwidjaja/frontend-pagebuilder | js/tinymce/plugins/bbcode/plugin.js | function (s) {
s = Tools.trim(s);
function rep(re, str) {
s = s.replace(re, str);
}
// example: [b] to <strong>
rep(/\n/gi, "<br />");
rep(/\[b\]/gi, "<strong>");
rep(/\[\/b\]/gi, "</strong>");
rep(/\[i\]/gi, "<em>");
... | javascript | function (s) {
s = Tools.trim(s);
function rep(re, str) {
s = s.replace(re, str);
}
// example: [b] to <strong>
rep(/\n/gi, "<br />");
rep(/\[b\]/gi, "<strong>");
rep(/\[\/b\]/gi, "</strong>");
rep(/\[i\]/gi, "<em>");
... | [
"function",
"(",
"s",
")",
"{",
"s",
"=",
"Tools",
".",
"trim",
"(",
"s",
")",
";",
"function",
"rep",
"(",
"re",
",",
"str",
")",
"{",
"s",
"=",
"s",
".",
"replace",
"(",
"re",
",",
"str",
")",
";",
"}",
"// example: [b] to <strong>",
"rep",
"... | BBCode -> HTML from PunBB dialect | [
"BBCode",
"-",
">",
"HTML",
"from",
"PunBB",
"dialect"
] | a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f | https://github.com/adiwidjaja/frontend-pagebuilder/blob/a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f/js/tinymce/plugins/bbcode/plugin.js#L232-L255 | |
55,506 | Ma3Route/node-sdk | lib/auth.js | addSignature | function addSignature(key, secret, uri, body, options) {
if (!_.isString(key) || !_.isString(secret)) {
throw new errors.AuthenticationRequiredError("key and secret must be provided for signing requests");
}
options = options || {};
// remove signature if it exists in URI object
uri.removeS... | javascript | function addSignature(key, secret, uri, body, options) {
if (!_.isString(key) || !_.isString(secret)) {
throw new errors.AuthenticationRequiredError("key and secret must be provided for signing requests");
}
options = options || {};
// remove signature if it exists in URI object
uri.removeS... | [
"function",
"addSignature",
"(",
"key",
",",
"secret",
",",
"uri",
",",
"body",
",",
"options",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"key",
")",
"||",
"!",
"_",
".",
"isString",
"(",
"secret",
")",
")",
"{",
"throw",
"new",
"error... | Add signature to URI instance for use in authenticating against the API.
The request body will be stringified using JSON.stringify if its not
a string.
@private
@memberof auth
@param {String} key - used to identify the client
@param {String} secret - used to sign the request
@param {URIjs} uri - an instance of URIjs
... | [
"Add",
"signature",
"to",
"URI",
"instance",
"for",
"use",
"in",
"authenticating",
"against",
"the",
"API",
".",
"The",
"request",
"body",
"will",
"be",
"stringified",
"using",
"JSON",
".",
"stringify",
"if",
"its",
"not",
"a",
"string",
"."
] | a2769d97d77d6f762d23e743bf4c749e2bad0d8a | https://github.com/Ma3Route/node-sdk/blob/a2769d97d77d6f762d23e743bf4c749e2bad0d8a/lib/auth.js#L49-L112 |
55,507 | Ma3Route/node-sdk | lib/auth.js | sign | function sign(key, secret, uri, body, options) {
// add timestamp
uri.addQuery("timestamp", utils.createTimestamp());
// add signature
addSignature(key, secret, uri, body, options);
return uri;
} | javascript | function sign(key, secret, uri, body, options) {
// add timestamp
uri.addQuery("timestamp", utils.createTimestamp());
// add signature
addSignature(key, secret, uri, body, options);
return uri;
} | [
"function",
"sign",
"(",
"key",
",",
"secret",
",",
"uri",
",",
"body",
",",
"options",
")",
"{",
"// add timestamp",
"uri",
".",
"addQuery",
"(",
"\"timestamp\"",
",",
"utils",
".",
"createTimestamp",
"(",
")",
")",
";",
"// add signature",
"addSignature",
... | Sign a URI instance.
Automatically adds a timestamp to the URI instance.
@public
@param {String} key - key used to sign
@param {String} secret - used to sign the request
@param {URIjs} uri - an instance of URIjs
@param {*} body - body to used in request
@param {Object} [options] - options
@param {Number} [options.api... | [
"Sign",
"a",
"URI",
"instance",
".",
"Automatically",
"adds",
"a",
"timestamp",
"to",
"the",
"URI",
"instance",
"."
] | a2769d97d77d6f762d23e743bf4c749e2bad0d8a | https://github.com/Ma3Route/node-sdk/blob/a2769d97d77d6f762d23e743bf4c749e2bad0d8a/lib/auth.js#L130-L138 |
55,508 | ozinc/node-restify-links | lib/links.js | makeLink | function makeLink(rel, ldo) {
var i, key, keys, result;
if (typeof ldo === 'string') {
return '<' + ldo + '>; rel="' + rel + '"';
}
result = '<' + ldo.href + '>; rel="' + rel + '"';
keys = Object.keys(ldo);
for (i = 0; i < keys.length; i += 1) {
key = keys[i];
if (key !== 'href' && key !== '... | javascript | function makeLink(rel, ldo) {
var i, key, keys, result;
if (typeof ldo === 'string') {
return '<' + ldo + '>; rel="' + rel + '"';
}
result = '<' + ldo.href + '>; rel="' + rel + '"';
keys = Object.keys(ldo);
for (i = 0; i < keys.length; i += 1) {
key = keys[i];
if (key !== 'href' && key !== '... | [
"function",
"makeLink",
"(",
"rel",
",",
"ldo",
")",
"{",
"var",
"i",
",",
"key",
",",
"keys",
",",
"result",
";",
"if",
"(",
"typeof",
"ldo",
"===",
"'string'",
")",
"{",
"return",
"'<'",
"+",
"ldo",
"+",
"'>; rel=\"'",
"+",
"rel",
"+",
"'\"'",
... | Set Link header field with the given `links`.
Examples:
res.links({
next: 'http://api.example.com/users?page=2',
last: 'http://api.example.com/users?page=5'
});
@param {Object} links
@return {ServerResponse}
@api public | [
"Set",
"Link",
"header",
"field",
"with",
"the",
"given",
"links",
"."
] | 68213903fa4ff8d9e55697bff1e8cd2fa348089f | https://github.com/ozinc/node-restify-links/blob/68213903fa4ff8d9e55697bff1e8cd2fa348089f/lib/links.js#L18-L37 |
55,509 | hpcloud/hpcloud-js | lib/objectstorage/index.js | newFromIdentity | function newFromIdentity(identity, region) {
var service = identity.serviceByName('object-store', region);
var endpoint = service.publicURL;
var os = new ObjectStorage(identity.token(), endpoint);
return os;
} | javascript | function newFromIdentity(identity, region) {
var service = identity.serviceByName('object-store', region);
var endpoint = service.publicURL;
var os = new ObjectStorage(identity.token(), endpoint);
return os;
} | [
"function",
"newFromIdentity",
"(",
"identity",
",",
"region",
")",
"{",
"var",
"service",
"=",
"identity",
".",
"serviceByName",
"(",
"'object-store'",
",",
"region",
")",
";",
"var",
"endpoint",
"=",
"service",
".",
"publicURL",
";",
"var",
"os",
"=",
"n... | Create a new ObjectStorage instance from an IdentityServices
Identity.
@param {Identity} identity
An identity with a service catalog.
@param {string} region
The availability zone. e.g. 'az-1.region-a.geo-1'. If this is
omitted, the first available object storage will be used.
@param {Function} fn
A callback, which wil... | [
"Create",
"a",
"new",
"ObjectStorage",
"instance",
"from",
"an",
"IdentityServices",
"Identity",
"."
] | c457ea3ee6a21e361d1af0af70d64622b6910208 | https://github.com/hpcloud/hpcloud-js/blob/c457ea3ee6a21e361d1af0af70d64622b6910208/lib/objectstorage/index.js#L57-L63 |
55,510 | d08ble/livecomment | public/js/main.js | modifyState | function modifyState($n) {
var state = self.state;
function selectByStateRecursive(name) {
if (state.recursive) {
return $n.find(name);
} else {
return $n.children(name)
}
}
var a;
var b;
if (state.mode == 'code') {
a = selectByStateRecursive('pre:visibl... | javascript | function modifyState($n) {
var state = self.state;
function selectByStateRecursive(name) {
if (state.recursive) {
return $n.find(name);
} else {
return $n.children(name)
}
}
var a;
var b;
if (state.mode == 'code') {
a = selectByStateRecursive('pre:visibl... | [
"function",
"modifyState",
"(",
"$n",
")",
"{",
"var",
"state",
"=",
"self",
".",
"state",
";",
"function",
"selectByStateRecursive",
"(",
"name",
")",
"{",
"if",
"(",
"state",
".",
"recursive",
")",
"{",
"return",
"$n",
".",
"find",
"(",
"name",
")",
... | DOM UPDATE STATE [ | [
"DOM",
"UPDATE",
"STATE",
"["
] | 9c4a00878101501411668070b4f6e7719e10d1fd | https://github.com/d08ble/livecomment/blob/9c4a00878101501411668070b4f6e7719e10d1fd/public/js/main.js#L204-L257 |
55,511 | UXFoundry/hashdo | lib/packs.js | function (baseUrl, cardsDirectory) {
var packs = _.filter(FS.readdirSync(cardsDirectory), function (dir) { return _.startsWith(dir, 'hashdo-'); });
console.log('PACKS: Cards will be loaded from %s.', cardsDirectory);
var packCounter = 0,
cardCounter = 0,
hiddenCounter = 0;
for (... | javascript | function (baseUrl, cardsDirectory) {
var packs = _.filter(FS.readdirSync(cardsDirectory), function (dir) { return _.startsWith(dir, 'hashdo-'); });
console.log('PACKS: Cards will be loaded from %s.', cardsDirectory);
var packCounter = 0,
cardCounter = 0,
hiddenCounter = 0;
for (... | [
"function",
"(",
"baseUrl",
",",
"cardsDirectory",
")",
"{",
"var",
"packs",
"=",
"_",
".",
"filter",
"(",
"FS",
".",
"readdirSync",
"(",
"cardsDirectory",
")",
",",
"function",
"(",
"dir",
")",
"{",
"return",
"_",
".",
"startsWith",
"(",
"dir",
",",
... | Initializes and caches the packs and card data.
This function should be called before any other functions in the packs API.
@method init
@param {String} baseUrl The protocol and host name where your cards are being hosted. Eg: https://hashdo.com
@param {String} cardsDirectory The directory where you packs a... | [
"Initializes",
"and",
"caches",
"the",
"packs",
"and",
"card",
"data",
".",
"This",
"function",
"should",
"be",
"called",
"before",
"any",
"other",
"functions",
"in",
"the",
"packs",
"API",
"."
] | c2a0adcba0cca26d6ebe56bba17017b177609057 | https://github.com/UXFoundry/hashdo/blob/c2a0adcba0cca26d6ebe56bba17017b177609057/lib/packs.js#L48-L109 | |
55,512 | UXFoundry/hashdo | lib/packs.js | function (filter) {
if (cardCount > 0) {
return cardCount;
}
else {
cardCount = 0;
if (filter) {
filter = filter.toLowerCase();
_.each(_.keys(cardPacks), function (packKey) {
_.each(_.keys(cardPacks[packKey].cards), function (cardKey) {
var card ... | javascript | function (filter) {
if (cardCount > 0) {
return cardCount;
}
else {
cardCount = 0;
if (filter) {
filter = filter.toLowerCase();
_.each(_.keys(cardPacks), function (packKey) {
_.each(_.keys(cardPacks[packKey].cards), function (cardKey) {
var card ... | [
"function",
"(",
"filter",
")",
"{",
"if",
"(",
"cardCount",
">",
"0",
")",
"{",
"return",
"cardCount",
";",
"}",
"else",
"{",
"cardCount",
"=",
"0",
";",
"if",
"(",
"filter",
")",
"{",
"filter",
"=",
"filter",
".",
"toLowerCase",
"(",
")",
";",
... | Get the number of cards matching an optional filter.
@method count
@param {String} [filter] Optional filter for card names. The filter will use fuzzy matching.
@returns {Number} The number of cards found matching the filter. | [
"Get",
"the",
"number",
"of",
"cards",
"matching",
"an",
"optional",
"filter",
"."
] | c2a0adcba0cca26d6ebe56bba17017b177609057 | https://github.com/UXFoundry/hashdo/blob/c2a0adcba0cca26d6ebe56bba17017b177609057/lib/packs.js#L119-L147 | |
55,513 | UXFoundry/hashdo | lib/packs.js | function (pack, card) {
if (cardPacks[pack] && cardPacks[pack].cards[card]) {
return cardPacks[pack].cards[card];
}
} | javascript | function (pack, card) {
if (cardPacks[pack] && cardPacks[pack].cards[card]) {
return cardPacks[pack].cards[card];
}
} | [
"function",
"(",
"pack",
",",
"card",
")",
"{",
"if",
"(",
"cardPacks",
"[",
"pack",
"]",
"&&",
"cardPacks",
"[",
"pack",
"]",
".",
"cards",
"[",
"card",
"]",
")",
"{",
"return",
"cardPacks",
"[",
"pack",
"]",
".",
"cards",
"[",
"card",
"]",
";",... | Get a specific card object.
@method card
@param {String} pack The pack name.
@param {String} card The card name.
@returns {Object} The card object macthing the pack and name provided, undefined if not found. | [
"Get",
"a",
"specific",
"card",
"object",
"."
] | c2a0adcba0cca26d6ebe56bba17017b177609057 | https://github.com/UXFoundry/hashdo/blob/c2a0adcba0cca26d6ebe56bba17017b177609057/lib/packs.js#L199-L203 | |
55,514 | jias/eoraptor.js | build/eoraptor.js | compile | function compile (str, options) {
var id;
var render;
str = str || EMPTY;
options = options || {};
id = options.id || str;
render = eoraptor[id];
if (render) {
return render;
}
var oTag = options.oTag || OTAG;
var cTag = options.cTag || CTAG;
var code = build(par... | javascript | function compile (str, options) {
var id;
var render;
str = str || EMPTY;
options = options || {};
id = options.id || str;
render = eoraptor[id];
if (render) {
return render;
}
var oTag = options.oTag || OTAG;
var cTag = options.cTag || CTAG;
var code = build(par... | [
"function",
"compile",
"(",
"str",
",",
"options",
")",
"{",
"var",
"id",
";",
"var",
"render",
";",
"str",
"=",
"str",
"||",
"EMPTY",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"id",
"=",
"options",
".",
"id",
"||",
"str",
";",
"render... | to compile a template string to callable render @param {string} str a template string @param {object} options optional @param {string} options.id the unique name for the template @param {string} options.oTag set a one-off opening tag TODO oTag cTag | [
"to",
"compile",
"a",
"template",
"string",
"to",
"callable",
"render"
] | 65483f3c6c001d75de3f5c240d999351f73d1fc1 | https://github.com/jias/eoraptor.js/blob/65483f3c6c001d75de3f5c240d999351f73d1fc1/build/eoraptor.js#L100-L135 |
55,515 | jias/eoraptor.js | build/eoraptor.js | isOTag | function isOTag (str, oTag, index) {
var l = oTag.length, s = str.substr(index, l), sign = str.charAt(index+l);
// NOTE 要保证sign有值 如果当前的index已经是字符串尾部 如'foo{{' sign为空
if (oTag === s && sign && SIGN.indexOf(sign) > -1) {
return {
str: s + sign,
index: index,
// sign:... | javascript | function isOTag (str, oTag, index) {
var l = oTag.length, s = str.substr(index, l), sign = str.charAt(index+l);
// NOTE 要保证sign有值 如果当前的index已经是字符串尾部 如'foo{{' sign为空
if (oTag === s && sign && SIGN.indexOf(sign) > -1) {
return {
str: s + sign,
index: index,
// sign:... | [
"function",
"isOTag",
"(",
"str",
",",
"oTag",
",",
"index",
")",
"{",
"var",
"l",
"=",
"oTag",
".",
"length",
",",
"s",
"=",
"str",
".",
"substr",
"(",
"index",
",",
"l",
")",
",",
"sign",
"=",
"str",
".",
"charAt",
"(",
"index",
"+",
"l",
"... | Is it the first char of an opening tag? | [
"Is",
"it",
"the",
"first",
"char",
"of",
"an",
"opening",
"tag?"
] | 65483f3c6c001d75de3f5c240d999351f73d1fc1 | https://github.com/jias/eoraptor.js/blob/65483f3c6c001d75de3f5c240d999351f73d1fc1/build/eoraptor.js#L238-L252 |
55,516 | jias/eoraptor.js | build/eoraptor.js | isCTag | function isCTag (str, cTag, index) {
var l = cTag.length, s = str.substr(index, l);
if (cTag === s) {
return {
str: s,
index: index,
type: 1,
jump: l - 1
};
}
} | javascript | function isCTag (str, cTag, index) {
var l = cTag.length, s = str.substr(index, l);
if (cTag === s) {
return {
str: s,
index: index,
type: 1,
jump: l - 1
};
}
} | [
"function",
"isCTag",
"(",
"str",
",",
"cTag",
",",
"index",
")",
"{",
"var",
"l",
"=",
"cTag",
".",
"length",
",",
"s",
"=",
"str",
".",
"substr",
"(",
"index",
",",
"l",
")",
";",
"if",
"(",
"cTag",
"===",
"s",
")",
"{",
"return",
"{",
"str... | Is it the first char of a closing tag? | [
"Is",
"it",
"the",
"first",
"char",
"of",
"a",
"closing",
"tag?"
] | 65483f3c6c001d75de3f5c240d999351f73d1fc1 | https://github.com/jias/eoraptor.js/blob/65483f3c6c001d75de3f5c240d999351f73d1fc1/build/eoraptor.js#L255-L265 |
55,517 | jias/eoraptor.js | build/eoraptor.js | isOSB | function isOSB (str, index) {
var quote = str.charAt(index+1);
if (quote === DQ || quote === SQ) {
return {
str: LSB + quote,
index: index,
quote: quote,
jump: 1
};
}
} | javascript | function isOSB (str, index) {
var quote = str.charAt(index+1);
if (quote === DQ || quote === SQ) {
return {
str: LSB + quote,
index: index,
quote: quote,
jump: 1
};
}
} | [
"function",
"isOSB",
"(",
"str",
",",
"index",
")",
"{",
"var",
"quote",
"=",
"str",
".",
"charAt",
"(",
"index",
"+",
"1",
")",
";",
"if",
"(",
"quote",
"===",
"DQ",
"||",
"quote",
"===",
"SQ",
")",
"{",
"return",
"{",
"str",
":",
"LSB",
"+",
... | Is it the first char of an opening square bracket expression? | [
"Is",
"it",
"the",
"first",
"char",
"of",
"an",
"opening",
"square",
"bracket",
"expression?"
] | 65483f3c6c001d75de3f5c240d999351f73d1fc1 | https://github.com/jias/eoraptor.js/blob/65483f3c6c001d75de3f5c240d999351f73d1fc1/build/eoraptor.js#L272-L282 |
55,518 | jias/eoraptor.js | build/eoraptor.js | isCSB | function isCSB (str, index, quote) {
if (str.charAt(index+1) === RSB) {
return {
str: quote + RSB,
index: index,
quote: quote,
jump: 1
};
}
} | javascript | function isCSB (str, index, quote) {
if (str.charAt(index+1) === RSB) {
return {
str: quote + RSB,
index: index,
quote: quote,
jump: 1
};
}
} | [
"function",
"isCSB",
"(",
"str",
",",
"index",
",",
"quote",
")",
"{",
"if",
"(",
"str",
".",
"charAt",
"(",
"index",
"+",
"1",
")",
"===",
"RSB",
")",
"{",
"return",
"{",
"str",
":",
"quote",
"+",
"RSB",
",",
"index",
":",
"index",
",",
"quote... | Is it the first char of a closing square bracket expression? | [
"Is",
"it",
"the",
"first",
"char",
"of",
"a",
"closing",
"square",
"bracket",
"expression?"
] | 65483f3c6c001d75de3f5c240d999351f73d1fc1 | https://github.com/jias/eoraptor.js/blob/65483f3c6c001d75de3f5c240d999351f73d1fc1/build/eoraptor.js#L285-L294 |
55,519 | melvincarvalho/rdf-shell | lib/ws.js | ws | function ws(argv, callback) {
if (!argv[2]) {
console.error("url is required");
console.error("Usage : ws <url>");
process.exit(-1);
}
var uri = argv[2];
var updatesVia = 'wss://' + uri.split('/')[2] + '/';
var s;
var connect = function(){
s = new wss(updatesVia, {
origin: 'http://we... | javascript | function ws(argv, callback) {
if (!argv[2]) {
console.error("url is required");
console.error("Usage : ws <url>");
process.exit(-1);
}
var uri = argv[2];
var updatesVia = 'wss://' + uri.split('/')[2] + '/';
var s;
var connect = function(){
s = new wss(updatesVia, {
origin: 'http://we... | [
"function",
"ws",
"(",
"argv",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"argv",
"[",
"2",
"]",
")",
"{",
"console",
".",
"error",
"(",
"\"url is required\"",
")",
";",
"console",
".",
"error",
"(",
"\"Usage : ws <url>\"",
")",
";",
"process",
".",
... | ws runs a websocket against a URI
@param {String} argv[2] url
@callback {bin~cb} callback | [
"ws",
"runs",
"a",
"websocket",
"against",
"a",
"URI"
] | bf2015f6f333855e69a18ce3ec9e917bbddfb425 | https://github.com/melvincarvalho/rdf-shell/blob/bf2015f6f333855e69a18ce3ec9e917bbddfb425/lib/ws.js#L18-L59 |
55,520 | melvincarvalho/rdf-shell | lib/ws.js | bin | function bin(argv) {
ws(argv, function(err, res) {
if (err) {
console.err(err);
} else {
console.log(res);
}
});
} | javascript | function bin(argv) {
ws(argv, function(err, res) {
if (err) {
console.err(err);
} else {
console.log(res);
}
});
} | [
"function",
"bin",
"(",
"argv",
")",
"{",
"ws",
"(",
"argv",
",",
"function",
"(",
"err",
",",
"res",
")",
"{",
"if",
"(",
"err",
")",
"{",
"console",
".",
"err",
"(",
"err",
")",
";",
"}",
"else",
"{",
"console",
".",
"log",
"(",
"res",
")",... | ws as a command
@param {String} argv[2] login
@callback {bin~cb} callback | [
"ws",
"as",
"a",
"command"
] | bf2015f6f333855e69a18ce3ec9e917bbddfb425 | https://github.com/melvincarvalho/rdf-shell/blob/bf2015f6f333855e69a18ce3ec9e917bbddfb425/lib/ws.js#L68-L76 |
55,521 | Ma3Route/node-sdk | example/init.js | init | function init() {
/**
* Get API key and secret.
*/
var auth = utils.getAuth();
/**
* Set up the SDK.
*/
sdk.utils.setup({
key: auth.key,
secret: auth.secret,
});
return {
out: out,
sdk: sdk,
};
} | javascript | function init() {
/**
* Get API key and secret.
*/
var auth = utils.getAuth();
/**
* Set up the SDK.
*/
sdk.utils.setup({
key: auth.key,
secret: auth.secret,
});
return {
out: out,
sdk: sdk,
};
} | [
"function",
"init",
"(",
")",
"{",
"/**\n * Get API key and secret.\n */",
"var",
"auth",
"=",
"utils",
".",
"getAuth",
"(",
")",
";",
"/**\n * Set up the SDK.\n */",
"sdk",
".",
"utils",
".",
"setup",
"(",
"{",
"key",
":",
"auth",
".",
"key",
",... | Initialize. This has placed in this separate file so as to
avoid duplicate code all over.
It simply does the following:
1. `require()` the modules we will be using frequently (already done above)
2. get API key and secret
3. setup the SDK so we can use it immediately
4. return an object containing modules from (1) abo... | [
"Initialize",
".",
"This",
"has",
"placed",
"in",
"this",
"separate",
"file",
"so",
"as",
"to",
"avoid",
"duplicate",
"code",
"all",
"over",
"."
] | a2769d97d77d6f762d23e743bf4c749e2bad0d8a | https://github.com/Ma3Route/node-sdk/blob/a2769d97d77d6f762d23e743bf4c749e2bad0d8a/example/init.js#L23-L41 |
55,522 | bionikspoon/unipath | src/index.js | unipath | function unipath(...bases) {
return partial;
/**
* Resolve base with paths.
*
* @param {...string} paths - Paths to join to base
* @returns {string} Resolved path
*/
function partial(...paths) {
const baseList = bases.length ? bases : [ '.' ];
const pathList = paths.length ? paths : [ '.' ... | javascript | function unipath(...bases) {
return partial;
/**
* Resolve base with paths.
*
* @param {...string} paths - Paths to join to base
* @returns {string} Resolved path
*/
function partial(...paths) {
const baseList = bases.length ? bases : [ '.' ];
const pathList = paths.length ? paths : [ '.' ... | [
"function",
"unipath",
"(",
"...",
"bases",
")",
"{",
"return",
"partial",
";",
"/**\n * Resolve base with paths.\n *\n * @param {...string} paths - Paths to join to base\n * @returns {string} Resolved path\n */",
"function",
"partial",
"(",
"...",
"paths",
")",
"{",
"c... | Create a path.join partial.
@param {...string} bases - Base paths
@returns {partial} Path join partial | [
"Create",
"a",
"path",
".",
"join",
"partial",
"."
] | 91d196b902f66f85ffb8b9a37ae9bb51b86507e7 | https://github.com/bionikspoon/unipath/blob/91d196b902f66f85ffb8b9a37ae9bb51b86507e7/src/index.js#L11-L26 |
55,523 | gtriggiano/dnsmq-messagebus | src/MasterBroker.js | startHeartbeats | function startHeartbeats () {
_isMaster = true
if (_hearbeatInterval) return
debug('starting heartbeats')
_sendHeartbeat()
_hearbeatInterval = setInterval(_sendHeartbeat, HEARTBEAT_INTERVAL)
} | javascript | function startHeartbeats () {
_isMaster = true
if (_hearbeatInterval) return
debug('starting heartbeats')
_sendHeartbeat()
_hearbeatInterval = setInterval(_sendHeartbeat, HEARTBEAT_INTERVAL)
} | [
"function",
"startHeartbeats",
"(",
")",
"{",
"_isMaster",
"=",
"true",
"if",
"(",
"_hearbeatInterval",
")",
"return",
"debug",
"(",
"'starting heartbeats'",
")",
"_sendHeartbeat",
"(",
")",
"_hearbeatInterval",
"=",
"setInterval",
"(",
"_sendHeartbeat",
",",
"HEA... | starts the emission of heartbeats at regular intervals | [
"starts",
"the",
"emission",
"of",
"heartbeats",
"at",
"regular",
"intervals"
] | ab935cae537f8a7e61a6ed6fba247661281c9374 | https://github.com/gtriggiano/dnsmq-messagebus/blob/ab935cae537f8a7e61a6ed6fba247661281c9374/src/MasterBroker.js#L114-L120 |
55,524 | digiaonline/generator-nord-backbone | app/templates/_Gruntfile.js | findBowerMainFiles | function findBowerMainFiles(componentsPath) {
var files = [];
fs.readdirSync(componentsPath).filter(function (file) {
return fs.statSync(componentsPath + '/' + file).isDirectory();
}).forEach(function (packageName) {
var bowerJsonPath = componentsPath + '/' + packageName... | javascript | function findBowerMainFiles(componentsPath) {
var files = [];
fs.readdirSync(componentsPath).filter(function (file) {
return fs.statSync(componentsPath + '/' + file).isDirectory();
}).forEach(function (packageName) {
var bowerJsonPath = componentsPath + '/' + packageName... | [
"function",
"findBowerMainFiles",
"(",
"componentsPath",
")",
"{",
"var",
"files",
"=",
"[",
"]",
";",
"fs",
".",
"readdirSync",
"(",
"componentsPath",
")",
".",
"filter",
"(",
"function",
"(",
"file",
")",
"{",
"return",
"fs",
".",
"statSync",
"(",
"com... | Parses the given components path and returns a list with the main file for each bower dependency.
@param {string} componentsPath path to Bower components
@returns {Array} list of files | [
"Parses",
"the",
"given",
"components",
"path",
"and",
"returns",
"a",
"list",
"with",
"the",
"main",
"file",
"for",
"each",
"bower",
"dependency",
"."
] | bc962e16b6354c7a4034ce09cf4030b9d300202e | https://github.com/digiaonline/generator-nord-backbone/blob/bc962e16b6354c7a4034ce09cf4030b9d300202e/app/templates/_Gruntfile.js#L10-L24 |
55,525 | brianloveswords/gogo | lib/base.js | extraction | function extraction(o) {
return _.map(o, function (spec, field) {
var fn = _.extract(spec, ['mutators', direction]) || _.identity;
return [field, fn];
});
} | javascript | function extraction(o) {
return _.map(o, function (spec, field) {
var fn = _.extract(spec, ['mutators', direction]) || _.identity;
return [field, fn];
});
} | [
"function",
"extraction",
"(",
"o",
")",
"{",
"return",
"_",
".",
"map",
"(",
"o",
",",
"function",
"(",
"spec",
",",
"field",
")",
"{",
"var",
"fn",
"=",
"_",
".",
"extract",
"(",
"spec",
",",
"[",
"'mutators'",
",",
"direction",
"]",
")",
"||",... | make a zipped array of field, mutator | [
"make",
"a",
"zipped",
"array",
"of",
"field",
"mutator"
] | f17ee794e0439ed961907f52b91bcb74dcca351a | https://github.com/brianloveswords/gogo/blob/f17ee794e0439ed961907f52b91bcb74dcca351a/lib/base.js#L97-L102 |
55,526 | brianloveswords/gogo | lib/base.js | cleanup | function cleanup(a) {
return _.filter(a, function (a) {
var field = a[0];
return attr[field];
});
} | javascript | function cleanup(a) {
return _.filter(a, function (a) {
var field = a[0];
return attr[field];
});
} | [
"function",
"cleanup",
"(",
"a",
")",
"{",
"return",
"_",
".",
"filter",
"(",
"a",
",",
"function",
"(",
"a",
")",
"{",
"var",
"field",
"=",
"a",
"[",
"0",
"]",
";",
"return",
"attr",
"[",
"field",
"]",
";",
"}",
")",
";",
"}"
] | drop all fields that aren't found in the attributes array | [
"drop",
"all",
"fields",
"that",
"aren",
"t",
"found",
"in",
"the",
"attributes",
"array"
] | f17ee794e0439ed961907f52b91bcb74dcca351a | https://github.com/brianloveswords/gogo/blob/f17ee794e0439ed961907f52b91bcb74dcca351a/lib/base.js#L105-L110 |
55,527 | brianloveswords/gogo | lib/base.js | getMutations | function getMutations(spec, attr) {
var fns = compose(extraction, cleanup, stitch)(spec);
return _.callmap(fns, attr);
} | javascript | function getMutations(spec, attr) {
var fns = compose(extraction, cleanup, stitch)(spec);
return _.callmap(fns, attr);
} | [
"function",
"getMutations",
"(",
"spec",
",",
"attr",
")",
"{",
"var",
"fns",
"=",
"compose",
"(",
"extraction",
",",
"cleanup",
",",
"stitch",
")",
"(",
"spec",
")",
";",
"return",
"_",
".",
"callmap",
"(",
"fns",
",",
"attr",
")",
";",
"}"
] | call of the functions in the mutators fn object with the values of the attributes object | [
"call",
"of",
"the",
"functions",
"in",
"the",
"mutators",
"fn",
"object",
"with",
"the",
"values",
"of",
"the",
"attributes",
"object"
] | f17ee794e0439ed961907f52b91bcb74dcca351a | https://github.com/brianloveswords/gogo/blob/f17ee794e0439ed961907f52b91bcb74dcca351a/lib/base.js#L117-L120 |
55,528 | muttr/libmuttr | lib/connection.js | Connection | function Connection(options) {
if (!(this instanceof Connection)) {
return new Connection(options);
}
events.EventEmitter.call(this);
this.options = merge(Object.create(Connection.DEFAULTS), options);
this._log = new kademlia.Logger(this.options.logLevel);
this._natClient = nat.createClient();
} | javascript | function Connection(options) {
if (!(this instanceof Connection)) {
return new Connection(options);
}
events.EventEmitter.call(this);
this.options = merge(Object.create(Connection.DEFAULTS), options);
this._log = new kademlia.Logger(this.options.logLevel);
this._natClient = nat.createClient();
} | [
"function",
"Connection",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Connection",
")",
")",
"{",
"return",
"new",
"Connection",
"(",
"options",
")",
";",
"}",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",... | Creates a connection the the Muttr DHT
@constructor
@param {object} options
@param {string} options.address
@param {number} options.port
@param {array} options.seeds
@param {object} options.seeds[]
@param {string} options.seeds[].address
@param {number} options.seeds[].port
@param {object} options.stor... | [
"Creates",
"a",
"connection",
"the",
"the",
"Muttr",
"DHT"
] | 2e4fda9cb2b47b8febe30585f54196d39d79e2e5 | https://github.com/muttr/libmuttr/blob/2e4fda9cb2b47b8febe30585f54196d39d79e2e5/lib/connection.js#L60-L71 |
55,529 | redisjs/jsr-validate | lib/validators/auth.js | auth | function auth(cmd, args, info) {
var pass = args[0];
if(pass instanceof Buffer) {
pass = pass.toString();
}
if(!info.conf.requirepass) {
throw AuthNotSet;
}else if(pass !== info.conf.requirepass) {
throw InvalidPassword;
}
return true;
} | javascript | function auth(cmd, args, info) {
var pass = args[0];
if(pass instanceof Buffer) {
pass = pass.toString();
}
if(!info.conf.requirepass) {
throw AuthNotSet;
}else if(pass !== info.conf.requirepass) {
throw InvalidPassword;
}
return true;
} | [
"function",
"auth",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"var",
"pass",
"=",
"args",
"[",
"0",
"]",
";",
"if",
"(",
"pass",
"instanceof",
"Buffer",
")",
"{",
"pass",
"=",
"pass",
".",
"toString",
"(",
")",
";",
"}",
"if",
"(",
"!",
... | Authentication validation.
@param cmd The command name - always AUTH.
@param args The command arguments.
@param info The server information. | [
"Authentication",
"validation",
"."
] | 2e0dddafb32c019ef9293a35b96cdd78dd8e4ae5 | https://github.com/redisjs/jsr-validate/blob/2e0dddafb32c019ef9293a35b96cdd78dd8e4ae5/lib/validators/auth.js#L13-L24 |
55,530 | jurca/idb-entity | es2015/equals.js | equals | function equals(value1, value2, traversedValues) {
if (!(value1 instanceof Object)) {
return value1 === value2
}
for (let wrappedType of WRAPPED_TYPES) {
if (value1 instanceof wrappedType) {
return (value2 instanceof wrappedType) &&
(value1.valueOf() === value2.valueOf())
}
}
... | javascript | function equals(value1, value2, traversedValues) {
if (!(value1 instanceof Object)) {
return value1 === value2
}
for (let wrappedType of WRAPPED_TYPES) {
if (value1 instanceof wrappedType) {
return (value2 instanceof wrappedType) &&
(value1.valueOf() === value2.valueOf())
}
}
... | [
"function",
"equals",
"(",
"value1",
",",
"value2",
",",
"traversedValues",
")",
"{",
"if",
"(",
"!",
"(",
"value1",
"instanceof",
"Object",
")",
")",
"{",
"return",
"value1",
"===",
"value2",
"}",
"for",
"(",
"let",
"wrappedType",
"of",
"WRAPPED_TYPES",
... | Compares the provided values to determine whether they are equal.
@param {*} value1 The 1st value to compare.
@param {*} value2 The 2nd value to compare.
@param {Map<Object, Object>} traversedValues A map of non-primitive values
traversed in the first structure to their equal counterparts in the
second structure.
@ret... | [
"Compares",
"the",
"provided",
"values",
"to",
"determine",
"whether",
"they",
"are",
"equal",
"."
] | 361ef8482872d9fc9a0d83b86970d49d391dc276 | https://github.com/jurca/idb-entity/blob/361ef8482872d9fc9a0d83b86970d49d391dc276/es2015/equals.js#L47-L118 |
55,531 | jurca/idb-entity | es2015/equals.js | objectEquals | function objectEquals(object1, object2, traversedValues) {
let keys1 = Object.keys(object1)
let keys2 = Object.keys(object2)
return structureEquals(
object1,
object2,
keys1,
keys2,
(object, key) => object[key],
traversedValues
)
} | javascript | function objectEquals(object1, object2, traversedValues) {
let keys1 = Object.keys(object1)
let keys2 = Object.keys(object2)
return structureEquals(
object1,
object2,
keys1,
keys2,
(object, key) => object[key],
traversedValues
)
} | [
"function",
"objectEquals",
"(",
"object1",
",",
"object2",
",",
"traversedValues",
")",
"{",
"let",
"keys1",
"=",
"Object",
".",
"keys",
"(",
"object1",
")",
"let",
"keys2",
"=",
"Object",
".",
"keys",
"(",
"object2",
")",
"return",
"structureEquals",
"("... | Compares the two provided plain objects.
@param {Object<string, *>} object1 The 1st object to compare.
@param {Object<string, *>} object2 The 2nd object to compare.
@param {Map<Object, Object>} traversedValues A map of non-primitive values
traversed in the first structure to their equal counterparts in the
second stru... | [
"Compares",
"the",
"two",
"provided",
"plain",
"objects",
"."
] | 361ef8482872d9fc9a0d83b86970d49d391dc276 | https://github.com/jurca/idb-entity/blob/361ef8482872d9fc9a0d83b86970d49d391dc276/es2015/equals.js#L130-L142 |
55,532 | jurca/idb-entity | es2015/equals.js | setEquals | function setEquals(set1, set2, traversedValues) {
if (set1.size !== set2.size) {
return false
}
return structureEquals(
set1,
set2,
iteratorToArray(set1.values()),
iteratorToArray(set2.values()),
() => undefined,
traversedValues
)
} | javascript | function setEquals(set1, set2, traversedValues) {
if (set1.size !== set2.size) {
return false
}
return structureEquals(
set1,
set2,
iteratorToArray(set1.values()),
iteratorToArray(set2.values()),
() => undefined,
traversedValues
)
} | [
"function",
"setEquals",
"(",
"set1",
",",
"set2",
",",
"traversedValues",
")",
"{",
"if",
"(",
"set1",
".",
"size",
"!==",
"set2",
".",
"size",
")",
"{",
"return",
"false",
"}",
"return",
"structureEquals",
"(",
"set1",
",",
"set2",
",",
"iteratorToArra... | Compares the two provided sets.
@param {Set<*>} set1 The 1st set to compare.
@param {Set<*>} set2 The 2nd set to compare.
@param {Map<Object, Object>} traversedValues A map of non-primitive values
traversed in the first structure to their equal counterparts in the
second structure.
@return {boolean} {@code true} if th... | [
"Compares",
"the",
"two",
"provided",
"sets",
"."
] | 361ef8482872d9fc9a0d83b86970d49d391dc276 | https://github.com/jurca/idb-entity/blob/361ef8482872d9fc9a0d83b86970d49d391dc276/es2015/equals.js#L154-L167 |
55,533 | jurca/idb-entity | es2015/equals.js | mapEquals | function mapEquals(map1, map2, traversedValues) {
if (map1.size !== map2.size) {
return false
}
return structureEquals(
map1,
map2,
iteratorToArray(map1.keys()),
iteratorToArray(map2.keys()),
(map, key) => map.get(key),
traversedValues
)
} | javascript | function mapEquals(map1, map2, traversedValues) {
if (map1.size !== map2.size) {
return false
}
return structureEquals(
map1,
map2,
iteratorToArray(map1.keys()),
iteratorToArray(map2.keys()),
(map, key) => map.get(key),
traversedValues
)
} | [
"function",
"mapEquals",
"(",
"map1",
",",
"map2",
",",
"traversedValues",
")",
"{",
"if",
"(",
"map1",
".",
"size",
"!==",
"map2",
".",
"size",
")",
"{",
"return",
"false",
"}",
"return",
"structureEquals",
"(",
"map1",
",",
"map2",
",",
"iteratorToArra... | Compares the two provided maps.
@param {Map<*, *>} map1 The 1st map to compare.
@param {Map<*, *>} map2 The 2nd map to compare.
@param {Map<Object, Object>} traversedValues A map of non-primitive values
traversed in the first structure to their equal counterparts in the
second structure.
@return {boolean} {@code true}... | [
"Compares",
"the",
"two",
"provided",
"maps",
"."
] | 361ef8482872d9fc9a0d83b86970d49d391dc276 | https://github.com/jurca/idb-entity/blob/361ef8482872d9fc9a0d83b86970d49d391dc276/es2015/equals.js#L179-L192 |
55,534 | jurca/idb-entity | es2015/equals.js | arrayEquals | function arrayEquals(array1, array2, traversedValues) {
if (array1.length !== array2.length) {
return false
}
return structureEquals(
array1,
array2,
iteratorToArray(array1.keys()),
iteratorToArray(array2.keys()),
(array, key) => array[key],
traversedValues
)
} | javascript | function arrayEquals(array1, array2, traversedValues) {
if (array1.length !== array2.length) {
return false
}
return structureEquals(
array1,
array2,
iteratorToArray(array1.keys()),
iteratorToArray(array2.keys()),
(array, key) => array[key],
traversedValues
)
} | [
"function",
"arrayEquals",
"(",
"array1",
",",
"array2",
",",
"traversedValues",
")",
"{",
"if",
"(",
"array1",
".",
"length",
"!==",
"array2",
".",
"length",
")",
"{",
"return",
"false",
"}",
"return",
"structureEquals",
"(",
"array1",
",",
"array2",
",",... | Compares the two provided arrays.
@param {*[]} array1 The 1st array to compare.
@param {*[]} array2 The 2nd array to compare.
@param {Map<Object, Object>} traversedValues A map of non-primitive values
traversed in the first structure to their equal counterparts in the
second structure.
@return {boolean} {@code true} i... | [
"Compares",
"the",
"two",
"provided",
"arrays",
"."
] | 361ef8482872d9fc9a0d83b86970d49d391dc276 | https://github.com/jurca/idb-entity/blob/361ef8482872d9fc9a0d83b86970d49d391dc276/es2015/equals.js#L204-L217 |
55,535 | jurca/idb-entity | es2015/equals.js | structureEquals | function structureEquals(structure1, structure2, keys1, keys2, getter,
traversedValues) {
if (keys1.length !== keys2.length) {
return false
}
traversedValues.set(structure1, structure2)
for (let i = keys1.length; i--;) {
let key1 = keys1[i]
let key2 = keys2[i]
if ((key1 instan... | javascript | function structureEquals(structure1, structure2, keys1, keys2, getter,
traversedValues) {
if (keys1.length !== keys2.length) {
return false
}
traversedValues.set(structure1, structure2)
for (let i = keys1.length; i--;) {
let key1 = keys1[i]
let key2 = keys2[i]
if ((key1 instan... | [
"function",
"structureEquals",
"(",
"structure1",
",",
"structure2",
",",
"keys1",
",",
"keys2",
",",
"getter",
",",
"traversedValues",
")",
"{",
"if",
"(",
"keys1",
".",
"length",
"!==",
"keys2",
".",
"length",
")",
"{",
"return",
"false",
"}",
"traversed... | Performs a structured comparison of two structures, determining their
equality.
@param {Object} structure1 The first structure to compare.
@param {Object} structure2 The second structure to compare.
@param {*[]} keys1 The keys of the properties to compare in the first
structure.
@param {*[]} keys2 The keys of the prop... | [
"Performs",
"a",
"structured",
"comparison",
"of",
"two",
"structures",
"determining",
"their",
"equality",
"."
] | 361ef8482872d9fc9a0d83b86970d49d391dc276 | https://github.com/jurca/idb-entity/blob/361ef8482872d9fc9a0d83b86970d49d391dc276/es2015/equals.js#L238-L287 |
55,536 | jurca/idb-entity | es2015/equals.js | iteratorToArray | function iteratorToArray(iterator) {
let elements = []
for (let element of iterator) {
elements.push(element)
}
return elements
} | javascript | function iteratorToArray(iterator) {
let elements = []
for (let element of iterator) {
elements.push(element)
}
return elements
} | [
"function",
"iteratorToArray",
"(",
"iterator",
")",
"{",
"let",
"elements",
"=",
"[",
"]",
"for",
"(",
"let",
"element",
"of",
"iterator",
")",
"{",
"elements",
".",
"push",
"(",
"element",
")",
"}",
"return",
"elements",
"}"
] | Traverses the provided finite iterator or iterable object and returns an
array of generated values.
@param {({[Symbol.iterator]: function(): {next: function(): {value: *, done: boolean}}}|{next: function(): {value: *, done: boolean}})} iterator
The iterator or iterable object.
@return {*[]} The elements generated by t... | [
"Traverses",
"the",
"provided",
"finite",
"iterator",
"or",
"iterable",
"object",
"and",
"returns",
"an",
"array",
"of",
"generated",
"values",
"."
] | 361ef8482872d9fc9a0d83b86970d49d391dc276 | https://github.com/jurca/idb-entity/blob/361ef8482872d9fc9a0d83b86970d49d391dc276/es2015/equals.js#L297-L305 |
55,537 | fosrias/apiql-express | lib/api.js | jsonDescription | function jsonDescription(format, description) {
switch (format) {
case 'application/openapi+json':
if (typeof description == object) {
return description;
} else {
throw new Error(`application/openapi+json description ${description} is not an object`);
}
case 'application/ope... | javascript | function jsonDescription(format, description) {
switch (format) {
case 'application/openapi+json':
if (typeof description == object) {
return description;
} else {
throw new Error(`application/openapi+json description ${description} is not an object`);
}
case 'application/ope... | [
"function",
"jsonDescription",
"(",
"format",
",",
"description",
")",
"{",
"switch",
"(",
"format",
")",
"{",
"case",
"'application/openapi+json'",
":",
"if",
"(",
"typeof",
"description",
"==",
"object",
")",
"{",
"return",
"description",
";",
"}",
"else",
... | private helper methods | [
"private",
"helper",
"methods"
] | 1bbfc5049f036d6311ade6c7486c63404f59af43 | https://github.com/fosrias/apiql-express/blob/1bbfc5049f036d6311ade6c7486c63404f59af43/lib/api.js#L119-L132 |
55,538 | torworx/well | well.js | well | function well(promiseOrValue, onFulfilled, onRejected, onProgress) {
// Get a trusted promise for the input promiseOrValue, and then
// register promise handlers
return resolve(promiseOrValue).then(onFulfilled, onRejected, onProgress);
} | javascript | function well(promiseOrValue, onFulfilled, onRejected, onProgress) {
// Get a trusted promise for the input promiseOrValue, and then
// register promise handlers
return resolve(promiseOrValue).then(onFulfilled, onRejected, onProgress);
} | [
"function",
"well",
"(",
"promiseOrValue",
",",
"onFulfilled",
",",
"onRejected",
",",
"onProgress",
")",
"{",
"// Get a trusted promise for the input promiseOrValue, and then",
"// register promise handlers",
"return",
"resolve",
"(",
"promiseOrValue",
")",
".",
"then",
"(... | Determine if a thing is a promise
Register an observer for a promise or immediate value.
@param {*} promiseOrValue
@param {function?} [onFulfilled] callback to be called when promiseOrValue is
successfully fulfilled. If promiseOrValue is an immediate value, callback
will be invoked immediately.
@param {function?} [o... | [
"Determine",
"if",
"a",
"thing",
"is",
"a",
"promise",
"Register",
"an",
"observer",
"for",
"a",
"promise",
"or",
"immediate",
"value",
"."
] | 45a1724a0a4192628c80b3c4ae541d6de28ac7da | https://github.com/torworx/well/blob/45a1724a0a4192628c80b3c4ae541d6de28ac7da/well.js#L51-L55 |
55,539 | torworx/well | well.js | chain | function chain(promiseOrValue, resolver, resolveValue) {
var useResolveValue = arguments.length > 2;
return well(promiseOrValue,
function (val) {
val = useResolveValue ? resolveValue : val;
resolver.resolve(val);
return... | javascript | function chain(promiseOrValue, resolver, resolveValue) {
var useResolveValue = arguments.length > 2;
return well(promiseOrValue,
function (val) {
val = useResolveValue ? resolveValue : val;
resolver.resolve(val);
return... | [
"function",
"chain",
"(",
"promiseOrValue",
",",
"resolver",
",",
"resolveValue",
")",
"{",
"var",
"useResolveValue",
"=",
"arguments",
".",
"length",
">",
"2",
";",
"return",
"well",
"(",
"promiseOrValue",
",",
"function",
"(",
"val",
")",
"{",
"val",
"="... | Ensure that resolution of promiseOrValue will trigger resolver with the
value or reason of promiseOrValue, or instead with resolveValue if it is provided.
@param promiseOrValue
@param {Object} resolver
@param {function} resolver.resolve
@param {function} resolver.reject
@param {*} [resolveValue]
@returns {Promise} | [
"Ensure",
"that",
"resolution",
"of",
"promiseOrValue",
"will",
"trigger",
"resolver",
"with",
"the",
"value",
"or",
"reason",
"of",
"promiseOrValue",
"or",
"instead",
"with",
"resolveValue",
"if",
"it",
"is",
"provided",
"."
] | 45a1724a0a4192628c80b3c4ae541d6de28ac7da | https://github.com/torworx/well/blob/45a1724a0a4192628c80b3c4ae541d6de28ac7da/well.js#L771-L789 |
55,540 | torworx/well | well.js | processQueue | function processQueue(queue, value) {
if (!queue || queue.length === 0) return;
var handler, i = 0;
while (handler = queue[i++]) {
handler(value);
}
} | javascript | function processQueue(queue, value) {
if (!queue || queue.length === 0) return;
var handler, i = 0;
while (handler = queue[i++]) {
handler(value);
}
} | [
"function",
"processQueue",
"(",
"queue",
",",
"value",
")",
"{",
"if",
"(",
"!",
"queue",
"||",
"queue",
".",
"length",
"===",
"0",
")",
"return",
";",
"var",
"handler",
",",
"i",
"=",
"0",
";",
"while",
"(",
"handler",
"=",
"queue",
"[",
"i",
"... | Utility functions
Apply all functions in queue to value
@param {Array} queue array of functions to execute
@param {*} value argument passed to each function | [
"Utility",
"functions",
"Apply",
"all",
"functions",
"in",
"queue",
"to",
"value"
] | 45a1724a0a4192628c80b3c4ae541d6de28ac7da | https://github.com/torworx/well/blob/45a1724a0a4192628c80b3c4ae541d6de28ac7da/well.js#L800-L807 |
55,541 | torworx/well | well.js | checkCallbacks | function checkCallbacks(start, arrayOfCallbacks) {
// TODO: Promises/A+ update type checking and docs
var arg, i = arrayOfCallbacks.length;
while (i > start) {
arg = arrayOfCallbacks[--i];
if (arg != null && typeof arg != 'function') {
... | javascript | function checkCallbacks(start, arrayOfCallbacks) {
// TODO: Promises/A+ update type checking and docs
var arg, i = arrayOfCallbacks.length;
while (i > start) {
arg = arrayOfCallbacks[--i];
if (arg != null && typeof arg != 'function') {
... | [
"function",
"checkCallbacks",
"(",
"start",
",",
"arrayOfCallbacks",
")",
"{",
"// TODO: Promises/A+ update type checking and docs",
"var",
"arg",
",",
"i",
"=",
"arrayOfCallbacks",
".",
"length",
";",
"while",
"(",
"i",
">",
"start",
")",
"{",
"arg",
"=",
"arra... | Helper that checks arrayOfCallbacks to ensure that each element is either
a function, or null or undefined.
@private
@param {number} start index at which to start checking items in arrayOfCallbacks
@param {Array} arrayOfCallbacks array to check
@throws {Error} if any element of arrayOfCallbacks is something other than
... | [
"Helper",
"that",
"checks",
"arrayOfCallbacks",
"to",
"ensure",
"that",
"each",
"element",
"is",
"either",
"a",
"function",
"or",
"null",
"or",
"undefined",
"."
] | 45a1724a0a4192628c80b3c4ae541d6de28ac7da | https://github.com/torworx/well/blob/45a1724a0a4192628c80b3c4ae541d6de28ac7da/well.js#L818-L829 |
55,542 | TJkrusinski/git-sha | index.js | git | function git(cb) {
which('git', function(err, data){
if (err) return cb(err, data);
child.exec('git rev-parse HEAD', cb);
});
} | javascript | function git(cb) {
which('git', function(err, data){
if (err) return cb(err, data);
child.exec('git rev-parse HEAD', cb);
});
} | [
"function",
"git",
"(",
"cb",
")",
"{",
"which",
"(",
"'git'",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"return",
"cb",
"(",
"err",
",",
"data",
")",
";",
"child",
".",
"exec",
"(",
"'git rev-parse HEAD'",
",",
"... | Get the git sha of the current commit
@param {Function} cb | [
"Get",
"the",
"git",
"sha",
"of",
"the",
"current",
"commit"
] | 12e7c077989beb40931144f0c8abba2165292ad5 | https://github.com/TJkrusinski/git-sha/blob/12e7c077989beb40931144f0c8abba2165292ad5/index.js#L18-L24 |
55,543 | CyclicMaterials/util-combine-class-names | src/index.js | combineClassNames | function combineClassNames(...classNames) {
return classNames.map((value) => {
if (!value) {
return value;
}
return Array.isArray(value) ?
combineClassNames.apply(void 0, value) :
value;
}).join(` `).replace(/ +/g, ` `).trim();
} | javascript | function combineClassNames(...classNames) {
return classNames.map((value) => {
if (!value) {
return value;
}
return Array.isArray(value) ?
combineClassNames.apply(void 0, value) :
value;
}).join(` `).replace(/ +/g, ` `).trim();
} | [
"function",
"combineClassNames",
"(",
"...",
"classNames",
")",
"{",
"return",
"classNames",
".",
"map",
"(",
"(",
"value",
")",
"=>",
"{",
"if",
"(",
"!",
"value",
")",
"{",
"return",
"value",
";",
"}",
"return",
"Array",
".",
"isArray",
"(",
"value",... | Returns a trimmed string of the combined class names.
Class names can be either strings or arrays of strings.
Example:
combineClassNames(`my-class`, `my-other-class`, [`first`, `second`])
// `myclass my-other-class first second`
Arrays can be nested.
@param {Array|String} classNames Any number of arguments of class ... | [
"Returns",
"a",
"trimmed",
"string",
"of",
"the",
"combined",
"class",
"names",
".",
"Class",
"names",
"can",
"be",
"either",
"strings",
"or",
"arrays",
"of",
"strings",
"."
] | 9fc0473b9640830861cd8f4cefb78109c2bd6b81 | https://github.com/CyclicMaterials/util-combine-class-names/blob/9fc0473b9640830861cd8f4cefb78109c2bd6b81/src/index.js#L14-L24 |
55,544 | campsi/campsi-service-auth | lib/handlers.js | initAuth | function initAuth (req, res, next) {
const params = {
session: false,
state: state.serialize(req),
scope: req.authProvider.scope
};
// noinspection JSUnresolvedFunction
passport.authenticate(
req.params.provider,
params
)(req, res, next);
} | javascript | function initAuth (req, res, next) {
const params = {
session: false,
state: state.serialize(req),
scope: req.authProvider.scope
};
// noinspection JSUnresolvedFunction
passport.authenticate(
req.params.provider,
params
)(req, res, next);
} | [
"function",
"initAuth",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"const",
"params",
"=",
"{",
"session",
":",
"false",
",",
"state",
":",
"state",
".",
"serialize",
"(",
"req",
")",
",",
"scope",
":",
"req",
".",
"authProvider",
".",
"scope",
... | Entry point of the authentification workflow.
There's no req.user yet.
@param req
@param res
@param next | [
"Entry",
"point",
"of",
"the",
"authentification",
"workflow",
".",
"There",
"s",
"no",
"req",
".",
"user",
"yet",
"."
] | f877626496de2288f9cfb50024accca2a88e179d | https://github.com/campsi/campsi-service-auth/blob/f877626496de2288f9cfb50024accca2a88e179d/lib/handlers.js#L124-L136 |
55,545 | chunksnbits/grunt-template-render | tasks/template.js | function(filename) {
var filepath = options.cwd + filename;
var template = readTemplateFile({ src: [ filepath ] });
return grunt.template.process(template, options);
} | javascript | function(filename) {
var filepath = options.cwd + filename;
var template = readTemplateFile({ src: [ filepath ] });
return grunt.template.process(template, options);
} | [
"function",
"(",
"filename",
")",
"{",
"var",
"filepath",
"=",
"options",
".",
"cwd",
"+",
"filename",
";",
"var",
"template",
"=",
"readTemplateFile",
"(",
"{",
"src",
":",
"[",
"filepath",
"]",
"}",
")",
";",
"return",
"grunt",
".",
"template",
".",
... | Render helper method. Allows to render partials within template files. | [
"Render",
"helper",
"method",
".",
"Allows",
"to",
"render",
"partials",
"within",
"template",
"files",
"."
] | 0e3c0b3e646a2d37e13f30eaee7baa433435f2a7 | https://github.com/chunksnbits/grunt-template-render/blob/0e3c0b3e646a2d37e13f30eaee7baa433435f2a7/tasks/template.js#L42-L46 | |
55,546 | chunksnbits/grunt-template-render | tasks/template.js | function(key) {
var translation = options.translations[key];
if (!translation) {
grunt.fail.warn('No translation found for key:', key);
}
return translation;
} | javascript | function(key) {
var translation = options.translations[key];
if (!translation) {
grunt.fail.warn('No translation found for key:', key);
}
return translation;
} | [
"function",
"(",
"key",
")",
"{",
"var",
"translation",
"=",
"options",
".",
"translations",
"[",
"key",
"]",
";",
"if",
"(",
"!",
"translation",
")",
"{",
"grunt",
".",
"fail",
".",
"warn",
"(",
"'No translation found for key:'",
",",
"key",
")",
";",
... | Translation helper method. Allows resolving keys within a translation file. | [
"Translation",
"helper",
"method",
".",
"Allows",
"resolving",
"keys",
"within",
"a",
"translation",
"file",
"."
] | 0e3c0b3e646a2d37e13f30eaee7baa433435f2a7 | https://github.com/chunksnbits/grunt-template-render/blob/0e3c0b3e646a2d37e13f30eaee7baa433435f2a7/tasks/template.js#L50-L57 | |
55,547 | chunksnbits/grunt-template-render | tasks/template.js | function(options) {
var recurse = function(options) {
_.each(options, function(value, key) {
if (_.isFunction(value)) {
options[key] = value();
}
else if (_.isObject(value)) {
options[key] = recurse(value);
}
});
return options;
};
retur... | javascript | function(options) {
var recurse = function(options) {
_.each(options, function(value, key) {
if (_.isFunction(value)) {
options[key] = value();
}
else if (_.isObject(value)) {
options[key] = recurse(value);
}
});
return options;
};
retur... | [
"function",
"(",
"options",
")",
"{",
"var",
"recurse",
"=",
"function",
"(",
"options",
")",
"{",
"_",
".",
"each",
"(",
"options",
",",
"function",
"(",
"value",
",",
"key",
")",
"{",
"if",
"(",
"_",
".",
"isFunction",
"(",
"value",
")",
")",
"... | Iterates recursively over all provided options executes them in case the option was provided as a function. | [
"Iterates",
"recursively",
"over",
"all",
"provided",
"options",
"executes",
"them",
"in",
"case",
"the",
"option",
"was",
"provided",
"as",
"a",
"function",
"."
] | 0e3c0b3e646a2d37e13f30eaee7baa433435f2a7 | https://github.com/chunksnbits/grunt-template-render/blob/0e3c0b3e646a2d37e13f30eaee7baa433435f2a7/tasks/template.js#L64-L78 | |
55,548 | zzolo/github-collect | index.js | qG | function qG(options) {
var defer = q.defer();
var compiledData = [];
// Recursive call to paginate
function qGCall(pageLink) {
var methodCall;
// Callback
function callback(error, data) {
if (error) {
defer.reject(new Error(error));
}
else {
compiledData = compile... | javascript | function qG(options) {
var defer = q.defer();
var compiledData = [];
// Recursive call to paginate
function qGCall(pageLink) {
var methodCall;
// Callback
function callback(error, data) {
if (error) {
defer.reject(new Error(error));
}
else {
compiledData = compile... | [
"function",
"qG",
"(",
"options",
")",
"{",
"var",
"defer",
"=",
"q",
".",
"defer",
"(",
")",
";",
"var",
"compiledData",
"=",
"[",
"]",
";",
"// Recursive call to paginate",
"function",
"qGCall",
"(",
"pageLink",
")",
"{",
"var",
"methodCall",
";",
"// ... | Wrap github calls in to promises | [
"Wrap",
"github",
"calls",
"in",
"to",
"promises"
] | 8b28add17a3fbd6e18d7532bf5dc42d898cd625e | https://github.com/zzolo/github-collect/blob/8b28add17a3fbd6e18d7532bf5dc42d898cd625e/index.js#L28-L63 |
55,549 | zzolo/github-collect | index.js | getObjects | function getObjects(user) {
var username = (_.isObject(user)) ? user.login : user;
var isOrg = (_.isObject(user) && user.type === 'Organization');
var defers = [];
// Get repos
defers.push(qG({
obj: 'repos', method: 'getFromUser', user: username,
sort: 'created', per_page: 100
}));
// Get gists
... | javascript | function getObjects(user) {
var username = (_.isObject(user)) ? user.login : user;
var isOrg = (_.isObject(user) && user.type === 'Organization');
var defers = [];
// Get repos
defers.push(qG({
obj: 'repos', method: 'getFromUser', user: username,
sort: 'created', per_page: 100
}));
// Get gists
... | [
"function",
"getObjects",
"(",
"user",
")",
"{",
"var",
"username",
"=",
"(",
"_",
".",
"isObject",
"(",
"user",
")",
")",
"?",
"user",
".",
"login",
":",
"user",
";",
"var",
"isOrg",
"=",
"(",
"_",
".",
"isObject",
"(",
"user",
")",
"&&",
"user"... | Get objects for a specific username | [
"Get",
"objects",
"for",
"a",
"specific",
"username"
] | 8b28add17a3fbd6e18d7532bf5dc42d898cd625e | https://github.com/zzolo/github-collect/blob/8b28add17a3fbd6e18d7532bf5dc42d898cd625e/index.js#L66-L92 |
55,550 | zzolo/github-collect | index.js | get | function get(usernames, options) {
usernames = usernames || '';
usernames = (_.isArray(usernames)) ? usernames : usernames.split(',');
options = options || {};
var defers = [];
var collection = {};
_.each(usernames, function(u) {
var defer = q.defer();
u = u.toLowerCase();
if (u.length === 0) ... | javascript | function get(usernames, options) {
usernames = usernames || '';
usernames = (_.isArray(usernames)) ? usernames : usernames.split(',');
options = options || {};
var defers = [];
var collection = {};
_.each(usernames, function(u) {
var defer = q.defer();
u = u.toLowerCase();
if (u.length === 0) ... | [
"function",
"get",
"(",
"usernames",
",",
"options",
")",
"{",
"usernames",
"=",
"usernames",
"||",
"''",
";",
"usernames",
"=",
"(",
"_",
".",
"isArray",
"(",
"usernames",
")",
")",
"?",
"usernames",
":",
"usernames",
".",
"split",
"(",
"','",
")",
... | Get data from usernames, which can be an array of usernames or a string of usernames separated by commas. | [
"Get",
"data",
"from",
"usernames",
"which",
"can",
"be",
"an",
"array",
"of",
"usernames",
"or",
"a",
"string",
"of",
"usernames",
"separated",
"by",
"commas",
"."
] | 8b28add17a3fbd6e18d7532bf5dc42d898cd625e | https://github.com/zzolo/github-collect/blob/8b28add17a3fbd6e18d7532bf5dc42d898cd625e/index.js#L96-L134 |
55,551 | Ma3Route/node-sdk | lib/poller.js | Poller | function Poller(getRequest, options) {
options = options || { };
events.EventEmitter.call(this);
this._pollerOptions = utils.getPollerOptions([utils.setup().poller, options]);
this._get = getRequest;
this._params = options.params || { };
this._lastreadId = this._params.lastreadId || null;
th... | javascript | function Poller(getRequest, options) {
options = options || { };
events.EventEmitter.call(this);
this._pollerOptions = utils.getPollerOptions([utils.setup().poller, options]);
this._get = getRequest;
this._params = options.params || { };
this._lastreadId = this._params.lastreadId || null;
th... | [
"function",
"Poller",
"(",
"getRequest",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_pollerOptions",
"=",
"utils",
".",
"getPollerOptions",
"(... | Poller Class. Inherits from events.EventEmitter. This poller
is designed in that it polls for new items automatically
without having you implement `lastreadId` logic.
@example
// create a new poller that keeps retrieiving traffic updates
var poller = new sdk.Poller(sdk.trafficUpdates.get, {
interval: 5000, // 5 second... | [
"Poller",
"Class",
".",
"Inherits",
"from",
"events",
".",
"EventEmitter",
".",
"This",
"poller",
"is",
"designed",
"in",
"that",
"it",
"polls",
"for",
"new",
"items",
"automatically",
"without",
"having",
"you",
"implement",
"lastreadId",
"logic",
"."
] | a2769d97d77d6f762d23e743bf4c749e2bad0d8a | https://github.com/Ma3Route/node-sdk/blob/a2769d97d77d6f762d23e743bf4c749e2bad0d8a/lib/poller.js#L65-L76 |
55,552 | altshift/altshift | lib/altshift/promise.js | function (array) {
var self = this,
deferred = new Deferred(),
fulfilled = 0,
length,
results = [],
hasError = false;
if (!isArray(array)) {
array = slice.call(arguments);
}
l... | javascript | function (array) {
var self = this,
deferred = new Deferred(),
fulfilled = 0,
length,
results = [],
hasError = false;
if (!isArray(array)) {
array = slice.call(arguments);
}
l... | [
"function",
"(",
"array",
")",
"{",
"var",
"self",
"=",
"this",
",",
"deferred",
"=",
"new",
"Deferred",
"(",
")",
",",
"fulfilled",
"=",
"0",
",",
"length",
",",
"results",
"=",
"[",
"]",
",",
"hasError",
"=",
"false",
";",
"if",
"(",
"!",
"isAr... | Takes an array of promises and returns a promise that is fulfilled once all
the promises in the array are fulfilled
@param {Array} array The array of promises
@return {Promise} the promise that is fulfilled when all the array is fulfilled, resolved to the array of results | [
"Takes",
"an",
"array",
"of",
"promises",
"and",
"returns",
"a",
"promise",
"that",
"is",
"fulfilled",
"once",
"all",
"the",
"promises",
"in",
"the",
"array",
"are",
"fulfilled"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L120-L165 | |
55,553 | altshift/altshift | lib/altshift/promise.js | function (array) {
var self = this,
deferred = new Deferred(),
fulfilled = false,
index, length,
onSuccess = function (value) {
if (!fulfilled) {
fulfilled = true;
deferred.emi... | javascript | function (array) {
var self = this,
deferred = new Deferred(),
fulfilled = false,
index, length,
onSuccess = function (value) {
if (!fulfilled) {
fulfilled = true;
deferred.emi... | [
"function",
"(",
"array",
")",
"{",
"var",
"self",
"=",
"this",
",",
"deferred",
"=",
"new",
"Deferred",
"(",
")",
",",
"fulfilled",
"=",
"false",
",",
"index",
",",
"length",
",",
"onSuccess",
"=",
"function",
"(",
"value",
")",
"{",
"if",
"(",
"!... | Takes an array of promises and returns a promise that is fulfilled when the
first promise in the array of promises is fulfilled
@param {Array} array The array of promises
@return {Promise} a promise that is fulfilled with the value of the value of first
promise to be fulfilled | [
"Takes",
"an",
"array",
"of",
"promises",
"and",
"returns",
"a",
"promise",
"that",
"is",
"fulfilled",
"when",
"the",
"first",
"promise",
"in",
"the",
"array",
"of",
"promises",
"is",
"fulfilled"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L175-L200 | |
55,554 | altshift/altshift | lib/altshift/promise.js | function (value) {
var nextAction = array.shift();
if (nextAction) {
self.when(nextAction(value), next, deferred.reject);
} else {
deferred.emitSuccess(value);
}
} | javascript | function (value) {
var nextAction = array.shift();
if (nextAction) {
self.when(nextAction(value), next, deferred.reject);
} else {
deferred.emitSuccess(value);
}
} | [
"function",
"(",
"value",
")",
"{",
"var",
"nextAction",
"=",
"array",
".",
"shift",
"(",
")",
";",
"if",
"(",
"nextAction",
")",
"{",
"self",
".",
"when",
"(",
"nextAction",
"(",
"value",
")",
",",
"next",
",",
"deferred",
".",
"reject",
")",
";",... | make a copy | [
"make",
"a",
"copy"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L215-L222 | |
55,555 | altshift/altshift | lib/altshift/promise.js | function (milliseconds) {
var deferred,
timer = setTimeout(function () {
deferred.emitSuccess();
}, milliseconds),
canceller = function () {
clearTimeout(timer);
};
deferred = new Deferred(can... | javascript | function (milliseconds) {
var deferred,
timer = setTimeout(function () {
deferred.emitSuccess();
}, milliseconds),
canceller = function () {
clearTimeout(timer);
};
deferred = new Deferred(can... | [
"function",
"(",
"milliseconds",
")",
"{",
"var",
"deferred",
",",
"timer",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"deferred",
".",
"emitSuccess",
"(",
")",
";",
"}",
",",
"milliseconds",
")",
",",
"canceller",
"=",
"function",
"(",
")",
"{... | Delays for a given amount of time and then fulfills the returned promise.
@param {int} milliseconds The number of milliseconds to delay
@return {Promise} A promise that will be fulfilled after the delay | [
"Delays",
"for",
"a",
"given",
"amount",
"of",
"time",
"and",
"then",
"fulfills",
"the",
"returned",
"promise",
"."
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L233-L243 | |
55,556 | altshift/altshift | lib/altshift/promise.js | function (resolvedCallback, errorCallback, progressCallback) {
var returnDeferred = new Deferred(this._canceller), //new Deferred(this.getPromise().cancel)
listener = {
resolved : resolvedCallback,
error : errorCallback,
progress : progressCallback,
... | javascript | function (resolvedCallback, errorCallback, progressCallback) {
var returnDeferred = new Deferred(this._canceller), //new Deferred(this.getPromise().cancel)
listener = {
resolved : resolvedCallback,
error : errorCallback,
progress : progressCallback,
... | [
"function",
"(",
"resolvedCallback",
",",
"errorCallback",
",",
"progressCallback",
")",
"{",
"var",
"returnDeferred",
"=",
"new",
"Deferred",
"(",
"this",
".",
"_canceller",
")",
",",
"//new Deferred(this.getPromise().cancel)",
"listener",
"=",
"{",
"resolved",
":"... | Return a new promise
@param {Function} resolvedCallback
@param {Function} errorCallback
@param {Function} progressCallback
@return {Promise} | [
"Return",
"a",
"new",
"promise"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L488-L503 | |
55,557 | altshift/altshift | lib/altshift/promise.js | function (error, dontThrow) {
var self = this;
self.isError = true;
self._notifyAll(error);
if (!dontThrow) {
enqueue(function () {
if (!self.handled) {
throw error;
}
});
}
return self.handled;
... | javascript | function (error, dontThrow) {
var self = this;
self.isError = true;
self._notifyAll(error);
if (!dontThrow) {
enqueue(function () {
if (!self.handled) {
throw error;
}
});
}
return self.handled;
... | [
"function",
"(",
"error",
",",
"dontThrow",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"isError",
"=",
"true",
";",
"self",
".",
"_notifyAll",
"(",
"error",
")",
";",
"if",
"(",
"!",
"dontThrow",
")",
"{",
"enqueue",
"(",
"function",
"... | Calling emitError will indicate that the promise failed
@param {*} value send to all resolved callbacks
@return this | [
"Calling",
"emitError",
"will",
"indicate",
"that",
"the",
"promise",
"failed"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L531-L544 | |
55,558 | altshift/altshift | lib/altshift/promise.js | function (update) {
var waiting = this.waiting,
length = waiting.length,
index,
progress;
for (index = 0; index < length; index += 1) {
progress = waiting[index].progress;
if (progress) {
progress(update);
}
... | javascript | function (update) {
var waiting = this.waiting,
length = waiting.length,
index,
progress;
for (index = 0; index < length; index += 1) {
progress = waiting[index].progress;
if (progress) {
progress(update);
}
... | [
"function",
"(",
"update",
")",
"{",
"var",
"waiting",
"=",
"this",
".",
"waiting",
",",
"length",
"=",
"waiting",
".",
"length",
",",
"index",
",",
"progress",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"length",
";",
"index",
"+=",
"1... | Call progress on every waiting function to notify that the promise was updated
@param {*} update
@return this | [
"Call",
"progress",
"on",
"every",
"waiting",
"function",
"to",
"notify",
"that",
"the",
"promise",
"was",
"updated"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L558-L571 | |
55,559 | altshift/altshift | lib/altshift/promise.js | function () {
if (!this.finished && this._canceller) {
var error = this._canceller();
if (!(error instanceof Error)) {
error = new Error(error);
}
return this.emitError(error);
}
return false;
} | javascript | function () {
if (!this.finished && this._canceller) {
var error = this._canceller();
if (!(error instanceof Error)) {
error = new Error(error);
}
return this.emitError(error);
}
return false;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"finished",
"&&",
"this",
".",
"_canceller",
")",
"{",
"var",
"error",
"=",
"this",
".",
"_canceller",
"(",
")",
";",
"if",
"(",
"!",
"(",
"error",
"instanceof",
"Error",
")",
")",
"{",
"err... | Cancel the promise
@return {boolean} true if error was handled | [
"Cancel",
"the",
"promise"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L578-L587 | |
55,560 | altshift/altshift | lib/altshift/promise.js | function (milliseconds) {
if (milliseconds === undefined) {
milliseconds = this._timeout;
}
var self = this;
if (self._timeout !== milliseconds) {
self._timeout = milliseconds;
if (self._timer) {
clearTimeout(this._timer);
... | javascript | function (milliseconds) {
if (milliseconds === undefined) {
milliseconds = this._timeout;
}
var self = this;
if (self._timeout !== milliseconds) {
self._timeout = milliseconds;
if (self._timer) {
clearTimeout(this._timer);
... | [
"function",
"(",
"milliseconds",
")",
"{",
"if",
"(",
"milliseconds",
"===",
"undefined",
")",
"{",
"milliseconds",
"=",
"this",
".",
"_timeout",
";",
"}",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"_timeout",
"!==",
"milliseconds",
")",
... | Set the timeout in milliseconds to auto cancel the promise
@param {int} milliseconds
@return this | [
"Set",
"the",
"timeout",
"in",
"milliseconds",
"to",
"auto",
"cancel",
"the",
"promise"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L595-L634 | |
55,561 | altshift/altshift | lib/altshift/promise.js | function (target, property) {
return perform(target, function (target) {
return target.get(property);
}, function (target) {
return target[property];
});
} | javascript | function (target, property) {
return perform(target, function (target) {
return target.get(property);
}, function (target) {
return target[property];
});
} | [
"function",
"(",
"target",
",",
"property",
")",
"{",
"return",
"perform",
"(",
"target",
",",
"function",
"(",
"target",
")",
"{",
"return",
"target",
".",
"get",
"(",
"property",
")",
";",
"}",
",",
"function",
"(",
"target",
")",
"{",
"return",
"t... | Gets the value of a property in a future turn.
@param {Promise} target promise or value for target object
@param {string} property name of property to get
@return {Promise} promise for the property value | [
"Gets",
"the",
"value",
"of",
"a",
"property",
"in",
"a",
"future",
"turn",
"."
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L768-L774 | |
55,562 | altshift/altshift | lib/altshift/promise.js | function (target, methodName, args) {
return perform(target, function (target) {
return target.apply(methodName, args);
}, function (target) {
return target[methodName].apply(target, args);
});
} | javascript | function (target, methodName, args) {
return perform(target, function (target) {
return target.apply(methodName, args);
}, function (target) {
return target[methodName].apply(target, args);
});
} | [
"function",
"(",
"target",
",",
"methodName",
",",
"args",
")",
"{",
"return",
"perform",
"(",
"target",
",",
"function",
"(",
"target",
")",
"{",
"return",
"target",
".",
"apply",
"(",
"methodName",
",",
"args",
")",
";",
"}",
",",
"function",
"(",
... | Invokes a method in a future turn.
@param {Promise} target promise or value for target object
@param {string} methodName name of method to invoke
@param {Array} args array of invocation arguments
@return {Promise} promise for the return value | [
"Invokes",
"a",
"method",
"in",
"a",
"future",
"turn",
"."
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L784-L790 | |
55,563 | altshift/altshift | lib/altshift/promise.js | function (target, property, value) {
return perform(target, function (target) {
return target.set(property, value);
}, function (target) {
target[property] = value;
return value;
});
} | javascript | function (target, property, value) {
return perform(target, function (target) {
return target.set(property, value);
}, function (target) {
target[property] = value;
return value;
});
} | [
"function",
"(",
"target",
",",
"property",
",",
"value",
")",
"{",
"return",
"perform",
"(",
"target",
",",
"function",
"(",
"target",
")",
"{",
"return",
"target",
".",
"set",
"(",
"property",
",",
"value",
")",
";",
"}",
",",
"function",
"(",
"tar... | Sets the value of a property in a future turn.
@param {Promise} target promise or value for target object
@param {string} property name of property to set
@param {*} value new value of property
@return promise for the return value | [
"Sets",
"the",
"value",
"of",
"a",
"property",
"in",
"a",
"future",
"turn",
"."
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L800-L807 | |
55,564 | altshift/altshift | lib/altshift/promise.js | function (asyncFunction, callbackNotDeclared) {
var arity = asyncFunction.length;
return function () {
var deferred = new Deferred(),
args = slice.call(arguments),
callback;
if (callbackNotDeclared && !args[args.length + 1] instanceof Function) {
arity = args... | javascript | function (asyncFunction, callbackNotDeclared) {
var arity = asyncFunction.length;
return function () {
var deferred = new Deferred(),
args = slice.call(arguments),
callback;
if (callbackNotDeclared && !args[args.length + 1] instanceof Function) {
arity = args... | [
"function",
"(",
"asyncFunction",
",",
"callbackNotDeclared",
")",
"{",
"var",
"arity",
"=",
"asyncFunction",
".",
"length",
";",
"return",
"function",
"(",
")",
"{",
"var",
"deferred",
"=",
"new",
"Deferred",
"(",
")",
",",
"args",
"=",
"slice",
".",
"c... | Converts a Node async function to a promise returning function
@param {Function} asyncFunction node async function which takes a callback as its last argument
@param {boolean} callbackNotDeclared true if callback is optional in the definition
@return {Function} A function that returns a promise | [
"Converts",
"a",
"Node",
"async",
"function",
"to",
"a",
"promise",
"returning",
"function"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/promise.js#L907-L949 | |
55,565 | iopa-io/iopa-devices | demo.js | DemoDevice | function DemoDevice(){
var _device = {};
_device[DEVICE.ModelManufacturer] = "Internet of Protocols Alliance";
_device[DEVICE.ModelManufacturerUrl] = "http://iopa.io";
_device[DEVICE.ModelName] = "npm install iopa-devices";
_device[DEVICE.ModelNumber] = "iopa-devices";
_device[DEVICE.ModelUrl] = "http://git... | javascript | function DemoDevice(){
var _device = {};
_device[DEVICE.ModelManufacturer] = "Internet of Protocols Alliance";
_device[DEVICE.ModelManufacturerUrl] = "http://iopa.io";
_device[DEVICE.ModelName] = "npm install iopa-devices";
_device[DEVICE.ModelNumber] = "iopa-devices";
_device[DEVICE.ModelUrl] = "http://git... | [
"function",
"DemoDevice",
"(",
")",
"{",
"var",
"_device",
"=",
"{",
"}",
";",
"_device",
"[",
"DEVICE",
".",
"ModelManufacturer",
"]",
"=",
"\"Internet of Protocols Alliance\"",
";",
"_device",
"[",
"DEVICE",
".",
"ModelManufacturerUrl",
"]",
"=",
"\"http://iop... | Demo Device Class | [
"Demo",
"Device",
"Class"
] | 1610a73f391fefa3f67f21b113f2206f13ba268d | https://github.com/iopa-io/iopa-devices/blob/1610a73f391fefa3f67f21b113f2206f13ba268d/demo.js#L46-L80 |
55,566 | mannyvergel/oils-js | core/utils/oilsUtils.js | function(arrPathFromRoot) {
if (arrPathFromRoot) {
let routes = {};
for (let pathFromRoot of arrPathFromRoot) {
routes['/' + pathFromRoot] = {
get: function(req, res) {
web.utils.serveStaticFile(path.join(web.conf.publicDir, pathFromRoot), res);
}
}
}
return routes;
... | javascript | function(arrPathFromRoot) {
if (arrPathFromRoot) {
let routes = {};
for (let pathFromRoot of arrPathFromRoot) {
routes['/' + pathFromRoot] = {
get: function(req, res) {
web.utils.serveStaticFile(path.join(web.conf.publicDir, pathFromRoot), res);
}
}
}
return routes;
... | [
"function",
"(",
"arrPathFromRoot",
")",
"{",
"if",
"(",
"arrPathFromRoot",
")",
"{",
"let",
"routes",
"=",
"{",
"}",
";",
"for",
"(",
"let",
"pathFromRoot",
"of",
"arrPathFromRoot",
")",
"{",
"routes",
"[",
"'/'",
"+",
"pathFromRoot",
"]",
"=",
"{",
"... | because of the ability to change the context of the public folder some icons like favico, sitemap, robots.txt are still best served in root | [
"because",
"of",
"the",
"ability",
"to",
"change",
"the",
"context",
"of",
"the",
"public",
"folder",
"some",
"icons",
"like",
"favico",
"sitemap",
"robots",
".",
"txt",
"are",
"still",
"best",
"served",
"in",
"root"
] | 8d23714cab202f6dbb79d5d4ec536a684d77ca00 | https://github.com/mannyvergel/oils-js/blob/8d23714cab202f6dbb79d5d4ec536a684d77ca00/core/utils/oilsUtils.js#L25-L40 | |
55,567 | GoIncremental/gi-util | dist/gi-util.js | transformData | function transformData(data, headers, status, fns) {
if (isFunction(fns))
return fns(data, headers, status);
forEach(fns, function(fn) {
data = fn(data, headers, status);
});
return data;
} | javascript | function transformData(data, headers, status, fns) {
if (isFunction(fns))
return fns(data, headers, status);
forEach(fns, function(fn) {
data = fn(data, headers, status);
});
return data;
} | [
"function",
"transformData",
"(",
"data",
",",
"headers",
",",
"status",
",",
"fns",
")",
"{",
"if",
"(",
"isFunction",
"(",
"fns",
")",
")",
"return",
"fns",
"(",
"data",
",",
"headers",
",",
"status",
")",
";",
"forEach",
"(",
"fns",
",",
"function... | Chain all given functions
This function is used for both request and response transforming
@param {*} data Data to transform.
@param {function(string=)} headers HTTP headers getter fn.
@param {number} status HTTP status code of the response.
@param {(Function|Array.<Function>)} fns Function or an array of functions.
... | [
"Chain",
"all",
"given",
"functions"
] | ea9eb87f1c94efbc2a5f935e8159b536d7af3c40 | https://github.com/GoIncremental/gi-util/blob/ea9eb87f1c94efbc2a5f935e8159b536d7af3c40/dist/gi-util.js#L13310-L13319 |
55,568 | nfroidure/gulp-vartree | src/index.js | treeSorter | function treeSorter(node) {
if(node[options.childsProp]) {
node[options.childsProp].forEach(function(node) {
treeSorter(node);
});
node[options.childsProp].sort(function childSorter(a, b) {
var result;
if('undefined' === typeof a[options.sortProp]) {
result = (opt... | javascript | function treeSorter(node) {
if(node[options.childsProp]) {
node[options.childsProp].forEach(function(node) {
treeSorter(node);
});
node[options.childsProp].sort(function childSorter(a, b) {
var result;
if('undefined' === typeof a[options.sortProp]) {
result = (opt... | [
"function",
"treeSorter",
"(",
"node",
")",
"{",
"if",
"(",
"node",
"[",
"options",
".",
"childsProp",
"]",
")",
"{",
"node",
"[",
"options",
".",
"childsProp",
"]",
".",
"forEach",
"(",
"function",
"(",
"node",
")",
"{",
"treeSorter",
"(",
"node",
"... | Tree sorting function | [
"Tree",
"sorting",
"function"
] | 44ea5059845b2e330f7514a666d89eb8e889422e | https://github.com/nfroidure/gulp-vartree/blob/44ea5059845b2e330f7514a666d89eb8e889422e/src/index.js#L41-L59 |
55,569 | Jam3/innkeeper | index.js | function( userId ) {
return this.memory.createRoom( userId )
.then( function( id ) {
rooms[ id ] = room( this.memory, id );
return promise.resolve( rooms[ id ] );
}.bind( this ), function() {
return promise.reject( 'could not get a roomID to create a room' );
});
... | javascript | function( userId ) {
return this.memory.createRoom( userId )
.then( function( id ) {
rooms[ id ] = room( this.memory, id );
return promise.resolve( rooms[ id ] );
}.bind( this ), function() {
return promise.reject( 'could not get a roomID to create a room' );
});
... | [
"function",
"(",
"userId",
")",
"{",
"return",
"this",
".",
"memory",
".",
"createRoom",
"(",
"userId",
")",
".",
"then",
"(",
"function",
"(",
"id",
")",
"{",
"rooms",
"[",
"id",
"]",
"=",
"room",
"(",
"this",
".",
"memory",
",",
"id",
")",
";",... | Create a new room object
@param {String} userId id of the user whose reserving a room
@param {Boolean} isPublic whether the room your are creating is publicly available
@return {Promise} This promise will resolve by sending a room instance | [
"Create",
"a",
"new",
"room",
"object"
] | 95182271c62cf4416442c825189f025234b6ef1e | https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/index.js#L28-L40 | |
55,570 | Jam3/innkeeper | index.js | function( userId, id ) {
return this.memory.joinRoom( userId, id )
.then( function( id ) {
if( rooms[ id ] === undefined ) {
rooms[ id ] = room( this.memory, id );
}
return promise.resolve( rooms[ id ] );
}.bind( this ));
} | javascript | function( userId, id ) {
return this.memory.joinRoom( userId, id )
.then( function( id ) {
if( rooms[ id ] === undefined ) {
rooms[ id ] = room( this.memory, id );
}
return promise.resolve( rooms[ id ] );
}.bind( this ));
} | [
"function",
"(",
"userId",
",",
"id",
")",
"{",
"return",
"this",
".",
"memory",
".",
"joinRoom",
"(",
"userId",
",",
"id",
")",
".",
"then",
"(",
"function",
"(",
"id",
")",
"{",
"if",
"(",
"rooms",
"[",
"id",
"]",
"===",
"undefined",
")",
"{",
... | Join a room
@param {String} userId id of the user whose entering a room
@param {String} id id for the room you'd like to enter
@return {Promise} This promise will resolve by sending a room instance if the room does not exist it will fail | [
"Join",
"a",
"room"
] | 95182271c62cf4416442c825189f025234b6ef1e | https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/index.js#L49-L61 | |
55,571 | Jam3/innkeeper | index.js | function( userId ) {
return this.memory.getPublicRoom()
.then(function( roomId ) {
if ( roomId ) {
return this.enter( userId, roomId);
} else {
return promise.reject( 'Could not find a public room' );
}
}.bind(this));
} | javascript | function( userId ) {
return this.memory.getPublicRoom()
.then(function( roomId ) {
if ( roomId ) {
return this.enter( userId, roomId);
} else {
return promise.reject( 'Could not find a public room' );
}
}.bind(this));
} | [
"function",
"(",
"userId",
")",
"{",
"return",
"this",
".",
"memory",
".",
"getPublicRoom",
"(",
")",
".",
"then",
"(",
"function",
"(",
"roomId",
")",
"{",
"if",
"(",
"roomId",
")",
"{",
"return",
"this",
".",
"enter",
"(",
"userId",
",",
"roomId",
... | Join an available public room or create one
@param {String} userId id of the user whose entering a room
@return {Promise} This promise will resolve by sending a room instance, or reject if no public rooms available | [
"Join",
"an",
"available",
"public",
"room",
"or",
"create",
"one"
] | 95182271c62cf4416442c825189f025234b6ef1e | https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/index.js#L82-L91 | |
55,572 | Jam3/innkeeper | index.js | function( userId, id ) {
return this.memory.leaveRoom( userId, id )
.then( function( numUsers ) {
if( numUsers == 0 ) {
// remove all listeners from room since there should be one
rooms[ id ].removeAllListeners();
rooms[ id ].setPrivate();
delete rooms[ id ];
return promise.resolve( n... | javascript | function( userId, id ) {
return this.memory.leaveRoom( userId, id )
.then( function( numUsers ) {
if( numUsers == 0 ) {
// remove all listeners from room since there should be one
rooms[ id ].removeAllListeners();
rooms[ id ].setPrivate();
delete rooms[ id ];
return promise.resolve( n... | [
"function",
"(",
"userId",
",",
"id",
")",
"{",
"return",
"this",
".",
"memory",
".",
"leaveRoom",
"(",
"userId",
",",
"id",
")",
".",
"then",
"(",
"function",
"(",
"numUsers",
")",
"{",
"if",
"(",
"numUsers",
"==",
"0",
")",
"{",
"// remove all list... | Leave a room.
@param {String} userId id of the user whose leaving a room
@param {String} id id for the room you'd like to leave
@return {Promise} When this promise resolves it will return a room object if the room still exists and null if not | [
"Leave",
"a",
"room",
"."
] | 95182271c62cf4416442c825189f025234b6ef1e | https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/index.js#L100-L118 | |
55,573 | juttle/juttle-googleanalytics-adapter | lib/google.js | getProperties | function getProperties() {
return analytics.management.webproperties.listAsync({
auth: auth,
accountId: accountId
})
.then((properties) => {
logger.debug('got properties', JSON.stringify(properties, null, 4));
return _.map(properties.items, (property) => {
return ... | javascript | function getProperties() {
return analytics.management.webproperties.listAsync({
auth: auth,
accountId: accountId
})
.then((properties) => {
logger.debug('got properties', JSON.stringify(properties, null, 4));
return _.map(properties.items, (property) => {
return ... | [
"function",
"getProperties",
"(",
")",
"{",
"return",
"analytics",
".",
"management",
".",
"webproperties",
".",
"listAsync",
"(",
"{",
"auth",
":",
"auth",
",",
"accountId",
":",
"accountId",
"}",
")",
".",
"then",
"(",
"(",
"properties",
")",
"=>",
"{"... | Get all accessible properties for the account | [
"Get",
"all",
"accessible",
"properties",
"for",
"the",
"account"
] | 2843c9667f21a3ff5dad62eca34e9935e835da22 | https://github.com/juttle/juttle-googleanalytics-adapter/blob/2843c9667f21a3ff5dad62eca34e9935e835da22/lib/google.js#L116-L127 |
55,574 | juttle/juttle-googleanalytics-adapter | lib/google.js | getViews | function getViews(property, options) {
logger.debug('getting views for', property);
return analytics.management.profiles.listAsync({
auth: auth,
accountId: accountId,
webPropertyId: property.id
})
.then((profiles) => {
// If we're not grouping by view, then only include t... | javascript | function getViews(property, options) {
logger.debug('getting views for', property);
return analytics.management.profiles.listAsync({
auth: auth,
accountId: accountId,
webPropertyId: property.id
})
.then((profiles) => {
// If we're not grouping by view, then only include t... | [
"function",
"getViews",
"(",
"property",
",",
"options",
")",
"{",
"logger",
".",
"debug",
"(",
"'getting views for'",
",",
"property",
")",
";",
"return",
"analytics",
".",
"management",
".",
"profiles",
".",
"listAsync",
"(",
"{",
"auth",
":",
"auth",
",... | Get all views for the given property | [
"Get",
"all",
"views",
"for",
"the",
"given",
"property"
] | 2843c9667f21a3ff5dad62eca34e9935e835da22 | https://github.com/juttle/juttle-googleanalytics-adapter/blob/2843c9667f21a3ff5dad62eca34e9935e835da22/lib/google.js#L130-L153 |
55,575 | hl198181/neptune | misc/demo/public/vendor/plupload-2.1.2/js/plupload.dev.js | get | function get(ids) {
var els = [], el;
if (o.typeOf(ids) !== 'array') {
ids = [ids];
}
var i = ids.length;
while (i--) {
el = o.get(ids[i]);
if (el) {
els.push(el);
}
}
return els.length ? els : null;
} | javascript | function get(ids) {
var els = [], el;
if (o.typeOf(ids) !== 'array') {
ids = [ids];
}
var i = ids.length;
while (i--) {
el = o.get(ids[i]);
if (el) {
els.push(el);
}
}
return els.length ? els : null;
} | [
"function",
"get",
"(",
"ids",
")",
"{",
"var",
"els",
"=",
"[",
"]",
",",
"el",
";",
"if",
"(",
"o",
".",
"typeOf",
"(",
"ids",
")",
"!==",
"'array'",
")",
"{",
"ids",
"=",
"[",
"ids",
"]",
";",
"}",
"var",
"i",
"=",
"ids",
".",
"length",
... | Get array of DOM Elements by their ids.
@method get
@for Utils
@param {String} id Identifier of the DOM Element
@return {Array} | [
"Get",
"array",
"of",
"DOM",
"Elements",
"by",
"their",
"ids",
"."
] | 88030bb4222945900e6a225469380cc43a016c13 | https://github.com/hl198181/neptune/blob/88030bb4222945900e6a225469380cc43a016c13/misc/demo/public/vendor/plupload-2.1.2/js/plupload.dev.js#L310-L326 |
55,576 | hl198181/neptune | misc/demo/public/vendor/plupload-2.1.2/js/plupload.dev.js | function(config, runtimes) {
var up, runtime;
up = new plupload.Uploader(config);
runtime = o.Runtime.thatCan(up.getOption().required_features, runtimes || config.runtimes);
up.destroy();
return runtime;
} | javascript | function(config, runtimes) {
var up, runtime;
up = new plupload.Uploader(config);
runtime = o.Runtime.thatCan(up.getOption().required_features, runtimes || config.runtimes);
up.destroy();
return runtime;
} | [
"function",
"(",
"config",
",",
"runtimes",
")",
"{",
"var",
"up",
",",
"runtime",
";",
"up",
"=",
"new",
"plupload",
".",
"Uploader",
"(",
"config",
")",
";",
"runtime",
"=",
"o",
".",
"Runtime",
".",
"thatCan",
"(",
"up",
".",
"getOption",
"(",
"... | A way to predict what runtime will be choosen in the current environment with the
specified settings.
@method predictRuntime
@static
@param {Object|String} config Plupload settings to check
@param {String} [runtimes] Comma-separated list of runtimes to check against
@return {String} Type of compatible runtime | [
"A",
"way",
"to",
"predict",
"what",
"runtime",
"will",
"be",
"choosen",
"in",
"the",
"current",
"environment",
"with",
"the",
"specified",
"settings",
"."
] | 88030bb4222945900e6a225469380cc43a016c13 | https://github.com/hl198181/neptune/blob/88030bb4222945900e6a225469380cc43a016c13/misc/demo/public/vendor/plupload-2.1.2/js/plupload.dev.js#L625-L632 | |
55,577 | robertblackwell/yake | src/yake/tasks.js | normalizeArguments | function normalizeArguments()
{
const a = arguments;
if (debug) debugLog(`normalizeArguments: arguments:${util.inspect(arguments)}`);
if (debug) debugLog(`normalizeArguments: a0: ${a[0]} a1:${a[1]} a2:${a[2]} a3:${a[3]}`);
if (debug) debugLog(`normalizeArguments: a0: ${typeof a[0]} a1:${typeof a[1]} a2... | javascript | function normalizeArguments()
{
const a = arguments;
if (debug) debugLog(`normalizeArguments: arguments:${util.inspect(arguments)}`);
if (debug) debugLog(`normalizeArguments: a0: ${a[0]} a1:${a[1]} a2:${a[2]} a3:${a[3]}`);
if (debug) debugLog(`normalizeArguments: a0: ${typeof a[0]} a1:${typeof a[1]} a2... | [
"function",
"normalizeArguments",
"(",
")",
"{",
"const",
"a",
"=",
"arguments",
";",
"if",
"(",
"debug",
")",
"debugLog",
"(",
"`",
"${",
"util",
".",
"inspect",
"(",
"arguments",
")",
"}",
"`",
")",
";",
"if",
"(",
"debug",
")",
"debugLog",
"(",
... | Normalize the arguments passed into the task definition function.
Inside a yakefile tasks are defined with a call like ...
jake.task('name', 'description', ['prerequisite1', ...], function action(){})
The name and action are manditory while the other two - description and [prerequisistes]
are optional.
This function... | [
"Normalize",
"the",
"arguments",
"passed",
"into",
"the",
"task",
"definition",
"function",
".",
"Inside",
"a",
"yakefile",
"tasks",
"are",
"defined",
"with",
"a",
"call",
"like",
"..."
] | 172b02e29303fb718bac88bbda9b85749c57169c | https://github.com/robertblackwell/yake/blob/172b02e29303fb718bac88bbda9b85749c57169c/src/yake/tasks.js#L233-L302 |
55,578 | robertblackwell/yake | src/yake/tasks.js | loadPreloadedTasks | function loadPreloadedTasks(taskCollection)
{
const preTasks = [
{
name : 'help',
description : 'list all tasks',
prerequisites : [],
action : function actionHelp()
{
/* eslint-disable no-console */
console.log('this... | javascript | function loadPreloadedTasks(taskCollection)
{
const preTasks = [
{
name : 'help',
description : 'list all tasks',
prerequisites : [],
action : function actionHelp()
{
/* eslint-disable no-console */
console.log('this... | [
"function",
"loadPreloadedTasks",
"(",
"taskCollection",
")",
"{",
"const",
"preTasks",
"=",
"[",
"{",
"name",
":",
"'help'",
",",
"description",
":",
"'list all tasks'",
",",
"prerequisites",
":",
"[",
"]",
",",
"action",
":",
"function",
"actionHelp",
"(",
... | Yake provides for a set of standard tasks to be preloaded. This function performs that process.
@param {TaskCollection} taskCollection into which the tasks are to be loaded
@return {TaskCollection} the same one that was passed in but updated | [
"Yake",
"provides",
"for",
"a",
"set",
"of",
"standard",
"tasks",
"to",
"be",
"preloaded",
".",
"This",
"function",
"performs",
"that",
"process",
"."
] | 172b02e29303fb718bac88bbda9b85749c57169c | https://github.com/robertblackwell/yake/blob/172b02e29303fb718bac88bbda9b85749c57169c/src/yake/tasks.js#L332-L350 |
55,579 | robertblackwell/yake | src/yake/tasks.js | requireTasks | function requireTasks(yakefile, taskCollection)
{
const debug = false;
globals.globalTaskCollection = taskCollection;
if (debug) debugLog(`loadTasks: called ${yakefile}`);
/* eslint-disable global-require */
require(yakefile);
/* eslint-disable global-require */
const newTaskCollectio... | javascript | function requireTasks(yakefile, taskCollection)
{
const debug = false;
globals.globalTaskCollection = taskCollection;
if (debug) debugLog(`loadTasks: called ${yakefile}`);
/* eslint-disable global-require */
require(yakefile);
/* eslint-disable global-require */
const newTaskCollectio... | [
"function",
"requireTasks",
"(",
"yakefile",
",",
"taskCollection",
")",
"{",
"const",
"debug",
"=",
"false",
";",
"globals",
".",
"globalTaskCollection",
"=",
"taskCollection",
";",
"if",
"(",
"debug",
")",
"debugLog",
"(",
"`",
"${",
"yakefile",
"}",
"`",
... | Loads tasks from a yakefile into taskCollection and returns the updated taskCollection.
It does this by a dynamic 'require'
@param {string} yakefile - full path to yakefile - assume it exists
@parame {TaskCollection} taskCollection - collection into which tasks will be placed
@return {TaskCollection}... | [
"Loads",
"tasks",
"from",
"a",
"yakefile",
"into",
"taskCollection",
"and",
"returns",
"the",
"updated",
"taskCollection",
".",
"It",
"does",
"this",
"by",
"a",
"dynamic",
"require"
] | 172b02e29303fb718bac88bbda9b85749c57169c | https://github.com/robertblackwell/yake/blob/172b02e29303fb718bac88bbda9b85749c57169c/src/yake/tasks.js#L361-L375 |
55,580 | BarzinJS/string-extensions | lib/parsers/bool.js | function (item, arr, options) {
debug('Match');
debug('Item: %s', item);
debug('Array: %s', arr);
debug('Options: %o', options);
// normal item match (case-sensitive)
let found = arr.indexOf(item) > -1;
// case insensitive test if on... | javascript | function (item, arr, options) {
debug('Match');
debug('Item: %s', item);
debug('Array: %s', arr);
debug('Options: %o', options);
// normal item match (case-sensitive)
let found = arr.indexOf(item) > -1;
// case insensitive test if on... | [
"function",
"(",
"item",
",",
"arr",
",",
"options",
")",
"{",
"debug",
"(",
"'Match'",
")",
";",
"debug",
"(",
"'Item: %s'",
",",
"item",
")",
";",
"debug",
"(",
"'Array: %s'",
",",
"arr",
")",
";",
"debug",
"(",
"'Options: %o'",
",",
"options",
")"... | Match item in an array
@param {string} item Item to search for
@param {array<string>} arr Array of string items
@param {any} options Search/Match options
@returns {bool} Match result | [
"Match",
"item",
"in",
"an",
"array"
] | 448db8fa460cb10859e927fadde3bde0eb8fb054 | https://github.com/BarzinJS/string-extensions/blob/448db8fa460cb10859e927fadde3bde0eb8fb054/lib/parsers/bool.js#L21-L48 | |
55,581 | lorenwest/monitor-min | lib/Sync.js | function(changedModel, options) {
// Don't update unless the model is different
var newModel = model.syncMonitor.get('model');
if (_.isEqual(JSON.parse(JSON.stringify(model)), JSON.parse(JSON.stringify(newModel)))) {
log.info('monitorListener.noChanges', t.className, newModel);
... | javascript | function(changedModel, options) {
// Don't update unless the model is different
var newModel = model.syncMonitor.get('model');
if (_.isEqual(JSON.parse(JSON.stringify(model)), JSON.parse(JSON.stringify(newModel)))) {
log.info('monitorListener.noChanges', t.className, newModel);
... | [
"function",
"(",
"changedModel",
",",
"options",
")",
"{",
"// Don't update unless the model is different",
"var",
"newModel",
"=",
"model",
".",
"syncMonitor",
".",
"get",
"(",
"'model'",
")",
";",
"if",
"(",
"_",
".",
"isEqual",
"(",
"JSON",
".",
"parse",
... | Server-side listener - for updating server changes into the model | [
"Server",
"-",
"side",
"listener",
"-",
"for",
"updating",
"server",
"changes",
"into",
"the",
"model"
] | 859ba34a121498dc1cb98577ae24abd825407fca | https://github.com/lorenwest/monitor-min/blob/859ba34a121498dc1cb98577ae24abd825407fca/lib/Sync.js#L299-L326 | |
55,582 | imlucas/node-stor | stores/indexeddb.js | db | function db(op, fn){
if(!indexedDB){
return fn(new Error('store `indexeddb` not supported by this browser'));
}
if(typeof op === 'function'){
fn = op;
op = 'readwrite';
}
if(source !== null){
return fn(null, source.transaction(module.exports.prefix, op).objectStore(module.exports.prefix));
... | javascript | function db(op, fn){
if(!indexedDB){
return fn(new Error('store `indexeddb` not supported by this browser'));
}
if(typeof op === 'function'){
fn = op;
op = 'readwrite';
}
if(source !== null){
return fn(null, source.transaction(module.exports.prefix, op).objectStore(module.exports.prefix));
... | [
"function",
"db",
"(",
"op",
",",
"fn",
")",
"{",
"if",
"(",
"!",
"indexedDB",
")",
"{",
"return",
"fn",
"(",
"new",
"Error",
"(",
"'store `indexeddb` not supported by this browser'",
")",
")",
";",
"}",
"if",
"(",
"typeof",
"op",
"===",
"'function'",
")... | Wrapper function that handles creating or acquiring the object store if it hasn't been already. | [
"Wrapper",
"function",
"that",
"handles",
"creating",
"or",
"acquiring",
"the",
"object",
"store",
"if",
"it",
"hasn",
"t",
"been",
"already",
"."
] | 6b74af52bf160873658bc3570db716d44c33f335 | https://github.com/imlucas/node-stor/blob/6b74af52bf160873658bc3570db716d44c33f335/stores/indexeddb.js#L8-L32 |
55,583 | YahooArchive/mojito-cli-jslint | lib/reporter.js | main | function main(env, print, cb) {
var dir = env.opts.directory || path.resolve(env.cwd, 'artifacts/jslint'),
lines = [],
count = 0,
total = 0;
function perOffense(o) {
var evidence = o.evidence.trim();
count += 1;
total += 1;
lines.push(fmt(' #%d %d,%d: ... | javascript | function main(env, print, cb) {
var dir = env.opts.directory || path.resolve(env.cwd, 'artifacts/jslint'),
lines = [],
count = 0,
total = 0;
function perOffense(o) {
var evidence = o.evidence.trim();
count += 1;
total += 1;
lines.push(fmt(' #%d %d,%d: ... | [
"function",
"main",
"(",
"env",
",",
"print",
",",
"cb",
")",
"{",
"var",
"dir",
"=",
"env",
".",
"opts",
".",
"directory",
"||",
"path",
".",
"resolve",
"(",
"env",
".",
"cwd",
",",
"'artifacts/jslint'",
")",
",",
"lines",
"=",
"[",
"]",
",",
"c... | return a function that is responsible for outputing the lint results, to a file or stdout, and then invoking the final callback. | [
"return",
"a",
"function",
"that",
"is",
"responsible",
"for",
"outputing",
"the",
"lint",
"results",
"to",
"a",
"file",
"or",
"stdout",
"and",
"then",
"invoking",
"the",
"final",
"callback",
"."
] | cc6f90352534689a9e8c524c4cce825215bb5186 | https://github.com/YahooArchive/mojito-cli-jslint/blob/cc6f90352534689a9e8c524c4cce825215bb5186/lib/reporter.js#L57-L121 |
55,584 | commenthol/streamss-readonly | index.js | readonly | function readonly (stream) {
var rs = stream._readableState || {}
var opts = {}
if (typeof stream.read !== 'function') {
throw new Error('not a readable stream')
}
['highWaterMark', 'encoding', 'objectMode'].forEach(function (p) {
opts[p] = rs[p]
})
var readOnly = new Readable(opts)
var waiti... | javascript | function readonly (stream) {
var rs = stream._readableState || {}
var opts = {}
if (typeof stream.read !== 'function') {
throw new Error('not a readable stream')
}
['highWaterMark', 'encoding', 'objectMode'].forEach(function (p) {
opts[p] = rs[p]
})
var readOnly = new Readable(opts)
var waiti... | [
"function",
"readonly",
"(",
"stream",
")",
"{",
"var",
"rs",
"=",
"stream",
".",
"_readableState",
"||",
"{",
"}",
"var",
"opts",
"=",
"{",
"}",
"if",
"(",
"typeof",
"stream",
".",
"read",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"Error",
"(",... | Converts any stream into a read-only stream
@param {Readable|Transform|Duplex} stream - A stream which shall behave as a Readable only stream.
@throws {Error} "not a readable stream" - if stream does not implement a Readable component this error is thrown
@return {Readable} - A read-only readable stream | [
"Converts",
"any",
"stream",
"into",
"a",
"read",
"-",
"only",
"stream"
] | cdeb9a41821a4837d94bc8bda8667d86dc74d273 | https://github.com/commenthol/streamss-readonly/blob/cdeb9a41821a4837d94bc8bda8667d86dc74d273/index.js#L19-L62 |
55,585 | fczbkk/event-simulator | lib/index.js | setupEvent | function setupEvent(event_type) {
var event = void 0;
if (exists(document.createEvent)) {
// modern browsers
event = document.createEvent('HTMLEvents');
event.initEvent(event_type, true, true);
} else if (exists(document.createEventObject)) {
// IE9-
event = document.createEventObject();
... | javascript | function setupEvent(event_type) {
var event = void 0;
if (exists(document.createEvent)) {
// modern browsers
event = document.createEvent('HTMLEvents');
event.initEvent(event_type, true, true);
} else if (exists(document.createEventObject)) {
// IE9-
event = document.createEventObject();
... | [
"function",
"setupEvent",
"(",
"event_type",
")",
"{",
"var",
"event",
"=",
"void",
"0",
";",
"if",
"(",
"exists",
"(",
"document",
".",
"createEvent",
")",
")",
"{",
"// modern browsers",
"event",
"=",
"document",
".",
"createEvent",
"(",
"'HTMLEvents'",
... | Cross-browser bridge that creates event object
@param {string} event_type Event identifier
@returns {Event} Event object
@private | [
"Cross",
"-",
"browser",
"bridge",
"that",
"creates",
"event",
"object"
] | ad7f7caff8145226c5b19faeac680772e5040001 | https://github.com/fczbkk/event-simulator/blob/ad7f7caff8145226c5b19faeac680772e5040001/lib/index.js#L27-L41 |
55,586 | fczbkk/event-simulator | lib/index.js | fireEvent | function fireEvent(target_object, event, event_type) {
var on_event_type = 'on' + event_type;
if (exists(target_object.dispatchEvent)) {
// modern browsers
target_object.dispatchEvent(event);
} else if (exists(target_object.fireEvent)) {
// IE9-
target_object.fireEvent(on_event_type, event);
} ... | javascript | function fireEvent(target_object, event, event_type) {
var on_event_type = 'on' + event_type;
if (exists(target_object.dispatchEvent)) {
// modern browsers
target_object.dispatchEvent(event);
} else if (exists(target_object.fireEvent)) {
// IE9-
target_object.fireEvent(on_event_type, event);
} ... | [
"function",
"fireEvent",
"(",
"target_object",
",",
"event",
",",
"event_type",
")",
"{",
"var",
"on_event_type",
"=",
"'on'",
"+",
"event_type",
";",
"if",
"(",
"exists",
"(",
"target_object",
".",
"dispatchEvent",
")",
")",
"{",
"// modern browsers",
"target... | Cross-browser bridge that fires an event object on target object
@param {Object} target_object Any object that can fire an event
@param {Event} event Event object
@param {string} event_type Event identifier
@private | [
"Cross",
"-",
"browser",
"bridge",
"that",
"fires",
"an",
"event",
"object",
"on",
"target",
"object"
] | ad7f7caff8145226c5b19faeac680772e5040001 | https://github.com/fczbkk/event-simulator/blob/ad7f7caff8145226c5b19faeac680772e5040001/lib/index.js#L50-L64 |
55,587 | fczbkk/event-simulator | lib/index.js | simulateEvent | function simulateEvent(target_object, event_type) {
if (!exists(target_object)) {
throw new TypeError('simulateEvent: target object must be defined');
}
if (typeof event_type !== 'string') {
throw new TypeError('simulateEvent: event type must be a string');
}
var event = setupEvent(event_type);
fi... | javascript | function simulateEvent(target_object, event_type) {
if (!exists(target_object)) {
throw new TypeError('simulateEvent: target object must be defined');
}
if (typeof event_type !== 'string') {
throw new TypeError('simulateEvent: event type must be a string');
}
var event = setupEvent(event_type);
fi... | [
"function",
"simulateEvent",
"(",
"target_object",
",",
"event_type",
")",
"{",
"if",
"(",
"!",
"exists",
"(",
"target_object",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'simulateEvent: target object must be defined'",
")",
";",
"}",
"if",
"(",
"typeof",... | Fires an event of provided type on provided object
@param {Object} target_object Any object that can fire an event
@param {string} event_type Event identifier
@example
simulateEvent(window, 'scroll'); | [
"Fires",
"an",
"event",
"of",
"provided",
"type",
"on",
"provided",
"object"
] | ad7f7caff8145226c5b19faeac680772e5040001 | https://github.com/fczbkk/event-simulator/blob/ad7f7caff8145226c5b19faeac680772e5040001/lib/index.js#L73-L84 |
55,588 | fczbkk/event-simulator | lib/index.js | setupMouseEvent | function setupMouseEvent(properties) {
var event = document.createEvent('MouseEvents');
event.initMouseEvent(properties.type, properties.canBubble, properties.cancelable, properties.view, properties.detail, properties.screenX, properties.screenY, properties.clientX, properties.clientY, properties.ctrlKey, propertie... | javascript | function setupMouseEvent(properties) {
var event = document.createEvent('MouseEvents');
event.initMouseEvent(properties.type, properties.canBubble, properties.cancelable, properties.view, properties.detail, properties.screenX, properties.screenY, properties.clientX, properties.clientY, properties.ctrlKey, propertie... | [
"function",
"setupMouseEvent",
"(",
"properties",
")",
"{",
"var",
"event",
"=",
"document",
".",
"createEvent",
"(",
"'MouseEvents'",
")",
";",
"event",
".",
"initMouseEvent",
"(",
"properties",
".",
"type",
",",
"properties",
".",
"canBubble",
",",
"properti... | Constructs mouse event object
@param {Object} properties
@returns {Event}
@private | [
"Constructs",
"mouse",
"event",
"object"
] | ad7f7caff8145226c5b19faeac680772e5040001 | https://github.com/fczbkk/event-simulator/blob/ad7f7caff8145226c5b19faeac680772e5040001/lib/index.js#L136-L140 |
55,589 | fczbkk/event-simulator | lib/index.js | simulateMouseEvent | function simulateMouseEvent(target_object) {
var custom_properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var properties = sanitizeProperties(custom_properties);
var event = setupMouseEvent(properties);
target_object.dispatchEvent(event);
} | javascript | function simulateMouseEvent(target_object) {
var custom_properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var properties = sanitizeProperties(custom_properties);
var event = setupMouseEvent(properties);
target_object.dispatchEvent(event);
} | [
"function",
"simulateMouseEvent",
"(",
"target_object",
")",
"{",
"var",
"custom_properties",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"{",
"}",
";",
"var",
"pr... | Fires a mouse event on provided object
@param {Object} target_object
@param {Object} custom_properties
@example
simulateMouseEvent(window, {type: 'mousedown', button: 'right'}); | [
"Fires",
"a",
"mouse",
"event",
"on",
"provided",
"object"
] | ad7f7caff8145226c5b19faeac680772e5040001 | https://github.com/fczbkk/event-simulator/blob/ad7f7caff8145226c5b19faeac680772e5040001/lib/index.js#L149-L155 |
55,590 | TJkrusinski/feedtitles | index.js | onText | function onText (text) {
if (!current || !text) return;
titles.push(text);
self.emit('title', text);
} | javascript | function onText (text) {
if (!current || !text) return;
titles.push(text);
self.emit('title', text);
} | [
"function",
"onText",
"(",
"text",
")",
"{",
"if",
"(",
"!",
"current",
"||",
"!",
"text",
")",
"return",
";",
"titles",
".",
"push",
"(",
"text",
")",
";",
"self",
".",
"emit",
"(",
"'title'",
",",
"text",
")",
";",
"}"
] | If we are in a title node then push on the text
@param {String} text | [
"If",
"we",
"are",
"in",
"a",
"title",
"node",
"then",
"push",
"on",
"the",
"text"
] | f398f4515607f03af05e4e3e340f9fdfd1aec195 | https://github.com/TJkrusinski/feedtitles/blob/f398f4515607f03af05e4e3e340f9fdfd1aec195/index.js#L50-L54 |
55,591 | pmh/espresso | lib/ometa/ometa/base.js | extend | function extend(obj) {
for(var i=1,len=arguments.length;i<len;i++) {
var props = arguments[i];
for(var p in props) {
if(props.hasOwnProperty(p)) {
obj[p] = props[p];
}
}
}
return obj;
} | javascript | function extend(obj) {
for(var i=1,len=arguments.length;i<len;i++) {
var props = arguments[i];
for(var p in props) {
if(props.hasOwnProperty(p)) {
obj[p] = props[p];
}
}
}
return obj;
} | [
"function",
"extend",
"(",
"obj",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"1",
",",
"len",
"=",
"arguments",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"var",
"props",
"=",
"arguments",
"[",
"i",
"]",
";",
"for",
"(",
"var"... | Local helper methods | [
"Local",
"helper",
"methods"
] | 26d7b2089a2098344aaaf32ec7eb942e91a7edf5 | https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L47-L58 |
55,592 | pmh/espresso | lib/ometa/ometa/base.js | inherit | function inherit(x, props) {
var r = Object.create(x);
return extend(r, props);
} | javascript | function inherit(x, props) {
var r = Object.create(x);
return extend(r, props);
} | [
"function",
"inherit",
"(",
"x",
",",
"props",
")",
"{",
"var",
"r",
"=",
"Object",
".",
"create",
"(",
"x",
")",
";",
"return",
"extend",
"(",
"r",
",",
"props",
")",
";",
"}"
] | A simplified Version of Object.create | [
"A",
"simplified",
"Version",
"of",
"Object",
".",
"create"
] | 26d7b2089a2098344aaaf32ec7eb942e91a7edf5 | https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L61-L64 |
55,593 | pmh/espresso | lib/ometa/ometa/base.js | function(grammar, ruleName) {
grammar = this._apply("anything");
ruleName = this._apply("anything");
var foreign = inherit(grammar, {
bt: this.bt.borrow()
});
var ans = foreign._apply(ruleName);
this.bt.take_back(); // return the borrowed input stream
return ans;
... | javascript | function(grammar, ruleName) {
grammar = this._apply("anything");
ruleName = this._apply("anything");
var foreign = inherit(grammar, {
bt: this.bt.borrow()
});
var ans = foreign._apply(ruleName);
this.bt.take_back(); // return the borrowed input stream
return ans;
... | [
"function",
"(",
"grammar",
",",
"ruleName",
")",
"{",
"grammar",
"=",
"this",
".",
"_apply",
"(",
"\"anything\"",
")",
";",
"ruleName",
"=",
"this",
".",
"_apply",
"(",
"\"anything\"",
")",
";",
"var",
"foreign",
"=",
"inherit",
"(",
"grammar",
",",
"... | otherGrammar.rule | [
"otherGrammar",
".",
"rule"
] | 26d7b2089a2098344aaaf32ec7eb942e91a7edf5 | https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L684-L695 | |
55,594 | pmh/espresso | lib/ometa/ometa/base.js | _not | function _not(expr) {
var state = this.bt.current_state();
try { var r = expr.call(this) }
catch (f) {
this.bt.catch_mismatch(f);
this.bt.restore(state);
return true
}
this.bt.mismatch("Negative lookahead didn't match got " + r);
} | javascript | function _not(expr) {
var state = this.bt.current_state();
try { var r = expr.call(this) }
catch (f) {
this.bt.catch_mismatch(f);
this.bt.restore(state);
return true
}
this.bt.mismatch("Negative lookahead didn't match got " + r);
} | [
"function",
"_not",
"(",
"expr",
")",
"{",
"var",
"state",
"=",
"this",
".",
"bt",
".",
"current_state",
"(",
")",
";",
"try",
"{",
"var",
"r",
"=",
"expr",
".",
"call",
"(",
"this",
")",
"}",
"catch",
"(",
"f",
")",
"{",
"this",
".",
"bt",
"... | negative lookahead ~rule | [
"negative",
"lookahead",
"~rule"
] | 26d7b2089a2098344aaaf32ec7eb942e91a7edf5 | https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L714-L723 |
55,595 | pmh/espresso | lib/ometa/ometa/base.js | _lookahead | function _lookahead(expr) {
var state = this.bt.current_state(),
ans = expr.call(this);
this.bt.restore(state);
return ans
} | javascript | function _lookahead(expr) {
var state = this.bt.current_state(),
ans = expr.call(this);
this.bt.restore(state);
return ans
} | [
"function",
"_lookahead",
"(",
"expr",
")",
"{",
"var",
"state",
"=",
"this",
".",
"bt",
".",
"current_state",
"(",
")",
",",
"ans",
"=",
"expr",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"bt",
".",
"restore",
"(",
"state",
")",
";",
"retu... | positive lookahead &rule | [
"positive",
"lookahead",
"&rule"
] | 26d7b2089a2098344aaaf32ec7eb942e91a7edf5 | https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L727-L732 |
55,596 | pmh/espresso | lib/ometa/ometa/base.js | function() {
var state = this.bt.current_state();
for(var i=0,len=arguments.length; i<len; i++) {
try {
return arguments[i].call(this)
} catch (f) {
this.bt.catch_mismatch(f);
this.bt.restore(state);
}
}
this.bt.mismatch("All alter... | javascript | function() {
var state = this.bt.current_state();
for(var i=0,len=arguments.length; i<len; i++) {
try {
return arguments[i].call(this)
} catch (f) {
this.bt.catch_mismatch(f);
this.bt.restore(state);
}
}
this.bt.mismatch("All alter... | [
"function",
"(",
")",
"{",
"var",
"state",
"=",
"this",
".",
"bt",
".",
"current_state",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"arguments",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"try",
"{",... | ordered alternatives rule_a | rule_b tries all alternatives until the first match | [
"ordered",
"alternatives",
"rule_a",
"|",
"rule_b",
"tries",
"all",
"alternatives",
"until",
"the",
"first",
"match"
] | 26d7b2089a2098344aaaf32ec7eb942e91a7edf5 | https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L737-L749 | |
55,597 | pmh/espresso | lib/ometa/ometa/base.js | function(rule) {
var state = this.bt.current_state();
try { return rule.call(this); }
catch(f) {
this.bt.catch_mismatch(f);
this.bt.restore(state);
}
} | javascript | function(rule) {
var state = this.bt.current_state();
try { return rule.call(this); }
catch(f) {
this.bt.catch_mismatch(f);
this.bt.restore(state);
}
} | [
"function",
"(",
"rule",
")",
"{",
"var",
"state",
"=",
"this",
".",
"bt",
".",
"current_state",
"(",
")",
";",
"try",
"{",
"return",
"rule",
".",
"call",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"f",
")",
"{",
"this",
".",
"bt",
".",
"catch_m... | Optional occurance of rule rule? | [
"Optional",
"occurance",
"of",
"rule",
"rule?"
] | 26d7b2089a2098344aaaf32ec7eb942e91a7edf5 | https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/base.js#L788-L795 | |
55,598 | nail/node-gelf-manager | lib/gelf-manager.js | GELFManager | function GELFManager(options) {
if (typeof options === 'undefined') options = {};
for (k in GELFManager.options)
if (typeof options[k] === 'undefined')
options[k] = GELFManager.options[k];
this.debug = options.debug;
this.chunkTimeout = options.chunkTimeout;
this.gcTimeout = options.gcTi... | javascript | function GELFManager(options) {
if (typeof options === 'undefined') options = {};
for (k in GELFManager.options)
if (typeof options[k] === 'undefined')
options[k] = GELFManager.options[k];
this.debug = options.debug;
this.chunkTimeout = options.chunkTimeout;
this.gcTimeout = options.gcTi... | [
"function",
"GELFManager",
"(",
"options",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'undefined'",
")",
"options",
"=",
"{",
"}",
";",
"for",
"(",
"k",
"in",
"GELFManager",
".",
"options",
")",
"if",
"(",
"typeof",
"options",
"[",
"k",
"]",
"... | GELFManager - Handles GELF messages
Example:
var manager = new GELFManager();
manager.on('message', function(msg) { console.log(msg); });
manager.feed(rawUDPMessage); | [
"GELFManager",
"-",
"Handles",
"GELF",
"messages"
] | 4c090050c8706e5e20158263fea451e5e814285e | https://github.com/nail/node-gelf-manager/blob/4c090050c8706e5e20158263fea451e5e814285e/lib/gelf-manager.js#L23-L39 |
55,599 | danawoodman/parent-folder | lib/index.js | parentFolder | function parentFolder(fullPath) {
var isFile = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
// If no path passed in, use the file path of the
// caller.
if (!fullPath) {
fullPath = module.parent.filename;
isFile = true;
}
var pathObj = _path2['default'].parse(fullPat... | javascript | function parentFolder(fullPath) {
var isFile = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
// If no path passed in, use the file path of the
// caller.
if (!fullPath) {
fullPath = module.parent.filename;
isFile = true;
}
var pathObj = _path2['default'].parse(fullPat... | [
"function",
"parentFolder",
"(",
"fullPath",
")",
"{",
"var",
"isFile",
"=",
"arguments",
".",
"length",
"<=",
"1",
"||",
"arguments",
"[",
"1",
"]",
"===",
"undefined",
"?",
"false",
":",
"arguments",
"[",
"1",
"]",
";",
"// If no path passed in, use the fi... | Get the name of the parent folder. If given a directory
as a path, return the last directory. If given a path
with a file, return the parent of that file. Default
to the parent folder of the call path.
@module parentFolder
@param {String} [fullPath=module.parent.filename] The full path to find the parent folder from
@... | [
"Get",
"the",
"name",
"of",
"the",
"parent",
"folder",
".",
"If",
"given",
"a",
"directory",
"as",
"a",
"path",
"return",
"the",
"last",
"directory",
".",
"If",
"given",
"a",
"path",
"with",
"a",
"file",
"return",
"the",
"parent",
"of",
"that",
"file",... | 36ec3bf041d1402ce9f6946e1d05d7f9aff01e5a | https://github.com/danawoodman/parent-folder/blob/36ec3bf041d1402ce9f6946e1d05d7f9aff01e5a/lib/index.js#L26-L43 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.