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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
16,200 | Breeze/breeze.js | build/breeze.debug.js | mergeEntity | function mergeEntity(mc, node, meta) {
node._$meta = meta;
var em = mc.entityManager;
var entityType = meta.entityType;
if (typeof (entityType) === 'string') {
entityType = mc.metadataStore._getEntityType(entityType, false);
}
node.entityType = entityType;
var mergeStrategy = mc.merg... | javascript | function mergeEntity(mc, node, meta) {
node._$meta = meta;
var em = mc.entityManager;
var entityType = meta.entityType;
if (typeof (entityType) === 'string') {
entityType = mc.metadataStore._getEntityType(entityType, false);
}
node.entityType = entityType;
var mergeStrategy = mc.merg... | [
"function",
"mergeEntity",
"(",
"mc",
",",
"node",
",",
"meta",
")",
"{",
"node",
".",
"_$meta",
"=",
"meta",
";",
"var",
"em",
"=",
"mc",
".",
"entityManager",
";",
"var",
"entityType",
"=",
"meta",
".",
"entityType",
";",
"if",
"(",
"typeof",
"(",
... | can return null for a deleted entity if includeDeleted == false | [
"can",
"return",
"null",
"for",
"a",
"deleted",
"entity",
"if",
"includeDeleted",
"==",
"false"
] | 06b4919202bd20388847ce7d0cf57b6011cca158 | https://github.com/Breeze/breeze.js/blob/06b4919202bd20388847ce7d0cf57b6011cca158/build/breeze.debug.js#L15655-L15719 |
16,201 | Breeze/breeze.js | build/breeze.debug.js | DefaultChangeRequestInterceptor | function DefaultChangeRequestInterceptor(saveContext, saveBundle) {
/**
Prepare and return the save data for an entity change-set.
The adapter calls this method for each entity in the change-set,
after it has prepared a "change request" for that object.
The method can do anything to the reques... | javascript | function DefaultChangeRequestInterceptor(saveContext, saveBundle) {
/**
Prepare and return the save data for an entity change-set.
The adapter calls this method for each entity in the change-set,
after it has prepared a "change request" for that object.
The method can do anything to the reques... | [
"function",
"DefaultChangeRequestInterceptor",
"(",
"saveContext",
",",
"saveBundle",
")",
"{",
"/**\n Prepare and return the save data for an entity change-set.\n\n The adapter calls this method for each entity in the change-set,\n after it has prepared a \"change request\" for that obj... | This is a default, no-op implementation that developers can replace. | [
"This",
"is",
"a",
"default",
"no",
"-",
"op",
"implementation",
"that",
"developers",
"can",
"replace",
"."
] | 06b4919202bd20388847ce7d0cf57b6011cca158 | https://github.com/Breeze/breeze.js/blob/06b4919202bd20388847ce7d0cf57b6011cca158/build/breeze.debug.js#L16155-L16200 |
16,202 | Breeze/breeze.js | build/breeze.debug.js | toQueryString | function toQueryString(obj) {
var parts = [];
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
parts.push(encodeURIComponent(i) + "=" + encodeURIComponent(obj[i]));
}
}
return parts.join("&");
} | javascript | function toQueryString(obj) {
var parts = [];
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
parts.push(encodeURIComponent(i) + "=" + encodeURIComponent(obj[i]));
}
}
return parts.join("&");
} | [
"function",
"toQueryString",
"(",
"obj",
")",
"{",
"var",
"parts",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"hasOwnProperty",
"(",
"i",
")",
")",
"{",
"parts",
".",
"push",
"(",
"encodeURIComponent",... | crude serializer. Doesn't recurse | [
"crude",
"serializer",
".",
"Doesn",
"t",
"recurse"
] | 06b4919202bd20388847ce7d0cf57b6011cca158 | https://github.com/Breeze/breeze.js/blob/06b4919202bd20388847ce7d0cf57b6011cca158/build/breeze.debug.js#L16722-L16730 |
16,203 | Breeze/breeze.js | build/breeze.debug.js | movePropDefsToProto | function movePropDefsToProto(proto) {
var stype = proto.entityType || proto.complexType;
var extra = stype._extra;
var alreadyWrapped = extra.alreadyWrappedProps || {};
stype.getProperties().forEach(function (prop) {
var propName = prop.name;
// we only want to wrap props that haven't alre... | javascript | function movePropDefsToProto(proto) {
var stype = proto.entityType || proto.complexType;
var extra = stype._extra;
var alreadyWrapped = extra.alreadyWrappedProps || {};
stype.getProperties().forEach(function (prop) {
var propName = prop.name;
// we only want to wrap props that haven't alre... | [
"function",
"movePropDefsToProto",
"(",
"proto",
")",
"{",
"var",
"stype",
"=",
"proto",
".",
"entityType",
"||",
"proto",
".",
"complexType",
";",
"var",
"extra",
"=",
"stype",
".",
"_extra",
";",
"var",
"alreadyWrapped",
"=",
"extra",
".",
"alreadyWrappedP... | private methods This method is called during Metadata initialization to correctly "wrap" properties. | [
"private",
"methods",
"This",
"method",
"is",
"called",
"during",
"Metadata",
"initialization",
"to",
"correctly",
"wrap",
"properties",
"."
] | 06b4919202bd20388847ce7d0cf57b6011cca158 | https://github.com/Breeze/breeze.js/blob/06b4919202bd20388847ce7d0cf57b6011cca158/build/breeze.debug.js#L17355-L17381 |
16,204 | Breeze/breeze.js | build/breeze.debug.js | movePropsToBackingStore | function movePropsToBackingStore(instance) {
var bs = getBackingStore(instance);
var proto = Object.getPrototypeOf(instance);
var stype = proto.entityType || proto.complexType;
stype.getProperties().forEach(function (prop) {
var propName = prop.name;
if (prop.isUnmapped) {
// insure... | javascript | function movePropsToBackingStore(instance) {
var bs = getBackingStore(instance);
var proto = Object.getPrototypeOf(instance);
var stype = proto.entityType || proto.complexType;
stype.getProperties().forEach(function (prop) {
var propName = prop.name;
if (prop.isUnmapped) {
// insure... | [
"function",
"movePropsToBackingStore",
"(",
"instance",
")",
"{",
"var",
"bs",
"=",
"getBackingStore",
"(",
"instance",
")",
";",
"var",
"proto",
"=",
"Object",
".",
"getPrototypeOf",
"(",
"instance",
")",
";",
"var",
"stype",
"=",
"proto",
".",
"entityType"... | This method is called when an instance is first created via materialization or createEntity. this method cannot be called while a 'defineProperty' accessor is executing because of IE bug mentioned above. | [
"This",
"method",
"is",
"called",
"when",
"an",
"instance",
"is",
"first",
"created",
"via",
"materialization",
"or",
"createEntity",
".",
"this",
"method",
"cannot",
"be",
"called",
"while",
"a",
"defineProperty",
"accessor",
"is",
"executing",
"because",
"of",... | 06b4919202bd20388847ce7d0cf57b6011cca158 | https://github.com/Breeze/breeze.js/blob/06b4919202bd20388847ce7d0cf57b6011cca158/build/breeze.debug.js#L17387-L17409 |
16,205 | Breeze/breeze.js | build/breeze.debug.js | getPendingBackingStore | function getPendingBackingStore(instance) {
var proto = Object.getPrototypeOf(instance);
var pendingStores = proto._pendingBackingStores;
var pending = core.arrayFirst(pendingStores, function (pending) {
return pending.entity === instance;
});
if (pending) return pending.backingStore;
var ... | javascript | function getPendingBackingStore(instance) {
var proto = Object.getPrototypeOf(instance);
var pendingStores = proto._pendingBackingStores;
var pending = core.arrayFirst(pendingStores, function (pending) {
return pending.entity === instance;
});
if (pending) return pending.backingStore;
var ... | [
"function",
"getPendingBackingStore",
"(",
"instance",
")",
"{",
"var",
"proto",
"=",
"Object",
".",
"getPrototypeOf",
"(",
"instance",
")",
";",
"var",
"pendingStores",
"=",
"proto",
".",
"_pendingBackingStores",
";",
"var",
"pending",
"=",
"core",
".",
"arra... | workaround for IE9 bug where instance properties cannot be changed when executing a property 'set' method. | [
"workaround",
"for",
"IE9",
"bug",
"where",
"instance",
"properties",
"cannot",
"be",
"changed",
"when",
"executing",
"a",
"property",
"set",
"method",
"."
] | 06b4919202bd20388847ce7d0cf57b6011cca158 | https://github.com/Breeze/breeze.js/blob/06b4919202bd20388847ce7d0cf57b6011cca158/build/breeze.debug.js#L17512-L17522 |
16,206 | youzan/vant-icons | build/build-iconfont.js | font | function font() {
return src([`${svgDir}/*.svg`])
.pipe(
iconfontCss({
fontName: config.name,
path: template,
targetPath: '../src/index.less',
normalize: true,
firstGlyph: 0xf000,
cssClass: fontName // this is a trick to pass fontName to template
})
... | javascript | function font() {
return src([`${svgDir}/*.svg`])
.pipe(
iconfontCss({
fontName: config.name,
path: template,
targetPath: '../src/index.less',
normalize: true,
firstGlyph: 0xf000,
cssClass: fontName // this is a trick to pass fontName to template
})
... | [
"function",
"font",
"(",
")",
"{",
"return",
"src",
"(",
"[",
"`",
"${",
"svgDir",
"}",
"`",
"]",
")",
".",
"pipe",
"(",
"iconfontCss",
"(",
"{",
"fontName",
":",
"config",
".",
"name",
",",
"path",
":",
"template",
",",
"targetPath",
":",
"'../src... | generate font from svg && build index.less | [
"generate",
"font",
"from",
"svg",
"&&",
"build",
"index",
".",
"less"
] | 862774a99a8cfdfb8e70d7da59507dd93af4c38e | https://github.com/youzan/vant-icons/blob/862774a99a8cfdfb8e70d7da59507dd93af4c38e/build/build-iconfont.js#L32-L51 |
16,207 | iMicknl/cordova-plugin-openalpr | www/OpenALPR.js | function(imageData, options, success, error) {
exec(
success,
error,
'OpenALPR',
'scan',
[imageData, validateOptions(options)]
)
} | javascript | function(imageData, options, success, error) {
exec(
success,
error,
'OpenALPR',
'scan',
[imageData, validateOptions(options)]
)
} | [
"function",
"(",
"imageData",
",",
"options",
",",
"success",
",",
"error",
")",
"{",
"exec",
"(",
"success",
",",
"error",
",",
"'OpenALPR'",
",",
"'scan'",
",",
"[",
"imageData",
",",
"validateOptions",
"(",
"options",
")",
"]",
")",
"}"
] | Scan license plate with OpenALPR
@param imageData {string} Base64 encoding of the image data or the image file URI
@param options {object} Options to pass to the OpenALPR scanner
@param success callback function on success
@param error callback function on failure.
@returns {array} licenseplate matches | [
"Scan",
"license",
"plate",
"with",
"OpenALPR"
] | 530066e9c36e2e73c22ee2b0eb962817700a60e4 | https://github.com/iMicknl/cordova-plugin-openalpr/blob/530066e9c36e2e73c22ee2b0eb962817700a60e4/www/OpenALPR.js#L19-L27 | |
16,208 | iMicknl/cordova-plugin-openalpr | www/OpenALPR.js | validateOptions | function validateOptions(options) {
//Check if options is set and is an object.
if(! options || ! typeof options === 'object') {
return {
country: DEFAULT_COUNTRY,
amount: DEFAULT_AMOUNT
}
}
//Check if country property is set.
if (! options.hasOwnProperty('country')) {
options.country = DEFAULT_COUNTR... | javascript | function validateOptions(options) {
//Check if options is set and is an object.
if(! options || ! typeof options === 'object') {
return {
country: DEFAULT_COUNTRY,
amount: DEFAULT_AMOUNT
}
}
//Check if country property is set.
if (! options.hasOwnProperty('country')) {
options.country = DEFAULT_COUNTR... | [
"function",
"validateOptions",
"(",
"options",
")",
"{",
"//Check if options is set and is an object.",
"if",
"(",
"!",
"options",
"||",
"!",
"typeof",
"options",
"===",
"'object'",
")",
"{",
"return",
"{",
"country",
":",
"DEFAULT_COUNTRY",
",",
"amount",
":",
... | Function to validate and when neccessary correct the options object.
@param {*} options
@return {*} options | [
"Function",
"to",
"validate",
"and",
"when",
"neccessary",
"correct",
"the",
"options",
"object",
"."
] | 530066e9c36e2e73c22ee2b0eb962817700a60e4 | https://github.com/iMicknl/cordova-plugin-openalpr/blob/530066e9c36e2e73c22ee2b0eb962817700a60e4/www/OpenALPR.js#L36-L56 |
16,209 | Ivshti/linvodb3 | lib/document.js | deserialize | function deserialize (rawData) {
return JSON.parse(rawData, function (k, v) {
if (k === '$$date') { return new Date(v); }
if (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || v === null) { return v; }
if (v && v.$$date) { return v.$$date; }
if (v && v.$$regex) { return deser... | javascript | function deserialize (rawData) {
return JSON.parse(rawData, function (k, v) {
if (k === '$$date') { return new Date(v); }
if (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || v === null) { return v; }
if (v && v.$$date) { return v.$$date; }
if (v && v.$$regex) { return deser... | [
"function",
"deserialize",
"(",
"rawData",
")",
"{",
"return",
"JSON",
".",
"parse",
"(",
"rawData",
",",
"function",
"(",
"k",
",",
"v",
")",
"{",
"if",
"(",
"k",
"===",
"'$$date'",
")",
"{",
"return",
"new",
"Date",
"(",
"v",
")",
";",
"}",
"if... | From a one-line representation of an object generate by the serialize function
Return the object itself | [
"From",
"a",
"one",
"-",
"line",
"representation",
"of",
"an",
"object",
"generate",
"by",
"the",
"serialize",
"function",
"Return",
"the",
"object",
"itself"
] | 6952de376e4761167cb0f9c29342d16d675874bf | https://github.com/Ivshti/linvodb3/blob/6952de376e4761167cb0f9c29342d16d675874bf/lib/document.js#L94-L103 |
16,210 | Ivshti/linvodb3 | lib/document.js | compoundCompareThings | function compoundCompareThings (fields) {
return function (a, b) {
var i, len, comparison;
// undefined
if (a === undefined) { return b === undefined ? 0 : -1; }
if (b === undefined) { return a === undefined ? 0 : 1; }
// null
if (a === null) { return b === null ? 0 : -1; }
if (b === nul... | javascript | function compoundCompareThings (fields) {
return function (a, b) {
var i, len, comparison;
// undefined
if (a === undefined) { return b === undefined ? 0 : -1; }
if (b === undefined) { return a === undefined ? 0 : 1; }
// null
if (a === null) { return b === null ? 0 : -1; }
if (b === nul... | [
"function",
"compoundCompareThings",
"(",
"fields",
")",
"{",
"return",
"function",
"(",
"a",
",",
"b",
")",
"{",
"var",
"i",
",",
"len",
",",
"comparison",
";",
"// undefined",
"if",
"(",
"a",
"===",
"undefined",
")",
"{",
"return",
"b",
"===",
"undef... | Used primarily in compound indexes. Returns a comparison function usable as
an Index's compareKeys function. | [
"Used",
"primarily",
"in",
"compound",
"indexes",
".",
"Returns",
"a",
"comparison",
"function",
"usable",
"as",
"an",
"Index",
"s",
"compareKeys",
"function",
"."
] | 6952de376e4761167cb0f9c29342d16d675874bf | https://github.com/Ivshti/linvodb3/blob/6952de376e4761167cb0f9c29342d16d675874bf/lib/document.js#L192-L211 |
16,211 | Ivshti/linvodb3 | lib/document.js | modify | function modify (obj, updateQuery) {
var keys = Object.keys(updateQuery)
, firstChars = _.map(keys, function (item) { return item[0]; })
, dollarFirstChars = _.filter(firstChars, function (c) { return c === '$'; })
, newDoc, modifiers
;
if ((keys.indexOf('_id') !== -1) && (updateQuery._id !== obj._... | javascript | function modify (obj, updateQuery) {
var keys = Object.keys(updateQuery)
, firstChars = _.map(keys, function (item) { return item[0]; })
, dollarFirstChars = _.filter(firstChars, function (c) { return c === '$'; })
, newDoc, modifiers
;
if ((keys.indexOf('_id') !== -1) && (updateQuery._id !== obj._... | [
"function",
"modify",
"(",
"obj",
",",
"updateQuery",
")",
"{",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"updateQuery",
")",
",",
"firstChars",
"=",
"_",
".",
"map",
"(",
"keys",
",",
"function",
"(",
"item",
")",
"{",
"return",
"item",
"[",
... | Modify a DB object according to an update query | [
"Modify",
"a",
"DB",
"object",
"according",
"to",
"an",
"update",
"query"
] | 6952de376e4761167cb0f9c29342d16d675874bf | https://github.com/Ivshti/linvodb3/blob/6952de376e4761167cb0f9c29342d16d675874bf/lib/document.js#L422-L465 |
16,212 | Ivshti/linvodb3 | lib/document.js | match | function match (obj, query) {
var queryKeys, queryKey, queryValue, i;
// Primitive query against a primitive type
// This is a bit of a hack since we construct an object with an arbitrary key only to dereference it later
// But I don't have time for a cleaner implementation now
if (isPrimitiveType(obj) || is... | javascript | function match (obj, query) {
var queryKeys, queryKey, queryValue, i;
// Primitive query against a primitive type
// This is a bit of a hack since we construct an object with an arbitrary key only to dereference it later
// But I don't have time for a cleaner implementation now
if (isPrimitiveType(obj) || is... | [
"function",
"match",
"(",
"obj",
",",
"query",
")",
"{",
"var",
"queryKeys",
",",
"queryKey",
",",
"queryValue",
",",
"i",
";",
"// Primitive query against a primitive type",
"// This is a bit of a hack since we construct an object with an arbitrary key only to dereference it lat... | Tell if a given document matches a query
@param {Object} obj Document to check
@param {Object} query | [
"Tell",
"if",
"a",
"given",
"document",
"matches",
"a",
"query"
] | 6952de376e4761167cb0f9c29342d16d675874bf | https://github.com/Ivshti/linvodb3/blob/6952de376e4761167cb0f9c29342d16d675874bf/lib/document.js#L678-L703 |
16,213 | Ivshti/linvodb3 | lib/indexes.js | projectForUnique | function projectForUnique (elt) {
if (elt === null) { return '$null'; }
if (typeof elt === 'string') { return '$string' + elt; }
if (typeof elt === 'boolean') { return '$boolean' + elt; }
if (typeof elt === 'number') { return '$number' + elt; }
if (util.isArray(elt)) { return '$date' + elt.getTime(); }
r... | javascript | function projectForUnique (elt) {
if (elt === null) { return '$null'; }
if (typeof elt === 'string') { return '$string' + elt; }
if (typeof elt === 'boolean') { return '$boolean' + elt; }
if (typeof elt === 'number') { return '$number' + elt; }
if (util.isArray(elt)) { return '$date' + elt.getTime(); }
r... | [
"function",
"projectForUnique",
"(",
"elt",
")",
"{",
"if",
"(",
"elt",
"===",
"null",
")",
"{",
"return",
"'$null'",
";",
"}",
"if",
"(",
"typeof",
"elt",
"===",
"'string'",
")",
"{",
"return",
"'$string'",
"+",
"elt",
";",
"}",
"if",
"(",
"typeof",... | Type-aware projection | [
"Type",
"-",
"aware",
"projection"
] | 6952de376e4761167cb0f9c29342d16d675874bf | https://github.com/Ivshti/linvodb3/blob/6952de376e4761167cb0f9c29342d16d675874bf/lib/indexes.js#L17-L25 |
16,214 | Ivshti/linvodb3 | lib/indexes.js | getDotValues | function getDotValues (doc, fields) {
var field, key, i, len;
if (util.isArray(fields)) {
key = {};
for (i = 0, len = fields.length; i < len; i++) {
field = fields[i];
key[field] = document.getDotValue(doc, field);
}
return key;
} else {
return document.getDotValue(doc, fields);
... | javascript | function getDotValues (doc, fields) {
var field, key, i, len;
if (util.isArray(fields)) {
key = {};
for (i = 0, len = fields.length; i < len; i++) {
field = fields[i];
key[field] = document.getDotValue(doc, field);
}
return key;
} else {
return document.getDotValue(doc, fields);
... | [
"function",
"getDotValues",
"(",
"doc",
",",
"fields",
")",
"{",
"var",
"field",
",",
"key",
",",
"i",
",",
"len",
";",
"if",
"(",
"util",
".",
"isArray",
"(",
"fields",
")",
")",
"{",
"key",
"=",
"{",
"}",
";",
"for",
"(",
"i",
"=",
"0",
","... | Get dot values for either a bunch of fields or just one. | [
"Get",
"dot",
"values",
"for",
"either",
"a",
"bunch",
"of",
"fields",
"or",
"just",
"one",
"."
] | 6952de376e4761167cb0f9c29342d16d675874bf | https://github.com/Ivshti/linvodb3/blob/6952de376e4761167cb0f9c29342d16d675874bf/lib/indexes.js#L30-L43 |
16,215 | Ivshti/linvodb3 | lib/model.js | Model | function Model (name, schema, options) {
if (typeof(name) != "string") throw "model name must be provided and a string";
if (arguments.length==1) { options = {}; schema = {} };
if (arguments.length==2) { options = schema; schema = {} };
var self = function Document(raw) { return document.Document.call(this, se... | javascript | function Model (name, schema, options) {
if (typeof(name) != "string") throw "model name must be provided and a string";
if (arguments.length==1) { options = {}; schema = {} };
if (arguments.length==2) { options = schema; schema = {} };
var self = function Document(raw) { return document.Document.call(this, se... | [
"function",
"Model",
"(",
"name",
",",
"schema",
",",
"options",
")",
"{",
"if",
"(",
"typeof",
"(",
"name",
")",
"!=",
"\"string\"",
")",
"throw",
"\"model name must be provided and a string\"",
";",
"if",
"(",
"arguments",
".",
"length",
"==",
"1",
")",
... | We'll use that on a bagpipe instance regulating findById
Create a new model | [
"We",
"ll",
"use",
"that",
"on",
"a",
"bagpipe",
"instance",
"regulating",
"findById",
"Create",
"a",
"new",
"model"
] | 6952de376e4761167cb0f9c29342d16d675874bf | https://github.com/Ivshti/linvodb3/blob/6952de376e4761167cb0f9c29342d16d675874bf/lib/model.js#L29-L62 |
16,216 | Ivshti/linvodb3 | lib/cursor.js | updated | function updated(docs) {
// Refresh if any of the objects: have an ID which is in our results OR they match our query (this.query)
var shouldRefresh = false;
docs.forEach(function(doc) { // Avoid using .some since it would stop iterating after first match and we need to set _prefetched
var interested ... | javascript | function updated(docs) {
// Refresh if any of the objects: have an ID which is in our results OR they match our query (this.query)
var shouldRefresh = false;
docs.forEach(function(doc) { // Avoid using .some since it would stop iterating after first match and we need to set _prefetched
var interested ... | [
"function",
"updated",
"(",
"docs",
")",
"{",
"// Refresh if any of the objects: have an ID which is in our results OR they match our query (this.query)",
"var",
"shouldRefresh",
"=",
"false",
";",
"docs",
".",
"forEach",
"(",
"function",
"(",
"doc",
")",
"{",
"// Avoid usi... | Watch for changes | [
"Watch",
"for",
"changes"
] | 6952de376e4761167cb0f9c29342d16d675874bf | https://github.com/Ivshti/linvodb3/blob/6952de376e4761167cb0f9c29342d16d675874bf/lib/cursor.js#L241-L250 |
16,217 | adobe/git-server | lib/git.js | isCheckedOut | async function isCheckedOut(dir, ref) {
let oidCurrent;
return git.resolveRef({ dir, ref: 'HEAD' })
.then((oid) => {
oidCurrent = oid;
return git.resolveRef({ dir, ref });
})
.then(oid => oidCurrent === oid)
.catch(() => false);
} | javascript | async function isCheckedOut(dir, ref) {
let oidCurrent;
return git.resolveRef({ dir, ref: 'HEAD' })
.then((oid) => {
oidCurrent = oid;
return git.resolveRef({ dir, ref });
})
.then(oid => oidCurrent === oid)
.catch(() => false);
} | [
"async",
"function",
"isCheckedOut",
"(",
"dir",
",",
"ref",
")",
"{",
"let",
"oidCurrent",
";",
"return",
"git",
".",
"resolveRef",
"(",
"{",
"dir",
",",
"ref",
":",
"'HEAD'",
"}",
")",
".",
"then",
"(",
"(",
"oid",
")",
"=>",
"{",
"oidCurrent",
"... | Determines whether the specified reference is currently checked out in the working dir.
@param {string} dir git repo path
@param {string} ref reference (branch or tag)
@returns {Promise<boolean>} `true` if the specified reference is checked out | [
"Determines",
"whether",
"the",
"specified",
"reference",
"is",
"currently",
"checked",
"out",
"in",
"the",
"working",
"dir",
"."
] | e0162b145c158560f785721349be04e2ca9e0379 | https://github.com/adobe/git-server/blob/e0162b145c158560f785721349be04e2ca9e0379/lib/git.js#L69-L78 |
16,218 | adobe/git-server | lib/git.js | resolveCommit | async function resolveCommit(dir, ref) {
return git.resolveRef({ dir, ref })
.catch(async (err) => {
if (err.code === 'ResolveRefError') {
// fallback: is ref a shortened oid prefix?
const oid = await git.expandOid({ dir, oid: ref }).catch(() => { throw err; });
return git.resolveRef... | javascript | async function resolveCommit(dir, ref) {
return git.resolveRef({ dir, ref })
.catch(async (err) => {
if (err.code === 'ResolveRefError') {
// fallback: is ref a shortened oid prefix?
const oid = await git.expandOid({ dir, oid: ref }).catch(() => { throw err; });
return git.resolveRef... | [
"async",
"function",
"resolveCommit",
"(",
"dir",
",",
"ref",
")",
"{",
"return",
"git",
".",
"resolveRef",
"(",
"{",
"dir",
",",
"ref",
"}",
")",
".",
"catch",
"(",
"async",
"(",
"err",
")",
"=>",
"{",
"if",
"(",
"err",
".",
"code",
"===",
"'Res... | Returns the commit oid of the curent commit referenced by `ref`
@param {string} dir git repo path
@param {string} ref reference (branch, tag or commit sha)
@returns {Promise<string>} commit oid of the curent commit referenced by `ref`
@throws {GitError} `err.code === 'ResolveRefError'`: invalid reference | [
"Returns",
"the",
"commit",
"oid",
"of",
"the",
"curent",
"commit",
"referenced",
"by",
"ref"
] | e0162b145c158560f785721349be04e2ca9e0379 | https://github.com/adobe/git-server/blob/e0162b145c158560f785721349be04e2ca9e0379/lib/git.js#L88-L99 |
16,219 | adobe/git-server | lib/git.js | resolveBlob | async function resolveBlob(dir, ref, pathName, includeUncommitted) {
const commitSha = await resolveCommit(dir, ref);
// project-helix/#150: check for uncommitted local changes
// project-helix/#183: serve newly created uncommitted files
// project-helix/#187: only serve uncommitted content if currently
// ... | javascript | async function resolveBlob(dir, ref, pathName, includeUncommitted) {
const commitSha = await resolveCommit(dir, ref);
// project-helix/#150: check for uncommitted local changes
// project-helix/#183: serve newly created uncommitted files
// project-helix/#187: only serve uncommitted content if currently
// ... | [
"async",
"function",
"resolveBlob",
"(",
"dir",
",",
"ref",
",",
"pathName",
",",
"includeUncommitted",
")",
"{",
"const",
"commitSha",
"=",
"await",
"resolveCommit",
"(",
"dir",
",",
"ref",
")",
";",
"// project-helix/#150: check for uncommitted local changes",
"//... | Returns the blob oid of the file at revision `ref` and `pathName`
@param {string} dir git repo path
@param {string} ref reference (branch, tag or commit sha)
@param {string} filePath relative path to file
@param {boolean} includeUncommitted include uncommitted changes in working dir
@returns {Promise<string>} blob oid... | [
"Returns",
"the",
"blob",
"oid",
"of",
"the",
"file",
"at",
"revision",
"ref",
"and",
"pathName"
] | e0162b145c158560f785721349be04e2ca9e0379 | https://github.com/adobe/git-server/blob/e0162b145c158560f785721349be04e2ca9e0379/lib/git.js#L112-L141 |
16,220 | adobe/git-server | lib/git.js | getRawContent | async function getRawContent(dir, ref, pathName, includeUncommitted) {
return resolveBlob(dir, ref, pathName, includeUncommitted)
.then(oid => git.readObject({ dir, oid, format: 'content' }).object);
} | javascript | async function getRawContent(dir, ref, pathName, includeUncommitted) {
return resolveBlob(dir, ref, pathName, includeUncommitted)
.then(oid => git.readObject({ dir, oid, format: 'content' }).object);
} | [
"async",
"function",
"getRawContent",
"(",
"dir",
",",
"ref",
",",
"pathName",
",",
"includeUncommitted",
")",
"{",
"return",
"resolveBlob",
"(",
"dir",
",",
"ref",
",",
"pathName",
",",
"includeUncommitted",
")",
".",
"then",
"(",
"oid",
"=>",
"git",
".",... | Returns the contents of the file at revision `ref` and `pathName`
@param {string} dir git repo path
@param {string} ref reference (branch, tag or commit sha)
@param {string} filePath relative path to file
@param {boolean} includeUncommitted include uncommitted changes in working dir
@returns {Promise<Buffer>} content ... | [
"Returns",
"the",
"contents",
"of",
"the",
"file",
"at",
"revision",
"ref",
"and",
"pathName"
] | e0162b145c158560f785721349be04e2ca9e0379 | https://github.com/adobe/git-server/blob/e0162b145c158560f785721349be04e2ca9e0379/lib/git.js#L154-L157 |
16,221 | adobe/git-server | lib/git.js | createBlobReadStream | async function createBlobReadStream(dir, oid) {
const { object: content } = await git.readObject({ dir, oid });
const stream = new PassThrough();
stream.end(content);
return stream;
} | javascript | async function createBlobReadStream(dir, oid) {
const { object: content } = await git.readObject({ dir, oid });
const stream = new PassThrough();
stream.end(content);
return stream;
} | [
"async",
"function",
"createBlobReadStream",
"(",
"dir",
",",
"oid",
")",
"{",
"const",
"{",
"object",
":",
"content",
"}",
"=",
"await",
"git",
".",
"readObject",
"(",
"{",
"dir",
",",
"oid",
"}",
")",
";",
"const",
"stream",
"=",
"new",
"PassThrough"... | Returns a stream for reading the specified blob.
@param {string} dir git repo path
@param {string} oid blob sha1
@returns {Promise<Stream>} readable Stream instance | [
"Returns",
"a",
"stream",
"for",
"reading",
"the",
"specified",
"blob",
"."
] | e0162b145c158560f785721349be04e2ca9e0379 | https://github.com/adobe/git-server/blob/e0162b145c158560f785721349be04e2ca9e0379/lib/git.js#L166-L171 |
16,222 | adobe/git-server | lib/git.js | isValidSha | function isValidSha(str) {
if (typeof str === 'string' && str.length === 40) {
const res = str.match(/[0-9a-f]/g);
return res && res.length === 40;
}
return false;
} | javascript | function isValidSha(str) {
if (typeof str === 'string' && str.length === 40) {
const res = str.match(/[0-9a-f]/g);
return res && res.length === 40;
}
return false;
} | [
"function",
"isValidSha",
"(",
"str",
")",
"{",
"if",
"(",
"typeof",
"str",
"===",
"'string'",
"&&",
"str",
".",
"length",
"===",
"40",
")",
"{",
"const",
"res",
"=",
"str",
".",
"match",
"(",
"/",
"[0-9a-f]",
"/",
"g",
")",
";",
"return",
"res",
... | Checks if the specified string is a valid SHA-1 value.
@param {string} str
@returns {boolean} `true` if `str` represents a valid SHA-1, otherwise `false` | [
"Checks",
"if",
"the",
"specified",
"string",
"is",
"a",
"valid",
"SHA",
"-",
"1",
"value",
"."
] | e0162b145c158560f785721349be04e2ca9e0379 | https://github.com/adobe/git-server/blob/e0162b145c158560f785721349be04e2ca9e0379/lib/git.js#L190-L196 |
16,223 | adobe/git-server | lib/git.js | commitLog | async function commitLog(dir, ref, path) {
return git.log({ dir, ref, path })
.catch(async (err) => {
if (err.code === 'ResolveRefError') {
// fallback: is ref a shortened oid prefix?
const oid = await git.expandOid({ dir, oid: ref });
return git.log({ dir, ref: oid, path });
}... | javascript | async function commitLog(dir, ref, path) {
return git.log({ dir, ref, path })
.catch(async (err) => {
if (err.code === 'ResolveRefError') {
// fallback: is ref a shortened oid prefix?
const oid = await git.expandOid({ dir, oid: ref });
return git.log({ dir, ref: oid, path });
}... | [
"async",
"function",
"commitLog",
"(",
"dir",
",",
"ref",
",",
"path",
")",
"{",
"return",
"git",
".",
"log",
"(",
"{",
"dir",
",",
"ref",
",",
"path",
"}",
")",
".",
"catch",
"(",
"async",
"(",
"err",
")",
"=>",
"{",
"if",
"(",
"err",
".",
"... | Returns a commit log, i.e. an array of commits in reverse chronological order.
@param {string} dir git repo path
@param {string} ref reference (branch, tag or commit sha)
@param {string} path only commits containing this file path will be returned
@throws {GitError} `err.code === 'ResolveRefError'`: invalid reference
... | [
"Returns",
"a",
"commit",
"log",
"i",
".",
"e",
".",
"an",
"array",
"of",
"commits",
"in",
"reverse",
"chronological",
"order",
"."
] | e0162b145c158560f785721349be04e2ca9e0379 | https://github.com/adobe/git-server/blob/e0162b145c158560f785721349be04e2ca9e0379/lib/git.js#L237-L283 |
16,224 | adobe/git-server | lib/utils.js | randomFileOrFolderName | function randomFileOrFolderName(len = 32) {
if (Number.isFinite(len)) {
return crypto.randomBytes(Math.ceil(len / 2)).toString('hex').slice(0, len);
}
throw new Error(`illegal argument: ${len}`);
} | javascript | function randomFileOrFolderName(len = 32) {
if (Number.isFinite(len)) {
return crypto.randomBytes(Math.ceil(len / 2)).toString('hex').slice(0, len);
}
throw new Error(`illegal argument: ${len}`);
} | [
"function",
"randomFileOrFolderName",
"(",
"len",
"=",
"32",
")",
"{",
"if",
"(",
"Number",
".",
"isFinite",
"(",
"len",
")",
")",
"{",
"return",
"crypto",
".",
"randomBytes",
"(",
"Math",
".",
"ceil",
"(",
"len",
"/",
"2",
")",
")",
".",
"toString",... | Generates a random name.
@param {Number} len | [
"Generates",
"a",
"random",
"name",
"."
] | e0162b145c158560f785721349be04e2ca9e0379 | https://github.com/adobe/git-server/blob/e0162b145c158560f785721349be04e2ca9e0379/lib/utils.js#L32-L37 |
16,225 | adobe/git-server | lib/utils.js | resolveRepositoryPath | function resolveRepositoryPath(options, owner, repo) {
let repPath = path.resolve(options.repoRoot, owner, repo);
if (options.virtualRepos[owner] && options.virtualRepos[owner][repo]) {
repPath = path.resolve(options.virtualRepos[owner][repo].path);
}
return repPath;
} | javascript | function resolveRepositoryPath(options, owner, repo) {
let repPath = path.resolve(options.repoRoot, owner, repo);
if (options.virtualRepos[owner] && options.virtualRepos[owner][repo]) {
repPath = path.resolve(options.virtualRepos[owner][repo].path);
}
return repPath;
} | [
"function",
"resolveRepositoryPath",
"(",
"options",
",",
"owner",
",",
"repo",
")",
"{",
"let",
"repPath",
"=",
"path",
".",
"resolve",
"(",
"options",
".",
"repoRoot",
",",
"owner",
",",
"repo",
")",
";",
"if",
"(",
"options",
".",
"virtualRepos",
"[",... | Resolves the file system path of the specified repository.
@param {object} options configuration hash
@param {string} owner github org or user
@param {string} repo repository name | [
"Resolves",
"the",
"file",
"system",
"path",
"of",
"the",
"specified",
"repository",
"."
] | e0162b145c158560f785721349be04e2ca9e0379 | https://github.com/adobe/git-server/blob/e0162b145c158560f785721349be04e2ca9e0379/lib/utils.js#L46-L53 |
16,226 | davisjam/vuln-regex-detector | src/cache/client/npm/vuln-regex-detector-client.js | promiseResult | function promiseResult (options, data) {
log(`promiseResult: data ${data}`);
return new Promise((resolve, reject) => {
/* Check cache to avoid I/O. */
const cacheHit = checkCache(config, pattern);
if (cacheHit !== RESPONSE_UNKNOWN) {
log(`Cache hit: ${cacheHit}`);
return resolve(cacheHit);
}
... | javascript | function promiseResult (options, data) {
log(`promiseResult: data ${data}`);
return new Promise((resolve, reject) => {
/* Check cache to avoid I/O. */
const cacheHit = checkCache(config, pattern);
if (cacheHit !== RESPONSE_UNKNOWN) {
log(`Cache hit: ${cacheHit}`);
return resolve(cacheHit);
}
... | [
"function",
"promiseResult",
"(",
"options",
",",
"data",
")",
"{",
"log",
"(",
"`",
"${",
"data",
"}",
"`",
")",
";",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"/* Check cache to avoid I/O. */",
"const",
"cacheHit",
... | Wrapper so we can return a Promise. | [
"Wrapper",
"so",
"we",
"can",
"return",
"a",
"Promise",
"."
] | 2cfdf7ac37985ba86caa052e5bb0f706b1553b9b | https://github.com/davisjam/vuln-regex-detector/blob/2cfdf7ac37985ba86caa052e5bb0f706b1553b9b/src/cache/client/npm/vuln-regex-detector-client.js#L98-L142 |
16,227 | davisjam/vuln-regex-detector | src/cache/server/cache-server.js | collectionLookup | function collectionLookup (collection, query) {
const id = createID(query.pattern, query.language);
log(`collectionLookup: querying for ${id}`);
return collection.find({_id: id}, {result: 1}).toArray()
.then(
(docs) => {
log(`collectionLookup: Got ${docs.length} docs`);
if (docs.length === 0) {
log... | javascript | function collectionLookup (collection, query) {
const id = createID(query.pattern, query.language);
log(`collectionLookup: querying for ${id}`);
return collection.find({_id: id}, {result: 1}).toArray()
.then(
(docs) => {
log(`collectionLookup: Got ${docs.length} docs`);
if (docs.length === 0) {
log... | [
"function",
"collectionLookup",
"(",
"collection",
",",
"query",
")",
"{",
"const",
"id",
"=",
"createID",
"(",
"query",
".",
"pattern",
",",
"query",
".",
"language",
")",
";",
"log",
"(",
"`",
"${",
"id",
"}",
"`",
")",
";",
"return",
"collection",
... | Helper for isVulnerable. Returns a Promise that resolves to one of the PATTERN_X results. | [
"Helper",
"for",
"isVulnerable",
".",
"Returns",
"a",
"Promise",
"that",
"resolves",
"to",
"one",
"of",
"the",
"PATTERN_X",
"results",
"."
] | 2cfdf7ac37985ba86caa052e5bb0f706b1553b9b | https://github.com/davisjam/vuln-regex-detector/blob/2cfdf7ac37985ba86caa052e5bb0f706b1553b9b/src/cache/server/cache-server.js#L167-L190 |
16,228 | davisjam/vuln-regex-detector | src/cache/server/cache-server.js | reportResult | function reportResult (body) {
// Reject invalid reports.
if (!body) {
log(`reportResult: no body`);
return Promise.resolve(PATTERN_INVALID);
}
// Required fields.
let isInvalid = false;
['pattern', 'language', 'result'].forEach((f) => {
if (!body.hasOwnProperty(f) || body[f] === null) {
isInvalid = tru... | javascript | function reportResult (body) {
// Reject invalid reports.
if (!body) {
log(`reportResult: no body`);
return Promise.resolve(PATTERN_INVALID);
}
// Required fields.
let isInvalid = false;
['pattern', 'language', 'result'].forEach((f) => {
if (!body.hasOwnProperty(f) || body[f] === null) {
isInvalid = tru... | [
"function",
"reportResult",
"(",
"body",
")",
"{",
"// Reject invalid reports.",
"if",
"(",
"!",
"body",
")",
"{",
"log",
"(",
"`",
"`",
")",
";",
"return",
"Promise",
".",
"resolve",
"(",
"PATTERN_INVALID",
")",
";",
"}",
"// Required fields.",
"let",
"is... | Returns a Promise that resolves to one of the PATTERN_X results. | [
"Returns",
"a",
"Promise",
"that",
"resolves",
"to",
"one",
"of",
"the",
"PATTERN_X",
"results",
"."
] | 2cfdf7ac37985ba86caa052e5bb0f706b1553b9b | https://github.com/davisjam/vuln-regex-detector/blob/2cfdf7ac37985ba86caa052e5bb0f706b1553b9b/src/cache/server/cache-server.js#L193-L255 |
16,229 | davisjam/vuln-regex-detector | src/cache/server/cache-server.js | collectionUpdate | function collectionUpdate (collection, result) {
result._id = createID(result.pattern, result.language);
return collection.insertOne(result)
.catch((e) => {
// May fail due to concurrent update on the same value.
log(`collectionUpdate: error: ${e}`);
return Promise.resolve(PATTERN_INVALID);
});
} | javascript | function collectionUpdate (collection, result) {
result._id = createID(result.pattern, result.language);
return collection.insertOne(result)
.catch((e) => {
// May fail due to concurrent update on the same value.
log(`collectionUpdate: error: ${e}`);
return Promise.resolve(PATTERN_INVALID);
});
} | [
"function",
"collectionUpdate",
"(",
"collection",
",",
"result",
")",
"{",
"result",
".",
"_id",
"=",
"createID",
"(",
"result",
".",
"pattern",
",",
"result",
".",
"language",
")",
";",
"return",
"collection",
".",
"insertOne",
"(",
"result",
")",
".",
... | Helper for reportResult. | [
"Helper",
"for",
"reportResult",
"."
] | 2cfdf7ac37985ba86caa052e5bb0f706b1553b9b | https://github.com/davisjam/vuln-regex-detector/blob/2cfdf7ac37985ba86caa052e5bb0f706b1553b9b/src/cache/server/cache-server.js#L258-L266 |
16,230 | andismith/grunt-responsive-images | demo/dist/assets/js/picturefill.js | runPicturefill | function runPicturefill() {
picturefill();
var intervalId = setInterval( function(){
// When the document has finished loading, stop checking for new images
// https://github.com/ded/domready/blob/master/ready.js#L15
w.picturefill();
if ( /^loaded|^i|^c/.test( doc.readyState ) ) {
... | javascript | function runPicturefill() {
picturefill();
var intervalId = setInterval( function(){
// When the document has finished loading, stop checking for new images
// https://github.com/ded/domready/blob/master/ready.js#L15
w.picturefill();
if ( /^loaded|^i|^c/.test( doc.readyState ) ) {
... | [
"function",
"runPicturefill",
"(",
")",
"{",
"picturefill",
"(",
")",
";",
"var",
"intervalId",
"=",
"setInterval",
"(",
"function",
"(",
")",
"{",
"// When the document has finished loading, stop checking for new images",
"// https://github.com/ded/domready/blob/master/ready.j... | Sets up picture polyfill by polling the document and running
the polyfill every 250ms until the document is ready.
Also attaches picturefill on resize | [
"Sets",
"up",
"picture",
"polyfill",
"by",
"polling",
"the",
"document",
"and",
"running",
"the",
"polyfill",
"every",
"250ms",
"until",
"the",
"document",
"is",
"ready",
".",
"Also",
"attaches",
"picturefill",
"on",
"resize"
] | c8def291ab152edb47153ca324722c86326ba573 | https://github.com/andismith/grunt-responsive-images/blob/c8def291ab152edb47153ca324722c86326ba573/demo/dist/assets/js/picturefill.js#L509-L529 |
16,231 | andismith/grunt-responsive-images | tasks/responsive_images.js | function(engine) {
if (typeof GFX_ENGINES[engine] === 'undefined') {
return grunt.fail.warn('Invalid render engine specified');
}
grunt.verbose.ok('Using render engine: ' + GFX_ENGINES[engine].name);
if (engine === 'im') {
return gm.subClass({ imageMagick: (engine === 'im') });
}
r... | javascript | function(engine) {
if (typeof GFX_ENGINES[engine] === 'undefined') {
return grunt.fail.warn('Invalid render engine specified');
}
grunt.verbose.ok('Using render engine: ' + GFX_ENGINES[engine].name);
if (engine === 'im') {
return gm.subClass({ imageMagick: (engine === 'im') });
}
r... | [
"function",
"(",
"engine",
")",
"{",
"if",
"(",
"typeof",
"GFX_ENGINES",
"[",
"engine",
"]",
"===",
"'undefined'",
")",
"{",
"return",
"grunt",
".",
"fail",
".",
"warn",
"(",
"'Invalid render engine specified'",
")",
";",
"}",
"grunt",
".",
"verbose",
".",... | Set the engine to ImageMagick or GraphicsMagick
@private
@param {string} engine im for ImageMagick, gm for GraphicsMagick | [
"Set",
"the",
"engine",
"to",
"ImageMagick",
"or",
"GraphicsMagick"
] | c8def291ab152edb47153ca324722c86326ba573 | https://github.com/andismith/grunt-responsive-images/blob/c8def291ab152edb47153ca324722c86326ba573/tasks/responsive_images.js#L89-L100 | |
16,232 | andismith/grunt-responsive-images | tasks/responsive_images.js | function(properties, options) {
var widthUnit = '',
heightUnit = '';
// name takes precedence
if (properties.name) {
return properties.name;
} else {
// figure out the units for width and height (they can be different)
widthUnit = ((properties.width || 0).toString().indexOf('%')... | javascript | function(properties, options) {
var widthUnit = '',
heightUnit = '';
// name takes precedence
if (properties.name) {
return properties.name;
} else {
// figure out the units for width and height (they can be different)
widthUnit = ((properties.width || 0).toString().indexOf('%')... | [
"function",
"(",
"properties",
",",
"options",
")",
"{",
"var",
"widthUnit",
"=",
"''",
",",
"heightUnit",
"=",
"''",
";",
"// name takes precedence",
"if",
"(",
"properties",
".",
"name",
")",
"{",
"return",
"properties",
".",
"name",
";",
"}",
"else",
... | Create a name to suffix to our file.
@private
@param {object} properties Contains properties for name, width, height (where applicable)
@return {string} A new name | [
"Create",
"a",
"name",
"to",
"suffix",
"to",
"our",
"file",
"."
] | c8def291ab152edb47153ca324722c86326ba573 | https://github.com/andismith/grunt-responsive-images/blob/c8def291ab152edb47153ca324722c86326ba573/tasks/responsive_images.js#L168-L186 | |
16,233 | andismith/grunt-responsive-images | tasks/responsive_images.js | function(obj, keys, remove) {
var i = 0,
l = keys.length;
for (i = 0; i < l; i++) {
if (obj[keys[i]] && obj[keys[i]].toString().indexOf(remove) > -1) {
obj[keys[i]] = obj[keys[i]].toString().replace(remove, '');
}
}
return obj;
} | javascript | function(obj, keys, remove) {
var i = 0,
l = keys.length;
for (i = 0; i < l; i++) {
if (obj[keys[i]] && obj[keys[i]].toString().indexOf(remove) > -1) {
obj[keys[i]] = obj[keys[i]].toString().replace(remove, '');
}
}
return obj;
} | [
"function",
"(",
"obj",
",",
"keys",
",",
"remove",
")",
"{",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"keys",
".",
"length",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",
"(",
"obj",
"[",
"keys",
"[",
... | Removes characters from the values of the object keys specified
@private
@param {object} obj The object to inspect.
@param {array} keys The keys to check the values of.
@param {string} remove The string to remove. | [
"Removes",
"characters",
"from",
"the",
"values",
"of",
"the",
"object",
"keys",
"specified"
] | c8def291ab152edb47153ca324722c86326ba573 | https://github.com/andismith/grunt-responsive-images/blob/c8def291ab152edb47153ca324722c86326ba573/tasks/responsive_images.js#L257-L266 | |
16,234 | andismith/grunt-responsive-images | tasks/responsive_images.js | function(error, engine) {
if (error.message.indexOf('ENOENT') > -1) {
grunt.log.error(error.message);
grunt.fail.warn('\nPlease ensure ' + GFX_ENGINES[engine].name + ' is installed correctly.\n' +
'`brew install ' + GFX_ENGINES[engine].brewurl + '` or see ' + GFX_ENGINES[engine].url + ' for more... | javascript | function(error, engine) {
if (error.message.indexOf('ENOENT') > -1) {
grunt.log.error(error.message);
grunt.fail.warn('\nPlease ensure ' + GFX_ENGINES[engine].name + ' is installed correctly.\n' +
'`brew install ' + GFX_ENGINES[engine].brewurl + '` or see ' + GFX_ENGINES[engine].url + ' for more... | [
"function",
"(",
"error",
",",
"engine",
")",
"{",
"if",
"(",
"error",
".",
"message",
".",
"indexOf",
"(",
"'ENOENT'",
")",
">",
"-",
"1",
")",
"{",
"grunt",
".",
"log",
".",
"error",
"(",
"error",
".",
"message",
")",
";",
"grunt",
".",
"fail",... | Handle showing errors to the user.
@private
@param {string} error The error message.
@param {string} engine The graphics engine being used. | [
"Handle",
"showing",
"errors",
"to",
"the",
"user",
"."
] | c8def291ab152edb47153ca324722c86326ba573 | https://github.com/andismith/grunt-responsive-images/blob/c8def291ab152edb47153ca324722c86326ba573/tasks/responsive_images.js#L275-L286 | |
16,235 | andismith/grunt-responsive-images | tasks/responsive_images.js | function(count, name) {
if (count) {
grunt.log.writeln('Resized ' + count.toString().cyan + ' ' +
grunt.util.pluralize(count, 'file/files') + ' for ' + name);
}
} | javascript | function(count, name) {
if (count) {
grunt.log.writeln('Resized ' + count.toString().cyan + ' ' +
grunt.util.pluralize(count, 'file/files') + ' for ' + name);
}
} | [
"function",
"(",
"count",
",",
"name",
")",
"{",
"if",
"(",
"count",
")",
"{",
"grunt",
".",
"log",
".",
"writeln",
"(",
"'Resized '",
"+",
"count",
".",
"toString",
"(",
")",
".",
"cyan",
"+",
"' '",
"+",
"grunt",
".",
"util",
".",
"pluralize",
... | Outputs the result of the tally.
@private
@param {number} count The file count.
@param {string} name Name of the image. | [
"Outputs",
"the",
"result",
"of",
"the",
"tally",
"."
] | c8def291ab152edb47153ca324722c86326ba573 | https://github.com/andismith/grunt-responsive-images/blob/c8def291ab152edb47153ca324722c86326ba573/tasks/responsive_images.js#L304-L309 | |
16,236 | andismith/grunt-responsive-images | tasks/responsive_images.js | function(srcPath, dstPath, sizeOptions, customDest, origCwd) {
var baseName = '',
dirName = '',
extName = '';
extName = path.extname(dstPath);
baseName = path.basename(dstPath, extName); // filename without extension
if (customDest) {
sizeOptions.path = srcPath.replace(new RegExp(or... | javascript | function(srcPath, dstPath, sizeOptions, customDest, origCwd) {
var baseName = '',
dirName = '',
extName = '';
extName = path.extname(dstPath);
baseName = path.basename(dstPath, extName); // filename without extension
if (customDest) {
sizeOptions.path = srcPath.replace(new RegExp(or... | [
"function",
"(",
"srcPath",
",",
"dstPath",
",",
"sizeOptions",
",",
"customDest",
",",
"origCwd",
")",
"{",
"var",
"baseName",
"=",
"''",
",",
"dirName",
"=",
"''",
",",
"extName",
"=",
"''",
";",
"extName",
"=",
"path",
".",
"extname",
"(",
"dstPath"... | Gets the destination path
@private
@param {string} srcPath The source path
@param {string} filename Image Filename
@param {object} sizeOptions
@param {string} customDest
@param {string} origCwd
@return The complete path and filename | [
"Gets",
"the",
"destination",
"path"
] | c8def291ab152edb47153ca324722c86326ba573 | https://github.com/andismith/grunt-responsive-images/blob/c8def291ab152edb47153ca324722c86326ba573/tasks/responsive_images.js#L461-L487 | |
16,237 | youzan/vant-doc | helper/touch-simulator.js | onMouse | function onMouse(touchType) {
return function(ev) {
// prevent mouse events
if (ev.which !== 1) {
return;
}
// The EventTarget on which the touch point started when it was first placed on the surface,
// even if the touch point has since moved outside the interactive area of that element.
... | javascript | function onMouse(touchType) {
return function(ev) {
// prevent mouse events
if (ev.which !== 1) {
return;
}
// The EventTarget on which the touch point started when it was first placed on the surface,
// even if the touch point has since moved outside the interactive area of that element.
... | [
"function",
"onMouse",
"(",
"touchType",
")",
"{",
"return",
"function",
"(",
"ev",
")",
"{",
"// prevent mouse events",
"if",
"(",
"ev",
".",
"which",
"!==",
"1",
")",
"{",
"return",
";",
"}",
"// The EventTarget on which the touch point started when it was first p... | only trigger touches when the left mousebutton has been pressed
@param touchType
@returns {Function} | [
"only",
"trigger",
"touches",
"when",
"the",
"left",
"mousebutton",
"has",
"been",
"pressed"
] | f1770c3dfa221987c96cd1ec9785304e2cefae02 | https://github.com/youzan/vant-doc/blob/f1770c3dfa221987c96cd1ec9785304e2cefae02/helper/touch-simulator.js#L100-L122 |
16,238 | youzan/vant-doc | helper/touch-simulator.js | triggerTouch | function triggerTouch(eventName, mouseEv) {
var touchEvent = document.createEvent('Event');
touchEvent.initEvent(eventName, true, true);
touchEvent.altKey = mouseEv.altKey;
touchEvent.ctrlKey = mouseEv.ctrlKey;
touchEvent.metaKey = mouseEv.metaKey;
touchEvent.shiftKey = mouseEv.shiftKey;
touchEvent.touc... | javascript | function triggerTouch(eventName, mouseEv) {
var touchEvent = document.createEvent('Event');
touchEvent.initEvent(eventName, true, true);
touchEvent.altKey = mouseEv.altKey;
touchEvent.ctrlKey = mouseEv.ctrlKey;
touchEvent.metaKey = mouseEv.metaKey;
touchEvent.shiftKey = mouseEv.shiftKey;
touchEvent.touc... | [
"function",
"triggerTouch",
"(",
"eventName",
",",
"mouseEv",
")",
"{",
"var",
"touchEvent",
"=",
"document",
".",
"createEvent",
"(",
"'Event'",
")",
";",
"touchEvent",
".",
"initEvent",
"(",
"eventName",
",",
"true",
",",
"true",
")",
";",
"touchEvent",
... | trigger a touch event
@param eventName
@param mouseEv | [
"trigger",
"a",
"touch",
"event"
] | f1770c3dfa221987c96cd1ec9785304e2cefae02 | https://github.com/youzan/vant-doc/blob/f1770c3dfa221987c96cd1ec9785304e2cefae02/helper/touch-simulator.js#L129-L143 |
16,239 | riot/route | dist/amd.route+tag.js | start | function start(autoExec) {
debouncedEmit = debounce(emit, 1);
win[ADD_EVENT_LISTENER](POPSTATE, debouncedEmit);
win[ADD_EVENT_LISTENER](HASHCHANGE, debouncedEmit);
doc[ADD_EVENT_LISTENER](clickEvent, click);
if (autoExec) { emit(true); }
} | javascript | function start(autoExec) {
debouncedEmit = debounce(emit, 1);
win[ADD_EVENT_LISTENER](POPSTATE, debouncedEmit);
win[ADD_EVENT_LISTENER](HASHCHANGE, debouncedEmit);
doc[ADD_EVENT_LISTENER](clickEvent, click);
if (autoExec) { emit(true); }
} | [
"function",
"start",
"(",
"autoExec",
")",
"{",
"debouncedEmit",
"=",
"debounce",
"(",
"emit",
",",
"1",
")",
";",
"win",
"[",
"ADD_EVENT_LISTENER",
"]",
"(",
"POPSTATE",
",",
"debouncedEmit",
")",
";",
"win",
"[",
"ADD_EVENT_LISTENER",
"]",
"(",
"HASHCHAN... | Set the window listeners to trigger the routes
@param {boolean} autoExec - see route.start | [
"Set",
"the",
"window",
"listeners",
"to",
"trigger",
"the",
"routes"
] | 226d16c3ff2ef745b333de3de84a18c78c97737d | https://github.com/riot/route/blob/226d16c3ff2ef745b333de3de84a18c78c97737d/dist/amd.route+tag.js#L207-L214 |
16,240 | nhn/tui.jsdoc-template | demo/src/class.js | function(a, b, retArr) {
if (retArr) {
return [a, b, a + b];
}
return a + b;
} | javascript | function(a, b, retArr) {
if (retArr) {
return [a, b, a + b];
}
return a + b;
} | [
"function",
"(",
"a",
",",
"b",
",",
"retArr",
")",
"{",
"if",
"(",
"retArr",
")",
"{",
"return",
"[",
"a",
",",
"b",
",",
"a",
"+",
"b",
"]",
";",
"}",
"return",
"a",
"+",
"b",
";",
"}"
] | Returns the sum of a and b
@param {Number} a
@param {Number} b
@param {Boolean} retArr If set to true, the function will return an array
@returns {Number|Array} Sum of a and b or an array that contains a, b and the sum of a and b. | [
"Returns",
"the",
"sum",
"of",
"a",
"and",
"b"
] | 13a8d08b4d1f01f41e46922549250eaed7e93733 | https://github.com/nhn/tui.jsdoc-template/blob/13a8d08b4d1f01f41e46922549250eaed7e93733/demo/src/class.js#L128-L133 | |
16,241 | davehorton/drachtio-srf | lib/connect.js | createServer | function createServer() {
function app(req, res, next) {
app.handle(req, res, next);
}
app.method = '*';
merge(app, proto);
merge(app, EventEmitter.prototype);
app.stack = [];
app.params = [];
app._cachedEvents = [] ;
app.routedMethods = {} ;
app.locals = Object.create(null);
for (var i = 0; i... | javascript | function createServer() {
function app(req, res, next) {
app.handle(req, res, next);
}
app.method = '*';
merge(app, proto);
merge(app, EventEmitter.prototype);
app.stack = [];
app.params = [];
app._cachedEvents = [] ;
app.routedMethods = {} ;
app.locals = Object.create(null);
for (var i = 0; i... | [
"function",
"createServer",
"(",
")",
"{",
"function",
"app",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"app",
".",
"handle",
"(",
"req",
",",
"res",
",",
"next",
")",
";",
"}",
"app",
".",
"method",
"=",
"'*'",
";",
"merge",
"(",
"app",
"... | Create a new server.
@return {Function}
@api public | [
"Create",
"a",
"new",
"server",
"."
] | a29e1a3a5c5f15e0b44fbdfbba9aa6e2ed31ca13 | https://github.com/davehorton/drachtio-srf/blob/a29e1a3a5c5f15e0b44fbdfbba9aa6e2ed31ca13/lib/connect.js#L15-L54 |
16,242 | node-ffi-napi/node-ffi-napi | lib/callback.js | Callback | function Callback (retType, argTypes, abi, func) {
debug('creating new Callback');
if (typeof abi === 'function') {
func = abi;
abi = undefined;
}
// check args
assert(!!retType, 'expected a return "type" object as the first argument');
assert(Array.isArray(argTypes), 'expected Array of arg "type"... | javascript | function Callback (retType, argTypes, abi, func) {
debug('creating new Callback');
if (typeof abi === 'function') {
func = abi;
abi = undefined;
}
// check args
assert(!!retType, 'expected a return "type" object as the first argument');
assert(Array.isArray(argTypes), 'expected Array of arg "type"... | [
"function",
"Callback",
"(",
"retType",
",",
"argTypes",
",",
"abi",
",",
"func",
")",
"{",
"debug",
"(",
"'creating new Callback'",
")",
";",
"if",
"(",
"typeof",
"abi",
"===",
"'function'",
")",
"{",
"func",
"=",
"abi",
";",
"abi",
"=",
"undefined",
... | Turns a JavaScript function into a C function pointer.
The function pointer may be used in other C functions that
accept C callback functions. | [
"Turns",
"a",
"JavaScript",
"function",
"into",
"a",
"C",
"function",
"pointer",
".",
"The",
"function",
"pointer",
"may",
"be",
"used",
"in",
"other",
"C",
"functions",
"that",
"accept",
"C",
"callback",
"functions",
"."
] | 998255a8009cbfca0fc2f2cb7e4fc0a7be30c422 | https://github.com/node-ffi-napi/node-ffi-napi/blob/998255a8009cbfca0fc2f2cb7e4fc0a7be30c422/lib/callback.js#L32-L79 |
16,243 | node-ffi-napi/node-ffi-napi | lib/foreign_function_var.js | variadic_function_generator | function variadic_function_generator () {
debug('variadic_function_generator invoked');
// first get the types of variadic args we are working with
const argTypes = fixedArgTypes.slice();
let key = fixedKey.slice();
for (let i = 0; i < arguments.length; i++) {
const type = ref.coerceType(arg... | javascript | function variadic_function_generator () {
debug('variadic_function_generator invoked');
// first get the types of variadic args we are working with
const argTypes = fixedArgTypes.slice();
let key = fixedKey.slice();
for (let i = 0; i < arguments.length; i++) {
const type = ref.coerceType(arg... | [
"function",
"variadic_function_generator",
"(",
")",
"{",
"debug",
"(",
"'variadic_function_generator invoked'",
")",
";",
"// first get the types of variadic args we are working with",
"const",
"argTypes",
"=",
"fixedArgTypes",
".",
"slice",
"(",
")",
";",
"let",
"key",
... | what gets returned is another function that needs to be invoked with the rest of the variadic types that are being invoked from the function. | [
"what",
"gets",
"returned",
"is",
"another",
"function",
"that",
"needs",
"to",
"be",
"invoked",
"with",
"the",
"rest",
"of",
"the",
"variadic",
"types",
"that",
"are",
"being",
"invoked",
"from",
"the",
"function",
"."
] | 998255a8009cbfca0fc2f2cb7e4fc0a7be30c422 | https://github.com/node-ffi-napi/node-ffi-napi/blob/998255a8009cbfca0fc2f2cb7e4fc0a7be30c422/lib/foreign_function_var.js#L50-L84 |
16,244 | node-ffi-napi/node-ffi-napi | lib/foreign_function.js | ForeignFunction | function ForeignFunction (funcPtr, returnType, argTypes, abi) {
debug('creating new ForeignFunction', funcPtr);
// check args
assert(Buffer.isBuffer(funcPtr), 'expected Buffer as first argument');
assert(!!returnType, 'expected a return "type" object as the second argument');
assert(Array.isArray(argTypes), ... | javascript | function ForeignFunction (funcPtr, returnType, argTypes, abi) {
debug('creating new ForeignFunction', funcPtr);
// check args
assert(Buffer.isBuffer(funcPtr), 'expected Buffer as first argument');
assert(!!returnType, 'expected a return "type" object as the second argument');
assert(Array.isArray(argTypes), ... | [
"function",
"ForeignFunction",
"(",
"funcPtr",
",",
"returnType",
",",
"argTypes",
",",
"abi",
")",
"{",
"debug",
"(",
"'creating new ForeignFunction'",
",",
"funcPtr",
")",
";",
"// check args",
"assert",
"(",
"Buffer",
".",
"isBuffer",
"(",
"funcPtr",
")",
"... | Represents a foreign function in another library. Manages all of the aspects
of function execution, including marshalling the data parameters for the
function into native types and also unmarshalling the return from function
execution. | [
"Represents",
"a",
"foreign",
"function",
"in",
"another",
"library",
".",
"Manages",
"all",
"of",
"the",
"aspects",
"of",
"function",
"execution",
"including",
"marshalling",
"the",
"data",
"parameters",
"for",
"the",
"function",
"into",
"native",
"types",
"and... | 998255a8009cbfca0fc2f2cb7e4fc0a7be30c422 | https://github.com/node-ffi-napi/node-ffi-napi/blob/998255a8009cbfca0fc2f2cb7e4fc0a7be30c422/lib/foreign_function.js#L19-L37 |
16,245 | node-ffi-napi/node-ffi-napi | lib/_foreign_function.js | function () {
debug('invoking proxy function');
if (arguments.length !== numArgs) {
throw new TypeError('Expected ' + numArgs +
' arguments, got ' + arguments.length);
}
// storage buffers for input arguments and the return value
const result = Buffer.alloc(resultSize);
const a... | javascript | function () {
debug('invoking proxy function');
if (arguments.length !== numArgs) {
throw new TypeError('Expected ' + numArgs +
' arguments, got ' + arguments.length);
}
// storage buffers for input arguments and the return value
const result = Buffer.alloc(resultSize);
const a... | [
"function",
"(",
")",
"{",
"debug",
"(",
"'invoking proxy function'",
")",
";",
"if",
"(",
"arguments",
".",
"length",
"!==",
"numArgs",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'Expected '",
"+",
"numArgs",
"+",
"' arguments, got '",
"+",
"arguments",
"... | This is the actual JS function that gets returned.
It handles marshalling input arguments into C values,
and unmarshalling the return value back into a JS value | [
"This",
"is",
"the",
"actual",
"JS",
"function",
"that",
"gets",
"returned",
".",
"It",
"handles",
"marshalling",
"input",
"arguments",
"into",
"C",
"values",
"and",
"unmarshalling",
"the",
"return",
"value",
"back",
"into",
"a",
"JS",
"value"
] | 998255a8009cbfca0fc2f2cb7e4fc0a7be30c422 | https://github.com/node-ffi-napi/node-ffi-napi/blob/998255a8009cbfca0fc2f2cb7e4fc0a7be30c422/lib/_foreign_function.js#L32-L65 | |
16,246 | node-ffi-napi/node-ffi-napi | lib/function.js | Function | function Function (retType, argTypes, abi) {
if (!(this instanceof Function)) {
return new Function(retType, argTypes, abi);
}
debug('creating new FunctionType');
// check args
assert(!!retType, 'expected a return "type" object as the first argument');
assert(Array.isArray(argTypes), 'expected Array o... | javascript | function Function (retType, argTypes, abi) {
if (!(this instanceof Function)) {
return new Function(retType, argTypes, abi);
}
debug('creating new FunctionType');
// check args
assert(!!retType, 'expected a return "type" object as the first argument');
assert(Array.isArray(argTypes), 'expected Array o... | [
"function",
"Function",
"(",
"retType",
",",
"argTypes",
",",
"abi",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Function",
")",
")",
"{",
"return",
"new",
"Function",
"(",
"retType",
",",
"argTypes",
",",
"abi",
")",
";",
"}",
"debug",
"("... | Creates and returns a "type" object for a C "function pointer".
@api public | [
"Creates",
"and",
"returns",
"a",
"type",
"object",
"for",
"a",
"C",
"function",
"pointer",
"."
] | 998255a8009cbfca0fc2f2cb7e4fc0a7be30c422 | https://github.com/node-ffi-napi/node-ffi-napi/blob/998255a8009cbfca0fc2f2cb7e4fc0a7be30c422/lib/function.js#L25-L41 |
16,247 | overlookmotel/sequelize-hierarchy | lib/utils.js | replaceTableNames | function replaceTableNames(sql, identifiers, sequelize) {
const {queryInterface} = sequelize;
_.forIn(identifiers, (model, identifier) => {
const tableName = model.getTableName();
sql = sql.replace(
new RegExp(`\\*${identifier}(?![a-zA-Z0-9_])`, 'g'),
tableName.schema ? tableName.toString() : queryInterface... | javascript | function replaceTableNames(sql, identifiers, sequelize) {
const {queryInterface} = sequelize;
_.forIn(identifiers, (model, identifier) => {
const tableName = model.getTableName();
sql = sql.replace(
new RegExp(`\\*${identifier}(?![a-zA-Z0-9_])`, 'g'),
tableName.schema ? tableName.toString() : queryInterface... | [
"function",
"replaceTableNames",
"(",
"sql",
",",
"identifiers",
",",
"sequelize",
")",
"{",
"const",
"{",
"queryInterface",
"}",
"=",
"sequelize",
";",
"_",
".",
"forIn",
"(",
"identifiers",
",",
"(",
"model",
",",
"identifier",
")",
"=>",
"{",
"const",
... | Replace identifier with model's full table name taking schema into account | [
"Replace",
"identifier",
"with",
"model",
"s",
"full",
"table",
"name",
"taking",
"schema",
"into",
"account"
] | f1ec87beff0de4ae9df3db7d7bd67a2355e5a9b4 | https://github.com/overlookmotel/sequelize-hierarchy/blob/f1ec87beff0de4ae9df3db7d7bd67a2355e5a9b4/lib/utils.js#L50-L60 |
16,248 | overlookmotel/sequelize-hierarchy | lib/utils.js | addOptions | function addOptions(queryOptions, options) {
const {transaction, logging} = options;
if (transaction !== undefined) queryOptions.transaction = transaction;
if (logging !== undefined) queryOptions.logging = logging;
return queryOptions;
} | javascript | function addOptions(queryOptions, options) {
const {transaction, logging} = options;
if (transaction !== undefined) queryOptions.transaction = transaction;
if (logging !== undefined) queryOptions.logging = logging;
return queryOptions;
} | [
"function",
"addOptions",
"(",
"queryOptions",
",",
"options",
")",
"{",
"const",
"{",
"transaction",
",",
"logging",
"}",
"=",
"options",
";",
"if",
"(",
"transaction",
"!==",
"undefined",
")",
"queryOptions",
".",
"transaction",
"=",
"transaction",
";",
"i... | Add transaction and logging from options to query options | [
"Add",
"transaction",
"and",
"logging",
"from",
"options",
"to",
"query",
"options"
] | f1ec87beff0de4ae9df3db7d7bd67a2355e5a9b4 | https://github.com/overlookmotel/sequelize-hierarchy/blob/f1ec87beff0de4ae9df3db7d7bd67a2355e5a9b4/lib/utils.js#L74-L79 |
16,249 | overlookmotel/sequelize-hierarchy | lib/utils.js | inFields | function inFields(fieldName, options) {
const {fields} = options;
if (!fields) return true;
return fields.includes(fieldName);
} | javascript | function inFields(fieldName, options) {
const {fields} = options;
if (!fields) return true;
return fields.includes(fieldName);
} | [
"function",
"inFields",
"(",
"fieldName",
",",
"options",
")",
"{",
"const",
"{",
"fields",
"}",
"=",
"options",
";",
"if",
"(",
"!",
"fields",
")",
"return",
"true",
";",
"return",
"fields",
".",
"includes",
"(",
"fieldName",
")",
";",
"}"
] | Check if field is in `fields` option | [
"Check",
"if",
"field",
"is",
"in",
"fields",
"option"
] | f1ec87beff0de4ae9df3db7d7bd67a2355e5a9b4 | https://github.com/overlookmotel/sequelize-hierarchy/blob/f1ec87beff0de4ae9df3db7d7bd67a2355e5a9b4/lib/utils.js#L82-L86 |
16,250 | overlookmotel/sequelize-hierarchy | lib/utils.js | valueFilteredByFields | function valueFilteredByFields(fieldName, item, options) {
if (!inFields(fieldName, options)) return null;
return item.dataValues[fieldName];
} | javascript | function valueFilteredByFields(fieldName, item, options) {
if (!inFields(fieldName, options)) return null;
return item.dataValues[fieldName];
} | [
"function",
"valueFilteredByFields",
"(",
"fieldName",
",",
"item",
",",
"options",
")",
"{",
"if",
"(",
"!",
"inFields",
"(",
"fieldName",
",",
"options",
")",
")",
"return",
"null",
";",
"return",
"item",
".",
"dataValues",
"[",
"fieldName",
"]",
";",
... | Get field value if is included in `options.fields` | [
"Get",
"field",
"value",
"if",
"is",
"included",
"in",
"options",
".",
"fields"
] | f1ec87beff0de4ae9df3db7d7bd67a2355e5a9b4 | https://github.com/overlookmotel/sequelize-hierarchy/blob/f1ec87beff0de4ae9df3db7d7bd67a2355e5a9b4/lib/utils.js#L89-L92 |
16,251 | overlookmotel/sequelize-hierarchy | lib/utils.js | addToFields | function addToFields(fieldName, options) {
if (inFields(fieldName, options)) return;
options.fields = options.fields.concat([fieldName]);
} | javascript | function addToFields(fieldName, options) {
if (inFields(fieldName, options)) return;
options.fields = options.fields.concat([fieldName]);
} | [
"function",
"addToFields",
"(",
"fieldName",
",",
"options",
")",
"{",
"if",
"(",
"inFields",
"(",
"fieldName",
",",
"options",
")",
")",
"return",
";",
"options",
".",
"fields",
"=",
"options",
".",
"fields",
".",
"concat",
"(",
"[",
"fieldName",
"]",
... | Add a field to `options.fields`. NB Clones `options.fields` before adding to it, to avoid options being mutated externally. | [
"Add",
"a",
"field",
"to",
"options",
".",
"fields",
".",
"NB",
"Clones",
"options",
".",
"fields",
"before",
"adding",
"to",
"it",
"to",
"avoid",
"options",
"being",
"mutated",
"externally",
"."
] | f1ec87beff0de4ae9df3db7d7bd67a2355e5a9b4 | https://github.com/overlookmotel/sequelize-hierarchy/blob/f1ec87beff0de4ae9df3db7d7bd67a2355e5a9b4/lib/utils.js#L96-L99 |
16,252 | GameJs/gamejs | src/gamejs/thread.js | guid | function guid(moduleId) {
var S4 = function() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
};
return moduleId + '@' + (S4()+S4());
} | javascript | function guid(moduleId) {
var S4 = function() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
};
return moduleId + '@' + (S4()+S4());
} | [
"function",
"guid",
"(",
"moduleId",
")",
"{",
"var",
"S4",
"=",
"function",
"(",
")",
"{",
"return",
"(",
"(",
"(",
"1",
"+",
"Math",
".",
"random",
"(",
")",
")",
"*",
"0x10000",
")",
"|",
"0",
")",
".",
"toString",
"(",
"16",
")",
".",
"su... | not a real GUID
@ignore | [
"not",
"a",
"real",
"GUID"
] | f09bf3e27235e1ca7f029e30c7e9a05a74af6663 | https://github.com/GameJs/gamejs/blob/f09bf3e27235e1ca7f029e30c7e9a05a74af6663/src/gamejs/thread.js#L245-L250 |
16,253 | GameJs/gamejs | src/gamejs/event.js | w3cTouchConvert | function w3cTouchConvert(touchList) {
var canvasOffset = display._getCanvasOffset();
var tList = [];
for (var i = 0; i < touchList.length; i++) {
var touchEvent = touchList.item(i);
tList.push({
identifier: touchEvent.identifier,
pos: [touchEvent.clientX - can... | javascript | function w3cTouchConvert(touchList) {
var canvasOffset = display._getCanvasOffset();
var tList = [];
for (var i = 0; i < touchList.length; i++) {
var touchEvent = touchList.item(i);
tList.push({
identifier: touchEvent.identifier,
pos: [touchEvent.clientX - can... | [
"function",
"w3cTouchConvert",
"(",
"touchList",
")",
"{",
"var",
"canvasOffset",
"=",
"display",
".",
"_getCanvasOffset",
"(",
")",
";",
"var",
"tList",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"touchList",
".",
"length",
... | convert a w3c touch event into gamejs event | [
"convert",
"a",
"w3c",
"touch",
"event",
"into",
"gamejs",
"event"
] | f09bf3e27235e1ca7f029e30c7e9a05a74af6663 | https://github.com/GameJs/gamejs/blob/f09bf3e27235e1ca7f029e30c7e9a05a74af6663/src/gamejs/event.js#L489-L500 |
16,254 | GameJs/gamejs | examples/threaded-noise/noise-worker.js | function(dimensions) {
var simplex = new gamejs.math.noise.Simplex(Math);
var surfaceData = [];
for (var i=0;i<dimensions[0];i++) {
surfaceData[i] = [];
for (var j=0;j<dimensions[1];j++) {
var val = simplex.get(i/50, j/50) * 255;
surfaceData[i][j] = val;
}
}
return sur... | javascript | function(dimensions) {
var simplex = new gamejs.math.noise.Simplex(Math);
var surfaceData = [];
for (var i=0;i<dimensions[0];i++) {
surfaceData[i] = [];
for (var j=0;j<dimensions[1];j++) {
var val = simplex.get(i/50, j/50) * 255;
surfaceData[i][j] = val;
}
}
return sur... | [
"function",
"(",
"dimensions",
")",
"{",
"var",
"simplex",
"=",
"new",
"gamejs",
".",
"math",
".",
"noise",
".",
"Simplex",
"(",
"Math",
")",
";",
"var",
"surfaceData",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"dimensi... | create array with noise data to display | [
"create",
"array",
"with",
"noise",
"data",
"to",
"display"
] | f09bf3e27235e1ca7f029e30c7e9a05a74af6663 | https://github.com/GameJs/gamejs/blob/f09bf3e27235e1ca7f029e30c7e9a05a74af6663/examples/threaded-noise/noise-worker.js#L5-L16 | |
16,255 | GameJs/gamejs | examples/touch/main.js | colorForTouch | function colorForTouch(touch) {
var id = touch.identifier + (100 * Math.random());
var r = Math.floor(id % 16);
var g = Math.floor(id / 3) % 16;
var b = Math.floor(id / 7) % 16;
r = r.toString(16);
g = g.toString(16);
b = b.toString(16);
var color = "#" + r + g + b;
gamejs.logging.log(color)
return... | javascript | function colorForTouch(touch) {
var id = touch.identifier + (100 * Math.random());
var r = Math.floor(id % 16);
var g = Math.floor(id / 3) % 16;
var b = Math.floor(id / 7) % 16;
r = r.toString(16);
g = g.toString(16);
b = b.toString(16);
var color = "#" + r + g + b;
gamejs.logging.log(color)
return... | [
"function",
"colorForTouch",
"(",
"touch",
")",
"{",
"var",
"id",
"=",
"touch",
".",
"identifier",
"+",
"(",
"100",
"*",
"Math",
".",
"random",
"(",
")",
")",
";",
"var",
"r",
"=",
"Math",
".",
"floor",
"(",
"id",
"%",
"16",
")",
";",
"var",
"g... | create random color from touch identifier | [
"create",
"random",
"color",
"from",
"touch",
"identifier"
] | f09bf3e27235e1ca7f029e30c7e9a05a74af6663 | https://github.com/GameJs/gamejs/blob/f09bf3e27235e1ca7f029e30c7e9a05a74af6663/examples/touch/main.js#L11-L22 |
16,256 | GameJs/gamejs | utils/qunit/qunit-close-enough.js | function(actual, expected, maxDifference, message) {
var passes = (actual === expected) || Math.abs(actual - expected) <= maxDifference;
QUnit.push(passes, actual, expected, message);
} | javascript | function(actual, expected, maxDifference, message) {
var passes = (actual === expected) || Math.abs(actual - expected) <= maxDifference;
QUnit.push(passes, actual, expected, message);
} | [
"function",
"(",
"actual",
",",
"expected",
",",
"maxDifference",
",",
"message",
")",
"{",
"var",
"passes",
"=",
"(",
"actual",
"===",
"expected",
")",
"||",
"Math",
".",
"abs",
"(",
"actual",
"-",
"expected",
")",
"<=",
"maxDifference",
";",
"QUnit",
... | Checks that the first two arguments are equal, or are numbers close enough to be considered equal
based on a specified maximum allowable difference.
@example close(3.141, Math.PI, 0.001);
@param Number actual
@param Number expected
@param Number maxDifference (the maximum inclusive difference allowed between the actu... | [
"Checks",
"that",
"the",
"first",
"two",
"arguments",
"are",
"equal",
"or",
"are",
"numbers",
"close",
"enough",
"to",
"be",
"considered",
"equal",
"based",
"on",
"a",
"specified",
"maximum",
"allowable",
"difference",
"."
] | f09bf3e27235e1ca7f029e30c7e9a05a74af6663 | https://github.com/GameJs/gamejs/blob/f09bf3e27235e1ca7f029e30c7e9a05a74af6663/utils/qunit/qunit-close-enough.js#L13-L16 | |
16,257 | GameJs/gamejs | utils/qunit/qunit-close-enough.js | function(actual, expected, minDifference, message) {
var passes = Math.abs(actual - expected) > minDifference;
ok(passes);
QUnit.push(passes, actual, expected, message);
} | javascript | function(actual, expected, minDifference, message) {
var passes = Math.abs(actual - expected) > minDifference;
ok(passes);
QUnit.push(passes, actual, expected, message);
} | [
"function",
"(",
"actual",
",",
"expected",
",",
"minDifference",
",",
"message",
")",
"{",
"var",
"passes",
"=",
"Math",
".",
"abs",
"(",
"actual",
"-",
"expected",
")",
">",
"minDifference",
";",
"ok",
"(",
"passes",
")",
";",
"QUnit",
".",
"push",
... | Checks that the first two arguments are numbers with differences greater than the specified
minimum difference.
@example notClose(3.1, Math.PI, 0.001);
@param Number actual
@param Number expected
@param Number minDifference (the minimum exclusive difference allowed between the actual and expected numbers)
@param Stri... | [
"Checks",
"that",
"the",
"first",
"two",
"arguments",
"are",
"numbers",
"with",
"differences",
"greater",
"than",
"the",
"specified",
"minimum",
"difference",
"."
] | f09bf3e27235e1ca7f029e30c7e9a05a74af6663 | https://github.com/GameJs/gamejs/blob/f09bf3e27235e1ca7f029e30c7e9a05a74af6663/utils/qunit/qunit-close-enough.js#L29-L33 | |
16,258 | GameJs/gamejs | examples/minimal/main.js | Ball | function Ball(center) {
this.center = center;
this.growPerSec = Ball.GROW_PER_SEC;
this.radius = this.growPerSec * 2;
this.color = 0;
return this;
} | javascript | function Ball(center) {
this.center = center;
this.growPerSec = Ball.GROW_PER_SEC;
this.radius = this.growPerSec * 2;
this.color = 0;
return this;
} | [
"function",
"Ball",
"(",
"center",
")",
"{",
"this",
".",
"center",
"=",
"center",
";",
"this",
".",
"growPerSec",
"=",
"Ball",
".",
"GROW_PER_SEC",
";",
"this",
".",
"radius",
"=",
"this",
".",
"growPerSec",
"*",
"2",
";",
"this",
".",
"color",
"=",... | ball is a colored circle. ball can circle through color list. ball constantly pulsates in size. | [
"ball",
"is",
"a",
"colored",
"circle",
".",
"ball",
"can",
"circle",
"through",
"color",
"list",
".",
"ball",
"constantly",
"pulsates",
"in",
"size",
"."
] | f09bf3e27235e1ca7f029e30c7e9a05a74af6663 | https://github.com/GameJs/gamejs/blob/f09bf3e27235e1ca7f029e30c7e9a05a74af6663/examples/minimal/main.js#L15-L21 |
16,259 | GameJs/gamejs | src/gamejs/display.js | function(event) {
var wrapper = getCanvas();
wrapper.requestFullScreen = wrapper.requestFullScreen || wrapper.mozRequestFullScreen || wrapper.webkitRequestFullScreen;
if (!wrapper.requestFullScreen) {
return false;
}
// @xbrowser chrome allows keboard input onl if ask for it (why oh why?)
if (El... | javascript | function(event) {
var wrapper = getCanvas();
wrapper.requestFullScreen = wrapper.requestFullScreen || wrapper.mozRequestFullScreen || wrapper.webkitRequestFullScreen;
if (!wrapper.requestFullScreen) {
return false;
}
// @xbrowser chrome allows keboard input onl if ask for it (why oh why?)
if (El... | [
"function",
"(",
"event",
")",
"{",
"var",
"wrapper",
"=",
"getCanvas",
"(",
")",
";",
"wrapper",
".",
"requestFullScreen",
"=",
"wrapper",
".",
"requestFullScreen",
"||",
"wrapper",
".",
"mozRequestFullScreen",
"||",
"wrapper",
".",
"webkitRequestFullScreen",
"... | Switches the display window normal browser mode and fullscreen.
@ignore
@returns {Boolean} true if operation was successfull, false otherwise | [
"Switches",
"the",
"display",
"window",
"normal",
"browser",
"mode",
"and",
"fullscreen",
"."
] | f09bf3e27235e1ca7f029e30c7e9a05a74af6663 | https://github.com/GameJs/gamejs/blob/f09bf3e27235e1ca7f029e30c7e9a05a74af6663/src/gamejs/display.js#L189-L202 | |
16,260 | JedWatson/react-tappable | dist/react-tappable.js | function (name, func, context, a, b, c, d, e, f) {
invokeGuardedCallback$1.apply(ReactErrorUtils, arguments);
} | javascript | function (name, func, context, a, b, c, d, e, f) {
invokeGuardedCallback$1.apply(ReactErrorUtils, arguments);
} | [
"function",
"(",
"name",
",",
"func",
",",
"context",
",",
"a",
",",
"b",
",",
"c",
",",
"d",
",",
"e",
",",
"f",
")",
"{",
"invokeGuardedCallback$1",
".",
"apply",
"(",
"ReactErrorUtils",
",",
"arguments",
")",
";",
"}"
] | Call a function while guarding against errors that happens within it.
Returns an error if it throws, otherwise null.
In production, this is implemented using a try-catch. The reason we don't
use a try-catch directly is so that we can swap out a different
implementation in DEV mode.
@param {String} name of the guard t... | [
"Call",
"a",
"function",
"while",
"guarding",
"against",
"errors",
"that",
"happens",
"within",
"it",
".",
"Returns",
"an",
"error",
"if",
"it",
"throws",
"otherwise",
"null",
"."
] | c7a05f03f354c7556a413a6d270544629fd50ab7 | https://github.com/JedWatson/react-tappable/blob/c7a05f03f354c7556a413a6d270544629fd50ab7/dist/react-tappable.js#L2680-L2682 | |
16,261 | JedWatson/react-tappable | dist/react-tappable.js | accumulateTwoPhaseDispatchesSingleSkipTarget | function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
var targetInst = event._targetInst;
var parentInst = targetInst ? getParentInstance(targetInst) : null;
traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
}
} | javascript | function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
var targetInst = event._targetInst;
var parentInst = targetInst ? getParentInstance(targetInst) : null;
traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
}
} | [
"function",
"accumulateTwoPhaseDispatchesSingleSkipTarget",
"(",
"event",
")",
"{",
"if",
"(",
"event",
"&&",
"event",
".",
"dispatchConfig",
".",
"phasedRegistrationNames",
")",
"{",
"var",
"targetInst",
"=",
"event",
".",
"_targetInst",
";",
"var",
"parentInst",
... | Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. | [
"Same",
"as",
"accumulateTwoPhaseDispatchesSingle",
"but",
"skips",
"over",
"the",
"targetID",
"."
] | c7a05f03f354c7556a413a6d270544629fd50ab7 | https://github.com/JedWatson/react-tappable/blob/c7a05f03f354c7556a413a6d270544629fd50ab7/dist/react-tappable.js#L3524-L3530 |
16,262 | JedWatson/react-tappable | dist/react-tappable.js | getPooledWarningPropertyDefinition | function getPooledWarningPropertyDefinition(propName, getVal) {
var isFunction = typeof getVal === 'function';
return {
configurable: true,
set: set,
get: get
};
function set(val) {
var action = isFunction ? 'setting the method' : 'setting the property';
warn(action, 'This is effectively a ... | javascript | function getPooledWarningPropertyDefinition(propName, getVal) {
var isFunction = typeof getVal === 'function';
return {
configurable: true,
set: set,
get: get
};
function set(val) {
var action = isFunction ? 'setting the method' : 'setting the property';
warn(action, 'This is effectively a ... | [
"function",
"getPooledWarningPropertyDefinition",
"(",
"propName",
",",
"getVal",
")",
"{",
"var",
"isFunction",
"=",
"typeof",
"getVal",
"===",
"'function'",
";",
"return",
"{",
"configurable",
":",
"true",
",",
"set",
":",
"set",
",",
"get",
":",
"get",
"}... | Helper to nullify syntheticEvent instance properties when destructing
@param {String} propName
@param {?object} getVal
@return {object} defineProperty object | [
"Helper",
"to",
"nullify",
"syntheticEvent",
"instance",
"properties",
"when",
"destructing"
] | c7a05f03f354c7556a413a6d270544629fd50ab7 | https://github.com/JedWatson/react-tappable/blob/c7a05f03f354c7556a413a6d270544629fd50ab7/dist/react-tappable.js#L3891-L3916 |
16,263 | JedWatson/react-tappable | dist/react-tappable.js | isEventSupported | function isEventSupported(eventNameSuffix, capture) {
if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
return false;
}
var eventName = 'on' + eventNameSuffix;
var isSupported = eventName in document;
if (!isSupported) {
var element = document.createElement('div'... | javascript | function isEventSupported(eventNameSuffix, capture) {
if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
return false;
}
var eventName = 'on' + eventNameSuffix;
var isSupported = eventName in document;
if (!isSupported) {
var element = document.createElement('div'... | [
"function",
"isEventSupported",
"(",
"eventNameSuffix",
",",
"capture",
")",
"{",
"if",
"(",
"!",
"ExecutionEnvironment",
".",
"canUseDOM",
"||",
"capture",
"&&",
"!",
"(",
"'addEventListener'",
"in",
"document",
")",
")",
"{",
"return",
"false",
";",
"}",
"... | Checks if an event is supported in the current execution environment.
NOTE: This will not work correctly for non-generic events such as `change`,
`reset`, `load`, `error`, and `select`.
Borrows from Modernizr.
@param {string} eventNameSuffix Event name, e.g. "click".
@param {?boolean} capture Check if the capture ph... | [
"Checks",
"if",
"an",
"event",
"is",
"supported",
"in",
"the",
"current",
"execution",
"environment",
"."
] | c7a05f03f354c7556a413a6d270544629fd50ab7 | https://github.com/JedWatson/react-tappable/blob/c7a05f03f354c7556a413a6d270544629fd50ab7/dist/react-tappable.js#L4544-L4559 |
16,264 | JedWatson/react-tappable | dist/react-tappable.js | function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
// Must not be a mouse in or mouse out - ... | javascript | function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
// Must not be a mouse in or mouse out - ... | [
"function",
"(",
"topLevelType",
",",
"targetInst",
",",
"nativeEvent",
",",
"nativeEventTarget",
")",
"{",
"if",
"(",
"topLevelType",
"===",
"'topMouseOver'",
"&&",
"(",
"nativeEvent",
".",
"relatedTarget",
"||",
"nativeEvent",
".",
"fromElement",
")",
")",
"{"... | For almost every interaction we care about, there will be both a top-level
`mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
we do not extract duplicate events. However, moving the mouse into the
browser from outside will not fire a `mouseout` event. In this case, we use
the `mouseover` top-leve... | [
"For",
"almost",
"every",
"interaction",
"we",
"care",
"about",
"there",
"will",
"be",
"both",
"a",
"top",
"-",
"level",
"mouseover",
"and",
"mouseout",
"event",
"that",
"occurs",
".",
"Only",
"use",
"mouseout",
"so",
"that",
"we",
"do",
"not",
"extract",
... | c7a05f03f354c7556a413a6d270544629fd50ab7 | https://github.com/JedWatson/react-tappable/blob/c7a05f03f354c7556a413a6d270544629fd50ab7/dist/react-tappable.js#L5829-L5885 | |
16,265 | JedWatson/react-tappable | dist/react-tappable.js | trapBubbledEvent | function trapBubbledEvent(topLevelType, handlerBaseName, element) {
if (!element) {
return null;
}
var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
addEventBubbleListener(element, handlerBaseName,
// Check if interactive and wrap in interactiveUpdate... | javascript | function trapBubbledEvent(topLevelType, handlerBaseName, element) {
if (!element) {
return null;
}
var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
addEventBubbleListener(element, handlerBaseName,
// Check if interactive and wrap in interactiveUpdate... | [
"function",
"trapBubbledEvent",
"(",
"topLevelType",
",",
"handlerBaseName",
",",
"element",
")",
"{",
"if",
"(",
"!",
"element",
")",
"{",
"return",
"null",
";",
"}",
"var",
"dispatch",
"=",
"isInteractiveTopLevelEventType",
"(",
"topLevelType",
")",
"?",
"di... | Traps top-level events by using event bubbling.
@param {string} topLevelType Record from `BrowserEventConstants`.
@param {string} handlerBaseName Event name (e.g. "click").
@param {object} element Element on which to attach listener.
@return {?object} An object with a remove function which will forcefully
remove the l... | [
"Traps",
"top",
"-",
"level",
"events",
"by",
"using",
"event",
"bubbling",
"."
] | c7a05f03f354c7556a413a6d270544629fd50ab7 | https://github.com/JedWatson/react-tappable/blob/c7a05f03f354c7556a413a6d270544629fd50ab7/dist/react-tappable.js#L6713-L6722 |
16,266 | JedWatson/react-tappable | dist/react-tappable.js | trapCapturedEvent | function trapCapturedEvent(topLevelType, handlerBaseName, element) {
if (!element) {
return null;
}
var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
addEventCaptureListener(element, handlerBaseName,
// Check if interactive and wrap in interactiveUpda... | javascript | function trapCapturedEvent(topLevelType, handlerBaseName, element) {
if (!element) {
return null;
}
var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
addEventCaptureListener(element, handlerBaseName,
// Check if interactive and wrap in interactiveUpda... | [
"function",
"trapCapturedEvent",
"(",
"topLevelType",
",",
"handlerBaseName",
",",
"element",
")",
"{",
"if",
"(",
"!",
"element",
")",
"{",
"return",
"null",
";",
"}",
"var",
"dispatch",
"=",
"isInteractiveTopLevelEventType",
"(",
"topLevelType",
")",
"?",
"d... | Traps a top-level event by using event capturing.
@param {string} topLevelType Record from `BrowserEventConstants`.
@param {string} handlerBaseName Event name (e.g. "click").
@param {object} element Element on which to attach listener.
@return {?object} An object with a remove function which will forcefully
remove the... | [
"Traps",
"a",
"top",
"-",
"level",
"event",
"by",
"using",
"event",
"capturing",
"."
] | c7a05f03f354c7556a413a6d270544629fd50ab7 | https://github.com/JedWatson/react-tappable/blob/c7a05f03f354c7556a413a6d270544629fd50ab7/dist/react-tappable.js#L6734-L6743 |
16,267 | JedWatson/react-tappable | dist/react-tappable.js | computeUniqueAsyncExpiration | function computeUniqueAsyncExpiration() {
var currentTime = recalculateCurrentTime();
var result = computeAsyncExpiration(currentTime);
if (result <= lastUniqueAsyncExpiration) {
// Since we assume the current time monotonically increases, we only hit
// this branch when computeUniqueAsyncExpira... | javascript | function computeUniqueAsyncExpiration() {
var currentTime = recalculateCurrentTime();
var result = computeAsyncExpiration(currentTime);
if (result <= lastUniqueAsyncExpiration) {
// Since we assume the current time monotonically increases, we only hit
// this branch when computeUniqueAsyncExpira... | [
"function",
"computeUniqueAsyncExpiration",
"(",
")",
"{",
"var",
"currentTime",
"=",
"recalculateCurrentTime",
"(",
")",
";",
"var",
"result",
"=",
"computeAsyncExpiration",
"(",
"currentTime",
")",
";",
"if",
"(",
"result",
"<=",
"lastUniqueAsyncExpiration",
")",
... | Creates a unique async expiration time. | [
"Creates",
"a",
"unique",
"async",
"expiration",
"time",
"."
] | c7a05f03f354c7556a413a6d270544629fd50ab7 | https://github.com/JedWatson/react-tappable/blob/c7a05f03f354c7556a413a6d270544629fd50ab7/dist/react-tappable.js#L14383-L14394 |
16,268 | JedWatson/react-tappable | dist/react-tappable.js | function (config) {
var getPublicInstance = config.getPublicInstance;
var _ReactFiberScheduler = ReactFiberScheduler(config),
computeUniqueAsyncExpiration = _ReactFiberScheduler.computeUniqueAsyncExpiration,
recalculateCurrentTime = _ReactFiberScheduler.recalculateCurrentTime,
computeExpirationFo... | javascript | function (config) {
var getPublicInstance = config.getPublicInstance;
var _ReactFiberScheduler = ReactFiberScheduler(config),
computeUniqueAsyncExpiration = _ReactFiberScheduler.computeUniqueAsyncExpiration,
recalculateCurrentTime = _ReactFiberScheduler.recalculateCurrentTime,
computeExpirationFo... | [
"function",
"(",
"config",
")",
"{",
"var",
"getPublicInstance",
"=",
"config",
".",
"getPublicInstance",
";",
"var",
"_ReactFiberScheduler",
"=",
"ReactFiberScheduler",
"(",
"config",
")",
",",
"computeUniqueAsyncExpiration",
"=",
"_ReactFiberScheduler",
".",
"comput... | 0 is PROD, 1 is DEV. Might add PROFILE later. | [
"0",
"is",
"PROD",
"1",
"is",
"DEV",
".",
"Might",
"add",
"PROFILE",
"later",
"."
] | c7a05f03f354c7556a413a6d270544629fd50ab7 | https://github.com/JedWatson/react-tappable/blob/c7a05f03f354c7556a413a6d270544629fd50ab7/dist/react-tappable.js#L15011-L15186 | |
16,269 | JedWatson/react-tappable | dist/react-tappable.js | validateFragmentProps | function validateFragmentProps(fragment) {
currentlyValidatingElement = fragment;
var keys = Object.keys(fragment.props);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (!VALID_FRAGMENT_PROPS.has(key)) {
warning(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragm... | javascript | function validateFragmentProps(fragment) {
currentlyValidatingElement = fragment;
var keys = Object.keys(fragment.props);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (!VALID_FRAGMENT_PROPS.has(key)) {
warning(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragm... | [
"function",
"validateFragmentProps",
"(",
"fragment",
")",
"{",
"currentlyValidatingElement",
"=",
"fragment",
";",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"fragment",
".",
"props",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"keys... | Given a fragment, validate that it can only be provided with fragment props
@param {ReactElement} fragment | [
"Given",
"a",
"fragment",
"validate",
"that",
"it",
"can",
"only",
"be",
"provided",
"with",
"fragment",
"props"
] | c7a05f03f354c7556a413a6d270544629fd50ab7 | https://github.com/JedWatson/react-tappable/blob/c7a05f03f354c7556a413a6d270544629fd50ab7/dist/react-tappable.js#L20550-L20567 |
16,270 | codex-team/js-notifier | src/notifier.js | show | function show(options) {
if (!options.message) {
return;
}
prepare_();
let notify = null;
const time = options.time || 8000;
switch (options.type) {
case 'confirm':
notify = draw.confirm(options);
break;
case 'prompt':
notify = draw.prompt(options);... | javascript | function show(options) {
if (!options.message) {
return;
}
prepare_();
let notify = null;
const time = options.time || 8000;
switch (options.type) {
case 'confirm':
notify = draw.confirm(options);
break;
case 'prompt':
notify = draw.prompt(options);... | [
"function",
"show",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"message",
")",
"{",
"return",
";",
"}",
"prepare_",
"(",
")",
";",
"let",
"notify",
"=",
"null",
";",
"const",
"time",
"=",
"options",
".",
"time",
"||",
"8000",
";",
... | Show new notification
@param {NotificationOptions | ConfirmNotificationOptions | PromptNotificationOptions} options | [
"Show",
"new",
"notification"
] | d000792c90bbde682d438b3554f3b9c8f6ddcb95 | https://github.com/codex-team/js-notifier/blob/d000792c90bbde682d438b3554f3b9c8f6ddcb95/src/notifier.js#L35-L65 |
16,271 | KhaledMohamedP/translate-json-object | lib/translate-json-object.js | init | function init(options) {
setting = options || {};
if (!setting.googleApiKey && !setting.yandexApiKey) {
console.warn(constant.ERROR.MISSING_TOKEN);
return false;
} else if (setting.yandexApiKey) {
serviceType = constant.YANDEX_NAME;
translateSrv = require('./service/yandex.js');
} else {
service... | javascript | function init(options) {
setting = options || {};
if (!setting.googleApiKey && !setting.yandexApiKey) {
console.warn(constant.ERROR.MISSING_TOKEN);
return false;
} else if (setting.yandexApiKey) {
serviceType = constant.YANDEX_NAME;
translateSrv = require('./service/yandex.js');
} else {
service... | [
"function",
"init",
"(",
"options",
")",
"{",
"setting",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"setting",
".",
"googleApiKey",
"&&",
"!",
"setting",
".",
"yandexApiKey",
")",
"{",
"console",
".",
"warn",
"(",
"constant",
".",
"ERROR",
... | init - Initialize the setting of your module instance, it takes a setting object
@param {Object} options
@return {boolean} indicate if the module is configured properly | [
"init",
"-",
"Initialize",
"the",
"setting",
"of",
"your",
"module",
"instance",
"it",
"takes",
"a",
"setting",
"object"
] | f1f0297614ed0f942921ab66ea788d6602e14b60 | https://github.com/KhaledMohamedP/translate-json-object/blob/f1f0297614ed0f942921ab66ea788d6602e14b60/lib/translate-json-object.js#L26-L42 |
16,272 | redhivesoftware/math-expression-evaluator | src/math_function.js | function (x) {
return (Mexp.math.isDegree ? 180 / Math.PI * Math.acos(x) : Math.acos(x))
} | javascript | function (x) {
return (Mexp.math.isDegree ? 180 / Math.PI * Math.acos(x) : Math.acos(x))
} | [
"function",
"(",
"x",
")",
"{",
"return",
"(",
"Mexp",
".",
"math",
".",
"isDegree",
"?",
"180",
"/",
"Math",
".",
"PI",
"*",
"Math",
".",
"acos",
"(",
"x",
")",
":",
"Math",
".",
"acos",
"(",
"x",
")",
")",
"}"
] | mode of calculator | [
"mode",
"of",
"calculator"
] | 8a12b393714235f8826376b958edade7c6965bb7 | https://github.com/redhivesoftware/math-expression-evaluator/blob/8a12b393714235f8826376b958edade7c6965bb7/src/math_function.js#L7-L9 | |
16,273 | TheCocoaProject/cordova-plugin-nativestorage | www/mainHandle.js | StorageHandle | function StorageHandle() {
this.storageSupport = storageSupportAnalyse();
switch (this.storageSupport) {
case 0:
var exec = require('cordova/exec');
this.storageHandlerDelegate = exec;
break;
case 1:
var localStorageHandle = require('./LocalStorageHandle');
this.storageHandlerD... | javascript | function StorageHandle() {
this.storageSupport = storageSupportAnalyse();
switch (this.storageSupport) {
case 0:
var exec = require('cordova/exec');
this.storageHandlerDelegate = exec;
break;
case 1:
var localStorageHandle = require('./LocalStorageHandle');
this.storageHandlerD... | [
"function",
"StorageHandle",
"(",
")",
"{",
"this",
".",
"storageSupport",
"=",
"storageSupportAnalyse",
"(",
")",
";",
"switch",
"(",
"this",
".",
"storageSupport",
")",
"{",
"case",
"0",
":",
"var",
"exec",
"=",
"require",
"(",
"'cordova/exec'",
")",
";"... | if storage not available gracefully fails, no error message for now | [
"if",
"storage",
"not",
"available",
"gracefully",
"fails",
"no",
"error",
"message",
"for",
"now"
] | 12aea3dfe4976c2ecb3e91dc951bd5af0cdd90df | https://github.com/TheCocoaProject/cordova-plugin-nativestorage/blob/12aea3dfe4976c2ecb3e91dc951bd5af0cdd90df/www/mainHandle.js#L26-L44 |
16,274 | mapbox/timespace | index.js | getFuzzyLocalTimeFromPoint | function getFuzzyLocalTimeFromPoint(timestamp, point) {
var tile = tilebelt.pointToTile(point[0], point[1], z).join('/');
var locale = tiles[tile];
if (locale) return moment.tz(new Date(timestamp), locale);
else return undefined;
} | javascript | function getFuzzyLocalTimeFromPoint(timestamp, point) {
var tile = tilebelt.pointToTile(point[0], point[1], z).join('/');
var locale = tiles[tile];
if (locale) return moment.tz(new Date(timestamp), locale);
else return undefined;
} | [
"function",
"getFuzzyLocalTimeFromPoint",
"(",
"timestamp",
",",
"point",
")",
"{",
"var",
"tile",
"=",
"tilebelt",
".",
"pointToTile",
"(",
"point",
"[",
"0",
"]",
",",
"point",
"[",
"1",
"]",
",",
"z",
")",
".",
"join",
"(",
"'/'",
")",
";",
"var",... | Returns the local time at the point of interest.
@param {Integer} timestamp a unix timestamp
@param {Array} point a [lng, lat] point of interest
@return {Object} a moment-timezone object | [
"Returns",
"the",
"local",
"time",
"at",
"the",
"point",
"of",
"interest",
"."
] | dab5368face8c355debff951bfbfd8d2b55b6686 | https://github.com/mapbox/timespace/blob/dab5368face8c355debff951bfbfd8d2b55b6686/index.js#L22-L28 |
16,275 | mapbox/timespace | index.js | getFuzzyTimezoneFromTile | function getFuzzyTimezoneFromTile(tile) {
if (tile[2] === z) {
var key = tile.join('/');
if (key in tiles) return tiles[key];
else throw new Error('tile not found');
} else if (tile[2] > z) {
// higher zoom level (9, 10, 11, ...)
key = _getParent(tile).join('/');
if (key in tiles) return ti... | javascript | function getFuzzyTimezoneFromTile(tile) {
if (tile[2] === z) {
var key = tile.join('/');
if (key in tiles) return tiles[key];
else throw new Error('tile not found');
} else if (tile[2] > z) {
// higher zoom level (9, 10, 11, ...)
key = _getParent(tile).join('/');
if (key in tiles) return ti... | [
"function",
"getFuzzyTimezoneFromTile",
"(",
"tile",
")",
"{",
"if",
"(",
"tile",
"[",
"2",
"]",
"===",
"z",
")",
"{",
"var",
"key",
"=",
"tile",
".",
"join",
"(",
"'/'",
")",
";",
"if",
"(",
"key",
"in",
"tiles",
")",
"return",
"tiles",
"[",
"ke... | Retrieves the timezone of the tile of interest at z8-level accuracy.
@param {Array} tile [x, y, z] coordinate of a tile
@return {String} timezone for the tile | [
"Retrieves",
"the",
"timezone",
"of",
"the",
"tile",
"of",
"interest",
"at",
"z8",
"-",
"level",
"accuracy",
"."
] | dab5368face8c355debff951bfbfd8d2b55b6686 | https://github.com/mapbox/timespace/blob/dab5368face8c355debff951bfbfd8d2b55b6686/index.js#L35-L70 |
16,276 | Slynova-Org/flydrive | src/Drivers/LocalFileSystem.js | isReadableStream | function isReadableStream (stream) {
return stream !== null
&& typeof (stream) === 'object'
&& typeof (stream.pipe) === 'function'
&& typeof (stream._read) === 'function'
&& typeof (stream._readableState) === 'object'
&& stream.readable !== false
} | javascript | function isReadableStream (stream) {
return stream !== null
&& typeof (stream) === 'object'
&& typeof (stream.pipe) === 'function'
&& typeof (stream._read) === 'function'
&& typeof (stream._readableState) === 'object'
&& stream.readable !== false
} | [
"function",
"isReadableStream",
"(",
"stream",
")",
"{",
"return",
"stream",
"!==",
"null",
"&&",
"typeof",
"(",
"stream",
")",
"===",
"'object'",
"&&",
"typeof",
"(",
"stream",
".",
"pipe",
")",
"===",
"'function'",
"&&",
"typeof",
"(",
"stream",
".",
"... | Returns a boolean indication if stream param
is a readable stream or not.
@param {*} stream
@return {Boolean} | [
"Returns",
"a",
"boolean",
"indication",
"if",
"stream",
"param",
"is",
"a",
"readable",
"stream",
"or",
"not",
"."
] | c1025a1b285efc9b879952a63fb8ec9bce7ac36b | https://github.com/Slynova-Org/flydrive/blob/c1025a1b285efc9b879952a63fb8ec9bce7ac36b/src/Drivers/LocalFileSystem.js#L23-L30 |
16,277 | oxygenhq/oxygen | ox_modules/module-mailinator.js | wait | function wait() {
var isDone = false;
var start = new Date().getTime();
var interval = setInterval(() => {
var now = new Date().getTime();
if ((now - start) >= _retryInterval){
clearInterval(interval);
isDone = true;
}
... | javascript | function wait() {
var isDone = false;
var start = new Date().getTime();
var interval = setInterval(() => {
var now = new Date().getTime();
if ((now - start) >= _retryInterval){
clearInterval(interval);
isDone = true;
}
... | [
"function",
"wait",
"(",
")",
"{",
"var",
"isDone",
"=",
"false",
";",
"var",
"start",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
";",
"var",
"interval",
"=",
"setInterval",
"(",
"(",
")",
"=>",
"{",
"var",
"now",
"=",
"new",
"Date",... | wait synchronously in a non-blocking manner | [
"wait",
"synchronously",
"in",
"a",
"non",
"-",
"blocking",
"manner"
] | b1c4be3360363091df89558dbbfb7f6d9d8efd71 | https://github.com/oxygenhq/oxygen/blob/b1c4be3360363091df89558dbbfb7f6d9d8efd71/ox_modules/module-mailinator.js#L33-L46 |
16,278 | oxygenhq/oxygen | ox_modules/module-mob/commands/clickHidden.js | function(elms, clickParent) {
var elm = elms && elms.length > 0 ? elms[0] : null;
if (!elm) {
return;
}
/*global document*/
var clck_ev = document.createEvent('MouseEvent');
clck_ev.initEvent('click', true, true);
if (clickParent) {
elm.par... | javascript | function(elms, clickParent) {
var elm = elms && elms.length > 0 ? elms[0] : null;
if (!elm) {
return;
}
/*global document*/
var clck_ev = document.createEvent('MouseEvent');
clck_ev.initEvent('click', true, true);
if (clickParent) {
elm.par... | [
"function",
"(",
"elms",
",",
"clickParent",
")",
"{",
"var",
"elm",
"=",
"elms",
"&&",
"elms",
".",
"length",
">",
"0",
"?",
"elms",
"[",
"0",
"]",
":",
"null",
";",
"if",
"(",
"!",
"elm",
")",
"{",
"return",
";",
"}",
"/*global document*/",
"va... | click hidden function | [
"click",
"hidden",
"function"
] | b1c4be3360363091df89558dbbfb7f6d9d8efd71 | https://github.com/oxygenhq/oxygen/blob/b1c4be3360363091df89558dbbfb7f6d9d8efd71/ox_modules/module-mob/commands/clickHidden.js#L24-L37 | |
16,279 | AleksandrRogov/DynamicsWebApi | lib/utilities/RequestConverter.js | convertRequest | function convertRequest(request, functionName, config) {
var url = '';
var result;
if (!request.url) {
if (!request._unboundRequest && !request.collection) {
ErrorHelper.parameterCheck(request.collection, 'DynamicsWebApi.' + functionName, "request.collection");
}
if (requ... | javascript | function convertRequest(request, functionName, config) {
var url = '';
var result;
if (!request.url) {
if (!request._unboundRequest && !request.collection) {
ErrorHelper.parameterCheck(request.collection, 'DynamicsWebApi.' + functionName, "request.collection");
}
if (requ... | [
"function",
"convertRequest",
"(",
"request",
",",
"functionName",
",",
"config",
")",
"{",
"var",
"url",
"=",
"''",
";",
"var",
"result",
";",
"if",
"(",
"!",
"request",
".",
"url",
")",
"{",
"if",
"(",
"!",
"request",
".",
"_unboundRequest",
"&&",
... | Converts a request object to URL link
@param {Object} request - Request object
@param {string} [functionName] - Name of the function that converts a request (for Error Handling only)
@param {Object} [config] - DynamicsWebApi config
@returns {ConvertedRequest} Converted request | [
"Converts",
"a",
"request",
"object",
"to",
"URL",
"link"
] | 3ef9e2a010bafe439d71774325adc0b317024e5a | https://github.com/AleksandrRogov/DynamicsWebApi/blob/3ef9e2a010bafe439d71774325adc0b317024e5a/lib/utilities/RequestConverter.js#L208-L264 |
16,280 | AleksandrRogov/DynamicsWebApi | lib/requests/sendRequest.js | findCollectionName | function findCollectionName(entityName) {
var xrmInternal = Utility.getXrmInternal();
if (!Utility.isNull(xrmInternal)) {
return xrmInternal.getEntitySetName(entityName) || entityName;
}
var collectionName = null;
if (!Utility.isNull(_entityNames)) {
collectionName = _entityNames[e... | javascript | function findCollectionName(entityName) {
var xrmInternal = Utility.getXrmInternal();
if (!Utility.isNull(xrmInternal)) {
return xrmInternal.getEntitySetName(entityName) || entityName;
}
var collectionName = null;
if (!Utility.isNull(_entityNames)) {
collectionName = _entityNames[e... | [
"function",
"findCollectionName",
"(",
"entityName",
")",
"{",
"var",
"xrmInternal",
"=",
"Utility",
".",
"getXrmInternal",
"(",
")",
";",
"if",
"(",
"!",
"Utility",
".",
"isNull",
"(",
"xrmInternal",
")",
")",
"{",
"return",
"xrmInternal",
".",
"getEntitySe... | Searches for a collection name by provided entity name in a cached entity metadata.
The returned collection name can be null.
@param {string} entityName - entity name
@returns {string} - a collection name | [
"Searches",
"for",
"a",
"collection",
"name",
"by",
"provided",
"entity",
"name",
"in",
"a",
"cached",
"entity",
"metadata",
".",
"The",
"returned",
"collection",
"name",
"can",
"be",
"null",
"."
] | 3ef9e2a010bafe439d71774325adc0b317024e5a | https://github.com/AleksandrRogov/DynamicsWebApi/blob/3ef9e2a010bafe439d71774325adc0b317024e5a/lib/requests/sendRequest.js#L14-L34 |
16,281 | AleksandrRogov/DynamicsWebApi | lib/requests/sendRequest.js | sendRequest | function sendRequest(method, path, config, data, additionalHeaders, responseParams, successCallback, errorCallback, isBatch, isAsync) {
additionalHeaders = additionalHeaders || {};
responseParams = responseParams || {};
//add response parameters to parse
responseParseParams.push(responseParams);
... | javascript | function sendRequest(method, path, config, data, additionalHeaders, responseParams, successCallback, errorCallback, isBatch, isAsync) {
additionalHeaders = additionalHeaders || {};
responseParams = responseParams || {};
//add response parameters to parse
responseParseParams.push(responseParams);
... | [
"function",
"sendRequest",
"(",
"method",
",",
"path",
",",
"config",
",",
"data",
",",
"additionalHeaders",
",",
"responseParams",
",",
"successCallback",
",",
"errorCallback",
",",
"isBatch",
",",
"isAsync",
")",
"{",
"additionalHeaders",
"=",
"additionalHeaders... | Sends a request to given URL with given parameters
@param {string} method - Method of the request.
@param {string} path - Request path.
@param {Object} config - DynamicsWebApi config.
@param {Object} [data] - Data to send in the request.
@param {Object} [additionalHeaders] - Object with additional headers. IMPORTANT! ... | [
"Sends",
"a",
"request",
"to",
"given",
"URL",
"with",
"given",
"parameters"
] | 3ef9e2a010bafe439d71774325adc0b317024e5a | https://github.com/AleksandrRogov/DynamicsWebApi/blob/3ef9e2a010bafe439d71774325adc0b317024e5a/lib/requests/sendRequest.js#L112-L226 |
16,282 | nikku/camunda-worker-node | lib/engine/api.js | getSerializedType | function getSerializedType(value, descriptor) {
if (value instanceof SerializedVariable) {
return 'SerializedVariable';
} else
if (descriptor) {
return descriptor.type;
} else
if (value instanceof Date) {
return 'Date';
} else
if (typeof value === 'object') {
retu... | javascript | function getSerializedType(value, descriptor) {
if (value instanceof SerializedVariable) {
return 'SerializedVariable';
} else
if (descriptor) {
return descriptor.type;
} else
if (value instanceof Date) {
return 'Date';
} else
if (typeof value === 'object') {
retu... | [
"function",
"getSerializedType",
"(",
"value",
",",
"descriptor",
")",
"{",
"if",
"(",
"value",
"instanceof",
"SerializedVariable",
")",
"{",
"return",
"'SerializedVariable'",
";",
"}",
"else",
"if",
"(",
"descriptor",
")",
"{",
"return",
"descriptor",
".",
"t... | Get serialized type for given value | [
"Get",
"serialized",
"type",
"for",
"given",
"value"
] | 705b105e99ed6bcff873b0f1bcc42bf11664c459 | https://github.com/nikku/camunda-worker-node/blob/705b105e99ed6bcff873b0f1bcc42bf11664c459/lib/engine/api.js#L79-L106 |
16,283 | nikku/camunda-worker-node | lib/auth.js | createAuth | function createAuth(type, token) {
if (!type) {
throw new Error('<type> required');
}
if (!token) {
throw new Error('<token> required');
}
/**
* Actual middleware that appends a `Authorization: "${type} ${token}"`
* header to the request options.
*/
return function(worker) {
const w... | javascript | function createAuth(type, token) {
if (!type) {
throw new Error('<type> required');
}
if (!token) {
throw new Error('<token> required');
}
/**
* Actual middleware that appends a `Authorization: "${type} ${token}"`
* header to the request options.
*/
return function(worker) {
const w... | [
"function",
"createAuth",
"(",
"type",
",",
"token",
")",
"{",
"if",
"(",
"!",
"type",
")",
"{",
"throw",
"new",
"Error",
"(",
"'<type> required'",
")",
";",
"}",
"if",
"(",
"!",
"token",
")",
"{",
"throw",
"new",
"Error",
"(",
"'<token> required'",
... | Set arbitrary authorization tokens on Engine API requests.
@example
Worker(engineEndpoint, {
use: [
Auth('Bearer', 'BEARER_TOKEN')
]
}); | [
"Set",
"arbitrary",
"authorization",
"tokens",
"on",
"Engine",
"API",
"requests",
"."
] | 705b105e99ed6bcff873b0f1bcc42bf11664c459 | https://github.com/nikku/camunda-worker-node/blob/705b105e99ed6bcff873b0f1bcc42bf11664c459/lib/auth.js#L14-L45 |
16,284 | nikku/camunda-worker-node | lib/worker.js | Worker | function Worker(baseUrl, opts = {}) {
if (!(this instanceof Worker)) {
return new Worker(baseUrl, opts);
}
// inheritance
Emitter.call(this);
this.options = extend({
workerId: uuid.v4()
}, defaultOptions, opts);
this.subscriptions = {};
this.state = STATE_NEW;
// apply extensions
if (t... | javascript | function Worker(baseUrl, opts = {}) {
if (!(this instanceof Worker)) {
return new Worker(baseUrl, opts);
}
// inheritance
Emitter.call(this);
this.options = extend({
workerId: uuid.v4()
}, defaultOptions, opts);
this.subscriptions = {};
this.state = STATE_NEW;
// apply extensions
if (t... | [
"function",
"Worker",
"(",
"baseUrl",
",",
"opts",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Worker",
")",
")",
"{",
"return",
"new",
"Worker",
"(",
"baseUrl",
",",
"opts",
")",
";",
"}",
"// inheritance",
"Emitter",
".",
... | Instantiate a worker.
@param {String} baseUrl
@param {Object} [opts={}] | [
"Instantiate",
"a",
"worker",
"."
] | 705b105e99ed6bcff873b0f1bcc42bf11664c459 | https://github.com/nikku/camunda-worker-node/blob/705b105e99ed6bcff873b0f1bcc42bf11664c459/lib/worker.js#L41-L78 |
16,285 | nikku/camunda-worker-node | lib/basic-auth.js | createBasicAuth | function createBasicAuth(username, password) {
if (!username) {
throw new Error('<username> required');
}
if (typeof password === 'undefined') {
throw new Error('<password> required');
}
const token = base64encode(`${username}:${password}`);
return auth('Basic', token);
} | javascript | function createBasicAuth(username, password) {
if (!username) {
throw new Error('<username> required');
}
if (typeof password === 'undefined') {
throw new Error('<password> required');
}
const token = base64encode(`${username}:${password}`);
return auth('Basic', token);
} | [
"function",
"createBasicAuth",
"(",
"username",
",",
"password",
")",
"{",
"if",
"(",
"!",
"username",
")",
"{",
"throw",
"new",
"Error",
"(",
"'<username> required'",
")",
";",
"}",
"if",
"(",
"typeof",
"password",
"===",
"'undefined'",
")",
"{",
"throw",... | Set username + password credentials on Engine API requests.
@example
Worker(engineEndpoint, {
use: [
BasicAuth('Walt', 'SECRET_PASSWORD')
]
}); | [
"Set",
"username",
"+",
"password",
"credentials",
"on",
"Engine",
"API",
"requests",
"."
] | 705b105e99ed6bcff873b0f1bcc42bf11664c459 | https://github.com/nikku/camunda-worker-node/blob/705b105e99ed6bcff873b0f1bcc42bf11664c459/lib/basic-auth.js#L16-L29 |
16,286 | nikku/camunda-worker-node | lib/logger.js | Logger | function Logger(worker) {
forEach([
'start',
'stop',
'reschedule',
'error',
'poll',
'poll:done',
'poll:error',
'fetchTasks',
'fetchTasks:failed',
'fetchTasks:success',
'worker:register',
'worker:remove',
'executeTask',
'executeTask:complete',
'executeTask:c... | javascript | function Logger(worker) {
forEach([
'start',
'stop',
'reschedule',
'error',
'poll',
'poll:done',
'poll:error',
'fetchTasks',
'fetchTasks:failed',
'fetchTasks:success',
'worker:register',
'worker:remove',
'executeTask',
'executeTask:complete',
'executeTask:c... | [
"function",
"Logger",
"(",
"worker",
")",
"{",
"forEach",
"(",
"[",
"'start'",
",",
"'stop'",
",",
"'reschedule'",
",",
"'error'",
",",
"'poll'",
",",
"'poll:done'",
",",
"'poll:error'",
",",
"'fetchTasks'",
",",
"'fetchTasks:failed'",
",",
"'fetchTasks:success'... | Enable detailed task worker logging.
@example
var worker = Worker(engineEndpoint, {
use: [
Logger
]
}); | [
"Enable",
"detailed",
"task",
"worker",
"logging",
"."
] | 705b105e99ed6bcff873b0f1bcc42bf11664c459 | https://github.com/nikku/camunda-worker-node/blob/705b105e99ed6bcff873b0f1bcc42bf11664c459/lib/logger.js#L18-L52 |
16,287 | nikku/camunda-worker-node | lib/metrics.js | Metric | function Metric(worker) {
var tasksExecutedCount = 0;
var pollCount = 0;
var executionTime = 0;
var pollTime = 0;
var idleTime = 0;
var activeTasks = 0;
worker.on('executeTask', function() {
activeTasks++;
});
worker.on('executeTask:done', function(task, durationMs) {
tasksExecutedCount++... | javascript | function Metric(worker) {
var tasksExecutedCount = 0;
var pollCount = 0;
var executionTime = 0;
var pollTime = 0;
var idleTime = 0;
var activeTasks = 0;
worker.on('executeTask', function() {
activeTasks++;
});
worker.on('executeTask:done', function(task, durationMs) {
tasksExecutedCount++... | [
"function",
"Metric",
"(",
"worker",
")",
"{",
"var",
"tasksExecutedCount",
"=",
"0",
";",
"var",
"pollCount",
"=",
"0",
";",
"var",
"executionTime",
"=",
"0",
";",
"var",
"pollTime",
"=",
"0",
";",
"var",
"idleTime",
"=",
"0",
";",
"var",
"activeTasks... | Periodically log worker utilization metrics.
@example
worker(engineEndpoint, {
use: [
Metrics
]
}); | [
"Periodically",
"log",
"worker",
"utilization",
"metrics",
"."
] | 705b105e99ed6bcff873b0f1bcc42bf11664c459 | https://github.com/nikku/camunda-worker-node/blob/705b105e99ed6bcff873b0f1bcc42bf11664c459/lib/metrics.js#L16-L82 |
16,288 | Streampunk/macadam | index.js | Capture | function Capture (deviceIndex, displayMode, pixelFormat) {
this.deviceIndex = deviceIndex;
this.displayMode = displayMode;
this.pixelFormat = pixelFormat;
this.emergencyBrake = null;
if (arguments.length !== 3 || typeof deviceIndex !== 'number' ||
typeof displayMode !== 'number' || typeof pixelFormat !=... | javascript | function Capture (deviceIndex, displayMode, pixelFormat) {
this.deviceIndex = deviceIndex;
this.displayMode = displayMode;
this.pixelFormat = pixelFormat;
this.emergencyBrake = null;
if (arguments.length !== 3 || typeof deviceIndex !== 'number' ||
typeof displayMode !== 'number' || typeof pixelFormat !=... | [
"function",
"Capture",
"(",
"deviceIndex",
",",
"displayMode",
",",
"pixelFormat",
")",
"{",
"this",
".",
"deviceIndex",
"=",
"deviceIndex",
";",
"this",
".",
"displayMode",
"=",
"displayMode",
";",
"this",
".",
"pixelFormat",
"=",
"pixelFormat",
";",
"this",
... | Capture class is deprecated | [
"Capture",
"class",
"is",
"deprecated"
] | b85b7b9b06415aeb896009fa05194c1dc1ce8616 | https://github.com/Streampunk/macadam/blob/b85b7b9b06415aeb896009fa05194c1dc1ce8616/index.js#L57-L89 |
16,289 | Streampunk/macadam | index.js | Playback | function Playback (deviceIndex, displayMode, pixelFormat) {
this.index = 0;
this.deviceIndex = deviceIndex;
this.displayMode = displayMode;
this.pixelFormat = pixelFormat;
this.running = true;
this.emergencyBrake = null;
if (arguments.length !== 3 || typeof deviceIndex !== 'number' ||
typeof display... | javascript | function Playback (deviceIndex, displayMode, pixelFormat) {
this.index = 0;
this.deviceIndex = deviceIndex;
this.displayMode = displayMode;
this.pixelFormat = pixelFormat;
this.running = true;
this.emergencyBrake = null;
if (arguments.length !== 3 || typeof deviceIndex !== 'number' ||
typeof display... | [
"function",
"Playback",
"(",
"deviceIndex",
",",
"displayMode",
",",
"pixelFormat",
")",
"{",
"this",
".",
"index",
"=",
"0",
";",
"this",
".",
"deviceIndex",
"=",
"deviceIndex",
";",
"this",
".",
"displayMode",
"=",
"displayMode",
";",
"this",
".",
"pixel... | Playback class is deprecated | [
"Playback",
"class",
"is",
"deprecated"
] | b85b7b9b06415aeb896009fa05194c1dc1ce8616 | https://github.com/Streampunk/macadam/blob/b85b7b9b06415aeb896009fa05194c1dc1ce8616/index.js#L130-L162 |
16,290 | projectatomic/dockerfile_lint | lib/parser.js | parseJSON | function parseJSON(cmd) {
try {
var json = JSON.parse(cmd.rest);
} catch (e) {
return false;
}
// Ensure it's an array.
if (!Array.isArray(json)) {
return false;
}
// Ensure every entry in the array is a string.
if (!json.every(function (entry) {
ret... | javascript | function parseJSON(cmd) {
try {
var json = JSON.parse(cmd.rest);
} catch (e) {
return false;
}
// Ensure it's an array.
if (!Array.isArray(json)) {
return false;
}
// Ensure every entry in the array is a string.
if (!json.every(function (entry) {
ret... | [
"function",
"parseJSON",
"(",
"cmd",
")",
"{",
"try",
"{",
"var",
"json",
"=",
"JSON",
".",
"parse",
"(",
"cmd",
".",
"rest",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"false",
";",
"}",
"// Ensure it's an array.",
"if",
"(",
"!",
"Arra... | Converts to JSON array, returns true on success, false otherwise. | [
"Converts",
"to",
"JSON",
"array",
"returns",
"true",
"on",
"success",
"false",
"otherwise",
"."
] | 625f957af62c5184423cbc017fdbc8e4a7383543 | https://github.com/projectatomic/dockerfile_lint/blob/625f957af62c5184423cbc017fdbc8e4a7383543/lib/parser.js#L267-L288 |
16,291 | projectatomic/dockerfile_lint | lib/parser.js | splitCommand | function splitCommand(line) {
// Make sure we get the same results irrespective of leading/trailing spaces
var match = line.match(TOKEN_WHITESPACE);
if (!match) {
return {
name: line.toUpperCase(),
rest: ''
};
}
var name = line.substr(0, match.index).toUpperCa... | javascript | function splitCommand(line) {
// Make sure we get the same results irrespective of leading/trailing spaces
var match = line.match(TOKEN_WHITESPACE);
if (!match) {
return {
name: line.toUpperCase(),
rest: ''
};
}
var name = line.substr(0, match.index).toUpperCa... | [
"function",
"splitCommand",
"(",
"line",
")",
"{",
"// Make sure we get the same results irrespective of leading/trailing spaces",
"var",
"match",
"=",
"line",
".",
"match",
"(",
"TOKEN_WHITESPACE",
")",
";",
"if",
"(",
"!",
"match",
")",
"{",
"return",
"{",
"name",... | Takes a single line of text and parses out the cmd and rest, which are used for dispatching to more exact parsing functions. | [
"Takes",
"a",
"single",
"line",
"of",
"text",
"and",
"parses",
"out",
"the",
"cmd",
"and",
"rest",
"which",
"are",
"used",
"for",
"dispatching",
"to",
"more",
"exact",
"parsing",
"functions",
"."
] | 625f957af62c5184423cbc017fdbc8e4a7383543 | https://github.com/projectatomic/dockerfile_lint/blob/625f957af62c5184423cbc017fdbc8e4a7383543/lib/parser.js#L341-L357 |
16,292 | node-red/node-red-node-test-helper | index.js | findRuntimePath | function findRuntimePath() {
const upPkg = readPkgUp.sync();
// case 1: we're in NR itself
if (upPkg.pkg.name === 'node-red') {
if (checkSemver(upPkg.pkg.version,"<0.20.0")) {
return path.join(path.dirname(upPkg.path), upPkg.pkg.main);
} else {
return path.join(path.d... | javascript | function findRuntimePath() {
const upPkg = readPkgUp.sync();
// case 1: we're in NR itself
if (upPkg.pkg.name === 'node-red') {
if (checkSemver(upPkg.pkg.version,"<0.20.0")) {
return path.join(path.dirname(upPkg.path), upPkg.pkg.main);
} else {
return path.join(path.d... | [
"function",
"findRuntimePath",
"(",
")",
"{",
"const",
"upPkg",
"=",
"readPkgUp",
".",
"sync",
"(",
")",
";",
"// case 1: we're in NR itself",
"if",
"(",
"upPkg",
".",
"pkg",
".",
"name",
"===",
"'node-red'",
")",
"{",
"if",
"(",
"checkSemver",
"(",
"upPkg... | Finds the NR runtime path by inspecting environment | [
"Finds",
"the",
"NR",
"runtime",
"path",
"by",
"inspecting",
"environment"
] | d6695c2de7968364c624f743ca38b13a0b859558 | https://github.com/node-red/node-red-node-test-helper/blob/d6695c2de7968364c624f743ca38b13a0b859558/index.js#L36-L59 |
16,293 | node-red/node-red-node-test-helper | index.js | checkSemver | function checkSemver(localVersion,testRange) {
var parts = localVersion.split("-");
return semver.satisfies(parts[0],testRange);
} | javascript | function checkSemver(localVersion,testRange) {
var parts = localVersion.split("-");
return semver.satisfies(parts[0],testRange);
} | [
"function",
"checkSemver",
"(",
"localVersion",
",",
"testRange",
")",
"{",
"var",
"parts",
"=",
"localVersion",
".",
"split",
"(",
"\"-\"",
")",
";",
"return",
"semver",
".",
"satisfies",
"(",
"parts",
"[",
"0",
"]",
",",
"testRange",
")",
";",
"}"
] | As we have prerelease tags in development version, they need stripping off before semver will do a sensible comparison with a range. | [
"As",
"we",
"have",
"prerelease",
"tags",
"in",
"development",
"version",
"they",
"need",
"stripping",
"off",
"before",
"semver",
"will",
"do",
"a",
"sensible",
"comparison",
"with",
"a",
"range",
"."
] | d6695c2de7968364c624f743ca38b13a0b859558 | https://github.com/node-red/node-red-node-test-helper/blob/d6695c2de7968364c624f743ca38b13a0b859558/index.js#L64-L67 |
16,294 | graphology/graphology | src/iteration/neighbors.js | createNeighborArrayForNode | function createNeighborArrayForNode(type, direction, nodeData) {
// If we want only undirected or in or out, we can roll some optimizations
if (type !== 'mixed') {
if (type === 'undirected')
return Object.keys(nodeData.undirected);
if (typeof direction === 'string')
return Object.keys(nodeData... | javascript | function createNeighborArrayForNode(type, direction, nodeData) {
// If we want only undirected or in or out, we can roll some optimizations
if (type !== 'mixed') {
if (type === 'undirected')
return Object.keys(nodeData.undirected);
if (typeof direction === 'string')
return Object.keys(nodeData... | [
"function",
"createNeighborArrayForNode",
"(",
"type",
",",
"direction",
",",
"nodeData",
")",
"{",
"// If we want only undirected or in or out, we can roll some optimizations",
"if",
"(",
"type",
"!==",
"'mixed'",
")",
"{",
"if",
"(",
"type",
"===",
"'undirected'",
")"... | Function creating an array of relevant neighbors for the given node.
@param {string} type - Type of neighbors.
@param {string} direction - Direction.
@param {any} nodeData - Target node's data.
@return {Array} - The list of neighbors. | [
"Function",
"creating",
"an",
"array",
"of",
"relevant",
"neighbors",
"for",
"the",
"given",
"node",
"."
] | f99681435ecd2d5b9d0a8e0d0d10f794817f417e | https://github.com/graphology/graphology/blob/f99681435ecd2d5b9d0a8e0d0d10f794817f417e/src/iteration/neighbors.js#L77-L106 |
16,295 | graphology/graphology | src/iteration/neighbors.js | forEachInObject | function forEachInObject(nodeData, object, callback) {
for (const k in object) {
let edgeData = object[k];
if (edgeData instanceof Set)
edgeData = edgeData.values().next().value;
const sourceData = edgeData.source,
targetData = edgeData.target;
const neighborData = sourceData === no... | javascript | function forEachInObject(nodeData, object, callback) {
for (const k in object) {
let edgeData = object[k];
if (edgeData instanceof Set)
edgeData = edgeData.values().next().value;
const sourceData = edgeData.source,
targetData = edgeData.target;
const neighborData = sourceData === no... | [
"function",
"forEachInObject",
"(",
"nodeData",
",",
"object",
",",
"callback",
")",
"{",
"for",
"(",
"const",
"k",
"in",
"object",
")",
"{",
"let",
"edgeData",
"=",
"object",
"[",
"k",
"]",
";",
"if",
"(",
"edgeData",
"instanceof",
"Set",
")",
"edgeDa... | Function iterating over the given node's relevant neighbors using a
callback.
@param {string} type - Type of neighbors.
@param {string} direction - Direction.
@param {any} nodeData - Target node's data.
@param {function} callback - Callback to use. | [
"Function",
"iterating",
"over",
"the",
"given",
"node",
"s",
"relevant",
"neighbors",
"using",
"a",
"callback",
"."
] | f99681435ecd2d5b9d0a8e0d0d10f794817f417e | https://github.com/graphology/graphology/blob/f99681435ecd2d5b9d0a8e0d0d10f794817f417e/src/iteration/neighbors.js#L117-L134 |
16,296 | graphology/graphology | src/iteration/neighbors.js | nodeHasNeighbor | function nodeHasNeighbor(graph, type, direction, node, neighbor) {
const nodeData = graph._nodes.get(node);
if (type !== 'undirected') {
if (direction !== 'out' && typeof nodeData.in !== 'undefined') {
for (const k in nodeData.in)
if (k === neighbor)
return true;
}
if (directi... | javascript | function nodeHasNeighbor(graph, type, direction, node, neighbor) {
const nodeData = graph._nodes.get(node);
if (type !== 'undirected') {
if (direction !== 'out' && typeof nodeData.in !== 'undefined') {
for (const k in nodeData.in)
if (k === neighbor)
return true;
}
if (directi... | [
"function",
"nodeHasNeighbor",
"(",
"graph",
",",
"type",
",",
"direction",
",",
"node",
",",
"neighbor",
")",
"{",
"const",
"nodeData",
"=",
"graph",
".",
"_nodes",
".",
"get",
"(",
"node",
")",
";",
"if",
"(",
"type",
"!==",
"'undirected'",
")",
"{",... | Function returning whether the given node has target neighbor.
@param {Graph} graph - Target graph.
@param {string} type - Type of neighbor.
@param {string} direction - Direction.
@param {any} node - Target node.
@param {any} neighbor - Target neighbor.
@return ... | [
"Function",
"returning",
"whether",
"the",
"given",
"node",
"has",
"target",
"neighbor",
"."
] | f99681435ecd2d5b9d0a8e0d0d10f794817f417e | https://github.com/graphology/graphology/blob/f99681435ecd2d5b9d0a8e0d0d10f794817f417e/src/iteration/neighbors.js#L299-L324 |
16,297 | graphology/graphology | src/iteration/neighbors.js | attachNeighborArrayCreator | function attachNeighborArrayCreator(Class, description) {
const {
name,
type,
direction
} = description;
/**
* Function returning an array or the count of certain neighbors.
*
* Arity 1: Return all of a node's relevant neighbors.
* @param {any} node - Target node.
*
* Arity 2: ... | javascript | function attachNeighborArrayCreator(Class, description) {
const {
name,
type,
direction
} = description;
/**
* Function returning an array or the count of certain neighbors.
*
* Arity 1: Return all of a node's relevant neighbors.
* @param {any} node - Target node.
*
* Arity 2: ... | [
"function",
"attachNeighborArrayCreator",
"(",
"Class",
",",
"description",
")",
"{",
"const",
"{",
"name",
",",
"type",
",",
"direction",
"}",
"=",
"description",
";",
"/**\n * Function returning an array or the count of certain neighbors.\n *\n * Arity 1: Return all of ... | Function attaching a neighbors array creator method to the Graph prototype.
@param {function} Class - Target class.
@param {object} description - Method description. | [
"Function",
"attaching",
"a",
"neighbors",
"array",
"creator",
"method",
"to",
"the",
"Graph",
"prototype",
"."
] | f99681435ecd2d5b9d0a8e0d0d10f794817f417e | https://github.com/graphology/graphology/blob/f99681435ecd2d5b9d0a8e0d0d10f794817f417e/src/iteration/neighbors.js#L332-L398 |
16,298 | graphology/graphology | src/iteration/edges.js | collectForKey | function collectForKey(edges, object, k) {
if (!(k in object))
return;
if (object[k] instanceof Set)
object[k].forEach(edgeData => edges.push(edgeData.key));
else
edges.push(object[k].key);
return;
} | javascript | function collectForKey(edges, object, k) {
if (!(k in object))
return;
if (object[k] instanceof Set)
object[k].forEach(edgeData => edges.push(edgeData.key));
else
edges.push(object[k].key);
return;
} | [
"function",
"collectForKey",
"(",
"edges",
",",
"object",
",",
"k",
")",
"{",
"if",
"(",
"!",
"(",
"k",
"in",
"object",
")",
")",
"return",
";",
"if",
"(",
"object",
"[",
"k",
"]",
"instanceof",
"Set",
")",
"object",
"[",
"k",
"]",
".",
"forEach"... | Function collecting edges from the given object at given key.
@param {array} edges - Edges array to populate.
@param {object} object - Target object.
@param {mixed} k - Neighbor key.
@return {array} - The found edges. | [
"Function",
"collecting",
"edges",
"from",
"the",
"given",
"object",
"at",
"given",
"key",
"."
] | f99681435ecd2d5b9d0a8e0d0d10f794817f417e | https://github.com/graphology/graphology/blob/f99681435ecd2d5b9d0a8e0d0d10f794817f417e/src/iteration/edges.js#L170-L181 |
16,299 | graphology/graphology | src/iteration/edges.js | forEachForKey | function forEachForKey(object, k, callback) {
if (!(k in object))
return;
if (object[k] instanceof Set)
object[k].forEach(edgeData => callback(
edgeData.key,
edgeData.attributes,
edgeData.source.key,
edgeData.target.key,
edgeData.source.attributes,
edgeData.target.attri... | javascript | function forEachForKey(object, k, callback) {
if (!(k in object))
return;
if (object[k] instanceof Set)
object[k].forEach(edgeData => callback(
edgeData.key,
edgeData.attributes,
edgeData.source.key,
edgeData.target.key,
edgeData.source.attributes,
edgeData.target.attri... | [
"function",
"forEachForKey",
"(",
"object",
",",
"k",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"(",
"k",
"in",
"object",
")",
")",
"return",
";",
"if",
"(",
"object",
"[",
"k",
"]",
"instanceof",
"Set",
")",
"object",
"[",
"k",
"]",
".",
"forEa... | Function iterating over the egdes from the object at given key using
a callback.
@param {object} object - Target object.
@param {mixed} k - Neighbor key.
@param {function} callback - Callback to use. | [
"Function",
"iterating",
"over",
"the",
"egdes",
"from",
"the",
"object",
"at",
"given",
"key",
"using",
"a",
"callback",
"."
] | f99681435ecd2d5b9d0a8e0d0d10f794817f417e | https://github.com/graphology/graphology/blob/f99681435ecd2d5b9d0a8e0d0d10f794817f417e/src/iteration/edges.js#L191-L219 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.