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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
winjs/react-winjs | react-winjs.js | function (propType) {
return {
propType: propType,
preCtorInit: function focusProperty_preCtorInit(element, options, data, displayName, propName, value) {
options[propName] = value;
},
update: function focusProperty_update(winjsComponent, propName,... | javascript | function (propType) {
return {
propType: propType,
preCtorInit: function focusProperty_preCtorInit(element, options, data, displayName, propName, value) {
options[propName] = value;
},
update: function focusProperty_update(winjsComponent, propName,... | [
"function",
"(",
"propType",
")",
"{",
"return",
"{",
"propType",
":",
"propType",
",",
"preCtorInit",
":",
"function",
"focusProperty_preCtorInit",
"(",
"element",
",",
"options",
",",
"data",
",",
"displayName",
",",
"propName",
",",
"value",
")",
"{",
"op... | Maps to a property on the winControl which involves setting focus. Such properties are set outside of componentWillReceiveProps to prevent React from undoing the focus move. | [
"Maps",
"to",
"a",
"property",
"on",
"the",
"winControl",
"which",
"involves",
"setting",
"focus",
".",
"Such",
"properties",
"are",
"set",
"outside",
"of",
"componentWillReceiveProps",
"to",
"prevent",
"React",
"from",
"undoing",
"the",
"focus",
"move",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L1955-L1976 | train | |
winjs/react-winjs | react-winjs.js | function (propType) {
return {
propType: propType,
preCtorInit: function domProperty_preCtorInit(element, options, data, displayName, propName, value) {
element[propName] = value;
},
update: function domProperty_update(winjsComponent, propName, old... | javascript | function (propType) {
return {
propType: propType,
preCtorInit: function domProperty_preCtorInit(element, options, data, displayName, propName, value) {
element[propName] = value;
},
update: function domProperty_update(winjsComponent, propName, old... | [
"function",
"(",
"propType",
")",
"{",
"return",
"{",
"propType",
":",
"propType",
",",
"preCtorInit",
":",
"function",
"domProperty_preCtorInit",
"(",
"element",
",",
"options",
",",
"data",
",",
"displayName",
",",
"propName",
",",
"value",
")",
"{",
"elem... | Maps to a property on the winControl's element. | [
"Maps",
"to",
"a",
"property",
"on",
"the",
"winControl",
"s",
"element",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L1979-L1991 | train | |
winjs/react-winjs | react-winjs.js | function (propType) {
return {
propType: propType,
update: function domAttribute_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
if (newValue !== null && newValue !== undefined) {
winjsCompone... | javascript | function (propType) {
return {
propType: propType,
update: function domAttribute_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
if (newValue !== null && newValue !== undefined) {
winjsCompone... | [
"function",
"(",
"propType",
")",
"{",
"return",
"{",
"propType",
":",
"propType",
",",
"update",
":",
"function",
"domAttribute_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"if",
"(",
"oldValue",
"!==",
"newVa... | Maps to an attribute on the winControl's element. | [
"Maps",
"to",
"an",
"attribute",
"on",
"the",
"winControl",
"s",
"element",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L1994-L2007 | train | |
winjs/react-winjs | react-winjs.js | event_update | function event_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
winjsComponent.winControl[propName.toLowerCase()] = newValue;
}
} | javascript | function event_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
winjsComponent.winControl[propName.toLowerCase()] = newValue;
}
} | [
"function",
"event_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"if",
"(",
"oldValue",
"!==",
"newValue",
")",
"{",
"winjsComponent",
".",
"winControl",
"[",
"propName",
".",
"toLowerCase",
"(",
")",
"]",
"=",
... | Can't set options in preCtorInit for events. The problem is WinJS control options use a different code path to hook up events than the event property setters. Consequently, setting an event property will not automatically unhook the event listener that was specified in the options during initialization. To avoid this p... | [
"Can",
"t",
"set",
"options",
"in",
"preCtorInit",
"for",
"events",
".",
"The",
"problem",
"is",
"WinJS",
"control",
"options",
"use",
"a",
"different",
"code",
"path",
"to",
"hook",
"up",
"events",
"than",
"the",
"event",
"property",
"setters",
".",
"Cons... | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2017-L2021 | train |
winjs/react-winjs | react-winjs.js | PropHandlers_warn | function PropHandlers_warn(warnMessage) {
return {
// Don't need preCtorInit because this prop handler doesn't have any side
// effects on the WinJS control. update also runs during initialization so
// update is just as good as preCtorInit for our use case.
updat... | javascript | function PropHandlers_warn(warnMessage) {
return {
// Don't need preCtorInit because this prop handler doesn't have any side
// effects on the WinJS control. update also runs during initialization so
// update is just as good as preCtorInit for our use case.
updat... | [
"function",
"PropHandlers_warn",
"(",
"warnMessage",
")",
"{",
"return",
"{",
"// Don't need preCtorInit because this prop handler doesn't have any side",
"// effects on the WinJS control. update also runs during initialization so",
"// update is just as good as preCtorInit for our use case.",
... | Emits a warning to the console whenever prop gets used. | [
"Emits",
"a",
"warning",
"to",
"the",
"console",
"whenever",
"prop",
"gets",
"used",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2101-L2110 | train |
winjs/react-winjs | react-winjs.js | PropHandlers_mountTo | function PropHandlers_mountTo(getMountPoint) {
return {
propType: React.PropTypes.element,
// Can't use preCtorInit because the mount point may not exist until the
// constructor has run.
update: function mountTo_update(winjsComponent, propName, oldValue, newValue... | javascript | function PropHandlers_mountTo(getMountPoint) {
return {
propType: React.PropTypes.element,
// Can't use preCtorInit because the mount point may not exist until the
// constructor has run.
update: function mountTo_update(winjsComponent, propName, oldValue, newValue... | [
"function",
"PropHandlers_mountTo",
"(",
"getMountPoint",
")",
"{",
"return",
"{",
"propType",
":",
"React",
".",
"PropTypes",
".",
"element",
",",
"// Can't use preCtorInit because the mount point may not exist until the",
"// constructor has run.",
"update",
":",
"function"... | Mounts a React component on whatever element gets returned by getMountPoint. | [
"Mounts",
"a",
"React",
"component",
"on",
"whatever",
"element",
"gets",
"returned",
"by",
"getMountPoint",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2150-L2206 | train |
winjs/react-winjs | react-winjs.js | mountTo_update | function mountTo_update(winjsComponent, propName, oldValue, newValue) {
var data = winjsComponent.data[propName] || {};
var version = (data.version || 0) + 1;
winjsComponent.data[propName] = {
// *mountComponent* may run asynchronously and we may queue... | javascript | function mountTo_update(winjsComponent, propName, oldValue, newValue) {
var data = winjsComponent.data[propName] || {};
var version = (data.version || 0) + 1;
winjsComponent.data[propName] = {
// *mountComponent* may run asynchronously and we may queue... | [
"function",
"mountTo_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"var",
"data",
"=",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
"||",
"{",
"}",
";",
"var",
"version",
"=",
"(",
"data",
".",
"vers... | Can't use preCtorInit because the mount point may not exist until the constructor has run. | [
"Can",
"t",
"use",
"preCtorInit",
"because",
"the",
"mount",
"point",
"may",
"not",
"exist",
"until",
"the",
"constructor",
"has",
"run",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2155-L2199 | train |
winjs/react-winjs | react-winjs.js | PropHandlers_syncChildrenWithBindingList | function PropHandlers_syncChildrenWithBindingList(bindingListName) {
return {
preCtorInit: function syncChildrenWithBindingList_preCtorInit(element, options, data, displayName, propName, value) {
var latest = processChildren(displayName, value, {});
data[propName] = {... | javascript | function PropHandlers_syncChildrenWithBindingList(bindingListName) {
return {
preCtorInit: function syncChildrenWithBindingList_preCtorInit(element, options, data, displayName, propName, value) {
var latest = processChildren(displayName, value, {});
data[propName] = {... | [
"function",
"PropHandlers_syncChildrenWithBindingList",
"(",
"bindingListName",
")",
"{",
"return",
"{",
"preCtorInit",
":",
"function",
"syncChildrenWithBindingList_preCtorInit",
"(",
"element",
",",
"options",
",",
"data",
",",
"displayName",
",",
"propName",
",",
"va... | Uses the Binding.List's editing APIs to make it match the children prop. Does this to the Binding.List stored in the winControl's property called bindingListName. | [
"Uses",
"the",
"Binding",
".",
"List",
"s",
"editing",
"APIs",
"to",
"make",
"it",
"match",
"the",
"children",
"prop",
".",
"Does",
"this",
"to",
"the",
"Binding",
".",
"List",
"stored",
"in",
"the",
"winControl",
"s",
"property",
"called",
"bindingListNam... | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2210-L2256 | train |
winjs/react-winjs | react-winjs.js | function (winjsComponent, propName, oldValue, newValue) {
// TODO: dispose
ReactDOM.render(React.DOM.div(null, newValue), winjsComponent.winControl.element);
} | javascript | function (winjsComponent, propName, oldValue, newValue) {
// TODO: dispose
ReactDOM.render(React.DOM.div(null, newValue), winjsComponent.winControl.element);
} | [
"function",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"// TODO: dispose",
"ReactDOM",
".",
"render",
"(",
"React",
".",
"DOM",
".",
"div",
"(",
"null",
",",
"newValue",
")",
",",
"winjsComponent",
".",
"winControl",
... | children propHandler looks like this rather than using mountTo on winControl.element because this enables props.children to have multiple components whereas the other technique restricts it to one. | [
"children",
"propHandler",
"looks",
"like",
"this",
"rather",
"than",
"using",
"mountTo",
"on",
"winControl",
".",
"element",
"because",
"this",
"enables",
"props",
".",
"children",
"to",
"have",
"multiple",
"components",
"whereas",
"the",
"other",
"technique",
... | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2626-L2629 | train | |
ciena-frost/ember-frost-bunsen | addon/components/detail.js | addMetaProperty | function addMetaProperty (object, propName, value) {
defineProperty(object, propName, {
enumerable: false,
value
})
} | javascript | function addMetaProperty (object, propName, value) {
defineProperty(object, propName, {
enumerable: false,
value
})
} | [
"function",
"addMetaProperty",
"(",
"object",
",",
"propName",
",",
"value",
")",
"{",
"defineProperty",
"(",
"object",
",",
"propName",
",",
"{",
"enumerable",
":",
"false",
",",
"value",
"}",
")",
"}"
] | Adds an unenumerable property to an object
@param {Object} object - object to add property to
@param {String} propName - property name
@param {Object|Number|String} value - property value | [
"Adds",
"an",
"unenumerable",
"property",
"to",
"an",
"object"
] | 0a4d323484e49aca86404204e4139a64d43829ad | https://github.com/ciena-frost/ember-frost-bunsen/blob/0a4d323484e49aca86404204e4139a64d43829ad/addon/components/detail.js#L69-L74 | train |
virtkick/http-master | src/di.js | functionParameters | function functionParameters(f) {
assert(typeof f === 'function');
var matches = functionRegex.exec(f.toString());
if(!matches || !matches[2].length) {
return [];
}
return matches[2].split(/[,\s]+/).filter(function(str) {
return str.length;
});
} | javascript | function functionParameters(f) {
assert(typeof f === 'function');
var matches = functionRegex.exec(f.toString());
if(!matches || !matches[2].length) {
return [];
}
return matches[2].split(/[,\s]+/).filter(function(str) {
return str.length;
});
} | [
"function",
"functionParameters",
"(",
"f",
")",
"{",
"assert",
"(",
"typeof",
"f",
"===",
"'function'",
")",
";",
"var",
"matches",
"=",
"functionRegex",
".",
"exec",
"(",
"f",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"!",
"matches",
"||",
"!... | get function arguments as array | [
"get",
"function",
"arguments",
"as",
"array"
] | 0bc7bededda0679590789642fff010d1df5d2395 | https://github.com/virtkick/http-master/blob/0bc7bededda0679590789642fff010d1df5d2395/src/di.js#L7-L16 | train |
virtkick/http-master | src/di.js | function(overrides) {
var result = this.cache;
if(!result) {
result = construct(type, functionParameters(type).map(function(paramName) {
return self.resolve(paramName, overrides);
}));
}
if(doCache) {
this.cache = result;
}
return result;
} | javascript | function(overrides) {
var result = this.cache;
if(!result) {
result = construct(type, functionParameters(type).map(function(paramName) {
return self.resolve(paramName, overrides);
}));
}
if(doCache) {
this.cache = result;
}
return result;
} | [
"function",
"(",
"overrides",
")",
"{",
"var",
"result",
"=",
"this",
".",
"cache",
";",
"if",
"(",
"!",
"result",
")",
"{",
"result",
"=",
"construct",
"(",
"type",
",",
"functionParameters",
"(",
"type",
")",
".",
"map",
"(",
"function",
"(",
"para... | this.cache is saved in mapping 'this' is mapping | [
"this",
".",
"cache",
"is",
"saved",
"in",
"mapping",
"this",
"is",
"mapping"
] | 0bc7bededda0679590789642fff010d1df5d2395 | https://github.com/virtkick/http-master/blob/0bc7bededda0679590789642fff010d1df5d2395/src/di.js#L77-L88 | train | |
ciena-frost/ember-frost-bunsen | addon/components/inputs/geolocation.js | deserializeProperty | function deserializeProperty (bunsenId, value, bunsenModel) {
const subModel = getSubModel(bunsenModel, bunsenId)
switch (subModel.type) {
case 'integer':
return parseInt(value)
case 'number':
return parseFloat(value)
default:
return value
}
} | javascript | function deserializeProperty (bunsenId, value, bunsenModel) {
const subModel = getSubModel(bunsenModel, bunsenId)
switch (subModel.type) {
case 'integer':
return parseInt(value)
case 'number':
return parseFloat(value)
default:
return value
}
} | [
"function",
"deserializeProperty",
"(",
"bunsenId",
",",
"value",
",",
"bunsenModel",
")",
"{",
"const",
"subModel",
"=",
"getSubModel",
"(",
"bunsenModel",
",",
"bunsenId",
")",
"switch",
"(",
"subModel",
".",
"type",
")",
"{",
"case",
"'integer'",
":",
"re... | Deserialize property value to format consumer expects
@param {String} bunsenId - property key
@param {String} value - property value
@param {Object} bunsenModel - bunsen model
@returns {String|Number} deserialized value | [
"Deserialize",
"property",
"value",
"to",
"format",
"consumer",
"expects"
] | 0a4d323484e49aca86404204e4139a64d43829ad | https://github.com/ciena-frost/ember-frost-bunsen/blob/0a4d323484e49aca86404204e4139a64d43829ad/addon/components/inputs/geolocation.js#L84-L97 | train |
ciena-frost/ember-frost-bunsen | addon/components/inputs/geolocation.js | serializeFormValue | function serializeFormValue (formValue) {
if (formValue.country) {
formValue.country = countryCodeToName(formValue.country)
}
if (typeOf(formValue.latitude) === 'number') {
formValue.latitude = `${formValue.latitude}`
}
if (typeOf(formValue.longitude) === 'number') {
formValue.longitude = `${for... | javascript | function serializeFormValue (formValue) {
if (formValue.country) {
formValue.country = countryCodeToName(formValue.country)
}
if (typeOf(formValue.latitude) === 'number') {
formValue.latitude = `${formValue.latitude}`
}
if (typeOf(formValue.longitude) === 'number') {
formValue.longitude = `${for... | [
"function",
"serializeFormValue",
"(",
"formValue",
")",
"{",
"if",
"(",
"formValue",
".",
"country",
")",
"{",
"formValue",
".",
"country",
"=",
"countryCodeToName",
"(",
"formValue",
".",
"country",
")",
"}",
"if",
"(",
"typeOf",
"(",
"formValue",
".",
"... | Serialize form value to be in correct format for sub-forms
@param {Object} formValue - unserialized form value | [
"Serialize",
"form",
"value",
"to",
"be",
"in",
"correct",
"format",
"for",
"sub",
"-",
"forms"
] | 0a4d323484e49aca86404204e4139a64d43829ad | https://github.com/ciena-frost/ember-frost-bunsen/blob/0a4d323484e49aca86404204e4139a64d43829ad/addon/components/inputs/geolocation.js#L103-L115 | train |
ciena-frost/ember-frost-bunsen | addon/list-utils.js | normalizeItems | function normalizeItems ({data, labelAttribute, records, valueAttribute}) {
const labelAttr = labelAttribute || 'label'
const valueAttr = valueAttribute || 'id'
return data.concat(
records.map((record) => {
if (typeof record !== 'object') {
return {
label: `${record}`, // make sure la... | javascript | function normalizeItems ({data, labelAttribute, records, valueAttribute}) {
const labelAttr = labelAttribute || 'label'
const valueAttr = valueAttribute || 'id'
return data.concat(
records.map((record) => {
if (typeof record !== 'object') {
return {
label: `${record}`, // make sure la... | [
"function",
"normalizeItems",
"(",
"{",
"data",
",",
"labelAttribute",
",",
"records",
",",
"valueAttribute",
"}",
")",
"{",
"const",
"labelAttr",
"=",
"labelAttribute",
"||",
"'label'",
"const",
"valueAttr",
"=",
"valueAttribute",
"||",
"'id'",
"return",
"data"... | Converts records from an API response into a standard format with "label"
and "value" properties so renderers can predictably process the data.
@param {Object[]} data - initializes the list with this
@param {String} labelAttribute - dot notated path to label attribute in record
@param {Array<Object>} records - records ... | [
"Converts",
"records",
"from",
"an",
"API",
"response",
"into",
"a",
"standard",
"format",
"with",
"label",
"and",
"value",
"properties",
"so",
"renderers",
"can",
"predictably",
"process",
"the",
"data",
"."
] | 0a4d323484e49aca86404204e4139a64d43829ad | https://github.com/ciena-frost/ember-frost-bunsen/blob/0a4d323484e49aca86404204e4139a64d43829ad/addon/list-utils.js#L256-L289 | train |
ciena-frost/ember-frost-bunsen | addon/list-utils.js | shouldAddCurrentValue | function shouldAddCurrentValue ({items, valueRecord, labelAttribute, valueAttribute, filter}) {
const filterRegex = new RegExp(filter, 'i')
const valueRecordMatchesFilter = filterRegex.test(valueRecord.get(labelAttribute))
const itemsContainsValueRecord = items.find(item => item.value === valueRecord.get(valueAtt... | javascript | function shouldAddCurrentValue ({items, valueRecord, labelAttribute, valueAttribute, filter}) {
const filterRegex = new RegExp(filter, 'i')
const valueRecordMatchesFilter = filterRegex.test(valueRecord.get(labelAttribute))
const itemsContainsValueRecord = items.find(item => item.value === valueRecord.get(valueAtt... | [
"function",
"shouldAddCurrentValue",
"(",
"{",
"items",
",",
"valueRecord",
",",
"labelAttribute",
",",
"valueAttribute",
",",
"filter",
"}",
")",
"{",
"const",
"filterRegex",
"=",
"new",
"RegExp",
"(",
"filter",
",",
"'i'",
")",
"const",
"valueRecordMatchesFilt... | Determine whether or not valueRecord should be appended to data
@param {Object[]} items - the larger set of data
@param {EmberObject} valueRecord - the record to add or not
@param {String} labelAttribute - dot notated path to label attribute in record
@param {String} valueAttribute - dot notated path to value attribute... | [
"Determine",
"whether",
"or",
"not",
"valueRecord",
"should",
"be",
"appended",
"to",
"data"
] | 0a4d323484e49aca86404204e4139a64d43829ad | https://github.com/ciena-frost/ember-frost-bunsen/blob/0a4d323484e49aca86404204e4139a64d43829ad/addon/list-utils.js#L300-L305 | train |
ryanwilliams/cocos2d-javascript | src/nodes/RenderTexture.js | function (rect) {
if (rect) {
this.context.clearRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height)
} else {
this.canvas.width = this.canvas.width
if (cc.FLIP_Y_AXIS) {
this.context.scale(1, -1)
this.context.translate(... | javascript | function (rect) {
if (rect) {
this.context.clearRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height)
} else {
this.canvas.width = this.canvas.width
if (cc.FLIP_Y_AXIS) {
this.context.scale(1, -1)
this.context.translate(... | [
"function",
"(",
"rect",
")",
"{",
"if",
"(",
"rect",
")",
"{",
"this",
".",
"context",
".",
"clearRect",
"(",
"rect",
".",
"origin",
".",
"x",
",",
"rect",
".",
"origin",
".",
"y",
",",
"rect",
".",
"size",
".",
"width",
",",
"rect",
".",
"siz... | Clear the canvas | [
"Clear",
"the",
"canvas"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/nodes/RenderTexture.js#L70-L80 | train | |
ryanwilliams/cocos2d-javascript | src/Scheduler.js | function (opts) {
var target = opts.target,
priority = opts.priority,
paused = opts.paused
var i, len
var entry = {target: target, priority: priority, paused: paused}
var added = false
if (priority === 0) {
this.updates0.push(entry)
... | javascript | function (opts) {
var target = opts.target,
priority = opts.priority,
paused = opts.paused
var i, len
var entry = {target: target, priority: priority, paused: paused}
var added = false
if (priority === 0) {
this.updates0.push(entry)
... | [
"function",
"(",
"opts",
")",
"{",
"var",
"target",
"=",
"opts",
".",
"target",
",",
"priority",
"=",
"opts",
".",
"priority",
",",
"paused",
"=",
"opts",
".",
"paused",
"var",
"i",
",",
"len",
"var",
"entry",
"=",
"{",
"target",
":",
"target",
","... | Schedules the 'update' selector for a given target with a given priority.
The 'update' selector will be called every frame.
The lower the priority, the earlier it is called. | [
"Schedules",
"the",
"update",
"selector",
"for",
"a",
"given",
"target",
"with",
"a",
"given",
"priority",
".",
"The",
"update",
"selector",
"will",
"be",
"called",
"every",
"frame",
".",
"The",
"lower",
"the",
"priority",
"the",
"earlier",
"it",
"is",
"ca... | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/Scheduler.js#L115-L153 | train | |
ryanwilliams/cocos2d-javascript | src/Scheduler.js | function (dt) {
var i, len, x
if (this.timeScale != 1.0) {
dt *= this.timeScale
}
var entry
for (i = 0, len = this.updatesNeg.length; i < len; i++) {
entry = this.updatesNeg[i]
if (entry && !entry.paused) {
entry.target.update(... | javascript | function (dt) {
var i, len, x
if (this.timeScale != 1.0) {
dt *= this.timeScale
}
var entry
for (i = 0, len = this.updatesNeg.length; i < len; i++) {
entry = this.updatesNeg[i]
if (entry && !entry.paused) {
entry.target.update(... | [
"function",
"(",
"dt",
")",
"{",
"var",
"i",
",",
"len",
",",
"x",
"if",
"(",
"this",
".",
"timeScale",
"!=",
"1.0",
")",
"{",
"dt",
"*=",
"this",
".",
"timeScale",
"}",
"var",
"entry",
"for",
"(",
"i",
"=",
"0",
",",
"len",
"=",
"this",
".",... | 'tick' the scheduler.
You should NEVER call this method, unless you know what you are doing. | [
"tick",
"the",
"scheduler",
".",
"You",
"should",
"NEVER",
"call",
"this",
"method",
"unless",
"you",
"know",
"what",
"you",
"are",
"doing",
"."
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/Scheduler.js#L159-L203 | train | |
ryanwilliams/cocos2d-javascript | src/Scheduler.js | function (opts) {
if (!opts.target || !opts.method) {
return
}
var target = opts.target,
method = (typeof opts.method == 'function') ? opts.method : target[opts.method]
var element = this.hashForMethods[opts.target.id]
if (element) {
for (var... | javascript | function (opts) {
if (!opts.target || !opts.method) {
return
}
var target = opts.target,
method = (typeof opts.method == 'function') ? opts.method : target[opts.method]
var element = this.hashForMethods[opts.target.id]
if (element) {
for (var... | [
"function",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"opts",
".",
"target",
"||",
"!",
"opts",
".",
"method",
")",
"{",
"return",
"}",
"var",
"target",
"=",
"opts",
".",
"target",
",",
"method",
"=",
"(",
"typeof",
"opts",
".",
"method",
"==",
"'fu... | Unshedules a selector for a given target.
If you want to unschedule the "update", use unscheduleUpdateForTarget. | [
"Unshedules",
"a",
"selector",
"for",
"a",
"given",
"target",
".",
"If",
"you",
"want",
"to",
"unschedule",
"the",
"update",
"use",
"unscheduleUpdateForTarget",
"."
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/Scheduler.js#L209-L227 | train | |
ryanwilliams/cocos2d-javascript | src/Scheduler.js | function (target) {
if (!target) {
return
}
var id = target.id,
elementUpdate = this.hashForUpdates[id]
if (elementUpdate) {
// Remove from updates list
if (elementUpdate.priority === 0) {
this.updates0.splice(this.updates0.... | javascript | function (target) {
if (!target) {
return
}
var id = target.id,
elementUpdate = this.hashForUpdates[id]
if (elementUpdate) {
// Remove from updates list
if (elementUpdate.priority === 0) {
this.updates0.splice(this.updates0.... | [
"function",
"(",
"target",
")",
"{",
"if",
"(",
"!",
"target",
")",
"{",
"return",
"}",
"var",
"id",
"=",
"target",
".",
"id",
",",
"elementUpdate",
"=",
"this",
".",
"hashForUpdates",
"[",
"id",
"]",
"if",
"(",
"elementUpdate",
")",
"{",
"// Remove ... | Unschedules the update selector for a given target | [
"Unschedules",
"the",
"update",
"selector",
"for",
"a",
"given",
"target"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/Scheduler.js#L232-L250 | train | |
ryanwilliams/cocos2d-javascript | src/Scheduler.js | function () {
var i, x, entry
// Custom selectors
for (x in this.hashForMethods) {
if (this.hashForMethods.hasOwnProperty(x)) {
entry = this.hashForMethods[x]
this.unscheduleAllSelectorsForTarget(entry.target)
}
}
// Update... | javascript | function () {
var i, x, entry
// Custom selectors
for (x in this.hashForMethods) {
if (this.hashForMethods.hasOwnProperty(x)) {
entry = this.hashForMethods[x]
this.unscheduleAllSelectorsForTarget(entry.target)
}
}
// Update... | [
"function",
"(",
")",
"{",
"var",
"i",
",",
"x",
",",
"entry",
"// Custom selectors",
"for",
"(",
"x",
"in",
"this",
".",
"hashForMethods",
")",
"{",
"if",
"(",
"this",
".",
"hashForMethods",
".",
"hasOwnProperty",
"(",
"x",
")",
")",
"{",
"entry",
"... | Unschedules all selectors from all targets.
You should NEVER call this method, unless you know what you are doing. | [
"Unschedules",
"all",
"selectors",
"from",
"all",
"targets",
".",
"You",
"should",
"NEVER",
"call",
"this",
"method",
"unless",
"you",
"know",
"what",
"you",
"are",
"doing",
"."
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/Scheduler.js#L256-L287 | train | |
ryanwilliams/cocos2d-javascript | src/Scheduler.js | function (target) {
if (!target) {
return
}
// Custom selector
var element = this.hashForMethods[target.id]
if (element) {
element.paused = true
element.timers = []; // Clear all timers
}
// Release HashMethodEntry object
... | javascript | function (target) {
if (!target) {
return
}
// Custom selector
var element = this.hashForMethods[target.id]
if (element) {
element.paused = true
element.timers = []; // Clear all timers
}
// Release HashMethodEntry object
... | [
"function",
"(",
"target",
")",
"{",
"if",
"(",
"!",
"target",
")",
"{",
"return",
"}",
"// Custom selector",
"var",
"element",
"=",
"this",
".",
"hashForMethods",
"[",
"target",
".",
"id",
"]",
"if",
"(",
"element",
")",
"{",
"element",
".",
"paused",... | Unschedules all selectors for a given target.
This also includes the "update" selector. | [
"Unschedules",
"all",
"selectors",
"for",
"a",
"given",
"target",
".",
"This",
"also",
"includes",
"the",
"update",
"selector",
"."
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/Scheduler.js#L293-L308 | train | |
ryanwilliams/cocos2d-javascript | src/ActionManager.js | function (opts) {
var targetID = opts.target.id
var element = this.targets[targetID]
if (!element) {
element = this.targets[targetID] = {
paused: false,
target: opts.target,
actions: []
}
}
element.actions... | javascript | function (opts) {
var targetID = opts.target.id
var element = this.targets[targetID]
if (!element) {
element = this.targets[targetID] = {
paused: false,
target: opts.target,
actions: []
}
}
element.actions... | [
"function",
"(",
"opts",
")",
"{",
"var",
"targetID",
"=",
"opts",
".",
"target",
".",
"id",
"var",
"element",
"=",
"this",
".",
"targets",
"[",
"targetID",
"]",
"if",
"(",
"!",
"element",
")",
"{",
"element",
"=",
"this",
".",
"targets",
"[",
"tar... | Adds an action with a target. If the target is already present, then the
action will be added to the existing target. If the target is not
present, a new instance of this target will be created either paused or
paused, and the action will be added to the newly created target. When
the target is paused, the queued actio... | [
"Adds",
"an",
"action",
"with",
"a",
"target",
".",
"If",
"the",
"target",
"is",
"already",
"present",
"then",
"the",
"action",
"will",
"be",
"added",
"to",
"the",
"existing",
"target",
".",
"If",
"the",
"target",
"is",
"not",
"present",
"a",
"new",
"i... | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/ActionManager.js#L42-L58 | train | |
ryanwilliams/cocos2d-javascript | src/ActionManager.js | function (action) {
var targetID = action.originalTarget.id,
element = this.targets[targetID]
if (!element) {
return
}
var actionIndex = element.actions.indexOf(action)
if (actionIndex == -1) {
return
}
if (this.currentTarge... | javascript | function (action) {
var targetID = action.originalTarget.id,
element = this.targets[targetID]
if (!element) {
return
}
var actionIndex = element.actions.indexOf(action)
if (actionIndex == -1) {
return
}
if (this.currentTarge... | [
"function",
"(",
"action",
")",
"{",
"var",
"targetID",
"=",
"action",
".",
"originalTarget",
".",
"id",
",",
"element",
"=",
"this",
".",
"targets",
"[",
"targetID",
"]",
"if",
"(",
"!",
"element",
")",
"{",
"return",
"}",
"var",
"actionIndex",
"=",
... | Remove an action
@param {cocos.actions.Action} action Action to remove | [
"Remove",
"an",
"action"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/ActionManager.js#L65-L92 | train | |
ryanwilliams/cocos2d-javascript | src/ActionManager.js | function(opts) {
var tag = opts.tag,
targetID = opts.target.id
var element = this.targets[targetID]
if (!element) {
return null
}
for (var i = 0; i < element.actions.length; i++ ) {
if (element.actions[i] &&
(element.actions[i]... | javascript | function(opts) {
var tag = opts.tag,
targetID = opts.target.id
var element = this.targets[targetID]
if (!element) {
return null
}
for (var i = 0; i < element.actions.length; i++ ) {
if (element.actions[i] &&
(element.actions[i]... | [
"function",
"(",
"opts",
")",
"{",
"var",
"tag",
"=",
"opts",
".",
"tag",
",",
"targetID",
"=",
"opts",
".",
"target",
".",
"id",
"var",
"element",
"=",
"this",
".",
"targets",
"[",
"targetID",
"]",
"if",
"(",
"!",
"element",
")",
"{",
"return",
... | Fetch an action belonging to a cocos.nodes.Node
@returns {cocos.actions.Action}
@opts {cocos.nodes.Node} target Target of the action
@opts {String} tag Tag of the action | [
"Fetch",
"an",
"action",
"belonging",
"to",
"a",
"cocos",
".",
"nodes",
".",
"Node"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/ActionManager.js#L102-L118 | train | |
ryanwilliams/cocos2d-javascript | src/ActionManager.js | function (target) {
var targetID = target.id
var element = this.targets[targetID]
if (!element) {
return
}
delete this.targets[targetID]
// Delete everything in array but don't replace it incase something else has a reference
element.actions.splice(0... | javascript | function (target) {
var targetID = target.id
var element = this.targets[targetID]
if (!element) {
return
}
delete this.targets[targetID]
// Delete everything in array but don't replace it incase something else has a reference
element.actions.splice(0... | [
"function",
"(",
"target",
")",
"{",
"var",
"targetID",
"=",
"target",
".",
"id",
"var",
"element",
"=",
"this",
".",
"targets",
"[",
"targetID",
"]",
"if",
"(",
"!",
"element",
")",
"{",
"return",
"}",
"delete",
"this",
".",
"targets",
"[",
"targetI... | Remove all actions for a cocos.nodes.Node
@param {cocos.nodes.Node} target Node to remove all actions for | [
"Remove",
"all",
"actions",
"for",
"a",
"cocos",
".",
"nodes",
".",
"Node"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/ActionManager.js#L125-L136 | train | |
ryanwilliams/cocos2d-javascript | lib/cocos2d/opts.js | function () {
var str = 'Usage: ' + path.basename(process.argv[1]) + ' ' + process.argv[2];
if (descriptors.opts.length) str += ' [options]';
if (descriptors.args.length) {
for (var i=0; i<descriptors.args.length; i++) {
if (descriptors.args[i].required) {
str += ' ' + descriptors.args[i].name;
... | javascript | function () {
var str = 'Usage: ' + path.basename(process.argv[1]) + ' ' + process.argv[2];
if (descriptors.opts.length) str += ' [options]';
if (descriptors.args.length) {
for (var i=0; i<descriptors.args.length; i++) {
if (descriptors.args[i].required) {
str += ' ' + descriptors.args[i].name;
... | [
"function",
"(",
")",
"{",
"var",
"str",
"=",
"'Usage: '",
"+",
"path",
".",
"basename",
"(",
"process",
".",
"argv",
"[",
"1",
"]",
")",
"+",
"' '",
"+",
"process",
".",
"argv",
"[",
"2",
"]",
";",
"if",
"(",
"descriptors",
".",
"opts",
".",
"... | Create the help string | [
"Create",
"the",
"help",
"string"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/lib/cocos2d/opts.js#L251-L276 | train | |
ryanwilliams/cocos2d-javascript | src/SpriteFrameCache.js | function (opts) {
var name = opts.name || opts
var frame = this.spriteFrames[name]
if (!frame) {
// No frame, look for an alias
var key = this.spriteFrameAliases[name]
if (key) {
frame = this.spriteFrames[key]
}
if (... | javascript | function (opts) {
var name = opts.name || opts
var frame = this.spriteFrames[name]
if (!frame) {
// No frame, look for an alias
var key = this.spriteFrameAliases[name]
if (key) {
frame = this.spriteFrames[key]
}
if (... | [
"function",
"(",
"opts",
")",
"{",
"var",
"name",
"=",
"opts",
".",
"name",
"||",
"opts",
"var",
"frame",
"=",
"this",
".",
"spriteFrames",
"[",
"name",
"]",
"if",
"(",
"!",
"frame",
")",
"{",
"// No frame, look for an alias",
"var",
"key",
"=",
"this"... | Get a single SpriteFrame
@param {String} opts.name The name of the sprite frame
@returns {cocos.SpriteFrame} The sprite frame | [
"Get",
"a",
"single",
"SpriteFrame"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/SpriteFrameCache.js#L167-L186 | train | |
ryanwilliams/cocos2d-javascript | src/nodes/TMXLayer.js | function (pos) {
var layerSize = this.layerSize,
tiles = this.tiles
if (pos.x < 0 || pos.y < 0 || pos.x >= layerSize.width || pos.y >= layerSize.height) {
throw "TMX Layer: Invalid position"
}
var tile,
gid = this.tileGIDAt(pos)
// if GID is... | javascript | function (pos) {
var layerSize = this.layerSize,
tiles = this.tiles
if (pos.x < 0 || pos.y < 0 || pos.x >= layerSize.width || pos.y >= layerSize.height) {
throw "TMX Layer: Invalid position"
}
var tile,
gid = this.tileGIDAt(pos)
// if GID is... | [
"function",
"(",
"pos",
")",
"{",
"var",
"layerSize",
"=",
"this",
".",
"layerSize",
",",
"tiles",
"=",
"this",
".",
"tiles",
"if",
"(",
"pos",
".",
"x",
"<",
"0",
"||",
"pos",
".",
"y",
"<",
"0",
"||",
"pos",
".",
"x",
">=",
"layerSize",
".",
... | Get the tile at a specifix tile coordinate
@param {geometry.Point} pos Position of tile to get in tile coordinates (not pixels)
@returns {cocos.nodes.Sprite} The tile | [
"Get",
"the",
"tile",
"at",
"a",
"specifix",
"tile",
"coordinate"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/nodes/TMXLayer.js#L257-L275 | train | |
ryanwilliams/cocos2d-javascript | lib/cocos2d/mimetypes.js | read | function read(file) {
var data = fs.readFileSync(file, 'ascii');
// Strip comments
data = data.replace(/#.*/g, '');
var lines = data.split('\n');
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i].trim();
if (!line) {
continue;
}
var ... | javascript | function read(file) {
var data = fs.readFileSync(file, 'ascii');
// Strip comments
data = data.replace(/#.*/g, '');
var lines = data.split('\n');
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i].trim();
if (!line) {
continue;
}
var ... | [
"function",
"read",
"(",
"file",
")",
"{",
"var",
"data",
"=",
"fs",
".",
"readFileSync",
"(",
"file",
",",
"'ascii'",
")",
";",
"// Strip comments",
"data",
"=",
"data",
".",
"replace",
"(",
"/",
"#.*",
"/",
"g",
",",
"''",
")",
";",
"var",
"lines... | Read a single mime.types-format file | [
"Read",
"a",
"single",
"mime",
".",
"types",
"-",
"format",
"file"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/lib/cocos2d/mimetypes.js#L38-L62 | train |
ryanwilliams/cocos2d-javascript | src/AnimationCache.js | function (opts) {
var name = opts.name,
animation = opts.animation
this.animations[name] = animation
} | javascript | function (opts) {
var name = opts.name,
animation = opts.animation
this.animations[name] = animation
} | [
"function",
"(",
"opts",
")",
"{",
"var",
"name",
"=",
"opts",
".",
"name",
",",
"animation",
"=",
"opts",
".",
"animation",
"this",
".",
"animations",
"[",
"name",
"]",
"=",
"animation",
"}"
] | Add an animation to the cache
@opt {String} name Unique name of the animation
@opt {cocos.Animcation} animation Animation to cache | [
"Add",
"an",
"animation",
"to",
"the",
"cache"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/AnimationCache.js#L31-L36 | train | |
ryanwilliams/cocos2d-javascript | src/TMXXMLParser.js | function (opts) {
var objectName = opts.name
var object = null
this.objects.forEach(function (item) {
if (item.name == objectName) {
object = item
}
})
if (object !== null) {
return object
}
} | javascript | function (opts) {
var objectName = opts.name
var object = null
this.objects.forEach(function (item) {
if (item.name == objectName) {
object = item
}
})
if (object !== null) {
return object
}
} | [
"function",
"(",
"opts",
")",
"{",
"var",
"objectName",
"=",
"opts",
".",
"name",
"var",
"object",
"=",
"null",
"this",
".",
"objects",
".",
"forEach",
"(",
"function",
"(",
"item",
")",
"{",
"if",
"(",
"item",
".",
"name",
"==",
"objectName",
")",
... | Get the object for the specific object name. It will return the 1st
object found on the array for the given name.
@opt {String} name Object name
@returns {Object} Object | [
"Get",
"the",
"object",
"for",
"the",
"specific",
"object",
"name",
".",
"It",
"will",
"return",
"the",
"1st",
"object",
"found",
"on",
"the",
"array",
"for",
"the",
"given",
"name",
"."
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/TMXXMLParser.js#L111-L123 | train | |
ryanwilliams/cocos2d-javascript | src/libs/bobject.js | function (key) {
var next = false
if (~key.indexOf('.')) {
var tokens = key.split('.');
key = tokens.shift();
next = tokens.join('.');
}
var accessor = getAccessors(this)[key],
val;
if (accessor) {
val = accessor.targe... | javascript | function (key) {
var next = false
if (~key.indexOf('.')) {
var tokens = key.split('.');
key = tokens.shift();
next = tokens.join('.');
}
var accessor = getAccessors(this)[key],
val;
if (accessor) {
val = accessor.targe... | [
"function",
"(",
"key",
")",
"{",
"var",
"next",
"=",
"false",
"if",
"(",
"~",
"key",
".",
"indexOf",
"(",
"'.'",
")",
")",
"{",
"var",
"tokens",
"=",
"key",
".",
"split",
"(",
"'.'",
")",
";",
"key",
"=",
"tokens",
".",
"shift",
"(",
")",
";... | Get a property from the object. Always use this instead of trying to
access the property directly. This will ensure all bindings, setters and
getters work correctly.
@param {String} key Name of property to get or dot (.) separated path to a property
@returns {*} Value of the property | [
"Get",
"a",
"property",
"from",
"the",
"object",
".",
"Always",
"use",
"this",
"instead",
"of",
"trying",
"to",
"access",
"the",
"property",
"directly",
".",
"This",
"will",
"ensure",
"all",
"bindings",
"setters",
"and",
"getters",
"work",
"correctly",
"."
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/libs/bobject.js#L76-L103 | train | |
ryanwilliams/cocos2d-javascript | src/libs/bobject.js | function (key, value) {
var accessor = getAccessors(this)[key],
oldVal = this.get(key);
this.triggerBeforeChanged(key, oldVal);
if (accessor) {
accessor.target.set(accessor.key, value);
} else {
if (this['set_' + key]) {
this['set_'... | javascript | function (key, value) {
var accessor = getAccessors(this)[key],
oldVal = this.get(key);
this.triggerBeforeChanged(key, oldVal);
if (accessor) {
accessor.target.set(accessor.key, value);
} else {
if (this['set_' + key]) {
this['set_'... | [
"function",
"(",
"key",
",",
"value",
")",
"{",
"var",
"accessor",
"=",
"getAccessors",
"(",
"this",
")",
"[",
"key",
"]",
",",
"oldVal",
"=",
"this",
".",
"get",
"(",
"key",
")",
";",
"this",
".",
"triggerBeforeChanged",
"(",
"key",
",",
"oldVal",
... | Set a property on the object. Always use this instead of trying to
access the property directly. This will ensure all bindings, setters and
getters work correctly.
@param {String} key Name of property to get
@param {*} value New value for the property | [
"Set",
"a",
"property",
"on",
"the",
"object",
".",
"Always",
"use",
"this",
"instead",
"of",
"trying",
"to",
"access",
"the",
"property",
"directly",
".",
"This",
"will",
"ensure",
"all",
"bindings",
"setters",
"and",
"getters",
"work",
"correctly",
"."
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/libs/bobject.js#L114-L132 | train | |
ryanwilliams/cocos2d-javascript | src/libs/bobject.js | function (kvp) {
for (var x in kvp) {
if (kvp.hasOwnProperty(x)) {
this.set(x, kvp[x]);
}
}
} | javascript | function (kvp) {
for (var x in kvp) {
if (kvp.hasOwnProperty(x)) {
this.set(x, kvp[x]);
}
}
} | [
"function",
"(",
"kvp",
")",
"{",
"for",
"(",
"var",
"x",
"in",
"kvp",
")",
"{",
"if",
"(",
"kvp",
".",
"hasOwnProperty",
"(",
"x",
")",
")",
"{",
"this",
".",
"set",
"(",
"x",
",",
"kvp",
"[",
"x",
"]",
")",
";",
"}",
"}",
"}"
] | Set multiple propertys in one go
@param {Object} kvp An Object where the key is a property name and the value is the value to assign to the property
@example
var props = {
monkey: 'ook',
cat: 'meow',
dog: 'woof'
};
foo.setValues(props);
console.log(foo.get('cat')); // Logs 'meow' | [
"Set",
"multiple",
"propertys",
"in",
"one",
"go"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/libs/bobject.js#L148-L154 | train | |
ryanwilliams/cocos2d-javascript | src/libs/bobject.js | function (key, target, targetKey, noNotify) {
targetKey = targetKey || key;
var self = this;
this.unbind(key);
var oldVal = this.get(key);
// When bound property changes, trigger a 'changed' event on this one too
getBindings(this)[key] = events.addListener(target, targe... | javascript | function (key, target, targetKey, noNotify) {
targetKey = targetKey || key;
var self = this;
this.unbind(key);
var oldVal = this.get(key);
// When bound property changes, trigger a 'changed' event on this one too
getBindings(this)[key] = events.addListener(target, targe... | [
"function",
"(",
"key",
",",
"target",
",",
"targetKey",
",",
"noNotify",
")",
"{",
"targetKey",
"=",
"targetKey",
"||",
"key",
";",
"var",
"self",
"=",
"this",
";",
"this",
".",
"unbind",
"(",
"key",
")",
";",
"var",
"oldVal",
"=",
"this",
".",
"g... | Bind the value of a property on this object to that of another object so
they always have the same value. Setting the value on either object will update
the other too.
@param {String} key Name of the property on this object that should be bound
@param {BOject} target Object to bind to
@param {String} [targetKey=key] K... | [
"Bind",
"the",
"value",
"of",
"a",
"property",
"on",
"this",
"object",
"to",
"that",
"of",
"another",
"object",
"so",
"they",
"always",
"have",
"the",
"same",
"value",
".",
"Setting",
"the",
"value",
"on",
"either",
"object",
"will",
"update",
"the",
"ot... | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/libs/bobject.js#L193-L206 | train | |
ryanwilliams/cocos2d-javascript | src/libs/bobject.js | function () {
var keys = [],
bindings = getBindings(this);
for (var k in bindings) {
if (bindings.hasOwnProperty(k)) {
this.unbind(k);
}
}
} | javascript | function () {
var keys = [],
bindings = getBindings(this);
for (var k in bindings) {
if (bindings.hasOwnProperty(k)) {
this.unbind(k);
}
}
} | [
"function",
"(",
")",
"{",
"var",
"keys",
"=",
"[",
"]",
",",
"bindings",
"=",
"getBindings",
"(",
"this",
")",
";",
"for",
"(",
"var",
"k",
"in",
"bindings",
")",
"{",
"if",
"(",
"bindings",
".",
"hasOwnProperty",
"(",
"k",
")",
")",
"{",
"this"... | Remove all bindings on this object | [
"Remove",
"all",
"bindings",
"on",
"this",
"object"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/libs/bobject.js#L231-L239 | train | |
ryanwilliams/cocos2d-javascript | src/libs/bobject.js | function (i, value) {
this.array.splice(i, 0, value);
this.set('length', this.array.length);
events.trigger(this, 'insert_at', i);
} | javascript | function (i, value) {
this.array.splice(i, 0, value);
this.set('length', this.array.length);
events.trigger(this, 'insert_at', i);
} | [
"function",
"(",
"i",
",",
"value",
")",
"{",
"this",
".",
"array",
".",
"splice",
"(",
"i",
",",
"0",
",",
"value",
")",
";",
"this",
".",
"set",
"(",
"'length'",
",",
"this",
".",
"array",
".",
"length",
")",
";",
"events",
".",
"trigger",
"(... | Insert a new item into the array without overwriting anything
@param {Integer} i Index to insert item at
@param {*} value Value to insert | [
"Insert",
"a",
"new",
"item",
"into",
"the",
"array",
"without",
"overwriting",
"anything"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/libs/bobject.js#L356-L360 | train | |
ryanwilliams/cocos2d-javascript | src/libs/bobject.js | function (i) {
var oldVal = this.array[i];
this.array.splice(i, 1);
this.set('length', this.array.length);
events.trigger(this, 'remove_at', i, oldVal);
return oldVal;
} | javascript | function (i) {
var oldVal = this.array[i];
this.array.splice(i, 1);
this.set('length', this.array.length);
events.trigger(this, 'remove_at', i, oldVal);
return oldVal;
} | [
"function",
"(",
"i",
")",
"{",
"var",
"oldVal",
"=",
"this",
".",
"array",
"[",
"i",
"]",
";",
"this",
".",
"array",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"this",
".",
"set",
"(",
"'length'",
",",
"this",
".",
"array",
".",
"length",
... | Remove item from the array and return it
@param {Integer} i Index to remove
@returns {*} Value that was removed | [
"Remove",
"item",
"from",
"the",
"array",
"and",
"return",
"it"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/libs/bobject.js#L368-L375 | train | |
vixis/angularplasmid | src/js/services.js | round10 | function round10(value, exp) {
var type = 'round';
// If the exp is undefined or zero...
if (typeof exp === 'undefined' || +exp === 0) {
return Math[type](value);
}
value = +value;
exp = +exp;
... | javascript | function round10(value, exp) {
var type = 'round';
// If the exp is undefined or zero...
if (typeof exp === 'undefined' || +exp === 0) {
return Math[type](value);
}
value = +value;
exp = +exp;
... | [
"function",
"round10",
"(",
"value",
",",
"exp",
")",
"{",
"var",
"type",
"=",
"'round'",
";",
"// If the exp is undefined or zero...",
"if",
"(",
"typeof",
"exp",
"===",
"'undefined'",
"||",
"+",
"exp",
"===",
"0",
")",
"{",
"return",
"Math",
"[",
"type",... | Decimal round with precision | [
"Decimal",
"round",
"with",
"precision"
] | fe43921e48357fd5bd4a1de70139148506ec9213 | https://github.com/vixis/angularplasmid/blob/fe43921e48357fd5bd4a1de70139148506ec9213/src/js/services.js#L20-L38 | train |
ryanwilliams/cocos2d-javascript | src/Director.js | Director | function Director () {
if (Director._instance) {
throw new Error('Director instance already exists')
}
this.sceneStack = []
this.window = parent.window
this.document = this.window.document
// Prevent writing to some properties
util.makeReadonly(this, 'canvas context sceneStack wi... | javascript | function Director () {
if (Director._instance) {
throw new Error('Director instance already exists')
}
this.sceneStack = []
this.window = parent.window
this.document = this.window.document
// Prevent writing to some properties
util.makeReadonly(this, 'canvas context sceneStack wi... | [
"function",
"Director",
"(",
")",
"{",
"if",
"(",
"Director",
".",
"_instance",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Director instance already exists'",
")",
"}",
"this",
".",
"sceneStack",
"=",
"[",
"]",
"this",
".",
"window",
"=",
"parent",
".",
"... | Create a new instance of Director. This is a singleton so you shouldn't use
the constructor directly. Instead grab the shared instance using the
cocos.Director.sharedDirector property.
@class
Creates and handles the main view and manages how and when to execute the
Scenes.
This class is a singleton so don't instantia... | [
"Create",
"a",
"new",
"instance",
"of",
"Director",
".",
"This",
"is",
"a",
"singleton",
"so",
"you",
"shouldn",
"t",
"use",
"the",
"constructor",
"directly",
".",
"Instead",
"grab",
"the",
"shared",
"instance",
"using",
"the",
"cocos",
".",
"Director",
".... | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/Director.js#L27-L38 | train |
ryanwilliams/cocos2d-javascript | src/Director.js | function () {
if (!Director._instance) {
if (window.navigator.userAgent.match(/(iPhone|iPod|iPad|Android)/)) {
Director._instance = new DirectorTouchScreen()
} else {
Director._instance = new this()
}
}
return Director._instanc... | javascript | function () {
if (!Director._instance) {
if (window.navigator.userAgent.match(/(iPhone|iPod|iPad|Android)/)) {
Director._instance = new DirectorTouchScreen()
} else {
Director._instance = new this()
}
}
return Director._instanc... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"Director",
".",
"_instance",
")",
"{",
"if",
"(",
"window",
".",
"navigator",
".",
"userAgent",
".",
"match",
"(",
"/",
"(iPhone|iPod|iPad|Android)",
"/",
")",
")",
"{",
"Director",
".",
"_instance",
"=",
"ne... | A shared singleton instance of cocos.Director
@memberOf cocos.Director
@getter {cocos.Director} sharedDirector | [
"A",
"shared",
"singleton",
"instance",
"of",
"cocos",
".",
"Director"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/Director.js#L612-L622 | train | |
ryanwilliams/cocos2d-javascript | src/nodes/Transition.js | function () {
var is = this.inScene,
os = this.outScene
/* clean up */
is.visible = true
is.position = geo.PointZero()
is.scale = 1.0
is.rotation = 0
os.visible = false
os.position = geo.PointZero()
os.scale = 1.0
os.rotation ... | javascript | function () {
var is = this.inScene,
os = this.outScene
/* clean up */
is.visible = true
is.position = geo.PointZero()
is.scale = 1.0
is.rotation = 0
os.visible = false
os.position = geo.PointZero()
os.scale = 1.0
os.rotation ... | [
"function",
"(",
")",
"{",
"var",
"is",
"=",
"this",
".",
"inScene",
",",
"os",
"=",
"this",
".",
"outScene",
"/* clean up */",
"is",
".",
"visible",
"=",
"true",
"is",
".",
"position",
"=",
"geo",
".",
"PointZero",
"(",
")",
"is",
".",
"scale",
"=... | Called after the transition finishes | [
"Called",
"after",
"the",
"transition",
"finishes"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/nodes/Transition.js#L74-L94 | train | |
infinum/webpack-asset-pipeline | index.js | function(manifest, compilation, props) {
const outputFolder = compilation.options.output.path;
const outputFile = path.join(outputFolder, props.fileName);
fse.outputFileSync(outputFile, manifest);
} | javascript | function(manifest, compilation, props) {
const outputFolder = compilation.options.output.path;
const outputFile = path.join(outputFolder, props.fileName);
fse.outputFileSync(outputFile, manifest);
} | [
"function",
"(",
"manifest",
",",
"compilation",
",",
"props",
")",
"{",
"const",
"outputFolder",
"=",
"compilation",
".",
"options",
".",
"output",
".",
"path",
";",
"const",
"outputFile",
"=",
"path",
".",
"join",
"(",
"outputFolder",
",",
"props",
".",
... | Writes a JSON to Webpack output path. If the output directory doesn't
exists it will create it.
@param {JSON} manifest - The manifest containing files
@param {object} compilation - Object containing Webpack context
@param {object} props - Props passed to the plugin
@return {undefined} | [
"Writes",
"a",
"JSON",
"to",
"Webpack",
"output",
"path",
".",
"If",
"the",
"output",
"directory",
"doesn",
"t",
"exists",
"it",
"will",
"create",
"it",
"."
] | b01ca6ddd60b3f7a2809079aa08523e256889691 | https://github.com/infinum/webpack-asset-pipeline/blob/b01ca6ddd60b3f7a2809079aa08523e256889691/index.js#L27-L32 | train | |
infinum/webpack-asset-pipeline | index.js | function(compilation, assetName) {
if (!compilation || !compilation.cache || typeof compilation.cache !== 'object') {
return null;
}
const cacheKeys = Object.keys(compilation.cache);
for (let keyIndex = 0; keyIndex < cacheKeys.length; keyIndex++) {
const cache = compilation.cache[cacheKeys... | javascript | function(compilation, assetName) {
if (!compilation || !compilation.cache || typeof compilation.cache !== 'object') {
return null;
}
const cacheKeys = Object.keys(compilation.cache);
for (let keyIndex = 0; keyIndex < cacheKeys.length; keyIndex++) {
const cache = compilation.cache[cacheKeys... | [
"function",
"(",
"compilation",
",",
"assetName",
")",
"{",
"if",
"(",
"!",
"compilation",
"||",
"!",
"compilation",
".",
"cache",
"||",
"typeof",
"compilation",
".",
"cache",
"!==",
"'object'",
")",
"{",
"return",
"null",
";",
"}",
"const",
"cacheKeys",
... | Tries to find the user reuqired file in cace. If it does it returns the
file path user used in the `require` statement. Otherwise it returns null.
@param {object} compilation - Object containing Webpack context
@param {string} assetName - Emitted file name
@return {string} path that user used in require/import | [
"Tries",
"to",
"find",
"the",
"user",
"reuqired",
"file",
"in",
"cace",
".",
"If",
"it",
"does",
"it",
"returns",
"the",
"file",
"path",
"user",
"used",
"in",
"the",
"require",
"statement",
".",
"Otherwise",
"it",
"returns",
"null",
"."
] | b01ca6ddd60b3f7a2809079aa08523e256889691 | https://github.com/infinum/webpack-asset-pipeline/blob/b01ca6ddd60b3f7a2809079aa08523e256889691/index.js#L42-L57 | train | |
ryanwilliams/cocos2d-javascript | src/RemoteFont.js | hasFontLoaded | function hasFontLoaded (window, fontName) {
var testSize = 16
if (!fontTestElement) {
fontTestElement = window.document.createElement('canvas')
fontTestElement.width = testSize
fontTestElement.height = testSize
fontTestElement.style.display = 'none'
ctx = fontTestElement... | javascript | function hasFontLoaded (window, fontName) {
var testSize = 16
if (!fontTestElement) {
fontTestElement = window.document.createElement('canvas')
fontTestElement.width = testSize
fontTestElement.height = testSize
fontTestElement.style.display = 'none'
ctx = fontTestElement... | [
"function",
"hasFontLoaded",
"(",
"window",
",",
"fontName",
")",
"{",
"var",
"testSize",
"=",
"16",
"if",
"(",
"!",
"fontTestElement",
")",
"{",
"fontTestElement",
"=",
"window",
".",
"document",
".",
"createElement",
"(",
"'canvas'",
")",
"fontTestElement",
... | Very crude way to test for when a font has loaded
While a font is loading they will be drawn as blank onto a canvas.
This function creates a small canvas and tests the pixels to see if the
given font draws. If it does then we can assume the font loaded. | [
"Very",
"crude",
"way",
"to",
"test",
"for",
"when",
"a",
"font",
"has",
"loaded"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/RemoteFont.js#L13-L43 | train |
ryanwilliams/cocos2d-javascript | src/nodes/TMXTiledMap.js | function (opts) {
var layerName = opts.name,
layer = null
this.children.forEach(function (item) {
if (item instanceof TMXLayer && item.layerName == layerName) {
layer = item
}
})
if (layer !== null) {
return layer
}... | javascript | function (opts) {
var layerName = opts.name,
layer = null
this.children.forEach(function (item) {
if (item instanceof TMXLayer && item.layerName == layerName) {
layer = item
}
})
if (layer !== null) {
return layer
}... | [
"function",
"(",
"opts",
")",
"{",
"var",
"layerName",
"=",
"opts",
".",
"name",
",",
"layer",
"=",
"null",
"this",
".",
"children",
".",
"forEach",
"(",
"function",
"(",
"item",
")",
"{",
"if",
"(",
"item",
"instanceof",
"TMXLayer",
"&&",
"item",
".... | Get a layer
@opt {String} name The name of the layer to get
@returns {cocos.nodes.TMXLayer} The layer requested | [
"Get",
"a",
"layer"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/nodes/TMXTiledMap.js#L141-L153 | train | |
ryanwilliams/cocos2d-javascript | src/nodes/TMXTiledMap.js | function (opts) {
var objectGroupName = opts.name,
objectGroup = null
this.objectGroups.forEach(function (item) {
if (item.name == objectGroupName) {
objectGroup = item
}
})
if (objectGroup !== null) {
return objectGroup
... | javascript | function (opts) {
var objectGroupName = opts.name,
objectGroup = null
this.objectGroups.forEach(function (item) {
if (item.name == objectGroupName) {
objectGroup = item
}
})
if (objectGroup !== null) {
return objectGroup
... | [
"function",
"(",
"opts",
")",
"{",
"var",
"objectGroupName",
"=",
"opts",
".",
"name",
",",
"objectGroup",
"=",
"null",
"this",
".",
"objectGroups",
".",
"forEach",
"(",
"function",
"(",
"item",
")",
"{",
"if",
"(",
"item",
".",
"name",
"==",
"objectGr... | Return the ObjectGroup for the secific group
@opt {String} name The object group name
@returns {cocos.TMXObjectGroup} The object group | [
"Return",
"the",
"ObjectGroup",
"for",
"the",
"secific",
"group"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/nodes/TMXTiledMap.js#L161-L173 | train | |
ryanwilliams/cocos2d-javascript | support/distribution/package.js | generateNSISScript | function generateNSISScript(files, callback) {
sys.puts('Generating NSIS script');
var installFileList = ' SetOverwrite try\n',
removeFileList = '',
removeDirList = '';
files = files.filter(function(file) {
// Ignore node-builds for other platforms
if (~file.indexOf('nod... | javascript | function generateNSISScript(files, callback) {
sys.puts('Generating NSIS script');
var installFileList = ' SetOverwrite try\n',
removeFileList = '',
removeDirList = '';
files = files.filter(function(file) {
// Ignore node-builds for other platforms
if (~file.indexOf('nod... | [
"function",
"generateNSISScript",
"(",
"files",
",",
"callback",
")",
"{",
"sys",
".",
"puts",
"(",
"'Generating NSIS script'",
")",
";",
"var",
"installFileList",
"=",
"' SetOverwrite try\\n'",
",",
"removeFileList",
"=",
"''",
",",
"removeDirList",
"=",
"''",
... | Generates an NSIS installer script to install the contents of a given
directory and returns it as a string.
@param {String} dir The directory that will be installed
@returns String The contents of the NSIS script | [
"Generates",
"an",
"NSIS",
"installer",
"script",
"to",
"install",
"the",
"contents",
"of",
"a",
"given",
"directory",
"and",
"returns",
"it",
"as",
"a",
"string",
"."
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/support/distribution/package.js#L37-L87 | train |
ryanwilliams/cocos2d-javascript | support/distribution/package.js | findFilesToPackage | function findFilesToPackage(dir, callback) {
var cwd = process.cwd();
process.chdir(dir);
var gitls = spawn('git', ['ls-files']),
// This gets the full path to each file in each submodule
subls = spawn('git', ['submodule', 'foreach', 'for file in `git ls-files`; do echo "$path/$file"; done'... | javascript | function findFilesToPackage(dir, callback) {
var cwd = process.cwd();
process.chdir(dir);
var gitls = spawn('git', ['ls-files']),
// This gets the full path to each file in each submodule
subls = spawn('git', ['submodule', 'foreach', 'for file in `git ls-files`; do echo "$path/$file"; done'... | [
"function",
"findFilesToPackage",
"(",
"dir",
",",
"callback",
")",
"{",
"var",
"cwd",
"=",
"process",
".",
"cwd",
"(",
")",
";",
"process",
".",
"chdir",
"(",
"dir",
")",
";",
"var",
"gitls",
"=",
"spawn",
"(",
"'git'",
",",
"[",
"'ls-files'",
"]",
... | Uses git to find the files we want to install. If a file isn't commited,
then it won't be installed.
@param {String} dir The directory that will be installed
@returns String[] Array of file paths | [
"Uses",
"git",
"to",
"find",
"the",
"files",
"we",
"want",
"to",
"install",
".",
"If",
"a",
"file",
"isn",
"t",
"commited",
"then",
"it",
"won",
"t",
"be",
"installed",
"."
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/support/distribution/package.js#L96-L157 | train |
ryanwilliams/cocos2d-javascript | src/SpriteFrame.js | function () {
return new SpriteFrame({rect: this.rect, rotated: this.rotated, offset: this.offset, originalSize: this.originalSize, texture: this.texture})
} | javascript | function () {
return new SpriteFrame({rect: this.rect, rotated: this.rotated, offset: this.offset, originalSize: this.originalSize, texture: this.texture})
} | [
"function",
"(",
")",
"{",
"return",
"new",
"SpriteFrame",
"(",
"{",
"rect",
":",
"this",
".",
"rect",
",",
"rotated",
":",
"this",
".",
"rotated",
",",
"offset",
":",
"this",
".",
"offset",
",",
"originalSize",
":",
"this",
".",
"originalSize",
",",
... | Make a copy of this frame
@returns {cocos.SpriteFrame} Exact copy of this object | [
"Make",
"a",
"copy",
"of",
"this",
"frame"
] | 6c156006333cb55a61555d4a755a43c5f12d1049 | https://github.com/ryanwilliams/cocos2d-javascript/blob/6c156006333cb55a61555d4a755a43c5f12d1049/src/SpriteFrame.js#L53-L55 | train | |
stadt-bielefeld/wms-downloader | src/helper/handleResolution.js | handleResolution | function handleResolution(options, ws, resIdx, config, progress, callback) {
// Resolution object
let res = options.tiles.resolutions[resIdx];
// Workspace of this resolutions
let resWs;
if (options.tiles.resolutions.length == 1) {
resWs = ws;
} else {
resWs = ws + '/' + res.id;
}
// Create ... | javascript | function handleResolution(options, ws, resIdx, config, progress, callback) {
// Resolution object
let res = options.tiles.resolutions[resIdx];
// Workspace of this resolutions
let resWs;
if (options.tiles.resolutions.length == 1) {
resWs = ws;
} else {
resWs = ws + '/' + res.id;
}
// Create ... | [
"function",
"handleResolution",
"(",
"options",
",",
"ws",
",",
"resIdx",
",",
"config",
",",
"progress",
",",
"callback",
")",
"{",
"// Resolution object",
"let",
"res",
"=",
"options",
".",
"tiles",
".",
"resolutions",
"[",
"resIdx",
"]",
";",
"// Workspac... | It handles recursive all resolutions of a task.
@param {Object} options
@param {String} ws Task workspace
@param {Number} resIdx Index of resolution
@param {Object} config See options of the {@link WMSDownloader|WMSDownloader constructor}
@param {Array} progress Array of the progress of all WMSDownloader tasks.
@param... | [
"It",
"handles",
"recursive",
"all",
"resolutions",
"of",
"a",
"task",
"."
] | 8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d | https://github.com/stadt-bielefeld/wms-downloader/blob/8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d/src/helper/handleResolution.js#L16-L74 | train |
stadt-bielefeld/wms-downloader | src/helper/writeTile.js | writeTile | function writeTile(file, url, request, callback) {
// Result of request
let res = null;
// FileWriteStream
let fileStream = fs.createWriteStream(file);
// Register finish callback of FileWriteStream
fileStream.on('finish', () => {
callback(null, res);
});
// Register error callback of FileWriteSt... | javascript | function writeTile(file, url, request, callback) {
// Result of request
let res = null;
// FileWriteStream
let fileStream = fs.createWriteStream(file);
// Register finish callback of FileWriteStream
fileStream.on('finish', () => {
callback(null, res);
});
// Register error callback of FileWriteSt... | [
"function",
"writeTile",
"(",
"file",
",",
"url",
",",
"request",
",",
"callback",
")",
"{",
"// Result of request",
"let",
"res",
"=",
"null",
";",
"// FileWriteStream",
"let",
"fileStream",
"=",
"fs",
".",
"createWriteStream",
"(",
"file",
")",
";",
"// Re... | Downloads and writes a tile.
@param {String} file Path where the tile is to be stored.
@param {String} url URL of tile
@param {Object} request Object from request module (let request = require('request');)
@param {Function} callback function(err, res){} | [
"Downloads",
"and",
"writes",
"a",
"tile",
"."
] | 8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d | https://github.com/stadt-bielefeld/wms-downloader/blob/8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d/src/helper/writeTile.js#L13-L45 | train |
RackHD/on-tasks | spec/lib/jobs/poweron-node-spec.js | function() {
//var logger = Logger.initialize(mockChildProcessFactory);
function MockChildProcess() {}
MockChildProcess.prototype.run = function run (command, args) {
// logger.debug("CHILD PROCESS MOCK!");
// logger.debug("command: "+command);
// logger.debug... | javascript | function() {
//var logger = Logger.initialize(mockChildProcessFactory);
function MockChildProcess() {}
MockChildProcess.prototype.run = function run (command, args) {
// logger.debug("CHILD PROCESS MOCK!");
// logger.debug("command: "+command);
// logger.debug... | [
"function",
"(",
")",
"{",
"//var logger = Logger.initialize(mockChildProcessFactory);",
"function",
"MockChildProcess",
"(",
")",
"{",
"}",
"MockChildProcess",
".",
"prototype",
".",
"run",
"=",
"function",
"run",
"(",
"command",
",",
"args",
")",
"{",
"// logger.d... | mock up the ChildProcess injectable to capture calls before they go to a local shell | [
"mock",
"up",
"the",
"ChildProcess",
"injectable",
"to",
"capture",
"calls",
"before",
"they",
"go",
"to",
"a",
"local",
"shell"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/spec/lib/jobs/poweron-node-spec.js#L10-L27 | train | |
RackHD/on-tasks | spec/lib/jobs/poweron-node-spec.js | function() {
function MockWaterline() {}
MockWaterline.prototype.nodes = {};
MockWaterline.prototype.nodes.findByIdentifier = function (nodeId) {
//return instance of a node with settings in it...
return Promise.resolve({
obmSettings: [
... | javascript | function() {
function MockWaterline() {}
MockWaterline.prototype.nodes = {};
MockWaterline.prototype.nodes.findByIdentifier = function (nodeId) {
//return instance of a node with settings in it...
return Promise.resolve({
obmSettings: [
... | [
"function",
"(",
")",
"{",
"function",
"MockWaterline",
"(",
")",
"{",
"}",
"MockWaterline",
".",
"prototype",
".",
"nodes",
"=",
"{",
"}",
";",
"MockWaterline",
".",
"prototype",
".",
"nodes",
".",
"findByIdentifier",
"=",
"function",
"(",
"nodeId",
")",
... | mock up the Services.Waterline injectable to subvert model lookups for our tests | [
"mock",
"up",
"the",
"Services",
".",
"Waterline",
"injectable",
"to",
"subvert",
"model",
"lookups",
"for",
"our",
"tests"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/spec/lib/jobs/poweron-node-spec.js#L30-L50 | train | |
RackHD/on-tasks | lib/jobs/pdu-node-relations.js | _adjustIpStrFormat | function _adjustIpStrFormat(ipString) {
var ip = ipString.split('.');
ipString = '';
for (var i = 0; i < ip.length; i += 1) {
switch (ip[i].length) {
case 1:
ip[i] = '00' + ip[i];
break;
case 2:
... | javascript | function _adjustIpStrFormat(ipString) {
var ip = ipString.split('.');
ipString = '';
for (var i = 0; i < ip.length; i += 1) {
switch (ip[i].length) {
case 1:
ip[i] = '00' + ip[i];
break;
case 2:
... | [
"function",
"_adjustIpStrFormat",
"(",
"ipString",
")",
"{",
"var",
"ip",
"=",
"ipString",
".",
"split",
"(",
"'.'",
")",
";",
"ipString",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"ip",
".",
"length",
";",
"i",
"+=",
"1",
... | Adjust ip Address format to 3 digits
return ip address string | [
"Adjust",
"ip",
"Address",
"format",
"to",
"3",
"digits",
"return",
"ip",
"address",
"string"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/jobs/pdu-node-relations.js#L171-L188 | train |
stadt-bielefeld/wms-downloader | src/helper/getRequestObject.js | getRequestObject | function getRequestObject(config, url) {
if (!request) {
// Init request object
request = require('request').defaults({
'headers': {
'User-Agent': config.request.userAgent
},
strictSSL: false,
timeout: config.request.timeout
});
}
if (!requestProxy) {
// If intern... | javascript | function getRequestObject(config, url) {
if (!request) {
// Init request object
request = require('request').defaults({
'headers': {
'User-Agent': config.request.userAgent
},
strictSSL: false,
timeout: config.request.timeout
});
}
if (!requestProxy) {
// If intern... | [
"function",
"getRequestObject",
"(",
"config",
",",
"url",
")",
"{",
"if",
"(",
"!",
"request",
")",
"{",
"// Init request object",
"request",
"=",
"require",
"(",
"'request'",
")",
".",
"defaults",
"(",
"{",
"'headers'",
":",
"{",
"'User-Agent'",
":",
"co... | Request object with internet proxy
Returns the correct request object with the right proxy settings.
@param {String} url URL of tile
@returns {Object} Object from request module (let request = require('request');) | [
"Request",
"object",
"with",
"internet",
"proxy",
"Returns",
"the",
"correct",
"request",
"object",
"with",
"the",
"right",
"proxy",
"settings",
"."
] | 8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d | https://github.com/stadt-bielefeld/wms-downloader/blob/8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d/src/helper/getRequestObject.js#L15-L66 | train |
RackHD/on-tasks | spec/mocks/logger.js | Logger | function Logger (module) {
// Set the intiial module to the provided string value if present.
this.module = module !== undefined ? module.toString() : 'No Module';
// If the module is a function then we'll look for di.js annotations to get the
// provide string.
if (_.isFunction... | javascript | function Logger (module) {
// Set the intiial module to the provided string value if present.
this.module = module !== undefined ? module.toString() : 'No Module';
// If the module is a function then we'll look for di.js annotations to get the
// provide string.
if (_.isFunction... | [
"function",
"Logger",
"(",
"module",
")",
"{",
"// Set the intiial module to the provided string value if present.",
"this",
".",
"module",
"=",
"module",
"!==",
"undefined",
"?",
"module",
".",
"toString",
"(",
")",
":",
"'No Module'",
";",
"// If the module is a funct... | Logger is a logger class which provides methods for logging based
on log levels with mesages & metadata provisions. This logger is a stub for the real
logger used that doesn't persist or publish logs over AMQP.
Usage:
var logger=Logger.initialize(yourFunctionOrInjectable)
logger.info('Your message here...', { hello: ... | [
"Logger",
"is",
"a",
"logger",
"class",
"which",
"provides",
"methods",
"for",
"logging",
"based",
"on",
"log",
"levels",
"with",
"mesages",
"&",
"metadata",
"provisions",
".",
"This",
"logger",
"is",
"a",
"stub",
"for",
"the",
"real",
"logger",
"used",
"t... | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/spec/mocks/logger.js#L32-L57 | train |
imcuttle/babel-plugin-danger-remove-unused-import | src/utils/getSpecImport.js | getSpecifierIdentifiers | function getSpecifierIdentifiers(specifiers = [], withPath = false) {
const collection = [];
function loop(path, index) {
const node = path.node
const item = !withPath ? node.local.name : { path, name: node.local.name }
switch (node.type) {
case 'ImportDefaultSpecifier':
case 'ImportSpecifie... | javascript | function getSpecifierIdentifiers(specifiers = [], withPath = false) {
const collection = [];
function loop(path, index) {
const node = path.node
const item = !withPath ? node.local.name : { path, name: node.local.name }
switch (node.type) {
case 'ImportDefaultSpecifier':
case 'ImportSpecifie... | [
"function",
"getSpecifierIdentifiers",
"(",
"specifiers",
"=",
"[",
"]",
",",
"withPath",
"=",
"false",
")",
"{",
"const",
"collection",
"=",
"[",
"]",
";",
"function",
"loop",
"(",
"path",
",",
"index",
")",
"{",
"const",
"node",
"=",
"path",
".",
"no... | get identifiers from the code, as follows
input: `import { b, c } from 'a'`
output: ['b', 'c']
input: `import a from 'a'`
output: ['a'] | [
"get",
"identifiers",
"from",
"the",
"code",
"as",
"follows"
] | 25ea4078a83524b786ad762e60cbf8c3b613e64b | https://github.com/imcuttle/babel-plugin-danger-remove-unused-import/blob/25ea4078a83524b786ad762e60cbf8c3b613e64b/src/utils/getSpecImport.js#L22-L38 | train |
pierrec/js-cuint | build/uint32.js | UINT32 | function UINT32 (l, h) {
if ( !(this instanceof UINT32) )
return new UINT32(l, h)
this._low = 0
this._high = 0
this.remainder = null
if (typeof h == 'undefined')
return fromNumber.call(this, l)
if (typeof l == 'string')
return fromString.call(this, l, h)
fromBits.call(this, l, h)
} | javascript | function UINT32 (l, h) {
if ( !(this instanceof UINT32) )
return new UINT32(l, h)
this._low = 0
this._high = 0
this.remainder = null
if (typeof h == 'undefined')
return fromNumber.call(this, l)
if (typeof l == 'string')
return fromString.call(this, l, h)
fromBits.call(this, l, h)
} | [
"function",
"UINT32",
"(",
"l",
",",
"h",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"UINT32",
")",
")",
"return",
"new",
"UINT32",
"(",
"l",
",",
"h",
")",
"this",
".",
"_low",
"=",
"0",
"this",
".",
"_high",
"=",
"0",
"this",
".",
... | Represents an unsigned 32 bits integer
@constructor
@param {Number|String|Number} low bits | integer as a string | integer as a number
@param {Number|Number|Undefined} high bits | radix (optional, default=10)
@return | [
"Represents",
"an",
"unsigned",
"32",
"bits",
"integer"
] | b93425a8f1b98bab8e357cede34ed491125c0d8b | https://github.com/pierrec/js-cuint/blob/b93425a8f1b98bab8e357cede34ed491125c0d8b/build/uint32.js#L29-L43 | train |
pierrec/js-cuint | build/uint32.js | fromString | function fromString (s, radix) {
var value = parseInt(s, radix || 10)
this._low = value & 0xFFFF
this._high = value >>> 16
return this
} | javascript | function fromString (s, radix) {
var value = parseInt(s, radix || 10)
this._low = value & 0xFFFF
this._high = value >>> 16
return this
} | [
"function",
"fromString",
"(",
"s",
",",
"radix",
")",
"{",
"var",
"value",
"=",
"parseInt",
"(",
"s",
",",
"radix",
"||",
"10",
")",
"this",
".",
"_low",
"=",
"value",
"&",
"0xFFFF",
"this",
".",
"_high",
"=",
"value",
">>>",
"16",
"return",
"this... | Set the current _UINT32_ object from a string
@method fromString
@param {String} integer as a string
@param {Number} radix (optional, default=10)
@return ThisExpression | [
"Set",
"the",
"current",
"_UINT32_",
"object",
"from",
"a",
"string"
] | b93425a8f1b98bab8e357cede34ed491125c0d8b | https://github.com/pierrec/js-cuint/blob/b93425a8f1b98bab8e357cede34ed491125c0d8b/build/uint32.js#L81-L88 | train |
RackHD/on-tasks | lib/jobs/get-catalog-values-job.js | GetCatalogValuesJob | function GetCatalogValuesJob(options, context, taskId){
GetCatalogValuesJob.super_.call(this, logger, options, context, taskId);
this.nodeId = context.target;
this.options = options;
this.logger = logger;
} | javascript | function GetCatalogValuesJob(options, context, taskId){
GetCatalogValuesJob.super_.call(this, logger, options, context, taskId);
this.nodeId = context.target;
this.options = options;
this.logger = logger;
} | [
"function",
"GetCatalogValuesJob",
"(",
"options",
",",
"context",
",",
"taskId",
")",
"{",
"GetCatalogValuesJob",
".",
"super_",
".",
"call",
"(",
"this",
",",
"logger",
",",
"options",
",",
"context",
",",
"taskId",
")",
";",
"this",
".",
"nodeId",
"=",
... | This job finds one or more requested values from one or more specified catalogs.
The catalog values are made available in the shared context in an object that
maps the catalog values to requester provided keys.
Example requestedData array:
[{
"source": "ohai",
"keys": {
"myIPAddrKeyName": "data.ipaddress"
}
}]
Adds t... | [
"This",
"job",
"finds",
"one",
"or",
"more",
"requested",
"values",
"from",
"one",
"or",
"more",
"specified",
"catalogs",
".",
"The",
"catalog",
"values",
"are",
"made",
"available",
"in",
"the",
"shared",
"context",
"in",
"an",
"object",
"that",
"maps",
"... | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/jobs/get-catalog-values-job.js#L50-L55 | train |
stadt-bielefeld/wms-downloader | src/helper/createGetMap.js | createGetMap | function createGetMap(wms, bbox, width, height) {
let getmap = wms.getmap.url;
for (let key in wms.getmap.kvp) {
getmap += encodeURIComponent(key) + '=' + encodeURIComponent(wms.getmap.kvp[key]) + '&';
}
getmap += 'BBOX=' + encodeURIComponent(bbox) + '&';
getmap += 'WIDTH=' + encodeURIComponent(width) +... | javascript | function createGetMap(wms, bbox, width, height) {
let getmap = wms.getmap.url;
for (let key in wms.getmap.kvp) {
getmap += encodeURIComponent(key) + '=' + encodeURIComponent(wms.getmap.kvp[key]) + '&';
}
getmap += 'BBOX=' + encodeURIComponent(bbox) + '&';
getmap += 'WIDTH=' + encodeURIComponent(width) +... | [
"function",
"createGetMap",
"(",
"wms",
",",
"bbox",
",",
"width",
",",
"height",
")",
"{",
"let",
"getmap",
"=",
"wms",
".",
"getmap",
".",
"url",
";",
"for",
"(",
"let",
"key",
"in",
"wms",
".",
"getmap",
".",
"kvp",
")",
"{",
"getmap",
"+=",
"... | Creates a full GetMap request from the following parameters.
@param {Object} wms Object with the GetMap base url and necessary key value pairs (kvp) like `{ 'getmap': { 'url':'http://', kvp: {'key': 'value' } } }`
@param {String} bbox BBOX of the GetMap request
@param {Number|String} width Width of the GetMap request
... | [
"Creates",
"a",
"full",
"GetMap",
"request",
"from",
"the",
"following",
"parameters",
"."
] | 8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d | https://github.com/stadt-bielefeld/wms-downloader/blob/8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d/src/helper/createGetMap.js#L36-L48 | train |
stadt-bielefeld/wms-downloader | src/helper/handleWMS.js | handleWMS | function handleWMS(options, ws, res, wmsIdx, config, progress, callback) {
// WMS object
let wms = options.wms[wmsIdx];
// Workspace of this WMS
let wmsWs = ws;
if (options.wms.length > 1) {
wmsWs += '/' + wms.id;
}
// Create directory of WMS workspace
fs.ensureDir(wmsWs, function (err) {
//... | javascript | function handleWMS(options, ws, res, wmsIdx, config, progress, callback) {
// WMS object
let wms = options.wms[wmsIdx];
// Workspace of this WMS
let wmsWs = ws;
if (options.wms.length > 1) {
wmsWs += '/' + wms.id;
}
// Create directory of WMS workspace
fs.ensureDir(wmsWs, function (err) {
//... | [
"function",
"handleWMS",
"(",
"options",
",",
"ws",
",",
"res",
",",
"wmsIdx",
",",
"config",
",",
"progress",
",",
"callback",
")",
"{",
"// WMS object",
"let",
"wms",
"=",
"options",
".",
"wms",
"[",
"wmsIdx",
"]",
";",
"// Workspace of this WMS",
"let",... | It handles recursive all Web Map Services of a resolution.
@param {Object} options
@param {String} ws Resolution workspace
@param {Object} res Resolution object
@param {Number} wmsIdx Index of WMS
@param {Object} config See options of the {@link WMSDownloader|WMSDownloader constructor}
@param {Array} progress Array of... | [
"It",
"handles",
"recursive",
"all",
"Web",
"Map",
"Services",
"of",
"a",
"resolution",
"."
] | 8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d | https://github.com/stadt-bielefeld/wms-downloader/blob/8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d/src/helper/handleWMS.js#L17-L90 | train |
stadt-bielefeld/wms-downloader | src/helper/determineGroundResolution.js | determineGroundResolution | function determineGroundResolution(res) {
//iterate over all resolutions
for (let int = 0; int < res.length; int++) {
let r = res[int];
//calculate the resolution if not available
if (!r.groundResolution) {
r.groundResolution = (0.0254 * r.scale) / r.dpi;
}
}
} | javascript | function determineGroundResolution(res) {
//iterate over all resolutions
for (let int = 0; int < res.length; int++) {
let r = res[int];
//calculate the resolution if not available
if (!r.groundResolution) {
r.groundResolution = (0.0254 * r.scale) / r.dpi;
}
}
} | [
"function",
"determineGroundResolution",
"(",
"res",
")",
"{",
"//iterate over all resolutions",
"for",
"(",
"let",
"int",
"=",
"0",
";",
"int",
"<",
"res",
".",
"length",
";",
"int",
"++",
")",
"{",
"let",
"r",
"=",
"res",
"[",
"int",
"]",
";",
"//cal... | Calculates the ground resolution from scale and dpi.
If `groundResolution` is not set, it will be calculated and set into the array.
@param {Array<Object>} res Resolutions defined with scales like `[ {'dpi': 72, 'scale': 5000 }, {'dpi': 72, 'scale': 10000 } ]`
@example
const res = [ {'dpi': 72, 'scale': 5000 }, {'dp... | [
"Calculates",
"the",
"ground",
"resolution",
"from",
"scale",
"and",
"dpi",
".",
"If",
"groundResolution",
"is",
"not",
"set",
"it",
"will",
"be",
"calculated",
"and",
"set",
"into",
"the",
"array",
"."
] | 8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d | https://github.com/stadt-bielefeld/wms-downloader/blob/8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d/src/helper/determineGroundResolution.js#L16-L28 | train |
RackHD/on-tasks | lib/utils/job-utils/net-snmp-parser.js | parseSnmpLine | function parseSnmpLine(line) {
if (typeof line !== 'string') {
throw new Error("Data is not in string format");
}
var data = line.trim();
var errString = 'No Such Object available on this agent at this OID';
if (data.indexOf(errString) >= 0) {
throw new ... | javascript | function parseSnmpLine(line) {
if (typeof line !== 'string') {
throw new Error("Data is not in string format");
}
var data = line.trim();
var errString = 'No Such Object available on this agent at this OID';
if (data.indexOf(errString) >= 0) {
throw new ... | [
"function",
"parseSnmpLine",
"(",
"line",
")",
"{",
"if",
"(",
"typeof",
"line",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Data is not in string format\"",
")",
";",
"}",
"var",
"data",
"=",
"line",
".",
"trim",
"(",
")",
";",
"var",
... | Parse a line of output from SNMP data
@param line
@returns {{value: *, oid: *}} | [
"Parse",
"a",
"line",
"of",
"output",
"from",
"SNMP",
"data"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/net-snmp-parser.js#L18-L47 | train |
RackHD/on-tasks | lib/utils/job-utils/net-snmp-parser.js | parseSnmpData | function parseSnmpData(snmpData) {
var lines = snmpData.trim().split('\n');
return _.compact(_.map(lines, function(line) {
return parseSnmpLine(line);
}));
} | javascript | function parseSnmpData(snmpData) {
var lines = snmpData.trim().split('\n');
return _.compact(_.map(lines, function(line) {
return parseSnmpLine(line);
}));
} | [
"function",
"parseSnmpData",
"(",
"snmpData",
")",
"{",
"var",
"lines",
"=",
"snmpData",
".",
"trim",
"(",
")",
".",
"split",
"(",
"'\\n'",
")",
";",
"return",
"_",
".",
"compact",
"(",
"_",
".",
"map",
"(",
"lines",
",",
"function",
"(",
"line",
"... | Parse the SNMP data.
@param snmpData
@returns [*] | [
"Parse",
"the",
"SNMP",
"data",
"."
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/net-snmp-parser.js#L54-L59 | train |
RackHD/on-tasks | lib/jobs/download-file.js | DownloadFileJob | function DownloadFileJob(options, context, taskId) {
var self = this;
DownloadFileJob.super_.call(self, logger, options, context, taskId);
self.nodeId = self.context.target;
if (self.options.filePath) {
self.options.filePath = self.options.filePath.trim();
if (_.... | javascript | function DownloadFileJob(options, context, taskId) {
var self = this;
DownloadFileJob.super_.call(self, logger, options, context, taskId);
self.nodeId = self.context.target;
if (self.options.filePath) {
self.options.filePath = self.options.filePath.trim();
if (_.... | [
"function",
"DownloadFileJob",
"(",
"options",
",",
"context",
",",
"taskId",
")",
"{",
"var",
"self",
"=",
"this",
";",
"DownloadFileJob",
".",
"super_",
".",
"call",
"(",
"self",
",",
"logger",
",",
"options",
",",
"context",
",",
"taskId",
")",
";",
... | This job will fetch a file from some repository
@param {Object} options
@param {Object} context
@param {String} taskId
@constructor | [
"This",
"job",
"will",
"fetch",
"a",
"file",
"from",
"some",
"repository"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/jobs/download-file.js#L38-L49 | train |
DenisCarriere/sqlite3-offline | scripts/update-binaries.js | getVersion | function getVersion () {
const url = 'https://raw.githubusercontent.com/mapbox/node-sqlite3/master/package.json'
return new Promise((resolve, reject) => {
https.get(url, res => {
let data = ''
res.setEncoding('utf8')
if (res.statusCode !== 200) return reject(res.statusMessage)
res.on('da... | javascript | function getVersion () {
const url = 'https://raw.githubusercontent.com/mapbox/node-sqlite3/master/package.json'
return new Promise((resolve, reject) => {
https.get(url, res => {
let data = ''
res.setEncoding('utf8')
if (res.statusCode !== 200) return reject(res.statusMessage)
res.on('da... | [
"function",
"getVersion",
"(",
")",
"{",
"const",
"url",
"=",
"'https://raw.githubusercontent.com/mapbox/node-sqlite3/master/package.json'",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"https",
".",
"get",
"(",
"url",
",",
"res"... | getVersion directly from GitHub repo package.json
@returns {Promise<string>} version
@example
const version = await getVersion()
//= '3.1.8' | [
"getVersion",
"directly",
"from",
"GitHub",
"repo",
"package",
".",
"json"
] | c4fe3eda2d51b71af44105ce016b324838feea4b | https://github.com/DenisCarriere/sqlite3-offline/blob/c4fe3eda2d51b71af44105ce016b324838feea4b/scripts/update-binaries.js#L21-L32 | train |
DenisCarriere/sqlite3-offline | scripts/update-binaries.js | main | async function main () {
const version = await getVersion()
for (const MODULE of ELECTRON_MODULES) {
for (const PLATFORM of PLATFORMS) {
for (const ARCH of ARCHS) {
const name = getElectronName(MODULE, PLATFORM, ARCH)
const filename = name + '.tar.gz'
const url = getUrl(version, n... | javascript | async function main () {
const version = await getVersion()
for (const MODULE of ELECTRON_MODULES) {
for (const PLATFORM of PLATFORMS) {
for (const ARCH of ARCHS) {
const name = getElectronName(MODULE, PLATFORM, ARCH)
const filename = name + '.tar.gz'
const url = getUrl(version, n... | [
"async",
"function",
"main",
"(",
")",
"{",
"const",
"version",
"=",
"await",
"getVersion",
"(",
")",
"for",
"(",
"const",
"MODULE",
"of",
"ELECTRON_MODULES",
")",
"{",
"for",
"(",
"const",
"PLATFORM",
"of",
"PLATFORMS",
")",
"{",
"for",
"(",
"const",
... | Update Binaries Scripts | [
"Update",
"Binaries",
"Scripts"
] | c4fe3eda2d51b71af44105ce016b324838feea4b | https://github.com/DenisCarriere/sqlite3-offline/blob/c4fe3eda2d51b71af44105ce016b324838feea4b/scripts/update-binaries.js#L109-L146 | train |
RackHD/on-tasks | lib/utils/job-utils/command-parser.js | _parseControllerInfoOneDriveData | function _parseControllerInfoOneDriveData(dataBlock) {
//split output by empty line
var dataSegments = dataBlock.split(/\n/); //Divided by line
var drvObj = {};
_.forEach(dataSegments, function(data) {
data = data.trim();
// Ignore empty line
if (data... | javascript | function _parseControllerInfoOneDriveData(dataBlock) {
//split output by empty line
var dataSegments = dataBlock.split(/\n/); //Divided by line
var drvObj = {};
_.forEach(dataSegments, function(data) {
data = data.trim();
// Ignore empty line
if (data... | [
"function",
"_parseControllerInfoOneDriveData",
"(",
"dataBlock",
")",
"{",
"//split output by empty line",
"var",
"dataSegments",
"=",
"dataBlock",
".",
"split",
"(",
"/",
"\\n",
"/",
")",
";",
"//Divided by line",
"var",
"drvObj",
"=",
"{",
"}",
";",
"_",
".",... | Parse the whole controller info of one drive.
@param {String} dataBlock - The controller info output data for one drive.
@returns {Object} The object with well classfied controller information. | [
"Parse",
"the",
"whole",
"controller",
"info",
"of",
"one",
"drive",
"."
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/command-parser.js#L1255-L1273 | train |
RackHD/on-tasks | lib/utils/job-utils/command-parser.js | _parseSmartOneDriveData | function _parseSmartOneDriveData(dataBlock) {
//split output by empty line
var dataSegments = dataBlock.split(/\r?\n\s*\r?\n/); //Divided by empty line
var drvObj = {};
_.forEach(dataSegments, function(data) {
data = data.trim();
//remove the empty data segment ... | javascript | function _parseSmartOneDriveData(dataBlock) {
//split output by empty line
var dataSegments = dataBlock.split(/\r?\n\s*\r?\n/); //Divided by empty line
var drvObj = {};
_.forEach(dataSegments, function(data) {
data = data.trim();
//remove the empty data segment ... | [
"function",
"_parseSmartOneDriveData",
"(",
"dataBlock",
")",
"{",
"//split output by empty line",
"var",
"dataSegments",
"=",
"dataBlock",
".",
"split",
"(",
"/",
"\\r?\\n\\s*\\r?\\n",
"/",
")",
";",
"//Divided by empty line",
"var",
"drvObj",
"=",
"{",
"}",
";",
... | Parse the whole SMART data of one drive.
The data catalog is refer to the smartctl GUI.
@param {String} dataBlock - The whole smartctl output data for one drive.
@returns {Object} The object with well classfied SMART information. | [
"Parse",
"the",
"whole",
"SMART",
"data",
"of",
"one",
"drive",
"."
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/command-parser.js#L1282-L1332 | train |
RackHD/on-tasks | lib/utils/job-utils/command-parser.js | _parseSmartInfoSection | function _parseSmartInfoSection(lines) {
/*
*Example data:
=== START OF INFORMATION SECTION ===
Device Model: Micron_P400e-MTFDDAK200MAR
Serial Number: 1144031E6FB3
LU WWN Device Id: 5 00a075 1031e6fb3
Firmware Version: 0135
User Capacity: ... | javascript | function _parseSmartInfoSection(lines) {
/*
*Example data:
=== START OF INFORMATION SECTION ===
Device Model: Micron_P400e-MTFDDAK200MAR
Serial Number: 1144031E6FB3
LU WWN Device Id: 5 00a075 1031e6fb3
Firmware Version: 0135
User Capacity: ... | [
"function",
"_parseSmartInfoSection",
"(",
"lines",
")",
"{",
"/*\n *Example data:\n\n === START OF INFORMATION SECTION ===\n Device Model: Micron_P400e-MTFDDAK200MAR\n Serial Number: 1144031E6FB3\n LU WWN Device Id: 5 00a075 1031e6fb3\n Firmware Ve... | Parse the SMART information section
@param {Array} The data to parse, it has been splitted by lines
@return {Object} | [
"Parse",
"the",
"SMART",
"information",
"section"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/command-parser.js#L1380-L1397 | train |
RackHD/on-tasks | lib/utils/job-utils/command-parser.js | _parseSmartSelfAssessment | function _parseSmartSelfAssessment(lines) {
/*
Example 1:
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Example 2:
=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK
*/
... | javascript | function _parseSmartSelfAssessment(lines) {
/*
Example 1:
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Example 2:
=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK
*/
... | [
"function",
"_parseSmartSelfAssessment",
"(",
"lines",
")",
"{",
"/*\n Example 1:\n\n === START OF READ SMART DATA SECTION ===\n SMART overall-health self-assessment test result: PASSED\n\n Example 2:\n\n === START OF READ SMART DATA SECTION ===\n SM... | Parse the SMART self-assessment result
@param {Array} The data to parse, it has been splitted by lines
@return {Object} | [
"Parse",
"the",
"SMART",
"self",
"-",
"assessment",
"result"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/command-parser.js#L1405-L1423 | train |
RackHD/on-tasks | lib/utils/job-utils/command-parser.js | _parseSmartCapabilities | function _parseSmartCapabilities(lines) {
var combineLines = [];
var strBuf = '';
/*
The first line is 'General SMART Values:', it should be discarded.
Some of the entry information is divided into multiline,
so first we try to combine these lines to achieve a regula... | javascript | function _parseSmartCapabilities(lines) {
var combineLines = [];
var strBuf = '';
/*
The first line is 'General SMART Values:', it should be discarded.
Some of the entry information is divided into multiline,
so first we try to combine these lines to achieve a regula... | [
"function",
"_parseSmartCapabilities",
"(",
"lines",
")",
"{",
"var",
"combineLines",
"=",
"[",
"]",
";",
"var",
"strBuf",
"=",
"''",
";",
"/*\n The first line is 'General SMART Values:', it should be discarded.\n\n Some of the entry information is divided into mult... | Parse SMART capabilities information from smartctl output
@param {Array} The data to parse, it has been splitted by lines
@return {Array} All parsed capabilities entries,
each entry contains properties 'Name', 'Value' and 'Annotation'. | [
"Parse",
"SMART",
"capabilities",
"information",
"from",
"smartctl",
"output"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/command-parser.js#L1432-L1482 | train |
RackHD/on-tasks | lib/utils/job-utils/command-parser.js | _parseSmartAttributes | function _parseSmartAttributes(lines) {
var attrObj = {};
/* Example data:
SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED
1 Raw_Read_Error_Rat... | javascript | function _parseSmartAttributes(lines) {
var attrObj = {};
/* Example data:
SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED
1 Raw_Read_Error_Rat... | [
"function",
"_parseSmartAttributes",
"(",
"lines",
")",
"{",
"var",
"attrObj",
"=",
"{",
"}",
";",
"/* Example data:\n SMART Attributes Data Structure revision number: 1\n Vendor Specific SMART Attributes with Thresholds:\n ID# ATTRIBUTE_NAME FLAG VALUE WORST... | Parse the SMART attribute table
@param {Array} The input data that has been splitted by line.
@param {Object} The object with SMART attribute revision and table. | [
"Parse",
"the",
"SMART",
"attribute",
"table"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/command-parser.js#L1490-L1507 | train |
RackHD/on-tasks | lib/utils/job-utils/command-parser.js | _parseSmartErrorLog | function _parseSmartErrorLog(lines) {
var resultObj = {};
//Parse first line to get revision number
//Example data:
//SMART Error Log Version: 1
if (lines.length > 0) {
resultObj.Revision = (lines[0].substring(
lines[0].lastIndexOf(' ') + 1)).trim();
... | javascript | function _parseSmartErrorLog(lines) {
var resultObj = {};
//Parse first line to get revision number
//Example data:
//SMART Error Log Version: 1
if (lines.length > 0) {
resultObj.Revision = (lines[0].substring(
lines[0].lastIndexOf(' ') + 1)).trim();
... | [
"function",
"_parseSmartErrorLog",
"(",
"lines",
")",
"{",
"var",
"resultObj",
"=",
"{",
"}",
";",
"//Parse first line to get revision number",
"//Example data:",
"//SMART Error Log Version: 1",
"if",
"(",
"lines",
".",
"length",
">",
"0",
")",
"{",
"resultObj",
"."... | Parse SMART error log
@param {Array} The data to parse, it has been splitted by line.
@return {Object} The object with error log revision and table. | [
"Parse",
"SMART",
"error",
"log"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/command-parser.js#L1515-L1535 | train |
RackHD/on-tasks | lib/utils/job-utils/command-parser.js | _parseSmartTable | function _parseSmartTable(lines,
ignoreLinesCount,
regSplitRow,
funcCheckTableEnd)
{
/* Example 1:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED
1 Raw_Read_Error_Rate ... | javascript | function _parseSmartTable(lines,
ignoreLinesCount,
regSplitRow,
funcCheckTableEnd)
{
/* Example 1:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED
1 Raw_Read_Error_Rate ... | [
"function",
"_parseSmartTable",
"(",
"lines",
",",
"ignoreLinesCount",
",",
"regSplitRow",
",",
"funcCheckTableEnd",
")",
"{",
"/* Example 1:\n\n ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED\n 1 Raw_Read_Error_Rate 0x0003 100 100 006 ... | Parse the table data to an array of object
The object properties (column header) is extracted from the first
valid line (line index = ignoreLinesCount)
@param {Array} The data to parse, it has been splitted by lines
@param {Number} The number of lines that needed be discarded before parsing.
@param {RegExp} The regul... | [
"Parse",
"the",
"table",
"data",
"to",
"an",
"array",
"of",
"object"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/command-parser.js#L1638-L1699 | train |
RackHD/on-tasks | lib/utils/job-utils/catalog-searcher.js | findDriveWwidByIndex | function findDriveWwidByIndex(catalog, isEsx, driveIndex) {
var wwid = null;
_.forEach(catalog, function(entry) {
if (entry.identifier === driveIndex) {
wwid = isEsx ? entry.esxiWwid : entry.linuxWwid;
return false; //have found the result, so we can exit iter... | javascript | function findDriveWwidByIndex(catalog, isEsx, driveIndex) {
var wwid = null;
_.forEach(catalog, function(entry) {
if (entry.identifier === driveIndex) {
wwid = isEsx ? entry.esxiWwid : entry.linuxWwid;
return false; //have found the result, so we can exit iter... | [
"function",
"findDriveWwidByIndex",
"(",
"catalog",
",",
"isEsx",
",",
"driveIndex",
")",
"{",
"var",
"wwid",
"=",
"null",
";",
"_",
".",
"forEach",
"(",
"catalog",
",",
"function",
"(",
"entry",
")",
"{",
"if",
"(",
"entry",
".",
"identifier",
"===",
... | Search the driveid catalog and lookup the corresponding drive WWID by the input
drive index.
@param {Object} catalog - the catalog data of drive id
@param {Boolean} isEsx - True to return the ESXi formated wwid,
otherwise linux format wwid.
@param {Number} driveIndex - The drive index
@return {String} The WWID for the ... | [
"Search",
"the",
"driveid",
"catalog",
"and",
"lookup",
"the",
"corresponding",
"drive",
"WWID",
"by",
"the",
"input",
"drive",
"index",
"."
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/catalog-searcher.js#L46-L55 | train |
RackHD/on-tasks | lib/utils/job-utils/catalog-searcher.js | getDriveIdCatalog | function getDriveIdCatalog(nodeId, filter) {
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'driveId'
}).then(function (catalog) {
if (!catalog || !_.has(catalog, 'data[0]')) {
return Promise.reject(
new Error('Cou... | javascript | function getDriveIdCatalog(nodeId, filter) {
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'driveId'
}).then(function (catalog) {
if (!catalog || !_.has(catalog, 'data[0]')) {
return Promise.reject(
new Error('Cou... | [
"function",
"getDriveIdCatalog",
"(",
"nodeId",
",",
"filter",
")",
"{",
"return",
"waterline",
".",
"catalogs",
".",
"findMostRecent",
"(",
"{",
"node",
":",
"nodeId",
",",
"source",
":",
"'driveId'",
"}",
")",
".",
"then",
"(",
"function",
"(",
"catalog"... | Get driveId catalog data
@param {String} nodeId - node identifier
@param {Object} filter - [optional] The filter which contains the driveId catalogs identifier
Or devName. For example: ['sda', 'sdb', '1'].
driveId catalogs in filter will return, otherwise skip.
@return {Promise} driveId catalogs | [
"Get",
"driveId",
"catalog",
"data"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/catalog-searcher.js#L65-L82 | train |
RackHD/on-tasks | lib/utils/job-utils/catalog-searcher.js | getVirtualDiskCatalog | function getVirtualDiskCatalog(nodeId){
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'megaraid-virtual-disks'
})
.then(function (virtualDiskCatalog) {
if (!_.has(virtualDiskCatalog, 'data.Controllers[0]')) {
return Promise.r... | javascript | function getVirtualDiskCatalog(nodeId){
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'megaraid-virtual-disks'
})
.then(function (virtualDiskCatalog) {
if (!_.has(virtualDiskCatalog, 'data.Controllers[0]')) {
return Promise.r... | [
"function",
"getVirtualDiskCatalog",
"(",
"nodeId",
")",
"{",
"return",
"waterline",
".",
"catalogs",
".",
"findMostRecent",
"(",
"{",
"node",
":",
"nodeId",
",",
"source",
":",
"'megaraid-virtual-disks'",
"}",
")",
".",
"then",
"(",
"function",
"(",
"virtualD... | Get virtual disk catalog data
@param {String} nodeId - node identifier
@return {Promise} drive virtual disk catalogs | [
"Get",
"virtual",
"disk",
"catalog",
"data"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/catalog-searcher.js#L89-L101 | train |
RackHD/on-tasks | lib/utils/job-utils/catalog-searcher.js | getPhysicalDiskCatalog | function getPhysicalDiskCatalog(nodeId){
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'megaraid-physical-drives'
})
.then(function(physicalDiskCatalog){
if (!_.has(physicalDiskCatalog, 'data')) {
return Promise.reject(
... | javascript | function getPhysicalDiskCatalog(nodeId){
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'megaraid-physical-drives'
})
.then(function(physicalDiskCatalog){
if (!_.has(physicalDiskCatalog, 'data')) {
return Promise.reject(
... | [
"function",
"getPhysicalDiskCatalog",
"(",
"nodeId",
")",
"{",
"return",
"waterline",
".",
"catalogs",
".",
"findMostRecent",
"(",
"{",
"node",
":",
"nodeId",
",",
"source",
":",
"'megaraid-physical-drives'",
"}",
")",
".",
"then",
"(",
"function",
"(",
"physi... | Get physical disk catalog data
@param {String} nodeId - node identifier
@return {Promise} drive physical disk catalogs | [
"Get",
"physical",
"disk",
"catalog",
"data"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/catalog-searcher.js#L108-L120 | train |
RackHD/on-tasks | lib/utils/job-utils/catalog-searcher.js | getRaidControllerVendor | function getRaidControllerVendor(nodeId){
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'megaraid-controllers'
})
.then(function (controllerCatalog) {
if (!_.has(controllerCatalog, 'data.Controllers')) {
return Promise.reject... | javascript | function getRaidControllerVendor(nodeId){
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'megaraid-controllers'
})
.then(function (controllerCatalog) {
if (!_.has(controllerCatalog, 'data.Controllers')) {
return Promise.reject... | [
"function",
"getRaidControllerVendor",
"(",
"nodeId",
")",
"{",
"return",
"waterline",
".",
"catalogs",
".",
"findMostRecent",
"(",
"{",
"node",
":",
"nodeId",
",",
"source",
":",
"'megaraid-controllers'",
"}",
")",
".",
"then",
"(",
"function",
"(",
"controll... | Get drive RAID controller vendor from catalog
@param {String} nodeId - node identifier
@return {Promise} drive RAID controller vendors | [
"Get",
"drive",
"RAID",
"controller",
"vendor",
"from",
"catalog"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/catalog-searcher.js#L127-L148 | train |
RackHD/on-tasks | lib/utils/job-utils/catalog-searcher.js | getDriveIdCatalogExt | function getDriveIdCatalogExt(nodeId, filter, extendJbod) {
return getDriveIdCatalog(nodeId, filter)
.then(function (driveIds) {
// get virtualDisk data from megaraid-virtual-disks catalog
var foundVdHasValue = _.find(driveIds, function (driveId) {
return !_.isEmp... | javascript | function getDriveIdCatalogExt(nodeId, filter, extendJbod) {
return getDriveIdCatalog(nodeId, filter)
.then(function (driveIds) {
// get virtualDisk data from megaraid-virtual-disks catalog
var foundVdHasValue = _.find(driveIds, function (driveId) {
return !_.isEmp... | [
"function",
"getDriveIdCatalogExt",
"(",
"nodeId",
",",
"filter",
",",
"extendJbod",
")",
"{",
"return",
"getDriveIdCatalog",
"(",
"nodeId",
",",
"filter",
")",
".",
"then",
"(",
"function",
"(",
"driveIds",
")",
"{",
"// get virtualDisk data from megaraid-virtual-d... | Get extended driveId catalog
@param {String} nodeId - node identifier
@param {Object} driveIds - driveId list retrieved from driveId catalogs
@param {Boolean} extendJbod - flag for if we should extend JBOD physical information
@return {Promise} Drive catalogs extended with Megaraid information | [
"Get",
"extended",
"driveId",
"catalog"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/catalog-searcher.js#L157-L198 | train |
RackHD/on-tasks | lib/utils/job-utils/catalog-searcher.js | _getVdExtDriveIdCatalog | function _getVdExtDriveIdCatalog(nodeId, driveId, virtualDiskData, vendors){
var match = driveId.virtualDisk.match(/^\/c(\d+)\/v(\d+)/);
if (!match) {
return driveId;
}
var vid = match[2];
var cid = match[1];
var vdInfo;
_.forEach(virtualDiskData.Contr... | javascript | function _getVdExtDriveIdCatalog(nodeId, driveId, virtualDiskData, vendors){
var match = driveId.virtualDisk.match(/^\/c(\d+)\/v(\d+)/);
if (!match) {
return driveId;
}
var vid = match[2];
var cid = match[1];
var vdInfo;
_.forEach(virtualDiskData.Contr... | [
"function",
"_getVdExtDriveIdCatalog",
"(",
"nodeId",
",",
"driveId",
",",
"virtualDiskData",
",",
"vendors",
")",
"{",
"var",
"match",
"=",
"driveId",
".",
"virtualDisk",
".",
"match",
"(",
"/",
"^\\/c(\\d+)\\/v(\\d+)",
"/",
")",
";",
"if",
"(",
"!",
"match... | Get extended driveId catalog data for disk from virtualDiskData
@param {String} nodeId - node identifier
@param {Object} driveId - driveId catalog
@param {Object} virtualDiskData - Megaraid virtual disk catalogs
@param {Array} vendors - Drive vendor controller list
@return {Promise} driveId catalogs extended | [
"Get",
"extended",
"driveId",
"catalog",
"data",
"for",
"disk",
"from",
"virtualDiskData"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/catalog-searcher.js#L208-L263 | train |
RackHD/on-tasks | lib/utils/job-utils/catalog-searcher.js | _getJbodExtDriveIdCatalog | function _getJbodExtDriveIdCatalog(nodeId, driveId, physicalDiskData, vendors){
//Devide ID in SCSI ID is used to match megaraid DID
//This feature is only qualified on servers with one RAID card
//An alternative method is to use logic wwid
//to find "OS Device Name" in smart catalog and... | javascript | function _getJbodExtDriveIdCatalog(nodeId, driveId, physicalDiskData, vendors){
//Devide ID in SCSI ID is used to match megaraid DID
//This feature is only qualified on servers with one RAID card
//An alternative method is to use logic wwid
//to find "OS Device Name" in smart catalog and... | [
"function",
"_getJbodExtDriveIdCatalog",
"(",
"nodeId",
",",
"driveId",
",",
"physicalDiskData",
",",
"vendors",
")",
"{",
"//Devide ID in SCSI ID is used to match megaraid DID",
"//This feature is only qualified on servers with one RAID card",
"//An alternative method is to use logic ww... | Get extended driveId catalog data for JBOD disk from megaraid-physical-drives
@param {String} nodeId - node identifier
@param {Object} driveId - driveId catalog
@param {Object} physicalDiskData - Megaraid physical disk catalogs
@param {Array} vendors - Drive vendor controller list
@return {Promise} driveId catalogs ext... | [
"Get",
"extended",
"driveId",
"catalog",
"data",
"for",
"JBOD",
"disk",
"from",
"megaraid",
"-",
"physical",
"-",
"drives"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/catalog-searcher.js#L273-L356 | train |
RackHD/on-tasks | lib/task.js | handleCommonOptions | function handleCommonOptions(options) {
// check the task timeout, if not specified, then set a default one.
if (!options.hasOwnProperty('_taskTimeout') && options.schedulerOverrides &&
options.schedulerOverrides.hasOwnProperty('timeout')) {
options._taskTimeout = options.sch... | javascript | function handleCommonOptions(options) {
// check the task timeout, if not specified, then set a default one.
if (!options.hasOwnProperty('_taskTimeout') && options.schedulerOverrides &&
options.schedulerOverrides.hasOwnProperty('timeout')) {
options._taskTimeout = options.sch... | [
"function",
"handleCommonOptions",
"(",
"options",
")",
"{",
"// check the task timeout, if not specified, then set a default one.",
"if",
"(",
"!",
"options",
".",
"hasOwnProperty",
"(",
"'_taskTimeout'",
")",
"&&",
"options",
".",
"schedulerOverrides",
"&&",
"options",
... | handle task common options
This handling will operate on the input options itself. Currently this function only checks
the task timout setting, if in future there is additional common setting, put it here as
well.
@param {Object} options - The input task options.
@return {Object} the result options object. | [
"handle",
"task",
"common",
"options"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/task.js#L482-L493 | train |
stadt-bielefeld/wms-downloader | src/helper/createWorldFile.js | createWorldFile | function createWorldFile(x0, y0, res) {
let halfPxInM = res / 2.0;
let ret = res + '\n';
ret += '0.0' + '\n';
ret += '0.0' + '\n';
ret += '-' + res + '\n';
ret += x0 + halfPxInM + '\n';
ret += y0 - halfPxInM;
return ret;
} | javascript | function createWorldFile(x0, y0, res) {
let halfPxInM = res / 2.0;
let ret = res + '\n';
ret += '0.0' + '\n';
ret += '0.0' + '\n';
ret += '-' + res + '\n';
ret += x0 + halfPxInM + '\n';
ret += y0 - halfPxInM;
return ret;
} | [
"function",
"createWorldFile",
"(",
"x0",
",",
"y0",
",",
"res",
")",
"{",
"let",
"halfPxInM",
"=",
"res",
"/",
"2.0",
";",
"let",
"ret",
"=",
"res",
"+",
"'\\n'",
";",
"ret",
"+=",
"'0.0'",
"+",
"'\\n'",
";",
"ret",
"+=",
"'0.0'",
"+",
"'\\n'",
... | Creates world file content.
@param {Number} x0 X value of start point (top-left)
@param {Number} y0 Y value of start point (top-left)
@param {Number} res Ground resolution
@returns {string} Content of world file
@example
const x0 = 458000;
const y0 = 5754000;
const res = 1;
let wordlFileContent = createWorldFile(x0, ... | [
"Creates",
"world",
"file",
"content",
"."
] | 8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d | https://github.com/stadt-bielefeld/wms-downloader/blob/8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d/src/helper/createWorldFile.js#L24-L33 | train |
RackHD/on-tasks | lib/services/obm-service.js | ObmService | function ObmService(nodeId, obmServiceFactory, obmSettings, options) {
assert.object(obmSettings);
assert.object(obmSettings.config);
assert.string(obmSettings.service);
assert.func(obmServiceFactory);
assert.isMongoId(nodeId);
this.params = options || {};
this.r... | javascript | function ObmService(nodeId, obmServiceFactory, obmSettings, options) {
assert.object(obmSettings);
assert.object(obmSettings.config);
assert.string(obmSettings.service);
assert.func(obmServiceFactory);
assert.isMongoId(nodeId);
this.params = options || {};
this.r... | [
"function",
"ObmService",
"(",
"nodeId",
",",
"obmServiceFactory",
",",
"obmSettings",
",",
"options",
")",
"{",
"assert",
".",
"object",
"(",
"obmSettings",
")",
";",
"assert",
".",
"object",
"(",
"obmSettings",
".",
"config",
")",
";",
"assert",
".",
"st... | An OBM command interface that runs raw OBM commands from
various OBM services with failure and retry logic.
@constructor | [
"An",
"OBM",
"command",
"interface",
"that",
"runs",
"raw",
"OBM",
"commands",
"from",
"various",
"OBM",
"services",
"with",
"failure",
"and",
"retry",
"logic",
"."
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/services/obm-service.js#L56-L77 | train |
RackHD/on-tasks | lib/services/obm-service.js | _getValidSku | function _getValidSku (node) {
if (node.sku) {
return waterline.skus.findOne({ id: node.sku }).then(function (sku) {
if (sku && sku.name) {
node.sku = sku.name;
}
else {
return Promise.reject();
}... | javascript | function _getValidSku (node) {
if (node.sku) {
return waterline.skus.findOne({ id: node.sku }).then(function (sku) {
if (sku && sku.name) {
node.sku = sku.name;
}
else {
return Promise.reject();
}... | [
"function",
"_getValidSku",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"sku",
")",
"{",
"return",
"waterline",
".",
"skus",
".",
"findOne",
"(",
"{",
"id",
":",
"node",
".",
"sku",
"}",
")",
".",
"then",
"(",
"function",
"(",
"sku",
")",
"{",... | Get valid sku info from database | [
"Get",
"valid",
"sku",
"info",
"from",
"database"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/services/obm-service.js#L657-L671 | train |
pierrec/js-cuint | build/uint64.js | UINT64 | function UINT64 (a00, a16, a32, a48) {
if ( !(this instanceof UINT64) )
return new UINT64(a00, a16, a32, a48)
this.remainder = null
if (typeof a00 == 'string')
return fromString.call(this, a00, a16)
if (typeof a16 == 'undefined')
return fromNumber.call(this, a00)
fromBits.apply(this, arguments)
} | javascript | function UINT64 (a00, a16, a32, a48) {
if ( !(this instanceof UINT64) )
return new UINT64(a00, a16, a32, a48)
this.remainder = null
if (typeof a00 == 'string')
return fromString.call(this, a00, a16)
if (typeof a16 == 'undefined')
return fromNumber.call(this, a00)
fromBits.apply(this, arguments)
} | [
"function",
"UINT64",
"(",
"a00",
",",
"a16",
",",
"a32",
",",
"a48",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"UINT64",
")",
")",
"return",
"new",
"UINT64",
"(",
"a00",
",",
"a16",
",",
"a32",
",",
"a48",
")",
"this",
".",
"remainder... | Represents an unsigned 64 bits integer
@constructor
@param {Number} first low bits (8)
@param {Number} second low bits (8)
@param {Number} first high bits (8)
@param {Number} second high bits (8)
or
@param {Number} low bits (32)
@param {Number} high bits (32)
or
@param {String|Number} integer as a string | integer a... | [
"Represents",
"an",
"unsigned",
"64",
"bits",
"integer"
] | b93425a8f1b98bab8e357cede34ed491125c0d8b | https://github.com/pierrec/js-cuint/blob/b93425a8f1b98bab8e357cede34ed491125c0d8b/build/uint64.js#L35-L47 | train |
pierrec/js-cuint | build/uint64.js | fromBits | function fromBits (a00, a16, a32, a48) {
if (typeof a32 == 'undefined') {
this._a00 = a00 & 0xFFFF
this._a16 = a00 >>> 16
this._a32 = a16 & 0xFFFF
this._a48 = a16 >>> 16
return this
}
this._a00 = a00 | 0
this._a16 = a16 | 0
this._a32 = a32 | 0
this._a48 = a48 | 0
return this
} | javascript | function fromBits (a00, a16, a32, a48) {
if (typeof a32 == 'undefined') {
this._a00 = a00 & 0xFFFF
this._a16 = a00 >>> 16
this._a32 = a16 & 0xFFFF
this._a48 = a16 >>> 16
return this
}
this._a00 = a00 | 0
this._a16 = a16 | 0
this._a32 = a32 | 0
this._a48 = a48 | 0
return this
} | [
"function",
"fromBits",
"(",
"a00",
",",
"a16",
",",
"a32",
",",
"a48",
")",
"{",
"if",
"(",
"typeof",
"a32",
"==",
"'undefined'",
")",
"{",
"this",
".",
"_a00",
"=",
"a00",
"&",
"0xFFFF",
"this",
".",
"_a16",
"=",
"a00",
">>>",
"16",
"this",
"."... | Set the current _UINT64_ object with its low and high bits
@method fromBits
@param {Number} first low bits (8)
@param {Number} second low bits (8)
@param {Number} first high bits (8)
@param {Number} second high bits (8)
or
@param {Number} low bits (32)
@param {Number} high bits (32)
@return ThisExpression | [
"Set",
"the",
"current",
"_UINT64_",
"object",
"with",
"its",
"low",
"and",
"high",
"bits"
] | b93425a8f1b98bab8e357cede34ed491125c0d8b | https://github.com/pierrec/js-cuint/blob/b93425a8f1b98bab8e357cede34ed491125c0d8b/build/uint64.js#L61-L76 | train |
pierrec/js-cuint | build/uint64.js | fromString | function fromString (s, radix) {
radix = radix || 10
this._a00 = 0
this._a16 = 0
this._a32 = 0
this._a48 = 0
/*
In Javascript, bitwise operators only operate on the first 32 bits
of a number, even though parseInt() encodes numbers with a 53 bits
mantissa.
Therefore UINT64(<Number>) can only ... | javascript | function fromString (s, radix) {
radix = radix || 10
this._a00 = 0
this._a16 = 0
this._a32 = 0
this._a48 = 0
/*
In Javascript, bitwise operators only operate on the first 32 bits
of a number, even though parseInt() encodes numbers with a 53 bits
mantissa.
Therefore UINT64(<Number>) can only ... | [
"function",
"fromString",
"(",
"s",
",",
"radix",
")",
"{",
"radix",
"=",
"radix",
"||",
"10",
"this",
".",
"_a00",
"=",
"0",
"this",
".",
"_a16",
"=",
"0",
"this",
".",
"_a32",
"=",
"0",
"this",
".",
"_a48",
"=",
"0",
"/*\n\t\t\tIn Javascript, bitwi... | Set the current _UINT64_ object from a string
@method fromString
@param {String} integer as a string
@param {Number} radix (optional, default=10)
@return ThisExpression | [
"Set",
"the",
"current",
"_UINT64_",
"object",
"from",
"a",
"string"
] | b93425a8f1b98bab8e357cede34ed491125c0d8b | https://github.com/pierrec/js-cuint/blob/b93425a8f1b98bab8e357cede34ed491125c0d8b/build/uint64.js#L102-L139 | train |
RackHD/on-tasks | lib/jobs/switch-node-relations.js | _findMatchingMac | function _findMatchingMac(nodeLldpData, lldpMacList) {
var relationsList = {};
return Promise.all(
_.forEach(_.keys(nodeLldpData.data), function (ethPort) {
//validate mac first
var lldpMac = catalogSearch.getPath(nodeLldpData.data[ethPort], 'chassis.mac');
if... | javascript | function _findMatchingMac(nodeLldpData, lldpMacList) {
var relationsList = {};
return Promise.all(
_.forEach(_.keys(nodeLldpData.data), function (ethPort) {
//validate mac first
var lldpMac = catalogSearch.getPath(nodeLldpData.data[ethPort], 'chassis.mac');
if... | [
"function",
"_findMatchingMac",
"(",
"nodeLldpData",
",",
"lldpMacList",
")",
"{",
"var",
"relationsList",
"=",
"{",
"}",
";",
"return",
"Promise",
".",
"all",
"(",
"_",
".",
"forEach",
"(",
"_",
".",
"keys",
"(",
"nodeLldpData",
".",
"data",
")",
",",
... | Iterate through switch mac addresses list
for a match in nodes lldp catalog
return a promise | [
"Iterate",
"through",
"switch",
"mac",
"addresses",
"list",
"for",
"a",
"match",
"in",
"nodes",
"lldp",
"catalog",
"return",
"a",
"promise"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/jobs/switch-node-relations.js#L190-L217 | train |
RackHD/on-tasks | lib/jobs/switch-node-relations.js | _adjustMacStrFormat | function _adjustMacStrFormat(macString) {
macString = macString.toLowerCase();
var mac = macString.split(':');
macString = '';
for (var i = 0; i < mac.length; i += 1) {
if (mac[i].length === 1) {
mac[i] = '0' + mac[i];
}
macString += ma... | javascript | function _adjustMacStrFormat(macString) {
macString = macString.toLowerCase();
var mac = macString.split(':');
macString = '';
for (var i = 0; i < mac.length; i += 1) {
if (mac[i].length === 1) {
mac[i] = '0' + mac[i];
}
macString += ma... | [
"function",
"_adjustMacStrFormat",
"(",
"macString",
")",
"{",
"macString",
"=",
"macString",
".",
"toLowerCase",
"(",
")",
";",
"var",
"mac",
"=",
"macString",
".",
"split",
"(",
"':'",
")",
";",
"macString",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=... | Adjust mac Address format to 2 hex digits
return mac address string | [
"Adjust",
"mac",
"Address",
"format",
"to",
"2",
"hex",
"digits",
"return",
"mac",
"address",
"string"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/jobs/switch-node-relations.js#L232-L243 | train |
stadt-bielefeld/wms-downloader | src/helper/cropTile.js | cropTile | function cropTile(oldFile, newFile, tileSizePx, gutterSizePx, callback) {
if (oldFile.endsWith('.svg') && newFile.endsWith('.svg')) {
// vector images
fs.readFile(oldFile, { encoding: 'utf8' }, (err, content) => {
if (err) {
callback(err);
} else {
const parser = new xml2js.Parse... | javascript | function cropTile(oldFile, newFile, tileSizePx, gutterSizePx, callback) {
if (oldFile.endsWith('.svg') && newFile.endsWith('.svg')) {
// vector images
fs.readFile(oldFile, { encoding: 'utf8' }, (err, content) => {
if (err) {
callback(err);
} else {
const parser = new xml2js.Parse... | [
"function",
"cropTile",
"(",
"oldFile",
",",
"newFile",
",",
"tileSizePx",
",",
"gutterSizePx",
",",
"callback",
")",
"{",
"if",
"(",
"oldFile",
".",
"endsWith",
"(",
"'.svg'",
")",
"&&",
"newFile",
".",
"endsWith",
"(",
"'.svg'",
")",
")",
"{",
"// vect... | Crops a tile with the gutter size.
@param {String} oldFile File to be crop
@param {String} newFile New cropped file
@param {Number} tileSizePx Size of the new tile
@param {Number} gutterSizePx Size of gutter in the old tile
@param {Function} callback function(err) {}
@example
const oldFile = __dirname + '/cropTileOld.... | [
"Crops",
"a",
"tile",
"with",
"the",
"gutter",
"size",
"."
] | 8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d | https://github.com/stadt-bielefeld/wms-downloader/blob/8e20d7d5547ed43d24d81b8fe3a2c6b4ced83f5d/src/helper/cropTile.js#L29-L95 | train |
RackHD/on-tasks | lib/jobs/wait-sel-events-job.js | _verifyFiltering | function _verifyFiltering(filters, counts, data) {
var reading = data.data.alert.reading;
if (_.isEmpty(reading)) {
return false;
}
var filter = filters[0];
var count = counts[0];
var matched = true;
_.map(filter, function(value, key){
if (... | javascript | function _verifyFiltering(filters, counts, data) {
var reading = data.data.alert.reading;
if (_.isEmpty(reading)) {
return false;
}
var filter = filters[0];
var count = counts[0];
var matched = true;
_.map(filter, function(value, key){
if (... | [
"function",
"_verifyFiltering",
"(",
"filters",
",",
"counts",
",",
"data",
")",
"{",
"var",
"reading",
"=",
"data",
".",
"data",
".",
"alert",
".",
"reading",
";",
"if",
"(",
"_",
".",
"isEmpty",
"(",
"reading",
")",
")",
"{",
"return",
"false",
";"... | Validate events data against filtering conditions.
Alert filters will be validated by indexing sequence.
Each alert filter can includes an attribute "count" to indicate how many times this event
should happen continuously
@param {Array} filters: an array of alert filters in sequence
@param {Array} counts: an array of a... | [
"Validate",
"events",
"data",
"against",
"filtering",
"conditions",
".",
"Alert",
"filters",
"will",
"be",
"validated",
"by",
"indexing",
"sequence",
".",
"Each",
"alert",
"filter",
"can",
"includes",
"an",
"attribute",
"count",
"to",
"indicate",
"how",
"many",
... | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/jobs/wait-sel-events-job.js#L180-L206 | train |
RackHD/on-tasks | lib/utils/job-utils/os-repo-tool.js | _extractEsxBootCfgValue | function _extractEsxBootCfgValue(data, pattern) {
var pos = data.indexOf(pattern);
if (pos >= 0) {
pos += pattern.length;
var lineEndPos = data.indexOf('\n', pos);
if (lineEndPos >= 0) {
return data.substring(pos, lineEndPos);
}
}
... | javascript | function _extractEsxBootCfgValue(data, pattern) {
var pos = data.indexOf(pattern);
if (pos >= 0) {
pos += pattern.length;
var lineEndPos = data.indexOf('\n', pos);
if (lineEndPos >= 0) {
return data.substring(pos, lineEndPos);
}
}
... | [
"function",
"_extractEsxBootCfgValue",
"(",
"data",
",",
"pattern",
")",
"{",
"var",
"pos",
"=",
"data",
".",
"indexOf",
"(",
"pattern",
")",
";",
"if",
"(",
"pos",
">=",
"0",
")",
"{",
"pos",
"+=",
"pattern",
".",
"length",
";",
"var",
"lineEndPos",
... | Extract the value from a whole data by key.
@param {String} data - The whole data that cotains all key-value pairs
@param {String} key - The key for target value including the key-value delimiter
@return {String} The extracted value; If key is not exsited, return empty.
@example
// return "12xyz - pmq"
_extractEsxiBoot... | [
"Extract",
"the",
"value",
"from",
"a",
"whole",
"data",
"by",
"key",
"."
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/utils/job-utils/os-repo-tool.js#L90-L100 | train |
RackHD/on-tasks | lib/jobs/redfish-enable-alerts-job.js | RestJob | function RestJob(options, context, taskId){
var self = this;
self.options = options;
self.context = context;
RestJob.super_.call(self, logger, options, context, taskId);
self.restClient = new HttpTool();
} | javascript | function RestJob(options, context, taskId){
var self = this;
self.options = options;
self.context = context;
RestJob.super_.call(self, logger, options, context, taskId);
self.restClient = new HttpTool();
} | [
"function",
"RestJob",
"(",
"options",
",",
"context",
",",
"taskId",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"options",
"=",
"options",
";",
"self",
".",
"context",
"=",
"context",
";",
"RestJob",
".",
"super_",
".",
"call",
"(",
"se... | The interface that runs Rest Job from tasks
@constructor | [
"The",
"interface",
"that",
"runs",
"Rest",
"Job",
"from",
"tasks"
] | 18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea | https://github.com/RackHD/on-tasks/blob/18ca8021a18e51cb8fc01ef3c08c9e48d34f73ea/lib/jobs/redfish-enable-alerts-job.js#L37-L44 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.