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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | _suspendBeforeObserver | function _suspendBeforeObserver(obj, path, target, method, callback) {
return suspendListener(obj, beforeEvent(path), target, method, callback);
} | javascript | function _suspendBeforeObserver(obj, path, target, method, callback) {
return suspendListener(obj, beforeEvent(path), target, method, callback);
} | [
"function",
"_suspendBeforeObserver",
"(",
"obj",
",",
"path",
",",
"target",
",",
"method",
",",
"callback",
")",
"{",
"return",
"suspendListener",
"(",
"obj",
",",
"beforeEvent",
"(",
"path",
")",
",",
"target",
",",
"method",
",",
"callback",
")",
";",
... | Suspend observer during callback. This should only be used by the target of the observer while it is setting the observed path. | [
"Suspend",
"observer",
"during",
"callback",
".",
"This",
"should",
"only",
"be",
"used",
"by",
"the",
"target",
"of",
"the",
"observer",
"while",
"it",
"is",
"setting",
"the",
"observed",
"path",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L16977-L16979 | train |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | set | function set(obj, keyName, value, tolerant) {
if (typeof obj === 'string') {
Ember.assert("Path '" + obj + "' must be global if no obj is given.", IS_GLOBAL.test(obj));
value = keyName;
keyName = obj;
obj = null;
}
Ember.assert("Cannot call set with "+ keyName +" key."... | javascript | function set(obj, keyName, value, tolerant) {
if (typeof obj === 'string') {
Ember.assert("Path '" + obj + "' must be global if no obj is given.", IS_GLOBAL.test(obj));
value = keyName;
keyName = obj;
obj = null;
}
Ember.assert("Cannot call set with "+ keyName +" key."... | [
"function",
"set",
"(",
"obj",
",",
"keyName",
",",
"value",
",",
"tolerant",
")",
"{",
"if",
"(",
"typeof",
"obj",
"===",
"'string'",
")",
"{",
"Ember",
".",
"assert",
"(",
"\"Path '\"",
"+",
"obj",
"+",
"\"' must be global if no obj is given.\"",
",",
"I... | Sets the value of a property on an object, respecting computed properties
and notifying observers and other listeners of the change. If the
property is not defined but the object implements the `setUnknownProperty`
method then that will be invoked as well.
@method set
@for Ember
@param {Object} obj The object to modif... | [
"Sets",
"the",
"value",
"of",
"a",
"property",
"on",
"an",
"object",
"respecting",
"computed",
"properties",
"and",
"notifying",
"observers",
"and",
"other",
"listeners",
"of",
"the",
"change",
".",
"If",
"the",
"property",
"is",
"not",
"defined",
"but",
"th... | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L18028-L18098 | train |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | intern | function intern(str) {
var obj = {};
obj[str] = 1;
for (var key in obj) {
if (key === str) return key;
}
return str;
} | javascript | function intern(str) {
var obj = {};
obj[str] = 1;
for (var key in obj) {
if (key === str) return key;
}
return str;
} | [
"function",
"intern",
"(",
"str",
")",
"{",
"var",
"obj",
"=",
"{",
"}",
";",
"obj",
"[",
"str",
"]",
"=",
"1",
";",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"{",
"if",
"(",
"key",
"===",
"str",
")",
"return",
"key",
";",
"}",
"return",
... | Strongly hint runtimes to intern the provided string.
When do I need to use this function?
For the most part, never. Pre-mature optimization is bad, and often the
runtime does exactly what you need it to, and more often the trade-off isn't
worth it.
Why?
Runtimes store strings in at least 2 different representation... | [
"Strongly",
"hint",
"runtimes",
"to",
"intern",
"the",
"provided",
"string",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L18923-L18930 | train |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | makeArray | function makeArray(obj) {
if (obj === null || obj === undefined) { return []; }
return isArray(obj) ? obj : [obj];
} | javascript | function makeArray(obj) {
if (obj === null || obj === undefined) { return []; }
return isArray(obj) ? obj : [obj];
} | [
"function",
"makeArray",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
"===",
"null",
"||",
"obj",
"===",
"undefined",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"isArray",
"(",
"obj",
")",
"?",
"obj",
":",
"[",
"obj",
"]",
";",
"}"
] | Forces the passed object to be part of an array. If the object is already
an array or array-like, returns the object. Otherwise adds the object to
an array. If obj is `null` or `undefined`, returns an empty array.
```javascript
Ember.makeArray(); // []
Ember.makeArray(null); // []
Ember.makeArray(und... | [
"Forces",
"the",
"passed",
"object",
"to",
"be",
"part",
"of",
"an",
"array",
".",
"If",
"the",
"object",
"is",
"already",
"an",
"array",
"or",
"array",
"-",
"like",
"returns",
"the",
"object",
".",
"Otherwise",
"adds",
"the",
"object",
"to",
"an",
"ar... | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L19327-L19330 | train |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | typeOf | function typeOf(item) {
var ret, modulePath;
// ES6TODO: Depends on Ember.Object which is defined in runtime.
if (typeof EmberObject === "undefined") {
modulePath = 'ember-runtime/system/object';
if (Ember.__loader.registry[modulePath]) {
EmberObject = Ember.__loader.require... | javascript | function typeOf(item) {
var ret, modulePath;
// ES6TODO: Depends on Ember.Object which is defined in runtime.
if (typeof EmberObject === "undefined") {
modulePath = 'ember-runtime/system/object';
if (Ember.__loader.registry[modulePath]) {
EmberObject = Ember.__loader.require... | [
"function",
"typeOf",
"(",
"item",
")",
"{",
"var",
"ret",
",",
"modulePath",
";",
"// ES6TODO: Depends on Ember.Object which is defined in runtime.",
"if",
"(",
"typeof",
"EmberObject",
"===",
"\"undefined\"",
")",
"{",
"modulePath",
"=",
"'ember-runtime/system/object'",... | Returns a consistent type for the passed item.
Use this instead of the built-in `typeof` to get the type of an item.
It will return the same result across all browsers and includes a bit
more detail. Here is what will be returned:
| Return Value | Meaning |
|-------------... | [
"Returns",
"a",
"consistent",
"type",
"for",
"the",
"passed",
"item",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L19602-L19624 | train |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | watchKey | function watchKey(obj, keyName, meta) {
// can't watch length on Array - it is special...
if (keyName === 'length' && typeOf(obj) === 'array') { return; }
var m = meta || metaFor(obj), watching = m.watching;
// activate watching first time
if (!watching[keyName]) {
watching[keyNa... | javascript | function watchKey(obj, keyName, meta) {
// can't watch length on Array - it is special...
if (keyName === 'length' && typeOf(obj) === 'array') { return; }
var m = meta || metaFor(obj), watching = m.watching;
// activate watching first time
if (!watching[keyName]) {
watching[keyNa... | [
"function",
"watchKey",
"(",
"obj",
",",
"keyName",
",",
"meta",
")",
"{",
"// can't watch length on Array - it is special...",
"if",
"(",
"keyName",
"===",
"'length'",
"&&",
"typeOf",
"(",
"obj",
")",
"===",
"'array'",
")",
"{",
"return",
";",
"}",
"var",
"... | utils.js | [
"utils",
".",
"js"
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L19720-L19745 | train |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function() {
this._super.apply(this, arguments);
Ember.deprecate('Using currentWhen with {{link-to}} is deprecated in favor of `current-when`.', !this.currentWhen);
// Map desired event name to invoke function
var eventName = get(this, 'eventName');
this.on(eventName, this, thi... | javascript | function() {
this._super.apply(this, arguments);
Ember.deprecate('Using currentWhen with {{link-to}} is deprecated in favor of `current-when`.', !this.currentWhen);
// Map desired event name to invoke function
var eventName = get(this, 'eventName');
this.on(eventName, this, thi... | [
"function",
"(",
")",
"{",
"this",
".",
"_super",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"Ember",
".",
"deprecate",
"(",
"'Using currentWhen with {{link-to}} is deprecated in favor of `current-when`.'",
",",
"!",
"this",
".",
"currentWhen",
")",
";... | this is doc'ed here so it shows up in the events section of the API documentation, which is where people will likely go looking for it.
Triggers the `LinkView`'s routing behavior. If
`eventName` is changed to a value other than `click`
the routing behavior will trigger on that custom event
instead.
@event click
An ... | [
"this",
"is",
"doc",
"ed",
"here",
"so",
"it",
"shows",
"up",
"in",
"the",
"events",
"section",
"of",
"the",
"API",
"documentation",
"which",
"is",
"where",
"people",
"will",
"likely",
"go",
"looking",
"for",
"it",
".",
"Triggers",
"the",
"LinkView",
"s"... | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L20594-L20602 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(){
var helperParameters = this.parameters;
var linkTextPath = helperParameters.options.linkTextPath;
var paths = getResolvedPaths(helperParameters);
var length = paths.length;
var path, i, normalizedPath;
if (linkTextPath) {
normalizedPath = getNormali... | javascript | function(){
var helperParameters = this.parameters;
var linkTextPath = helperParameters.options.linkTextPath;
var paths = getResolvedPaths(helperParameters);
var length = paths.length;
var path, i, normalizedPath;
if (linkTextPath) {
normalizedPath = getNormali... | [
"function",
"(",
")",
"{",
"var",
"helperParameters",
"=",
"this",
".",
"parameters",
";",
"var",
"linkTextPath",
"=",
"helperParameters",
".",
"options",
".",
"linkTextPath",
";",
"var",
"paths",
"=",
"getResolvedPaths",
"(",
"helperParameters",
")",
";",
"va... | This is called to setup observers that will trigger a rerender.
@private
@method _setupPathObservers
@since 1.3.0 | [
"This",
"is",
"called",
"to",
"setup",
"observers",
"that",
"will",
"trigger",
"a",
"rerender",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L20623-L20661 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(params, transition) {
var match, name, sawParams, value;
var queryParams = get(this, '_qp.map');
for (var prop in params) {
if (prop === 'queryParams' || (queryParams && prop in queryParams)) {
continue;
}
if (match = prop.match(/^(.*)_id$/))... | javascript | function(params, transition) {
var match, name, sawParams, value;
var queryParams = get(this, '_qp.map');
for (var prop in params) {
if (prop === 'queryParams' || (queryParams && prop in queryParams)) {
continue;
}
if (match = prop.match(/^(.*)_id$/))... | [
"function",
"(",
"params",
",",
"transition",
")",
"{",
"var",
"match",
",",
"name",
",",
"sawParams",
",",
"value",
";",
"var",
"queryParams",
"=",
"get",
"(",
"this",
",",
"'_qp.map'",
")",
";",
"for",
"(",
"var",
"prop",
"in",
"params",
")",
"{",
... | A hook you can implement to convert the URL into the model for
this route.
```js
App.Router.map(function() {
this.resource('post', {path: '/posts/:post_id'});
});
```
The model for the `post` route is `store.find('post', params.post_id)`.
By default, if your route has a dynamic segment ending in `_id`:
The model cl... | [
"A",
"hook",
"you",
"can",
"implement",
"to",
"convert",
"the",
"URL",
"into",
"the",
"model",
"for",
"this",
"route",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L24873-L24900 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(name, model) {
var container = this.container;
model = model || this.modelFor(name);
return generateController(container, name, model);
} | javascript | function(name, model) {
var container = this.container;
model = model || this.modelFor(name);
return generateController(container, name, model);
} | [
"function",
"(",
"name",
",",
"model",
")",
"{",
"var",
"container",
"=",
"this",
".",
"container",
";",
"model",
"=",
"model",
"||",
"this",
".",
"modelFor",
"(",
"name",
")",
";",
"return",
"generateController",
"(",
"container",
",",
"name",
",",
"m... | Generates a controller for a route.
If the optional model is passed then the controller type is determined automatically,
e.g., an ArrayController for arrays.
Example
```js
App.PostRoute = Ember.Route.extend({
setupController: function(controller, post) {
this._super(controller, post);
this.generateController('posts... | [
"Generates",
"a",
"controller",
"for",
"a",
"route",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L25150-L25156 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(infos) {
updatePaths(this);
this._cancelLoadingEvent();
this.notifyPropertyChange('url');
// Put this in the runloop so url will be accurate. Seems
// less surprising than didTransition being out of sync.
run.once(this, this.trigger, 'didTransition');
... | javascript | function(infos) {
updatePaths(this);
this._cancelLoadingEvent();
this.notifyPropertyChange('url');
// Put this in the runloop so url will be accurate. Seems
// less surprising than didTransition being out of sync.
run.once(this, this.trigger, 'didTransition');
... | [
"function",
"(",
"infos",
")",
"{",
"updatePaths",
"(",
"this",
")",
";",
"this",
".",
"_cancelLoadingEvent",
"(",
")",
";",
"this",
".",
"notifyPropertyChange",
"(",
"'url'",
")",
";",
"// Put this in the runloop so url will be accurate. Seems",
"// less surprising t... | Handles updating the paths and notifying any listeners of the URL
change.
Triggers the router level `didTransition` hook.
@method didTransition
@private
@since 1.2.0 | [
"Handles",
"updating",
"the",
"paths",
"and",
"notifying",
"any",
"listeners",
"of",
"the",
"URL",
"change",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L25804-L25818 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(routeName, models, queryParams) {
var router = this.router;
return router.isActive.apply(router, arguments);
} | javascript | function(routeName, models, queryParams) {
var router = this.router;
return router.isActive.apply(router, arguments);
} | [
"function",
"(",
"routeName",
",",
"models",
",",
"queryParams",
")",
"{",
"var",
"router",
"=",
"this",
".",
"router",
";",
"return",
"router",
".",
"isActive",
".",
"apply",
"(",
"router",
",",
"arguments",
")",
";",
"}"
] | An alternative form of `isActive` that doesn't require
manual concatenation of the arguments into a single
array.
@method isActiveIntent
@param routeName
@param models
@param queryParams
@return {Boolean}
@private
@since 1.7.0 | [
"An",
"alternative",
"form",
"of",
"isActive",
"that",
"doesn",
"t",
"require",
"manual",
"concatenation",
"of",
"the",
"arguments",
"into",
"a",
"single",
"array",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L25893-L25896 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(callback) {
var router = this.router;
if (!router) {
router = new Router();
router._triggerWillChangeContext = Ember.K;
router._triggerWillLeave = Ember.K;
router.callbacks = [];
router.triggerEvent = triggerEvent;
... | javascript | function(callback) {
var router = this.router;
if (!router) {
router = new Router();
router._triggerWillChangeContext = Ember.K;
router._triggerWillLeave = Ember.K;
router.callbacks = [];
router.triggerEvent = triggerEvent;
... | [
"function",
"(",
"callback",
")",
"{",
"var",
"router",
"=",
"this",
".",
"router",
";",
"if",
"(",
"!",
"router",
")",
"{",
"router",
"=",
"new",
"Router",
"(",
")",
";",
"router",
".",
"_triggerWillChangeContext",
"=",
"Ember",
".",
"K",
";",
"rout... | The `Router.map` function allows you to define mappings from URLs to routes
and resources in your application. These mappings are defined within the
supplied callback function using `this.resource` and `this.route`.
```javascript
App.Router.map(function({
this.route('about');
this.resource('article');
}));
```
For mo... | [
"The",
"Router",
".",
"map",
"function",
"allows",
"you",
"to",
"define",
"mappings",
"from",
"URLs",
"to",
"routes",
"and",
"resources",
"in",
"your",
"application",
".",
"These",
"mappings",
"are",
"defined",
"within",
"the",
"supplied",
"callback",
"functio... | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L26432-L26459 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | map | function map(dependentKey, callback) {
var options = {
addedItem: function(array, item, changeMeta, instanceMeta) {
var mapped = callback.call(this, item, changeMeta.index);
array.insertAt(changeMeta.index, mapped);
return array;
},
removedItem: function(array... | javascript | function map(dependentKey, callback) {
var options = {
addedItem: function(array, item, changeMeta, instanceMeta) {
var mapped = callback.call(this, item, changeMeta.index);
array.insertAt(changeMeta.index, mapped);
return array;
},
removedItem: function(array... | [
"function",
"map",
"(",
"dependentKey",
",",
"callback",
")",
"{",
"var",
"options",
"=",
"{",
"addedItem",
":",
"function",
"(",
"array",
",",
"item",
",",
"changeMeta",
",",
"instanceMeta",
")",
"{",
"var",
"mapped",
"=",
"callback",
".",
"call",
"(",
... | Returns an array mapped via the callback
The callback method you provide should have the following signature.
`item` is the current item in the iteration.
`index` is the integer index of the current item in the iteration.
```javascript
function(item, index);
```
Example
```javascript
var Hamster = Ember.Object.exte... | [
"Returns",
"an",
"array",
"mapped",
"via",
"the",
"callback"
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L28050-L28064 | train |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | sort | function sort(itemsKey, sortDefinition) {
Ember.assert('Ember.computed.sort requires two arguments: an array key to sort and ' +
'either a sort properties key or sort function', arguments.length === 2);
if (typeof sortDefinition === 'function') {
return customSort(itemsKey, sortDefinition);... | javascript | function sort(itemsKey, sortDefinition) {
Ember.assert('Ember.computed.sort requires two arguments: an array key to sort and ' +
'either a sort properties key or sort function', arguments.length === 2);
if (typeof sortDefinition === 'function') {
return customSort(itemsKey, sortDefinition);... | [
"function",
"sort",
"(",
"itemsKey",
",",
"sortDefinition",
")",
"{",
"Ember",
".",
"assert",
"(",
"'Ember.computed.sort requires two arguments: an array key to sort and '",
"+",
"'either a sort properties key or sort function'",
",",
"arguments",
".",
"length",
"===",
"2",
... | A computed property which returns a new array with all the
properties from the first dependent array sorted based on a property
or sort function.
The callback method you provide should have the following signature:
```javascript
function(itemA, itemB);
```
- `itemA` the first item to compare.
- `itemB` the second it... | [
"A",
"computed",
"property",
"which",
"returns",
"a",
"new",
"array",
"with",
"all",
"the",
"properties",
"from",
"the",
"first",
"dependent",
"array",
"sorted",
"based",
"on",
"a",
"property",
"or",
"sort",
"function",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L28558-L28567 | train |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(actionName) {
var args = [].slice.call(arguments, 1);
var target;
if (this._actions && this._actions[actionName]) {
if (this._actions[actionName].apply(this, args) === true) {
// handler returned true, so this action will bubble
} else {
retu... | javascript | function(actionName) {
var args = [].slice.call(arguments, 1);
var target;
if (this._actions && this._actions[actionName]) {
if (this._actions[actionName].apply(this, args) === true) {
// handler returned true, so this action will bubble
} else {
retu... | [
"function",
"(",
"actionName",
")",
"{",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"var",
"target",
";",
"if",
"(",
"this",
".",
"_actions",
"&&",
"this",
".",
"_actions",
"[",
"actionName",
"]",... | Triggers a named action on the `ActionHandler`. Any parameters
supplied after the `actionName` string will be passed as arguments
to the action target function.
If the `ActionHandler` has its `target` property set, actions may
bubble to the `target`. Bubbling happens when an `actionName` can
not be found in the `Actio... | [
"Triggers",
"a",
"named",
"action",
"on",
"the",
"ActionHandler",
".",
"Any",
"parameters",
"supplied",
"after",
"the",
"actionName",
"string",
"will",
"be",
"passed",
"as",
"arguments",
"to",
"the",
"action",
"target",
"function",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L29893-L29909 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(removing, adding) {
var removeCnt, addCnt, hasDelta;
if ('number' === typeof removing) removeCnt = removing;
else if (removing) removeCnt = get(removing, 'length');
else removeCnt = removing = -1;
if ('number' === typeof adding) addCnt = adding;
else if (addin... | javascript | function(removing, adding) {
var removeCnt, addCnt, hasDelta;
if ('number' === typeof removing) removeCnt = removing;
else if (removing) removeCnt = get(removing, 'length');
else removeCnt = removing = -1;
if ('number' === typeof adding) addCnt = adding;
else if (addin... | [
"function",
"(",
"removing",
",",
"adding",
")",
"{",
"var",
"removeCnt",
",",
"addCnt",
",",
"hasDelta",
";",
"if",
"(",
"'number'",
"===",
"typeof",
"removing",
")",
"removeCnt",
"=",
"removing",
";",
"else",
"if",
"(",
"removing",
")",
"removeCnt",
"=... | Invoke this method just before the contents of your enumerable will
change. You can either omit the parameters completely or pass the objects
to be removed or added if available or just a count.
@method enumerableContentWillChange
@param {Ember.Enumerable|Number} removing An enumerable of the objects to
be removed or ... | [
"Invoke",
"this",
"method",
"just",
"before",
"the",
"contents",
"of",
"your",
"enumerable",
"will",
"change",
".",
"You",
"can",
"either",
"omit",
"the",
"parameters",
"completely",
"or",
"pass",
"the",
"objects",
"to",
"be",
"removed",
"or",
"added",
"if",... | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L31705-L31727 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(name, target, method) {
if (!method) {
method = target;
target = null;
}
addListener(this, name, target, method, true);
return this;
} | javascript | function(name, target, method) {
if (!method) {
method = target;
target = null;
}
addListener(this, name, target, method, true);
return this;
} | [
"function",
"(",
"name",
",",
"target",
",",
"method",
")",
"{",
"if",
"(",
"!",
"method",
")",
"{",
"method",
"=",
"target",
";",
"target",
"=",
"null",
";",
"}",
"addListener",
"(",
"this",
",",
"name",
",",
"target",
",",
"method",
",",
"true",
... | Subscribes a function to a named event and then cancels the subscription
after the first time the event is triggered. It is good to use ``one`` when
you only care about the first time an event has taken place.
This function takes an optional 2nd argument that will become the "this"
value for the callback. If this argu... | [
"Subscribes",
"a",
"function",
"to",
"a",
"named",
"event",
"and",
"then",
"cancels",
"the",
"subscription",
"after",
"the",
"first",
"time",
"the",
"event",
"is",
"triggered",
".",
"It",
"is",
"good",
"to",
"use",
"one",
"when",
"you",
"only",
"care",
"... | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L31885-L31893 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(name) {
var length = arguments.length;
var args = new Array(length - 1);
for (var i = 1; i < length; i++) {
args[i - 1] = arguments[i];
}
sendEvent(this, name, args);
} | javascript | function(name) {
var length = arguments.length;
var args = new Array(length - 1);
for (var i = 1; i < length; i++) {
args[i - 1] = arguments[i];
}
sendEvent(this, name, args);
} | [
"function",
"(",
"name",
")",
"{",
"var",
"length",
"=",
"arguments",
".",
"length",
";",
"var",
"args",
"=",
"new",
"Array",
"(",
"length",
"-",
"1",
")",
";",
"for",
"(",
"var",
"i",
"=",
"1",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"... | Triggers a named event for the object. Any additional arguments
will be passed as parameters to the functions that are subscribed to the
event.
```javascript
person.on('didEat', function(food) {
console.log('person ate some ' + food);
});
person.trigger('didEat', 'broccoli');
outputs: person ate some broccoli
```
@m... | [
"Triggers",
"a",
"named",
"event",
"for",
"the",
"object",
".",
"Any",
"additional",
"arguments",
"will",
"be",
"passed",
"as",
"parameters",
"to",
"the",
"functions",
"that",
"are",
"subscribed",
"to",
"the",
"event",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L31913-L31922 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(objects) {
if (!(Enumerable.detect(objects) || isArray(objects))) {
throw new TypeError("Must pass Ember.Enumerable to Ember.MutableArray#pushObjects");
}
this.replace(get(this, 'length'), 0, objects);
return this;
} | javascript | function(objects) {
if (!(Enumerable.detect(objects) || isArray(objects))) {
throw new TypeError("Must pass Ember.Enumerable to Ember.MutableArray#pushObjects");
}
this.replace(get(this, 'length'), 0, objects);
return this;
} | [
"function",
"(",
"objects",
")",
"{",
"if",
"(",
"!",
"(",
"Enumerable",
".",
"detect",
"(",
"objects",
")",
"||",
"isArray",
"(",
"objects",
")",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Must pass Ember.Enumerable to Ember.MutableArray#pushObjects\""... | Add the objects in the passed numerable to the end of the array. Defers
notifying observers of the change until all objects are added.
```javascript
var colors = ["red"];
colors.pushObjects(["yellow", "orange"]); // ["red", "yellow", "orange"]
```
@method pushObjects
@param {Ember.Enumerable} objects the objects to ... | [
"Add",
"the",
"objects",
"in",
"the",
"passed",
"numerable",
"to",
"the",
"end",
"of",
"the",
"array",
".",
"Defers",
"notifying",
"observers",
"of",
"the",
"change",
"until",
"all",
"objects",
"are",
"added",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L32228-L32234 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(objects) {
beginPropertyChanges(this);
for (var i = objects.length - 1; i >= 0; i--) {
this.removeObject(objects[i]);
}
endPropertyChanges(this);
return this;
} | javascript | function(objects) {
beginPropertyChanges(this);
for (var i = objects.length - 1; i >= 0; i--) {
this.removeObject(objects[i]);
}
endPropertyChanges(this);
return this;
} | [
"function",
"(",
"objects",
")",
"{",
"beginPropertyChanges",
"(",
"this",
")",
";",
"for",
"(",
"var",
"i",
"=",
"objects",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"this",
".",
"removeObject",
"(",
"objects",
"[",
... | Removes each object in the passed enumerable from the receiver.
@method removeObjects
@param {Ember.Enumerable} objects the objects to remove
@return {Object} receiver | [
"Removes",
"each",
"object",
"in",
"the",
"passed",
"enumerable",
"from",
"the",
"receiver",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L32513-L32520 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function() {
var C = this;
var l = arguments.length;
if (l > 0) {
var args = new Array(l);
for (var i = 0; i < l; i++) {
args[i] = arguments[i];
}
this._initProperties(args);
}
return new C();
} | javascript | function() {
var C = this;
var l = arguments.length;
if (l > 0) {
var args = new Array(l);
for (var i = 0; i < l; i++) {
args[i] = arguments[i];
}
this._initProperties(args);
}
return new C();
} | [
"function",
"(",
")",
"{",
"var",
"C",
"=",
"this",
";",
"var",
"l",
"=",
"arguments",
".",
"length",
";",
"if",
"(",
"l",
">",
"0",
")",
"{",
"var",
"args",
"=",
"new",
"Array",
"(",
"l",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
... | Creates an instance of a class. Accepts either no arguments, or an object
containing values to initialize the newly instantiated object with.
```javascript
App.Person = Ember.Object.extend({
helloWorld: function() {
alert("Hi, my name is " + this.get('name'));
}
});
var tom = App.Person.create({
name: 'Tom Dale'
});
... | [
"Creates",
"an",
"instance",
"of",
"a",
"class",
".",
"Accepts",
"either",
"no",
"arguments",
"or",
"an",
"object",
"containing",
"values",
"to",
"initialize",
"the",
"newly",
"instantiated",
"object",
"with",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L34719-L34730 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(obj) {
// fail fast
if (!Enumerable.detect(obj)) return false;
var loc = get(this, 'length');
if (get(obj, 'length') !== loc) return false;
while(--loc >= 0) {
if (!obj.contains(this[loc])) return false;
}
return true;
} | javascript | function(obj) {
// fail fast
if (!Enumerable.detect(obj)) return false;
var loc = get(this, 'length');
if (get(obj, 'length') !== loc) return false;
while(--loc >= 0) {
if (!obj.contains(this[loc])) return false;
}
return true;
} | [
"function",
"(",
"obj",
")",
"{",
"// fail fast",
"if",
"(",
"!",
"Enumerable",
".",
"detect",
"(",
"obj",
")",
")",
"return",
"false",
";",
"var",
"loc",
"=",
"get",
"(",
"this",
",",
"'length'",
")",
";",
"if",
"(",
"get",
"(",
"obj",
",",
"'le... | Returns true if the passed object is also an enumerable that contains the
same objects as the receiver.
```javascript
var colors = ["red", "green", "blue"],
same_colors = new Ember.Set(colors);
same_colors.isEqual(colors); // true
same_colors.isEqual(["purple", "brown"]); // false
```
@method isEqual
... | [
"Returns",
"true",
"if",
"the",
"passed",
"object",
"is",
"also",
"an",
"enumerable",
"that",
"contains",
"the",
"same",
"objects",
"as",
"the",
"receiver",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L35999-L36011 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function() {
if (get(this, 'isFrozen')) throw new EmberError(FROZEN_ERROR);
var obj = this.length > 0 ? this[this.length-1] : null;
this.remove(obj);
return obj;
} | javascript | function() {
if (get(this, 'isFrozen')) throw new EmberError(FROZEN_ERROR);
var obj = this.length > 0 ? this[this.length-1] : null;
this.remove(obj);
return obj;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"get",
"(",
"this",
",",
"'isFrozen'",
")",
")",
"throw",
"new",
"EmberError",
"(",
"FROZEN_ERROR",
")",
";",
"var",
"obj",
"=",
"this",
".",
"length",
">",
"0",
"?",
"this",
"[",
"this",
".",
"length",
"-",
... | Removes the last element from the set and returns it, or `null` if it's empty.
```javascript
var colors = new Ember.Set(["green", "blue"]);
colors.pop(); // "blue"
colors.pop(); // "green"
colors.pop(); // null
```
@method pop
@return {Object} The removed object from the set or null. | [
"Removes",
"the",
"last",
"element",
"from",
"the",
"set",
"and",
"returns",
"it",
"or",
"null",
"if",
"it",
"s",
"empty",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L36066-L36071 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function (index) {
var split = false;
var arrayOperationIndex, arrayOperation,
arrayOperationRangeStart, arrayOperationRangeEnd,
len;
// OPTIMIZE: we could search these faster if we kept a balanced tree.
// find leftmost arrayOperation to the right of `index`
... | javascript | function (index) {
var split = false;
var arrayOperationIndex, arrayOperation,
arrayOperationRangeStart, arrayOperationRangeEnd,
len;
// OPTIMIZE: we could search these faster if we kept a balanced tree.
// find leftmost arrayOperation to the right of `index`
... | [
"function",
"(",
"index",
")",
"{",
"var",
"split",
"=",
"false",
";",
"var",
"arrayOperationIndex",
",",
"arrayOperation",
",",
"arrayOperationRangeStart",
",",
"arrayOperationRangeEnd",
",",
"len",
";",
"// OPTIMIZE: we could search these faster if we kept a balanced tree... | Return an `ArrayOperationMatch` for the operation that contains the item at `index`.
@method _findArrayOperation
@param {Number} index the index of the item whose operation information
should be returned.
@private | [
"Return",
"an",
"ArrayOperationMatch",
"for",
"the",
"operation",
"that",
"contains",
"the",
"item",
"at",
"index",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L36918-L36944 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(rootElement, event, eventName) {
var self = this;
rootElement.on(event + '.ember', '.ember-view', function(evt, triggeringManager) {
var view = View.views[this.id];
var result = true;
var manager = self.canDispatchToEventManager ? self._findNearestEventManager(vi... | javascript | function(rootElement, event, eventName) {
var self = this;
rootElement.on(event + '.ember', '.ember-view', function(evt, triggeringManager) {
var view = View.views[this.id];
var result = true;
var manager = self.canDispatchToEventManager ? self._findNearestEventManager(vi... | [
"function",
"(",
"rootElement",
",",
"event",
",",
"eventName",
")",
"{",
"var",
"self",
"=",
"this",
";",
"rootElement",
".",
"on",
"(",
"event",
"+",
"'.ember'",
",",
"'.ember-view'",
",",
"function",
"(",
"evt",
",",
"triggeringManager",
")",
"{",
"va... | Registers an event listener on the rootElement. If the given event is
triggered, the provided event handler will be triggered on the target view.
If the target view does not implement the event handler, or if the handler
returns `false`, the parent view will be called. The event will continue to
bubble to each success... | [
"Registers",
"an",
"event",
"listener",
"on",
"the",
"rootElement",
".",
"If",
"the",
"given",
"event",
"is",
"triggered",
"the",
"provided",
"event",
"handler",
"will",
"be",
"triggered",
"on",
"the",
"target",
"view",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L38698-L38727 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(content, start, removedCount) {
// If the contents were empty before and this template collection has an
// empty view remove it now.
var emptyView = get(this, 'emptyView');
if (emptyView && emptyView instanceof View) {
emptyView.removeFromParent();
}
... | javascript | function(content, start, removedCount) {
// If the contents were empty before and this template collection has an
// empty view remove it now.
var emptyView = get(this, 'emptyView');
if (emptyView && emptyView instanceof View) {
emptyView.removeFromParent();
}
... | [
"function",
"(",
"content",
",",
"start",
",",
"removedCount",
")",
"{",
"// If the contents were empty before and this template collection has an",
"// empty view remove it now.",
"var",
"emptyView",
"=",
"get",
"(",
"this",
",",
"'emptyView'",
")",
";",
"if",
"(",
"em... | Called when a mutation to the underlying content array will occur.
This method will remove any views that are no longer in the underlying
content array.
Invokes whenever the content array itself will change.
@method arrayWillChange
@param {Array} content the managed collection of objects
@param {Number} start the in... | [
"Called",
"when",
"a",
"mutation",
"to",
"the",
"underlying",
"content",
"array",
"will",
"occur",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L39935-L39953 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(content, start, removed, added) {
var addedViews = [];
var view, item, idx, len, itemViewClass, emptyView;
len = content ? get(content, 'length') : 0;
if (len) {
itemViewClass = get(this, 'itemViewClass');
itemViewClass = handlebarsGetView(content, itemView... | javascript | function(content, start, removed, added) {
var addedViews = [];
var view, item, idx, len, itemViewClass, emptyView;
len = content ? get(content, 'length') : 0;
if (len) {
itemViewClass = get(this, 'itemViewClass');
itemViewClass = handlebarsGetView(content, itemView... | [
"function",
"(",
"content",
",",
"start",
",",
"removed",
",",
"added",
")",
"{",
"var",
"addedViews",
"=",
"[",
"]",
";",
"var",
"view",
",",
"item",
",",
"idx",
",",
"len",
",",
"itemViewClass",
",",
"emptyView",
";",
"len",
"=",
"content",
"?",
... | Called when a mutation to the underlying content array occurs.
This method will replay that mutation against the views that compose the
`Ember.CollectionView`, ensuring that the view reflects the model.
This array observer is added in `contentDidChange`.
@method arrayDidChange
@param {Array} content the managed coll... | [
"Called",
"when",
"a",
"mutation",
"to",
"the",
"underlying",
"content",
"array",
"occurs",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L39969-L40008 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(classBindings) {
var classNames = this.classNames;
var elem, newClass, dasherizedClass;
// Loop through all of the configured bindings. These will be either
// property names ('isUrgent') or property paths relative to the view
// ('content.isUrgent')
forEach(cla... | javascript | function(classBindings) {
var classNames = this.classNames;
var elem, newClass, dasherizedClass;
// Loop through all of the configured bindings. These will be either
// property names ('isUrgent') or property paths relative to the view
// ('content.isUrgent')
forEach(cla... | [
"function",
"(",
"classBindings",
")",
"{",
"var",
"classNames",
"=",
"this",
".",
"classNames",
";",
"var",
"elem",
",",
"newClass",
",",
"dasherizedClass",
";",
"// Loop through all of the configured bindings. These will be either",
"// property names ('isUrgent') or proper... | Iterates over the view's `classNameBindings` array, inserts the value
of the specified property into the `classNames` array, then creates an
observer to update the view's element if the bound property ever changes
in the future.
@method _applyClassNameBindings
@private | [
"Iterates",
"over",
"the",
"view",
"s",
"classNameBindings",
"array",
"inserts",
"the",
"value",
"of",
"the",
"specified",
"property",
"into",
"the",
"classNames",
"array",
"then",
"creates",
"an",
"observer",
"to",
"update",
"the",
"view",
"s",
"element",
"if... | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L42336-L42404 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | function(property) {
var parsedPath = View._parsePropertyPath(property);
var path = parsedPath.path;
var val = get(this, path);
if (val === undefined && isGlobalPath(path)) {
val = get(Ember.lookup, path);
}
return View._classStringForValue(path, val, parsedPa... | javascript | function(property) {
var parsedPath = View._parsePropertyPath(property);
var path = parsedPath.path;
var val = get(this, path);
if (val === undefined && isGlobalPath(path)) {
val = get(Ember.lookup, path);
}
return View._classStringForValue(path, val, parsedPa... | [
"function",
"(",
"property",
")",
"{",
"var",
"parsedPath",
"=",
"View",
".",
"_parsePropertyPath",
"(",
"property",
")",
";",
"var",
"path",
"=",
"parsedPath",
".",
"path",
";",
"var",
"val",
"=",
"get",
"(",
"this",
",",
"path",
")",
";",
"if",
"("... | Given a property name, returns a dasherized version of that
property name if the property evaluates to a non-falsy value.
For example, if the view has property `isUrgent` that evaluates to true,
passing `isUrgent` to this method will return `"is-urgent"`.
@method _classStringForProperty
@param property
@private | [
"Given",
"a",
"property",
"name",
"returns",
"a",
"dasherized",
"version",
"of",
"that",
"property",
"name",
"if",
"the",
"property",
"evaluates",
"to",
"a",
"non",
"-",
"falsy",
"value",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L42493-L42503 | train | |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | interiorNamespace | function interiorNamespace(element){
if (
element &&
element.namespaceURI === svgNamespace &&
!svgHTMLIntegrationPoints[element.tagName]
) {
return svgNamespace;
} else {
return null;
}
} | javascript | function interiorNamespace(element){
if (
element &&
element.namespaceURI === svgNamespace &&
!svgHTMLIntegrationPoints[element.tagName]
) {
return svgNamespace;
} else {
return null;
}
} | [
"function",
"interiorNamespace",
"(",
"element",
")",
"{",
"if",
"(",
"element",
"&&",
"element",
".",
"namespaceURI",
"===",
"svgNamespace",
"&&",
"!",
"svgHTMLIntegrationPoints",
"[",
"element",
".",
"tagName",
"]",
")",
"{",
"return",
"svgNamespace",
";",
"... | This is not the namespace of the element, but of the elements inside that elements. | [
"This",
"is",
"not",
"the",
"namespace",
"of",
"the",
"element",
"but",
"of",
"the",
"elements",
"inside",
"that",
"elements",
"."
] | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L43484-L43494 | train |
appiphony/appiphony-lightning-js | public/lib/emberjs/ember.js | buildSafeDOM | function buildSafeDOM(html, contextualElement, dom) {
var childNodes = buildIESafeDOM(html, contextualElement, dom);
if (contextualElement.tagName === 'SELECT') {
// Walk child nodes
for (var i = 0; childNodes[i]; i++) {
// Find and process the first option child node
if... | javascript | function buildSafeDOM(html, contextualElement, dom) {
var childNodes = buildIESafeDOM(html, contextualElement, dom);
if (contextualElement.tagName === 'SELECT') {
// Walk child nodes
for (var i = 0; childNodes[i]; i++) {
// Find and process the first option child node
if... | [
"function",
"buildSafeDOM",
"(",
"html",
",",
"contextualElement",
",",
"dom",
")",
"{",
"var",
"childNodes",
"=",
"buildIESafeDOM",
"(",
"html",
",",
"contextualElement",
",",
"dom",
")",
";",
"if",
"(",
"contextualElement",
".",
"tagName",
"===",
"'SELECT'",... | When parsing innerHTML, the browser may set up DOM with some things not desired. For example, with a select element context and option innerHTML the first option will be marked selected. This method cleans up some of that, resetting those values back to their defaults. | [
"When",
"parsing",
"innerHTML",
"the",
"browser",
"may",
"set",
"up",
"DOM",
"with",
"some",
"things",
"not",
"desired",
".",
"For",
"example",
"with",
"a",
"select",
"element",
"context",
"and",
"option",
"innerHTML",
"the",
"first",
"option",
"will",
"be",... | 704953fdc60b62d3073fc5cace716a201d38b36c | https://github.com/appiphony/appiphony-lightning-js/blob/704953fdc60b62d3073fc5cace716a201d38b36c/public/lib/emberjs/ember.js#L43949-L43968 | train |
yahoo/kobold | lib/cli.js | filterArguments | function filterArguments(args, params, inject) {
var newArgs = ['node', '_mocha'].concat(inject || []),
param, i, len,
type;
for (i = 2, len = args.length; i < len; i++) {
if ((i < args.length - 1) && (args[i].length > 2) && (args[i].substr(0, 2) === '--')) {
// Get parameter without '--'
param = args... | javascript | function filterArguments(args, params, inject) {
var newArgs = ['node', '_mocha'].concat(inject || []),
param, i, len,
type;
for (i = 2, len = args.length; i < len; i++) {
if ((i < args.length - 1) && (args[i].length > 2) && (args[i].substr(0, 2) === '--')) {
// Get parameter without '--'
param = args... | [
"function",
"filterArguments",
"(",
"args",
",",
"params",
",",
"inject",
")",
"{",
"var",
"newArgs",
"=",
"[",
"'node'",
",",
"'_mocha'",
"]",
".",
"concat",
"(",
"inject",
"||",
"[",
"]",
")",
",",
"param",
",",
"i",
",",
"len",
",",
"type",
";",... | Filters arguments given and sets them to parameters
@method filterArguments
@param {string[]} args
@param {object} params
@param {string[]} [inject]
@return {string[]}
@private | [
"Filters",
"arguments",
"given",
"and",
"sets",
"them",
"to",
"parameters"
] | c43adea98046a7cc4101a27f0448675b2f589601 | https://github.com/yahoo/kobold/blob/c43adea98046a7cc4101a27f0448675b2f589601/lib/cli.js#L14-L63 | train |
yahoo/kobold | lib/cli.js | prepareEnvironment | function prepareEnvironment (argv) {
var params, args;
// Define default values
params = {
'approved-folder': 'approved',
'build-folder': 'build',
'highlight-folder': 'highlight',
'config-folder': 'config',
'fail-orphans': false,
'fail-additions': false,
'test-path': null,
'config': null
};
// F... | javascript | function prepareEnvironment (argv) {
var params, args;
// Define default values
params = {
'approved-folder': 'approved',
'build-folder': 'build',
'highlight-folder': 'highlight',
'config-folder': 'config',
'fail-orphans': false,
'fail-additions': false,
'test-path': null,
'config': null
};
// F... | [
"function",
"prepareEnvironment",
"(",
"argv",
")",
"{",
"var",
"params",
",",
"args",
";",
"// Define default values",
"params",
"=",
"{",
"'approved-folder'",
":",
"'approved'",
",",
"'build-folder'",
":",
"'build'",
",",
"'highlight-folder'",
":",
"'highlight'",
... | Prepares the environment for kobold
@method prepareEnvironment
@param {string[]} argv
@return {string[]}
@private | [
"Prepares",
"the",
"environment",
"for",
"kobold"
] | c43adea98046a7cc4101a27f0448675b2f589601 | https://github.com/yahoo/kobold/blob/c43adea98046a7cc4101a27f0448675b2f589601/lib/cli.js#L73-L133 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | makeBarsChartPath | function makeBarsChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, paddingLeft, isRange) {
let heightScaler = (chartHeight-markerRadius)/maxValue;
let xSpacing = width / pointsOnScreen;
let barWidth = xSpacing - paddingLeft;
let fullWidth = paddingLeft/2 ... | javascript | function makeBarsChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, paddingLeft, isRange) {
let heightScaler = (chartHeight-markerRadius)/maxValue;
let xSpacing = width / pointsOnScreen;
let barWidth = xSpacing - paddingLeft;
let fullWidth = paddingLeft/2 ... | [
"function",
"makeBarsChartPath",
"(",
"chart",
",",
"width",
",",
"t",
",",
"maxValue",
",",
"chartHeight",
",",
"chartHeightOffset",
",",
"markerRadius",
",",
"pointsOnScreen",
",",
"paddingLeft",
",",
"isRange",
")",
"{",
"let",
"heightScaler",
"=",
"(",
"ch... | Generate the SVG path for a bar chart.
@param {object} chart The chart object
@param {number} width Width of the chart in pixels
@param {number} t Scale parameter (range: 0-1), used for
animating the graph
@param {number} maxValue The maximum value of chart data... | [
"Generate",
"the",
"SVG",
"path",
"for",
"a",
"bar",
"chart",
"."
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L276-L313 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | makeStackedBarsChartPath | function makeStackedBarsChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, paddingLeft, yAxisWidth, isRange) {
let heightScaler = (chartHeight-markerRadius)/maxValue;
width = width - yAxisWidth;
let xSpacing = width / pointsOnScreen;
let barWidth = xSpacin... | javascript | function makeStackedBarsChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, paddingLeft, yAxisWidth, isRange) {
let heightScaler = (chartHeight-markerRadius)/maxValue;
width = width - yAxisWidth;
let xSpacing = width / pointsOnScreen;
let barWidth = xSpacin... | [
"function",
"makeStackedBarsChartPath",
"(",
"chart",
",",
"width",
",",
"t",
",",
"maxValue",
",",
"chartHeight",
",",
"chartHeightOffset",
",",
"markerRadius",
",",
"pointsOnScreen",
",",
"paddingLeft",
",",
"yAxisWidth",
",",
"isRange",
")",
"{",
"let",
"heig... | Make like candle-stick, where each stck is its own Shape | [
"Make",
"like",
"candle",
"-",
"stick",
"where",
"each",
"stck",
"is",
"its",
"own",
"Shape"
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L316-L350 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | makeAreaChartPath | function makeAreaChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen) {
return makeLineOrAreaChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, true, false);
} | javascript | function makeAreaChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen) {
return makeLineOrAreaChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, true, false);
} | [
"function",
"makeAreaChartPath",
"(",
"chart",
",",
"width",
",",
"t",
",",
"maxValue",
",",
"chartHeight",
",",
"chartHeightOffset",
",",
"markerRadius",
",",
"pointsOnScreen",
")",
"{",
"return",
"makeLineOrAreaChartPath",
"(",
"chart",
",",
"width",
",",
"t",... | Wrapper function for makeLineOrAreaChartPath to make a line chart. | [
"Wrapper",
"function",
"for",
"makeLineOrAreaChartPath",
"to",
"make",
"a",
"line",
"chart",
"."
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L479-L481 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | makeLineChartPath | function makeLineChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen) {
return makeLineOrAreaChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, false, false);
} | javascript | function makeLineChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen) {
return makeLineOrAreaChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, false, false);
} | [
"function",
"makeLineChartPath",
"(",
"chart",
",",
"width",
",",
"t",
",",
"maxValue",
",",
"chartHeight",
",",
"chartHeightOffset",
",",
"markerRadius",
",",
"pointsOnScreen",
")",
"{",
"return",
"makeLineOrAreaChartPath",
"(",
"chart",
",",
"width",
",",
"t",... | Wrapper function for makeLineOrAreaChartPath to make an area chart. | [
"Wrapper",
"function",
"for",
"makeLineOrAreaChartPath",
"to",
"make",
"an",
"area",
"chart",
"."
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L490-L492 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | makeLineOrAreaChartPath | function makeLineOrAreaChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, makeArea, isRange) {
let heightScaler = (chartHeight-markerRadius)/maxValue;
let xSpacing = width / pointsOnScreen;
let centeriser = xSpacing / 2 - markerRadius;
let fullWidth = xSpa... | javascript | function makeLineOrAreaChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, makeArea, isRange) {
let heightScaler = (chartHeight-markerRadius)/maxValue;
let xSpacing = width / pointsOnScreen;
let centeriser = xSpacing / 2 - markerRadius;
let fullWidth = xSpa... | [
"function",
"makeLineOrAreaChartPath",
"(",
"chart",
",",
"width",
",",
"t",
",",
"maxValue",
",",
"chartHeight",
",",
"chartHeightOffset",
",",
"markerRadius",
",",
"pointsOnScreen",
",",
"makeArea",
",",
"isRange",
")",
"{",
"let",
"heightScaler",
"=",
"(",
... | Generate the SVG path for a line or area chart.
@param {object} chart The chart object
@param {number} width Width of the chart in pixels
@param {number} t Scale parameter (range: 0-1), used for
animating the graph
@param {number} maxValue The maximum value of c... | [
"Generate",
"the",
"SVG",
"path",
"for",
"a",
"line",
"or",
"area",
"chart",
"."
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L515-L564 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | makeSplineChartPath | function makeSplineChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, closePath) {
let heightScaler = (chartHeight-markerRadius)/maxValue;
let xSpacing = width / pointsOnScreen;
let centeriser = xSpacing / 2 - markerRadius;
let fullWidth = xSpacing*(chart.... | javascript | function makeSplineChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, closePath) {
let heightScaler = (chartHeight-markerRadius)/maxValue;
let xSpacing = width / pointsOnScreen;
let centeriser = xSpacing / 2 - markerRadius;
let fullWidth = xSpacing*(chart.... | [
"function",
"makeSplineChartPath",
"(",
"chart",
",",
"width",
",",
"t",
",",
"maxValue",
",",
"chartHeight",
",",
"chartHeightOffset",
",",
"markerRadius",
",",
"pointsOnScreen",
",",
"closePath",
")",
"{",
"let",
"heightScaler",
"=",
"(",
"chartHeight",
"-",
... | Generate the SVG path for a spline or spline-area chart.
@param {object} chart The chart object
@param {number} width Width of the chart in pixels
@param {number} t Scale parameter (range: 0-1), used for
animating the graph
@param {number} maxValue The maximum v... | [
"Generate",
"the",
"SVG",
"path",
"for",
"a",
"spline",
"or",
"spline",
"-",
"area",
"chart",
"."
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L613-L645 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | rgbaToHsla | function rgbaToHsla(h, s, l, a) {
return [...rgbToHsl(h,s,l), a];
} | javascript | function rgbaToHsla(h, s, l, a) {
return [...rgbToHsl(h,s,l), a];
} | [
"function",
"rgbaToHsla",
"(",
"h",
",",
"s",
",",
"l",
",",
"a",
")",
"{",
"return",
"[",
"...",
"rgbToHsl",
"(",
"h",
",",
"s",
",",
"l",
")",
",",
"a",
"]",
";",
"}"
] | Converts a RGBA colour to HSLA. | [
"Converts",
"a",
"RGBA",
"colour",
"to",
"HSLA",
"."
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L739-L741 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | inerpolateColorsFixedAlpha | function inerpolateColorsFixedAlpha(col1, col2, amount, alpha) {
let col1rgb = parseColor(col1);
let col2rgb = parseColor(col2);
return RGBobj2string({
r: Math.min(255, col1rgb.r * amount + col2rgb.r * Math.max(0,1-amount)),
g: Math.min(255, col1rgb.g * amount + col2rgb.g * Math.max(0,1-amount)),
b: M... | javascript | function inerpolateColorsFixedAlpha(col1, col2, amount, alpha) {
let col1rgb = parseColor(col1);
let col2rgb = parseColor(col2);
return RGBobj2string({
r: Math.min(255, col1rgb.r * amount + col2rgb.r * Math.max(0,1-amount)),
g: Math.min(255, col1rgb.g * amount + col2rgb.g * Math.max(0,1-amount)),
b: M... | [
"function",
"inerpolateColorsFixedAlpha",
"(",
"col1",
",",
"col2",
",",
"amount",
",",
"alpha",
")",
"{",
"let",
"col1rgb",
"=",
"parseColor",
"(",
"col1",
")",
";",
"let",
"col2rgb",
"=",
"parseColor",
"(",
"col2",
")",
";",
"return",
"RGBobj2string",
"(... | Interpolate two colours and set the alpha value. | [
"Interpolate",
"two",
"colours",
"and",
"set",
"the",
"alpha",
"value",
"."
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L863-L872 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | shadeColor | function shadeColor(col, amount) {
let col1rgb = parseColor(col);
return RGBobj2string({
r: Math.min(255, col1rgb.r * amount + 0 * Math.max(0,1-amount)),
g: Math.min(255, col1rgb.g * amount + 0 * Math.max(0,1-amount)),
b: Math.min(255, col1rgb.b * amount + 0 * Math.max(0,1-amount)),
a: col1rgb.a
}... | javascript | function shadeColor(col, amount) {
let col1rgb = parseColor(col);
return RGBobj2string({
r: Math.min(255, col1rgb.r * amount + 0 * Math.max(0,1-amount)),
g: Math.min(255, col1rgb.g * amount + 0 * Math.max(0,1-amount)),
b: Math.min(255, col1rgb.b * amount + 0 * Math.max(0,1-amount)),
a: col1rgb.a
}... | [
"function",
"shadeColor",
"(",
"col",
",",
"amount",
")",
"{",
"let",
"col1rgb",
"=",
"parseColor",
"(",
"col",
")",
";",
"return",
"RGBobj2string",
"(",
"{",
"r",
":",
"Math",
".",
"min",
"(",
"255",
",",
"col1rgb",
".",
"r",
"*",
"amount",
"+",
"... | Shade the colour by the given amount. | [
"Shade",
"the",
"colour",
"by",
"the",
"given",
"amount",
"."
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L877-L885 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | lightenColor | function lightenColor(col, amount) {
let colRgba = parseColor(col);
let colHsla = rgbaToHsla(colRgba.r, colRgba.g, colRgba.b, colRgba.a);
colRgba = hslaToRgba(colHsla[0],colHsla[1],Math.min(Math.max(colHsla[2]+amount, 0), 1),colHsla[3]);
return RGBobj2string({
r: colRgba[0],
g: colRgba[1],
b: colRgb... | javascript | function lightenColor(col, amount) {
let colRgba = parseColor(col);
let colHsla = rgbaToHsla(colRgba.r, colRgba.g, colRgba.b, colRgba.a);
colRgba = hslaToRgba(colHsla[0],colHsla[1],Math.min(Math.max(colHsla[2]+amount, 0), 1),colHsla[3]);
return RGBobj2string({
r: colRgba[0],
g: colRgba[1],
b: colRgb... | [
"function",
"lightenColor",
"(",
"col",
",",
"amount",
")",
"{",
"let",
"colRgba",
"=",
"parseColor",
"(",
"col",
")",
";",
"let",
"colHsla",
"=",
"rgbaToHsla",
"(",
"colRgba",
".",
"r",
",",
"colRgba",
".",
"g",
",",
"colRgba",
".",
"b",
",",
"colRg... | Increase colour lightness by the given amount. | [
"Increase",
"colour",
"lightness",
"by",
"the",
"given",
"amount",
"."
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L903-L913 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | hueshiftColor | function hueshiftColor(col, amount) {
let colRgba = parseColor(col);
let colHsla = rgbaToHsla(colRgba.r, colRgba.g, colRgba.b, colRgba.a);
colRgba = hslaToRgba((hsl[0] + amount) % 1, colHsla[1], colHsla[2],colHsla[3]);
return RGBobj2string({
r: colRgba[0],
g: colRgba[1],
b: colRgba[2],
a: colRgb... | javascript | function hueshiftColor(col, amount) {
let colRgba = parseColor(col);
let colHsla = rgbaToHsla(colRgba.r, colRgba.g, colRgba.b, colRgba.a);
colRgba = hslaToRgba((hsl[0] + amount) % 1, colHsla[1], colHsla[2],colHsla[3]);
return RGBobj2string({
r: colRgba[0],
g: colRgba[1],
b: colRgba[2],
a: colRgb... | [
"function",
"hueshiftColor",
"(",
"col",
",",
"amount",
")",
"{",
"let",
"colRgba",
"=",
"parseColor",
"(",
"col",
")",
";",
"let",
"colHsla",
"=",
"rgbaToHsla",
"(",
"colRgba",
".",
"r",
",",
"colRgba",
".",
"g",
",",
"colRgba",
".",
"b",
",",
"colR... | Hue shift colour by a given amount. | [
"Hue",
"shift",
"colour",
"by",
"a",
"given",
"amount",
"."
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L933-L943 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | getMaxSumStack | function getMaxSumStack(arr) { //here!!!
let maxValue = Number.MIN_VALUE;
arr
.forEach((d) => {
let stackSum = computeArrayValueSum(d);
if (stackSum > maxValue) {
maxValue = stackSum;
}
});
return maxValue;
} | javascript | function getMaxSumStack(arr) { //here!!!
let maxValue = Number.MIN_VALUE;
arr
.forEach((d) => {
let stackSum = computeArrayValueSum(d);
if (stackSum > maxValue) {
maxValue = stackSum;
}
});
return maxValue;
} | [
"function",
"getMaxSumStack",
"(",
"arr",
")",
"{",
"//here!!!",
"let",
"maxValue",
"=",
"Number",
".",
"MIN_VALUE",
";",
"arr",
".",
"forEach",
"(",
"(",
"d",
")",
"=>",
"{",
"let",
"stackSum",
"=",
"computeArrayValueSum",
"(",
"d",
")",
";",
"if",
"(... | Find maximum stacksum | [
"Find",
"maximum",
"stacksum"
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L999-L1009 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | getMinMaxValuesXY | function getMinMaxValuesXY(arr) {
let maxValueX = Number.MIN_VALUE;
let maxValueY = Number.MIN_VALUE;
let minValueX = Number.MAX_VALUE;
let minValueY = Number.MAX_VALUE;
arr
.forEach((d) => {
if (d.x > maxValueX) {
maxValueX = d.x;
}
if (d.x < minValueX) {
... | javascript | function getMinMaxValuesXY(arr) {
let maxValueX = Number.MIN_VALUE;
let maxValueY = Number.MIN_VALUE;
let minValueX = Number.MAX_VALUE;
let minValueY = Number.MAX_VALUE;
arr
.forEach((d) => {
if (d.x > maxValueX) {
maxValueX = d.x;
}
if (d.x < minValueX) {
... | [
"function",
"getMinMaxValuesXY",
"(",
"arr",
")",
"{",
"let",
"maxValueX",
"=",
"Number",
".",
"MIN_VALUE",
";",
"let",
"maxValueY",
"=",
"Number",
".",
"MIN_VALUE",
";",
"let",
"minValueX",
"=",
"Number",
".",
"MAX_VALUE",
";",
"let",
"minValueY",
"=",
"N... | Find minimum and maximum X and Y values in an array of
XY coordinate objects | [
"Find",
"minimum",
"and",
"maximum",
"X",
"and",
"Y",
"values",
"in",
"an",
"array",
"of",
"XY",
"coordinate",
"objects"
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L1027-L1048 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | getMinMaxValuesCandlestick | function getMinMaxValuesCandlestick(arr) {
let maxValue = Number.MIN_VALUE;
let minValue = Number.MAX_VALUE;
arr
.forEach((d) => {
if (d.high > maxValue) {
maxValue = d.high;
}
if (d.low < minValue) {
minValue = d.low;
}
});
return {maxVa... | javascript | function getMinMaxValuesCandlestick(arr) {
let maxValue = Number.MIN_VALUE;
let minValue = Number.MAX_VALUE;
arr
.forEach((d) => {
if (d.high > maxValue) {
maxValue = d.high;
}
if (d.low < minValue) {
minValue = d.low;
}
});
return {maxVa... | [
"function",
"getMinMaxValuesCandlestick",
"(",
"arr",
")",
"{",
"let",
"maxValue",
"=",
"Number",
".",
"MIN_VALUE",
";",
"let",
"minValue",
"=",
"Number",
".",
"MAX_VALUE",
";",
"arr",
".",
"forEach",
"(",
"(",
"d",
")",
"=>",
"{",
"if",
"(",
"d",
".",... | Find minimum and maximum value in an array of candlestick objects | [
"Find",
"minimum",
"and",
"maximum",
"value",
"in",
"an",
"array",
"of",
"candlestick",
"objects"
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L1053-L1066 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | findRectangleIndexContainingPoint | function findRectangleIndexContainingPoint(rectangles, x, y) {
let closestIdx;
rectangles.some((d, idx) => {
if ((d.x1 <= x && x <= d.x2) && (d.y1 <= y && y <= d.y2)) {
closestIdx = idx;
return true;
}
return false;
});
return closestIdx;
} | javascript | function findRectangleIndexContainingPoint(rectangles, x, y) {
let closestIdx;
rectangles.some((d, idx) => {
if ((d.x1 <= x && x <= d.x2) && (d.y1 <= y && y <= d.y2)) {
closestIdx = idx;
return true;
}
return false;
});
return closestIdx;
} | [
"function",
"findRectangleIndexContainingPoint",
"(",
"rectangles",
",",
"x",
",",
"y",
")",
"{",
"let",
"closestIdx",
";",
"rectangles",
".",
"some",
"(",
"(",
"d",
",",
"idx",
")",
"=>",
"{",
"if",
"(",
"(",
"d",
".",
"x1",
"<=",
"x",
"&&",
"x",
... | Find the index of the rectangle that contains a given
coordinate.
@param {array} points - Array of rectangles, each rectangle is of the form
{x1: number, x2: number, y1: number, y2: number},
where x1 and x2 are the minimum and maximum x coordinates
and y1 and y3 are the minimum and maximum x coordinates.
@param {number... | [
"Find",
"the",
"index",
"of",
"the",
"rectangle",
"that",
"contains",
"a",
"given",
"coordinate",
"."
] | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L1091-L1101 | train |
redpandatronicsuk/arty-charty | arty-charty/util.js | findClosestPointIndexWithinRadius | function findClosestPointIndexWithinRadius(points, x, y, radiusThreshold) {
let closestIdx;
let closestDist = Number.MAX_VALUE;
points.forEach((d, idx) => {
let distSqrd = Math.pow(d.x - x, 2) + Math.pow(d.y - y, 2); // changeto: (d.x - x)**2 + (d.y - y)**2;
if (distSqrd < closestDist && distSqr... | javascript | function findClosestPointIndexWithinRadius(points, x, y, radiusThreshold) {
let closestIdx;
let closestDist = Number.MAX_VALUE;
points.forEach((d, idx) => {
let distSqrd = Math.pow(d.x - x, 2) + Math.pow(d.y - y, 2); // changeto: (d.x - x)**2 + (d.y - y)**2;
if (distSqrd < closestDist && distSqr... | [
"function",
"findClosestPointIndexWithinRadius",
"(",
"points",
",",
"x",
",",
"y",
",",
"radiusThreshold",
")",
"{",
"let",
"closestIdx",
";",
"let",
"closestDist",
"=",
"Number",
".",
"MAX_VALUE",
";",
"points",
".",
"forEach",
"(",
"(",
"d",
",",
"idx",
... | Find the index of the closest coordinate to a
reference coordinate in an array of coordinates.
If no point is found within the threshold distance
undefined is returned. | [
"Find",
"the",
"index",
"of",
"the",
"closest",
"coordinate",
"to",
"a",
"reference",
"coordinate",
"in",
"an",
"array",
"of",
"coordinates",
".",
"If",
"no",
"point",
"is",
"found",
"within",
"the",
"threshold",
"distance",
"undefined",
"is",
"returned",
".... | d0b90b42de9f4360343e25e918358e9b331f080d | https://github.com/redpandatronicsuk/arty-charty/blob/d0b90b42de9f4360343e25e918358e9b331f080d/arty-charty/util.js#L1109-L1120 | train |
Kronos-Integration/kronos-interceptor-object-data-processor-row | lib/util/property-helper.js | function (fieldDefinition) {
let type = fieldDefinition.fieldType;
if (typeof type === 'object') {
type = fieldDefinition.fieldType.type;
}
return type;
} | javascript | function (fieldDefinition) {
let type = fieldDefinition.fieldType;
if (typeof type === 'object') {
type = fieldDefinition.fieldType.type;
}
return type;
} | [
"function",
"(",
"fieldDefinition",
")",
"{",
"let",
"type",
"=",
"fieldDefinition",
".",
"fieldType",
";",
"if",
"(",
"typeof",
"type",
"===",
"'object'",
")",
"{",
"type",
"=",
"fieldDefinition",
".",
"fieldType",
".",
"type",
";",
"}",
"return",
"type",... | Returns the severity for a check property. The severity may be defined globaly
for the complete field, but also may be defined on a per check basis
@param fieldDefinition The field_definition | [
"Returns",
"the",
"severity",
"for",
"a",
"check",
"property",
".",
"The",
"severity",
"may",
"be",
"defined",
"globaly",
"for",
"the",
"complete",
"field",
"but",
"also",
"may",
"be",
"defined",
"on",
"a",
"per",
"check",
"basis"
] | 678a59b84dab4a9082377c90849a0d62d97a1ea4 | https://github.com/Kronos-Integration/kronos-interceptor-object-data-processor-row/blob/678a59b84dab4a9082377c90849a0d62d97a1ea4/lib/util/property-helper.js#L87-L93 | train | |
sociomantic-tsunami/lochness | webpack.config.js | buildConfig | function buildConfig( wantedEnv )
{
const isValid = wantedEnv &&
wantedEnv.length > 0 && allowedEnvs.indexOf( wantedEnv ) !== -1;
const validEnv = isValid ? wantedEnv : 'dev';
return configs[ validEnv ];
} | javascript | function buildConfig( wantedEnv )
{
const isValid = wantedEnv &&
wantedEnv.length > 0 && allowedEnvs.indexOf( wantedEnv ) !== -1;
const validEnv = isValid ? wantedEnv : 'dev';
return configs[ validEnv ];
} | [
"function",
"buildConfig",
"(",
"wantedEnv",
")",
"{",
"const",
"isValid",
"=",
"wantedEnv",
"&&",
"wantedEnv",
".",
"length",
">",
"0",
"&&",
"allowedEnvs",
".",
"indexOf",
"(",
"wantedEnv",
")",
"!==",
"-",
"1",
";",
"const",
"validEnv",
"=",
"isValid",
... | Build the webpack configuration
@param {String} wantedEnv The wanted environment
@return {Object} Webpack config | [
"Build",
"the",
"webpack",
"configuration"
] | cf71d6608ce2cdc6d745195a90c815304b8f0f6f | https://github.com/sociomantic-tsunami/lochness/blob/cf71d6608ce2cdc6d745195a90c815304b8f0f6f/webpack.config.js#L37-L45 | train |
yhtml5/yhtml5-cli | packages/yhtml5-cli/lib/generate.js | generate | function generate (projectPatch, source, done) {
shell.mkdir('-p', projectPatch)
shell.cp('-Rf', source, projectPatch)
done()
} | javascript | function generate (projectPatch, source, done) {
shell.mkdir('-p', projectPatch)
shell.cp('-Rf', source, projectPatch)
done()
} | [
"function",
"generate",
"(",
"projectPatch",
",",
"source",
",",
"done",
")",
"{",
"shell",
".",
"mkdir",
"(",
"'-p'",
",",
"projectPatch",
")",
"shell",
".",
"cp",
"(",
"'-Rf'",
",",
"source",
",",
"projectPatch",
")",
"done",
"(",
")",
"}"
] | Generate a template given a `src` and `dest`.
@param {String} projectPatch
@param {String} source
@param {Function} done | [
"Generate",
"a",
"template",
"given",
"a",
"src",
"and",
"dest",
"."
] | 521a8ad160058e453dff87c7cc9bfb16215715c6 | https://github.com/yhtml5/yhtml5-cli/blob/521a8ad160058e453dff87c7cc9bfb16215715c6/packages/yhtml5-cli/lib/generate.js#L12-L16 | train |
feedhenry/fh-mbaas-express | lib/common/authenticate.js | getCacheRefreshInterval | function getCacheRefreshInterval() {
var value = parseInt(process.env[CACHE_REFRESH_KEY]);
// Should we 0 here to invalidate the cache immediately?
if (value && !isNaN(value) && value > 0) {
return value;
}
return DEFAULT_CACHE_REFRESH_SECONDS;
} | javascript | function getCacheRefreshInterval() {
var value = parseInt(process.env[CACHE_REFRESH_KEY]);
// Should we 0 here to invalidate the cache immediately?
if (value && !isNaN(value) && value > 0) {
return value;
}
return DEFAULT_CACHE_REFRESH_SECONDS;
} | [
"function",
"getCacheRefreshInterval",
"(",
")",
"{",
"var",
"value",
"=",
"parseInt",
"(",
"process",
".",
"env",
"[",
"CACHE_REFRESH_KEY",
"]",
")",
";",
"// Should we 0 here to invalidate the cache immediately?",
"if",
"(",
"value",
"&&",
"!",
"isNaN",
"(",
"va... | The refresh interval of the authentication cache should be configurable. Since
this is running inside a cloud app the best option is th use an environment
variable.
@returns {*} | [
"The",
"refresh",
"interval",
"of",
"the",
"authentication",
"cache",
"should",
"be",
"configurable",
".",
"Since",
"this",
"is",
"running",
"inside",
"a",
"cloud",
"app",
"the",
"best",
"option",
"is",
"th",
"use",
"an",
"environment",
"variable",
"."
] | 381c2a5842b49a4cbc4519d55b9a3c870b364d3c | https://github.com/feedhenry/fh-mbaas-express/blob/381c2a5842b49a4cbc4519d55b9a3c870b364d3c/lib/common/authenticate.js#L357-L366 | train |
scijs/cwise-parser | index.js | createLocal | function createLocal(id) {
var nstr = prefix + id.replace(/\_/g, "__")
localVars.push(nstr)
return nstr
} | javascript | function createLocal(id) {
var nstr = prefix + id.replace(/\_/g, "__")
localVars.push(nstr)
return nstr
} | [
"function",
"createLocal",
"(",
"id",
")",
"{",
"var",
"nstr",
"=",
"prefix",
"+",
"id",
".",
"replace",
"(",
"/",
"\\_",
"/",
"g",
",",
"\"__\"",
")",
"localVars",
".",
"push",
"(",
"nstr",
")",
"return",
"nstr",
"}"
] | Retrieves a local variable | [
"Retrieves",
"a",
"local",
"variable"
] | 6b9cbce6ebb6b66051226df75627f740b7ecdcc8 | https://github.com/scijs/cwise-parser/blob/6b9cbce6ebb6b66051226df75627f740b7ecdcc8/index.js#L72-L76 | train |
scijs/cwise-parser | index.js | createThisVar | function createThisVar(id) {
var nstr = "this_" + id.replace(/\_/g, "__")
thisVars.push(nstr)
return nstr
} | javascript | function createThisVar(id) {
var nstr = "this_" + id.replace(/\_/g, "__")
thisVars.push(nstr)
return nstr
} | [
"function",
"createThisVar",
"(",
"id",
")",
"{",
"var",
"nstr",
"=",
"\"this_\"",
"+",
"id",
".",
"replace",
"(",
"/",
"\\_",
"/",
"g",
",",
"\"__\"",
")",
"thisVars",
".",
"push",
"(",
"nstr",
")",
"return",
"nstr",
"}"
] | Creates a this variable | [
"Creates",
"a",
"this",
"variable"
] | 6b9cbce6ebb6b66051226df75627f740b7ecdcc8 | https://github.com/scijs/cwise-parser/blob/6b9cbce6ebb6b66051226df75627f740b7ecdcc8/index.js#L79-L83 | train |
scijs/cwise-parser | index.js | rewrite | function rewrite(node, nstr) {
var lo = node.range[0], hi = node.range[1]
for(var i=lo+1; i<hi; ++i) {
exploded[i] = ""
}
exploded[lo] = nstr
} | javascript | function rewrite(node, nstr) {
var lo = node.range[0], hi = node.range[1]
for(var i=lo+1; i<hi; ++i) {
exploded[i] = ""
}
exploded[lo] = nstr
} | [
"function",
"rewrite",
"(",
"node",
",",
"nstr",
")",
"{",
"var",
"lo",
"=",
"node",
".",
"range",
"[",
"0",
"]",
",",
"hi",
"=",
"node",
".",
"range",
"[",
"1",
"]",
"for",
"(",
"var",
"i",
"=",
"lo",
"+",
"1",
";",
"i",
"<",
"hi",
";",
... | Rewrites an ast node | [
"Rewrites",
"an",
"ast",
"node"
] | 6b9cbce6ebb6b66051226df75627f740b7ecdcc8 | https://github.com/scijs/cwise-parser/blob/6b9cbce6ebb6b66051226df75627f740b7ecdcc8/index.js#L86-L92 | train |
dowjones/distribucache | lib/CacheClient.js | CacheClient | function CacheClient(store, config) {
EventEmitter.call(this);
this._store = store;
this._config = config || {};
util.propagateEvent(this._store, this, 'error');
this.on('error', unhandledErrorListener);
} | javascript | function CacheClient(store, config) {
EventEmitter.call(this);
this._store = store;
this._config = config || {};
util.propagateEvent(this._store, this, 'error');
this.on('error', unhandledErrorListener);
} | [
"function",
"CacheClient",
"(",
"store",
",",
"config",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_store",
"=",
"store",
";",
"this",
".",
"_config",
"=",
"config",
"||",
"{",
"}",
";",
"util",
".",
"propagateEvent",
... | Create a new cache client,
decorated with the desired features,
based on the provided config.
@constructor
@param {Store} store
@param {Object} [config]
@param {Boolean} [config.isPreconfigured] defaults to false
@param {String} [config.host] defaults to 'localhost'
@param {Number} [config.port] defaults to 6379
@pa... | [
"Create",
"a",
"new",
"cache",
"client",
"decorated",
"with",
"the",
"desired",
"features",
"based",
"on",
"the",
"provided",
"config",
"."
] | ad79caee277771a6e49ee4a98c4983480cd89945 | https://github.com/dowjones/distribucache/blob/ad79caee277771a6e49ee4a98c4983480cd89945/lib/CacheClient.js#L46-L54 | train |
macrat/AsyncMark | src/timer.js | timeit | async function timeit(fun, context={}, args=[]) {
const start = now();
await fun.call(context, ...args);
const end = now();
return end - start;
} | javascript | async function timeit(fun, context={}, args=[]) {
const start = now();
await fun.call(context, ...args);
const end = now();
return end - start;
} | [
"async",
"function",
"timeit",
"(",
"fun",
",",
"context",
"=",
"{",
"}",
",",
"args",
"=",
"[",
"]",
")",
"{",
"const",
"start",
"=",
"now",
"(",
")",
";",
"await",
"fun",
".",
"call",
"(",
"context",
",",
"...",
"args",
")",
";",
"const",
"en... | Measure tiem to execute a function.
wait for done if the target function returns a thenable object. so you can use async function.
NOTE: this function will execute target function only once.
@param {function(): ?Promise} fun - the target function.
@param {Object} [context={}] - the `this` for target function.
@param... | [
"Measure",
"tiem",
"to",
"execute",
"a",
"function",
"."
] | 84ae4130034c47857d0df0e64d43900a18b8b285 | https://github.com/macrat/AsyncMark/blob/84ae4130034c47857d0df0e64d43900a18b8b285/src/timer.js#L79-L85 | train |
SandJS/http | lib/middleware/ai.js | getCache | function getCache() {
return new Promise(function(resolve, reject) {
// create and fetch the cache key
get(getKey(), function(err, data) {
if (err) {
return reject(err);
}
resolve(data);
});
});
} | javascript | function getCache() {
return new Promise(function(resolve, reject) {
// create and fetch the cache key
get(getKey(), function(err, data) {
if (err) {
return reject(err);
}
resolve(data);
});
});
} | [
"function",
"getCache",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"// create and fetch the cache key",
"get",
"(",
"getKey",
"(",
")",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(... | Fetches an image buffer from the cache
@returns {Promise} | [
"Fetches",
"an",
"image",
"buffer",
"from",
"the",
"cache"
] | 8f8b4d23eb5f59d802c9537e0ccd67b47fa79d2f | https://github.com/SandJS/http/blob/8f8b4d23eb5f59d802c9537e0ccd67b47fa79d2f/lib/middleware/ai.js#L323-L333 | train |
SandJS/http | lib/middleware/ai.js | putCache | function putCache() {
return new Promise(function(resolve, reject) {
// make the cache key
let key = getKey();
// adapt the image
adapt(function(err, stdout, stderr) {
if (err) {
return reject(err);
}
// convert the new image stream to bu... | javascript | function putCache() {
return new Promise(function(resolve, reject) {
// make the cache key
let key = getKey();
// adapt the image
adapt(function(err, stdout, stderr) {
if (err) {
return reject(err);
}
// convert the new image stream to bu... | [
"function",
"putCache",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"// make the cache key",
"let",
"key",
"=",
"getKey",
"(",
")",
";",
"// adapt the image",
"adapt",
"(",
"function",
"(",
"err",
",... | Creates an adapted image buffer | puts it in the cache | returns the buffer
@returns {Promise} | [
"Creates",
"an",
"adapted",
"image",
"buffer",
"|",
"puts",
"it",
"in",
"the",
"cache",
"|",
"returns",
"the",
"buffer"
] | 8f8b4d23eb5f59d802c9537e0ccd67b47fa79d2f | https://github.com/SandJS/http/blob/8f8b4d23eb5f59d802c9537e0ccd67b47fa79d2f/lib/middleware/ai.js#L340-L373 | train |
SandJS/http | lib/middleware/ai.js | getKey | function getKey() {
let paramString =
width + 'x' + height + '-'
+ path
+ (is2x ? '-@2x' : '')
+ (bg ? `_${bg}` : '')
+ (crop ? '_crop' : '')
+ (mode ? `_${mode}` : '')
+ (trim ? '_trim' : '');
return paramString + '-' + crypto.createHash('sha1').upda... | javascript | function getKey() {
let paramString =
width + 'x' + height + '-'
+ path
+ (is2x ? '-@2x' : '')
+ (bg ? `_${bg}` : '')
+ (crop ? '_crop' : '')
+ (mode ? `_${mode}` : '')
+ (trim ? '_trim' : '');
return paramString + '-' + crypto.createHash('sha1').upda... | [
"function",
"getKey",
"(",
")",
"{",
"let",
"paramString",
"=",
"width",
"+",
"'x'",
"+",
"height",
"+",
"'-'",
"+",
"path",
"+",
"(",
"is2x",
"?",
"'-@2x'",
":",
"''",
")",
"+",
"(",
"bg",
"?",
"`",
"${",
"bg",
"}",
"`",
":",
"''",
")",
"+",... | Builds a cache key for the adapted image
@returns {string} | [
"Builds",
"a",
"cache",
"key",
"for",
"the",
"adapted",
"image"
] | 8f8b4d23eb5f59d802c9537e0ccd67b47fa79d2f | https://github.com/SandJS/http/blob/8f8b4d23eb5f59d802c9537e0ccd67b47fa79d2f/lib/middleware/ai.js#L380-L391 | train |
Rhinostone/gina | core/controller/controller.js | function(type, resStr, resArr, resObj) {
switch(type){
case 'css':
var css = resObj;
for (var res in resArr) {
//means that you will find options.
if (typeof(resArr[res]) == "object") {
//console.info('fo... | javascript | function(type, resStr, resArr, resObj) {
switch(type){
case 'css':
var css = resObj;
for (var res in resArr) {
//means that you will find options.
if (typeof(resArr[res]) == "object") {
//console.info('fo... | [
"function",
"(",
"type",
",",
"resStr",
",",
"resArr",
",",
"resObj",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"'css'",
":",
"var",
"css",
"=",
"resObj",
";",
"for",
"(",
"var",
"res",
"in",
"resArr",
")",
"{",
"//means that you will find opt... | Get node resources
@param {string} type
@param {string} resStr
@param {array} resArr
@param {object} resObj
@return {object} content
@private | [
"Get",
"node",
"resources"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/controller/controller.js#L942-L989 | train | |
Rhinostone/gina | core/controller/controller.js | function (i, res, files, cb) {
if (!files.length || files.length == 0) {
cb(false)
} else {
if ( fs.existsSync(files[i].target) ) new _(files[i].target).rmSync();
var sourceStream = fs.createReadStream(files[i].source);
var destinationStream = fs.createWr... | javascript | function (i, res, files, cb) {
if (!files.length || files.length == 0) {
cb(false)
} else {
if ( fs.existsSync(files[i].target) ) new _(files[i].target).rmSync();
var sourceStream = fs.createReadStream(files[i].source);
var destinationStream = fs.createWr... | [
"function",
"(",
"i",
",",
"res",
",",
"files",
",",
"cb",
")",
"{",
"if",
"(",
"!",
"files",
".",
"length",
"||",
"files",
".",
"length",
"==",
"0",
")",
"{",
"cb",
"(",
"false",
")",
"}",
"else",
"{",
"if",
"(",
"fs",
".",
"existsSync",
"("... | Move files to assets dir
@param {object} res
@param {collection} files
@callback cb
@param {object} [err] | [
"Move",
"files",
"to",
"assets",
"dir"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/controller/controller.js#L1165-L1192 | train | |
Rhinostone/gina | core/controller/controller.js | function(req) {
req.getParams = function() {
// copy
var params = JSON.parse(JSON.stringify(req.params));
switch( req.method.toLowerCase() ) {
case 'get':
params = merge(params, req.get, true);
break;
c... | javascript | function(req) {
req.getParams = function() {
// copy
var params = JSON.parse(JSON.stringify(req.params));
switch( req.method.toLowerCase() ) {
case 'get':
params = merge(params, req.get, true);
break;
c... | [
"function",
"(",
"req",
")",
"{",
"req",
".",
"getParams",
"=",
"function",
"(",
")",
"{",
"// copy",
"var",
"params",
"=",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"req",
".",
"params",
")",
")",
";",
"switch",
"(",
"req",
".",
... | Get all Params | [
"Get",
"all",
"Params"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/controller/controller.js#L1542-L1591 | train | |
Rhinostone/gina | core/controller/controller.js | function (code) {
var list = {}, cde = 'short', name = null;
if ( typeof(code) != 'undefined' && typeof(userLocales[0][code]) == 'string' ) {
cde = code
} else if ( typeof(code) != 'undefined' ) (
console.warn('`'+ code +'` not supported : sticking wi... | javascript | function (code) {
var list = {}, cde = 'short', name = null;
if ( typeof(code) != 'undefined' && typeof(userLocales[0][code]) == 'string' ) {
cde = code
} else if ( typeof(code) != 'undefined' ) (
console.warn('`'+ code +'` not supported : sticking wi... | [
"function",
"(",
"code",
")",
"{",
"var",
"list",
"=",
"{",
"}",
",",
"cde",
"=",
"'short'",
",",
"name",
"=",
"null",
";",
"if",
"(",
"typeof",
"(",
"code",
")",
"!=",
"'undefined'",
"&&",
"typeof",
"(",
"userLocales",
"[",
"0",
"]",
"[",
"code"... | Get countries list
@param {string} [code] - e.g.: short, long, fifa, m49
@return {object} countries - countries code & value list | [
"Get",
"countries",
"list"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/controller/controller.js#L1649-L1670 | train | |
Rhinostone/gina | core/controller/controller.js | function (arr){
var tmp = null,
curObj = {},
obj = {},
count = 0,
data = {},
last = null;
for (var r in arr) {
tmp = r.split(".");
//Creating structure - Adding sub levels
for (var o in tmp) {
... | javascript | function (arr){
var tmp = null,
curObj = {},
obj = {},
count = 0,
data = {},
last = null;
for (var r in arr) {
tmp = r.split(".");
//Creating structure - Adding sub levels
for (var o in tmp) {
... | [
"function",
"(",
"arr",
")",
"{",
"var",
"tmp",
"=",
"null",
",",
"curObj",
"=",
"{",
"}",
",",
"obj",
"=",
"{",
"}",
",",
"count",
"=",
"0",
",",
"data",
"=",
"{",
"}",
",",
"last",
"=",
"null",
";",
"for",
"(",
"var",
"r",
"in",
"arr",
... | converting references to objects | [
"converting",
"references",
"to",
"objects"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/controller/controller.js#L1816-L1854 | train | |
invisible-tech/mongoose-extras | customAsserts/documentAssertions.js | assertSameObjectIdArray | function assertSameObjectIdArray(actual, expected, msg) {
assert(Array.isArray(actual), 'assertSameObjectIdArray: First argument is not an Array.')
assert(Array.isArray(expected), 'assertSameObjectIdArray: Second argument is not an Array.')
assert(size(actual) > 0 || size(expected) > 0, 'assertSameObjectIdArray: ... | javascript | function assertSameObjectIdArray(actual, expected, msg) {
assert(Array.isArray(actual), 'assertSameObjectIdArray: First argument is not an Array.')
assert(Array.isArray(expected), 'assertSameObjectIdArray: Second argument is not an Array.')
assert(size(actual) > 0 || size(expected) > 0, 'assertSameObjectIdArray: ... | [
"function",
"assertSameObjectIdArray",
"(",
"actual",
",",
"expected",
",",
"msg",
")",
"{",
"assert",
"(",
"Array",
".",
"isArray",
"(",
"actual",
")",
",",
"'assertSameObjectIdArray: First argument is not an Array.'",
")",
"assert",
"(",
"Array",
".",
"isArray",
... | Throws if the given actual and expected arrays of ObjectIds don't match.
@method assertSameDocumentIdArray
@param {ObjectId[]} actual - Array of ObjectId
@param {ObjectId[]} expected - Array of ObjectId
@param {String} msg - Optional custom error message
@return {undefined} - Throws if assertions fail | [
"Throws",
"if",
"the",
"given",
"actual",
"and",
"expected",
"arrays",
"of",
"ObjectIds",
"don",
"t",
"match",
"."
] | 9b572554a292ead1644b0afa3fc5a5b382d5dec9 | https://github.com/invisible-tech/mongoose-extras/blob/9b572554a292ead1644b0afa3fc5a5b382d5dec9/customAsserts/documentAssertions.js#L73-L82 | train |
Rhinostone/gina | script/pre_install.js | PreInstall | function PreInstall() {
var self = this;
var init = function() {
self.isWin32 = ( os.platform() == 'win32' ) ? true : false;
self.path = __dirname.substring(0, (__dirname.length - 'script'.length));
console.debug('paths -> '+ self.path);
if ( hasNodeModulesSync() ) { // cleain... | javascript | function PreInstall() {
var self = this;
var init = function() {
self.isWin32 = ( os.platform() == 'win32' ) ? true : false;
self.path = __dirname.substring(0, (__dirname.length - 'script'.length));
console.debug('paths -> '+ self.path);
if ( hasNodeModulesSync() ) { // cleain... | [
"function",
"PreInstall",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"init",
"=",
"function",
"(",
")",
"{",
"self",
".",
"isWin32",
"=",
"(",
"os",
".",
"platform",
"(",
")",
"==",
"'win32'",
")",
"?",
"true",
":",
"false",
";",
"sel... | Pre install constructor
@constructor | [
"Pre",
"install",
"constructor"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/script/pre_install.js#L24-L61 | train |
Rhinostone/gina | core/plugins/lib/validator/src/main.js | function($form) {
var $form = $form, _id = null;
if ( typeof($form) == 'undefined' ) {
if ( typeof(this.target) != 'undefined' ) {
_id = this.target.getAttribute('id');
} else {
_id = this.getAttribute('id');
}
$form = inst... | javascript | function($form) {
var $form = $form, _id = null;
if ( typeof($form) == 'undefined' ) {
if ( typeof(this.target) != 'undefined' ) {
_id = this.target.getAttribute('id');
} else {
_id = this.getAttribute('id');
}
$form = inst... | [
"function",
"(",
"$form",
")",
"{",
"var",
"$form",
"=",
"$form",
",",
"_id",
"=",
"null",
";",
"if",
"(",
"typeof",
"(",
"$form",
")",
"==",
"'undefined'",
")",
"{",
"if",
"(",
"typeof",
"(",
"this",
".",
"target",
")",
"!=",
"'undefined'",
")",
... | Reset errors display
@param {object|string} [$form|formId] | [
"Reset",
"errors",
"display"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/plugins/lib/validator/src/main.js#L392-L416 | train | |
Rhinostone/gina | core/plugins/lib/validator/src/main.js | function(rules, tmp) {
var _r = null;
for (var r in rules) {
if ( typeof(rules[r]) == 'object' && typeof(instance.rules[tmp + r]) == 'undefined' ) {
_r = r;
if (/\[|\]/.test(r) ) { // must be a real path
_r = r.replace(/\[/g, '.').replace... | javascript | function(rules, tmp) {
var _r = null;
for (var r in rules) {
if ( typeof(rules[r]) == 'object' && typeof(instance.rules[tmp + r]) == 'undefined' ) {
_r = r;
if (/\[|\]/.test(r) ) { // must be a real path
_r = r.replace(/\[/g, '.').replace... | [
"function",
"(",
"rules",
",",
"tmp",
")",
"{",
"var",
"_r",
"=",
"null",
";",
"for",
"(",
"var",
"r",
"in",
"rules",
")",
"{",
"if",
"(",
"typeof",
"(",
"rules",
"[",
"r",
"]",
")",
"==",
"'object'",
"&&",
"typeof",
"(",
"instance",
".",
"rule... | parseRules - Preparing rules paths
@param {object} rules
@param {string} tmp - path | [
"parseRules",
"-",
"Preparing",
"rules",
"paths"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/plugins/lib/validator/src/main.js#L1103-L1119 | train | |
Kronos-Integration/kronos-interceptor-object-data-processor-row | lib/converter/data-field-splitter.js | createSplitterForField | function createSplitterForField(multiFieldDefinitionPart, fieldName) {
if (multiFieldDefinitionPart === undefined) {
throw ("'multiFieldDefinitionPart' must not be undefined");
}
if (fieldName === undefined) {
throw ("'fieldName' must not be undefined");
}
const delimiter = multiFieldDefinitionPart.delimiter... | javascript | function createSplitterForField(multiFieldDefinitionPart, fieldName) {
if (multiFieldDefinitionPart === undefined) {
throw ("'multiFieldDefinitionPart' must not be undefined");
}
if (fieldName === undefined) {
throw ("'fieldName' must not be undefined");
}
const delimiter = multiFieldDefinitionPart.delimiter... | [
"function",
"createSplitterForField",
"(",
"multiFieldDefinitionPart",
",",
"fieldName",
")",
"{",
"if",
"(",
"multiFieldDefinitionPart",
"===",
"undefined",
")",
"{",
"throw",
"(",
"\"'multiFieldDefinitionPart' must not be undefined\"",
")",
";",
"}",
"if",
"(",
"field... | Create the field spliter for a given field definition
The field must be a multiField.
@param multiFieldDefinitionPart The multiField part of aa field definition for one field.
@param fieldName The name of the current multiField | [
"Create",
"the",
"field",
"spliter",
"for",
"a",
"given",
"field",
"definition",
"The",
"field",
"must",
"be",
"a",
"multiField",
"."
] | 678a59b84dab4a9082377c90849a0d62d97a1ea4 | https://github.com/Kronos-Integration/kronos-interceptor-object-data-processor-row/blob/678a59b84dab4a9082377c90849a0d62d97a1ea4/lib/converter/data-field-splitter.js#L28-L146 | train |
AlCalzone/shared-utils | build/sorted-list/index.js | findPrevNode | function findPrevNode(firstNode, item, comparer) {
let ret;
let prevNode = firstNode;
// while item > prevNode.value
while (prevNode != undefined && comparer(prevNode.value, item) > 0) {
ret = prevNode;
prevNode = prevNode.next;
}
return ret;
} | javascript | function findPrevNode(firstNode, item, comparer) {
let ret;
let prevNode = firstNode;
// while item > prevNode.value
while (prevNode != undefined && comparer(prevNode.value, item) > 0) {
ret = prevNode;
prevNode = prevNode.next;
}
return ret;
} | [
"function",
"findPrevNode",
"(",
"firstNode",
",",
"item",
",",
"comparer",
")",
"{",
"let",
"ret",
";",
"let",
"prevNode",
"=",
"firstNode",
";",
"// while item > prevNode.value",
"while",
"(",
"prevNode",
"!=",
"undefined",
"&&",
"comparer",
"(",
"prevNode",
... | Seeks the list from the beginning and finds the position to add the new item | [
"Seeks",
"the",
"list",
"from",
"the",
"beginning",
"and",
"finds",
"the",
"position",
"to",
"add",
"the",
"new",
"item"
] | 9048e1f8793909fae7acb503984a4d8aadad4f3b | https://github.com/AlCalzone/shared-utils/blob/9048e1f8793909fae7acb503984a4d8aadad4f3b/build/sorted-list/index.js#L8-L17 | train |
AlCalzone/shared-utils | build/sorted-list/index.js | findNode | function findNode(firstNode, predicate) {
let curNode = firstNode;
while (curNode != null) {
if (predicate(curNode.value))
return curNode;
curNode = curNode.next;
}
} | javascript | function findNode(firstNode, predicate) {
let curNode = firstNode;
while (curNode != null) {
if (predicate(curNode.value))
return curNode;
curNode = curNode.next;
}
} | [
"function",
"findNode",
"(",
"firstNode",
",",
"predicate",
")",
"{",
"let",
"curNode",
"=",
"firstNode",
";",
"while",
"(",
"curNode",
"!=",
"null",
")",
"{",
"if",
"(",
"predicate",
"(",
"curNode",
".",
"value",
")",
")",
"return",
"curNode",
";",
"c... | Seeks the list from the beginning and returns the first item matching the given predicate | [
"Seeks",
"the",
"list",
"from",
"the",
"beginning",
"and",
"returns",
"the",
"first",
"item",
"matching",
"the",
"given",
"predicate"
] | 9048e1f8793909fae7acb503984a4d8aadad4f3b | https://github.com/AlCalzone/shared-utils/blob/9048e1f8793909fae7acb503984a4d8aadad4f3b/build/sorted-list/index.js#L21-L28 | train |
Kronos-Integration/kronos-interceptor-object-data-processor-row | lib/recordCheck/data-check-string-email.js | createCheckEmail | function createCheckEmail(fieldDefinition, fieldName) {
const severity = propertyHelper.getSeverity(fieldDefinition);
// return getIteratorFunction: function (fieldName, defaultValue, checkProperties, checkFunction, getErrorFunction,
// getValueIfErrorFunction, getValueIfOkFunction) {
let errorInfo = {
s... | javascript | function createCheckEmail(fieldDefinition, fieldName) {
const severity = propertyHelper.getSeverity(fieldDefinition);
// return getIteratorFunction: function (fieldName, defaultValue, checkProperties, checkFunction, getErrorFunction,
// getValueIfErrorFunction, getValueIfOkFunction) {
let errorInfo = {
s... | [
"function",
"createCheckEmail",
"(",
"fieldDefinition",
",",
"fieldName",
")",
"{",
"const",
"severity",
"=",
"propertyHelper",
".",
"getSeverity",
"(",
"fieldDefinition",
")",
";",
"// return getIteratorFunction: function (fieldName, defaultValue, checkProperties, checkFunction,... | Checks if a given string looks like a valid email.
@param fieldDefinition The field_definition for this field.
@param fieldName The name of the current field
@return The check | [
"Checks",
"if",
"a",
"given",
"string",
"looks",
"like",
"a",
"valid",
"email",
"."
] | 678a59b84dab4a9082377c90849a0d62d97a1ea4 | https://github.com/Kronos-Integration/kronos-interceptor-object-data-processor-row/blob/678a59b84dab4a9082377c90849a0d62d97a1ea4/lib/recordCheck/data-check-string-email.js#L45-L58 | train |
Kronos-Integration/kronos-interceptor-object-data-processor-row | lib/recordCheck/data-check-string-email.js | createCheckDefaultValue | function createCheckDefaultValue(fieldDefinition, fieldName) {
const defaultValue = fieldDefinition.defaultValue;
// -----------------------------------------------------------------------
// Set default value
// -----------------------------------------------------------------------
return function (content... | javascript | function createCheckDefaultValue(fieldDefinition, fieldName) {
const defaultValue = fieldDefinition.defaultValue;
// -----------------------------------------------------------------------
// Set default value
// -----------------------------------------------------------------------
return function (content... | [
"function",
"createCheckDefaultValue",
"(",
"fieldDefinition",
",",
"fieldName",
")",
"{",
"const",
"defaultValue",
"=",
"fieldDefinition",
".",
"defaultValue",
";",
"// -----------------------------------------------------------------------",
"// Set default value",
"// ----------... | Set the default value if no value is there
@param fieldDefinition The field_definition for this field.
@param fieldName The name of the current field
@return checks A list of checks to be perfomred | [
"Set",
"the",
"default",
"value",
"if",
"no",
"value",
"is",
"there"
] | 678a59b84dab4a9082377c90849a0d62d97a1ea4 | https://github.com/Kronos-Integration/kronos-interceptor-object-data-processor-row/blob/678a59b84dab4a9082377c90849a0d62d97a1ea4/lib/recordCheck/data-check-string-email.js#L66-L90 | train |
Rhinostone/gina | core/utils/helpers/dateFormat.js | function (format) {
var name = "default";
for (var f in self.masks) {
if ( self.masks[f] === format )
return f
}
return name
} | javascript | function (format) {
var name = "default";
for (var f in self.masks) {
if ( self.masks[f] === format )
return f
}
return name
} | [
"function",
"(",
"format",
")",
"{",
"var",
"name",
"=",
"\"default\"",
";",
"for",
"(",
"var",
"f",
"in",
"self",
".",
"masks",
")",
"{",
"if",
"(",
"self",
".",
"masks",
"[",
"f",
"]",
"===",
"format",
")",
"return",
"f",
"}",
"return",
"name",... | Get mask name from a given format
@param {string} format
@return {string} maskName | [
"Get",
"mask",
"name",
"from",
"a",
"given",
"format"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/helpers/dateFormat.js#L143-L153 | train | |
Rhinostone/gina | core/utils/helpers/dateFormat.js | function(date, dateTo) {
if ( dateTo instanceof Date) {
// The number of milliseconds in one day
var oneDay = 1000 * 60 * 60 * 24
// Convert both dates to milliseconds
var date1Ms = date.getTime()
var date2Ms = dateTo.getTime()
// Calcul... | javascript | function(date, dateTo) {
if ( dateTo instanceof Date) {
// The number of milliseconds in one day
var oneDay = 1000 * 60 * 60 * 24
// Convert both dates to milliseconds
var date1Ms = date.getTime()
var date2Ms = dateTo.getTime()
// Calcul... | [
"function",
"(",
"date",
",",
"dateTo",
")",
"{",
"if",
"(",
"dateTo",
"instanceof",
"Date",
")",
"{",
"// The number of milliseconds in one day",
"var",
"oneDay",
"=",
"1000",
"*",
"60",
"*",
"60",
"*",
"24",
"// Convert both dates to milliseconds",
"var",
"dat... | Count days from the current date to another
TODO - add a closure to `ignoreWeekend()` based on Utils::Validator
TODO - add a closure to `ignoreFromList(array)` based on Utils::Validator
@param {object} dateTo
@return {number} count | [
"Count",
"days",
"from",
"the",
"current",
"date",
"to",
"another"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/helpers/dateFormat.js#L165-L183 | train | |
Rhinostone/gina | core/utils/helpers/dateFormat.js | function(date, dateTo, mask) {
if ( dateTo instanceof Date) {
var count = countDaysTo(date, dateTo)
, month = date.getMonth()
, year = date.getFullYear()
, day = date.getDate() + 1
, dateObj = new Date(year, mont... | javascript | function(date, dateTo, mask) {
if ( dateTo instanceof Date) {
var count = countDaysTo(date, dateTo)
, month = date.getMonth()
, year = date.getFullYear()
, day = date.getDate() + 1
, dateObj = new Date(year, mont... | [
"function",
"(",
"date",
",",
"dateTo",
",",
"mask",
")",
"{",
"if",
"(",
"dateTo",
"instanceof",
"Date",
")",
"{",
"var",
"count",
"=",
"countDaysTo",
"(",
"date",
",",
"dateTo",
")",
",",
"month",
"=",
"date",
".",
"getMonth",
"(",
")",
",",
"yea... | Will give an array of dates between the current date to a targeted date
TODO - add a closure to `ignoreWeekend()` based on Utils::Validator
TODO - add a closure to `ignoreFromList(array)` based on Utils::Validator
@param {object} dateTo
@param {string} [ mask ]
@return {array} dates | [
"Will",
"give",
"an",
"array",
"of",
"dates",
"between",
"the",
"current",
"date",
"to",
"a",
"targeted",
"date"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/helpers/dateFormat.js#L196-L221 | train | |
dowjones/distribucache | lib/decorators/BaseDecorator.js | BaseDecorator | function BaseDecorator(cache, config, configSchema) {
this._cache = cache;
if (config) {
this._configSchema = configSchema;
this._config = this._humanTimeIntervalToMs(config);
this._config = this._validateConfig(configSchema, this._config);
}
// substitute cb, for cases
// when you don't need a ... | javascript | function BaseDecorator(cache, config, configSchema) {
this._cache = cache;
if (config) {
this._configSchema = configSchema;
this._config = this._humanTimeIntervalToMs(config);
this._config = this._validateConfig(configSchema, this._config);
}
// substitute cb, for cases
// when you don't need a ... | [
"function",
"BaseDecorator",
"(",
"cache",
",",
"config",
",",
"configSchema",
")",
"{",
"this",
".",
"_cache",
"=",
"cache",
";",
"if",
"(",
"config",
")",
"{",
"this",
".",
"_configSchema",
"=",
"configSchema",
";",
"this",
".",
"_config",
"=",
"this",... | The root of the Decorator tree
@constructor | [
"The",
"root",
"of",
"the",
"Decorator",
"tree"
] | ad79caee277771a6e49ee4a98c4983480cd89945 | https://github.com/dowjones/distribucache/blob/ad79caee277771a6e49ee4a98c4983480cd89945/lib/decorators/BaseDecorator.js#L12-L27 | train |
Rhinostone/gina | core/utils/lib/merge/src/main.js | function (obj) {
if (
!obj
|| {}.toString.call(obj) !== '[object Object]'
|| obj.nodeType
|| obj.setInterval
) {
return false
}
var hasOwn = {}.hasOwnProperty;
var hasOwnConstructor = hasOwn.call(obj, 'co... | javascript | function (obj) {
if (
!obj
|| {}.toString.call(obj) !== '[object Object]'
|| obj.nodeType
|| obj.setInterval
) {
return false
}
var hasOwn = {}.hasOwnProperty;
var hasOwnConstructor = hasOwn.call(obj, 'co... | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"obj",
"||",
"{",
"}",
".",
"toString",
".",
"call",
"(",
"obj",
")",
"!==",
"'[object Object]'",
"||",
"obj",
".",
"nodeType",
"||",
"obj",
".",
"setInterval",
")",
"{",
"return",
"false",
"}",
"va... | Check if object before merging. | [
"Check",
"if",
"object",
"before",
"merging",
"."
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/lib/merge/src/main.js#L307-L333 | train | |
kevinoid/promise-nodeify | index.js | doCallback | function doCallback(callback, reason, value) {
// Note: Could delay callback call until later, as When.js does, but this
// loses the stack (particularly for bluebird long traces) and causes
// unnecessary delay in the non-exception (common) case.
try {
// Match argument length to resolve/reject in case ca... | javascript | function doCallback(callback, reason, value) {
// Note: Could delay callback call until later, as When.js does, but this
// loses the stack (particularly for bluebird long traces) and causes
// unnecessary delay in the non-exception (common) case.
try {
// Match argument length to resolve/reject in case ca... | [
"function",
"doCallback",
"(",
"callback",
",",
"reason",
",",
"value",
")",
"{",
"// Note: Could delay callback call until later, as When.js does, but this",
"// loses the stack (particularly for bluebird long traces) and causes",
"// unnecessary delay in the non-exception (common) case.",... | Invokes callback and ensures any exceptions thrown are uncaught.
@private | [
"Invokes",
"callback",
"and",
"ensures",
"any",
"exceptions",
"thrown",
"are",
"uncaught",
"."
] | 1542cb7824c1b5e0e19e925dfb9650bfe8c7cdbd | https://github.com/kevinoid/promise-nodeify/blob/1542cb7824c1b5e0e19e925dfb9650bfe8c7cdbd/index.js#L20-L37 | train |
kevinoid/promise-nodeify | index.js | promiseNodeify | function promiseNodeify(promise, callback) {
if (typeof callback !== 'function') {
return promise;
}
function onRejected(reason) {
// callback is unlikely to recognize or expect a falsey error.
// (we also rely on truthyness for arguments.length in doCallback)
// Convert it to something truthy
... | javascript | function promiseNodeify(promise, callback) {
if (typeof callback !== 'function') {
return promise;
}
function onRejected(reason) {
// callback is unlikely to recognize or expect a falsey error.
// (we also rely on truthyness for arguments.length in doCallback)
// Convert it to something truthy
... | [
"function",
"promiseNodeify",
"(",
"promise",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"callback",
"!==",
"'function'",
")",
"{",
"return",
"promise",
";",
"}",
"function",
"onRejected",
"(",
"reason",
")",
"{",
"// callback is unlikely to recognize or expe... | Calls a node-style callback when a Promise is resolved or rejected.
This function provides the behavior of
{@link https://github.com/then/nodeify then <code>nodeify</code>},
{@link
https://github.com/cujojs/when/blob/master/docs/api.md#nodebindcallback
when.js <code>node.bindCallback</code>},
or {@link http://bluebird... | [
"Calls",
"a",
"node",
"-",
"style",
"callback",
"when",
"a",
"Promise",
"is",
"resolved",
"or",
"rejected",
"."
] | 1542cb7824c1b5e0e19e925dfb9650bfe8c7cdbd | https://github.com/kevinoid/promise-nodeify/blob/1542cb7824c1b5e0e19e925dfb9650bfe8c7cdbd/index.js#L63-L90 | train |
Gi60s/binary-case | index.js | getBinaryCase | function getBinaryCase (str, val) {
let res = '';
for (let i = 0; i < str.length; i++) {
const code = str.charCodeAt(i);
if (code >= 65 && code <= 90) {
res += val & 1 ? String.fromCharCode(code + 32) : String.fromCharCode(code);
val >>>= 1;
} else if (code >= 9... | javascript | function getBinaryCase (str, val) {
let res = '';
for (let i = 0; i < str.length; i++) {
const code = str.charCodeAt(i);
if (code >= 65 && code <= 90) {
res += val & 1 ? String.fromCharCode(code + 32) : String.fromCharCode(code);
val >>>= 1;
} else if (code >= 9... | [
"function",
"getBinaryCase",
"(",
"str",
",",
"val",
")",
"{",
"let",
"res",
"=",
"''",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
";",
"i",
"++",
")",
"{",
"const",
"code",
"=",
"str",
".",
"charCodeAt",
"(",
... | A performance improved method for acquiring the binary case, provided by Blake Embrey with very minor modification by James Speirs.
@author Blake Embrey | https://github.com/blakeembrey
@author James Speirs | https://github.com/gi60s
@param {string} str
@param {number} val
@returns {string} | [
"A",
"performance",
"improved",
"method",
"for",
"acquiring",
"the",
"binary",
"case",
"provided",
"by",
"Blake",
"Embrey",
"with",
"very",
"minor",
"modification",
"by",
"James",
"Speirs",
"."
] | a53af5c542b936d6c1329895dd9b93556024d132 | https://github.com/Gi60s/binary-case/blob/a53af5c542b936d6c1329895dd9b93556024d132/index.js#L86-L108 | train |
feedhenry/fh-mbaas-express | lib/mbaas.js | resolvePermission | function resolvePermission(params) {
var dbPermissions = mBaaS.permission_map.db;
if (params.act && dbPermissions && dbPermissions[params.act]) {
params.requestedPermission = dbPermissions[params.act].requires;
}
} | javascript | function resolvePermission(params) {
var dbPermissions = mBaaS.permission_map.db;
if (params.act && dbPermissions && dbPermissions[params.act]) {
params.requestedPermission = dbPermissions[params.act].requires;
}
} | [
"function",
"resolvePermission",
"(",
"params",
")",
"{",
"var",
"dbPermissions",
"=",
"mBaaS",
".",
"permission_map",
".",
"db",
";",
"if",
"(",
"params",
".",
"act",
"&&",
"dbPermissions",
"&&",
"dbPermissions",
"[",
"params",
".",
"act",
"]",
")",
"{",
... | DB actions are bound to specific permissions. For example the `list` action
requires only read permissions while `update` requires write. Those permissions
are configured in the `permission-map` of fh-db. If the given action has a
permission set we will add that to the params, otherwise we ignore it.
@param params Req... | [
"DB",
"actions",
"are",
"bound",
"to",
"specific",
"permissions",
".",
"For",
"example",
"the",
"list",
"action",
"requires",
"only",
"read",
"permissions",
"while",
"update",
"requires",
"write",
".",
"Those",
"permissions",
"are",
"configured",
"in",
"the",
... | 381c2a5842b49a4cbc4519d55b9a3c870b364d3c | https://github.com/feedhenry/fh-mbaas-express/blob/381c2a5842b49a4cbc4519d55b9a3c870b364d3c/lib/mbaas.js#L39-L44 | train |
passabilities/backrest | lib/routing/buildRoutes.js | getFilterMethods | function getFilterMethods(type, controller, action) {
// Get all filters for the action.
let filters = getFilters(type, controller, action)
// Get filter method names to be skipped.
type = `skip${type[0].toUpperCase() + type.slice(1)}`
let skipFilterMethods = _.map(getFilters(type, controller, action), 'actio... | javascript | function getFilterMethods(type, controller, action) {
// Get all filters for the action.
let filters = getFilters(type, controller, action)
// Get filter method names to be skipped.
type = `skip${type[0].toUpperCase() + type.slice(1)}`
let skipFilterMethods = _.map(getFilters(type, controller, action), 'actio... | [
"function",
"getFilterMethods",
"(",
"type",
",",
"controller",
",",
"action",
")",
"{",
"// Get all filters for the action.",
"let",
"filters",
"=",
"getFilters",
"(",
"type",
",",
"controller",
",",
"action",
")",
"// Get filter method names to be skipped.",
"type",
... | Get list of filter methods to be applied to a specific action. | [
"Get",
"list",
"of",
"filter",
"methods",
"to",
"be",
"applied",
"to",
"a",
"specific",
"action",
"."
] | d44d417f199c4199a0f440b5c56ced19248de27a | https://github.com/passabilities/backrest/blob/d44d417f199c4199a0f440b5c56ced19248de27a/lib/routing/buildRoutes.js#L153-L174 | train |
passabilities/backrest | lib/routing/buildRoutes.js | getFilters | function getFilters(type, controller, action) {
// User can set 'only' and 'except' rules on filters to be used on one
// or many action methods.
let useOptions = { only: true, except: false }
// Only return action filter methods that apply.
return _.filter(controller[`__${type}Filters`], filter => {
// ... | javascript | function getFilters(type, controller, action) {
// User can set 'only' and 'except' rules on filters to be used on one
// or many action methods.
let useOptions = { only: true, except: false }
// Only return action filter methods that apply.
return _.filter(controller[`__${type}Filters`], filter => {
// ... | [
"function",
"getFilters",
"(",
"type",
",",
"controller",
",",
"action",
")",
"{",
"// User can set 'only' and 'except' rules on filters to be used on one",
"// or many action methods.",
"let",
"useOptions",
"=",
"{",
"only",
":",
"true",
",",
"except",
":",
"false",
"}... | Get list of filters based on the type name to be applied to a specific action. | [
"Get",
"list",
"of",
"filters",
"based",
"on",
"the",
"type",
"name",
"to",
"be",
"applied",
"to",
"a",
"specific",
"action",
"."
] | d44d417f199c4199a0f440b5c56ced19248de27a | https://github.com/passabilities/backrest/blob/d44d417f199c4199a0f440b5c56ced19248de27a/lib/routing/buildRoutes.js#L177-L207 | train |
tunnckoCoreLabs/charlike | src/index.js | charlike | async function charlike(settings = {}) {
const proj = settings.project;
if (!proj || (proj && typeof proj !== 'object')) {
throw new TypeError('expect `settings.project` to be an object');
}
const options = await makeDefaults(settings);
const { project, templates } = options;
const cfgDir = path.join... | javascript | async function charlike(settings = {}) {
const proj = settings.project;
if (!proj || (proj && typeof proj !== 'object')) {
throw new TypeError('expect `settings.project` to be an object');
}
const options = await makeDefaults(settings);
const { project, templates } = options;
const cfgDir = path.join... | [
"async",
"function",
"charlike",
"(",
"settings",
"=",
"{",
"}",
")",
"{",
"const",
"proj",
"=",
"settings",
".",
"project",
";",
"if",
"(",
"!",
"proj",
"||",
"(",
"proj",
"&&",
"typeof",
"proj",
"!==",
"'object'",
")",
")",
"{",
"throw",
"new",
"... | Generates a complete project using a set of templates.
You can define what _"templates"_ files to be used
by passing `settings.templates`, by default it uses [./templates](./templates)
folder from this repository root.
You can define project metadata in `settings.project` object, which should contain
`name`, `descrip... | [
"Generates",
"a",
"complete",
"project",
"using",
"a",
"set",
"of",
"templates",
"."
] | a1278ff083b76f9e14f14ca25e6b5a467c9e20fa | https://github.com/tunnckoCoreLabs/charlike/blob/a1278ff083b76f9e14f14ca25e6b5a467c9e20fa/src/index.js#L62-L139 | train |
Rhinostone/gina | core/router.js | function(request, params, route) {
var uRe = params.url.split(/\//)
, uRo = route.split(/\//)
, maxLen = uRo.length
, score = 0
, r = {}
, i = 0;
//attaching routing description for this request
req... | javascript | function(request, params, route) {
var uRe = params.url.split(/\//)
, uRo = route.split(/\//)
, maxLen = uRo.length
, score = 0
, r = {}
, i = 0;
//attaching routing description for this request
req... | [
"function",
"(",
"request",
",",
"params",
",",
"route",
")",
"{",
"var",
"uRe",
"=",
"params",
".",
"url",
".",
"split",
"(",
"/",
"\\/",
"/",
")",
",",
"uRo",
"=",
"route",
".",
"split",
"(",
"/",
"\\/",
"/",
")",
",",
"maxLen",
"=",
"uRo",
... | Parse routing for mathcing url
@param {object} request
@param {object} params
@param {string} route
@return | [
"Parse",
"routing",
"for",
"mathcing",
"url"
] | c6ba13d3255a43734c54880ff12d3a50df53ebea | https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/router.js#L113-L138 | train | |
cshum/ginga | index.js | wrapFn | function wrapFn (gen) {
if (!is.function(gen)) throw new Error('Middleware must be a function')
if (!is.generator(gen)) return gen
// wrap generator with raco
var fn = raco.wrap(gen)
return function (ctx, next) {
fn.call(this, ctx, next)
}
} | javascript | function wrapFn (gen) {
if (!is.function(gen)) throw new Error('Middleware must be a function')
if (!is.generator(gen)) return gen
// wrap generator with raco
var fn = raco.wrap(gen)
return function (ctx, next) {
fn.call(this, ctx, next)
}
} | [
"function",
"wrapFn",
"(",
"gen",
")",
"{",
"if",
"(",
"!",
"is",
".",
"function",
"(",
"gen",
")",
")",
"throw",
"new",
"Error",
"(",
"'Middleware must be a function'",
")",
"if",
"(",
"!",
"is",
".",
"generator",
"(",
"gen",
")",
")",
"return",
"ge... | wrap ginga middleware function | [
"wrap",
"ginga",
"middleware",
"function"
] | 6169297b1864d3779f4f09884fd9979a59052fb5 | https://github.com/cshum/ginga/blob/6169297b1864d3779f4f09884fd9979a59052fb5/index.js#L8-L17 | train |
cshum/ginga | index.js | use | function use () {
// init hooks
if (!this.hasOwnProperty('_hooks')) {
this._hooks = {}
}
var args = Array.prototype.slice.call(arguments)
var i, j, l, m
var name = null
if (is.array(args[0])) {
// use(['a','b','c'], ...)
var arr = args.shift()
for (i = 0, l = arr.length; i < l; i++) {
... | javascript | function use () {
// init hooks
if (!this.hasOwnProperty('_hooks')) {
this._hooks = {}
}
var args = Array.prototype.slice.call(arguments)
var i, j, l, m
var name = null
if (is.array(args[0])) {
// use(['a','b','c'], ...)
var arr = args.shift()
for (i = 0, l = arr.length; i < l; i++) {
... | [
"function",
"use",
"(",
")",
"{",
"// init hooks",
"if",
"(",
"!",
"this",
".",
"hasOwnProperty",
"(",
"'_hooks'",
")",
")",
"{",
"this",
".",
"_hooks",
"=",
"{",
"}",
"}",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"... | ginga use method | [
"ginga",
"use",
"method"
] | 6169297b1864d3779f4f09884fd9979a59052fb5 | https://github.com/cshum/ginga/blob/6169297b1864d3779f4f09884fd9979a59052fb5/index.js#L20-L66 | train |
cshum/ginga | index.js | define | function define () {
var args = Array.prototype.slice.call(arguments)
var i, l
var name = args.shift()
if (is.array(name)) {
name = args.shift()
for (i = 0, l = name.length; i < l; i++) {
define.apply(this, [name[i]].concat(args))
}
return this
}
if (!is.string(name)) throw new Error... | javascript | function define () {
var args = Array.prototype.slice.call(arguments)
var i, l
var name = args.shift()
if (is.array(name)) {
name = args.shift()
for (i = 0, l = name.length; i < l; i++) {
define.apply(this, [name[i]].concat(args))
}
return this
}
if (!is.string(name)) throw new Error... | [
"function",
"define",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
"var",
"i",
",",
"l",
"var",
"name",
"=",
"args",
".",
"shift",
"(",
")",
"if",
"(",
"is",
".",
"array",
"(",
... | ginga define method | [
"ginga",
"define",
"method"
] | 6169297b1864d3779f4f09884fd9979a59052fb5 | https://github.com/cshum/ginga/blob/6169297b1864d3779f4f09884fd9979a59052fb5/index.js#L69-L159 | train |
Jack12816/greppy | lib/app/worker.js | function(callback) {
self.configureDatabases(function(err) {
if (err) {
process.exit(111);
return;
}
self.configureApplicationStack(
app, server, callback
... | javascript | function(callback) {
self.configureDatabases(function(err) {
if (err) {
process.exit(111);
return;
}
self.configureApplicationStack(
app, server, callback
... | [
"function",
"(",
"callback",
")",
"{",
"self",
".",
"configureDatabases",
"(",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"process",
".",
"exit",
"(",
"111",
")",
";",
"return",
";",
"}",
"self",
".",
"configureApplicationStack",
"("... | Configure database connections | [
"Configure",
"database",
"connections"
] | ede2157b90c207896781cc41fb9ea115e83951dd | https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/app/worker.js#L454-L466 | train | |
Kronos-Integration/kronos-interceptor-object-data-processor-row | lib/recordCheck/data-check-common.js | function (fieldDefinition, fieldName) {
const severity = propertyHelper.getSeverity(fieldDefinition, undefined, 'mandatory');
const isMandatoy = propertyHelper.getProperty(fieldDefinition, undefined, 'mandatory');
// const severity = fieldDefinition.severity;
// const isMandatoy = fieldDefinition.mandatory;
... | javascript | function (fieldDefinition, fieldName) {
const severity = propertyHelper.getSeverity(fieldDefinition, undefined, 'mandatory');
const isMandatoy = propertyHelper.getProperty(fieldDefinition, undefined, 'mandatory');
// const severity = fieldDefinition.severity;
// const isMandatoy = fieldDefinition.mandatory;
... | [
"function",
"(",
"fieldDefinition",
",",
"fieldName",
")",
"{",
"const",
"severity",
"=",
"propertyHelper",
".",
"getSeverity",
"(",
"fieldDefinition",
",",
"undefined",
",",
"'mandatory'",
")",
";",
"const",
"isMandatoy",
"=",
"propertyHelper",
".",
"getProperty"... | Creates the checks which are common to each file type
@param fieldDefinition The field_definition for this field.
@param fieldName The name of the current field | [
"Creates",
"the",
"checks",
"which",
"are",
"common",
"to",
"each",
"file",
"type"
] | 678a59b84dab4a9082377c90849a0d62d97a1ea4 | https://github.com/Kronos-Integration/kronos-interceptor-object-data-processor-row/blob/678a59b84dab4a9082377c90849a0d62d97a1ea4/lib/recordCheck/data-check-common.js#L14-L41 | train | |
vimlet/vimlet-commons | docs/release/framework/vcomet/vcomet.js | function (evt) {
//Using currentTarget instead of target for Firefox 2.0's sake. Not
//all old browsers will be supported, but this one was easy enough
//to support and still makes sense.
if (
evt.type === "load" ||
readyRegExp.test((evt.currentTarget || e... | javascript | function (evt) {
//Using currentTarget instead of target for Firefox 2.0's sake. Not
//all old browsers will be supported, but this one was easy enough
//to support and still makes sense.
if (
evt.type === "load" ||
readyRegExp.test((evt.currentTarget || e... | [
"function",
"(",
"evt",
")",
"{",
"//Using currentTarget instead of target for Firefox 2.0's sake. Not",
"//all old browsers will be supported, but this one was easy enough",
"//to support and still makes sense.",
"if",
"(",
"evt",
".",
"type",
"===",
"\"load\"",
"||",
"readyRegExp",... | callback for script loads, used to check status of loading.
@param {Event} evt the event from the browser for the script
that was loaded. | [
"callback",
"for",
"script",
"loads",
"used",
"to",
"check",
"status",
"of",
"loading",
"."
] | c2d06dd64637e6729872ef82b40e99b7155b0dea | https://github.com/vimlet/vimlet-commons/blob/c2d06dd64637e6729872ef82b40e99b7155b0dea/docs/release/framework/vcomet/vcomet.js#L2073-L2089 | train | |
vimlet/vimlet-commons | docs/release/framework/vcomet/vcomet.js | function (attrName, oldVal, newVal) {
var property = vcomet.util.hyphenToCamelCase(attrName);
// The onAttributeChanged callback is triggered whether its observed or as a reflection of a property
if (el.__observeAttributes[attrName] || el.__reflectProperties[property]) {
... | javascript | function (attrName, oldVal, newVal) {
var property = vcomet.util.hyphenToCamelCase(attrName);
// The onAttributeChanged callback is triggered whether its observed or as a reflection of a property
if (el.__observeAttributes[attrName] || el.__reflectProperties[property]) {
... | [
"function",
"(",
"attrName",
",",
"oldVal",
",",
"newVal",
")",
"{",
"var",
"property",
"=",
"vcomet",
".",
"util",
".",
"hyphenToCamelCase",
"(",
"attrName",
")",
";",
"// The onAttributeChanged callback is triggered whether its observed or as a reflection of a property",
... | Callback to be triggered when the user calls to setAttribute | [
"Callback",
"to",
"be",
"triggered",
"when",
"the",
"user",
"calls",
"to",
"setAttribute"
] | c2d06dd64637e6729872ef82b40e99b7155b0dea | https://github.com/vimlet/vimlet-commons/blob/c2d06dd64637e6729872ef82b40e99b7155b0dea/docs/release/framework/vcomet/vcomet.js#L4582-L4597 | train | |
datacentricdesign/dcd-model | services/ThingService.js | createAccessPolicy | function createAccessPolicy(thingId) {
const thingPolicy = {
id: thingId + "-" + thingId + "-cru-policy",
effect: "allow",
actions: ["dcd:actions:create", "dcd:actions:read", "dcd:actions:update"],
subjects: ["dcd:things:" + thingId],
resources: [
"dcd:things:" + thingId,
"dcd:things:"... | javascript | function createAccessPolicy(thingId) {
const thingPolicy = {
id: thingId + "-" + thingId + "-cru-policy",
effect: "allow",
actions: ["dcd:actions:create", "dcd:actions:read", "dcd:actions:update"],
subjects: ["dcd:things:" + thingId],
resources: [
"dcd:things:" + thingId,
"dcd:things:"... | [
"function",
"createAccessPolicy",
"(",
"thingId",
")",
"{",
"const",
"thingPolicy",
"=",
"{",
"id",
":",
"thingId",
"+",
"\"-\"",
"+",
"thingId",
"+",
"\"-cru-policy\"",
",",
"effect",
":",
"\"allow\"",
",",
"actions",
":",
"[",
"\"dcd:actions:create\"",
",",
... | Generate an access policy for a thing.
@param thingId
@returns {Promise<>} | [
"Generate",
"an",
"access",
"policy",
"for",
"a",
"thing",
"."
] | 162b724bc965439fcd894cf23101b2f00dd02924 | https://github.com/datacentricdesign/dcd-model/blob/162b724bc965439fcd894cf23101b2f00dd02924/services/ThingService.js#L161-L175 | train |
datacentricdesign/dcd-model | services/ThingService.js | createOwnerAccessPolicy | function createOwnerAccessPolicy(thingId, subject) {
const thingOwnerPolicy = {
id: thingId + "-" + subject + "-clrud-policy",
effect: "allow",
actions: [
"dcd:actions:create",
"dcd:actions:list",
"dcd:actions:read",
"dcd:actions:update",
"dcd:actions:delete"
],
subje... | javascript | function createOwnerAccessPolicy(thingId, subject) {
const thingOwnerPolicy = {
id: thingId + "-" + subject + "-clrud-policy",
effect: "allow",
actions: [
"dcd:actions:create",
"dcd:actions:list",
"dcd:actions:read",
"dcd:actions:update",
"dcd:actions:delete"
],
subje... | [
"function",
"createOwnerAccessPolicy",
"(",
"thingId",
",",
"subject",
")",
"{",
"const",
"thingOwnerPolicy",
"=",
"{",
"id",
":",
"thingId",
"+",
"\"-\"",
"+",
"subject",
"+",
"\"-clrud-policy\"",
",",
"effect",
":",
"\"allow\"",
",",
"actions",
":",
"[",
"... | Generate an access policy for the owner of a thing.
@param thingId
@param subject
@returns {Promise<>} | [
"Generate",
"an",
"access",
"policy",
"for",
"the",
"owner",
"of",
"a",
"thing",
"."
] | 162b724bc965439fcd894cf23101b2f00dd02924 | https://github.com/datacentricdesign/dcd-model/blob/162b724bc965439fcd894cf23101b2f00dd02924/services/ThingService.js#L183-L202 | train |
dowjones/distribucache | lib/decorators/PopulateInDecorator.js | PopulateInDecorator | function PopulateInDecorator(cache, config) {
BaseDecorator.call(this, cache, config, joi.object().keys({
populateIn: joi.number().integer().min(500).required(),
populateInAttempts: joi.number().integer().default(5),
pausePopulateIn: joi.number().integer().required(),
accessedAtThrottle: joi.number().... | javascript | function PopulateInDecorator(cache, config) {
BaseDecorator.call(this, cache, config, joi.object().keys({
populateIn: joi.number().integer().min(500).required(),
populateInAttempts: joi.number().integer().default(5),
pausePopulateIn: joi.number().integer().required(),
accessedAtThrottle: joi.number().... | [
"function",
"PopulateInDecorator",
"(",
"cache",
",",
"config",
")",
"{",
"BaseDecorator",
".",
"call",
"(",
"this",
",",
"cache",
",",
"config",
",",
"joi",
".",
"object",
"(",
")",
".",
"keys",
"(",
"{",
"populateIn",
":",
"joi",
".",
"number",
"(",
... | Auto-populating Redis-backed cache
@constructor
@param {Cache} cache
@param {Object} [config]
@param {String} [config.populateIn]
@param {String} [config.populateInAttempts]
@param {String} [config.pausePopulateIn]
@param {String} [config.accessedAtThrottle] | [
"Auto",
"-",
"populating",
"Redis",
"-",
"backed",
"cache"
] | ad79caee277771a6e49ee4a98c4983480cd89945 | https://github.com/dowjones/distribucache/blob/ad79caee277771a6e49ee4a98c4983480cd89945/lib/decorators/PopulateInDecorator.js#L22-L38 | train |
kalamuna/metalsmith-concat-convention | index.js | concatenateFile | function concatenateFile(file, done) {
// Append the concat file itself to the end of the concatenation.
files[file].files.push(file)
// Make sure the output is defined.
if (!Object.prototype.hasOwnProperty.call(files[file], 'output')) {
// Output the file to the destination, without th... | javascript | function concatenateFile(file, done) {
// Append the concat file itself to the end of the concatenation.
files[file].files.push(file)
// Make sure the output is defined.
if (!Object.prototype.hasOwnProperty.call(files[file], 'output')) {
// Output the file to the destination, without th... | [
"function",
"concatenateFile",
"(",
"file",
",",
"done",
")",
"{",
"// Append the concat file itself to the end of the concatenation.",
"files",
"[",
"file",
"]",
".",
"files",
".",
"push",
"(",
"file",
")",
"// Make sure the output is defined.",
"if",
"(",
"!",
"Obje... | Tell Metalsmith Concatenate to process on the given file config. | [
"Tell",
"Metalsmith",
"Concatenate",
"to",
"process",
"on",
"the",
"given",
"file",
"config",
"."
] | 631950f41b06423494ebf657635856ada5460615 | https://github.com/kalamuna/metalsmith-concat-convention/blob/631950f41b06423494ebf657635856ada5460615/index.js#L29-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.