id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9,500 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | stopDetect | function stopDetect() {
// clone current data to the store as the previous gesture
// used for the double tap gesture, since this is an other gesture detect session
this.previous = ionic.Gestures.utils.extend({}, this.current);
// reset the current
this.current = null;
// stopped!
... | javascript | function stopDetect() {
// clone current data to the store as the previous gesture
// used for the double tap gesture, since this is an other gesture detect session
this.previous = ionic.Gestures.utils.extend({}, this.current);
// reset the current
this.current = null;
// stopped!
... | [
"function",
"stopDetect",
"(",
")",
"{",
"// clone current data to the store as the previous gesture",
"// used for the double tap gesture, since this is an other gesture detect session",
"this",
".",
"previous",
"=",
"ionic",
".",
"Gestures",
".",
"utils",
".",
"extend",
"(",
... | clear the ionic.Gestures.gesture vars
this is called on endDetect, but can also be used when a final ionic.Gestures.gesture has been detected
to stop other ionic.Gestures.gestures from being fired | [
"clear",
"the",
"ionic",
".",
"Gestures",
".",
"gesture",
"vars",
"this",
"is",
"called",
"on",
"endDetect",
"but",
"can",
"also",
"be",
"used",
"when",
"a",
"final",
"ionic",
".",
"Gestures",
".",
"gesture",
"has",
"been",
"detected",
"to",
"stop",
"oth... | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L1402-L1412 |
9,501 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | extendEventData | function extendEventData(ev) {
var startEv = this.current.startEvent;
// if the touches change, set the new touches over the startEvent touches
// this because touchevents don't have all the touches on touchstart, or the
// user must place his fingers at the EXACT same time on the screen, which... | javascript | function extendEventData(ev) {
var startEv = this.current.startEvent;
// if the touches change, set the new touches over the startEvent touches
// this because touchevents don't have all the touches on touchstart, or the
// user must place his fingers at the EXACT same time on the screen, which... | [
"function",
"extendEventData",
"(",
"ev",
")",
"{",
"var",
"startEv",
"=",
"this",
".",
"current",
".",
"startEvent",
";",
"// if the touches change, set the new touches over the startEvent touches",
"// this because touchevents don't have all the touches on touchstart, or the",
"/... | extend eventData for ionic.Gestures.gestures
@param {Object} ev
@returns {Object} ev | [
"extend",
"eventData",
"for",
"ionic",
".",
"Gestures",
".",
"gestures"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L1420-L1460 |
9,502 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | function(obj) {
var args = Array.prototype.slice.call(arguments, 1);
for (var i = 0; i < args.length; i++) {
var source = args[i];
if (source) {
for (var prop in source) {
obj[prop] = source[prop];
}
}
}
return obj;
} | javascript | function(obj) {
var args = Array.prototype.slice.call(arguments, 1);
for (var i = 0; i < args.length; i++) {
var source = args[i];
if (source) {
for (var prop in source) {
obj[prop] = source[prop];
}
}
}
return obj;
} | [
"function",
"(",
"obj",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"args",
".",
"length",
";",
"i",
"++",
")",
"{"... | Extend adapted from Underscore.js | [
"Extend",
"adapted",
"from",
"Underscore",
".",
"js"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L3314-L3325 | |
9,503 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | function() {
var index = uid.length;
var digit;
while (index) {
index--;
digit = uid[index].charCodeAt(0);
if (digit == 57 /*'9'*/) {
uid[index] = 'A';
return uid.join('');
}
if (digit == 90 /*'Z'*/) {
uid[index] = '0';
} ... | javascript | function() {
var index = uid.length;
var digit;
while (index) {
index--;
digit = uid[index].charCodeAt(0);
if (digit == 57 /*'9'*/) {
uid[index] = 'A';
return uid.join('');
}
if (digit == 90 /*'Z'*/) {
uid[index] = '0';
} ... | [
"function",
"(",
")",
"{",
"var",
"index",
"=",
"uid",
".",
"length",
";",
"var",
"digit",
";",
"while",
"(",
"index",
")",
"{",
"index",
"--",
";",
"digit",
"=",
"uid",
"[",
"index",
"]",
".",
"charCodeAt",
"(",
"0",
")",
";",
"if",
"(",
"digi... | A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric
characters such as '012ABC'. The reason why we are not using simply a number counter is that
the number string gets longer over time, and it can also overflow, where as the nextId
will grow much slower, it is a string, and it will... | [
"A",
"consistent",
"way",
"of",
"creating",
"unique",
"IDs",
"in",
"angular",
".",
"The",
"ID",
"is",
"a",
"sequence",
"of",
"alpha",
"numeric",
"characters",
"such",
"as",
"012ABC",
".",
"The",
"reason",
"why",
"we",
"are",
"not",
"using",
"simply",
"a"... | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L3335-L3355 | |
9,504 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | function(stepCallback, verifyCallback, completedCallback, duration, easingMethod, root) {
var start = time();
var lastFrame = start;
var percent = 0;
var dropCounter = 0;
var id = counter++;
if (!root) {
root = document.body;
}
// Compacting running db automati... | javascript | function(stepCallback, verifyCallback, completedCallback, duration, easingMethod, root) {
var start = time();
var lastFrame = start;
var percent = 0;
var dropCounter = 0;
var id = counter++;
if (!root) {
root = document.body;
}
// Compacting running db automati... | [
"function",
"(",
"stepCallback",
",",
"verifyCallback",
",",
"completedCallback",
",",
"duration",
",",
"easingMethod",
",",
"root",
")",
"{",
"var",
"start",
"=",
"time",
"(",
")",
";",
"var",
"lastFrame",
"=",
"start",
";",
"var",
"percent",
"=",
"0",
... | Start the animation.
@param stepCallback {Function} Pointer to function which is executed on every step.
Signature of the method should be `function(percent, now, virtual) { return continueWithAnimation; }`
@param verifyCallback {Function} Executed before every animation step.
Signature of the method should be `functi... | [
"Start",
"the",
"animation",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L4082-L4160 | |
9,505 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | function() {
// Use publish instead of scrollTo to allow scrolling to out of boundary position
// We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled
this.__publish(this.__scrollLeft, -this.__refreshHeight, this.__zoomLevel, true);
var... | javascript | function() {
// Use publish instead of scrollTo to allow scrolling to out of boundary position
// We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled
this.__publish(this.__scrollLeft, -this.__refreshHeight, this.__zoomLevel, true);
var... | [
"function",
"(",
")",
"{",
"// Use publish instead of scrollTo to allow scrolling to out of boundary position",
"// We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled",
"this",
".",
"__publish",
"(",
"this",
".",
"__scrollL... | Starts pull-to-refresh manually. | [
"Starts",
"pull",
"-",
"to",
"-",
"refresh",
"manually",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L5287-L5298 | |
9,506 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | function(level, animate, originLeft, originTop) {
var self = this;
if (!self.options.zooming) {
throw new Error("Zooming is not enabled!");
}
// Stop deceleration
if (self.__isDecelerating) {
zyngaCore.effect.Animate.stop(self.__isDecelerating);
self.__isDecelerating = false;
... | javascript | function(level, animate, originLeft, originTop) {
var self = this;
if (!self.options.zooming) {
throw new Error("Zooming is not enabled!");
}
// Stop deceleration
if (self.__isDecelerating) {
zyngaCore.effect.Animate.stop(self.__isDecelerating);
self.__isDecelerating = false;
... | [
"function",
"(",
"level",
",",
"animate",
",",
"originLeft",
",",
"originTop",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"self",
".",
"options",
".",
"zooming",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Zooming is not enabled!\"",
")",
... | Zooms to the given level. Supports optional animation. Zooms
the center when no coordinates are given.
@param level {Number} Level to zoom to
@param animate {Boolean} Whether to use animation
@param originLeft {Number} Zoom in at given left coordinate
@param originTop {Number} Zoom in at given top coordinate | [
"Zooms",
"to",
"the",
"given",
"level",
".",
"Supports",
"optional",
"animation",
".",
"Zooms",
"the",
"center",
"when",
"no",
"coordinates",
"are",
"given",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L5367-L5418 | |
9,507 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | function(left, top, animate, zoom, wasResize) {
var self = this;
// Stop deceleration
if (self.__isDecelerating) {
zyngaCore.effect.Animate.stop(self.__isDecelerating);
self.__isDecelerating = false;
}
// Correct coordinates based on new zoom level
if (zoom != null && zoom !== self... | javascript | function(left, top, animate, zoom, wasResize) {
var self = this;
// Stop deceleration
if (self.__isDecelerating) {
zyngaCore.effect.Animate.stop(self.__isDecelerating);
self.__isDecelerating = false;
}
// Correct coordinates based on new zoom level
if (zoom != null && zoom !== self... | [
"function",
"(",
"left",
",",
"top",
",",
"animate",
",",
"zoom",
",",
"wasResize",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Stop deceleration",
"if",
"(",
"self",
".",
"__isDecelerating",
")",
"{",
"zyngaCore",
".",
"effect",
".",
"Animate",
".",
... | Scrolls to the given position. Respect limitations and snapping automatically.
@param left {Number} Horizontal scroll position, keeps current if value is <code>null</code>
@param top {Number} Vertical scroll position, keeps current if value is <code>null</code>
@param animate {Boolean} Whether the scrolling should hap... | [
"Scrolls",
"to",
"the",
"given",
"position",
".",
"Respect",
"limitations",
"and",
"snapping",
"automatically",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L5442-L5512 | |
9,508 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | function() {
var self = this;
clearTimeout(self.__sizerTimeout);
var sizer = function() {
self.resize();
// if ((self.options.scrollingX && !self.__maxScrollLeft) || (self.options.scrollingY && !self.__maxScrollTop)) {
// //self.__sizerTimeout = setTimeout(sizer, 1000);
// }
... | javascript | function() {
var self = this;
clearTimeout(self.__sizerTimeout);
var sizer = function() {
self.resize();
// if ((self.options.scrollingX && !self.__maxScrollLeft) || (self.options.scrollingY && !self.__maxScrollTop)) {
// //self.__sizerTimeout = setTimeout(sizer, 1000);
// }
... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"clearTimeout",
"(",
"self",
".",
"__sizerTimeout",
")",
";",
"var",
"sizer",
"=",
"function",
"(",
")",
"{",
"self",
".",
"resize",
"(",
")",
";",
"// if ((self.options.scrollingX && !self.__maxScr... | If the scroll view isn't sized correctly on start, wait until we have at least some size | [
"If",
"the",
"scroll",
"view",
"isn",
"t",
"sized",
"correctly",
"on",
"start",
"wait",
"until",
"we",
"have",
"at",
"least",
"some",
"size"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L6071-L6086 | |
9,509 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | function(target) {
while (target) {
if (target.classList && target.classList.contains(ITEM_CLASS)) {
return target;
}
target = target.parentNode;
}
return null;
} | javascript | function(target) {
while (target) {
if (target.classList && target.classList.contains(ITEM_CLASS)) {
return target;
}
target = target.parentNode;
}
return null;
} | [
"function",
"(",
"target",
")",
"{",
"while",
"(",
"target",
")",
"{",
"if",
"(",
"target",
".",
"classList",
"&&",
"target",
".",
"classList",
".",
"contains",
"(",
"ITEM_CLASS",
")",
")",
"{",
"return",
"target",
";",
"}",
"target",
"=",
"target",
... | Return the list item from the given target | [
"Return",
"the",
"list",
"item",
"from",
"the",
"given",
"target"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L6832-L6840 | |
9,510 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | function(e) {
var _this = this, content, buttons;
if (Math.abs(e.gesture.deltaY) > 5) {
this._didDragUpOrDown = true;
}
// If we get a drag event, make sure we aren't in another drag, then check if we should
// start one
if (!this.isDragging && !this._dragOp) {
this... | javascript | function(e) {
var _this = this, content, buttons;
if (Math.abs(e.gesture.deltaY) > 5) {
this._didDragUpOrDown = true;
}
// If we get a drag event, make sure we aren't in another drag, then check if we should
// start one
if (!this.isDragging && !this._dragOp) {
this... | [
"function",
"(",
"e",
")",
"{",
"var",
"_this",
"=",
"this",
",",
"content",
",",
"buttons",
";",
"if",
"(",
"Math",
".",
"abs",
"(",
"e",
".",
"gesture",
".",
"deltaY",
")",
">",
"5",
")",
"{",
"this",
".",
"_didDragUpOrDown",
"=",
"true",
";",
... | Process the drag event to move the item to the left or right. | [
"Process",
"the",
"drag",
"event",
"to",
"move",
"the",
"item",
"to",
"the",
"left",
"or",
"right",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L6914-L6935 | |
9,511 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | shallowCopy | function shallowCopy(src, dst) {
if (isArray(src)) {
dst = dst || [];
for (var i = 0, ii = src.length; i < ii; i++) {
dst[i] = src[i];
}
} else if (isObject(src)) {
dst = dst || {};
for (var key in src) {
if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
dst[key] = s... | javascript | function shallowCopy(src, dst) {
if (isArray(src)) {
dst = dst || [];
for (var i = 0, ii = src.length; i < ii; i++) {
dst[i] = src[i];
}
} else if (isObject(src)) {
dst = dst || {};
for (var key in src) {
if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
dst[key] = s... | [
"function",
"shallowCopy",
"(",
"src",
",",
"dst",
")",
"{",
"if",
"(",
"isArray",
"(",
"src",
")",
")",
"{",
"dst",
"=",
"dst",
"||",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"ii",
"=",
"src",
".",
"length",
";",
"i",
"<",
"ii... | Creates a shallow copy of an object, an array or a primitive.
Assumes that there are no proto properties for objects. | [
"Creates",
"a",
"shallow",
"copy",
"of",
"an",
"object",
"an",
"array",
"or",
"a",
"primitive",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L8667-L8685 |
9,512 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | getter | function getter(obj, path, bindFnToScope) {
if (!path) return obj;
var keys = path.split('.');
var key;
var lastInstance = obj;
var len = keys.length;
for (var i = 0; i < len; i++) {
key = keys[i];
if (obj) {
obj = (lastInstance = obj)[key];
}
}
if (!bindFnToScope && isFunction(obj)) ... | javascript | function getter(obj, path, bindFnToScope) {
if (!path) return obj;
var keys = path.split('.');
var key;
var lastInstance = obj;
var len = keys.length;
for (var i = 0; i < len; i++) {
key = keys[i];
if (obj) {
obj = (lastInstance = obj)[key];
}
}
if (!bindFnToScope && isFunction(obj)) ... | [
"function",
"getter",
"(",
"obj",
",",
"path",
",",
"bindFnToScope",
")",
"{",
"if",
"(",
"!",
"path",
")",
"return",
"obj",
";",
"var",
"keys",
"=",
"path",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"key",
";",
"var",
"lastInstance",
"=",
"obj",
... | Return the value accessible from the object by path. Any undefined traversals are ignored
@param {Object} obj starting object
@param {String} path path to traverse
@param {boolean} [bindFnToScope=true]
@returns {Object} value as accessible by path
TODO(misko): this function needs to be removed | [
"Return",
"the",
"value",
"accessible",
"from",
"the",
"object",
"by",
"path",
".",
"Any",
"undefined",
"traversals",
"are",
"ignored"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L9423-L9440 |
9,513 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | HashMap | function HashMap(array, isolatedUid) {
if (isolatedUid) {
var uid = 0;
this.nextUid = function() {
return ++uid;
};
}
forEach(array, this.put, this);
} | javascript | function HashMap(array, isolatedUid) {
if (isolatedUid) {
var uid = 0;
this.nextUid = function() {
return ++uid;
};
}
forEach(array, this.put, this);
} | [
"function",
"HashMap",
"(",
"array",
",",
"isolatedUid",
")",
"{",
"if",
"(",
"isolatedUid",
")",
"{",
"var",
"uid",
"=",
"0",
";",
"this",
".",
"nextUid",
"=",
"function",
"(",
")",
"{",
"return",
"++",
"uid",
";",
"}",
";",
"}",
"forEach",
"(",
... | HashMap which can use objects as keys | [
"HashMap",
"which",
"can",
"use",
"objects",
"as",
"keys"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L11134-L11142 |
9,514 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | directiveIsMultiElement | function directiveIsMultiElement(name) {
if (hasDirectives.hasOwnProperty(name)) {
for (var directive, directives = $injector.get(name + Suffix),
i = 0, ii = directives.length; i < ii; i++) {
directive = directives[i];
if (directive.multiElement) {
return true;
... | javascript | function directiveIsMultiElement(name) {
if (hasDirectives.hasOwnProperty(name)) {
for (var directive, directives = $injector.get(name + Suffix),
i = 0, ii = directives.length; i < ii; i++) {
directive = directives[i];
if (directive.multiElement) {
return true;
... | [
"function",
"directiveIsMultiElement",
"(",
"name",
")",
"{",
"if",
"(",
"hasDirectives",
".",
"hasOwnProperty",
"(",
"name",
")",
")",
"{",
"for",
"(",
"var",
"directive",
",",
"directives",
"=",
"$injector",
".",
"get",
"(",
"name",
"+",
"Suffix",
")",
... | looks up the directive and returns true if it is a multi-element directive,
and therefore requires DOM nodes between -start and -end markers to be grouped
together.
@param {string} name name of the directive to look up.
@returns true if directive was registered as multi-element. | [
"looks",
"up",
"the",
"directive",
"and",
"returns",
"true",
"if",
"it",
"is",
"a",
"multi",
"-",
"element",
"directive",
"and",
"therefore",
"requires",
"DOM",
"nodes",
"between",
"-",
"start",
"and",
"-",
"end",
"markers",
"to",
"be",
"grouped",
"togethe... | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L15616-L15627 |
9,515 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | mergeTemplateAttributes | function mergeTemplateAttributes(dst, src) {
var srcAttr = src.$attr,
dstAttr = dst.$attr,
$element = dst.$$element;
// reapply the old attributes to the new element
forEach(dst, function(value, key) {
if (key.charAt(0) != '$') {
if (src[key] && src[key] !== valu... | javascript | function mergeTemplateAttributes(dst, src) {
var srcAttr = src.$attr,
dstAttr = dst.$attr,
$element = dst.$$element;
// reapply the old attributes to the new element
forEach(dst, function(value, key) {
if (key.charAt(0) != '$') {
if (src[key] && src[key] !== valu... | [
"function",
"mergeTemplateAttributes",
"(",
"dst",
",",
"src",
")",
"{",
"var",
"srcAttr",
"=",
"src",
".",
"$attr",
",",
"dstAttr",
"=",
"dst",
".",
"$attr",
",",
"$element",
"=",
"dst",
".",
"$$element",
";",
"// reapply the old attributes to the new element",... | When the element is replaced with HTML template then the new attributes
on the template need to be merged with the existing attributes in the DOM.
The desired effect is to have both of the attributes present.
@param {object} dst destination attributes (original DOM)
@param {object} src source attributes (from the dire... | [
"When",
"the",
"element",
"is",
"replaced",
"with",
"HTML",
"template",
"then",
"the",
"new",
"attributes",
"on",
"the",
"template",
"need",
"to",
"be",
"merged",
"with",
"the",
"existing",
"attributes",
"in",
"the",
"DOM",
".",
"The",
"desired",
"effect",
... | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L15637-L15668 |
9,516 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | byPriority | function byPriority(a, b) {
var diff = b.priority - a.priority;
if (diff !== 0) return diff;
if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;
return a.index - b.index;
} | javascript | function byPriority(a, b) {
var diff = b.priority - a.priority;
if (diff !== 0) return diff;
if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;
return a.index - b.index;
} | [
"function",
"byPriority",
"(",
"a",
",",
"b",
")",
"{",
"var",
"diff",
"=",
"b",
".",
"priority",
"-",
"a",
".",
"priority",
";",
"if",
"(",
"diff",
"!==",
"0",
")",
"return",
"diff",
";",
"if",
"(",
"a",
".",
"name",
"!==",
"b",
".",
"name",
... | Sorting function for bound directives. | [
"Sorting",
"function",
"for",
"bound",
"directives",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L15789-L15794 |
9,517 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | function(event) {
// IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
// it. In particular the event is not fired when backspace or delete key are pressed or
// when cut operation is performed.
// IE10+ implements 'input' event but it erroneously f... | javascript | function(event) {
// IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
// it. In particular the event is not fired when backspace or delete key are pressed or
// when cut operation is performed.
// IE10+ implements 'input' event but it erroneously f... | [
"function",
"(",
"event",
")",
"{",
"// IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have",
"// it. In particular the event is not fired when backspace or delete key are pressed or",
"// when cut operation is performed.",
"// IE10+ implements 'input' event but ... | jshint +W018 | [
"jshint",
"+",
"W018"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L23760-L23774 | |
9,518 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | urlIsSameOrigin | function urlIsSameOrigin(requestUrl) {
var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
return (parsed.protocol === originUrl.protocol &&
parsed.host === originUrl.host);
} | javascript | function urlIsSameOrigin(requestUrl) {
var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
return (parsed.protocol === originUrl.protocol &&
parsed.host === originUrl.host);
} | [
"function",
"urlIsSameOrigin",
"(",
"requestUrl",
")",
"{",
"var",
"parsed",
"=",
"(",
"isString",
"(",
"requestUrl",
")",
")",
"?",
"urlResolve",
"(",
"requestUrl",
")",
":",
"requestUrl",
";",
"return",
"(",
"parsed",
".",
"protocol",
"===",
"originUrl",
... | Parse a request URL and determine whether this is a same-origin request as the application document.
@param {string|object} requestUrl The url of the request as a string that will be resolved
or a parsed URL object.
@returns {boolean} Whether the request is for the same origin as the application document. | [
"Parse",
"a",
"request",
"URL",
"and",
"determine",
"whether",
"this",
"is",
"a",
"same",
"-",
"origin",
"request",
"as",
"the",
"application",
"document",
"."
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L24140-L24144 |
9,519 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | createPredicateFn | function createPredicateFn(expression, comparator, matchAgainstAnyProp) {
var predicateFn;
if (comparator === true) {
comparator = equals;
} else if (!isFunction(comparator)) {
comparator = function(actual, expected) {
if (isObject(actual) || isObject(expected)) {
// Prevent an object to be... | javascript | function createPredicateFn(expression, comparator, matchAgainstAnyProp) {
var predicateFn;
if (comparator === true) {
comparator = equals;
} else if (!isFunction(comparator)) {
comparator = function(actual, expected) {
if (isObject(actual) || isObject(expected)) {
// Prevent an object to be... | [
"function",
"createPredicateFn",
"(",
"expression",
",",
"comparator",
",",
"matchAgainstAnyProp",
")",
"{",
"var",
"predicateFn",
";",
"if",
"(",
"comparator",
"===",
"true",
")",
"{",
"comparator",
"=",
"equals",
";",
"}",
"else",
"if",
"(",
"!",
"isFuncti... | Helper functions for `filterFilter` | [
"Helper",
"functions",
"for",
"filterFilter"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L24483-L24506 |
9,520 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | regExpPrefix | function regExpPrefix(re) {
var prefix = /^\^((?:\\[^a-zA-Z0-9]|[^\\\[\]\^$*+?.()|{}]+)*)/.exec(re.source);
return (prefix != null) ? prefix[1].replace(/\\(.)/g, "$1") : '';
} | javascript | function regExpPrefix(re) {
var prefix = /^\^((?:\\[^a-zA-Z0-9]|[^\\\[\]\^$*+?.()|{}]+)*)/.exec(re.source);
return (prefix != null) ? prefix[1].replace(/\\(.)/g, "$1") : '';
} | [
"function",
"regExpPrefix",
"(",
"re",
")",
"{",
"var",
"prefix",
"=",
"/",
"^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)",
"/",
".",
"exec",
"(",
"re",
".",
"source",
")",
";",
"return",
"(",
"prefix",
"!=",
"null",
")",
"?",
"prefix",
"[",
"1",
... | Returns a string that is a prefix of all strings matching the RegExp | [
"Returns",
"a",
"string",
"that",
"is",
"a",
"prefix",
"of",
"all",
"strings",
"matching",
"the",
"RegExp"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L38394-L38397 |
9,521 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | function(scope, element, attr) {
attr.$observe(ngAttrName, function(value) {
if (!value) {
element[0].removeAttribute(attrName);
}
});
} | javascript | function(scope, element, attr) {
attr.$observe(ngAttrName, function(value) {
if (!value) {
element[0].removeAttribute(attrName);
}
});
} | [
"function",
"(",
"scope",
",",
"element",
",",
"attr",
")",
"{",
"attr",
".",
"$observe",
"(",
"ngAttrName",
",",
"function",
"(",
"value",
")",
"{",
"if",
"(",
"!",
"value",
")",
"{",
"element",
"[",
"0",
"]",
".",
"removeAttribute",
"(",
"attrName"... | it needs to run after the attributes are interpolated | [
"it",
"needs",
"to",
"run",
"after",
"the",
"attributes",
"are",
"interpolated"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L48701-L48707 | |
9,522 | ionic-team/ng-cordova | demo/www/lib/ionic/js/ionic.bundle.js | onContentTap | function onContentTap(gestureEvt) {
if (sideMenuCtrl.getOpenAmount() !== 0) {
sideMenuCtrl.close();
gestureEvt.gesture.srcEvent.preventDefault();
startCoord = null;
primaryScrollAxis = null;
} else if (!startCoord) {
startCoord = ionic.tap.... | javascript | function onContentTap(gestureEvt) {
if (sideMenuCtrl.getOpenAmount() !== 0) {
sideMenuCtrl.close();
gestureEvt.gesture.srcEvent.preventDefault();
startCoord = null;
primaryScrollAxis = null;
} else if (!startCoord) {
startCoord = ionic.tap.... | [
"function",
"onContentTap",
"(",
"gestureEvt",
")",
"{",
"if",
"(",
"sideMenuCtrl",
".",
"getOpenAmount",
"(",
")",
"!==",
"0",
")",
"{",
"sideMenuCtrl",
".",
"close",
"(",
")",
";",
"gestureEvt",
".",
"gesture",
".",
"srcEvent",
".",
"preventDefault",
"("... | Listen for taps on the content to close the menu | [
"Listen",
"for",
"taps",
"on",
"the",
"content",
"to",
"close",
"the",
"menu"
] | 2a401e063eda2889cd54abf17365c22286e32285 | https://github.com/ionic-team/ng-cordova/blob/2a401e063eda2889cd54abf17365c22286e32285/demo/www/lib/ionic/js/ionic.bundle.js#L51354-L51363 |
9,523 | twbs/bootlint | src/bootlint.js | sortedColumnClasses | function sortedColumnClasses(classes) {
// extract column classes
var colClasses = [];
while (true) {
var match = COL_REGEX.exec(classes);
if (!match) {
break;
}
var colClass = match[0];
colClasses.push(colClass);
... | javascript | function sortedColumnClasses(classes) {
// extract column classes
var colClasses = [];
while (true) {
var match = COL_REGEX.exec(classes);
if (!match) {
break;
}
var colClass = match[0];
colClasses.push(colClass);
... | [
"function",
"sortedColumnClasses",
"(",
"classes",
")",
"{",
"// extract column classes",
"var",
"colClasses",
"=",
"[",
"]",
";",
"while",
"(",
"true",
")",
"{",
"var",
"match",
"=",
"COL_REGEX",
".",
"exec",
"(",
"classes",
")",
";",
"if",
"(",
"!",
"m... | Moves any grid column classes to the end of the class string and sorts the grid classes by ascending screen size.
@param {string} classes The "class" attribute of a DOM node
@returns {string} The processed "class" attribute value | [
"Moves",
"any",
"grid",
"column",
"classes",
"to",
"the",
"end",
"of",
"the",
"class",
"string",
"and",
"sorts",
"the",
"grid",
"classes",
"by",
"ascending",
"screen",
"size",
"."
] | c3f24dcfd3f5f341cc34682c2e487ac3dab6ab78 | https://github.com/twbs/bootlint/blob/c3f24dcfd3f5f341cc34682c2e487ac3dab6ab78/src/bootlint.js#L107-L122 |
9,524 | twbs/bootlint | src/location.js | LocationIndex | function LocationIndex(string) {
// ensure newline termination
if (string[string.length - 1] !== '\n') {
string += '\n';
}
this._stringLength = string.length;
/*
* Each triple in _lineStartEndTriples consists of:
* [0], the 0-based line index of the ... | javascript | function LocationIndex(string) {
// ensure newline termination
if (string[string.length - 1] !== '\n') {
string += '\n';
}
this._stringLength = string.length;
/*
* Each triple in _lineStartEndTriples consists of:
* [0], the 0-based line index of the ... | [
"function",
"LocationIndex",
"(",
"string",
")",
"{",
"// ensure newline termination",
"if",
"(",
"string",
"[",
"string",
".",
"length",
"-",
"1",
"]",
"!==",
"'\\n'",
")",
"{",
"string",
"+=",
"'\\n'",
";",
"}",
"this",
".",
"_stringLength",
"=",
"string... | Maps code unit indices into the string to line numbers and column numbers.
@param {string} string String to construct the index for
@class | [
"Maps",
"code",
"unit",
"indices",
"into",
"the",
"string",
"to",
"line",
"numbers",
"and",
"column",
"numbers",
"."
] | c3f24dcfd3f5f341cc34682c2e487ac3dab6ab78 | https://github.com/twbs/bootlint/blob/c3f24dcfd3f5f341cc34682c2e487ac3dab6ab78/src/location.js#L23-L53 |
9,525 | wa0x6e/cal-heatmap | src/cal-heatmap.js | w | function w(d, outer) {
var width = self.options.cellSize*self._domainType[self.options.subDomain].column(d) + self.options.cellPadding*self._domainType[self.options.subDomain].column(d);
if (arguments.length === 2 && outer === true) {
return width += self.domainHorizontalLabelWidth + self.options.domainGutter + ... | javascript | function w(d, outer) {
var width = self.options.cellSize*self._domainType[self.options.subDomain].column(d) + self.options.cellPadding*self._domainType[self.options.subDomain].column(d);
if (arguments.length === 2 && outer === true) {
return width += self.domainHorizontalLabelWidth + self.options.domainGutter + ... | [
"function",
"w",
"(",
"d",
",",
"outer",
")",
"{",
"var",
"width",
"=",
"self",
".",
"options",
".",
"cellSize",
"*",
"self",
".",
"_domainType",
"[",
"self",
".",
"options",
".",
"subDomain",
"]",
".",
"column",
"(",
"d",
")",
"+",
"self",
".",
... | Return the width of the domain block, without the domain gutter @param int d Domain start timestamp | [
"Return",
"the",
"width",
"of",
"the",
"domain",
"block",
"without",
"the",
"domain",
"gutter"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L685-L691 |
9,526 | wa0x6e/cal-heatmap | src/cal-heatmap.js | h | function h(d, outer) {
var height = self.options.cellSize*self._domainType[self.options.subDomain].row(d) + self.options.cellPadding*self._domainType[self.options.subDomain].row(d);
if (arguments.length === 2 && outer === true) {
height += self.options.domainGutter + self.domainVerticalLabelHeight + self.options... | javascript | function h(d, outer) {
var height = self.options.cellSize*self._domainType[self.options.subDomain].row(d) + self.options.cellPadding*self._domainType[self.options.subDomain].row(d);
if (arguments.length === 2 && outer === true) {
height += self.options.domainGutter + self.domainVerticalLabelHeight + self.options... | [
"function",
"h",
"(",
"d",
",",
"outer",
")",
"{",
"var",
"height",
"=",
"self",
".",
"options",
".",
"cellSize",
"*",
"self",
".",
"_domainType",
"[",
"self",
".",
"options",
".",
"subDomain",
"]",
".",
"row",
"(",
"d",
")",
"+",
"self",
".",
"o... | Return the height of the domain block, without the domain gutter | [
"Return",
"the",
"height",
"of",
"the",
"domain",
"block",
"without",
"the",
"domain",
"gutter"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L694-L700 |
9,527 | wa0x6e/cal-heatmap | src/cal-heatmap.js | validateSelector | function validateSelector(selector, canBeFalse, name) {
if (((canBeFalse && selector === false) || selector instanceof Element || typeof selector === "string") && selector !== "") {
return true;
}
throw new Error("The " + name + " is not valid");
} | javascript | function validateSelector(selector, canBeFalse, name) {
if (((canBeFalse && selector === false) || selector instanceof Element || typeof selector === "string") && selector !== "") {
return true;
}
throw new Error("The " + name + " is not valid");
} | [
"function",
"validateSelector",
"(",
"selector",
",",
"canBeFalse",
",",
"name",
")",
"{",
"if",
"(",
"(",
"(",
"canBeFalse",
"&&",
"selector",
"===",
"false",
")",
"||",
"selector",
"instanceof",
"Element",
"||",
"typeof",
"selector",
"===",
"\"string\"",
"... | Validate that a queryString is valid
@param {Element|string|bool} selector The queryString to test
@param {bool} canBeFalse Whether false is an accepted and valid value
@param {string} name Name of the tested selector
@throws {Error} If the selector is not valid
@return {bool} True if the selector is a val... | [
"Validate",
"that",
"a",
"queryString",
"is",
"valid"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1171-L1176 |
9,528 | wa0x6e/cal-heatmap | src/cal-heatmap.js | validateDomainType | function validateDomainType() {
if (!parent._domainType.hasOwnProperty(options.domain) || options.domain === "min" || options.domain.substring(0, 2) === "x_") {
throw new Error("The domain '" + options.domain + "' is not valid");
}
if (!parent._domainType.hasOwnProperty(options.subDomain) || options.subDo... | javascript | function validateDomainType() {
if (!parent._domainType.hasOwnProperty(options.domain) || options.domain === "min" || options.domain.substring(0, 2) === "x_") {
throw new Error("The domain '" + options.domain + "' is not valid");
}
if (!parent._domainType.hasOwnProperty(options.subDomain) || options.subDo... | [
"function",
"validateDomainType",
"(",
")",
"{",
"if",
"(",
"!",
"parent",
".",
"_domainType",
".",
"hasOwnProperty",
"(",
"options",
".",
"domain",
")",
"||",
"options",
".",
"domain",
"===",
"\"min\"",
"||",
"options",
".",
"domain",
".",
"substring",
"(... | Ensure that the domain and subdomain are valid
@throw {Error} when domain or subdomain are not valid
@return {bool} True if domain and subdomain are valid and compatible | [
"Ensure",
"that",
"the",
"domain",
"and",
"subdomain",
"are",
"valid"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1205-L1219 |
9,529 | wa0x6e/cal-heatmap | src/cal-heatmap.js | autoAlignLabel | function autoAlignLabel() {
// Auto-align label, depending on it's position
if (!settings.hasOwnProperty("label") || (settings.hasOwnProperty("label") && !settings.label.hasOwnProperty("align"))) {
switch(options.label.position) {
case "left":
options.label.align = "right";
break;
case "righ... | javascript | function autoAlignLabel() {
// Auto-align label, depending on it's position
if (!settings.hasOwnProperty("label") || (settings.hasOwnProperty("label") && !settings.label.hasOwnProperty("align"))) {
switch(options.label.position) {
case "left":
options.label.align = "right";
break;
case "righ... | [
"function",
"autoAlignLabel",
"(",
")",
"{",
"// Auto-align label, depending on it's position",
"if",
"(",
"!",
"settings",
".",
"hasOwnProperty",
"(",
"\"label\"",
")",
"||",
"(",
"settings",
".",
"hasOwnProperty",
"(",
"\"label\"",
")",
"&&",
"!",
"settings",
".... | Fine-tune the label alignement depending on its position
@return void | [
"Fine",
"-",
"tune",
"the",
"label",
"alignement",
"depending",
"on",
"its",
"position"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1226-L1255 |
9,530 | wa0x6e/cal-heatmap | src/cal-heatmap.js | autoAddLegendMargin | function autoAddLegendMargin() {
switch(options.legendVerticalPosition) {
case "top":
options.legendMargin[2] = parent.DEFAULT_LEGEND_MARGIN;
break;
case "bottom":
options.legendMargin[0] = parent.DEFAULT_LEGEND_MARGIN;
break;
case "middle":
case "center":
options.legendMargin[options... | javascript | function autoAddLegendMargin() {
switch(options.legendVerticalPosition) {
case "top":
options.legendMargin[2] = parent.DEFAULT_LEGEND_MARGIN;
break;
case "bottom":
options.legendMargin[0] = parent.DEFAULT_LEGEND_MARGIN;
break;
case "middle":
case "center":
options.legendMargin[options... | [
"function",
"autoAddLegendMargin",
"(",
")",
"{",
"switch",
"(",
"options",
".",
"legendVerticalPosition",
")",
"{",
"case",
"\"top\"",
":",
"options",
".",
"legendMargin",
"[",
"2",
"]",
"=",
"parent",
".",
"DEFAULT_LEGEND_MARGIN",
";",
"break",
";",
"case",
... | If not specified, add some margin around the legend depending on its position
@return void | [
"If",
"not",
"specified",
"add",
"some",
"margin",
"around",
"the",
"legend",
"depending",
"on",
"its",
"position"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1262-L1274 |
9,531 | wa0x6e/cal-heatmap | src/cal-heatmap.js | expandMarginSetting | function expandMarginSetting(value) {
if (typeof value === "number") {
value = [value];
}
if (!Array.isArray(value)) {
console.log("Margin only takes an integer or an array of integers");
value = [0];
}
switch(value.length) {
case 1:
return [value[0], value[0], value[0], value[0]];
... | javascript | function expandMarginSetting(value) {
if (typeof value === "number") {
value = [value];
}
if (!Array.isArray(value)) {
console.log("Margin only takes an integer or an array of integers");
value = [0];
}
switch(value.length) {
case 1:
return [value[0], value[0], value[0], value[0]];
... | [
"function",
"expandMarginSetting",
"(",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"===",
"\"number\"",
")",
"{",
"value",
"=",
"[",
"value",
"]",
";",
"}",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"console",
".",
... | Expand a number of an array of numbers to an usable 4 values array
@param {integer|array} value
@return {array} array | [
"Expand",
"a",
"number",
"of",
"an",
"array",
"of",
"numbers",
"to",
"an",
"usable",
"4",
"values",
"array"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1282-L1304 |
9,532 | wa0x6e/cal-heatmap | src/cal-heatmap.js | addStyle | function addStyle(element) {
if (parent.legendScale === null) {
return false;
}
element.attr("fill", function(d) {
if (d.v === null && (options.hasOwnProperty("considerMissingDataAsZero") && !options.considerMissingDataAsZero)) {
if (options.legendColors.hasOwnProperty("base")) {
return opt... | javascript | function addStyle(element) {
if (parent.legendScale === null) {
return false;
}
element.attr("fill", function(d) {
if (d.v === null && (options.hasOwnProperty("considerMissingDataAsZero") && !options.considerMissingDataAsZero)) {
if (options.legendColors.hasOwnProperty("base")) {
return opt... | [
"function",
"addStyle",
"(",
"element",
")",
"{",
"if",
"(",
"parent",
".",
"legendScale",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"element",
".",
"attr",
"(",
"\"fill\"",
",",
"function",
"(",
"d",
")",
"{",
"if",
"(",
"d",
".",
"v",... | Colorize the cell via a style attribute if enabled | [
"Colorize",
"the",
"cell",
"via",
"a",
"style",
"attribute",
"if",
"enabled"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1395-L1419 |
9,533 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(start) {
"use strict";
var parent = this;
return this.triggerEvent("afterLoadPreviousDomain", function() {
var subDomain = parent.getSubDomain(start);
return [subDomain.shift(), subDomain.pop()];
});
} | javascript | function(start) {
"use strict";
var parent = this;
return this.triggerEvent("afterLoadPreviousDomain", function() {
var subDomain = parent.getSubDomain(start);
return [subDomain.shift(), subDomain.pop()];
});
} | [
"function",
"(",
"start",
")",
"{",
"\"use strict\"",
";",
"var",
"parent",
"=",
"this",
";",
"return",
"this",
".",
"triggerEvent",
"(",
"\"afterLoadPreviousDomain\"",
",",
"function",
"(",
")",
"{",
"var",
"subDomain",
"=",
"parent",
".",
"getSubDomain",
"... | Event triggered after shifting the calendar one domain back
@param Date start Domain start date
@param Date end Domain end date | [
"Event",
"triggered",
"after",
"shifting",
"the",
"calendar",
"one",
"domain",
"back"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1564-L1572 | |
9,534 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(n) {
"use strict";
if (this._minDomainReached || n === 0) {
return false;
}
var bound = this.loadNewDomains(this.NAVIGATE_LEFT, this.getDomain(this.getDomainKeys()[0], -n).reverse());
this.afterLoadPreviousDomain(bound.start);
this.checkIfMinDomainIsReached(bound.start, bound.end);
return ... | javascript | function(n) {
"use strict";
if (this._minDomainReached || n === 0) {
return false;
}
var bound = this.loadNewDomains(this.NAVIGATE_LEFT, this.getDomain(this.getDomainKeys()[0], -n).reverse());
this.afterLoadPreviousDomain(bound.start);
this.checkIfMinDomainIsReached(bound.start, bound.end);
return ... | [
"function",
"(",
"n",
")",
"{",
"\"use strict\"",
";",
"if",
"(",
"this",
".",
"_minDomainReached",
"||",
"n",
"===",
"0",
")",
"{",
"return",
"false",
";",
"}",
"var",
"bound",
"=",
"this",
".",
"loadNewDomains",
"(",
"this",
".",
"NAVIGATE_LEFT",
","... | Shift the calendar one domain backward
The previous domain is loaded only if it's not beyond the minDate
@param int n Number of domains to load
@return bool True if the previous domain was loaded, else false | [
"Shift",
"the",
"calendar",
"one",
"domain",
"backward"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1727-L1740 | |
9,535 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function() {
"use strict";
return this._domains.keys()
.map(function(d) { return parseInt(d, 10); })
.sort(function(a,b) { return a-b; });
} | javascript | function() {
"use strict";
return this._domains.keys()
.map(function(d) { return parseInt(d, 10); })
.sort(function(a,b) { return a-b; });
} | [
"function",
"(",
")",
"{",
"\"use strict\"",
";",
"return",
"this",
".",
"_domains",
".",
"keys",
"(",
")",
".",
"map",
"(",
"function",
"(",
"d",
")",
"{",
"return",
"parseInt",
"(",
"d",
",",
"10",
")",
";",
"}",
")",
".",
"sort",
"(",
"functio... | Return the list of the calendar's domain timestamp
@return Array a sorted array of timestamp | [
"Return",
"the",
"list",
"of",
"the",
"calendar",
"s",
"domain",
"timestamp"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1830-L1836 | |
9,536 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(d) {
"use strict";
d = new Date(d);
if (this.options.highlight.length > 0) {
for (var i in this.options.highlight) {
if (this.dateIsEqual(this.options.highlight[i], d)) {
return this.isNow(this.options.highlight[i]) ? " highlight-now": " highlight";
}
}
}
return "";
} | javascript | function(d) {
"use strict";
d = new Date(d);
if (this.options.highlight.length > 0) {
for (var i in this.options.highlight) {
if (this.dateIsEqual(this.options.highlight[i], d)) {
return this.isNow(this.options.highlight[i]) ? " highlight-now": " highlight";
}
}
}
return "";
} | [
"function",
"(",
"d",
")",
"{",
"\"use strict\"",
";",
"d",
"=",
"new",
"Date",
"(",
"d",
")",
";",
"if",
"(",
"this",
".",
"options",
".",
"highlight",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"this",
".",
"options",
".... | Return a classname if the specified date should be highlighted
@param timestamp date Date of the current subDomain
@return String the highlight class | [
"Return",
"a",
"classname",
"if",
"the",
"specified",
"date",
"should",
"be",
"highlighted"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1900-L1913 | |
9,537 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(dateA, dateB) {
"use strict";
if(!(dateA instanceof Date)) {
dateA = new Date(dateA);
}
if (!(dateB instanceof Date)) {
dateB = new Date(dateB);
}
switch(this.options.subDomain) {
case "x_min":
case "min":
return dateA.getFullYear() === dateB.getFullYear() &&
dateA.getMonth() ==... | javascript | function(dateA, dateB) {
"use strict";
if(!(dateA instanceof Date)) {
dateA = new Date(dateA);
}
if (!(dateB instanceof Date)) {
dateB = new Date(dateB);
}
switch(this.options.subDomain) {
case "x_min":
case "min":
return dateA.getFullYear() === dateB.getFullYear() &&
dateA.getMonth() ==... | [
"function",
"(",
"dateA",
",",
"dateB",
")",
"{",
"\"use strict\"",
";",
"if",
"(",
"!",
"(",
"dateA",
"instanceof",
"Date",
")",
")",
"{",
"dateA",
"=",
"new",
"Date",
"(",
"dateA",
")",
";",
"}",
"if",
"(",
"!",
"(",
"dateB",
"instanceof",
"Date"... | Return whether 2 dates are equals
This function is subdomain-aware,
and dates comparison are dependent of the subdomain
@param Date dateA First date to compare
@param Date dateB Secon date to compare
@return bool true if the 2 dates are equals
/* jshint maxcomplexity: false | [
"Return",
"whether",
"2",
"dates",
"are",
"equals",
"This",
"function",
"is",
"subdomain",
"-",
"aware",
"and",
"dates",
"comparison",
"are",
"dependent",
"of",
"the",
"subdomain"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1938-L1979 | |
9,538 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(dateA, dateB) {
"use strict";
if(!(dateA instanceof Date)) {
dateA = new Date(dateA);
}
if (!(dateB instanceof Date)) {
dateB = new Date(dateB);
}
function normalizedMillis(date, subdomain) {
switch(subdomain) {
case "x_min":
case "min":
return new Date(date.getFullYear(), da... | javascript | function(dateA, dateB) {
"use strict";
if(!(dateA instanceof Date)) {
dateA = new Date(dateA);
}
if (!(dateB instanceof Date)) {
dateB = new Date(dateB);
}
function normalizedMillis(date, subdomain) {
switch(subdomain) {
case "x_min":
case "min":
return new Date(date.getFullYear(), da... | [
"function",
"(",
"dateA",
",",
"dateB",
")",
"{",
"\"use strict\"",
";",
"if",
"(",
"!",
"(",
"dateA",
"instanceof",
"Date",
")",
")",
"{",
"dateA",
"=",
"new",
"Date",
"(",
"dateA",
")",
";",
"}",
"if",
"(",
"!",
"(",
"dateB",
"instanceof",
"Date"... | Returns wether or not dateA is less than or equal to dateB. This function is subdomain aware.
Performs automatic conversion of values.
@param dateA may be a number or a Date
@param dateB may be a number or a Date
@returns {boolean} | [
"Returns",
"wether",
"or",
"not",
"dateA",
"is",
"less",
"than",
"or",
"equal",
"to",
"dateB",
".",
"This",
"function",
"is",
"subdomain",
"aware",
".",
"Performs",
"automatic",
"conversion",
"of",
"values",
"."
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L1989-L2023 | |
9,539 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(d) {
"use strict";
var f = this.options.weekStartOnMonday === true ? d3.time.format("%W"): d3.time.format("%U");
return f(d);
} | javascript | function(d) {
"use strict";
var f = this.options.weekStartOnMonday === true ? d3.time.format("%W"): d3.time.format("%U");
return f(d);
} | [
"function",
"(",
"d",
")",
"{",
"\"use strict\"",
";",
"var",
"f",
"=",
"this",
".",
"options",
".",
"weekStartOnMonday",
"===",
"true",
"?",
"d3",
".",
"time",
".",
"format",
"(",
"\"%W\"",
")",
":",
"d3",
".",
"time",
".",
"format",
"(",
"\"%U\"",
... | Return the week number of the year
Monday as the first day of the week
@return int Week number [0-53] | [
"Return",
"the",
"week",
"number",
"of",
"the",
"year",
"Monday",
"as",
"the",
"first",
"day",
"of",
"the",
"week"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2042-L2047 | |
9,540 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function (d) {
"use strict";
if (typeof d === "number") {
d = new Date(d);
}
var monthFirstWeekNumber = this.getWeekNumber(new Date(d.getFullYear(), d.getMonth()));
return this.getWeekNumber(d) - monthFirstWeekNumber - 1;
} | javascript | function (d) {
"use strict";
if (typeof d === "number") {
d = new Date(d);
}
var monthFirstWeekNumber = this.getWeekNumber(new Date(d.getFullYear(), d.getMonth()));
return this.getWeekNumber(d) - monthFirstWeekNumber - 1;
} | [
"function",
"(",
"d",
")",
"{",
"\"use strict\"",
";",
"if",
"(",
"typeof",
"d",
"===",
"\"number\"",
")",
"{",
"d",
"=",
"new",
"Date",
"(",
"d",
")",
";",
"}",
"var",
"monthFirstWeekNumber",
"=",
"this",
".",
"getWeekNumber",
"(",
"new",
"Date",
"(... | Return the week number, relative to its month
@param int|Date d Date or timestamp in milliseconds
@return int Week number, relative to the month [0-5] | [
"Return",
"the",
"week",
"number",
"relative",
"to",
"its",
"month"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2055-L2064 | |
9,541 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(d) {
"use strict";
if (this.options.weekStartOnMonday === false) {
return d.getDay();
}
return d.getDay() === 0 ? 6 : (d.getDay()-1);
} | javascript | function(d) {
"use strict";
if (this.options.weekStartOnMonday === false) {
return d.getDay();
}
return d.getDay() === 0 ? 6 : (d.getDay()-1);
} | [
"function",
"(",
"d",
")",
"{",
"\"use strict\"",
";",
"if",
"(",
"this",
".",
"options",
".",
"weekStartOnMonday",
"===",
"false",
")",
"{",
"return",
"d",
".",
"getDay",
"(",
")",
";",
"}",
"return",
"d",
".",
"getDay",
"(",
")",
"===",
"0",
"?",... | Get the weekday from a date
Return the week day number (0-6) of a date,
depending on whether the week start on monday or sunday
@param Date d
@return int The week day number (0-6) | [
"Get",
"the",
"weekday",
"from",
"a",
"date"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2116-L2123 | |
9,542 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(d) {
"use strict";
if (typeof d === "number") {
d = new Date(d);
}
return new Date(d.getFullYear(), d.getMonth()+1, 0);
} | javascript | function(d) {
"use strict";
if (typeof d === "number") {
d = new Date(d);
}
return new Date(d.getFullYear(), d.getMonth()+1, 0);
} | [
"function",
"(",
"d",
")",
"{",
"\"use strict\"",
";",
"if",
"(",
"typeof",
"d",
"===",
"\"number\"",
")",
"{",
"d",
"=",
"new",
"Date",
"(",
"d",
")",
";",
"}",
"return",
"new",
"Date",
"(",
"d",
".",
"getFullYear",
"(",
")",
",",
"d",
".",
"g... | Get the last day of the month
@param Date|int d Date or timestamp in milliseconds
@return Date Last day of the month | [
"Get",
"the",
"last",
"day",
"of",
"the",
"month"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2130-L2137 | |
9,543 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function (d, range) {
"use strict";
var start = new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours());
var stop = null;
if (range instanceof Date) {
stop = new Date(range.getFullYear(), range.getMonth(), range.getDate(), range.getHours());
} else {
stop = new Date(start);
stop.setHours(... | javascript | function (d, range) {
"use strict";
var start = new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours());
var stop = null;
if (range instanceof Date) {
stop = new Date(range.getFullYear(), range.getMonth(), range.getDate(), range.getHours());
} else {
stop = new Date(start);
stop.setHours(... | [
"function",
"(",
"d",
",",
"range",
")",
"{",
"\"use strict\"",
";",
"var",
"start",
"=",
"new",
"Date",
"(",
"d",
".",
"getFullYear",
"(",
")",
",",
"d",
".",
"getMonth",
"(",
")",
",",
"d",
".",
"getDate",
"(",
")",
",",
"d",
".",
"getHours",
... | Return all the hours between 2 dates
@param Date d A date
@param int|date range Number of hours in the range, or a stop date
@return array An array of hours | [
"Return",
"all",
"the",
"hours",
"between",
"2",
"dates"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2201-L2235 | |
9,544 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function (d, range) {
"use strict";
var start = new Date(d.getFullYear(), d.getMonth(), d.getDate());
var stop = null;
if (range instanceof Date) {
stop = new Date(range.getFullYear(), range.getMonth(), range.getDate());
} else {
stop = new Date(start);
stop = new Date(stop.setDate(stop.getDate() + ... | javascript | function (d, range) {
"use strict";
var start = new Date(d.getFullYear(), d.getMonth(), d.getDate());
var stop = null;
if (range instanceof Date) {
stop = new Date(range.getFullYear(), range.getMonth(), range.getDate());
} else {
stop = new Date(start);
stop = new Date(stop.setDate(stop.getDate() + ... | [
"function",
"(",
"d",
",",
"range",
")",
"{",
"\"use strict\"",
";",
"var",
"start",
"=",
"new",
"Date",
"(",
"d",
".",
"getFullYear",
"(",
")",
",",
"d",
".",
"getMonth",
"(",
")",
",",
"d",
".",
"getDate",
"(",
")",
")",
";",
"var",
"stop",
"... | Return all the days between 2 dates
@param Date d A date
@param int|date range Number of days in the range, or a stop date
@return array An array of weeks | [
"Return",
"all",
"the",
"days",
"between",
"2",
"dates"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2244-L2257 | |
9,545 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function (d, range) {
"use strict";
var weekStart;
if (this.options.weekStartOnMonday === false) {
weekStart = new Date(d.getFullYear(), d.getMonth(), d.getDate() - d.getDay());
} else {
if (d.getDay() === 1) {
weekStart = new Date(d.getFullYear(), d.getMonth(), d.getDate());
} else if (d.getDay(... | javascript | function (d, range) {
"use strict";
var weekStart;
if (this.options.weekStartOnMonday === false) {
weekStart = new Date(d.getFullYear(), d.getMonth(), d.getDate() - d.getDay());
} else {
if (d.getDay() === 1) {
weekStart = new Date(d.getFullYear(), d.getMonth(), d.getDate());
} else if (d.getDay(... | [
"function",
"(",
"d",
",",
"range",
")",
"{",
"\"use strict\"",
";",
"var",
"weekStart",
";",
"if",
"(",
"this",
".",
"options",
".",
"weekStartOnMonday",
"===",
"false",
")",
"{",
"weekStart",
"=",
"new",
"Date",
"(",
"d",
".",
"getFullYear",
"(",
")"... | Return all the weeks between 2 dates
@param Date d A date
@param int|date range Number of minutes in the range, or a stop date
@return array An array of weeks | [
"Return",
"all",
"the",
"weeks",
"between",
"2",
"dates"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2266-L2295 | |
9,546 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function (d, range) {
"use strict";
var start = new Date(d.getFullYear(), d.getMonth());
var stop = null;
if (range instanceof Date) {
stop = new Date(range.getFullYear(), range.getMonth());
} else {
stop = new Date(start);
stop = stop.setMonth(stop.getMonth()+range);
}
return d3.time.months(Ma... | javascript | function (d, range) {
"use strict";
var start = new Date(d.getFullYear(), d.getMonth());
var stop = null;
if (range instanceof Date) {
stop = new Date(range.getFullYear(), range.getMonth());
} else {
stop = new Date(start);
stop = stop.setMonth(stop.getMonth()+range);
}
return d3.time.months(Ma... | [
"function",
"(",
"d",
",",
"range",
")",
"{",
"\"use strict\"",
";",
"var",
"start",
"=",
"new",
"Date",
"(",
"d",
".",
"getFullYear",
"(",
")",
",",
"d",
".",
"getMonth",
"(",
")",
")",
";",
"var",
"stop",
"=",
"null",
";",
"if",
"(",
"range",
... | Return all the months between 2 dates
@param Date d A date
@param int|date range Number of months in the range, or a stop date
@return array An array of months | [
"Return",
"all",
"the",
"months",
"between",
"2",
"dates"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2304-L2317 | |
9,547 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(d, range){
"use strict";
var start = new Date(d.getFullYear(), 0);
var stop = null;
if (range instanceof Date) {
stop = new Date(range.getFullYear(), 0);
} else {
stop = new Date(d.getFullYear()+range, 0);
}
return d3.time.years(Math.min(start, stop), Math.max(start, stop));
} | javascript | function(d, range){
"use strict";
var start = new Date(d.getFullYear(), 0);
var stop = null;
if (range instanceof Date) {
stop = new Date(range.getFullYear(), 0);
} else {
stop = new Date(d.getFullYear()+range, 0);
}
return d3.time.years(Math.min(start, stop), Math.max(start, stop));
} | [
"function",
"(",
"d",
",",
"range",
")",
"{",
"\"use strict\"",
";",
"var",
"start",
"=",
"new",
"Date",
"(",
"d",
".",
"getFullYear",
"(",
")",
",",
"0",
")",
";",
"var",
"stop",
"=",
"null",
";",
"if",
"(",
"range",
"instanceof",
"Date",
")",
"... | Return all the years between 2 dates
@param Date d date A date
@param int|date range Number of minutes in the range, or a stop date
@return array An array of hours | [
"Return",
"all",
"the",
"years",
"between",
"2",
"dates"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2326-L2338 | |
9,548 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(date, range) {
"use strict";
if (typeof date === "number") {
date = new Date(date);
}
if (arguments.length < 2) {
range = this.options.range;
}
switch(this.options.domain) {
case "hour" :
var domains = this.getHourDomain(date, range);
// Case where an hour is missing, when passing... | javascript | function(date, range) {
"use strict";
if (typeof date === "number") {
date = new Date(date);
}
if (arguments.length < 2) {
range = this.options.range;
}
switch(this.options.domain) {
case "hour" :
var domains = this.getHourDomain(date, range);
// Case where an hour is missing, when passing... | [
"function",
"(",
"date",
",",
"range",
")",
"{",
"\"use strict\"",
";",
"if",
"(",
"typeof",
"date",
"===",
"\"number\"",
")",
"{",
"date",
"=",
"new",
"Date",
"(",
"date",
")",
";",
"}",
"if",
"(",
"arguments",
".",
"length",
"<",
"2",
")",
"{",
... | Get an array of domain start dates
@param int|Date date A random date included in the wanted domain
@param int|Date range Number of dates to get, or a stop date
@return Array of dates | [
"Get",
"an",
"array",
"of",
"domain",
"start",
"dates"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2347-L2381 | |
9,549 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(data, updateMode, startDate, endDate) {
"use strict";
if (updateMode === this.RESET_ALL_ON_UPDATE) {
this._domains.forEach(function(key, value) {
value.forEach(function(element, index, array) {
array[index].v = null;
});
});
}
var temp = {};
var extractTime = function(d) { retur... | javascript | function(data, updateMode, startDate, endDate) {
"use strict";
if (updateMode === this.RESET_ALL_ON_UPDATE) {
this._domains.forEach(function(key, value) {
value.forEach(function(element, index, array) {
array[index].v = null;
});
});
}
var temp = {};
var extractTime = function(d) { retur... | [
"function",
"(",
"data",
",",
"updateMode",
",",
"startDate",
",",
"endDate",
")",
"{",
"\"use strict\"",
";",
"if",
"(",
"updateMode",
"===",
"this",
".",
"RESET_ALL_ON_UPDATE",
")",
"{",
"this",
".",
"_domains",
".",
"forEach",
"(",
"function",
"(",
"key... | Populate the calendar internal data
@param object data
@param constant updateMode
@param Date startDate
@param Date endDate
@return void | [
"Populate",
"the",
"calendar",
"internal",
"data"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2615-L2669 | |
9,550 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function() {
"use strict";
var parent = this;
var options = parent.options;
var legendWidth = options.displayLegend ? (parent.Legend.getDim("width") + options.legendMargin[1] + options.legendMargin[3]) : 0;
var legendHeight = options.displayLegend ? (parent.Legend.getDim("height") + options.legendMargin[0] +... | javascript | function() {
"use strict";
var parent = this;
var options = parent.options;
var legendWidth = options.displayLegend ? (parent.Legend.getDim("width") + options.legendMargin[1] + options.legendMargin[3]) : 0;
var legendHeight = options.displayLegend ? (parent.Legend.getDim("height") + options.legendMargin[0] +... | [
"function",
"(",
")",
"{",
"\"use strict\"",
";",
"var",
"parent",
"=",
"this",
";",
"var",
"options",
"=",
"parent",
".",
"options",
";",
"var",
"legendWidth",
"=",
"options",
".",
"displayLegend",
"?",
"(",
"parent",
".",
"Legend",
".",
"getDim",
"(",
... | Handle the calendar layout and dimension
Expand and shrink the container depending on its children dimension
Also rearrange the children position depending on their dimension,
and the legend position
@return void | [
"Handle",
"the",
"calendar",
"layout",
"and",
"dimension"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2706-L2749 | |
9,551 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(date, reset) {
"use strict";
if (arguments.length < 2) {
reset = false;
}
var domains = this.getDomainKeys();
var firstDomain = domains[0];
var lastDomain = domains[domains.length-1];
if (date < firstDomain) {
return this.loadPreviousDomain(this.getDomain(firstDomain, date).length);
} e... | javascript | function(date, reset) {
"use strict";
if (arguments.length < 2) {
reset = false;
}
var domains = this.getDomainKeys();
var firstDomain = domains[0];
var lastDomain = domains[domains.length-1];
if (date < firstDomain) {
return this.loadPreviousDomain(this.getDomain(firstDomain, date).length);
} e... | [
"function",
"(",
"date",
",",
"reset",
")",
"{",
"\"use strict\"",
";",
"if",
"(",
"arguments",
".",
"length",
"<",
"2",
")",
"{",
"reset",
"=",
"false",
";",
"}",
"var",
"domains",
"=",
"this",
".",
"getDomainKeys",
"(",
")",
";",
"var",
"firstDomai... | Jump directly to a specific date
JumpTo will scroll the calendar until the wanted domain with the specified
date is visible. Unless you set reset to true, the wanted domain
will not necessarily be the first (leftmost) domain of the calendar.
@param Date date Jump to the domain containing that date
@param bool reset W... | [
"Jump",
"directly",
"to",
"a",
"specific",
"date"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2790-L2813 | |
9,552 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(dataSource, afterLoad, updateMode) {
"use strict";
if (arguments.length === 0) {
dataSource = this.options.data;
}
if (arguments.length < 2) {
afterLoad = true;
}
if (arguments.length < 3) {
updateMode = this.RESET_ALL_ON_UPDATE;
}
var domains = this.getDomainKeys();
var self = thi... | javascript | function(dataSource, afterLoad, updateMode) {
"use strict";
if (arguments.length === 0) {
dataSource = this.options.data;
}
if (arguments.length < 2) {
afterLoad = true;
}
if (arguments.length < 3) {
updateMode = this.RESET_ALL_ON_UPDATE;
}
var domains = this.getDomainKeys();
var self = thi... | [
"function",
"(",
"dataSource",
",",
"afterLoad",
",",
"updateMode",
")",
"{",
"\"use strict\"",
";",
"if",
"(",
"arguments",
".",
"length",
"===",
"0",
")",
"{",
"dataSource",
"=",
"this",
".",
"options",
".",
"data",
";",
"}",
"if",
"(",
"arguments",
... | Update the calendar with new data
@param object|string dataSource The calendar's datasource, same type as this.options.data
@param boolean|function afterLoad Whether to execute afterLoad() on the data. Pass directly a function
if you don't want to use the afterLoad() callback | [
"Update",
"the",
"calendar",
"with",
"new",
"data"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2834-L2860 | |
9,553 | wa0x6e/cal-heatmap | src/cal-heatmap.js | function(callback) {
"use strict";
this.root.transition().duration(this.options.animationDuration)
.attr("width", 0)
.attr("height", 0)
.remove()
.each("end", function() {
if (typeof callback === "function") {
callback();
} else if (typeof callback !== "undefined") {
console.log("Prov... | javascript | function(callback) {
"use strict";
this.root.transition().duration(this.options.animationDuration)
.attr("width", 0)
.attr("height", 0)
.remove()
.each("end", function() {
if (typeof callback === "function") {
callback();
} else if (typeof callback !== "undefined") {
console.log("Prov... | [
"function",
"(",
"callback",
")",
"{",
"\"use strict\"",
";",
"this",
".",
"root",
".",
"transition",
"(",
")",
".",
"duration",
"(",
"this",
".",
"options",
".",
"animationDuration",
")",
".",
"attr",
"(",
"\"width\"",
",",
"0",
")",
".",
"attr",
"(",... | Destroy the calendar
Usage: cal = cal.destroy();
@since 3.3.6
@param function A callback function to trigger after destroying the calendar
@return null | [
"Destroy",
"the",
"calendar"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L2951-L2968 | |
9,554 | wa0x6e/cal-heatmap | src/cal-heatmap.js | arrayEquals | function arrayEquals(arrayA, arrayB) {
"use strict";
// if the other array is a falsy value, return
if (!arrayB || !arrayA) {
return false;
}
// compare lengths - can save a lot of time
if (arrayA.length !== arrayB.length) {
return false;
}
for (var i = 0; i < arrayA.length; i++) {
// Check if we have ... | javascript | function arrayEquals(arrayA, arrayB) {
"use strict";
// if the other array is a falsy value, return
if (!arrayB || !arrayA) {
return false;
}
// compare lengths - can save a lot of time
if (arrayA.length !== arrayB.length) {
return false;
}
for (var i = 0; i < arrayA.length; i++) {
// Check if we have ... | [
"function",
"arrayEquals",
"(",
"arrayA",
",",
"arrayB",
")",
"{",
"\"use strict\"",
";",
"// if the other array is a falsy value, return",
"if",
"(",
"!",
"arrayB",
"||",
"!",
"arrayA",
")",
"{",
"return",
"false",
";",
"}",
"// compare lengths - can save a lot of ti... | Check if 2 arrays are equals
@link http://stackoverflow.com/a/14853974/805649
@param array array the array to compare to
@return bool true of the 2 arrays are equals | [
"Check",
"if",
"2",
"arrays",
"are",
"equals"
] | 0b594620104e0b11a94cc45feb0a76b58a038e0e | https://github.com/wa0x6e/cal-heatmap/blob/0b594620104e0b11a94cc45feb0a76b58a038e0e/src/cal-heatmap.js#L3466-L3493 |
9,555 | stjohnjohnson/smartthings-mqtt-bridge | server.js | loadSavedState | function loadSavedState () {
var output;
try {
output = jsonfile.readFileSync(STATE_FILE);
} catch (ex) {
winston.info('No previous state found, continuing');
output = {
subscriptions: [],
callback: '',
history: {},
version: '0.0.0'
... | javascript | function loadSavedState () {
var output;
try {
output = jsonfile.readFileSync(STATE_FILE);
} catch (ex) {
winston.info('No previous state found, continuing');
output = {
subscriptions: [],
callback: '',
history: {},
version: '0.0.0'
... | [
"function",
"loadSavedState",
"(",
")",
"{",
"var",
"output",
";",
"try",
"{",
"output",
"=",
"jsonfile",
".",
"readFileSync",
"(",
"STATE_FILE",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"winston",
".",
"info",
"(",
"'No previous state found, continuing'... | Load the saved previous state from disk
@method loadSavedState
@return {Object} Configuration | [
"Load",
"the",
"saved",
"previous",
"state",
"from",
"disk"
] | 066d3f492e2f9d9016964bef191230b99cb4e0c8 | https://github.com/stjohnjohnson/smartthings-mqtt-bridge/blob/066d3f492e2f9d9016964bef191230b99cb4e0c8/server.js#L71-L85 |
9,556 | stjohnjohnson/smartthings-mqtt-bridge | server.js | saveState | function saveState () {
winston.info('Saving current state');
jsonfile.writeFileSync(STATE_FILE, {
subscriptions: subscriptions,
callback: callback,
history: history,
version: CURRENT_VERSION
}, {
spaces: 4
});
} | javascript | function saveState () {
winston.info('Saving current state');
jsonfile.writeFileSync(STATE_FILE, {
subscriptions: subscriptions,
callback: callback,
history: history,
version: CURRENT_VERSION
}, {
spaces: 4
});
} | [
"function",
"saveState",
"(",
")",
"{",
"winston",
".",
"info",
"(",
"'Saving current state'",
")",
";",
"jsonfile",
".",
"writeFileSync",
"(",
"STATE_FILE",
",",
"{",
"subscriptions",
":",
"subscriptions",
",",
"callback",
":",
"callback",
",",
"history",
":"... | Resubscribe on a periodic basis
@method saveState | [
"Resubscribe",
"on",
"a",
"periodic",
"basis"
] | 066d3f492e2f9d9016964bef191230b99cb4e0c8 | https://github.com/stjohnjohnson/smartthings-mqtt-bridge/blob/066d3f492e2f9d9016964bef191230b99cb4e0c8/server.js#L91-L101 |
9,557 | stjohnjohnson/smartthings-mqtt-bridge | server.js | migrateState | function migrateState (version) {
// Make sure the object exists
if (!config.mqtt) {
config.mqtt = {};
}
// This is the previous default, but it's totally wrong
if (!config.mqtt.preface) {
config.mqtt.preface = '/smartthings';
}
// Default Suffixes
if (!config.mqtt[SUFF... | javascript | function migrateState (version) {
// Make sure the object exists
if (!config.mqtt) {
config.mqtt = {};
}
// This is the previous default, but it's totally wrong
if (!config.mqtt.preface) {
config.mqtt.preface = '/smartthings';
}
// Default Suffixes
if (!config.mqtt[SUFF... | [
"function",
"migrateState",
"(",
"version",
")",
"{",
"// Make sure the object exists",
"if",
"(",
"!",
"config",
".",
"mqtt",
")",
"{",
"config",
".",
"mqtt",
"=",
"{",
"}",
";",
"}",
"// This is the previous default, but it's totally wrong",
"if",
"(",
"!",
"c... | Migrate the configuration from the current version to the latest version
@method migrateState
@param {String} version Version the state was written in before | [
"Migrate",
"the",
"configuration",
"from",
"the",
"current",
"version",
"to",
"the",
"latest",
"version"
] | 066d3f492e2f9d9016964bef191230b99cb4e0c8 | https://github.com/stjohnjohnson/smartthings-mqtt-bridge/blob/066d3f492e2f9d9016964bef191230b99cb4e0c8/server.js#L108-L154 |
9,558 | stjohnjohnson/smartthings-mqtt-bridge | server.js | handleSubscribeEvent | function handleSubscribeEvent (req, res) {
// Subscribe to all events
subscriptions = [];
Object.keys(req.body.devices).forEach(function (property) {
req.body.devices[property].forEach(function (device) {
subscriptions.push(getTopicFor(device, property, TOPIC_COMMAND));
subsc... | javascript | function handleSubscribeEvent (req, res) {
// Subscribe to all events
subscriptions = [];
Object.keys(req.body.devices).forEach(function (property) {
req.body.devices[property].forEach(function (device) {
subscriptions.push(getTopicFor(device, property, TOPIC_COMMAND));
subsc... | [
"function",
"handleSubscribeEvent",
"(",
"req",
",",
"res",
")",
"{",
"// Subscribe to all events",
"subscriptions",
"=",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"req",
".",
"body",
".",
"devices",
")",
".",
"forEach",
"(",
"function",
"(",
"property",
... | Handle Subscribe event from SmartThings
@method handleSubscribeEvent
@param {Request} req
@param {Object} req.body
@param {Object} req.body.devices List of properties => device names
@param {String} req.body.callback Host and port for SmartThings Hub
@param {Result} res Result Object | [
"Handle",
"Subscribe",
"event",
"from",
"SmartThings"
] | 066d3f492e2f9d9016964bef191230b99cb4e0c8 | https://github.com/stjohnjohnson/smartthings-mqtt-bridge/blob/066d3f492e2f9d9016964bef191230b99cb4e0c8/server.js#L193-L216 |
9,559 | stjohnjohnson/smartthings-mqtt-bridge | server.js | getTopicFor | function getTopicFor (device, property, type) {
var tree = [config.mqtt.preface, device, property],
suffix;
if (type === TOPIC_COMMAND) {
suffix = config.mqtt[SUFFIX_COMMAND];
} else if (type === TOPIC_READ_STATE) {
suffix = config.mqtt[SUFFIX_READ_STATE];
} else if (type === TO... | javascript | function getTopicFor (device, property, type) {
var tree = [config.mqtt.preface, device, property],
suffix;
if (type === TOPIC_COMMAND) {
suffix = config.mqtt[SUFFIX_COMMAND];
} else if (type === TOPIC_READ_STATE) {
suffix = config.mqtt[SUFFIX_READ_STATE];
} else if (type === TO... | [
"function",
"getTopicFor",
"(",
"device",
",",
"property",
",",
"type",
")",
"{",
"var",
"tree",
"=",
"[",
"config",
".",
"mqtt",
".",
"preface",
",",
"device",
",",
"property",
"]",
",",
"suffix",
";",
"if",
"(",
"type",
"===",
"TOPIC_COMMAND",
")",
... | Get the topic name for a given item
@method getTopicFor
@param {String} device Device Name
@param {String} property Property
@param {String} type Type of topic (command or state)
@return {String} MQTT Topic name | [
"Get",
"the",
"topic",
"name",
"for",
"a",
"given",
"item"
] | 066d3f492e2f9d9016964bef191230b99cb4e0c8 | https://github.com/stjohnjohnson/smartthings-mqtt-bridge/blob/066d3f492e2f9d9016964bef191230b99cb4e0c8/server.js#L227-L244 |
9,560 | stjohnjohnson/smartthings-mqtt-bridge | server.js | parseMQTTMessage | function parseMQTTMessage (topic, message) {
var contents = message.toString();
winston.info('Incoming message from MQTT: %s = %s', topic, contents);
// Remove the preface from the topic before splitting it
var pieces = topic.substr(config.mqtt.preface.length + 1).split('/'),
device = pieces[0]... | javascript | function parseMQTTMessage (topic, message) {
var contents = message.toString();
winston.info('Incoming message from MQTT: %s = %s', topic, contents);
// Remove the preface from the topic before splitting it
var pieces = topic.substr(config.mqtt.preface.length + 1).split('/'),
device = pieces[0]... | [
"function",
"parseMQTTMessage",
"(",
"topic",
",",
"message",
")",
"{",
"var",
"contents",
"=",
"message",
".",
"toString",
"(",
")",
";",
"winston",
".",
"info",
"(",
"'Incoming message from MQTT: %s = %s'",
",",
"topic",
",",
"contents",
")",
";",
"// Remove... | Parse incoming message from MQTT
@method parseMQTTMessage
@param {String} topic Topic channel the event came from
@param {String} message Contents of the event | [
"Parse",
"incoming",
"message",
"from",
"MQTT"
] | 066d3f492e2f9d9016964bef191230b99cb4e0c8 | https://github.com/stjohnjohnson/smartthings-mqtt-bridge/blob/066d3f492e2f9d9016964bef191230b99cb4e0c8/server.js#L252-L306 |
9,561 | publiclab/PublicLab.Editor | src/modules/PublicLab.TitleModule.Related.js | build | function build() {
module.el.find('.ple-module-content').append('<div style="display:none;" class="ple-title-related"></div>');
relatedEl = module.el.find('.ple-title-related');
relatedEl.append('<p class="ple-help">Does your work relate to one of these? Click to alert those contributors.</p><hr style="ma... | javascript | function build() {
module.el.find('.ple-module-content').append('<div style="display:none;" class="ple-title-related"></div>');
relatedEl = module.el.find('.ple-title-related');
relatedEl.append('<p class="ple-help">Does your work relate to one of these? Click to alert those contributors.</p><hr style="ma... | [
"function",
"build",
"(",
")",
"{",
"module",
".",
"el",
".",
"find",
"(",
"'.ple-module-content'",
")",
".",
"append",
"(",
"'<div style=\"display:none;\" class=\"ple-title-related\"></div>'",
")",
";",
"relatedEl",
"=",
"module",
".",
"el",
".",
"find",
"(",
"... | make an area for "related posts" to connect to | [
"make",
"an",
"area",
"for",
"related",
"posts",
"to",
"connect",
"to"
] | 03b7b24682aa860f6f589e93098dd12c496687b3 | https://github.com/publiclab/PublicLab.Editor/blob/03b7b24682aa860f6f589e93098dd12c496687b3/src/modules/PublicLab.TitleModule.Related.js#L34-L40 |
9,562 | publiclab/PublicLab.Editor | src/adapters/PublicLab.Formatter.js | function() {
var _formatter = this;
// functions that accept standard <data> and output form data for known services
_formatter.schemas = {
"publiclab": function(data) {
var output = {};
output.title = data.title || null;
output.body = data.body... | javascript | function() {
var _formatter = this;
// functions that accept standard <data> and output form data for known services
_formatter.schemas = {
"publiclab": function(data) {
var output = {};
output.title = data.title || null;
output.body = data.body... | [
"function",
"(",
")",
"{",
"var",
"_formatter",
"=",
"this",
";",
"// functions that accept standard <data> and output form data for known services",
"_formatter",
".",
"schemas",
"=",
"{",
"\"publiclab\"",
":",
"function",
"(",
"data",
")",
"{",
"var",
"output",
"=",... | eventually we could accept both a format and a URL | [
"eventually",
"we",
"could",
"accept",
"both",
"a",
"format",
"and",
"a",
"URL"
] | 03b7b24682aa860f6f589e93098dd12c496687b3 | https://github.com/publiclab/PublicLab.Editor/blob/03b7b24682aa860f6f589e93098dd12c496687b3/src/adapters/PublicLab.Formatter.js#L12-L61 | |
9,563 | PhilWaldmann/openrecord | lib/base/save.js | function(options) {
var self = this
options = options || {}
if (typeof options === 'function') throw new Error('then!')
return self
.validate()
.then(function() {
return self._create_or_update(options)
})
.then(function() {
// eliminate changes -> we just saved i... | javascript | function(options) {
var self = this
options = options || {}
if (typeof options === 'function') throw new Error('then!')
return self
.validate()
.then(function() {
return self._create_or_update(options)
})
.then(function() {
// eliminate changes -> we just saved i... | [
"function",
"(",
"options",
")",
"{",
"var",
"self",
"=",
"this",
"options",
"=",
"options",
"||",
"{",
"}",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"throw",
"new",
"Error",
"(",
"'then!'",
")",
"return",
"self",
".",
"validate",
"(",... | Save the current record
@class Record
@method save | [
"Save",
"the",
"current",
"record"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/save.js#L10-L27 | |
9,564 | PhilWaldmann/openrecord | lib/base/json.js | function(allowedAttributes, exportObject) {
var definition = this.definition
var tmp = exportObject || definition.store.utils.clone(this.attributes)
for (var i in definition.relations) {
var relation = definition.relations[i]
if (this['_' + relation.name]) {
tmp[relation.name] = this['_... | javascript | function(allowedAttributes, exportObject) {
var definition = this.definition
var tmp = exportObject || definition.store.utils.clone(this.attributes)
for (var i in definition.relations) {
var relation = definition.relations[i]
if (this['_' + relation.name]) {
tmp[relation.name] = this['_... | [
"function",
"(",
"allowedAttributes",
",",
"exportObject",
")",
"{",
"var",
"definition",
"=",
"this",
".",
"definition",
"var",
"tmp",
"=",
"exportObject",
"||",
"definition",
".",
"store",
".",
"utils",
".",
"clone",
"(",
"this",
".",
"attributes",
")",
... | Returns an object which represent the record in plain json
@class Record
@method toJson
@param {array} allowedAttributes - Optional: Only export the given attributes and/or relations
@param {object} exportObject - Optional: By default, OpenRecord clones the `attributes` object. If you specify the `exportObject` it wil... | [
"Returns",
"an",
"object",
"which",
"represent",
"the",
"record",
"in",
"plain",
"json"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/json.js#L12-L52 | |
9,565 | PhilWaldmann/openrecord | lib/base/json.js | function(allowedAttributes) {
var tmp = []
this.forEach(function(record) {
tmp.push(record.toJson(allowedAttributes))
})
return tmp
} | javascript | function(allowedAttributes) {
var tmp = []
this.forEach(function(record) {
tmp.push(record.toJson(allowedAttributes))
})
return tmp
} | [
"function",
"(",
"allowedAttributes",
")",
"{",
"var",
"tmp",
"=",
"[",
"]",
"this",
".",
"forEach",
"(",
"function",
"(",
"record",
")",
"{",
"tmp",
".",
"push",
"(",
"record",
".",
"toJson",
"(",
"allowedAttributes",
")",
")",
"}",
")",
"return",
"... | Returns an array of objects which represent the records in plain json
@class Collection
@method toJson
@param {array} allowedAttributes - Optional: Only export the given attributes and/or relations
@return {array} | [
"Returns",
"an",
"array",
"of",
"objects",
"which",
"represent",
"the",
"records",
"in",
"plain",
"json"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/json.js#L70-L76 | |
9,566 | PhilWaldmann/openrecord | lib/base/scope.js | function(name, fn, lazy) {
const Utils = this.store.utils
if (!fn && this.model) fn = this.model[name]
if (!fn)
throw new Error('You need to provide a function in order to use a scope')
var tmp = function() {
var args = Utils.args(arguments)
const self = this.chain()._unresolve() // ... | javascript | function(name, fn, lazy) {
const Utils = this.store.utils
if (!fn && this.model) fn = this.model[name]
if (!fn)
throw new Error('You need to provide a function in order to use a scope')
var tmp = function() {
var args = Utils.args(arguments)
const self = this.chain()._unresolve() // ... | [
"function",
"(",
"name",
",",
"fn",
",",
"lazy",
")",
"{",
"const",
"Utils",
"=",
"this",
".",
"store",
".",
"utils",
"if",
"(",
"!",
"fn",
"&&",
"this",
".",
"model",
")",
"fn",
"=",
"this",
".",
"model",
"[",
"name",
"]",
"if",
"(",
"!",
"f... | scope callback function
@public
@callback scopeFN
@param {*} args - All caller arguments
@return *
@this Model
Creates a custom chained Model method
@public
@memberof Definition
@method scope
@param {string} name - The name of the scope
@param {scopeFN} callback - The scope function
@return {Definition} | [
"scope",
"callback",
"function"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/scope.js#L35-L60 | |
9,567 | PhilWaldmann/openrecord | lib/base/chainable.js | function(options) {
options = options || {}
if (this.chained && options.clone !== true) return this
var ChainModel = new this.definition.ChainGenerator(options)
if (this.chained && options.clone === true) {
ChainModel._internal_attributes = this.definition.store.utils.clone(
this._intern... | javascript | function(options) {
options = options || {}
if (this.chained && options.clone !== true) return this
var ChainModel = new this.definition.ChainGenerator(options)
if (this.chained && options.clone === true) {
ChainModel._internal_attributes = this.definition.store.utils.clone(
this._intern... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
"if",
"(",
"this",
".",
"chained",
"&&",
"options",
".",
"clone",
"!==",
"true",
")",
"return",
"this",
"var",
"ChainModel",
"=",
"new",
"this",
".",
"definition",
".",
... | Returns a Collection, which is in fact a cloned Model - or a chained Model
A Collectioin is an Array with all of Models' methods. All `where`, `limit`, `setContext`, ... information will be stored in this chained Model to allow asynchronous usage.
@class Model
@method chain
@param {object} options - The options hash
@... | [
"Returns",
"a",
"Collection",
"which",
"is",
"in",
"fact",
"a",
"cloned",
"Model",
"-",
"or",
"a",
"chained",
"Model",
"A",
"Collectioin",
"is",
"an",
"Array",
"with",
"all",
"of",
"Models",
"methods",
".",
"All",
"where",
"limit",
"setContext",
"...",
"... | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/chainable.js#L82-L98 | |
9,568 | PhilWaldmann/openrecord | lib/base/relations.js | function() {
var self = this
Object.keys(this.definition.relations).forEach(function(key) {
delete self.relations[key]
})
return this
} | javascript | function() {
var self = this
Object.keys(this.definition.relations).forEach(function(key) {
delete self.relations[key]
})
return this
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
"Object",
".",
"keys",
"(",
"this",
".",
"definition",
".",
"relations",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"delete",
"self",
".",
"relations",
"[",
"key",
"]",
"}",
")... | clear all loadede relations | [
"clear",
"all",
"loadede",
"relations"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/relations.js#L276-L284 | |
9,569 | PhilWaldmann/openrecord | lib/base/attributes.js | function(name, type, options) {
const Store = require('../store')
options = options || {}
type = type || String
if (typeof type === 'string') {
type = type.toLowerCase()
}
var fieldType = this.store.getType(type)
if (!fieldType) {
throw new Store.UnknownAttributeTypeError(type)... | javascript | function(name, type, options) {
const Store = require('../store')
options = options || {}
type = type || String
if (typeof type === 'string') {
type = type.toLowerCase()
}
var fieldType = this.store.getType(type)
if (!fieldType) {
throw new Store.UnknownAttributeTypeError(type)... | [
"function",
"(",
"name",
",",
"type",
",",
"options",
")",
"{",
"const",
"Store",
"=",
"require",
"(",
"'../store'",
")",
"options",
"=",
"options",
"||",
"{",
"}",
"type",
"=",
"type",
"||",
"String",
"if",
"(",
"typeof",
"type",
"===",
"'string'",
... | Add a new attribute to your Model
@public
@memberof Definition
@method attribute
@param {string} name - The attribute name
@param {string} type - The attribute type (e.g. `text`, `integer`, or sql language specific. e.g. `blob`)
@param {object} [options] - Optional options
@param {boolean} [options.writable=true] - ma... | [
"Add",
"a",
"new",
"attribute",
"to",
"your",
"Model"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/attributes.js#L56-L106 | |
9,570 | PhilWaldmann/openrecord | lib/base/attributes.js | function(name, fn) {
const externalName = this.store.toExternalAttributeName(name)
this.instanceMethods.__defineSetter__(name, fn)
if(externalName !== name) this.instanceMethods.__defineSetter__(externalName, fn)
return this
} | javascript | function(name, fn) {
const externalName = this.store.toExternalAttributeName(name)
this.instanceMethods.__defineSetter__(name, fn)
if(externalName !== name) this.instanceMethods.__defineSetter__(externalName, fn)
return this
} | [
"function",
"(",
"name",
",",
"fn",
")",
"{",
"const",
"externalName",
"=",
"this",
".",
"store",
".",
"toExternalAttributeName",
"(",
"name",
")",
"this",
".",
"instanceMethods",
".",
"__defineSetter__",
"(",
"name",
",",
"fn",
")",
"if",
"(",
"externalNa... | Add a custom setter to your record
@class Definition
@method setter
@param {string} name - The setter name
@param {function} fn - The method to call
@return {Definition} | [
"Add",
"a",
"custom",
"setter",
"to",
"your",
"record"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/attributes.js#L169-L174 | |
9,571 | PhilWaldmann/openrecord | lib/base/attributes.js | function(name, fn) {
const _name = this.store.toInternalAttributeName(name)
const Store = require('../store')
if (!this.attributes[_name]) throw new Store.UnknownAttributeError(name)
this.attributes[_name].variant = fn
this[name + '$'] = function(args) {
return fn.call(this, this[_name], arg... | javascript | function(name, fn) {
const _name = this.store.toInternalAttributeName(name)
const Store = require('../store')
if (!this.attributes[_name]) throw new Store.UnknownAttributeError(name)
this.attributes[_name].variant = fn
this[name + '$'] = function(args) {
return fn.call(this, this[_name], arg... | [
"function",
"(",
"name",
",",
"fn",
")",
"{",
"const",
"_name",
"=",
"this",
".",
"store",
".",
"toInternalAttributeName",
"(",
"name",
")",
"const",
"Store",
"=",
"require",
"(",
"'../store'",
")",
"if",
"(",
"!",
"this",
".",
"attributes",
"[",
"_nam... | Add a variant method to the specified attribute
@class Definition
@method variant
@param {string} name - The attribute name
@param {function} fn - The method to call
@return {Definition} | [
"Add",
"a",
"variant",
"method",
"to",
"the",
"specified",
"attribute"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/attributes.js#L186-L198 | |
9,572 | PhilWaldmann/openrecord | lib/base/attributes.js | function(name, value) {
if (!name && !value) return
var values = name
var castType = value
var singleAssign = false
if (typeof name === 'string') {
values = {}
values[name] = value
castType = 'input'
singleAssign = true
}
for (var field in this.definition.attributes... | javascript | function(name, value) {
if (!name && !value) return
var values = name
var castType = value
var singleAssign = false
if (typeof name === 'string') {
values = {}
values[name] = value
castType = 'input'
singleAssign = true
}
for (var field in this.definition.attributes... | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"if",
"(",
"!",
"name",
"&&",
"!",
"value",
")",
"return",
"var",
"values",
"=",
"name",
"var",
"castType",
"=",
"value",
"var",
"singleAssign",
"=",
"false",
"if",
"(",
"typeof",
"name",
"===",
"'stri... | Set one or multiple attributes of a Record.
@class Record
@method set
@param {string} name - The attributes name
@param {VALUE} value - The attributes value
@or
@param {object} attributes - Multiple attribute as an object
@param {string} cast_type - Optional cast_type name (Default: `input`)
@return {Record} | [
"Set",
"one",
"or",
"multiple",
"attributes",
"of",
"a",
"Record",
"."
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/attributes.js#L229-L337 | |
9,573 | PhilWaldmann/openrecord | lib/base/attributes.js | function(name) {
var attr = this.definition.attributes[name]
if (attr) {
// set undefined values to null
if (this.attributes[name] === undefined) {
this.attributes[name] = null
}
return this.definition.cast(name, this.attributes[name], 'output', this)
}
return null
} | javascript | function(name) {
var attr = this.definition.attributes[name]
if (attr) {
// set undefined values to null
if (this.attributes[name] === undefined) {
this.attributes[name] = null
}
return this.definition.cast(name, this.attributes[name], 'output', this)
}
return null
} | [
"function",
"(",
"name",
")",
"{",
"var",
"attr",
"=",
"this",
".",
"definition",
".",
"attributes",
"[",
"name",
"]",
"if",
"(",
"attr",
")",
"{",
"// set undefined values to null",
"if",
"(",
"this",
".",
"attributes",
"[",
"name",
"]",
"===",
"undefin... | Get an attributes.
@class Record
@method get
@param {string} name - The attributes name
@return {VALUE} | [
"Get",
"an",
"attributes",
"."
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/attributes.js#L348-L361 | |
9,574 | PhilWaldmann/openrecord | lib/base/attributes.js | function() {
this.checkObjectChanges()
var tmp = {}
for (var name in this.changes) {
if (this.changes.hasOwnProperty(name)) {
if (
!this.allowed_attributes ||
(this.allowed_attributes &&
this.allowed_attributes.indexOf(name) !== -1)
) {
tmp[nam... | javascript | function() {
this.checkObjectChanges()
var tmp = {}
for (var name in this.changes) {
if (this.changes.hasOwnProperty(name)) {
if (
!this.allowed_attributes ||
(this.allowed_attributes &&
this.allowed_attributes.indexOf(name) !== -1)
) {
tmp[nam... | [
"function",
"(",
")",
"{",
"this",
".",
"checkObjectChanges",
"(",
")",
"var",
"tmp",
"=",
"{",
"}",
"for",
"(",
"var",
"name",
"in",
"this",
".",
"changes",
")",
"{",
"if",
"(",
"this",
".",
"changes",
".",
"hasOwnProperty",
"(",
"name",
")",
")",... | Returns an object with all the changes. One attribute will always include the original and current value
@class Record
@method getChanges
@return {object} | [
"Returns",
"an",
"object",
"with",
"all",
"the",
"changes",
".",
"One",
"attribute",
"will",
"always",
"include",
"the",
"original",
"and",
"current",
"value"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/attributes.js#L397-L412 | |
9,575 | PhilWaldmann/openrecord | lib/base/attributes.js | function() {
for (var name in this.changes) {
if (this.changes.hasOwnProperty(name)) {
this.attributes[name] = this.changes[name][0]
}
}
this.changes = {}
return this
} | javascript | function() {
for (var name in this.changes) {
if (this.changes.hasOwnProperty(name)) {
this.attributes[name] = this.changes[name][0]
}
}
this.changes = {}
return this
} | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"name",
"in",
"this",
".",
"changes",
")",
"{",
"if",
"(",
"this",
".",
"changes",
".",
"hasOwnProperty",
"(",
"name",
")",
")",
"{",
"this",
".",
"attributes",
"[",
"name",
"]",
"=",
"this",
".",
"ch... | Resets all changes to the original values
@class Record
@method resetChanges
@return {Record} | [
"Resets",
"all",
"changes",
"to",
"the",
"original",
"values"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/attributes.js#L447-L456 | |
9,576 | PhilWaldmann/openrecord | lib/base/conditions.js | function() {
const Utils = this.definition.store.utils
const self = this.chain()._unresolve() // if the collection is already resolved, return a unresolved and empty copy!
const existingConditions = self.getInternal('conditions') || []
const existingMap = {}
existingConditions.forEach(function(con... | javascript | function() {
const Utils = this.definition.store.utils
const self = this.chain()._unresolve() // if the collection is already resolved, return a unresolved and empty copy!
const existingConditions = self.getInternal('conditions') || []
const existingMap = {}
existingConditions.forEach(function(con... | [
"function",
"(",
")",
"{",
"const",
"Utils",
"=",
"this",
".",
"definition",
".",
"store",
".",
"utils",
"const",
"self",
"=",
"this",
".",
"chain",
"(",
")",
".",
"_unresolve",
"(",
")",
"// if the collection is already resolved, return a unresolved and empty cop... | Set some conditions
@public
@memberof Model
@method where
@param {(object|array)} conditions - every key-value pair will be translated into a condition
@return {Model} | [
"Set",
"some",
"conditions"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/conditions.js#L97-L165 | |
9,577 | PhilWaldmann/openrecord | lib/base/exec.js | function(resolve) {
var self = this.chain()
// if .find(null) was called
if (self.getInternal('exec_null')) {
return Promise.resolve(null)
}
var relation = self.getInternal('relation')
if (relation && typeof relation.loadWithCollection === 'function') {
const promise = relation.lo... | javascript | function(resolve) {
var self = this.chain()
// if .find(null) was called
if (self.getInternal('exec_null')) {
return Promise.resolve(null)
}
var relation = self.getInternal('relation')
if (relation && typeof relation.loadWithCollection === 'function') {
const promise = relation.lo... | [
"function",
"(",
"resolve",
")",
"{",
"var",
"self",
"=",
"this",
".",
"chain",
"(",
")",
"// if .find(null) was called",
"if",
"(",
"self",
".",
"getInternal",
"(",
"'exec_null'",
")",
")",
"{",
"return",
"Promise",
".",
"resolve",
"(",
"null",
")",
"}"... | Executes the find
@class Model
@method exec
@callback
@param {array|object} result - Either a Collection of records or a single Record
@this Collection | [
"Executes",
"the",
"find"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/exec.js#L12-L47 | |
9,578 | PhilWaldmann/openrecord | lib/base/validations.js | function() {
var self = this
var validations = []
return self
.callInterceptors('beforeValidation', [self])
.then(function() {
for (var field in self.definition.validations) {
var fieldValidations = self.definition.validations[field]
// set the scope of all validato... | javascript | function() {
var self = this
var validations = []
return self
.callInterceptors('beforeValidation', [self])
.then(function() {
for (var field in self.definition.validations) {
var fieldValidations = self.definition.validations[field]
// set the scope of all validato... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
"var",
"validations",
"=",
"[",
"]",
"return",
"self",
".",
"callInterceptors",
"(",
"'beforeValidation'",
",",
"[",
"self",
"]",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"for",
"(",
"va... | validates the record
@class Record
@method validate
@this Promise | [
"validates",
"the",
"record"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/validations.js#L296-L322 | |
9,579 | PhilWaldmann/openrecord | lib/base/validations.js | function(resolve) {
var self = this
return this.validate()
.then(function() {
return true
})
.catch(function(error) {
if (error instanceof self.store.ValidationError) return false
throw error
})
.then(resolve)
} | javascript | function(resolve) {
var self = this
return this.validate()
.then(function() {
return true
})
.catch(function(error) {
if (error instanceof self.store.ValidationError) return false
throw error
})
.then(resolve)
} | [
"function",
"(",
"resolve",
")",
"{",
"var",
"self",
"=",
"this",
"return",
"this",
".",
"validate",
"(",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"true",
"}",
")",
".",
"catch",
"(",
"function",
"(",
"error",
")",
"{",
"if",
"... | validates the record and returns true or false
@class Record
@method validate
@this Promise | [
"validates",
"the",
"record",
"and",
"returns",
"true",
"or",
"false"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/validations.js#L332-L343 | |
9,580 | PhilWaldmann/openrecord | lib/stores/sql/destroy.js | function(options) {
const Store = require('../../store')
var self = this
var primaryKeys = this.definition.primaryKeys
var condition = {}
options = options || {}
for (var i = 0; i < primaryKeys.length; i++) {
condition[primaryKeys[i]] = this[primaryKeys[i]]
}
return self.store.... | javascript | function(options) {
const Store = require('../../store')
var self = this
var primaryKeys = this.definition.primaryKeys
var condition = {}
options = options || {}
for (var i = 0; i < primaryKeys.length; i++) {
condition[primaryKeys[i]] = this[primaryKeys[i]]
}
return self.store.... | [
"function",
"(",
"options",
")",
"{",
"const",
"Store",
"=",
"require",
"(",
"'../../store'",
")",
"var",
"self",
"=",
"this",
"var",
"primaryKeys",
"=",
"this",
".",
"definition",
".",
"primaryKeys",
"var",
"condition",
"=",
"{",
"}",
"options",
"=",
"o... | Destroy a record
@class Record
@method destroy
@return {Record} | [
"Destroy",
"a",
"record"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/stores/sql/destroy.js#L16-L54 | |
9,581 | PhilWaldmann/openrecord | lib/base/collection.js | function(data, options) {
var self = this
if (Array.isArray(data)) {
return this.chain()
.add(data)
.save()
}
return this.runScopes().then(function() {
return self.new(data).save(options)
})
} | javascript | function(data, options) {
var self = this
if (Array.isArray(data)) {
return this.chain()
.add(data)
.save()
}
return this.runScopes().then(function() {
return self.new(data).save(options)
})
} | [
"function",
"(",
"data",
",",
"options",
")",
"{",
"var",
"self",
"=",
"this",
"if",
"(",
"Array",
".",
"isArray",
"(",
"data",
")",
")",
"{",
"return",
"this",
".",
"chain",
"(",
")",
".",
"add",
"(",
"data",
")",
".",
"save",
"(",
")",
"}",
... | Creates a new record and saves it
@class Model
@method create
@param {object} data - The data of the new record | [
"Creates",
"a",
"new",
"record",
"and",
"saves",
"it"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/collection.js#L54-L65 | |
9,582 | PhilWaldmann/openrecord | lib/base/collection.js | function(index) {
var self = this.chain()
if (typeof index !== 'number') {
index = self.indexOf(index)
}
const record = self[index]
var relation = self.getInternal('relation')
var parentRecord = self.getInternal('relation_to')
if (
record &&
relation &&
parentRecor... | javascript | function(index) {
var self = this.chain()
if (typeof index !== 'number') {
index = self.indexOf(index)
}
const record = self[index]
var relation = self.getInternal('relation')
var parentRecord = self.getInternal('relation_to')
if (
record &&
relation &&
parentRecor... | [
"function",
"(",
"index",
")",
"{",
"var",
"self",
"=",
"this",
".",
"chain",
"(",
")",
"if",
"(",
"typeof",
"index",
"!==",
"'number'",
")",
"{",
"index",
"=",
"self",
".",
"indexOf",
"(",
"index",
")",
"}",
"const",
"record",
"=",
"self",
"[",
... | Removes a Record from the Collection
@class Collection
@method remove
@param {integer} index - Removes the Record on the given index
@or
@param {Record} record - Removes given Record from the Collection
@return {Collection} | [
"Removes",
"a",
"Record",
"from",
"the",
"Collection"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/base/collection.js#L282-L305 | |
9,583 | PhilWaldmann/openrecord | lib/stores/sql/save.js | save | function save(options) {
const self = this
options = options || {}
if (self.options.polymorph) return this.callParent(options)
return Promise.all(
this.map(function(record) {
// validate all records at once.
return record.validate()
})
)
.then(function() {
... | javascript | function save(options) {
const self = this
options = options || {}
if (self.options.polymorph) return this.callParent(options)
return Promise.all(
this.map(function(record) {
// validate all records at once.
return record.validate()
})
)
.then(function() {
... | [
"function",
"save",
"(",
"options",
")",
"{",
"const",
"self",
"=",
"this",
"options",
"=",
"options",
"||",
"{",
"}",
"if",
"(",
"self",
".",
"options",
".",
"polymorph",
")",
"return",
"this",
".",
"callParent",
"(",
"options",
")",
"return",
"Promis... | create multiple records at once | [
"create",
"multiple",
"records",
"at",
"once"
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/stores/sql/save.js#L217-L247 |
9,584 | PhilWaldmann/openrecord | lib/definition.js | function(store, modelName) {
this.store = store
this.modelName = modelName
this.model = null
this.middleware = []
this.instanceMethods = {}
this.staticMethods = {}
events.EventEmitter.call(this)
} | javascript | function(store, modelName) {
this.store = store
this.modelName = modelName
this.model = null
this.middleware = []
this.instanceMethods = {}
this.staticMethods = {}
events.EventEmitter.call(this)
} | [
"function",
"(",
"store",
",",
"modelName",
")",
"{",
"this",
".",
"store",
"=",
"store",
"this",
".",
"modelName",
"=",
"modelName",
"this",
".",
"model",
"=",
"null",
"this",
".",
"middleware",
"=",
"[",
"]",
"this",
".",
"instanceMethods",
"=",
"{",... | There are two ways to define a model.
```js
var store = new OpenRecord({
//my store config
})
store.model('MyModel', function(){
//model definition scope
});
```
or via the `models` config option:
```js
var store = new OpenRecord({
//my store config
models: __dirname + '/models/*'
});
```
```js
// ./models/mymodel... | [
"There",
"are",
"two",
"ways",
"to",
"define",
"a",
"model",
"."
] | 779fdfcd8c7d2e7dba5429938d6847eeaefd20a5 | https://github.com/PhilWaldmann/openrecord/blob/779fdfcd8c7d2e7dba5429938d6847eeaefd20a5/lib/definition.js#L66-L77 | |
9,585 | pixijs/pixi-filters | tools/screenshots/renderer.js | nextAnim | function nextAnim() {
const anim = config.animations[++index];
if (anim) {
const encoder = new GIFEncoder(app.view.width, app.view.height);
// Stream output
encoder.createReadStream().pipe(fs.createWriteStream(
path.join(outputPath, anim.filename + '.gif')
));
... | javascript | function nextAnim() {
const anim = config.animations[++index];
if (anim) {
const encoder = new GIFEncoder(app.view.width, app.view.height);
// Stream output
encoder.createReadStream().pipe(fs.createWriteStream(
path.join(outputPath, anim.filename + '.gif')
));
... | [
"function",
"nextAnim",
"(",
")",
"{",
"const",
"anim",
"=",
"config",
".",
"animations",
"[",
"++",
"index",
"]",
";",
"if",
"(",
"anim",
")",
"{",
"const",
"encoder",
"=",
"new",
"GIFEncoder",
"(",
"app",
".",
"view",
".",
"width",
",",
"app",
".... | Combine a bunch of frames | [
"Combine",
"a",
"bunch",
"of",
"frames"
] | caeac3f2ff85077befaeb18990e7fede6defc61e | https://github.com/pixijs/pixi-filters/blob/caeac3f2ff85077befaeb18990e7fede6defc61e/tools/screenshots/renderer.js#L131-L161 |
9,586 | pixijs/pixi-filters | rollup.config.js | dedupeDefaultVert | function dedupeDefaultVert() {
const defaultVert = path.join(__dirname, 'tools/fragments/default.vert');
const fragment = fs.readFileSync(defaultVert, 'utf8')
.replace(/\n/g, '\\\\n')
.replace(/([()*=.])/g, '\\$1');
const pattern = new RegExp(`(var ([^=\\s]+)\\s?=\\s?)"${fragment}"`, 'g');
... | javascript | function dedupeDefaultVert() {
const defaultVert = path.join(__dirname, 'tools/fragments/default.vert');
const fragment = fs.readFileSync(defaultVert, 'utf8')
.replace(/\n/g, '\\\\n')
.replace(/([()*=.])/g, '\\$1');
const pattern = new RegExp(`(var ([^=\\s]+)\\s?=\\s?)"${fragment}"`, 'g');
... | [
"function",
"dedupeDefaultVert",
"(",
")",
"{",
"const",
"defaultVert",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'tools/fragments/default.vert'",
")",
";",
"const",
"fragment",
"=",
"fs",
".",
"readFileSync",
"(",
"defaultVert",
",",
"'utf8'",
")",
".... | This plugin is a filesize optimization for the pixi-filters bundle
it removes all the successive occurances of the default vertex fragment
and reassigns the name of the vertex variable
@function dedupeDefaultVert
@private | [
"This",
"plugin",
"is",
"a",
"filesize",
"optimization",
"for",
"the",
"pixi",
"-",
"filters",
"bundle",
"it",
"removes",
"all",
"the",
"successive",
"occurances",
"of",
"the",
"default",
"vertex",
"fragment",
"and",
"reassigns",
"the",
"name",
"of",
"the",
... | caeac3f2ff85077befaeb18990e7fede6defc61e | https://github.com/pixijs/pixi-filters/blob/caeac3f2ff85077befaeb18990e7fede6defc61e/rollup.config.js#L21-L63 |
9,587 | pixijs/pixi-filters | rollup.config.js | getSortedPackages | async function getSortedPackages() {
// Support --scope and --ignore globs
const {scope, ignore} = minimist(process.argv.slice(2));
// Standard Lerna plumbing getting packages
const packages = await getPackages(__dirname);
const filtered = filterPackages(
packages,
scope,
ig... | javascript | async function getSortedPackages() {
// Support --scope and --ignore globs
const {scope, ignore} = minimist(process.argv.slice(2));
// Standard Lerna plumbing getting packages
const packages = await getPackages(__dirname);
const filtered = filterPackages(
packages,
scope,
ig... | [
"async",
"function",
"getSortedPackages",
"(",
")",
"{",
"// Support --scope and --ignore globs",
"const",
"{",
"scope",
",",
"ignore",
"}",
"=",
"minimist",
"(",
"process",
".",
"argv",
".",
"slice",
"(",
"2",
")",
")",
";",
"// Standard Lerna plumbing getting pa... | Get a list of the non-private sorted packages with Lerna v3
@see https://github.com/lerna/lerna/issues/1848
@return {Promise<Package[]>} List of packages | [
"Get",
"a",
"list",
"of",
"the",
"non",
"-",
"private",
"sorted",
"packages",
"with",
"Lerna",
"v3"
] | caeac3f2ff85077befaeb18990e7fede6defc61e | https://github.com/pixijs/pixi-filters/blob/caeac3f2ff85077befaeb18990e7fede6defc61e/rollup.config.js#L70-L85 |
9,588 | 3rd-Eden/useragent | index.js | Agent | function Agent(family, major, minor, patch, source) {
this.family = family || 'Other';
this.major = major || '0';
this.minor = minor || '0';
this.patch = patch || '0';
this.source = source || '';
} | javascript | function Agent(family, major, minor, patch, source) {
this.family = family || 'Other';
this.major = major || '0';
this.minor = minor || '0';
this.patch = patch || '0';
this.source = source || '';
} | [
"function",
"Agent",
"(",
"family",
",",
"major",
",",
"minor",
",",
"patch",
",",
"source",
")",
"{",
"this",
".",
"family",
"=",
"family",
"||",
"'Other'",
";",
"this",
".",
"major",
"=",
"major",
"||",
"'0'",
";",
"this",
".",
"minor",
"=",
"min... | The representation of a parsed user agent.
@constructor
@param {String} family The name of the browser
@param {String} major Major version of the browser
@param {String} minor Minor version of the browser
@param {String} patch Patch version of the browser
@param {String} source The actual user agent string
@api public | [
"The",
"representation",
"of",
"a",
"parsed",
"user",
"agent",
"."
] | 187c17255028bd30d82e3af108846ce73a8197fb | https://github.com/3rd-Eden/useragent/blob/187c17255028bd30d82e3af108846ce73a8197fb/index.js#L34-L40 |
9,589 | 3rd-Eden/useragent | index.js | set | function set(os) {
if (!(os instanceof OperatingSystem)) return false;
return Object.defineProperty(this, 'os', {
value: os
}).os;
} | javascript | function set(os) {
if (!(os instanceof OperatingSystem)) return false;
return Object.defineProperty(this, 'os', {
value: os
}).os;
} | [
"function",
"set",
"(",
"os",
")",
"{",
"if",
"(",
"!",
"(",
"os",
"instanceof",
"OperatingSystem",
")",
")",
"return",
"false",
";",
"return",
"Object",
".",
"defineProperty",
"(",
"this",
",",
"'os'",
",",
"{",
"value",
":",
"os",
"}",
")",
".",
... | Bypass the OnDemand parsing and set an OperatingSystem instance.
@param {OperatingSystem} os
@api public | [
"Bypass",
"the",
"OnDemand",
"parsing",
"and",
"set",
"an",
"OperatingSystem",
"instance",
"."
] | 187c17255028bd30d82e3af108846ce73a8197fb | https://github.com/3rd-Eden/useragent/blob/187c17255028bd30d82e3af108846ce73a8197fb/index.js#L84-L90 |
9,590 | 3rd-Eden/useragent | index.js | set | function set(device) {
if (!(device instanceof Device)) return false;
return Object.defineProperty(this, 'device', {
value: device
}).device;
} | javascript | function set(device) {
if (!(device instanceof Device)) return false;
return Object.defineProperty(this, 'device', {
value: device
}).device;
} | [
"function",
"set",
"(",
"device",
")",
"{",
"if",
"(",
"!",
"(",
"device",
"instanceof",
"Device",
")",
")",
"return",
"false",
";",
"return",
"Object",
".",
"defineProperty",
"(",
"this",
",",
"'device'",
",",
"{",
"value",
":",
"device",
"}",
")",
... | Bypass the OnDemand parsing and set an Device instance.
@param {Device} device
@api public | [
"Bypass",
"the",
"OnDemand",
"parsing",
"and",
"set",
"an",
"Device",
"instance",
"."
] | 187c17255028bd30d82e3af108846ce73a8197fb | https://github.com/3rd-Eden/useragent/blob/187c17255028bd30d82e3af108846ce73a8197fb/index.js#L135-L141 |
9,591 | 3rd-Eden/useragent | index.js | OperatingSystem | function OperatingSystem(family, major, minor, patch) {
this.family = family || 'Other';
this.major = major || '0';
this.minor = minor || '0';
this.patch = patch || '0';
} | javascript | function OperatingSystem(family, major, minor, patch) {
this.family = family || 'Other';
this.major = major || '0';
this.minor = minor || '0';
this.patch = patch || '0';
} | [
"function",
"OperatingSystem",
"(",
"family",
",",
"major",
",",
"minor",
",",
"patch",
")",
"{",
"this",
".",
"family",
"=",
"family",
"||",
"'Other'",
";",
"this",
".",
"major",
"=",
"major",
"||",
"'0'",
";",
"this",
".",
"minor",
"=",
"minor",
"|... | The representation of a parsed Operating System.
@constructor
@param {String} family The name of the os
@param {String} major Major version of the os
@param {String} minor Minor version of the os
@param {String} patch Patch version of the os
@api public | [
"The",
"representation",
"of",
"a",
"parsed",
"Operating",
"System",
"."
] | 187c17255028bd30d82e3af108846ce73a8197fb | https://github.com/3rd-Eden/useragent/blob/187c17255028bd30d82e3af108846ce73a8197fb/index.js#L222-L227 |
9,592 | 3rd-Eden/useragent | index.js | Device | function Device(family, major, minor, patch) {
this.family = family || 'Other';
this.major = major || '0';
this.minor = minor || '0';
this.patch = patch || '0';
} | javascript | function Device(family, major, minor, patch) {
this.family = family || 'Other';
this.major = major || '0';
this.minor = minor || '0';
this.patch = patch || '0';
} | [
"function",
"Device",
"(",
"family",
",",
"major",
",",
"minor",
",",
"patch",
")",
"{",
"this",
".",
"family",
"=",
"family",
"||",
"'Other'",
";",
"this",
".",
"major",
"=",
"major",
"||",
"'0'",
";",
"this",
".",
"minor",
"=",
"minor",
"||",
"'0... | The representation of a parsed Device.
@constructor
@param {String} family The name of the device
@param {String} major Major version of the device
@param {String} minor Minor version of the device
@param {String} patch Patch version of the device
@api public | [
"The",
"representation",
"of",
"a",
"parsed",
"Device",
"."
] | 187c17255028bd30d82e3af108846ce73a8197fb | https://github.com/3rd-Eden/useragent/blob/187c17255028bd30d82e3af108846ce73a8197fb/index.js#L295-L300 |
9,593 | 3rd-Eden/useragent | index.js | isSafe | function isSafe(userAgent) {
var consecutive = 0
, code = 0;
if (userAgent.length > 1000) return false;
for (var i = 0; i < userAgent.length; i++) {
code = userAgent.charCodeAt(i);
// numbers between 0 and 9, letters between a and z, spaces and control
if ((code >= 48 && code <= 57) || (code >= ... | javascript | function isSafe(userAgent) {
var consecutive = 0
, code = 0;
if (userAgent.length > 1000) return false;
for (var i = 0; i < userAgent.length; i++) {
code = userAgent.charCodeAt(i);
// numbers between 0 and 9, letters between a and z, spaces and control
if ((code >= 48 && code <= 57) || (code >= ... | [
"function",
"isSafe",
"(",
"userAgent",
")",
"{",
"var",
"consecutive",
"=",
"0",
",",
"code",
"=",
"0",
";",
"if",
"(",
"userAgent",
".",
"length",
">",
"1000",
")",
"return",
"false",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"userA... | Check if the userAgent is something we want to parse with regexp's.
@param {String} userAgent The userAgent.
@returns {Boolean} | [
"Check",
"if",
"the",
"userAgent",
"is",
"something",
"we",
"want",
"to",
"parse",
"with",
"regexp",
"s",
"."
] | 187c17255028bd30d82e3af108846ce73a8197fb | https://github.com/3rd-Eden/useragent/blob/187c17255028bd30d82e3af108846ce73a8197fb/index.js#L414-L435 |
9,594 | aws/aws-xray-sdk-node | packages/core/lib/segments/attributes/aws.js | setAWSWhitelist | function setAWSWhitelist(source) {
if (!source || source instanceof String || !(typeof source === 'string' || (source instanceof Object)))
throw new Error('Please specify a path to the local whitelist file, or supply a whitelist source object.');
capturer = new CallCapturer(source);
} | javascript | function setAWSWhitelist(source) {
if (!source || source instanceof String || !(typeof source === 'string' || (source instanceof Object)))
throw new Error('Please specify a path to the local whitelist file, or supply a whitelist source object.');
capturer = new CallCapturer(source);
} | [
"function",
"setAWSWhitelist",
"(",
"source",
")",
"{",
"if",
"(",
"!",
"source",
"||",
"source",
"instanceof",
"String",
"||",
"!",
"(",
"typeof",
"source",
"===",
"'string'",
"||",
"(",
"source",
"instanceof",
"Object",
")",
")",
")",
"throw",
"new",
"... | Overrides the default whitelisting file to specify what params to capture on each AWS Service call.
@param {string|Object} source - The path to the custom whitelist file, or a whitelist source JSON object.
@exports setAWSWhitelist | [
"Overrides",
"the",
"default",
"whitelisting",
"file",
"to",
"specify",
"what",
"params",
"to",
"capture",
"on",
"each",
"AWS",
"Service",
"call",
"."
] | ad817e5ccfbb803ec4140cd8a457be579ea3cc1c | https://github.com/aws/aws-xray-sdk-node/blob/ad817e5ccfbb803ec4140cd8a457be579ea3cc1c/packages/core/lib/segments/attributes/aws.js#L42-L47 |
9,595 | aws/aws-xray-sdk-node | packages/core/lib/segments/attributes/aws.js | appendAWSWhitelist | function appendAWSWhitelist(source) {
if (!source || source instanceof String || !(typeof source === 'string' || (source instanceof Object)))
throw new Error('Please specify a path to the local whitelist file, or supply a whitelist source object.');
capturer.append(source);
} | javascript | function appendAWSWhitelist(source) {
if (!source || source instanceof String || !(typeof source === 'string' || (source instanceof Object)))
throw new Error('Please specify a path to the local whitelist file, or supply a whitelist source object.');
capturer.append(source);
} | [
"function",
"appendAWSWhitelist",
"(",
"source",
")",
"{",
"if",
"(",
"!",
"source",
"||",
"source",
"instanceof",
"String",
"||",
"!",
"(",
"typeof",
"source",
"===",
"'string'",
"||",
"(",
"source",
"instanceof",
"Object",
")",
")",
")",
"throw",
"new",
... | Appends to the default whitelisting file to specify what params to capture on each AWS Service call.
@param {string|Object} source - The path to the custom whitelist file, or a whitelist source JSON object.
@exports appendAWSWhitelist | [
"Appends",
"to",
"the",
"default",
"whitelisting",
"file",
"to",
"specify",
"what",
"params",
"to",
"capture",
"on",
"each",
"AWS",
"Service",
"call",
"."
] | ad817e5ccfbb803ec4140cd8a457be579ea3cc1c | https://github.com/aws/aws-xray-sdk-node/blob/ad817e5ccfbb803ec4140cd8a457be579ea3cc1c/packages/core/lib/segments/attributes/aws.js#L55-L60 |
9,596 | aws/aws-xray-sdk-node | packages/core/lib/segment_emitter.js | batchSendData | function batchSendData (ops, callback) {
var client = dgram.createSocket('udp4');
executeSendData(client, ops, 0, function () {
try {
client.close();
} finally {
callback();
}
});
} | javascript | function batchSendData (ops, callback) {
var client = dgram.createSocket('udp4');
executeSendData(client, ops, 0, function () {
try {
client.close();
} finally {
callback();
}
});
} | [
"function",
"batchSendData",
"(",
"ops",
",",
"callback",
")",
"{",
"var",
"client",
"=",
"dgram",
".",
"createSocket",
"(",
"'udp4'",
")",
";",
"executeSendData",
"(",
"client",
",",
"ops",
",",
"0",
",",
"function",
"(",
")",
"{",
"try",
"{",
"client... | Sends a collection of data over a UDP socket. This method
is designed to be used by `atomic-batcher` as a way to share
a single UDP socket for sending multiple data blocks.
@param {object} ops - Details of the data to send
@param {Function} callback - The function to call when done | [
"Sends",
"a",
"collection",
"of",
"data",
"over",
"a",
"UDP",
"socket",
".",
"This",
"method",
"is",
"designed",
"to",
"be",
"used",
"by",
"atomic",
"-",
"batcher",
"as",
"a",
"way",
"to",
"share",
"a",
"single",
"UDP",
"socket",
"for",
"sending",
"mul... | ad817e5ccfbb803ec4140cd8a457be579ea3cc1c | https://github.com/aws/aws-xray-sdk-node/blob/ad817e5ccfbb803ec4140cd8a457be579ea3cc1c/packages/core/lib/segment_emitter.js#L17-L27 |
9,597 | aws/aws-xray-sdk-node | packages/core/lib/segment_emitter.js | executeSendData | function executeSendData (client, ops, index, callback) {
if (index >= ops.length) {
callback();
return;
}
sendMessage(client, ops[index], function () {
executeSendData(client, ops, index+1, callback);
});
} | javascript | function executeSendData (client, ops, index, callback) {
if (index >= ops.length) {
callback();
return;
}
sendMessage(client, ops[index], function () {
executeSendData(client, ops, index+1, callback);
});
} | [
"function",
"executeSendData",
"(",
"client",
",",
"ops",
",",
"index",
",",
"callback",
")",
"{",
"if",
"(",
"index",
">=",
"ops",
".",
"length",
")",
"{",
"callback",
"(",
")",
";",
"return",
";",
"}",
"sendMessage",
"(",
"client",
",",
"ops",
"[",... | Execute sending data starting at the specified index and
using the provided client.
@param {Socket} client - Socket to send data with
@param {object} ops - Details of data to send
@param {number} index - Starting index for sending
@param {Function} callback - Function to call when done | [
"Execute",
"sending",
"data",
"starting",
"at",
"the",
"specified",
"index",
"and",
"using",
"the",
"provided",
"client",
"."
] | ad817e5ccfbb803ec4140cd8a457be579ea3cc1c | https://github.com/aws/aws-xray-sdk-node/blob/ad817e5ccfbb803ec4140cd8a457be579ea3cc1c/packages/core/lib/segment_emitter.js#L38-L47 |
9,598 | aws/aws-xray-sdk-node | packages/core/lib/segment_emitter.js | sendMessage | function sendMessage (client, data, batchCallback) {
var msg = data.msg;
var offset = data.offset;
var length = data.length;
var port = data.port;
var address = data.address;
var callback = data.callback;
client.send(msg, offset, length, port, address, function(err) {
try {
callback(err);
}... | javascript | function sendMessage (client, data, batchCallback) {
var msg = data.msg;
var offset = data.offset;
var length = data.length;
var port = data.port;
var address = data.address;
var callback = data.callback;
client.send(msg, offset, length, port, address, function(err) {
try {
callback(err);
}... | [
"function",
"sendMessage",
"(",
"client",
",",
"data",
",",
"batchCallback",
")",
"{",
"var",
"msg",
"=",
"data",
".",
"msg",
";",
"var",
"offset",
"=",
"data",
".",
"offset",
";",
"var",
"length",
"=",
"data",
".",
"length",
";",
"var",
"port",
"=",... | Send a single message over a UDP socket.
@param {Socket} client - Socket to send data with
@param {object} data - Details of the data to send
@param {Function} batchCallback - Function to call when done | [
"Send",
"a",
"single",
"message",
"over",
"a",
"UDP",
"socket",
"."
] | ad817e5ccfbb803ec4140cd8a457be579ea3cc1c | https://github.com/aws/aws-xray-sdk-node/blob/ad817e5ccfbb803ec4140cd8a457be579ea3cc1c/packages/core/lib/segment_emitter.js#L56-L71 |
9,599 | aws/aws-xray-sdk-node | packages/core/lib/segment_emitter.js | send | function send(segment) {
var client = this.socket;
var formatted = segment.format();
var data = PROTOCOL_HEADER + PROTOCOL_DELIMITER + formatted;
var message = new Buffer(data);
var short = '{"trace_id:"' + segment.trace_id + '","id":"' + segment.id + '"}';
var type = segment.type === 'subsegme... | javascript | function send(segment) {
var client = this.socket;
var formatted = segment.format();
var data = PROTOCOL_HEADER + PROTOCOL_DELIMITER + formatted;
var message = new Buffer(data);
var short = '{"trace_id:"' + segment.trace_id + '","id":"' + segment.id + '"}';
var type = segment.type === 'subsegme... | [
"function",
"send",
"(",
"segment",
")",
"{",
"var",
"client",
"=",
"this",
".",
"socket",
";",
"var",
"formatted",
"=",
"segment",
".",
"format",
"(",
")",
";",
"var",
"data",
"=",
"PROTOCOL_HEADER",
"+",
"PROTOCOL_DELIMITER",
"+",
"formatted",
";",
"va... | Creates a UDP socket connection and send the formatted segment.
@param {Segment} segment - The segment to send to the daemon. | [
"Creates",
"a",
"UDP",
"socket",
"connection",
"and",
"send",
"the",
"formatted",
"segment",
"."
] | ad817e5ccfbb803ec4140cd8a457be579ea3cc1c | https://github.com/aws/aws-xray-sdk-node/blob/ad817e5ccfbb803ec4140cd8a457be579ea3cc1c/packages/core/lib/segment_emitter.js#L121-L141 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.