id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
45,400 | nodejitsu/contour | pagelets/head.js | stylesheets | function stylesheets(options) {
return this.stylesheets.reduce(function reduce(links, sheet) {
return links + options.fn(sheet);
}, '');
} | javascript | function stylesheets(options) {
return this.stylesheets.reduce(function reduce(links, sheet) {
return links + options.fn(sheet);
}, '');
} | [
"function",
"stylesheets",
"(",
"options",
")",
"{",
"return",
"this",
".",
"stylesheets",
".",
"reduce",
"(",
"function",
"reduce",
"(",
"links",
",",
"sheet",
")",
"{",
"return",
"links",
"+",
"options",
".",
"fn",
"(",
"sheet",
")",
";",
"}",
",",
... | Handlebars helper that will iterate over the stylesheets in the data.
@param {Object} options
@return {String} generated template
@api private | [
"Handlebars",
"helper",
"that",
"will",
"iterate",
"over",
"the",
"stylesheets",
"in",
"the",
"data",
"."
] | 0828e9bd25ef1eeb97ea231c447118d9867021b6 | https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/head.js#L43-L47 |
45,401 | nodejitsu/contour | pagelets/head.js | define | function define() {
if (!('canonical' in this.data)) {
this.data.canonical = [
'https://',
pkg.subdomain,
'.nodejitsu.com',
url.parse(this.defaults.canonical).pathname
].join('');
}
return this;
} | javascript | function define() {
if (!('canonical' in this.data)) {
this.data.canonical = [
'https://',
pkg.subdomain,
'.nodejitsu.com',
url.parse(this.defaults.canonical).pathname
].join('');
}
return this;
} | [
"function",
"define",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"'canonical'",
"in",
"this",
".",
"data",
")",
")",
"{",
"this",
".",
"data",
".",
"canonical",
"=",
"[",
"'https://'",
",",
"pkg",
".",
"subdomain",
",",
"'.nodejitsu.com'",
",",
"url",
".",
... | Always set a canonical reference on the data.
@returns {Pagelet}
@api private | [
"Always",
"set",
"a",
"canonical",
"reference",
"on",
"the",
"data",
"."
] | 0828e9bd25ef1eeb97ea231c447118d9867021b6 | https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/head.js#L55-L66 |
45,402 | mchalapuk/hyper-text-slider | lib/core/slide-change-event.js | SlideChangeEvent | function SlideChangeEvent(fromIndex, toIndex) {
check(fromIndex, 'fromIndex').is.aNumber();
check(toIndex, 'toIndex').is.aNumber();
var pub = Object.create(SlideChangeEvent.prototype);
/**
* Index of previous slide.
*
* @type Number
* @access read-only
* @fqn SlideChangeEvent.prototype.fromInde... | javascript | function SlideChangeEvent(fromIndex, toIndex) {
check(fromIndex, 'fromIndex').is.aNumber();
check(toIndex, 'toIndex').is.aNumber();
var pub = Object.create(SlideChangeEvent.prototype);
/**
* Index of previous slide.
*
* @type Number
* @access read-only
* @fqn SlideChangeEvent.prototype.fromInde... | [
"function",
"SlideChangeEvent",
"(",
"fromIndex",
",",
"toIndex",
")",
"{",
"check",
"(",
"fromIndex",
",",
"'fromIndex'",
")",
".",
"is",
".",
"aNumber",
"(",
")",
";",
"check",
"(",
"toIndex",
",",
"'toIndex'",
")",
".",
"is",
".",
"aNumber",
"(",
")... | Creates SlideChangeEvent.
@param {Number} from index of a previous slide
@param {Number} to index of current slide
@fqn SlideChangeEvent.prototype.constructor | [
"Creates",
"SlideChangeEvent",
"."
] | 2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4 | https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/slide-change-event.js#L37-L62 |
45,403 | sofa/sofa | dist/sofa.js | function (backendAddress) {
backendAddress = backendAddress || {};
var country = {
value: safeUse(backendAddress.country),
label: safeUse(backendAddress.countryname)
};
return {
company: safeUse(backendAddress.company),
saluta... | javascript | function (backendAddress) {
backendAddress = backendAddress || {};
var country = {
value: safeUse(backendAddress.country),
label: safeUse(backendAddress.countryname)
};
return {
company: safeUse(backendAddress.company),
saluta... | [
"function",
"(",
"backendAddress",
")",
"{",
"backendAddress",
"=",
"backendAddress",
"||",
"{",
"}",
";",
"var",
"country",
"=",
"{",
"value",
":",
"safeUse",
"(",
"backendAddress",
".",
"country",
")",
",",
"label",
":",
"safeUse",
"(",
"backendAddress",
... | unfortunately the backend uses all sorts of different address formats this one converts an address coming from a summary response to the generic app address format. | [
"unfortunately",
"the",
"backend",
"uses",
"all",
"sorts",
"of",
"different",
"address",
"formats",
"this",
"one",
"converts",
"an",
"address",
"coming",
"from",
"a",
"summary",
"response",
"to",
"the",
"generic",
"app",
"address",
"format",
"."
] | 0dda1f2f197e3cf7d93bcea4b890777af74e65f6 | https://github.com/sofa/sofa/blob/0dda1f2f197e3cf7d93bcea4b890777af74e65f6/dist/sofa.js#L2048-L2069 | |
45,404 | sofa/sofa | dist/sofa.js | function (products, categoryUrlId) {
return products.map(function (product) {
product.categoryUrlId = categoryUrlId;
// the backend is sending us prices as strings.
// we need to fix that up for sorting and other things to work
product.price = parseFloat(product.p... | javascript | function (products, categoryUrlId) {
return products.map(function (product) {
product.categoryUrlId = categoryUrlId;
// the backend is sending us prices as strings.
// we need to fix that up for sorting and other things to work
product.price = parseFloat(product.p... | [
"function",
"(",
"products",
",",
"categoryUrlId",
")",
"{",
"return",
"products",
".",
"map",
"(",
"function",
"(",
"product",
")",
"{",
"product",
".",
"categoryUrlId",
"=",
"categoryUrlId",
";",
"// the backend is sending us prices as strings.",
"// we need to fix ... | it's a bit akward that we need to do that. It should be adressed directly on our server API so that this extra processing can be removed. | [
"it",
"s",
"a",
"bit",
"akward",
"that",
"we",
"need",
"to",
"do",
"that",
".",
"It",
"should",
"be",
"adressed",
"directly",
"on",
"our",
"server",
"API",
"so",
"that",
"this",
"extra",
"processing",
"can",
"be",
"removed",
"."
] | 0dda1f2f197e3cf7d93bcea4b890777af74e65f6 | https://github.com/sofa/sofa/blob/0dda1f2f197e3cf7d93bcea4b890777af74e65f6/dist/sofa.js#L2344-L2352 | |
45,405 | sofa/sofa | dist/sofa.js | function () {
var activeCoupons = basketService.getActiveCoupons();
var oldCouponCodes = activeCoupons.map(function (activeCoupon) {
return activeCoupon.code;
});
basketService.clearCoupons();
oldCouponCodes.forEach(function (couponCode) {
self.submitCo... | javascript | function () {
var activeCoupons = basketService.getActiveCoupons();
var oldCouponCodes = activeCoupons.map(function (activeCoupon) {
return activeCoupon.code;
});
basketService.clearCoupons();
oldCouponCodes.forEach(function (couponCode) {
self.submitCo... | [
"function",
"(",
")",
"{",
"var",
"activeCoupons",
"=",
"basketService",
".",
"getActiveCoupons",
"(",
")",
";",
"var",
"oldCouponCodes",
"=",
"activeCoupons",
".",
"map",
"(",
"function",
"(",
"activeCoupon",
")",
"{",
"return",
"activeCoupon",
".",
"code",
... | When the cart changes, refresh the values of the coupons by sending them to the backend along with the new cart | [
"When",
"the",
"cart",
"changes",
"refresh",
"the",
"values",
"of",
"the",
"coupons",
"by",
"sending",
"them",
"to",
"the",
"backend",
"along",
"with",
"the",
"new",
"cart"
] | 0dda1f2f197e3cf7d93bcea4b890777af74e65f6 | https://github.com/sofa/sofa/blob/0dda1f2f197e3cf7d93bcea4b890777af74e65f6/dist/sofa.js#L2658-L2670 | |
45,406 | feedhenry/fh-mbaas-client | lib/app/appforms/config.js | get | function get(params, cb) {
var resourcePath = "/appforms/config";
var method = "GET";
var data = {};
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
mbaasRequest.app(params, cb);
} | javascript | function get(params, cb) {
var resourcePath = "/appforms/config";
var method = "GET";
var data = {};
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
mbaasRequest.app(params, cb);
} | [
"function",
"get",
"(",
"params",
",",
"cb",
")",
"{",
"var",
"resourcePath",
"=",
"\"/appforms/config\"",
";",
"var",
"method",
"=",
"\"GET\"",
";",
"var",
"data",
"=",
"{",
"}",
";",
"params",
".",
"resourcePath",
"=",
"resourcePath",
";",
"params",
".... | Get The Forms App Configuration Associated With A Project | [
"Get",
"The",
"Forms",
"App",
"Configuration",
"Associated",
"With",
"A",
"Project"
] | 2d5a9cbb32e1b2464d71ffa18513358fea388859 | https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/app/appforms/config.js#L6-L16 |
45,407 | jldec/pub-generator | serialize.js | serializeFile | function serializeFile(file) {
// preserve path, source, and file-save props
var o = u.pick(file, 'path', '_oldtext', '_dirty');
// recreate file.text from serialized fragments
// new or modifified fragments should delete file.text
o.text = file.text || serializeTextFragments(file);
return o;
} | javascript | function serializeFile(file) {
// preserve path, source, and file-save props
var o = u.pick(file, 'path', '_oldtext', '_dirty');
// recreate file.text from serialized fragments
// new or modifified fragments should delete file.text
o.text = file.text || serializeTextFragments(file);
return o;
} | [
"function",
"serializeFile",
"(",
"file",
")",
"{",
"// preserve path, source, and file-save props",
"var",
"o",
"=",
"u",
".",
"pick",
"(",
"file",
",",
"'path'",
",",
"'_oldtext'",
",",
"'_dirty'",
")",
";",
"// recreate file.text from serialized fragments",
"// new... | return serializable file object | [
"return",
"serializable",
"file",
"object"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/serialize.js#L27-L37 |
45,408 | socialally/air | lib/air/clone.js | clone | function clone() {
var arr = [];
this.each(function(el) {
arr.push(el.cloneNode(true));
});
return this.air(arr);
} | javascript | function clone() {
var arr = [];
this.each(function(el) {
arr.push(el.cloneNode(true));
});
return this.air(arr);
} | [
"function",
"clone",
"(",
")",
"{",
"var",
"arr",
"=",
"[",
"]",
";",
"this",
".",
"each",
"(",
"function",
"(",
"el",
")",
"{",
"arr",
".",
"push",
"(",
"el",
".",
"cloneNode",
"(",
"true",
")",
")",
";",
"}",
")",
";",
"return",
"this",
"."... | Create a deep copy of the set of matched elements. | [
"Create",
"a",
"deep",
"copy",
"of",
"the",
"set",
"of",
"matched",
"elements",
"."
] | a3d94de58aaa4930a425fbcc7266764bf6ca8ca6 | https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/clone.js#L4-L10 |
45,409 | vesln/unix.js | lib/result.js | Result | function Result(cmd, err, stdout, stderr) {
this.cmd = cmd;
this.err = err;
this.stdout = strip(stdout);
this.stderr = strip(stderr);
} | javascript | function Result(cmd, err, stdout, stderr) {
this.cmd = cmd;
this.err = err;
this.stdout = strip(stdout);
this.stderr = strip(stderr);
} | [
"function",
"Result",
"(",
"cmd",
",",
"err",
",",
"stdout",
",",
"stderr",
")",
"{",
"this",
".",
"cmd",
"=",
"cmd",
";",
"this",
".",
"err",
"=",
"err",
";",
"this",
".",
"stdout",
"=",
"strip",
"(",
"stdout",
")",
";",
"this",
".",
"stderr",
... | Command result.
@param {String} command
@param {Object} error
@param {String} stdout
@param {String} stderr
@constructor | [
"Command",
"result",
"."
] | 706b70b3d4d0cf815414303d58791afeae2fed3e | https://github.com/vesln/unix.js/blob/706b70b3d4d0cf815414303d58791afeae2fed3e/lib/result.js#L23-L28 |
45,410 | cliffano/couchpenter | lib/db.js | _errorCb | function _errorCb(err, result) {
// if there is a conflict error, retrieve the document's revision first
function _successCb(err, result) {
// use the revision to update the existing documents
// NOTE: it is not impossible that the revision of this document
// i... | javascript | function _errorCb(err, result) {
// if there is a conflict error, retrieve the document's revision first
function _successCb(err, result) {
// use the revision to update the existing documents
// NOTE: it is not impossible that the revision of this document
// i... | [
"function",
"_errorCb",
"(",
"err",
",",
"result",
")",
"{",
"// if there is a conflict error, retrieve the document's revision first",
"function",
"_successCb",
"(",
"err",
",",
"result",
")",
"{",
"// use the revision to update the existing documents",
"// NOTE: it is not impos... | try to create documents, but with conflict error handling | [
"try",
"to",
"create",
"documents",
"but",
"with",
"conflict",
"error",
"handling"
] | 00cce387da2f39e4b276b27b0bacb073caa80453 | https://github.com/cliffano/couchpenter/blob/00cce387da2f39e4b276b27b0bacb073caa80453/lib/db.js#L143-L165 |
45,411 | cliffano/couchpenter | lib/db.js | _successCb | function _successCb(err, result) {
self.couch.use(dbName).destroy(result._id, result._rev, self._handle(cb, {
dbName: dbName,
docId: doc._id,
message: 'deleted'
}));
} | javascript | function _successCb(err, result) {
self.couch.use(dbName).destroy(result._id, result._rev, self._handle(cb, {
dbName: dbName,
docId: doc._id,
message: 'deleted'
}));
} | [
"function",
"_successCb",
"(",
"err",
",",
"result",
")",
"{",
"self",
".",
"couch",
".",
"use",
"(",
"dbName",
")",
".",
"destroy",
"(",
"result",
".",
"_id",
",",
"result",
".",
"_rev",
",",
"self",
".",
"_handle",
"(",
"cb",
",",
"{",
"dbName",
... | retrieve the document revision and use it to delete the document | [
"retrieve",
"the",
"document",
"revision",
"and",
"use",
"it",
"to",
"delete",
"the",
"document"
] | 00cce387da2f39e4b276b27b0bacb073caa80453 | https://github.com/cliffano/couchpenter/blob/00cce387da2f39e4b276b27b0bacb073caa80453/lib/db.js#L195-L202 |
45,412 | cliffano/couchpenter | lib/db.js | _result | function _result(err, dbName, docId, message) {
var result = {
id: util.format('%s%s%s', dbName, (docId) ? '/' : '', docId || ''),
message: message || util.format('%s (%s)', err.error, err.status_code)
};
if (err) {
result.error = err;
}
return result;
} | javascript | function _result(err, dbName, docId, message) {
var result = {
id: util.format('%s%s%s', dbName, (docId) ? '/' : '', docId || ''),
message: message || util.format('%s (%s)', err.error, err.status_code)
};
if (err) {
result.error = err;
}
return result;
} | [
"function",
"_result",
"(",
"err",
",",
"dbName",
",",
"docId",
",",
"message",
")",
"{",
"var",
"result",
"=",
"{",
"id",
":",
"util",
".",
"format",
"(",
"'%s%s%s'",
",",
"dbName",
",",
"(",
"docId",
")",
"?",
"'/'",
":",
"''",
",",
"docId",
"|... | construct result object, the existence of error field indicates whether the result is a success or not | [
"construct",
"result",
"object",
"the",
"existence",
"of",
"error",
"field",
"indicates",
"whether",
"the",
"result",
"is",
"a",
"success",
"or",
"not"
] | 00cce387da2f39e4b276b27b0bacb073caa80453 | https://github.com/cliffano/couchpenter/blob/00cce387da2f39e4b276b27b0bacb073caa80453/lib/db.js#L382-L391 |
45,413 | kflorence/gulp-data-matter | index.js | matter | function matter(file) {
var parsed = gm(file.contents.toString());
file.contents = new Buffer(parsed.content);
return parsed.data;
} | javascript | function matter(file) {
var parsed = gm(file.contents.toString());
file.contents = new Buffer(parsed.content);
return parsed.data;
} | [
"function",
"matter",
"(",
"file",
")",
"{",
"var",
"parsed",
"=",
"gm",
"(",
"file",
".",
"contents",
".",
"toString",
"(",
")",
")",
";",
"file",
".",
"contents",
"=",
"new",
"Buffer",
"(",
"parsed",
".",
"content",
")",
";",
"return",
"parsed",
... | Extract and parse front-matter from files using gray-matter.
@param {Object} file Vinyl File object
@return Data from front matter | [
"Extract",
"and",
"parse",
"front",
"-",
"matter",
"from",
"files",
"using",
"gray",
"-",
"matter",
"."
] | 7655bcbfe08dd5f228e9c7887b17778651bf35d0 | https://github.com/kflorence/gulp-data-matter/blob/7655bcbfe08dd5f228e9c7887b17778651bf35d0/index.js#L11-L15 |
45,414 | mchalapuk/hyper-text-slider | lib/docgen/formatter.js | lazyBuildObjectTree | function lazyBuildObjectTree(priv, formatted) {
definePropertyGetters(formatted, {
children: lazy(function() { return priv.fqnMap.getChildrenOf(formatted.fqn); }),
fields: lazy(function() { return formatted.children.filter(Filter.ofType('property')); }),
methods: lazy(function() { return formatted.childre... | javascript | function lazyBuildObjectTree(priv, formatted) {
definePropertyGetters(formatted, {
children: lazy(function() { return priv.fqnMap.getChildrenOf(formatted.fqn); }),
fields: lazy(function() { return formatted.children.filter(Filter.ofType('property')); }),
methods: lazy(function() { return formatted.childre... | [
"function",
"lazyBuildObjectTree",
"(",
"priv",
",",
"formatted",
")",
"{",
"definePropertyGetters",
"(",
"formatted",
",",
"{",
"children",
":",
"lazy",
"(",
"function",
"(",
")",
"{",
"return",
"priv",
".",
"fqnMap",
".",
"getChildrenOf",
"(",
"formatted",
... | sets parent->child relations | [
"sets",
"parent",
"-",
">",
"child",
"relations"
] | 2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4 | https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/docgen/formatter.js#L199-L207 |
45,415 | mchalapuk/hyper-text-slider | lib/docgen/formatter.js | toGithubHash | function toGithubHash(title) {
var GITHUB_ILLEGAL = new RegExp('[\\[\\]{}()<>^$#@!%&*+\/\\|~`"\':;,.]', 'g');
return title.toLowerCase().replace(/ /g, '-').replace(GITHUB_ILLEGAL, '');
} | javascript | function toGithubHash(title) {
var GITHUB_ILLEGAL = new RegExp('[\\[\\]{}()<>^$#@!%&*+\/\\|~`"\':;,.]', 'g');
return title.toLowerCase().replace(/ /g, '-').replace(GITHUB_ILLEGAL, '');
} | [
"function",
"toGithubHash",
"(",
"title",
")",
"{",
"var",
"GITHUB_ILLEGAL",
"=",
"new",
"RegExp",
"(",
"'[\\\\[\\\\]{}()<>^$#@!%&*+\\/\\\\|~`\"\\':;,.]'",
",",
"'g'",
")",
";",
"return",
"title",
".",
"toLowerCase",
"(",
")",
".",
"replace",
"(",
"/",
" ",
"/... | Algorithm of generating a HTML label used in Github Markdown | [
"Algorithm",
"of",
"generating",
"a",
"HTML",
"label",
"used",
"in",
"Github",
"Markdown"
] | 2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4 | https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/docgen/formatter.js#L237-L240 |
45,416 | neurospeech/web-atoms-mvvm.js | dist/web-atoms-mvvm.js | bindableProperty | function bindableProperty(target, key) {
// property value
var _val = this[key];
var keyName = "_" + key;
this[keyName] = _val;
// property getter
var getter = function () {
// console.log(`Get: ${key} => ${_val}`);
return this[keyName];
};
// property setter
var sett... | javascript | function bindableProperty(target, key) {
// property value
var _val = this[key];
var keyName = "_" + key;
this[keyName] = _val;
// property getter
var getter = function () {
// console.log(`Get: ${key} => ${_val}`);
return this[keyName];
};
// property setter
var sett... | [
"function",
"bindableProperty",
"(",
"target",
",",
"key",
")",
"{",
"// property value",
"var",
"_val",
"=",
"this",
"[",
"key",
"]",
";",
"var",
"keyName",
"=",
"\"_\"",
"+",
"key",
";",
"this",
"[",
"keyName",
"]",
"=",
"_val",
";",
"// property gette... | This decorator will mark given property as bindable, it will define
getter and setter, and in the setter, it will refresh the property.
class Customer{
@bindableProperty
firstName:string;
}
@param {*} target
@param {string} key | [
"This",
"decorator",
"will",
"mark",
"given",
"property",
"as",
"bindable",
"it",
"will",
"define",
"getter",
"and",
"setter",
"and",
"in",
"the",
"setter",
"it",
"will",
"refresh",
"the",
"property",
"."
] | 777222c3d5b491686be3a81a433e0cf7cb3ff979 | https://github.com/neurospeech/web-atoms-mvvm.js/blob/777222c3d5b491686be3a81a433e0cf7cb3ff979/dist/web-atoms-mvvm.js#L172-L215 |
45,417 | neurospeech/web-atoms-mvvm.js | dist/web-atoms-mvvm.js | AtomWatcher | function AtomWatcher(target, path, runAfterSetup, forValidation) {
var _this = this;
this._isExecuting = false;
this.target = target;
var e = false;
if (forValidation === true) {
this.forValidation = true;
}
if (path ins... | javascript | function AtomWatcher(target, path, runAfterSetup, forValidation) {
var _this = this;
this._isExecuting = false;
this.target = target;
var e = false;
if (forValidation === true) {
this.forValidation = true;
}
if (path ins... | [
"function",
"AtomWatcher",
"(",
"target",
",",
"path",
",",
"runAfterSetup",
",",
"forValidation",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"this",
".",
"_isExecuting",
"=",
"false",
";",
"this",
".",
"target",
"=",
"target",
";",
"var",
"e",
"=",
"... | Creates an instance of AtomWatcher.
var w = new AtomWatcher(this, x => x.data.fullName = `${x.data.firstName} ${x.data.lastName}`);
You must dispose `w` in order to avoid memory leaks.
Above method will set fullName whenver, data or its firstName,lastName property is modified.
AtomWatcher will assign null if any exp... | [
"Creates",
"an",
"instance",
"of",
"AtomWatcher",
"."
] | 777222c3d5b491686be3a81a433e0cf7cb3ff979 | https://github.com/neurospeech/web-atoms-mvvm.js/blob/777222c3d5b491686be3a81a433e0cf7cb3ff979/dist/web-atoms-mvvm.js#L1431-L1462 |
45,418 | neurospeech/web-atoms-mvvm.js | dist/web-atoms-mvvm.js | function () {
return {
href: location.href,
hash: location.hash,
host: location.host,
hostName: location.hostname,
port: location.port,
protocol: location.protocol
};
... | javascript | function () {
return {
href: location.href,
hash: location.hash,
host: location.host,
hostName: location.hostname,
port: location.port,
protocol: location.protocol
};
... | [
"function",
"(",
")",
"{",
"return",
"{",
"href",
":",
"location",
".",
"href",
",",
"hash",
":",
"location",
".",
"hash",
",",
"host",
":",
"location",
".",
"host",
",",
"hostName",
":",
"location",
".",
"hostname",
",",
"port",
":",
"location",
"."... | Gets current location of browser, this does not return
actual location but it returns values of browser location.
This is done to provide mocking behaviour for unit testing.
@readonly
@type {AtomLocation}
@memberof BrowserService | [
"Gets",
"current",
"location",
"of",
"browser",
"this",
"does",
"not",
"return",
"actual",
"location",
"but",
"it",
"returns",
"values",
"of",
"browser",
"location",
".",
"This",
"is",
"done",
"to",
"provide",
"mocking",
"behaviour",
"for",
"unit",
"testing",
... | 777222c3d5b491686be3a81a433e0cf7cb3ff979 | https://github.com/neurospeech/web-atoms-mvvm.js/blob/777222c3d5b491686be3a81a433e0cf7cb3ff979/dist/web-atoms-mvvm.js#L1625-L1634 | |
45,419 | vid/SenseBase | web/ext-lib/dragFile.js | previewfile | function previewfile(file) {
if (false && tests.filereader === true) {
var reader = new FileReader();
reader.onload = function (event) {
var image = new Image();
image.src = event.target.result;
image.width = 250; // a fake resize
holder.appendChild(image);
};
... | javascript | function previewfile(file) {
if (false && tests.filereader === true) {
var reader = new FileReader();
reader.onload = function (event) {
var image = new Image();
image.src = event.target.result;
image.width = 250; // a fake resize
holder.appendChild(image);
};
... | [
"function",
"previewfile",
"(",
"file",
")",
"{",
"if",
"(",
"false",
"&&",
"tests",
".",
"filereader",
"===",
"true",
")",
"{",
"var",
"reader",
"=",
"new",
"FileReader",
"(",
")",
";",
"reader",
".",
"onload",
"=",
"function",
"(",
"event",
")",
"{... | FIXME display filetype icon | [
"FIXME",
"display",
"filetype",
"icon"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/web/ext-lib/dragFile.js#L47-L62 |
45,420 | unkelpehr/node-exit-hook | exit-hook.js | handleExit | function handleExit (canCancel, signal, code) {
var i = 0,
sub;
while ((sub = subs[i++])) {
if (sub[0].call(sub[1], canCancel, signal, code) === false && canCancel) {
return;
}
}
if (canCancel) {
process.exit(code);
}
} | javascript | function handleExit (canCancel, signal, code) {
var i = 0,
sub;
while ((sub = subs[i++])) {
if (sub[0].call(sub[1], canCancel, signal, code) === false && canCancel) {
return;
}
}
if (canCancel) {
process.exit(code);
}
} | [
"function",
"handleExit",
"(",
"canCancel",
",",
"signal",
",",
"code",
")",
"{",
"var",
"i",
"=",
"0",
",",
"sub",
";",
"while",
"(",
"(",
"sub",
"=",
"subs",
"[",
"i",
"++",
"]",
")",
")",
"{",
"if",
"(",
"sub",
"[",
"0",
"]",
".",
"call",
... | Handler for all exit events | [
"Handler",
"for",
"all",
"exit",
"events"
] | 5c4a6078c3d8f0fb98fbbfbd8a952b5d6e8a159e | https://github.com/unkelpehr/node-exit-hook/blob/5c4a6078c3d8f0fb98fbbfbd8a952b5d6e8a159e/exit-hook.js#L9-L22 |
45,421 | unkelpehr/node-exit-hook | exit-hook.js | exitHook | function exitHook (context, func) {
if (!func) {
func = context;
context = func;
}
if (typeof func === 'function') {
subs.push([func, context])
}
return exitHook;
} | javascript | function exitHook (context, func) {
if (!func) {
func = context;
context = func;
}
if (typeof func === 'function') {
subs.push([func, context])
}
return exitHook;
} | [
"function",
"exitHook",
"(",
"context",
",",
"func",
")",
"{",
"if",
"(",
"!",
"func",
")",
"{",
"func",
"=",
"context",
";",
"context",
"=",
"func",
";",
"}",
"if",
"(",
"typeof",
"func",
"===",
"'function'",
")",
"{",
"subs",
".",
"push",
"(",
... | Adds a new function to execute when the application is exiting. | [
"Adds",
"a",
"new",
"function",
"to",
"execute",
"when",
"the",
"application",
"is",
"exiting",
"."
] | 5c4a6078c3d8f0fb98fbbfbd8a952b5d6e8a159e | https://github.com/unkelpehr/node-exit-hook/blob/5c4a6078c3d8f0fb98fbbfbd8a952b5d6e8a159e/exit-hook.js#L25-L36 |
45,422 | ngenerio/smsghjs | lib/sendmsg.js | SendMessage | function SendMessage (auth, apiVersion) {
if (!(this instanceof SendMessage)) return new SendMessage(auth, apiVersion)
this._noopCallback = function () {}
this._headers = {
'Accept': 'application/json',
'Authorization': 'Basic ' + auth.basicAuth
}
this.versionNumber = apiVersion || 'v3'
this.lastQue... | javascript | function SendMessage (auth, apiVersion) {
if (!(this instanceof SendMessage)) return new SendMessage(auth, apiVersion)
this._noopCallback = function () {}
this._headers = {
'Accept': 'application/json',
'Authorization': 'Basic ' + auth.basicAuth
}
this.versionNumber = apiVersion || 'v3'
this.lastQue... | [
"function",
"SendMessage",
"(",
"auth",
",",
"apiVersion",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"SendMessage",
")",
")",
"return",
"new",
"SendMessage",
"(",
"auth",
",",
"apiVersion",
")",
"this",
".",
"_noopCallback",
"=",
"function",
"("... | The main constructor used for sending messages
@param {Auth} auth The authentication details
@param {String} apiVersion The API version to use for request (Versioned API) | [
"The",
"main",
"constructor",
"used",
"for",
"sending",
"messages"
] | cfb33bb6b5b02d54125bed67365a5b174a1ad562 | https://github.com/ngenerio/smsghjs/blob/cfb33bb6b5b02d54125bed67365a5b174a1ad562/lib/sendmsg.js#L12-L22 |
45,423 | express-go/express-go | lib/Boot/Boot.js | Init | function Init(appGlobal, pathsList) {
debug("Initializing Boot");
loadFinder = new Finder();
loadProvider = new Provider();
loadNamespace = new Namespace();
global = appGlobal;
global.App = {};
global.Modules = {};
g... | javascript | function Init(appGlobal, pathsList) {
debug("Initializing Boot");
loadFinder = new Finder();
loadProvider = new Provider();
loadNamespace = new Namespace();
global = appGlobal;
global.App = {};
global.Modules = {};
g... | [
"function",
"Init",
"(",
"appGlobal",
",",
"pathsList",
")",
"{",
"debug",
"(",
"\"Initializing Boot\"",
")",
";",
"loadFinder",
"=",
"new",
"Finder",
"(",
")",
";",
"loadProvider",
"=",
"new",
"Provider",
"(",
")",
";",
"loadNamespace",
"=",
"new",
"Names... | Loading components, objects
@param appGlobal
@param pathsList | [
"Loading",
"components",
"objects"
] | d8da60bc2046380528464a827c43de4f75c5b2d7 | https://github.com/express-go/express-go/blob/d8da60bc2046380528464a827c43de4f75c5b2d7/lib/Boot/Boot.js#L37-L60 |
45,424 | cfpb/AtomicComponent | src/utilities/object-assign/index.js | assign | function assign( destination ) {
destination = destination || {};
for ( let i = 1, len = arguments.length; i < len; i++ ) {
const source = arguments[i] || {};
for ( const key in source ) {
if ( Object.prototype.hasOwnProperty.call( source, key ) ) {
const value = source[key];
if ( _isP... | javascript | function assign( destination ) {
destination = destination || {};
for ( let i = 1, len = arguments.length; i < len; i++ ) {
const source = arguments[i] || {};
for ( const key in source ) {
if ( Object.prototype.hasOwnProperty.call( source, key ) ) {
const value = source[key];
if ( _isP... | [
"function",
"assign",
"(",
"destination",
")",
"{",
"destination",
"=",
"destination",
"||",
"{",
"}",
";",
"for",
"(",
"let",
"i",
"=",
"1",
",",
"len",
"=",
"arguments",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"const",
"s... | Copies properties of all sources to the destination object overriding its own
existing properties. When assigning from multiple sources, fields of every
next source will override same named fields of previous sources.
@param {Object} destination object.
@returns {Object} assigned destination object. | [
"Copies",
"properties",
"of",
"all",
"sources",
"to",
"the",
"destination",
"object",
"overriding",
"its",
"own",
"existing",
"properties",
".",
"When",
"assigning",
"from",
"multiple",
"sources",
"fields",
"of",
"every",
"next",
"source",
"will",
"override",
"s... | f45d7ded6687672c8b701c9910ddfe90c7ede742 | https://github.com/cfpb/AtomicComponent/blob/f45d7ded6687672c8b701c9910ddfe90c7ede742/src/utilities/object-assign/index.js#L29-L46 |
45,425 | briancsparks/js-aws | lib/ec2/ec2.js | function(dbg, raFn, subName, g, name, argv_, context, outerCallback, callback) {
var argv = _.extend({}, argv_);
g[name] = {};
return raFn(argv, context, function(err, result_) {
if (err) { return sg.die(err, outerCallback, 'fetching '+name); }
var result = subName ? result_[subName] : result_;
if... | javascript | function(dbg, raFn, subName, g, name, argv_, context, outerCallback, callback) {
var argv = _.extend({}, argv_);
g[name] = {};
return raFn(argv, context, function(err, result_) {
if (err) { return sg.die(err, outerCallback, 'fetching '+name); }
var result = subName ? result_[subName] : result_;
if... | [
"function",
"(",
"dbg",
",",
"raFn",
",",
"subName",
",",
"g",
",",
"name",
",",
"argv_",
",",
"context",
",",
"outerCallback",
",",
"callback",
")",
"{",
"var",
"argv",
"=",
"_",
".",
"extend",
"(",
"{",
"}",
",",
"argv_",
")",
";",
"g",
"[",
... | fetch, using creds, not contacting server in the other acct | [
"fetch",
"using",
"creds",
"not",
"contacting",
"server",
"in",
"the",
"other",
"acct"
] | bb403415a1de754e6dee2238d3b5fb9bf5a2bf15 | https://github.com/briancsparks/js-aws/blob/bb403415a1de754e6dee2238d3b5fb9bf5a2bf15/lib/ec2/ec2.js#L1744-L1785 | |
45,426 | briancsparks/js-aws | lib/ec2/ec2.js | getUserdata0_ | function getUserdata0_(username, upNamespace, envVars_, origUsername) {
var envVars = cleanEnvVars(upNamespace, envVars_);
var script = [
"#!/bin/bash -ex",
format("if ! [ -d /home/%s ]; then", username),
format(" usermod -l %s %s", username, origUsername),
format(" gr... | javascript | function getUserdata0_(username, upNamespace, envVars_, origUsername) {
var envVars = cleanEnvVars(upNamespace, envVars_);
var script = [
"#!/bin/bash -ex",
format("if ! [ -d /home/%s ]; then", username),
format(" usermod -l %s %s", username, origUsername),
format(" gr... | [
"function",
"getUserdata0_",
"(",
"username",
",",
"upNamespace",
",",
"envVars_",
",",
"origUsername",
")",
"{",
"var",
"envVars",
"=",
"cleanEnvVars",
"(",
"upNamespace",
",",
"envVars_",
")",
";",
"var",
"script",
"=",
"[",
"\"#!/bin/bash -ex\"",
",",
"form... | The userdata for when starting an instance from a base-image.
Basically, it renames the default 'ubuntu' user to 'scotty'; manages
/etc/hosts, and sets a couple of system-wide env vars. | [
"The",
"userdata",
"for",
"when",
"starting",
"an",
"instance",
"from",
"a",
"base",
"-",
"image",
"."
] | bb403415a1de754e6dee2238d3b5fb9bf5a2bf15 | https://github.com/briancsparks/js-aws/blob/bb403415a1de754e6dee2238d3b5fb9bf5a2bf15/lib/ec2/ec2.js#L2539-L2567 |
45,427 | briancsparks/js-aws | lib/ec2/ec2.js | getUserdataForAmi_ | function getUserdataForAmi_(username, upNamespace, envVars_, origUsername) {
var envVars = cleanEnvVars(upNamespace, envVars_);
var script = [
"#!/bin/bash -ex",
""
];
_.each(envVars, function(value, key) {
script.push("/usr/local/bin/yoshi-set-env "+key+" "+value);
});
... | javascript | function getUserdataForAmi_(username, upNamespace, envVars_, origUsername) {
var envVars = cleanEnvVars(upNamespace, envVars_);
var script = [
"#!/bin/bash -ex",
""
];
_.each(envVars, function(value, key) {
script.push("/usr/local/bin/yoshi-set-env "+key+" "+value);
});
... | [
"function",
"getUserdataForAmi_",
"(",
"username",
",",
"upNamespace",
",",
"envVars_",
",",
"origUsername",
")",
"{",
"var",
"envVars",
"=",
"cleanEnvVars",
"(",
"upNamespace",
",",
"envVars_",
")",
";",
"var",
"script",
"=",
"[",
"\"#!/bin/bash -ex\"",
",",
... | The userdata for when starting an instance from a created AMI. | [
"The",
"userdata",
"for",
"when",
"starting",
"an",
"instance",
"from",
"a",
"created",
"AMI",
"."
] | bb403415a1de754e6dee2238d3b5fb9bf5a2bf15 | https://github.com/briancsparks/js-aws/blob/bb403415a1de754e6dee2238d3b5fb9bf5a2bf15/lib/ec2/ec2.js#L2578-L2592 |
45,428 | briancsparks/js-aws | lib/ec2/ec2.js | taggedAs | function taggedAs(taggedItem, name, namespace, namespaceEx) {
var tags = taggedItem.tags || taggedItem.Tags;
if (!namespace) { return /* undefined */; }
if (!tags) { return /* undefined */; }
// The new, improved way (ite... | javascript | function taggedAs(taggedItem, name, namespace, namespaceEx) {
var tags = taggedItem.tags || taggedItem.Tags;
if (!namespace) { return /* undefined */; }
if (!tags) { return /* undefined */; }
// The new, improved way (ite... | [
"function",
"taggedAs",
"(",
"taggedItem",
",",
"name",
",",
"namespace",
",",
"namespaceEx",
")",
"{",
"var",
"tags",
"=",
"taggedItem",
".",
"tags",
"||",
"taggedItem",
".",
"Tags",
";",
"if",
"(",
"!",
"namespace",
")",
"{",
"return",
"/* undefined */",... | Returns the tag, and knows a few different styles. | [
"Returns",
"the",
"tag",
"and",
"knows",
"a",
"few",
"different",
"styles",
"."
] | bb403415a1de754e6dee2238d3b5fb9bf5a2bf15 | https://github.com/briancsparks/js-aws/blob/bb403415a1de754e6dee2238d3b5fb9bf5a2bf15/lib/ec2/ec2.js#L2709-L2726 |
45,429 | briancsparks/js-aws | lib/ec2/ec2.js | isTaggedAs | function isTaggedAs(taggedItem, name, value, namespace, namespaceEx) {
return taggedAs(taggedItem, name, namespace, namespaceEx) == value; // == is intentional
} | javascript | function isTaggedAs(taggedItem, name, value, namespace, namespaceEx) {
return taggedAs(taggedItem, name, namespace, namespaceEx) == value; // == is intentional
} | [
"function",
"isTaggedAs",
"(",
"taggedItem",
",",
"name",
",",
"value",
",",
"namespace",
",",
"namespaceEx",
")",
"{",
"return",
"taggedAs",
"(",
"taggedItem",
",",
"name",
",",
"namespace",
",",
"namespaceEx",
")",
"==",
"value",
";",
"// == is intentional",... | Returns true if the item is tagged with the value. | [
"Returns",
"true",
"if",
"the",
"item",
"is",
"tagged",
"with",
"the",
"value",
"."
] | bb403415a1de754e6dee2238d3b5fb9bf5a2bf15 | https://github.com/briancsparks/js-aws/blob/bb403415a1de754e6dee2238d3b5fb9bf5a2bf15/lib/ec2/ec2.js#L2731-L2733 |
45,430 | Sobesednik/wrote | es5/src/create-writable.js | createWritable | function createWritable() {
var $args = arguments;return new Promise(function ($return, $error) {
var file, ws;
file = $args.length > 0 && $args[0] !== undefined ? $args[0] : getTempFile();
return Promise.resolve(openFileForWrite(file)).then(function ($await_2) {
try {
... | javascript | function createWritable() {
var $args = arguments;return new Promise(function ($return, $error) {
var file, ws;
file = $args.length > 0 && $args[0] !== undefined ? $args[0] : getTempFile();
return Promise.resolve(openFileForWrite(file)).then(function ($await_2) {
try {
... | [
"function",
"createWritable",
"(",
")",
"{",
"var",
"$args",
"=",
"arguments",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
"$return",
",",
"$error",
")",
"{",
"var",
"file",
",",
"ws",
";",
"file",
"=",
"$args",
".",
"length",
">",
"0",
"&... | Open the file for writing and create a write stream.
@param {string} ffile path to the file
@returns {Promise<Writable>} A promise with the stream | [
"Open",
"the",
"file",
"for",
"writing",
"and",
"create",
"a",
"write",
"stream",
"."
] | 24992ad3bba4e5959dfb617b6c1f22d9a1306ab9 | https://github.com/Sobesednik/wrote/blob/24992ad3bba4e5959dfb617b6c1f22d9a1306ab9/es5/src/create-writable.js#L47-L60 |
45,431 | feedhenry/fh-mbaas-client | lib/admin/appforms/submissions.js | list | function list(params, cb) {
var resourcePath = config.addURIParams(constants.FORMS_BASE_PATH + "/submissions", params);
var method = "GET";
var data = {};
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
mbaasRequest.admin(params, cb);
} | javascript | function list(params, cb) {
var resourcePath = config.addURIParams(constants.FORMS_BASE_PATH + "/submissions", params);
var method = "GET";
var data = {};
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
mbaasRequest.admin(params, cb);
} | [
"function",
"list",
"(",
"params",
",",
"cb",
")",
"{",
"var",
"resourcePath",
"=",
"config",
".",
"addURIParams",
"(",
"constants",
".",
"FORMS_BASE_PATH",
"+",
"\"/submissions\"",
",",
"params",
")",
";",
"var",
"method",
"=",
"\"GET\"",
";",
"var",
"dat... | List Submissions For An Environment
@param params
@param {object} params.paginate
@param {number} params.paginate.page Page to get
@param {number} params.paginate.limit Entries Per Page
@param cb | [
"List",
"Submissions",
"For",
"An",
"Environment"
] | 2d5a9cbb32e1b2464d71ffa18513358fea388859 | https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/admin/appforms/submissions.js#L13-L23 |
45,432 | feedhenry/fh-mbaas-client | lib/admin/appforms/submissions.js | updateFile | function updateFile(params, cb) {
var resourcePath = config.addURIParams(constants.FORMS_BASE_PATH + "/submissions/:id/fields/:fieldId/files/:fileId", params);
var method = "PUT";
var data = params.fileDetails;
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
params.fileRe... | javascript | function updateFile(params, cb) {
var resourcePath = config.addURIParams(constants.FORMS_BASE_PATH + "/submissions/:id/fields/:fieldId/files/:fileId", params);
var method = "PUT";
var data = params.fileDetails;
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
params.fileRe... | [
"function",
"updateFile",
"(",
"params",
",",
"cb",
")",
"{",
"var",
"resourcePath",
"=",
"config",
".",
"addURIParams",
"(",
"constants",
".",
"FORMS_BASE_PATH",
"+",
"\"/submissions/:id/fields/:fieldId/files/:fileId\"",
",",
"params",
")",
";",
"var",
"method",
... | Update A File For A Submission
@param {object} params
@param {string} params.id The submission ID (The submission should already exist)
@param {string} params.domain The Domain
@param {string} params.environment The Environment ID to upload To
@param {string}... | [
"Update",
"A",
"File",
"For",
"A",
"Submission"
] | 2d5a9cbb32e1b2464d71ffa18513358fea388859 | https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/admin/appforms/submissions.js#L101-L114 |
45,433 | feedhenry/fh-mbaas-client | lib/admin/appforms/submissions.js | filterSubmissions | function filterSubmissions(params, cb) {
params.resourcePath = config.addURIParams(constants.FORMS_BASE_PATH + "/submissions/filter", params);
params.method = "POST";
params.data = params.filterParams;
mbaasRequest.admin(params, cb);
} | javascript | function filterSubmissions(params, cb) {
params.resourcePath = config.addURIParams(constants.FORMS_BASE_PATH + "/submissions/filter", params);
params.method = "POST";
params.data = params.filterParams;
mbaasRequest.admin(params, cb);
} | [
"function",
"filterSubmissions",
"(",
"params",
",",
"cb",
")",
"{",
"params",
".",
"resourcePath",
"=",
"config",
".",
"addURIParams",
"(",
"constants",
".",
"FORMS_BASE_PATH",
"+",
"\"/submissions/filter\"",
",",
"params",
")",
";",
"params",
".",
"method",
... | Filtering Submissions From An Environment Mbaas.
Forms Can Be Filtered By form ID or Project ID
@param {object} params.pagination
@param {number} params.pagination.page Page to get
@param {number} params.pagination.limit Entries Per Page
@param cb | [
"Filtering",
"Submissions",
"From",
"An",
"Environment",
"Mbaas",
"."
] | 2d5a9cbb32e1b2464d71ffa18513358fea388859 | https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/admin/appforms/submissions.js#L189-L195 |
45,434 | feedhenry/fh-mbaas-client | lib/admin/appforms/submissions.js | getSubmissionPDF | function getSubmissionPDF(params, cb) {
var resourcePath = config.addURIParams(constants.FORMS_BASE_PATH + "/submissions/:id/exportpdf", params);
var method = "POST";
params.resourcePath = resourcePath;
params.method = method;
params.data = params.data || {};
params.fileRequest = true;
mbaasRequest.adm... | javascript | function getSubmissionPDF(params, cb) {
var resourcePath = config.addURIParams(constants.FORMS_BASE_PATH + "/submissions/:id/exportpdf", params);
var method = "POST";
params.resourcePath = resourcePath;
params.method = method;
params.data = params.data || {};
params.fileRequest = true;
mbaasRequest.adm... | [
"function",
"getSubmissionPDF",
"(",
"params",
",",
"cb",
")",
"{",
"var",
"resourcePath",
"=",
"config",
".",
"addURIParams",
"(",
"constants",
".",
"FORMS_BASE_PATH",
"+",
"\"/submissions/:id/exportpdf\"",
",",
"params",
")",
";",
"var",
"method",
"=",
"\"POST... | Getting A PDF Of A Submission
@param params
@param params.data
@param params.data.coreLocation - The host name of the domain accessing the PDF.
@param cb | [
"Getting",
"A",
"PDF",
"Of",
"A",
"Submission"
] | 2d5a9cbb32e1b2464d71ffa18513358fea388859 | https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/admin/appforms/submissions.js#L243-L254 |
45,435 | eoaranda/mta-metro | lib/metronorth.js | function(key,options){
this.key = key;
var route = "",
dayroute = "",
timeroute = "",
debug = false;
if (!this.key || this.key == "" || this.key == "<YOU-API-KEY>") {
throw new Error('MTA API key missing or incorrect.');
}... | javascript | function(key,options){
this.key = key;
var route = "",
dayroute = "",
timeroute = "",
debug = false;
if (!this.key || this.key == "" || this.key == "<YOU-API-KEY>") {
throw new Error('MTA API key missing or incorrect.');
}... | [
"function",
"(",
"key",
",",
"options",
")",
"{",
"this",
".",
"key",
"=",
"key",
";",
"var",
"route",
"=",
"\"\"",
",",
"dayroute",
"=",
"\"\"",
",",
"timeroute",
"=",
"\"\"",
",",
"debug",
"=",
"false",
";",
"if",
"(",
"!",
"this",
".",
"key",
... | returns an array with the schedule | [
"returns",
"an",
"array",
"with",
"the",
"schedule"
] | f0b10c99df222b39433a9cac3e0a3debf1f053df | https://github.com/eoaranda/mta-metro/blob/f0b10c99df222b39433a9cac3e0a3debf1f053df/lib/metronorth.js#L12-L63 | |
45,436 | specla/validator | lib/transformType.js | transformObject | function transformObject (type) {
const transformed = {}
for (let key in type) {
transformed[key] = transformType(type[key])
}
return transformed
} | javascript | function transformObject (type) {
const transformed = {}
for (let key in type) {
transformed[key] = transformType(type[key])
}
return transformed
} | [
"function",
"transformObject",
"(",
"type",
")",
"{",
"const",
"transformed",
"=",
"{",
"}",
"for",
"(",
"let",
"key",
"in",
"type",
")",
"{",
"transformed",
"[",
"key",
"]",
"=",
"transformType",
"(",
"type",
"[",
"key",
"]",
")",
"}",
"return",
"tr... | Transform an object
@param {Object} type
@return {Object} transformed object type
@private | [
"Transform",
"an",
"object"
] | 087d3877e2dff464682b0cf07389c0ad9cfd9b85 | https://github.com/specla/validator/blob/087d3877e2dff464682b0cf07389c0ad9cfd9b85/lib/transformType.js#L46-L54 |
45,437 | specla/validator | lib/transformType.js | findType | function findType (type) {
let name = ''
const defaultTypes = [
'string',
'number',
'boolean',
'symbol',
'array',
'object'
]
try {
name = type.prototype.constructor.name.toLowerCase()
} catch (err) {}
if (defaultTypes.includes(name)) {
return types[name]()
}
return val... | javascript | function findType (type) {
let name = ''
const defaultTypes = [
'string',
'number',
'boolean',
'symbol',
'array',
'object'
]
try {
name = type.prototype.constructor.name.toLowerCase()
} catch (err) {}
if (defaultTypes.includes(name)) {
return types[name]()
}
return val... | [
"function",
"findType",
"(",
"type",
")",
"{",
"let",
"name",
"=",
"''",
"const",
"defaultTypes",
"=",
"[",
"'string'",
",",
"'number'",
",",
"'boolean'",
",",
"'symbol'",
",",
"'array'",
",",
"'object'",
"]",
"try",
"{",
"name",
"=",
"type",
".",
"pro... | Find validator fucntion for a type
@param {Function} type
@return {Function} | [
"Find",
"validator",
"fucntion",
"for",
"a",
"type"
] | 087d3877e2dff464682b0cf07389c0ad9cfd9b85 | https://github.com/specla/validator/blob/087d3877e2dff464682b0cf07389c0ad9cfd9b85/lib/transformType.js#L70-L96 |
45,438 | vid/SenseBase | lib/reset.js | step | function step(err, res) {
if (!err && res && res.error) {
console.log('ERR', res);
err = res.error;
}
var nextStep = steps.shift();
if (err && curStep !== 'delIndex') {
console.log('failing on', curStep, err);
console.trace();
callback(err);
return;
}
if (nextStep) {
curStep = ne... | javascript | function step(err, res) {
if (!err && res && res.error) {
console.log('ERR', res);
err = res.error;
}
var nextStep = steps.shift();
if (err && curStep !== 'delIndex') {
console.log('failing on', curStep, err);
console.trace();
callback(err);
return;
}
if (nextStep) {
curStep = ne... | [
"function",
"step",
"(",
"err",
",",
"res",
")",
"{",
"if",
"(",
"!",
"err",
"&&",
"res",
"&&",
"res",
".",
"error",
")",
"{",
"console",
".",
"log",
"(",
"'ERR'",
",",
"res",
")",
";",
"err",
"=",
"res",
".",
"error",
";",
"}",
"var",
"nextS... | check for an error, if no error do the next step, if no next step callback | [
"check",
"for",
"an",
"error",
"if",
"no",
"error",
"do",
"the",
"next",
"step",
"if",
"no",
"next",
"step",
"callback"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/reset.js#L168-L187 |
45,439 | feedhenry/fh-mbaas-client | lib/config/config.js | addURIParams | function addURIParams(uri, params) {
uri = uri || "";
params = params || {};
params = _.clone(params);
var keys = _.keys(params);
var separatedPath = uri.split("/");
separatedPath = _.compact(separatedPath);
//Replacing Any Path Elements
separatedPath = _.map(separatedPath, function(pathEntry) {
... | javascript | function addURIParams(uri, params) {
uri = uri || "";
params = params || {};
params = _.clone(params);
var keys = _.keys(params);
var separatedPath = uri.split("/");
separatedPath = _.compact(separatedPath);
//Replacing Any Path Elements
separatedPath = _.map(separatedPath, function(pathEntry) {
... | [
"function",
"addURIParams",
"(",
"uri",
",",
"params",
")",
"{",
"uri",
"=",
"uri",
"||",
"\"\"",
";",
"params",
"=",
"params",
"||",
"{",
"}",
";",
"params",
"=",
"_",
".",
"clone",
"(",
"params",
")",
";",
"var",
"keys",
"=",
"_",
".",
"keys",
... | Maps Parameters To Url Parameters.
@param uri
@param params
@returns {*} | [
"Maps",
"Parameters",
"To",
"Url",
"Parameters",
"."
] | 2d5a9cbb32e1b2464d71ffa18513358fea388859 | https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/config/config.js#L11-L57 |
45,440 | jquense/component-metadata-loader | lib/index.js | cleanDoclets | function cleanDoclets(desc) {
var idx = desc.indexOf('@');
return (idx === -1 ? desc : desc.substr(0, idx)).trim();
} | javascript | function cleanDoclets(desc) {
var idx = desc.indexOf('@');
return (idx === -1 ? desc : desc.substr(0, idx)).trim();
} | [
"function",
"cleanDoclets",
"(",
"desc",
")",
"{",
"var",
"idx",
"=",
"desc",
".",
"indexOf",
"(",
"'@'",
")",
";",
"return",
"(",
"idx",
"===",
"-",
"1",
"?",
"desc",
":",
"desc",
".",
"substr",
"(",
"0",
",",
"idx",
")",
")",
".",
"trim",
"("... | removes doclet syntax from comments | [
"removes",
"doclet",
"syntax",
"from",
"comments"
] | 07e38af2e0ad5b444ae091687f0ae4497a0a9c9f | https://github.com/jquense/component-metadata-loader/blob/07e38af2e0ad5b444ae091687f0ae4497a0a9c9f/lib/index.js#L22-L25 |
45,441 | vadr-vr/VR-Analytics-JSCore | js/dataManager/serverRequestManager.js | addDataRequest | function addDataRequest(requestDict){
logger.info('Adding request to server');
const dataRequest = _getServerRequest(requestDict);
_addRequestToDb(dataRequest).then(() => {
if (!requestingPost){
_makeRequestToServer();
}
});
} | javascript | function addDataRequest(requestDict){
logger.info('Adding request to server');
const dataRequest = _getServerRequest(requestDict);
_addRequestToDb(dataRequest).then(() => {
if (!requestingPost){
_makeRequestToServer();
}
});
} | [
"function",
"addDataRequest",
"(",
"requestDict",
")",
"{",
"logger",
".",
"info",
"(",
"'Adding request to server'",
")",
";",
"const",
"dataRequest",
"=",
"_getServerRequest",
"(",
"requestDict",
")",
";",
"_addRequestToDb",
"(",
"dataRequest",
")",
".",
"then",... | Adds request to send data in list of requests
@memberof ServerRequestManager
@param {object} requestDict The dictionary contaning data for the added request | [
"Adds",
"request",
"to",
"send",
"data",
"in",
"list",
"of",
"requests"
] | 7e4a493c824c2c1716360dcb6a3bfecfede5df3b | https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/dataManager/serverRequestManager.js#L24-L40 |
45,442 | ikr/estimate-tasks | lib/calc.js | function (bestCaseHours, mostLikelyCaseHours, worstCaseHours, confidencePercent) {
var isVector = (typeof bestCaseHours === 'object')
this.bestCaseHours = isVector ? bestCaseHours[0] : bestCaseHours
this.mostLikelyCaseHours = isVector ? bestCaseHours[1] : mostLikelyCaseHours
this.worstC... | javascript | function (bestCaseHours, mostLikelyCaseHours, worstCaseHours, confidencePercent) {
var isVector = (typeof bestCaseHours === 'object')
this.bestCaseHours = isVector ? bestCaseHours[0] : bestCaseHours
this.mostLikelyCaseHours = isVector ? bestCaseHours[1] : mostLikelyCaseHours
this.worstC... | [
"function",
"(",
"bestCaseHours",
",",
"mostLikelyCaseHours",
",",
"worstCaseHours",
",",
"confidencePercent",
")",
"{",
"var",
"isVector",
"=",
"(",
"typeof",
"bestCaseHours",
"===",
"'object'",
")",
"this",
".",
"bestCaseHours",
"=",
"isVector",
"?",
"bestCaseHo... | bestCaseHours <= mostLikelyCaseHours <= worstCaseHours
Minimum possible confidencePercent is 10 | [
"bestCaseHours",
"<",
"=",
"mostLikelyCaseHours",
"<",
"=",
"worstCaseHours",
"Minimum",
"possible",
"confidencePercent",
"is",
"10"
] | a5fd271b8a1bc23257694673e42bf8f9dbd2ec40 | https://github.com/ikr/estimate-tasks/blob/a5fd271b8a1bc23257694673e42bf8f9dbd2ec40/lib/calc.js#L19-L26 | |
45,443 | uniphil/xxs | xxs.js | createUpdater | function createUpdater(actionUpdates) {
if (process.env.NODE_ENV !== 'production') {
// Ensure that all values are functions
Object.getOwnPropertySymbols(actionUpdates).concat(Object.keys(actionUpdates))
.filter(k => typeof actionUpdates[k] !== 'function')
.forEach(k => { throw new Error(`Expected... | javascript | function createUpdater(actionUpdates) {
if (process.env.NODE_ENV !== 'production') {
// Ensure that all values are functions
Object.getOwnPropertySymbols(actionUpdates).concat(Object.keys(actionUpdates))
.filter(k => typeof actionUpdates[k] !== 'function')
.forEach(k => { throw new Error(`Expected... | [
"function",
"createUpdater",
"(",
"actionUpdates",
")",
"{",
"if",
"(",
"process",
".",
"env",
".",
"NODE_ENV",
"!==",
"'production'",
")",
"{",
"// Ensure that all values are functions",
"Object",
".",
"getOwnPropertySymbols",
"(",
"actionUpdates",
")",
".",
"conca... | A helper to generate updater functions mapped by action
@param {object} actionUpdates An object with Actions (strings or symbols) as
keys and ((state, payload) => nextState) functions as values
@returns {function} An updater function ((state, action, payload) => nextState) | [
"A",
"helper",
"to",
"generate",
"updater",
"functions",
"mapped",
"by",
"action"
] | 44b559e491f568756c41f6fbdd26420b6393189d | https://github.com/uniphil/xxs/blob/44b559e491f568756c41f6fbdd26420b6393189d/xxs.js#L56-L67 |
45,444 | uniphil/xxs | xxs.js | dispatch | function dispatch(action, payload) {
if (process.env.NODE_ENV !== 'production' && dispatching) {
throw new Error(`'${action.toString()}' was dispatched while '${dispatching.toString()}' was still updating. Updaters should be pure functions and must not dispatch actions.`);
}
try {
dispatching = ... | javascript | function dispatch(action, payload) {
if (process.env.NODE_ENV !== 'production' && dispatching) {
throw new Error(`'${action.toString()}' was dispatched while '${dispatching.toString()}' was still updating. Updaters should be pure functions and must not dispatch actions.`);
}
try {
dispatching = ... | [
"function",
"dispatch",
"(",
"action",
",",
"payload",
")",
"{",
"if",
"(",
"process",
".",
"env",
".",
"NODE_ENV",
"!==",
"'production'",
"&&",
"dispatching",
")",
"{",
"throw",
"new",
"Error",
"(",
"`",
"${",
"action",
".",
"toString",
"(",
")",
"}",... | dummy spec for the node we're attaching to
@param {Symbol|string} action? The action to dispatch (or undefined to force a render)
@param {any} payload? Any data associated with the action
@returns {void} | [
"dummy",
"spec",
"for",
"the",
"node",
"we",
"re",
"attaching",
"to"
] | 44b559e491f568756c41f6fbdd26420b6393189d | https://github.com/uniphil/xxs/blob/44b559e491f568756c41f6fbdd26420b6393189d/xxs.js#L157-L171 |
45,445 | DScheglov/merest | lib/middlewares/transform-response.js | Bundle | function Bundle(transform, req, res) {
this.status = res.__status || 200;
this.body = res.__body || {};
this.apiMethod = res.__apiMethod;
this.apiInstanceMethod = res.__apiInstanceMethod;
this.apiStaticMethod = res.__apiStaticMethod;
this.api = res.__api;
this.modelAPI = res.__modelAPI;
if (this... | javascript | function Bundle(transform, req, res) {
this.status = res.__status || 200;
this.body = res.__body || {};
this.apiMethod = res.__apiMethod;
this.apiInstanceMethod = res.__apiInstanceMethod;
this.apiStaticMethod = res.__apiStaticMethod;
this.api = res.__api;
this.modelAPI = res.__modelAPI;
if (this... | [
"function",
"Bundle",
"(",
"transform",
",",
"req",
",",
"res",
")",
"{",
"this",
".",
"status",
"=",
"res",
".",
"__status",
"||",
"200",
";",
"this",
".",
"body",
"=",
"res",
".",
"__body",
"||",
"{",
"}",
";",
"this",
".",
"apiMethod",
"=",
"r... | Bundle - class to aggregate data to be changed
@param {Function} transform the function transforms `this.status` and `this.body`
@param {Number} status HTTP Response code
@param {Any} body The Body to be changed
@return {Transformer} created transformed option | [
"Bundle",
"-",
"class",
"to",
"aggregate",
"data",
"to",
"be",
"changed"
] | d39e7ef0d56236247773467e9bfe83cb128ebc01 | https://github.com/DScheglov/merest/blob/d39e7ef0d56236247773467e9bfe83cb128ebc01/lib/middlewares/transform-response.js#L14-L26 |
45,446 | DScheglov/merest | lib/middlewares/transform-response.js | transformResponse | function transformResponse(transform) {
assert.ok(transform);
assert.ok(transform instanceof Function);
var originalStatus, originalJson, reqClosure;
return function (req, res, next) {
originalStatus = res.status;
originalJson = res.json;
reqClosure = req;
res.status = setStatus;
... | javascript | function transformResponse(transform) {
assert.ok(transform);
assert.ok(transform instanceof Function);
var originalStatus, originalJson, reqClosure;
return function (req, res, next) {
originalStatus = res.status;
originalJson = res.json;
reqClosure = req;
res.status = setStatus;
... | [
"function",
"transformResponse",
"(",
"transform",
")",
"{",
"assert",
".",
"ok",
"(",
"transform",
")",
";",
"assert",
".",
"ok",
"(",
"transform",
"instanceof",
"Function",
")",
";",
"var",
"originalStatus",
",",
"originalJson",
",",
"reqClosure",
";",
"re... | transformResponse - the factory for middleware that transforms response
@param {Function} transform the function transfomrs `this.status` and `this.body`
@return {Function} express middleware that transfomrs response | [
"transformResponse",
"-",
"the",
"factory",
"for",
"middleware",
"that",
"transforms",
"response"
] | d39e7ef0d56236247773467e9bfe83cb128ebc01 | https://github.com/DScheglov/merest/blob/d39e7ef0d56236247773467e9bfe83cb128ebc01/lib/middlewares/transform-response.js#L34-L62 |
45,447 | yeikos/js.url | url.js | function() {
// Construimos los atributos en base a la localización
var attr = Public.unbuild(this._attributes, this.location);
// Si no se encuentra disponible la instancia localización
if (!(this.location instanceof Public))
// La dirección será externa si tiene definido el atributo `protocol` o ... | javascript | function() {
// Construimos los atributos en base a la localización
var attr = Public.unbuild(this._attributes, this.location);
// Si no se encuentra disponible la instancia localización
if (!(this.location instanceof Public))
// La dirección será externa si tiene definido el atributo `protocol` o ... | [
"function",
"(",
")",
"{",
"// Construimos los atributos en base a la localización",
"var",
"attr",
"=",
"Public",
".",
"unbuild",
"(",
"this",
".",
"_attributes",
",",
"this",
".",
"location",
")",
";",
"// Si no se encuentra disponible la instancia localización",
"if",
... | Comprueba si la URL es externa | [
"Comprueba",
"si",
"la",
"URL",
"es",
"externa"
] | 4015fcb113528c253d5732b86564dfbe965ebdc6 | https://github.com/yeikos/js.url/blob/4015fcb113528c253d5732b86564dfbe965ebdc6/url.js#L231-L249 | |
45,448 | yeikos/js.url | url.js | function() {
var attr = Public.attributes.slice(0),
argv = [].slice.apply(arguments),
buffer = {},
x = argv.length,
y = attr.length;
// Convertimos la matriz de argumentos a objeto
while (x--)
buffer[_toString(argv[x]).toLowerCase()] = 1;
// Si se desea eliminar el atributo `hostnam... | javascript | function() {
var attr = Public.attributes.slice(0),
argv = [].slice.apply(arguments),
buffer = {},
x = argv.length,
y = attr.length;
// Convertimos la matriz de argumentos a objeto
while (x--)
buffer[_toString(argv[x]).toLowerCase()] = 1;
// Si se desea eliminar el atributo `hostnam... | [
"function",
"(",
")",
"{",
"var",
"attr",
"=",
"Public",
".",
"attributes",
".",
"slice",
"(",
"0",
")",
",",
"argv",
"=",
"[",
"]",
".",
"slice",
".",
"apply",
"(",
"arguments",
")",
",",
"buffer",
"=",
"{",
"}",
",",
"x",
"=",
"argv",
".",
... | Construye la URL sin los atributos seleccionados | [
"Construye",
"la",
"URL",
"sin",
"los",
"atributos",
"seleccionados"
] | 4015fcb113528c253d5732b86564dfbe965ebdc6 | https://github.com/yeikos/js.url/blob/4015fcb113528c253d5732b86564dfbe965ebdc6/url.js#L261-L308 | |
45,449 | yeikos/js.url | url.js | _isElement | function _isElement(input) {
return (typeof HTMLElement === 'function') ?
(input instanceof HTMLElement) :
(input && typeof input === 'object' && input.nodeType === 1 && typeof input.nodeName === 'string');
} | javascript | function _isElement(input) {
return (typeof HTMLElement === 'function') ?
(input instanceof HTMLElement) :
(input && typeof input === 'object' && input.nodeType === 1 && typeof input.nodeName === 'string');
} | [
"function",
"_isElement",
"(",
"input",
")",
"{",
"return",
"(",
"typeof",
"HTMLElement",
"===",
"'function'",
")",
"?",
"(",
"input",
"instanceof",
"HTMLElement",
")",
":",
"(",
"input",
"&&",
"typeof",
"input",
"===",
"'object'",
"&&",
"input",
".",
"nod... | Comprueba si el objeto es un elemento HTML | [
"Comprueba",
"si",
"el",
"objeto",
"es",
"un",
"elemento",
"HTML"
] | 4015fcb113528c253d5732b86564dfbe965ebdc6 | https://github.com/yeikos/js.url/blob/4015fcb113528c253d5732b86564dfbe965ebdc6/url.js#L1253-L1261 |
45,450 | jquense/cobble | index.js | cobble | function cobble(){
var args = [], last;
for(var i = 0; i < arguments.length; ++i) {
last = arguments[i];
if( isArray(last) ) args = args.concat(last)
else args[args.length] = last
}
return cobble.into({}, args)
} | javascript | function cobble(){
var args = [], last;
for(var i = 0; i < arguments.length; ++i) {
last = arguments[i];
if( isArray(last) ) args = args.concat(last)
else args[args.length] = last
}
return cobble.into({}, args)
} | [
"function",
"cobble",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
",",
"last",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"++",
"i",
")",
"{",
"last",
"=",
"arguments",
"[",
"i",
"]",
";",
"if",
... | compose objects into a new object, leaving the original objects untouched
@param {...object} an object to be composed.
@return {object} | [
"compose",
"objects",
"into",
"a",
"new",
"object",
"leaving",
"the",
"original",
"objects",
"untouched"
] | 25889b99309cdd6d690fa8efdb6f86e99c41c466 | https://github.com/jquense/cobble/blob/25889b99309cdd6d690fa8efdb6f86e99c41c466/index.js#L12-L22 |
45,451 | lodestarjs/lodestar-ractive | src/main.js | LodeRactive | function LodeRactive( options ) {
if ( typeof Ractive === 'undefined' ) throw Error('Couldn\'t find an instance of Ractive, you need to have it in order to use this framework.');
if ( options && typeof options.DEBUG !== 'undefined') Ractive.DEBUG = options.DEBUG;
this.router = new Router( options );
} | javascript | function LodeRactive( options ) {
if ( typeof Ractive === 'undefined' ) throw Error('Couldn\'t find an instance of Ractive, you need to have it in order to use this framework.');
if ( options && typeof options.DEBUG !== 'undefined') Ractive.DEBUG = options.DEBUG;
this.router = new Router( options );
} | [
"function",
"LodeRactive",
"(",
"options",
")",
"{",
"if",
"(",
"typeof",
"Ractive",
"===",
"'undefined'",
")",
"throw",
"Error",
"(",
"'Couldn\\'t find an instance of Ractive, you need to have it in order to use this framework.'",
")",
";",
"if",
"(",
"options",
"&&",
... | Constructor for the framework. It depends on Ractive as this is a POC
of using the router with Ractive.
@param {Object} options, the configuration options for the framework.
@returns {Void}, nothing returned | [
"Constructor",
"for",
"the",
"framework",
".",
"It",
"depends",
"on",
"Ractive",
"as",
"this",
"is",
"a",
"POC",
"of",
"using",
"the",
"router",
"with",
"Ractive",
"."
] | 58cded8a1b8f0d258f174dd5fcfc0a291d7664e9 | https://github.com/lodestarjs/lodestar-ractive/blob/58cded8a1b8f0d258f174dd5fcfc0a291d7664e9/src/main.js#L10-L18 |
45,452 | socialally/air | lib/air/parent.js | parent | function parent(/*selector*/) {
var arr = [], $ = this.air, slice = this.slice;
this.each(function(el) {
arr = arr.concat(slice.call($(el.parentNode).dom));
});
return $(arr);
} | javascript | function parent(/*selector*/) {
var arr = [], $ = this.air, slice = this.slice;
this.each(function(el) {
arr = arr.concat(slice.call($(el.parentNode).dom));
});
return $(arr);
} | [
"function",
"parent",
"(",
"/*selector*/",
")",
"{",
"var",
"arr",
"=",
"[",
"]",
",",
"$",
"=",
"this",
".",
"air",
",",
"slice",
"=",
"this",
".",
"slice",
";",
"this",
".",
"each",
"(",
"function",
"(",
"el",
")",
"{",
"arr",
"=",
"arr",
"."... | Get the parent of each element in the current set of matched elements,
optionally filtered by a selector.
TODO: implement selector filtering | [
"Get",
"the",
"parent",
"of",
"each",
"element",
"in",
"the",
"current",
"set",
"of",
"matched",
"elements",
"optionally",
"filtered",
"by",
"a",
"selector",
"."
] | a3d94de58aaa4930a425fbcc7266764bf6ca8ca6 | https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/parent.js#L7-L13 |
45,453 | MorganConrad/metalsmith-inspect | inspect.js | inspect | function inspect(options){
options = normalize(options);
return function(files, metalsmith, done) {
if (options.disable)
return done();
//try {
var bigJSObject = {};
if (options.includeMetalsmith) {
bigJSObject[options.includeMetalsmith] = metalsmith... | javascript | function inspect(options){
options = normalize(options);
return function(files, metalsmith, done) {
if (options.disable)
return done();
//try {
var bigJSObject = {};
if (options.includeMetalsmith) {
bigJSObject[options.includeMetalsmith] = metalsmith... | [
"function",
"inspect",
"(",
"options",
")",
"{",
"options",
"=",
"normalize",
"(",
"options",
")",
";",
"return",
"function",
"(",
"files",
",",
"metalsmith",
",",
"done",
")",
"{",
"if",
"(",
"options",
".",
"disable",
")",
"return",
"done",
"(",
")",... | Metalsmith plugin that prints the objects
@param {Object} opts
@return {Function} | [
"Metalsmith",
"plugin",
"that",
"prints",
"the",
"objects"
] | 3e2dc04254fa90862a2589584c95e84b8db66b8b | https://github.com/MorganConrad/metalsmith-inspect/blob/3e2dc04254fa90862a2589584c95e84b8db66b8b/inspect.js#L12-L105 |
45,454 | MorganConrad/metalsmith-inspect | inspect.js | normalize | function normalize(options){
options = options || {};
options.printfn = options.printfn || function(obj) {
console.dir(obj, {colors: true});
};
if (!options.accept) {
if (options.include) {
options.accept = function(propKey) { return options.include.indexOf(propKey) >= 0; ... | javascript | function normalize(options){
options = options || {};
options.printfn = options.printfn || function(obj) {
console.dir(obj, {colors: true});
};
if (!options.accept) {
if (options.include) {
options.accept = function(propKey) { return options.include.indexOf(propKey) >= 0; ... | [
"function",
"normalize",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"options",
".",
"printfn",
"=",
"options",
".",
"printfn",
"||",
"function",
"(",
"obj",
")",
"{",
"console",
".",
"dir",
"(",
"obj",
",",
"{",
"colors... | Normalize an `options` dictionary.
@param {Object} options | [
"Normalize",
"an",
"options",
"dictionary",
"."
] | 3e2dc04254fa90862a2589584c95e84b8db66b8b | https://github.com/MorganConrad/metalsmith-inspect/blob/3e2dc04254fa90862a2589584c95e84b8db66b8b/inspect.js#L61-L83 |
45,455 | haraldrudell/nodegod | lib/rotatedlogger.js | write | function write(s) {
var err
var args = Array.prototype.slice.call(arguments)
var cb = typeof args[args.length - 1] === 'function' ? args.pop() : null
var cbCounter = 1
if (writeToStdoutEnabled) {
cbCounter++
process.stdout.write(s, stdWr)
}
if (writeStream) {
cbCounter++
writeStream.write(s, w... | javascript | function write(s) {
var err
var args = Array.prototype.slice.call(arguments)
var cb = typeof args[args.length - 1] === 'function' ? args.pop() : null
var cbCounter = 1
if (writeToStdoutEnabled) {
cbCounter++
process.stdout.write(s, stdWr)
}
if (writeStream) {
cbCounter++
writeStream.write(s, w... | [
"function",
"write",
"(",
"s",
")",
"{",
"var",
"err",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
"var",
"cb",
"=",
"typeof",
"args",
"[",
"args",
".",
"length",
"-",
"1",
"]",
"===",
"'function... | logging of utf-8 string | [
"logging",
"of",
"utf",
"-",
"8",
"string"
] | 3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21 | https://github.com/haraldrudell/nodegod/blob/3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21/lib/rotatedlogger.js#L76-L117 |
45,456 | iamchairs/snooze | lib/module.js | function(nm, modules, snooze) {
this.snooze = snooze;
if(nm === null || nm === undefined || nm.length < 1) {
throw new Error('Module name note defined.');
}
this.name = nm;
this.snoozeConfig = this.snooze.getConfig();
this.runs = [];
this.configs = [];
this.modules = modules || [];
this.EntityMan... | javascript | function(nm, modules, snooze) {
this.snooze = snooze;
if(nm === null || nm === undefined || nm.length < 1) {
throw new Error('Module name note defined.');
}
this.name = nm;
this.snoozeConfig = this.snooze.getConfig();
this.runs = [];
this.configs = [];
this.modules = modules || [];
this.EntityMan... | [
"function",
"(",
"nm",
",",
"modules",
",",
"snooze",
")",
"{",
"this",
".",
"snooze",
"=",
"snooze",
";",
"if",
"(",
"nm",
"===",
"null",
"||",
"nm",
"===",
"undefined",
"||",
"nm",
".",
"length",
"<",
"1",
")",
"{",
"throw",
"new",
"Error",
"("... | A SnoozeJS Module
@constructor
@param {string} nm - The name of the module
@param {array} modules - Array of module names to inject | [
"A",
"SnoozeJS",
"Module"
] | 6127a6a183562721311bdb03b16c5448b71900ec | https://github.com/iamchairs/snooze/blob/6127a6a183562721311bdb03b16c5448b71900ec/lib/module.js#L15-L41 | |
45,457 | binduwavell/generator-alfresco-common | lib/maven-archetype-file-filtering.js | function (content, properties) {
var lines = content.split(lineEndingRE);
lines = replaceProperties(lines, properties);
lines = replaceSymbols(lines);
return lines.join('\n');
} | javascript | function (content, properties) {
var lines = content.split(lineEndingRE);
lines = replaceProperties(lines, properties);
lines = replaceSymbols(lines);
return lines.join('\n');
} | [
"function",
"(",
"content",
",",
"properties",
")",
"{",
"var",
"lines",
"=",
"content",
".",
"split",
"(",
"lineEndingRE",
")",
";",
"lines",
"=",
"replaceProperties",
"(",
"lines",
",",
"properties",
")",
";",
"lines",
"=",
"replaceSymbols",
"(",
"lines"... | Given some text, we find all references that correlate with provided properties
and replace them with the value assigned to the property.
@param {!string} content
@param {!Object} properties
@returns {!string} | [
"Given",
"some",
"text",
"we",
"find",
"all",
"references",
"that",
"correlate",
"with",
"provided",
"properties",
"and",
"replace",
"them",
"with",
"the",
"value",
"assigned",
"to",
"the",
"property",
"."
] | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/maven-archetype-file-filtering.js#L24-L29 | |
45,458 | binduwavell/generator-alfresco-common | lib/maven-archetype-file-filtering.js | replaceProperties | function replaceProperties (lines, properties) {
var filteredLines = [];
lines.forEach((line) => {
for (var prop in properties) {
line = expandReference(line, prop, properties[prop]);
}
filteredLines.push(line);
});
return filteredLines;
} | javascript | function replaceProperties (lines, properties) {
var filteredLines = [];
lines.forEach((line) => {
for (var prop in properties) {
line = expandReference(line, prop, properties[prop]);
}
filteredLines.push(line);
});
return filteredLines;
} | [
"function",
"replaceProperties",
"(",
"lines",
",",
"properties",
")",
"{",
"var",
"filteredLines",
"=",
"[",
"]",
";",
"lines",
".",
"forEach",
"(",
"(",
"line",
")",
"=>",
"{",
"for",
"(",
"var",
"prop",
"in",
"properties",
")",
"{",
"line",
"=",
"... | Given a list of lines from a file, we go through each line and replace properties that
are provided with the associated value.
NOTE: This does not process properties if they are not in the properties parameter.
@param {!Array<string>} lines are processed one at a time
@param {!Object} properties are replaced
@returns... | [
"Given",
"a",
"list",
"of",
"lines",
"from",
"a",
"file",
"we",
"go",
"through",
"each",
"line",
"and",
"replace",
"properties",
"that",
"are",
"provided",
"with",
"the",
"associated",
"value",
"."
] | d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4 | https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/maven-archetype-file-filtering.js#L66-L75 |
45,459 | pageobjectmodel/pom | src/emitter.js | once | function once(eventName, handler, context, args) {
this.on(eventName, handler, context, args, true);
} | javascript | function once(eventName, handler, context, args) {
this.on(eventName, handler, context, args, true);
} | [
"function",
"once",
"(",
"eventName",
",",
"handler",
",",
"context",
",",
"args",
")",
"{",
"this",
".",
"on",
"(",
"eventName",
",",
"handler",
",",
"context",
",",
"args",
",",
"true",
")",
";",
"}"
] | Adds listener for an event that should be called once
@param {string} eventName
@param {function} handler
@param {object} context
@param {array} args | [
"Adds",
"listener",
"for",
"an",
"event",
"that",
"should",
"be",
"called",
"once"
] | 75c566244e0520c3ca260dda261df3f4a92d8335 | https://github.com/pageobjectmodel/pom/blob/75c566244e0520c3ca260dda261df3f4a92d8335/src/emitter.js#L139-L141 |
45,460 | pageobjectmodel/pom | src/emitter.js | bubbleEvent | function bubbleEvent(eventName, toEmitter) {
this.on(eventName, (event) => {
toEmitter.emit(eventName, event.data, event);
});
} | javascript | function bubbleEvent(eventName, toEmitter) {
this.on(eventName, (event) => {
toEmitter.emit(eventName, event.data, event);
});
} | [
"function",
"bubbleEvent",
"(",
"eventName",
",",
"toEmitter",
")",
"{",
"this",
".",
"on",
"(",
"eventName",
",",
"(",
"event",
")",
"=>",
"{",
"toEmitter",
".",
"emit",
"(",
"eventName",
",",
"event",
".",
"data",
",",
"event",
")",
";",
"}",
")",
... | Bubbles event to other emitter
@param {string} eventName
@param {object} toEmitter | [
"Bubbles",
"event",
"to",
"other",
"emitter"
] | 75c566244e0520c3ca260dda261df3f4a92d8335 | https://github.com/pageobjectmodel/pom/blob/75c566244e0520c3ca260dda261df3f4a92d8335/src/emitter.js#L192-L196 |
45,461 | pageobjectmodel/pom | src/emitter.js | getListeners | function getListeners(eventName, handler, context, args) {
if (!this.__listeners || !this.__listeners[eventName]) {
return null;
}
return this.__listeners[eventName]
.map((config) => {
if (handler !== undefined && config.fn !== handler) {
return false;
... | javascript | function getListeners(eventName, handler, context, args) {
if (!this.__listeners || !this.__listeners[eventName]) {
return null;
}
return this.__listeners[eventName]
.map((config) => {
if (handler !== undefined && config.fn !== handler) {
return false;
... | [
"function",
"getListeners",
"(",
"eventName",
",",
"handler",
",",
"context",
",",
"args",
")",
"{",
"if",
"(",
"!",
"this",
".",
"__listeners",
"||",
"!",
"this",
".",
"__listeners",
"[",
"eventName",
"]",
")",
"{",
"return",
"null",
";",
"}",
"return... | Gets all listeners that match criteria
@param {string} eventName required
@param {function} handler if defined will be used for match
@param {object} context if defined will be used for match
@param {array} args if defined will be used for match
@returns {array<EventConfig>|null} | [
"Gets",
"all",
"listeners",
"that",
"match",
"criteria"
] | 75c566244e0520c3ca260dda261df3f4a92d8335 | https://github.com/pageobjectmodel/pom/blob/75c566244e0520c3ca260dda261df3f4a92d8335/src/emitter.js#L206-L225 |
45,462 | OpenSmartEnvironment/ose | lib/entry/index.js | init | function init(shard, eid) { // {{{2
/**
* Entry constructor
*
* @param shard {Object} Entry owner shard instance
* @param eid {Number|String} Entry id
*
* @method constructor
*/
O.inherited(this)();
this.setMaxListeners(Consts.coreListeners);
this.subjectState = this.SUBJECT_STATE.INIT;
this.shard =... | javascript | function init(shard, eid) { // {{{2
/**
* Entry constructor
*
* @param shard {Object} Entry owner shard instance
* @param eid {Number|String} Entry id
*
* @method constructor
*/
O.inherited(this)();
this.setMaxListeners(Consts.coreListeners);
this.subjectState = this.SUBJECT_STATE.INIT;
this.shard =... | [
"function",
"init",
"(",
"shard",
",",
"eid",
")",
"{",
"// {{{2",
"/**\n * Entry constructor\n *\n * @param shard {Object} Entry owner shard instance\n * @param eid {Number|String} Entry id\n *\n * @method constructor\n */",
"O",
".",
"inherited",
"(",
"this",
")",
"(",
")",
";"... | slaves {{{2
Contains all response sockets of slave entries
@property slaves
@type Object
@internal
Public {{{1 | [
"slaves",
"{{{",
"2",
"Contains",
"all",
"response",
"sockets",
"of",
"slave",
"entries"
] | 2ab051d9db6e77341c40abb9cbdae6ce586917e0 | https://github.com/OpenSmartEnvironment/ose/blob/2ab051d9db6e77341c40abb9cbdae6ce586917e0/lib/entry/index.js#L134-L173 |
45,463 | kaelzhang/node-trait | index.js | function(key) {
if (arguments.length === 0) {
// reset all values, including non-enumerable and readonly properties
this.key_list.forEach(function(key) {
this._reset(key);
}, this);
} else {
this._reset(key);
}
} | javascript | function(key) {
if (arguments.length === 0) {
// reset all values, including non-enumerable and readonly properties
this.key_list.forEach(function(key) {
this._reset(key);
}, this);
} else {
this._reset(key);
}
} | [
"function",
"(",
"key",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"===",
"0",
")",
"{",
"// reset all values, including non-enumerable and readonly properties",
"this",
".",
"key_list",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"this",
".",
... | Reset to default value. Run this method will execute setup methods | [
"Reset",
"to",
"default",
"value",
".",
"Run",
"this",
"method",
"will",
"execute",
"setup",
"methods"
] | cd78e902baedbd16728518ba5be2fbcc48ca564f | https://github.com/kaelzhang/node-trait/blob/cd78e902baedbd16728518ba5be2fbcc48ca564f/index.js#L106-L116 | |
45,464 | kaelzhang/node-trait | index.js | function(key) {
var attr = this.__attrs[key];
if (!attr) {
return;
}
var value = attr.value = attr._origin;
var setup = attr.type.setup;
if (setup) {
setup.call(this.host, value, key, this);
}
} | javascript | function(key) {
var attr = this.__attrs[key];
if (!attr) {
return;
}
var value = attr.value = attr._origin;
var setup = attr.type.setup;
if (setup) {
setup.call(this.host, value, key, this);
}
} | [
"function",
"(",
"key",
")",
"{",
"var",
"attr",
"=",
"this",
".",
"__attrs",
"[",
"key",
"]",
";",
"if",
"(",
"!",
"attr",
")",
"{",
"return",
";",
"}",
"var",
"value",
"=",
"attr",
".",
"value",
"=",
"attr",
".",
"_origin",
";",
"var",
"setup... | Force to unsetting a value by key, use this method carefully. | [
"Force",
"to",
"unsetting",
"a",
"value",
"by",
"key",
"use",
"this",
"method",
"carefully",
"."
] | cd78e902baedbd16728518ba5be2fbcc48ca564f | https://github.com/kaelzhang/node-trait/blob/cd78e902baedbd16728518ba5be2fbcc48ca564f/index.js#L120-L133 | |
45,465 | jldec/pub-generator | helpers.js | resolve | function resolve(ref, context) {
if (typeof ref !== 'string') return ref;
if (/^#/.test(ref)) { ref = (context._href || '/') + ref; }
return generator.fragment$[ref];
} | javascript | function resolve(ref, context) {
if (typeof ref !== 'string') return ref;
if (/^#/.test(ref)) { ref = (context._href || '/') + ref; }
return generator.fragment$[ref];
} | [
"function",
"resolve",
"(",
"ref",
",",
"context",
")",
"{",
"if",
"(",
"typeof",
"ref",
"!==",
"'string'",
")",
"return",
"ref",
";",
"if",
"(",
"/",
"^#",
"/",
".",
"test",
"(",
"ref",
")",
")",
"{",
"ref",
"=",
"(",
"context",
".",
"_href",
... | resolve references to fragments directly or via href string | [
"resolve",
"references",
"to",
"fragments",
"directly",
"or",
"via",
"href",
"string"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/helpers.js#L236-L240 |
45,466 | jldec/pub-generator | helpers.js | pageLang | function pageLang(page) {
return page.lang ||
opts.lang ||
(opts.langDirs && !u.isRootLevel(page._href) && u.topLevel(page._href)) ||
'en';
} | javascript | function pageLang(page) {
return page.lang ||
opts.lang ||
(opts.langDirs && !u.isRootLevel(page._href) && u.topLevel(page._href)) ||
'en';
} | [
"function",
"pageLang",
"(",
"page",
")",
"{",
"return",
"page",
".",
"lang",
"||",
"opts",
".",
"lang",
"||",
"(",
"opts",
".",
"langDirs",
"&&",
"!",
"u",
".",
"isRootLevel",
"(",
"page",
".",
"_href",
")",
"&&",
"u",
".",
"topLevel",
"(",
"page"... | determine language string for a page | [
"determine",
"language",
"string",
"for",
"a",
"page"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/helpers.js#L243-L248 |
45,467 | jldec/pub-generator | helpers.js | defaultFragmentHtml | function defaultFragmentHtml(fragmentName, faMarkdown, html, frame) {
var f = generator.fragment$[fragmentName];
if (f) return fragmentHtml(f);
if (faMarkdown && u.find(opts.pkgs, function(pkg) {
return ('pub-pkg-font-awesome' === pkg.pkgName);
})) {
return fragmentHtml( { _txt:faMarkdown,... | javascript | function defaultFragmentHtml(fragmentName, faMarkdown, html, frame) {
var f = generator.fragment$[fragmentName];
if (f) return fragmentHtml(f);
if (faMarkdown && u.find(opts.pkgs, function(pkg) {
return ('pub-pkg-font-awesome' === pkg.pkgName);
})) {
return fragmentHtml( { _txt:faMarkdown,... | [
"function",
"defaultFragmentHtml",
"(",
"fragmentName",
",",
"faMarkdown",
",",
"html",
",",
"frame",
")",
"{",
"var",
"f",
"=",
"generator",
".",
"fragment$",
"[",
"fragmentName",
"]",
";",
"if",
"(",
"f",
")",
"return",
"fragmentHtml",
"(",
"f",
")",
"... | try user-provided fragment, then faMarkdown with font-awesome, then html treat 3rd parameter as markdown if it doesn't contain < | [
"try",
"user",
"-",
"provided",
"fragment",
"then",
"faMarkdown",
"with",
"font",
"-",
"awesome",
"then",
"html",
"treat",
"3rd",
"parameter",
"as",
"markdown",
"if",
"it",
"doesn",
"t",
"contain",
"<"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/helpers.js#L404-L416 |
45,468 | socialally/air | lib/air/create.js | el | function el(tag, attrs) {
var n = el.air(create(tag));
if(attrs && n.attr) {
return n.attr(attrs);
}
return n;
} | javascript | function el(tag, attrs) {
var n = el.air(create(tag));
if(attrs && n.attr) {
return n.attr(attrs);
}
return n;
} | [
"function",
"el",
"(",
"tag",
",",
"attrs",
")",
"{",
"var",
"n",
"=",
"el",
".",
"air",
"(",
"create",
"(",
"tag",
")",
")",
";",
"if",
"(",
"attrs",
"&&",
"n",
".",
"attr",
")",
"{",
"return",
"n",
".",
"attr",
"(",
"attrs",
")",
";",
"}"... | Create a wrapped DOM element.
@param tag The element tag name.
@param attrs Object map of element attributes. | [
"Create",
"a",
"wrapped",
"DOM",
"element",
"."
] | a3d94de58aaa4930a425fbcc7266764bf6ca8ca6 | https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/create.js#L25-L31 |
45,469 | DynoSRC/dynosrc | lib/git.js | Repo | function Repo(name, username) {
this.name = name;
this.username = username;
this.isLoaded = Deferred();
this.isCloned = Deferred();
this.isClonning = false;
this.branch = null;
} | javascript | function Repo(name, username) {
this.name = name;
this.username = username;
this.isLoaded = Deferred();
this.isCloned = Deferred();
this.isClonning = false;
this.branch = null;
} | [
"function",
"Repo",
"(",
"name",
",",
"username",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"username",
"=",
"username",
";",
"this",
".",
"isLoaded",
"=",
"Deferred",
"(",
")",
";",
"this",
".",
"isCloned",
"=",
"Deferred",
"(",
... | Not used, but kinda cool. If we do need this we will swap the git shell aspect out for a stable js-git though under the good | [
"Not",
"used",
"but",
"kinda",
"cool",
".",
"If",
"we",
"do",
"need",
"this",
"we",
"will",
"swap",
"the",
"git",
"shell",
"aspect",
"out",
"for",
"a",
"stable",
"js",
"-",
"git",
"though",
"under",
"the",
"good"
] | 1a763c9310b719a51b0df56387970ecd3f08c438 | https://github.com/DynoSRC/dynosrc/blob/1a763c9310b719a51b0df56387970ecd3f08c438/lib/git.js#L82-L89 |
45,470 | jaredhanson/antenna | lib/route.js | Route | function Route(topic, fns, options) {
options = options || {};
this.topic = topic;
this.fns = fns;
this.regexp = pattern.parse(topic
, this.keys = []
, options.sensitive
, options.strict);
} | javascript | function Route(topic, fns, options) {
options = options || {};
this.topic = topic;
this.fns = fns;
this.regexp = pattern.parse(topic
, this.keys = []
, options.sensitive
, options.strict);
} | [
"function",
"Route",
"(",
"topic",
",",
"fns",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"topic",
"=",
"topic",
";",
"this",
".",
"fns",
"=",
"fns",
";",
"this",
".",
"regexp",
"=",
"pattern",
".",
"pa... | `Route` constructor.
@api protected | [
"Route",
"constructor",
"."
] | fecfa8320a29d0f1cf22df0230f3b65a12316087 | https://github.com/jaredhanson/antenna/blob/fecfa8320a29d0f1cf22df0230f3b65a12316087/lib/route.js#L12-L20 |
45,471 | henrytseng/angular-state-router | src/services/url-manager.js | function() {
var current = $state.current();
if(current && current.url) {
var path;
path = current.url;
// Add parameters or use default parameters
var params = current.params || {};
var query = {};
for(var name in params) {
var re = new RegExp(':'+name, 'g');
... | javascript | function() {
var current = $state.current();
if(current && current.url) {
var path;
path = current.url;
// Add parameters or use default parameters
var params = current.params || {};
var query = {};
for(var name in params) {
var re = new RegExp(':'+name, 'g');
... | [
"function",
"(",
")",
"{",
"var",
"current",
"=",
"$state",
".",
"current",
"(",
")",
";",
"if",
"(",
"current",
"&&",
"current",
".",
"url",
")",
"{",
"var",
"path",
";",
"path",
"=",
"current",
".",
"url",
";",
"// Add parameters or use default paramet... | Update URL based on state | [
"Update",
"URL",
"based",
"on",
"state"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/services/url-manager.js#L14-L38 | |
45,472 | keybase/node-bitcoin | lib/lib.js | function (str) {
for (var bytes = [], i = 0; i < str.length; i++)
bytes.push(str.charCodeAt(i) & 0xFF);
return bytes;
} | javascript | function (str) {
for (var bytes = [], i = 0; i < str.length; i++)
bytes.push(str.charCodeAt(i) & 0xFF);
return bytes;
} | [
"function",
"(",
"str",
")",
"{",
"for",
"(",
"var",
"bytes",
"=",
"[",
"]",
",",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
";",
"i",
"++",
")",
"bytes",
".",
"push",
"(",
"str",
".",
"charCodeAt",
"(",
"i",
")",
"&",
"0xFF",
")",... | Convert a string to a byte array | [
"Convert",
"a",
"string",
"to",
"a",
"byte",
"array"
] | 44d9e7279f48be95e3e7bb61110a4d76e71a977a | https://github.com/keybase/node-bitcoin/blob/44d9e7279f48be95e3e7bb61110a4d76e71a977a/lib/lib.js#L1455-L1459 | |
45,473 | keybase/node-bitcoin | lib/lib.js | function (bytes) {
for (var str = [], i = 0; i < bytes.length; i++)
str.push(String.fromCharCode(bytes[i]));
return str.join("");
} | javascript | function (bytes) {
for (var str = [], i = 0; i < bytes.length; i++)
str.push(String.fromCharCode(bytes[i]));
return str.join("");
} | [
"function",
"(",
"bytes",
")",
"{",
"for",
"(",
"var",
"str",
"=",
"[",
"]",
",",
"i",
"=",
"0",
";",
"i",
"<",
"bytes",
".",
"length",
";",
"i",
"++",
")",
"str",
".",
"push",
"(",
"String",
".",
"fromCharCode",
"(",
"bytes",
"[",
"i",
"]",
... | Convert a byte array to a string | [
"Convert",
"a",
"byte",
"array",
"to",
"a",
"string"
] | 44d9e7279f48be95e3e7bb61110a4d76e71a977a | https://github.com/keybase/node-bitcoin/blob/44d9e7279f48be95e3e7bb61110a4d76e71a977a/lib/lib.js#L1462-L1466 | |
45,474 | keybase/node-bitcoin | lib/lib.js | function () {
// p = 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1
var p = ec.fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F");
var a = BigInteger.ZERO;
var b = ec.fromHex("7");
var n = ec.fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141");
var h = ... | javascript | function () {
// p = 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1
var p = ec.fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F");
var a = BigInteger.ZERO;
var b = ec.fromHex("7");
var n = ec.fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141");
var h = ... | [
"function",
"(",
")",
"{",
"// p = 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1",
"var",
"p",
"=",
"ec",
".",
"fromHex",
"(",
"\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F\"",
")",
";",
"var",
"a",
"=",
"BigInteger",
".",
"ZERO",
";",
"var",
"b",... | used by Bitcoin | [
"used",
"by",
"Bitcoin"
] | 44d9e7279f48be95e3e7bb61110a4d76e71a977a | https://github.com/keybase/node-bitcoin/blob/44d9e7279f48be95e3e7bb61110a4d76e71a977a/lib/lib.js#L2391-L2403 | |
45,475 | keybase/node-bitcoin | lib/lib.js | function (input) {
var bi = BigInteger.fromByteArrayUnsigned(input);
var chars = [];
while (bi.compareTo(B58.base) >= 0) {
var mod = bi.mod(B58.base);
chars.unshift(B58.alphabet[mod.intValue()]);
bi = bi.subtract(mod).divide(B58.base);
}
chars.unshift(B58.alphabet[bi.intValue()]);
// Con... | javascript | function (input) {
var bi = BigInteger.fromByteArrayUnsigned(input);
var chars = [];
while (bi.compareTo(B58.base) >= 0) {
var mod = bi.mod(B58.base);
chars.unshift(B58.alphabet[mod.intValue()]);
bi = bi.subtract(mod).divide(B58.base);
}
chars.unshift(B58.alphabet[bi.intValue()]);
// Con... | [
"function",
"(",
"input",
")",
"{",
"var",
"bi",
"=",
"BigInteger",
".",
"fromByteArrayUnsigned",
"(",
"input",
")",
";",
"var",
"chars",
"=",
"[",
"]",
";",
"while",
"(",
"bi",
".",
"compareTo",
"(",
"B58",
".",
"base",
")",
">=",
"0",
")",
"{",
... | Convert a byte array to a base58-encoded string.
Written by Mike Hearn for BitcoinJ.
Copyright (c) 2011 Google Inc.
Ported to JavaScript by Stefan Thomas. | [
"Convert",
"a",
"byte",
"array",
"to",
"a",
"base58",
"-",
"encoded",
"string",
"."
] | 44d9e7279f48be95e3e7bb61110a4d76e71a977a | https://github.com/keybase/node-bitcoin/blob/44d9e7279f48be95e3e7bb61110a4d76e71a977a/lib/lib.js#L2486-L2505 | |
45,476 | keybase/node-bitcoin | lib/lib.js | function (len, val) {
var array = [];
var i = 0;
while (i < len) {
array[i++] = val;
}
return array;
} | javascript | function (len, val) {
var array = [];
var i = 0;
while (i < len) {
array[i++] = val;
}
return array;
} | [
"function",
"(",
"len",
",",
"val",
")",
"{",
"var",
"array",
"=",
"[",
"]",
";",
"var",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"len",
")",
"{",
"array",
"[",
"i",
"++",
"]",
"=",
"val",
";",
"}",
"return",
"array",
";",
"}"
] | Create an array of a certain length filled with a specific value. | [
"Create",
"an",
"array",
"of",
"a",
"certain",
"length",
"filled",
"with",
"a",
"specific",
"value",
"."
] | 44d9e7279f48be95e3e7bb61110a4d76e71a977a | https://github.com/keybase/node-bitcoin/blob/44d9e7279f48be95e3e7bb61110a4d76e71a977a/lib/lib.js#L2815-L2822 | |
45,477 | keybase/node-bitcoin | lib/lib.js | function (i) {
if (i < 0xfd) {
// unsigned char
return [i];
} else if (i <= 1 << 16) {
// unsigned short (LE)
return [0xfd, i >>> 8, i & 255];
} else if (i <= 1 << 32) {
// unsigned int (LE)
return [0xfe].concat(Crypto.util.wordsToBytes([i]));
} else {
// unsigned long long (LE)
... | javascript | function (i) {
if (i < 0xfd) {
// unsigned char
return [i];
} else if (i <= 1 << 16) {
// unsigned short (LE)
return [0xfd, i >>> 8, i & 255];
} else if (i <= 1 << 32) {
// unsigned int (LE)
return [0xfe].concat(Crypto.util.wordsToBytes([i]));
} else {
// unsigned long long (LE)
... | [
"function",
"(",
"i",
")",
"{",
"if",
"(",
"i",
"<",
"0xfd",
")",
"{",
"// unsigned char",
"return",
"[",
"i",
"]",
";",
"}",
"else",
"if",
"(",
"i",
"<=",
"1",
"<<",
"16",
")",
"{",
"// unsigned short (LE)",
"return",
"[",
"0xfd",
",",
"i",
">>>... | Turn an integer into a "var_int".
"var_int" is a variable length integer used by Bitcoin's binary format.
Returns a byte array. | [
"Turn",
"an",
"integer",
"into",
"a",
"var_int",
"."
] | 44d9e7279f48be95e3e7bb61110a4d76e71a977a | https://github.com/keybase/node-bitcoin/blob/44d9e7279f48be95e3e7bb61110a4d76e71a977a/lib/lib.js#L2830-L2844 | |
45,478 | keybase/node-bitcoin | lib/lib.js | function (valueBuffer) {
var value = this.valueToBigInt(valueBuffer).toString();
var integerPart = value.length > 8 ? value.substr(0, value.length - 8) : '0';
var decimalPart = value.length > 8 ? value.substr(value.length - 8) : value;
while (decimalPart.length < 8) decimalPart = "0" + decimalPart;
decim... | javascript | function (valueBuffer) {
var value = this.valueToBigInt(valueBuffer).toString();
var integerPart = value.length > 8 ? value.substr(0, value.length - 8) : '0';
var decimalPart = value.length > 8 ? value.substr(value.length - 8) : value;
while (decimalPart.length < 8) decimalPart = "0" + decimalPart;
decim... | [
"function",
"(",
"valueBuffer",
")",
"{",
"var",
"value",
"=",
"this",
".",
"valueToBigInt",
"(",
"valueBuffer",
")",
".",
"toString",
"(",
")",
";",
"var",
"integerPart",
"=",
"value",
".",
"length",
">",
"8",
"?",
"value",
".",
"substr",
"(",
"0",
... | Format a Bitcoin value as a string.
Takes a BigInteger or byte-array and returns that amount of Bitcoins in a
nice standard formatting.
Examples:
12.3555
0.1234
900.99998888
34.00 | [
"Format",
"a",
"Bitcoin",
"value",
"as",
"a",
"string",
"."
] | 44d9e7279f48be95e3e7bb61110a4d76e71a977a | https://github.com/keybase/node-bitcoin/blob/44d9e7279f48be95e3e7bb61110a4d76e71a977a/lib/lib.js#L2866-L2874 | |
45,479 | keybase/node-bitcoin | lib/lib.js | function (valueString) {
// TODO: Detect other number formats (e.g. comma as decimal separator)
var valueComp = valueString.split('.');
var integralPart = valueComp[0];
var fractionalPart = valueComp[1] || "0";
while (fractionalPart.length < 8) fractionalPart += "0";
fractionalPart = fractionalPart.re... | javascript | function (valueString) {
// TODO: Detect other number formats (e.g. comma as decimal separator)
var valueComp = valueString.split('.');
var integralPart = valueComp[0];
var fractionalPart = valueComp[1] || "0";
while (fractionalPart.length < 8) fractionalPart += "0";
fractionalPart = fractionalPart.re... | [
"function",
"(",
"valueString",
")",
"{",
"// TODO: Detect other number formats (e.g. comma as decimal separator)",
"var",
"valueComp",
"=",
"valueString",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"integralPart",
"=",
"valueComp",
"[",
"0",
"]",
";",
"var",
"fract... | Parse a floating point string as a Bitcoin value.
Keep in mind that parsing user input is messy. You should always display
the parsed value back to the user to make sure we understood his input
correctly. | [
"Parse",
"a",
"floating",
"point",
"string",
"as",
"a",
"Bitcoin",
"value",
"."
] | 44d9e7279f48be95e3e7bb61110a4d76e71a977a | https://github.com/keybase/node-bitcoin/blob/44d9e7279f48be95e3e7bb61110a4d76e71a977a/lib/lib.js#L2882-L2893 | |
45,480 | nyurik/mw-graph-shared | src/VegaWrapper.js | removeColon | function removeColon(protocol) {
return protocol && protocol.length && protocol[protocol.length - 1] === ':'
? protocol.substring(0, protocol.length - 1) : protocol;
} | javascript | function removeColon(protocol) {
return protocol && protocol.length && protocol[protocol.length - 1] === ':'
? protocol.substring(0, protocol.length - 1) : protocol;
} | [
"function",
"removeColon",
"(",
"protocol",
")",
"{",
"return",
"protocol",
"&&",
"protocol",
".",
"length",
"&&",
"protocol",
"[",
"protocol",
".",
"length",
"-",
"1",
"]",
"===",
"':'",
"?",
"protocol",
".",
"substring",
"(",
"0",
",",
"protocol",
".",... | Utility function to remove trailing colon from a protocol
@param {string} protocol
@return {string} | [
"Utility",
"function",
"to",
"remove",
"trailing",
"colon",
"from",
"a",
"protocol"
] | 0e1dd7356de18a0631680f4dd7231a3a2746093d | https://github.com/nyurik/mw-graph-shared/blob/0e1dd7356de18a0631680f4dd7231a3a2746093d/src/VegaWrapper.js#L15-L18 |
45,481 | nyurik/mw-graph-shared | src/VegaWrapper.js | VegaWrapper | function VegaWrapper(wrapperOpts) {
var self = this;
// Copy all options into this object
self.objExtender = wrapperOpts.datalib.extend;
self.objExtender(self, wrapperOpts);
self.validators = {};
self.datalib.load.loader = function (opt, callback) {
var error = callback || function (e) ... | javascript | function VegaWrapper(wrapperOpts) {
var self = this;
// Copy all options into this object
self.objExtender = wrapperOpts.datalib.extend;
self.objExtender(self, wrapperOpts);
self.validators = {};
self.datalib.load.loader = function (opt, callback) {
var error = callback || function (e) ... | [
"function",
"VegaWrapper",
"(",
"wrapperOpts",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Copy all options into this object",
"self",
".",
"objExtender",
"=",
"wrapperOpts",
".",
"datalib",
".",
"extend",
";",
"self",
".",
"objExtender",
"(",
"self",
",",
... | Shared library to wrap around vega code
@param {Object} wrapperOpts Configuration options
@param {Object} wrapperOpts.datalib Vega's datalib object
@param {Object} wrapperOpts.datalib.load Vega's data loader
@param {Function} wrapperOpts.datalib.load.loader Vega's data loader function
@param {Function} wrapperOpts.data... | [
"Shared",
"library",
"to",
"wrap",
"around",
"vega",
"code"
] | 0e1dd7356de18a0631680f4dd7231a3a2746093d | https://github.com/nyurik/mw-graph-shared/blob/0e1dd7356de18a0631680f4dd7231a3a2746093d/src/VegaWrapper.js#L37-L75 |
45,482 | theboyWhoCriedWoolf/transition-manager | src/core/transitionViewManager.js | _prepareViews | function _prepareViews( actionData, paramData )
{
let linkedTranssModules = actionData.linkedVTransModules, // look into slice speed over creating new array
ViewsModuleLength = linkedTranssModules.length,
promises = [],
preparedViews = [],
actionDataClone = null,
viewCache = {},
i ... | javascript | function _prepareViews( actionData, paramData )
{
let linkedTranssModules = actionData.linkedVTransModules, // look into slice speed over creating new array
ViewsModuleLength = linkedTranssModules.length,
promises = [],
preparedViews = [],
actionDataClone = null,
viewCache = {},
i ... | [
"function",
"_prepareViews",
"(",
"actionData",
",",
"paramData",
")",
"{",
"let",
"linkedTranssModules",
"=",
"actionData",
".",
"linkedVTransModules",
",",
"// look into slice speed over creating new array",
"ViewsModuleLength",
"=",
"linkedTranssModules",
".",
"length",
... | loop through all transition modules and prepare the
views requested by the config
@param {object} actionData containing all transition types and views required
@param {object} paramData sent with the action
@return {object} promises array and pepared views array | [
"loop",
"through",
"all",
"transition",
"modules",
"and",
"prepare",
"the",
"views",
"requested",
"by",
"the",
"config"
] | a20fda0bb07c0098bf709ea03770b1ee2a855655 | https://github.com/theboyWhoCriedWoolf/transition-manager/blob/a20fda0bb07c0098bf709ea03770b1ee2a855655/src/core/transitionViewManager.js#L35-L56 |
45,483 | theboyWhoCriedWoolf/transition-manager | src/core/transitionViewManager.js | _fetchViews | function _fetchViews( viewsToPrepare, actionDataClone, promises, viewCache )
{
const views = viewsToPrepare,
viewManager = _options.viewManager,
length = views.length,
currentViewID = actionDataClone.currentViewID,
nextViewID = actionDataClone.nextViewID;
let i = 0,
_deferred,
view... | javascript | function _fetchViews( viewsToPrepare, actionDataClone, promises, viewCache )
{
const views = viewsToPrepare,
viewManager = _options.viewManager,
length = views.length,
currentViewID = actionDataClone.currentViewID,
nextViewID = actionDataClone.nextViewID;
let i = 0,
_deferred,
view... | [
"function",
"_fetchViews",
"(",
"viewsToPrepare",
",",
"actionDataClone",
",",
"promises",
",",
"viewCache",
")",
"{",
"const",
"views",
"=",
"viewsToPrepare",
",",
"viewManager",
"=",
"_options",
".",
"viewManager",
",",
"length",
"=",
"views",
".",
"length",
... | loop through and fetch all the requested views, use viewReady
and collect a promise for each to allow the view to build up and perform
its preperation tasks if required
@param {array} views - string references
@param {object} actionDataClone - cloned data as to not override config
@param {array} promises - collect ... | [
"loop",
"through",
"and",
"fetch",
"all",
"the",
"requested",
"views",
"use",
"viewReady",
"and",
"collect",
"a",
"promise",
"for",
"each",
"to",
"allow",
"the",
"view",
"to",
"build",
"up",
"and",
"perform",
"its",
"preperation",
"tasks",
"if",
"required"
] | a20fda0bb07c0098bf709ea03770b1ee2a855655 | https://github.com/theboyWhoCriedWoolf/transition-manager/blob/a20fda0bb07c0098bf709ea03770b1ee2a855655/src/core/transitionViewManager.js#L69-L117 |
45,484 | theboyWhoCriedWoolf/transition-manager | src/core/transitionViewManager.js | _viewRef | function _viewRef( ref, comparisonViews ) {
var index = comparisonViews.indexOf( ref );
return (index === -1 )? null : ['currentView', 'nextView'][ index ];
} | javascript | function _viewRef( ref, comparisonViews ) {
var index = comparisonViews.indexOf( ref );
return (index === -1 )? null : ['currentView', 'nextView'][ index ];
} | [
"function",
"_viewRef",
"(",
"ref",
",",
"comparisonViews",
")",
"{",
"var",
"index",
"=",
"comparisonViews",
".",
"indexOf",
"(",
"ref",
")",
";",
"return",
"(",
"index",
"===",
"-",
"1",
")",
"?",
"null",
":",
"[",
"'currentView'",
",",
"'nextView'",
... | convert view named references to either current view
or next view if the ID's match
Makes it easier to access and build generic use cases
@param {string} ref current View ID
@param {array} comparisonViews - currentView and nextView string IDS
@return {string} - new IDS if matched | [
"convert",
"view",
"named",
"references",
"to",
"either",
"current",
"view",
"or",
"next",
"view",
"if",
"the",
"ID",
"s",
"match",
"Makes",
"it",
"easier",
"to",
"access",
"and",
"build",
"generic",
"use",
"cases"
] | a20fda0bb07c0098bf709ea03770b1ee2a855655 | https://github.com/theboyWhoCriedWoolf/transition-manager/blob/a20fda0bb07c0098bf709ea03770b1ee2a855655/src/core/transitionViewManager.js#L128-L131 |
45,485 | theboyWhoCriedWoolf/transition-manager | src/core/transitionViewManager.js | _getCached | function _getCached( cached, data )
{
if( !data ){ return cached; }
let i = -1, len = cached.length;
while (++i < len) {
cached[i].data = data;
}
return cached;
} | javascript | function _getCached( cached, data )
{
if( !data ){ return cached; }
let i = -1, len = cached.length;
while (++i < len) {
cached[i].data = data;
}
return cached;
} | [
"function",
"_getCached",
"(",
"cached",
",",
"data",
")",
"{",
"if",
"(",
"!",
"data",
")",
"{",
"return",
"cached",
";",
"}",
"let",
"i",
"=",
"-",
"1",
",",
"len",
"=",
"cached",
".",
"length",
";",
"while",
"(",
"++",
"i",
"<",
"len",
")",
... | return cached views based on action type
@param {array} cached - previously prepared views
@param {object} data - action data passed through with action
@return {array} - cached views | [
"return",
"cached",
"views",
"based",
"on",
"action",
"type"
] | a20fda0bb07c0098bf709ea03770b1ee2a855655 | https://github.com/theboyWhoCriedWoolf/transition-manager/blob/a20fda0bb07c0098bf709ea03770b1ee2a855655/src/core/transitionViewManager.js#L140-L149 |
45,486 | theboyWhoCriedWoolf/transition-manager | src/core/transitionViewManager.js | _cloneViewState | function _cloneViewState( actionData, transitionObject, paramData ) {
return {
data : paramData,
currentViewID : actionData.currentView, // optional
nextViewID : actionData.nextView, // optional
views : {},
transitionType : transitionObject.transitionType
};
} | javascript | function _cloneViewState( actionData, transitionObject, paramData ) {
return {
data : paramData,
currentViewID : actionData.currentView, // optional
nextViewID : actionData.nextView, // optional
views : {},
transitionType : transitionObject.transitionType
};
} | [
"function",
"_cloneViewState",
"(",
"actionData",
",",
"transitionObject",
",",
"paramData",
")",
"{",
"return",
"{",
"data",
":",
"paramData",
",",
"currentViewID",
":",
"actionData",
".",
"currentView",
",",
"// optional",
"nextViewID",
":",
"actionData",
".",
... | clone the action data object
fast clone and prevents the config references to be
oweriden by instances or other settings
@param {object} actionData passed in from the config
@param {object} transitionObject - action data transition
@param {object} paramData sent with the action
@return {object} new object with an in... | [
"clone",
"the",
"action",
"data",
"object",
"fast",
"clone",
"and",
"prevents",
"the",
"config",
"references",
"to",
"be",
"oweriden",
"by",
"instances",
"or",
"other",
"settings"
] | a20fda0bb07c0098bf709ea03770b1ee2a855655 | https://github.com/theboyWhoCriedWoolf/transition-manager/blob/a20fda0bb07c0098bf709ea03770b1ee2a855655/src/core/transitionViewManager.js#L160-L168 |
45,487 | shamoons/linguist-samples | samples/JavaScript/http.js | parserOnHeaders | function parserOnHeaders(headers, url) {
// Once we exceeded headers limit - stop collecting them
if (this.maxHeaderPairs <= 0 ||
this._headers.length < this.maxHeaderPairs) {
this._headers = this._headers.concat(headers);
}
this._url += url;
} | javascript | function parserOnHeaders(headers, url) {
// Once we exceeded headers limit - stop collecting them
if (this.maxHeaderPairs <= 0 ||
this._headers.length < this.maxHeaderPairs) {
this._headers = this._headers.concat(headers);
}
this._url += url;
} | [
"function",
"parserOnHeaders",
"(",
"headers",
",",
"url",
")",
"{",
"// Once we exceeded headers limit - stop collecting them",
"if",
"(",
"this",
".",
"maxHeaderPairs",
"<=",
"0",
"||",
"this",
".",
"_headers",
".",
"length",
"<",
"this",
".",
"maxHeaderPairs",
... | Only called in the slow case where slow means that the request headers were either fragmented across multiple TCP packets or too large to be processed in a single run. This method is also called to process trailing HTTP headers. | [
"Only",
"called",
"in",
"the",
"slow",
"case",
"where",
"slow",
"means",
"that",
"the",
"request",
"headers",
"were",
"either",
"fragmented",
"across",
"multiple",
"TCP",
"packets",
"or",
"too",
"large",
"to",
"be",
"processed",
"in",
"a",
"single",
"run",
... | 71c5ec1a535f7dde31f9e407679475f57fae0c08 | https://github.com/shamoons/linguist-samples/blob/71c5ec1a535f7dde31f9e407679475f57fae0c08/samples/JavaScript/http.js#L45-L52 |
45,488 | zipscene/winston-daily-rotate | index.js | throwIf | function throwIf (target /*, illegal... */) {
Array.prototype.slice.call(arguments, 1).forEach(function (name) {
if (options[name]) {
throw new Error('Cannot set ' + name + ' and ' + target + 'together');
}
});
} | javascript | function throwIf (target /*, illegal... */) {
Array.prototype.slice.call(arguments, 1).forEach(function (name) {
if (options[name]) {
throw new Error('Cannot set ' + name + ' and ' + target + 'together');
}
});
} | [
"function",
"throwIf",
"(",
"target",
"/*, illegal... */",
")",
"{",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
".",
"forEach",
"(",
"function",
"(",
"name",
")",
"{",
"if",
"(",
"options",
"[",
"name",
"]",
... | Helper function which throws an `Error` in the event that any of the rest of the arguments is present in `options`. | [
"Helper",
"function",
"which",
"throws",
"an",
"Error",
"in",
"the",
"event",
"that",
"any",
"of",
"the",
"rest",
"of",
"the",
"arguments",
"is",
"present",
"in",
"options",
"."
] | 63a708572475b766061cb950e9dd1f98b20ea772 | https://github.com/zipscene/winston-daily-rotate/blob/63a708572475b766061cb950e9dd1f98b20ea772/index.js#L35-L41 |
45,489 | mesmotronic/conbo | examples/Template.js | function()
{
this.appendView
(
new ns.MyLoadedView(this.context.addTo({templateUrl:'template-2.html'})),
new ns.MyOtherView(this.context.addTo({template:'This is an internal template using <b>options.template</b> that hates <span cb-style="favoriteColor:color">{{favoriteColor}}</span>'}))
);
... | javascript | function()
{
this.appendView
(
new ns.MyLoadedView(this.context.addTo({templateUrl:'template-2.html'})),
new ns.MyOtherView(this.context.addTo({template:'This is an internal template using <b>options.template</b> that hates <span cb-style="favoriteColor:color">{{favoriteColor}}</span>'}))
);
... | [
"function",
"(",
")",
"{",
"this",
".",
"appendView",
"(",
"new",
"ns",
".",
"MyLoadedView",
"(",
"this",
".",
"context",
".",
"addTo",
"(",
"{",
"templateUrl",
":",
"'template-2.html'",
"}",
")",
")",
",",
"new",
"ns",
".",
"MyOtherView",
"(",
"this",... | All classes have an initialize entry point | [
"All",
"classes",
"have",
"an",
"initialize",
"entry",
"point"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/examples/Template.js#L50-L57 | |
45,490 | Stitchuuuu/thread-promisify | thread.js | Log | function Log() {
var args = CopyArguments(arguments);
var level = args.shift();
args.unshift("[Thread] <"+threadId+">");
args.unshift(level);
process.send({name: "thread-log", args: SerializeForProcess(args)});
} | javascript | function Log() {
var args = CopyArguments(arguments);
var level = args.shift();
args.unshift("[Thread] <"+threadId+">");
args.unshift(level);
process.send({name: "thread-log", args: SerializeForProcess(args)});
} | [
"function",
"Log",
"(",
")",
"{",
"var",
"args",
"=",
"CopyArguments",
"(",
"arguments",
")",
";",
"var",
"level",
"=",
"args",
".",
"shift",
"(",
")",
";",
"args",
".",
"unshift",
"(",
"\"[Thread] <\"",
"+",
"threadId",
"+",
"\">\"",
")",
";",
"args... | Log an information | [
"Log",
"an",
"information"
] | 5c6fc0b481520049e2078461693ceee7c27ddd53 | https://github.com/Stitchuuuu/thread-promisify/blob/5c6fc0b481520049e2078461693ceee7c27ddd53/thread.js#L14-L20 |
45,491 | Stitchuuuu/thread-promisify | thread.js | ConvertArgs | function ConvertArgs(args, baseResponse) {
var baseResponse = Object.assign({}, baseResponse);
args.forEach(function(arg, i) {
if (typeof(arg) == "object" && arg._classname == "SerializedFunction") {
var idRemoteFunction = arg.id;
args[i] = function() {
process.se... | javascript | function ConvertArgs(args, baseResponse) {
var baseResponse = Object.assign({}, baseResponse);
args.forEach(function(arg, i) {
if (typeof(arg) == "object" && arg._classname == "SerializedFunction") {
var idRemoteFunction = arg.id;
args[i] = function() {
process.se... | [
"function",
"ConvertArgs",
"(",
"args",
",",
"baseResponse",
")",
"{",
"var",
"baseResponse",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"baseResponse",
")",
";",
"args",
".",
"forEach",
"(",
"function",
"(",
"arg",
",",
"i",
")",
"{",
"if",
"... | Convert SerializedFunction objects to function, so when called
we execute the function in the original thread | [
"Convert",
"SerializedFunction",
"objects",
"to",
"function",
"so",
"when",
"called",
"we",
"execute",
"the",
"function",
"in",
"the",
"original",
"thread"
] | 5c6fc0b481520049e2078461693ceee7c27ddd53 | https://github.com/Stitchuuuu/thread-promisify/blob/5c6fc0b481520049e2078461693ceee7c27ddd53/thread.js#L26-L37 |
45,492 | Stitchuuuu/thread-promisify | thread.js | finalizeRequestDone | function finalizeRequestDone() {
if (PendingRequests.length) {
// If we have queued requests, we execute the next one
currentRequest = PendingRequests.shift();
Log(3, "Executing request", currentRequest.id);
executeRequest(currentRequest);
} else {
// We set a timeout in ... | javascript | function finalizeRequestDone() {
if (PendingRequests.length) {
// If we have queued requests, we execute the next one
currentRequest = PendingRequests.shift();
Log(3, "Executing request", currentRequest.id);
executeRequest(currentRequest);
} else {
// We set a timeout in ... | [
"function",
"finalizeRequestDone",
"(",
")",
"{",
"if",
"(",
"PendingRequests",
".",
"length",
")",
"{",
"// If we have queued requests, we execute the next one",
"currentRequest",
"=",
"PendingRequests",
".",
"shift",
"(",
")",
";",
"Log",
"(",
"3",
",",
"\"Executi... | Finalize a request when it is done | [
"Finalize",
"a",
"request",
"when",
"it",
"is",
"done"
] | 5c6fc0b481520049e2078461693ceee7c27ddd53 | https://github.com/Stitchuuuu/thread-promisify/blob/5c6fc0b481520049e2078461693ceee7c27ddd53/thread.js#L42-L60 |
45,493 | CrocInc/grunt-croc-requirejs | rjs/xcss.js | _includeCSSInternal | function _includeCSSInternal (css) {
var head,
style = document.getElementById(_stylesheetTagID);
if (!style) {
// there's no our styles tag - create
style = document.createElement('style');
style.setAttribute('id', _stylesheetTagID);
style.setAttribute('type', 'text/css');
head = document.getEle... | javascript | function _includeCSSInternal (css) {
var head,
style = document.getElementById(_stylesheetTagID);
if (!style) {
// there's no our styles tag - create
style = document.createElement('style');
style.setAttribute('id', _stylesheetTagID);
style.setAttribute('type', 'text/css');
head = document.getEle... | [
"function",
"_includeCSSInternal",
"(",
"css",
")",
"{",
"var",
"head",
",",
"style",
"=",
"document",
".",
"getElementById",
"(",
"_stylesheetTagID",
")",
";",
"if",
"(",
"!",
"style",
")",
"{",
"// there's no our styles tag - create",
"style",
"=",
"document",... | Add css code into STYLE tag in HEAD. It tries to use the single STYLE tag with special ID "xcss_styles"
@param css - style | [
"Add",
"css",
"code",
"into",
"STYLE",
"tag",
"in",
"HEAD",
".",
"It",
"tries",
"to",
"use",
"the",
"single",
"STYLE",
"tag",
"with",
"special",
"ID",
"xcss_styles"
] | bc07f1b096a6484b472a72830dcacc65ca64b407 | https://github.com/CrocInc/grunt-croc-requirejs/blob/bc07f1b096a6484b472a72830dcacc65ca64b407/rjs/xcss.js#L64-L82 |
45,494 | CrocInc/grunt-croc-requirejs | rjs/xcss.js | function (css, name) {
if (typeof css === "function") { css = css(); }
if (!css) { return; }
if (!name) {
_includeCSSInternal(css);
} else if (!_stylesheetFiles[name]) {
_includeCSSInternal(css);
_stylesheetFiles[name] = true;
}
} | javascript | function (css, name) {
if (typeof css === "function") { css = css(); }
if (!css) { return; }
if (!name) {
_includeCSSInternal(css);
} else if (!_stylesheetFiles[name]) {
_includeCSSInternal(css);
_stylesheetFiles[name] = true;
}
} | [
"function",
"(",
"css",
",",
"name",
")",
"{",
"if",
"(",
"typeof",
"css",
"===",
"\"function\"",
")",
"{",
"css",
"=",
"css",
"(",
")",
";",
"}",
"if",
"(",
"!",
"css",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"name",
")",
"{",
"_includ... | Append style element with css param's content
@param {String|Function} css Content for style element or a function which returns it
@param {String} name Name of the stylesheet to prevent duplication. | [
"Append",
"style",
"element",
"with",
"css",
"param",
"s",
"content"
] | bc07f1b096a6484b472a72830dcacc65ca64b407 | https://github.com/CrocInc/grunt-croc-requirejs/blob/bc07f1b096a6484b472a72830dcacc65ca64b407/rjs/xcss.js#L100-L109 | |
45,495 | svipas/cachimo | src/cachimo.js | clear | function clear() {
timeouts.forEach((callback, timeout) => {
clearTimeout(timeout);
// reject Promise or execute callback which returns Error
callback();
});
const length = size();
cache.clear();
return length;
} | javascript | function clear() {
timeouts.forEach((callback, timeout) => {
clearTimeout(timeout);
// reject Promise or execute callback which returns Error
callback();
});
const length = size();
cache.clear();
return length;
} | [
"function",
"clear",
"(",
")",
"{",
"timeouts",
".",
"forEach",
"(",
"(",
"callback",
",",
"timeout",
")",
"=>",
"{",
"clearTimeout",
"(",
"timeout",
")",
";",
"// reject Promise or execute callback which returns Error",
"callback",
"(",
")",
";",
"}",
")",
";... | Removes all elements stored in cache and clears all timeouts.
@returns {number} how much elements was removed from cache | [
"Removes",
"all",
"elements",
"stored",
"in",
"cache",
"and",
"clears",
"all",
"timeouts",
"."
] | c6e53dfff29e4dcb67979c71992887ab1c51b5df | https://github.com/svipas/cachimo/blob/c6e53dfff29e4dcb67979c71992887ab1c51b5df/src/cachimo.js#L78-L89 |
45,496 | svipas/cachimo | src/cachimo.js | put | function put(key, value, timeout, callback) {
// key type is incorrect
if (typeof key !== 'string' && typeof key !== 'number' && typeof key !== 'boolean') {
throw new TypeError(`key can be only: string | number | boolean instead of ${typeof key}`);
}
// check if key is not NaN
if (typeof key === 'number' ... | javascript | function put(key, value, timeout, callback) {
// key type is incorrect
if (typeof key !== 'string' && typeof key !== 'number' && typeof key !== 'boolean') {
throw new TypeError(`key can be only: string | number | boolean instead of ${typeof key}`);
}
// check if key is not NaN
if (typeof key === 'number' ... | [
"function",
"put",
"(",
"key",
",",
"value",
",",
"timeout",
",",
"callback",
")",
"{",
"// key type is incorrect",
"if",
"(",
"typeof",
"key",
"!==",
"'string'",
"&&",
"typeof",
"key",
"!==",
"'number'",
"&&",
"typeof",
"key",
"!==",
"'boolean'",
")",
"{"... | Stores an element in-memory with specified key and value.
If only `key` and `value` is provided it returns boolean.
true: if element was stored and key doesn't exist.
false: if key does exist.
If additionally only `timeout` is provided it returns Promise.
Element will be deleted after given `timeout` and Promise will... | [
"Stores",
"an",
"element",
"in",
"-",
"memory",
"with",
"specified",
"key",
"and",
"value",
"."
] | c6e53dfff29e4dcb67979c71992887ab1c51b5df | https://github.com/svipas/cachimo/blob/c6e53dfff29e4dcb67979c71992887ab1c51b5df/src/cachimo.js#L111-L165 |
45,497 | synder/xpress | demo/commander/index.js | Option | function Option(flags, description) {
this.flags = flags;
this.required = ~flags.indexOf('<');
this.optional = ~flags.indexOf('[');
this.bool = !~flags.indexOf('-no-');
flags = flags.split(/[ ,|]+/);
if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
this.long = flags.shift();
... | javascript | function Option(flags, description) {
this.flags = flags;
this.required = ~flags.indexOf('<');
this.optional = ~flags.indexOf('[');
this.bool = !~flags.indexOf('-no-');
flags = flags.split(/[ ,|]+/);
if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
this.long = flags.shift();
... | [
"function",
"Option",
"(",
"flags",
",",
"description",
")",
"{",
"this",
".",
"flags",
"=",
"flags",
";",
"this",
".",
"required",
"=",
"~",
"flags",
".",
"indexOf",
"(",
"'<'",
")",
";",
"this",
".",
"optional",
"=",
"~",
"flags",
".",
"indexOf",
... | Initialize a new `Option` with the given `flags` and `description`.
@param {String} flags
@param {String} description
@api public | [
"Initialize",
"a",
"new",
"Option",
"with",
"the",
"given",
"flags",
"and",
"description",
"."
] | 4b1e89208b6f34cd78ce90b8a858592115b6ccb5 | https://github.com/synder/xpress/blob/4b1e89208b6f34cd78ce90b8a858592115b6ccb5/demo/commander/index.js#L38-L47 |
45,498 | henrytseng/angular-state-view | src/services/view-manager.js | function() {
// Reset views
var resetPromised = {};
angular.forEach(_activeSet, function(view, id) {
resetPromised[id] = $q.when(view.reset());
});
// Empty active set
_activeSet = {};
return $q.all(resetPromised);
} | javascript | function() {
// Reset views
var resetPromised = {};
angular.forEach(_activeSet, function(view, id) {
resetPromised[id] = $q.when(view.reset());
});
// Empty active set
_activeSet = {};
return $q.all(resetPromised);
} | [
"function",
"(",
")",
"{",
"// Reset views",
"var",
"resetPromised",
"=",
"{",
"}",
";",
"angular",
".",
"forEach",
"(",
"_activeSet",
",",
"function",
"(",
"view",
",",
"id",
")",
"{",
"resetPromised",
"[",
"id",
"]",
"=",
"$q",
".",
"when",
"(",
"v... | Reset active views
@return {Promise} A promise fulfilled when currently active views are reset | [
"Reset",
"active",
"views"
] | cf27c3a5cf65289501957e4dce3b75e7abef4def | https://github.com/henrytseng/angular-state-view/blob/cf27c3a5cf65289501957e4dce3b75e7abef4def/src/services/view-manager.js#L20-L31 | |
45,499 | henrytseng/angular-state-view | src/services/view-manager.js | function(id, view, data, controller) {
return _getTemplate(data).then(function(template) {
// Controller
if(controller) {
var current = $state.current();
return view.render(template, controller, current.locals);
// Template only
} else {
return view.render(template)... | javascript | function(id, view, data, controller) {
return _getTemplate(data).then(function(template) {
// Controller
if(controller) {
var current = $state.current();
return view.render(template, controller, current.locals);
// Template only
} else {
return view.render(template)... | [
"function",
"(",
"id",
",",
"view",
",",
"data",
",",
"controller",
")",
"{",
"return",
"_getTemplate",
"(",
"data",
")",
".",
"then",
"(",
"function",
"(",
"template",
")",
"{",
"// Controller",
"if",
"(",
"controller",
")",
"{",
"var",
"current",
"="... | Render a view
@param {String} id Unique identifier for view
@param {View} view A view instance
@param {Mixed} data Template data, String src to include or Function invocation
@return {Promise} A promise fulfilled when currently active view is rendered | [
"Render",
"a",
"view"
] | cf27c3a5cf65289501957e4dce3b75e7abef4def | https://github.com/henrytseng/angular-state-view/blob/cf27c3a5cf65289501957e4dce3b75e7abef4def/src/services/view-manager.js#L52-L65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.