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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
12,600 | aframevr/aframe-inspector | src/lib/entity.js | optimizeComponents | function optimizeComponents(copy, source) {
var removeAttribute = HTMLElement.prototype.removeAttribute;
var setAttribute = HTMLElement.prototype.setAttribute;
var components = source.components || {};
Object.keys(components).forEach(function(name) {
var component = components[name];
var result = getImp... | javascript | function optimizeComponents(copy, source) {
var removeAttribute = HTMLElement.prototype.removeAttribute;
var setAttribute = HTMLElement.prototype.setAttribute;
var components = source.components || {};
Object.keys(components).forEach(function(name) {
var component = components[name];
var result = getImp... | [
"function",
"optimizeComponents",
"(",
"copy",
",",
"source",
")",
"{",
"var",
"removeAttribute",
"=",
"HTMLElement",
".",
"prototype",
".",
"removeAttribute",
";",
"var",
"setAttribute",
"=",
"HTMLElement",
".",
"prototype",
".",
"setAttribute",
";",
"var",
"co... | Removes from copy those components or components' properties that comes from
primitive attributes, mixins, injected default components or schema defaults.
@param {Element} copy Destinatary element for the optimization.
@param {Element} source Element to be optimized. | [
"Removes",
"from",
"copy",
"those",
"components",
"or",
"components",
"properties",
"that",
"comes",
"from",
"primitive",
"attributes",
"mixins",
"injected",
"default",
"components",
"or",
"schema",
"defaults",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L196-L220 |
12,601 | aframevr/aframe-inspector | src/lib/entity.js | getImplicitValue | function getImplicitValue(component, source) {
var isInherited = false;
var value = (isSingleProperty(component.schema) ? _single : _multi)();
return [value, isInherited];
function _single() {
var value = getMixedValue(component, null, source);
if (value === undefined) {
value = getInjectedValue(... | javascript | function getImplicitValue(component, source) {
var isInherited = false;
var value = (isSingleProperty(component.schema) ? _single : _multi)();
return [value, isInherited];
function _single() {
var value = getMixedValue(component, null, source);
if (value === undefined) {
value = getInjectedValue(... | [
"function",
"getImplicitValue",
"(",
"component",
",",
"source",
")",
"{",
"var",
"isInherited",
"=",
"false",
";",
"var",
"value",
"=",
"(",
"isSingleProperty",
"(",
"component",
".",
"schema",
")",
"?",
"_single",
":",
"_multi",
")",
"(",
")",
";",
"re... | Computes the value for a component coming from primitive attributes,
mixins, primitive defaults, a-frame default components and schema defaults.
In this specific order.
In other words, it is the value of the component if the author would have not
overridden it explicitly.
@param {Component} component Component to cal... | [
"Computes",
"the",
"value",
"for",
"a",
"component",
"coming",
"from",
"primitive",
"attributes",
"mixins",
"primitive",
"defaults",
"a",
"-",
"frame",
"default",
"components",
"and",
"schema",
"defaults",
".",
"In",
"this",
"specific",
"order",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L262-L310 |
12,602 | aframevr/aframe-inspector | src/lib/entity.js | getFromAttribute | function getFromAttribute(component, propertyName, source) {
var value;
var mappings = source.mappings || {};
var route = component.name + '.' + propertyName;
var primitiveAttribute = findAttribute(mappings, route);
if (primitiveAttribute && source.hasAttribute(primitiveAttribute)) {
value = source.getAtt... | javascript | function getFromAttribute(component, propertyName, source) {
var value;
var mappings = source.mappings || {};
var route = component.name + '.' + propertyName;
var primitiveAttribute = findAttribute(mappings, route);
if (primitiveAttribute && source.hasAttribute(primitiveAttribute)) {
value = source.getAtt... | [
"function",
"getFromAttribute",
"(",
"component",
",",
"propertyName",
",",
"source",
")",
"{",
"var",
"value",
";",
"var",
"mappings",
"=",
"source",
".",
"mappings",
"||",
"{",
"}",
";",
"var",
"route",
"=",
"component",
".",
"name",
"+",
"'.'",
"+",
... | Gets the value for the component's property coming from a primitive
attribute.
Primitives have mappings from attributes to component's properties.
The function looks for a present attribute in the source element which
maps to the specified component's property.
@param {Component} component Component to be found.
... | [
"Gets",
"the",
"value",
"for",
"the",
"component",
"s",
"property",
"coming",
"from",
"a",
"primitive",
"attribute",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L327-L347 |
12,603 | aframevr/aframe-inspector | src/lib/entity.js | getMixedValue | function getMixedValue(component, propertyName, source) {
var value;
var reversedMixins = source.mixinEls.reverse();
for (var i = 0; value === undefined && i < reversedMixins.length; i++) {
var mixin = reversedMixins[i];
if (mixin.attributes.hasOwnProperty(component.name)) {
if (!propertyName) {
... | javascript | function getMixedValue(component, propertyName, source) {
var value;
var reversedMixins = source.mixinEls.reverse();
for (var i = 0; value === undefined && i < reversedMixins.length; i++) {
var mixin = reversedMixins[i];
if (mixin.attributes.hasOwnProperty(component.name)) {
if (!propertyName) {
... | [
"function",
"getMixedValue",
"(",
"component",
",",
"propertyName",
",",
"source",
")",
"{",
"var",
"value",
";",
"var",
"reversedMixins",
"=",
"source",
".",
"mixinEls",
".",
"reverse",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"value",
"=... | Gets the value for a component or component's property coming from mixins of
an element.
If the component or component's property is not provided by mixins, the
functions will return `undefined`.
@param {Component} component Component to be found.
@param {string} [propertyName] If provided, component's proper... | [
"Gets",
"the",
"value",
"for",
"a",
"component",
"or",
"component",
"s",
"property",
"coming",
"from",
"mixins",
"of",
"an",
"element",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L363-L377 |
12,604 | aframevr/aframe-inspector | src/lib/entity.js | getInjectedValue | function getInjectedValue(component, propertyName, source) {
var value;
var primitiveDefaults = source.defaultComponentsFromPrimitive || {};
var aFrameDefaults = source.defaultComponents || {};
var defaultSources = [primitiveDefaults, aFrameDefaults];
for (var i = 0; value === undefined && i < defaultSources.... | javascript | function getInjectedValue(component, propertyName, source) {
var value;
var primitiveDefaults = source.defaultComponentsFromPrimitive || {};
var aFrameDefaults = source.defaultComponents || {};
var defaultSources = [primitiveDefaults, aFrameDefaults];
for (var i = 0; value === undefined && i < defaultSources.... | [
"function",
"getInjectedValue",
"(",
"component",
",",
"propertyName",
",",
"source",
")",
"{",
"var",
"value",
";",
"var",
"primitiveDefaults",
"=",
"source",
".",
"defaultComponentsFromPrimitive",
"||",
"{",
"}",
";",
"var",
"aFrameDefaults",
"=",
"source",
".... | Gets the value for a component or component's property coming from primitive
defaults or a-frame defaults. In this specific order.
@param {Component} component Component to be found.
@param {string} [propertyName] If provided, component's property to be
found.
@param {Element} source Element owning t... | [
"Gets",
"the",
"value",
"for",
"a",
"component",
"or",
"component",
"s",
"property",
"coming",
"from",
"primitive",
"defaults",
"or",
"a",
"-",
"frame",
"defaults",
".",
"In",
"this",
"specific",
"order",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L390-L406 |
12,605 | aframevr/aframe-inspector | src/lib/entity.js | getDefaultValue | function getDefaultValue(component, propertyName, source) {
if (!propertyName) {
return component.schema.default;
}
return component.schema[propertyName].default;
} | javascript | function getDefaultValue(component, propertyName, source) {
if (!propertyName) {
return component.schema.default;
}
return component.schema[propertyName].default;
} | [
"function",
"getDefaultValue",
"(",
"component",
",",
"propertyName",
",",
"source",
")",
"{",
"if",
"(",
"!",
"propertyName",
")",
"{",
"return",
"component",
".",
"schema",
".",
"default",
";",
"}",
"return",
"component",
".",
"schema",
"[",
"propertyName"... | Gets the value for a component or component's property coming from schema
defaults.
@param {Component} component Component to be found.
@param {string} [propertyName] If provided, component's property to be
found.
@param {Element} source Element owning the component.
@return ... | [
"Gets",
"the",
"value",
"for",
"a",
"component",
"or",
"component",
"s",
"property",
"coming",
"from",
"schema",
"defaults",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L419-L424 |
12,606 | aframevr/aframe-inspector | src/lib/entity.js | getOptimalUpdate | function getOptimalUpdate(component, implicit, reference) {
if (equal(implicit, reference)) {
return null;
}
if (isSingleProperty(component.schema)) {
return reference;
}
var optimal = {};
Object.keys(reference).forEach(function(key) {
var needsUpdate = !equal(reference[key], implicit[key]);
... | javascript | function getOptimalUpdate(component, implicit, reference) {
if (equal(implicit, reference)) {
return null;
}
if (isSingleProperty(component.schema)) {
return reference;
}
var optimal = {};
Object.keys(reference).forEach(function(key) {
var needsUpdate = !equal(reference[key], implicit[key]);
... | [
"function",
"getOptimalUpdate",
"(",
"component",
",",
"implicit",
",",
"reference",
")",
"{",
"if",
"(",
"equal",
"(",
"implicit",
",",
"reference",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"isSingleProperty",
"(",
"component",
".",
"schema",... | Returns the minimum value for a component with an implicit value to equal a
reference value. A `null` optimal value means that there is no need for an
update since the implicit value and the reference are equal.
@param {Component} component Component of the computed value.
@param {any} implicit The implicit val... | [
"Returns",
"the",
"minimum",
"value",
"for",
"a",
"component",
"with",
"an",
"implicit",
"value",
"to",
"equal",
"a",
"reference",
"value",
".",
"A",
"null",
"optimal",
"value",
"means",
"that",
"there",
"is",
"no",
"need",
"for",
"an",
"update",
"since",
... | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L437-L452 |
12,607 | aframevr/aframe-inspector | src/lib/entity.js | getUniqueId | function getUniqueId(baseId) {
if (!document.getElementById(baseId)) {
return baseId;
}
var i = 2;
// If the baseId ends with _#, it extracts the baseId removing the suffix
var groups = baseId.match(/(\w+)-(\d+)/);
if (groups) {
baseId = groups[1];
i = groups[2];
}
while (document.getEleme... | javascript | function getUniqueId(baseId) {
if (!document.getElementById(baseId)) {
return baseId;
}
var i = 2;
// If the baseId ends with _#, it extracts the baseId removing the suffix
var groups = baseId.match(/(\w+)-(\d+)/);
if (groups) {
baseId = groups[1];
i = groups[2];
}
while (document.getEleme... | [
"function",
"getUniqueId",
"(",
"baseId",
")",
"{",
"if",
"(",
"!",
"document",
".",
"getElementById",
"(",
"baseId",
")",
")",
"{",
"return",
"baseId",
";",
"}",
"var",
"i",
"=",
"2",
";",
"// If the baseId ends with _#, it extracts the baseId removing the suffix... | Detect element's Id collision and returns a valid one
@param {string} baseId Proposed Id
@return {string} Valid Id based on the proposed Id | [
"Detect",
"element",
"s",
"Id",
"collision",
"and",
"returns",
"a",
"valid",
"one"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L467-L485 |
12,608 | aframevr/aframe-inspector | src/lib/entity.js | getModifiedProperties | function getModifiedProperties(entity, componentName) {
var data = entity.components[componentName].data;
var defaultData = entity.components[componentName].schema;
var diff = {};
for (var key in data) {
// Prevent adding unknown attributes
if (!defaultData[key]) {
continue;
}
... | javascript | function getModifiedProperties(entity, componentName) {
var data = entity.components[componentName].data;
var defaultData = entity.components[componentName].schema;
var diff = {};
for (var key in data) {
// Prevent adding unknown attributes
if (!defaultData[key]) {
continue;
}
... | [
"function",
"getModifiedProperties",
"(",
"entity",
",",
"componentName",
")",
"{",
"var",
"data",
"=",
"entity",
".",
"components",
"[",
"componentName",
"]",
".",
"data",
";",
"var",
"defaultData",
"=",
"entity",
".",
"components",
"[",
"componentName",
"]",... | Get the list of modified properties
@param {Element} entity Entity where the component belongs
@param {string} componentName Component name
@return {object} List of modified properties with their value | [
"Get",
"the",
"list",
"of",
"modified",
"properties"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L494-L513 |
12,609 | aframevr/aframe-inspector | src/index.js | function(focusEl) {
this.opened = true;
Events.emit('inspectortoggle', true);
if (this.sceneEl.hasAttribute('embedded')) {
// Remove embedded styles, but keep track of it.
this.sceneEl.removeAttribute('embedded');
this.sceneEl.setAttribute('aframe-inspector-removed-embedded');
}
... | javascript | function(focusEl) {
this.opened = true;
Events.emit('inspectortoggle', true);
if (this.sceneEl.hasAttribute('embedded')) {
// Remove embedded styles, but keep track of it.
this.sceneEl.removeAttribute('embedded');
this.sceneEl.setAttribute('aframe-inspector-removed-embedded');
}
... | [
"function",
"(",
"focusEl",
")",
"{",
"this",
".",
"opened",
"=",
"true",
";",
"Events",
".",
"emit",
"(",
"'inspectortoggle'",
",",
"true",
")",
";",
"if",
"(",
"this",
".",
"sceneEl",
".",
"hasAttribute",
"(",
"'embedded'",
")",
")",
"{",
"// Remove ... | Open the editor UI | [
"Open",
"the",
"editor",
"UI"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/index.js#L244-L280 | |
12,610 | aframevr/aframe-inspector | src/index.js | function() {
this.opened = false;
Events.emit('inspectortoggle', false);
// Untrick scene when we enabled this to run the cursor tick.
this.sceneEl.isPlaying = false;
this.sceneEl.play();
this.cursor.pause();
if (this.sceneEl.hasAttribute('aframe-inspector-removed-embedded')) {
this... | javascript | function() {
this.opened = false;
Events.emit('inspectortoggle', false);
// Untrick scene when we enabled this to run the cursor tick.
this.sceneEl.isPlaying = false;
this.sceneEl.play();
this.cursor.pause();
if (this.sceneEl.hasAttribute('aframe-inspector-removed-embedded')) {
this... | [
"function",
"(",
")",
"{",
"this",
".",
"opened",
"=",
"false",
";",
"Events",
".",
"emit",
"(",
"'inspectortoggle'",
",",
"false",
")",
";",
"// Untrick scene when we enabled this to run the cursor tick.",
"this",
".",
"sceneEl",
".",
"isPlaying",
"=",
"false",
... | Closes the editor and gives the control back to the scene
@return {[type]} [description] | [
"Closes",
"the",
"editor",
"and",
"gives",
"the",
"control",
"back",
"to",
"the",
"scene"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/index.js#L286-L303 | |
12,611 | aframevr/aframe-inspector | src/lib/assetsLoader.js | function() {
var xhr = new XMLHttpRequest();
var url = assetsBaseUrl + assetsRelativeUrl['images'];
// @todo Remove the sync call and use a callback
xhr.open('GET', url);
xhr.onload = () => {
var data = JSON.parse(xhr.responseText);
this.images = data.images;
this.images.forEach(... | javascript | function() {
var xhr = new XMLHttpRequest();
var url = assetsBaseUrl + assetsRelativeUrl['images'];
// @todo Remove the sync call and use a callback
xhr.open('GET', url);
xhr.onload = () => {
var data = JSON.parse(xhr.responseText);
this.images = data.images;
this.images.forEach(... | [
"function",
"(",
")",
"{",
"var",
"xhr",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"var",
"url",
"=",
"assetsBaseUrl",
"+",
"assetsRelativeUrl",
"[",
"'images'",
"]",
";",
"// @todo Remove the sync call and use a callback",
"xhr",
".",
"open",
"(",
"'GET'",
... | XHR the assets JSON. | [
"XHR",
"the",
"assets",
"JSON",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/assetsLoader.js#L19-L42 | |
12,612 | aframevr/aframe-inspector | src/lib/raycaster.js | onDoubleClick | function onDoubleClick(event) {
const array = getMousePosition(
inspector.container,
event.clientX,
event.clientY
);
onDoubleClickPosition.fromArray(array);
const intersectedEl = mouseCursor.components.cursor.intersectedEl;
if (!intersectedEl) {
return;
}
Events.emit(... | javascript | function onDoubleClick(event) {
const array = getMousePosition(
inspector.container,
event.clientX,
event.clientY
);
onDoubleClickPosition.fromArray(array);
const intersectedEl = mouseCursor.components.cursor.intersectedEl;
if (!intersectedEl) {
return;
}
Events.emit(... | [
"function",
"onDoubleClick",
"(",
"event",
")",
"{",
"const",
"array",
"=",
"getMousePosition",
"(",
"inspector",
".",
"container",
",",
"event",
".",
"clientX",
",",
"event",
".",
"clientY",
")",
";",
"onDoubleClickPosition",
".",
"fromArray",
"(",
"array",
... | Focus on double click. | [
"Focus",
"on",
"double",
"click",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/raycaster.js#L127-L139 |
12,613 | aframevr/aframe-inspector | vendor/GLTFExporter.js | equalArray | function equalArray(array1, array2) {
return (
array1.length === array2.length &&
array1.every(function(element, index) {
return element === array2[index];
})
);
} | javascript | function equalArray(array1, array2) {
return (
array1.length === array2.length &&
array1.every(function(element, index) {
return element === array2[index];
})
);
} | [
"function",
"equalArray",
"(",
"array1",
",",
"array2",
")",
"{",
"return",
"(",
"array1",
".",
"length",
"===",
"array2",
".",
"length",
"&&",
"array1",
".",
"every",
"(",
"function",
"(",
"element",
",",
"index",
")",
"{",
"return",
"element",
"===",
... | Compare two arrays
Compare two arrays
@param {Array} array1 Array 1 to compare
@param {Array} array2 Array 2 to compare
@return {Boolean} Returns true if both arrays are equal | [
"Compare",
"two",
"arrays",
"Compare",
"two",
"arrays"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L115-L122 |
12,614 | aframevr/aframe-inspector | vendor/GLTFExporter.js | stringToArrayBuffer | function stringToArrayBuffer(text) {
if (window.TextEncoder !== undefined) {
return new TextEncoder().encode(text).buffer;
}
var array = new Uint8Array(new ArrayBuffer(text.length));
for (var i = 0, il = text.length; i < il; i++) {
var value = text.charCodeAt(i);
// Re... | javascript | function stringToArrayBuffer(text) {
if (window.TextEncoder !== undefined) {
return new TextEncoder().encode(text).buffer;
}
var array = new Uint8Array(new ArrayBuffer(text.length));
for (var i = 0, il = text.length; i < il; i++) {
var value = text.charCodeAt(i);
// Re... | [
"function",
"stringToArrayBuffer",
"(",
"text",
")",
"{",
"if",
"(",
"window",
".",
"TextEncoder",
"!==",
"undefined",
")",
"{",
"return",
"new",
"TextEncoder",
"(",
")",
".",
"encode",
"(",
"text",
")",
".",
"buffer",
";",
"}",
"var",
"array",
"=",
"n... | Converts a string to an ArrayBuffer.
@param {string} text
@return {ArrayBuffer} | [
"Converts",
"a",
"string",
"to",
"an",
"ArrayBuffer",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L129-L144 |
12,615 | aframevr/aframe-inspector | vendor/GLTFExporter.js | getMinMax | function getMinMax(attribute, start, count) {
var output = {
min: new Array(attribute.itemSize).fill(Number.POSITIVE_INFINITY),
max: new Array(attribute.itemSize).fill(Number.NEGATIVE_INFINITY)
};
for (var i = start; i < start + count; i++) {
for (var a = 0; a < attribute.item... | javascript | function getMinMax(attribute, start, count) {
var output = {
min: new Array(attribute.itemSize).fill(Number.POSITIVE_INFINITY),
max: new Array(attribute.itemSize).fill(Number.NEGATIVE_INFINITY)
};
for (var i = start; i < start + count; i++) {
for (var a = 0; a < attribute.item... | [
"function",
"getMinMax",
"(",
"attribute",
",",
"start",
",",
"count",
")",
"{",
"var",
"output",
"=",
"{",
"min",
":",
"new",
"Array",
"(",
"attribute",
".",
"itemSize",
")",
".",
"fill",
"(",
"Number",
".",
"POSITIVE_INFINITY",
")",
",",
"max",
":",
... | Get the min and max vectors from the given attribute
@param {THREE.BufferAttribute} attribute Attribute to find the min/max in range from start to start + count
@param {Integer} start
@param {Integer} count
@return {Object} Object containing the `min` and `max` values (As an array of attribute.itemSize components) | [
"Get",
"the",
"min",
"and",
"max",
"vectors",
"from",
"the",
"given",
"attribute"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L153-L168 |
12,616 | aframevr/aframe-inspector | vendor/GLTFExporter.js | isNormalizedNormalAttribute | function isNormalizedNormalAttribute(normal) {
if (cachedData.attributes.has(normal)) {
return false;
}
var v = new THREE.Vector3();
for (var i = 0, il = normal.count; i < il; i++) {
// 0.0005 is from glTF-validator
if (Math.abs(v.fromArray(normal.array, i * 3).length()... | javascript | function isNormalizedNormalAttribute(normal) {
if (cachedData.attributes.has(normal)) {
return false;
}
var v = new THREE.Vector3();
for (var i = 0, il = normal.count; i < il; i++) {
// 0.0005 is from glTF-validator
if (Math.abs(v.fromArray(normal.array, i * 3).length()... | [
"function",
"isNormalizedNormalAttribute",
"(",
"normal",
")",
"{",
"if",
"(",
"cachedData",
".",
"attributes",
".",
"has",
"(",
"normal",
")",
")",
"{",
"return",
"false",
";",
"}",
"var",
"v",
"=",
"new",
"THREE",
".",
"Vector3",
"(",
")",
";",
"for"... | Checks if normal attribute values are normalized.
@param {THREE.BufferAttribute} normal
@returns {Boolean} | [
"Checks",
"if",
"normal",
"attribute",
"values",
"are",
"normalized",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L191-L205 |
12,617 | aframevr/aframe-inspector | vendor/GLTFExporter.js | createNormalizedNormalAttribute | function createNormalizedNormalAttribute(normal) {
if (cachedData.attributes.has(normal)) {
return cachedData.attributes.get(normal);
}
var attribute = normal.clone();
var v = new THREE.Vector3();
for (var i = 0, il = attribute.count; i < il; i++) {
v.fromArray(attribute... | javascript | function createNormalizedNormalAttribute(normal) {
if (cachedData.attributes.has(normal)) {
return cachedData.attributes.get(normal);
}
var attribute = normal.clone();
var v = new THREE.Vector3();
for (var i = 0, il = attribute.count; i < il; i++) {
v.fromArray(attribute... | [
"function",
"createNormalizedNormalAttribute",
"(",
"normal",
")",
"{",
"if",
"(",
"cachedData",
".",
"attributes",
".",
"has",
"(",
"normal",
")",
")",
"{",
"return",
"cachedData",
".",
"attributes",
".",
"get",
"(",
"normal",
")",
";",
"}",
"var",
"attri... | Creates normalized normal buffer attribute.
@param {THREE.BufferAttribute} normal
@returns {THREE.BufferAttribute} | [
"Creates",
"normalized",
"normal",
"buffer",
"attribute",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L214-L239 |
12,618 | aframevr/aframe-inspector | vendor/GLTFExporter.js | getPaddedArrayBuffer | function getPaddedArrayBuffer(arrayBuffer, paddingByte) {
paddingByte = paddingByte || 0;
var paddedLength = getPaddedBufferSize(arrayBuffer.byteLength);
if (paddedLength !== arrayBuffer.byteLength) {
var array = new Uint8Array(paddedLength);
array.set(new Uint8Array(arrayBuffer));
... | javascript | function getPaddedArrayBuffer(arrayBuffer, paddingByte) {
paddingByte = paddingByte || 0;
var paddedLength = getPaddedBufferSize(arrayBuffer.byteLength);
if (paddedLength !== arrayBuffer.byteLength) {
var array = new Uint8Array(paddedLength);
array.set(new Uint8Array(arrayBuffer));
... | [
"function",
"getPaddedArrayBuffer",
"(",
"arrayBuffer",
",",
"paddingByte",
")",
"{",
"paddingByte",
"=",
"paddingByte",
"||",
"0",
";",
"var",
"paddedLength",
"=",
"getPaddedBufferSize",
"(",
"arrayBuffer",
".",
"byteLength",
")",
";",
"if",
"(",
"paddedLength",
... | Returns a buffer aligned to 4-byte boundary.
@param {ArrayBuffer} arrayBuffer Buffer to pad
@param {Integer} paddingByte (Optional)
@returns {ArrayBuffer} The same buffer if it's already aligned to 4-byte boundary or a new buffer | [
"Returns",
"a",
"buffer",
"aligned",
"to",
"4",
"-",
"byte",
"boundary",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L260-L279 |
12,619 | aframevr/aframe-inspector | vendor/GLTFExporter.js | serializeUserData | function serializeUserData(object) {
try {
return JSON.parse(JSON.stringify(object.userData));
} catch (error) {
console.warn(
"THREE.GLTFExporter: userData of '" +
object.name +
"' " +
"won't be serialized because of JSON.stringify error - " +
... | javascript | function serializeUserData(object) {
try {
return JSON.parse(JSON.stringify(object.userData));
} catch (error) {
console.warn(
"THREE.GLTFExporter: userData of '" +
object.name +
"' " +
"won't be serialized because of JSON.stringify error - " +
... | [
"function",
"serializeUserData",
"(",
"object",
")",
"{",
"try",
"{",
"return",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"object",
".",
"userData",
")",
")",
";",
"}",
"catch",
"(",
"error",
")",
"{",
"console",
".",
"warn",
"(",
"\"... | Serializes a userData.
@param {THREE.Object3D|THREE.Material} object
@returns {Object} | [
"Serializes",
"a",
"userData",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L287-L301 |
12,620 | aframevr/aframe-inspector | vendor/GLTFExporter.js | processBuffer | function processBuffer(buffer) {
if (!outputJSON.buffers) {
outputJSON.buffers = [{ byteLength: 0 }];
}
// All buffers are merged before export.
buffers.push(buffer);
return 0;
} | javascript | function processBuffer(buffer) {
if (!outputJSON.buffers) {
outputJSON.buffers = [{ byteLength: 0 }];
}
// All buffers are merged before export.
buffers.push(buffer);
return 0;
} | [
"function",
"processBuffer",
"(",
"buffer",
")",
"{",
"if",
"(",
"!",
"outputJSON",
".",
"buffers",
")",
"{",
"outputJSON",
".",
"buffers",
"=",
"[",
"{",
"byteLength",
":",
"0",
"}",
"]",
";",
"}",
"// All buffers are merged before export.",
"buffers",
".",... | Process a buffer to append to the default one.
@param {ArrayBuffer} buffer
@return {Integer} | [
"Process",
"a",
"buffer",
"to",
"append",
"to",
"the",
"default",
"one",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L308-L317 |
12,621 | aframevr/aframe-inspector | vendor/GLTFExporter.js | processBufferView | function processBufferView(attribute, componentType, start, count, target) {
if (!outputJSON.bufferViews) {
outputJSON.bufferViews = [];
}
// Create a new dataview and dump the attribute's array into it
var componentSize;
if (componentType === WEBGL_CONSTANTS.UNSIGNED_BYTE) {
... | javascript | function processBufferView(attribute, componentType, start, count, target) {
if (!outputJSON.bufferViews) {
outputJSON.bufferViews = [];
}
// Create a new dataview and dump the attribute's array into it
var componentSize;
if (componentType === WEBGL_CONSTANTS.UNSIGNED_BYTE) {
... | [
"function",
"processBufferView",
"(",
"attribute",
",",
"componentType",
",",
"start",
",",
"count",
",",
"target",
")",
"{",
"if",
"(",
"!",
"outputJSON",
".",
"bufferViews",
")",
"{",
"outputJSON",
".",
"bufferViews",
"=",
"[",
"]",
";",
"}",
"// Create ... | Process and generate a BufferView
@param {THREE.BufferAttribute} attribute
@param {number} componentType
@param {number} start
@param {number} count
@param {number} target (Optional) Target usage of the BufferView
@return {Object} | [
"Process",
"and",
"generate",
"a",
"BufferView"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L328-L395 |
12,622 | aframevr/aframe-inspector | vendor/GLTFExporter.js | processBufferViewImage | function processBufferViewImage(blob) {
if (!outputJSON.bufferViews) {
outputJSON.bufferViews = [];
}
return new Promise(function(resolve) {
var reader = new window.FileReader();
reader.readAsArrayBuffer(blob);
reader.onloadend = function() {
var buffer = get... | javascript | function processBufferViewImage(blob) {
if (!outputJSON.bufferViews) {
outputJSON.bufferViews = [];
}
return new Promise(function(resolve) {
var reader = new window.FileReader();
reader.readAsArrayBuffer(blob);
reader.onloadend = function() {
var buffer = get... | [
"function",
"processBufferViewImage",
"(",
"blob",
")",
"{",
"if",
"(",
"!",
"outputJSON",
".",
"bufferViews",
")",
"{",
"outputJSON",
".",
"bufferViews",
"=",
"[",
"]",
";",
"}",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
")",
"{",
"va... | Process and generate a BufferView from an image Blob.
@param {Blob} blob
@return {Promise<Integer>} | [
"Process",
"and",
"generate",
"a",
"BufferView",
"from",
"an",
"image",
"Blob",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L402-L426 |
12,623 | aframevr/aframe-inspector | vendor/GLTFExporter.js | processAccessor | function processAccessor(attribute, geometry, start, count) {
var types = {
1: 'SCALAR',
2: 'VEC2',
3: 'VEC3',
4: 'VEC4',
16: 'MAT4'
};
var componentType;
// Detect the component type of the attribute array (float, uint or ushort)
if (attribute.arr... | javascript | function processAccessor(attribute, geometry, start, count) {
var types = {
1: 'SCALAR',
2: 'VEC2',
3: 'VEC3',
4: 'VEC4',
16: 'MAT4'
};
var componentType;
// Detect the component type of the attribute array (float, uint or ushort)
if (attribute.arr... | [
"function",
"processAccessor",
"(",
"attribute",
",",
"geometry",
",",
"start",
",",
"count",
")",
"{",
"var",
"types",
"=",
"{",
"1",
":",
"'SCALAR'",
",",
"2",
":",
"'VEC2'",
",",
"3",
":",
"'VEC3'",
",",
"4",
":",
"'VEC4'",
",",
"16",
":",
"'MAT... | Process attribute to generate an accessor
@param {THREE.BufferAttribute} attribute Attribute to process
@param {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range
@param {Integer} start (Optional)
@param {Integer} count (Optional)
@return {Integer} Index of the processed acce... | [
"Process",
"attribute",
"to",
"generate",
"an",
"accessor"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L436-L526 |
12,624 | aframevr/aframe-inspector | vendor/GLTFExporter.js | processAnimation | function processAnimation(clip, root) {
if (!outputJSON.animations) {
outputJSON.animations = [];
}
var channels = [];
var samplers = [];
for (var i = 0; i < clip.tracks.length; ++i) {
var track = clip.tracks[i];
var trackBinding = THREE.PropertyBinding.parseTrack... | javascript | function processAnimation(clip, root) {
if (!outputJSON.animations) {
outputJSON.animations = [];
}
var channels = [];
var samplers = [];
for (var i = 0; i < clip.tracks.length; ++i) {
var track = clip.tracks[i];
var trackBinding = THREE.PropertyBinding.parseTrack... | [
"function",
"processAnimation",
"(",
"clip",
",",
"root",
")",
"{",
"if",
"(",
"!",
"outputJSON",
".",
"animations",
")",
"{",
"outputJSON",
".",
"animations",
"=",
"[",
"]",
";",
"}",
"var",
"channels",
"=",
"[",
"]",
";",
"var",
"samplers",
"=",
"[... | Creates glTF animation entry from AnimationClip object.
Status:
- Only properties listed in PATH_PROPERTIES may be animated.
@param {THREE.AnimationClip} clip
@param {THREE.Object3D} root
@return {number} | [
"Creates",
"glTF",
"animation",
"entry",
"from",
"AnimationClip",
"object",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L1128-L1232 |
12,625 | aframevr/aframe-inspector | vendor/GLTFExporter.js | processNode | function processNode(object) {
if (object.isLight) {
console.warn(
'GLTFExporter: Unsupported node type:',
object.constructor.name
);
return null;
}
if (!outputJSON.nodes) {
outputJSON.nodes = [];
}
var gltfNode = {};
if (options... | javascript | function processNode(object) {
if (object.isLight) {
console.warn(
'GLTFExporter: Unsupported node type:',
object.constructor.name
);
return null;
}
if (!outputJSON.nodes) {
outputJSON.nodes = [];
}
var gltfNode = {};
if (options... | [
"function",
"processNode",
"(",
"object",
")",
"{",
"if",
"(",
"object",
".",
"isLight",
")",
"{",
"console",
".",
"warn",
"(",
"'GLTFExporter: Unsupported node type:'",
",",
"object",
".",
"constructor",
".",
"name",
")",
";",
"return",
"null",
";",
"}",
... | Process Object3D node
@param {THREE.Object3D} node Object3D to processNode
@return {Integer} Index of the node in the nodes list | [
"Process",
"Object3D",
"node"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L1273-L1379 |
12,626 | aframevr/aframe-inspector | vendor/GLTFExporter.js | processObjects | function processObjects(objects) {
var scene = new THREE.Scene();
scene.name = 'AuxScene';
for (var i = 0; i < objects.length; i++) {
// We push directly to children instead of calling `add` to prevent
// modify the .parent and break its original scene and hierarchy
scene.chil... | javascript | function processObjects(objects) {
var scene = new THREE.Scene();
scene.name = 'AuxScene';
for (var i = 0; i < objects.length; i++) {
// We push directly to children instead of calling `add` to prevent
// modify the .parent and break its original scene and hierarchy
scene.chil... | [
"function",
"processObjects",
"(",
"objects",
")",
"{",
"var",
"scene",
"=",
"new",
"THREE",
".",
"Scene",
"(",
")",
";",
"scene",
".",
"name",
"=",
"'AuxScene'",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"objects",
".",
"length",
";",
... | Creates a THREE.Scene to hold a list of objects and parse it
@param {Array} objects List of objects to process | [
"Creates",
"a",
"THREE",
".",
"Scene",
"to",
"hold",
"a",
"list",
"of",
"objects",
"and",
"parse",
"it"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L1424-L1435 |
12,627 | Intellicode/eslint-plugin-react-native | lib/util/Components.js | function () {
let scope = context.getScope();
while (scope) {
const node = scope.block && scope.block.parent && scope.block.parent.parent;
if (node && utils.isES5Component(node)) {
return node;
}
scope = scope.upper;
}
return null;
} | javascript | function () {
let scope = context.getScope();
while (scope) {
const node = scope.block && scope.block.parent && scope.block.parent.parent;
if (node && utils.isES5Component(node)) {
return node;
}
scope = scope.upper;
}
return null;
} | [
"function",
"(",
")",
"{",
"let",
"scope",
"=",
"context",
".",
"getScope",
"(",
")",
";",
"while",
"(",
"scope",
")",
"{",
"const",
"node",
"=",
"scope",
".",
"block",
"&&",
"scope",
".",
"block",
".",
"parent",
"&&",
"scope",
".",
"block",
".",
... | Get the parent ES5 component node from the current scope
@returns {ASTNode} component node, null if we are not in a component | [
"Get",
"the",
"parent",
"ES5",
"component",
"node",
"from",
"the",
"current",
"scope"
] | da07c9ae222a98c7a1652ebe6d9d13dcc2225ef5 | https://github.com/Intellicode/eslint-plugin-react-native/blob/da07c9ae222a98c7a1652ebe6d9d13dcc2225ef5/lib/util/Components.js#L186-L196 | |
12,628 | Intellicode/eslint-plugin-react-native | lib/util/Components.js | function () {
let scope = context.getScope();
while (scope && scope.type !== 'class') {
scope = scope.upper;
}
const node = scope && scope.block;
if (!node || !utils.isES6Component(node)) {
return null;
}
return node;
} | javascript | function () {
let scope = context.getScope();
while (scope && scope.type !== 'class') {
scope = scope.upper;
}
const node = scope && scope.block;
if (!node || !utils.isES6Component(node)) {
return null;
}
return node;
} | [
"function",
"(",
")",
"{",
"let",
"scope",
"=",
"context",
".",
"getScope",
"(",
")",
";",
"while",
"(",
"scope",
"&&",
"scope",
".",
"type",
"!==",
"'class'",
")",
"{",
"scope",
"=",
"scope",
".",
"upper",
";",
"}",
"const",
"node",
"=",
"scope",
... | Get the parent ES6 component node from the current scope
@returns {ASTNode} component node, null if we are not in a component | [
"Get",
"the",
"parent",
"ES6",
"component",
"node",
"from",
"the",
"current",
"scope"
] | da07c9ae222a98c7a1652ebe6d9d13dcc2225ef5 | https://github.com/Intellicode/eslint-plugin-react-native/blob/da07c9ae222a98c7a1652ebe6d9d13dcc2225ef5/lib/util/Components.js#L203-L213 | |
12,629 | Intellicode/eslint-plugin-react-native | lib/util/variable.js | markVariableAsUsed | function markVariableAsUsed(context, name) {
let scope = context.getScope();
let variables;
let i;
let len;
let found = false;
// Special Node.js scope means we need to start one level deeper
if (scope.type === 'global') {
while (scope.childScopes.length) {
scope = scope.childScopes[0];
}
... | javascript | function markVariableAsUsed(context, name) {
let scope = context.getScope();
let variables;
let i;
let len;
let found = false;
// Special Node.js scope means we need to start one level deeper
if (scope.type === 'global') {
while (scope.childScopes.length) {
scope = scope.childScopes[0];
}
... | [
"function",
"markVariableAsUsed",
"(",
"context",
",",
"name",
")",
"{",
"let",
"scope",
"=",
"context",
".",
"getScope",
"(",
")",
";",
"let",
"variables",
";",
"let",
"i",
";",
"let",
"len",
";",
"let",
"found",
"=",
"false",
";",
"// Special Node.js s... | Record that a particular variable has been used in code
@param {String} name The name of the variable to mark as used.
@returns {Boolean} True if the variable was found and marked as used, false if not. | [
"Record",
"that",
"a",
"particular",
"variable",
"has",
"been",
"used",
"in",
"code"
] | da07c9ae222a98c7a1652ebe6d9d13dcc2225ef5 | https://github.com/Intellicode/eslint-plugin-react-native/blob/da07c9ae222a98c7a1652ebe6d9d13dcc2225ef5/lib/util/variable.js#L14-L40 |
12,630 | Intellicode/eslint-plugin-react-native | lib/util/variable.js | findVariable | function findVariable(variables, name) {
let i;
let len;
for (i = 0, len = variables.length; i < len; i++) { // eslint-disable-line no-plusplus
if (variables[i].name === name) {
return true;
}
}
return false;
} | javascript | function findVariable(variables, name) {
let i;
let len;
for (i = 0, len = variables.length; i < len; i++) { // eslint-disable-line no-plusplus
if (variables[i].name === name) {
return true;
}
}
return false;
} | [
"function",
"findVariable",
"(",
"variables",
",",
"name",
")",
"{",
"let",
"i",
";",
"let",
"len",
";",
"for",
"(",
"i",
"=",
"0",
",",
"len",
"=",
"variables",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"// eslint-disable-line... | Search a particular variable in a list
@param {Array} variables The variables list.
@param {Array} name The name of the variable to search.
@returns {Boolean} True if the variable was found, false if not. | [
"Search",
"a",
"particular",
"variable",
"in",
"a",
"list"
] | da07c9ae222a98c7a1652ebe6d9d13dcc2225ef5 | https://github.com/Intellicode/eslint-plugin-react-native/blob/da07c9ae222a98c7a1652ebe6d9d13dcc2225ef5/lib/util/variable.js#L48-L59 |
12,631 | Intellicode/eslint-plugin-react-native | lib/util/variable.js | variablesInScope | function variablesInScope(context) {
let scope = context.getScope();
let variables = scope.variables;
while (scope.type !== 'global') {
scope = scope.upper;
variables = scope.variables.concat(variables);
}
if (scope.childScopes.length) {
variables = scope.childScopes[0].variables.concat(variables... | javascript | function variablesInScope(context) {
let scope = context.getScope();
let variables = scope.variables;
while (scope.type !== 'global') {
scope = scope.upper;
variables = scope.variables.concat(variables);
}
if (scope.childScopes.length) {
variables = scope.childScopes[0].variables.concat(variables... | [
"function",
"variablesInScope",
"(",
"context",
")",
"{",
"let",
"scope",
"=",
"context",
".",
"getScope",
"(",
")",
";",
"let",
"variables",
"=",
"scope",
".",
"variables",
";",
"while",
"(",
"scope",
".",
"type",
"!==",
"'global'",
")",
"{",
"scope",
... | List all variable in a given scope
Contain a patch for babel-eslint to avoid https://github.com/babel/babel-eslint/issues/21
@param {Object} context The current rule context.
@param {Array} name The name of the variable to search.
@returns {Boolean} True if the variable was found, false if not. | [
"List",
"all",
"variable",
"in",
"a",
"given",
"scope"
] | da07c9ae222a98c7a1652ebe6d9d13dcc2225ef5 | https://github.com/Intellicode/eslint-plugin-react-native/blob/da07c9ae222a98c7a1652ebe6d9d13dcc2225ef5/lib/util/variable.js#L70-L86 |
12,632 | darrenscerri/duplicate-package-checker-webpack-plugin | src/index.js | getClosestPackage | function getClosestPackage(modulePath) {
let root;
let pkg;
// Catch findRoot or require errors
try {
root = findRoot(modulePath);
pkg = require(path.join(root, "package.json"));
} catch (e) {
return null;
}
// If the package.json does not have a name property, try again from
// one level ... | javascript | function getClosestPackage(modulePath) {
let root;
let pkg;
// Catch findRoot or require errors
try {
root = findRoot(modulePath);
pkg = require(path.join(root, "package.json"));
} catch (e) {
return null;
}
// If the package.json does not have a name property, try again from
// one level ... | [
"function",
"getClosestPackage",
"(",
"modulePath",
")",
"{",
"let",
"root",
";",
"let",
"pkg",
";",
"// Catch findRoot or require errors",
"try",
"{",
"root",
"=",
"findRoot",
"(",
"modulePath",
")",
";",
"pkg",
"=",
"require",
"(",
"path",
".",
"join",
"("... | Get closest package definition from path | [
"Get",
"closest",
"package",
"definition",
"from",
"path"
] | f78729d8042055387528bf0c493b7560ac0bf149 | https://github.com/darrenscerri/duplicate-package-checker-webpack-plugin/blob/f78729d8042055387528bf0c493b7560ac0bf149/src/index.js#L24-L48 |
12,633 | Raathigesh/dazzle | lib/components/Row.js | Row | function Row(props) {
const {
rowClass,
columns,
widgets,
onRemove,
layout,
rowIndex,
editable,
frameComponent,
editableColumnClass,
droppableColumnClass,
addWidgetComponentText,
addWidgetComponent,
onAdd,
onMove,
onEdit,
} = props;
const items = column... | javascript | function Row(props) {
const {
rowClass,
columns,
widgets,
onRemove,
layout,
rowIndex,
editable,
frameComponent,
editableColumnClass,
droppableColumnClass,
addWidgetComponentText,
addWidgetComponent,
onAdd,
onMove,
onEdit,
} = props;
const items = column... | [
"function",
"Row",
"(",
"props",
")",
"{",
"const",
"{",
"rowClass",
",",
"columns",
",",
"widgets",
",",
"onRemove",
",",
"layout",
",",
"rowIndex",
",",
"editable",
",",
"frameComponent",
",",
"editableColumnClass",
",",
"droppableColumnClass",
",",
"addWidg... | Returns a set of columns that belongs to a row. | [
"Returns",
"a",
"set",
"of",
"columns",
"that",
"belongs",
"to",
"a",
"row",
"."
] | c4a46f62401a0a1b34efa3a45134a6a34a121770 | https://github.com/Raathigesh/dazzle/blob/c4a46f62401a0a1b34efa3a45134a6a34a121770/lib/components/Row.js#L9-L67 |
12,634 | jeffbski/wait-on | lib/wait-on.js | waitOn | function waitOn(opts, cb) {
if (cb !== undefined) {
return waitOnImpl(opts, cb);
} else {
return new Promise(function (resolve, reject) {
waitOnImpl(opts, function(err) {
if (err) {
reject(err);
} else {
resolve();
}
})
});
}
} | javascript | function waitOn(opts, cb) {
if (cb !== undefined) {
return waitOnImpl(opts, cb);
} else {
return new Promise(function (resolve, reject) {
waitOnImpl(opts, function(err) {
if (err) {
reject(err);
} else {
resolve();
}
})
});
}
} | [
"function",
"waitOn",
"(",
"opts",
",",
"cb",
")",
"{",
"if",
"(",
"cb",
"!==",
"undefined",
")",
"{",
"return",
"waitOnImpl",
"(",
"opts",
",",
"cb",
")",
";",
"}",
"else",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"re... | Waits for resources to become available before calling callback
Polls file, http(s), tcp ports, sockets for availability.
Resource types are distinquished by their prefix with default being `file:`
- file:/path/to/file - waits for file to be available and size to stabilize
- http://foo.com:8000/bar verifies HTTP HEAD... | [
"Waits",
"for",
"resources",
"to",
"become",
"available",
"before",
"calling",
"callback"
] | f45bcd580f2647c7db4f61d79fdcb9005e556720 | https://github.com/jeffbski/wait-on/blob/f45bcd580f2647c7db4f61d79fdcb9005e556720/lib/wait-on.js#L71-L85 |
12,635 | adam-cowley/neode | src/Services/GenerateDefaultValues.js | GenerateDefaultValues | function GenerateDefaultValues(neode, model, properties) {
const output = GenerateDefaultValuesAsync(neode, model, properties);
return Promise.resolve(output);
} | javascript | function GenerateDefaultValues(neode, model, properties) {
const output = GenerateDefaultValuesAsync(neode, model, properties);
return Promise.resolve(output);
} | [
"function",
"GenerateDefaultValues",
"(",
"neode",
",",
"model",
",",
"properties",
")",
"{",
"const",
"output",
"=",
"GenerateDefaultValuesAsync",
"(",
"neode",
",",
"model",
",",
"properties",
")",
";",
"return",
"Promise",
".",
"resolve",
"(",
"output",
")"... | Generate default values where no values are not currently set.
@param {Neode} neode
@param {Model} model
@param {Object} properties
@return {Promise} | [
"Generate",
"default",
"values",
"where",
"no",
"values",
"are",
"not",
"currently",
"set",
"."
] | f978655da08715602df32cc6b687dd3c9139a62f | https://github.com/adam-cowley/neode/blob/f978655da08715602df32cc6b687dd3c9139a62f/src/Services/GenerateDefaultValues.js#L49-L53 |
12,636 | adam-cowley/neode | build/Services/WriteUtils.js | splitProperties | function splitProperties(mode, model, properties) {
var merge_on = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
var inline = {};
var set = {};
var on_create = {};
var on_match = {};
// Calculate Set Properties
model.properties().forEach(function (property) {
... | javascript | function splitProperties(mode, model, properties) {
var merge_on = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
var inline = {};
var set = {};
var on_create = {};
var on_match = {};
// Calculate Set Properties
model.properties().forEach(function (property) {
... | [
"function",
"splitProperties",
"(",
"mode",
",",
"model",
",",
"properties",
")",
"{",
"var",
"merge_on",
"=",
"arguments",
".",
"length",
">",
"3",
"&&",
"arguments",
"[",
"3",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"3",
"]",
":",
"[",
"]",
... | Split properties into
@param {String} mode 'create' or 'merge'
@param {Model} model Model to merge on
@param {Object} properties Map of properties
@param {Array} merge_on Array of properties explicitly stated to merge on
@return {Object} { inline, set, on_create, on_match } | [
"Split",
"properties",
"into"
] | f978655da08715602df32cc6b687dd3c9139a62f | https://github.com/adam-cowley/neode/blob/f978655da08715602df32cc6b687dd3c9139a62f/build/Services/WriteUtils.js#L42-L85 |
12,637 | adam-cowley/neode | build/Services/WriteUtils.js | addRelationshipToStatement | function addRelationshipToStatement(neode, builder, alias, rel_alias, target_alias, relationship, value, aliases, mode) {
if (aliases.length > MAX_CREATE_DEPTH) {
return;
}
// Extract Node
var node_alias = relationship.nodeAlias();
var node_value = value[node_alias];
delete value[node_... | javascript | function addRelationshipToStatement(neode, builder, alias, rel_alias, target_alias, relationship, value, aliases, mode) {
if (aliases.length > MAX_CREATE_DEPTH) {
return;
}
// Extract Node
var node_alias = relationship.nodeAlias();
var node_value = value[node_alias];
delete value[node_... | [
"function",
"addRelationshipToStatement",
"(",
"neode",
",",
"builder",
",",
"alias",
",",
"rel_alias",
",",
"target_alias",
",",
"relationship",
",",
"value",
",",
"aliases",
",",
"mode",
")",
"{",
"if",
"(",
"aliases",
".",
"length",
">",
"MAX_CREATE_DEPTH",... | Add a relationship to the current statement
@param {Neode} neode Neode instance
@param {Builder} builder Query builder
@param {String} alias Current node alias
@param {String} rel_alias Generated alias for the relationship
@param {String} t... | [
"Add",
"a",
"relationship",
"to",
"the",
"current",
"statement"
] | f978655da08715602df32cc6b687dd3c9139a62f | https://github.com/adam-cowley/neode/blob/f978655da08715602df32cc6b687dd3c9139a62f/build/Services/WriteUtils.js#L220-L264 |
12,638 | adam-cowley/neode | build/Services/WriteUtils.js | addNodeRelationshipToStatement | function addNodeRelationshipToStatement(neode, builder, alias, rel_alias, target_alias, relationship, value, aliases, mode) {
if (aliases.length > MAX_CREATE_DEPTH) {
return;
}
// If Node is passed, attempt to create a relationship to that specific node
if (value instanceof _Node2.default) {
... | javascript | function addNodeRelationshipToStatement(neode, builder, alias, rel_alias, target_alias, relationship, value, aliases, mode) {
if (aliases.length > MAX_CREATE_DEPTH) {
return;
}
// If Node is passed, attempt to create a relationship to that specific node
if (value instanceof _Node2.default) {
... | [
"function",
"addNodeRelationshipToStatement",
"(",
"neode",
",",
"builder",
",",
"alias",
",",
"rel_alias",
",",
"target_alias",
",",
"relationship",
",",
"value",
",",
"aliases",
",",
"mode",
")",
"{",
"if",
"(",
"aliases",
".",
"length",
">",
"MAX_CREATE_DEP... | Add a node relationship to the current statement
@param {Neode} neode Neode instance
@param {Builder} builder Query builder
@param {String} alias Current node alias
@param {String} rel_alias Generated alias for the relationship
@param {String} ... | [
"Add",
"a",
"node",
"relationship",
"to",
"the",
"current",
"statement"
] | f978655da08715602df32cc6b687dd3c9139a62f | https://github.com/adam-cowley/neode/blob/f978655da08715602df32cc6b687dd3c9139a62f/build/Services/WriteUtils.js#L279-L306 |
12,639 | adam-cowley/neode | build/Entity.js | _valueToJson | function _valueToJson(property, value) {
if (_neo4jDriver.v1.isInt(value)) {
return value.toNumber();
} else if (_neo4jDriver.v1.temporal.isDate(value) || _neo4jDriver.v1.temporal.isDateTime(value) || _neo4jDriver.v1.temporal.isTime(value) || _neo4jDriver.v1.temporal.isLocalDateTime(value) || _neo4jDriv... | javascript | function _valueToJson(property, value) {
if (_neo4jDriver.v1.isInt(value)) {
return value.toNumber();
} else if (_neo4jDriver.v1.temporal.isDate(value) || _neo4jDriver.v1.temporal.isDateTime(value) || _neo4jDriver.v1.temporal.isTime(value) || _neo4jDriver.v1.temporal.isLocalDateTime(value) || _neo4jDriv... | [
"function",
"_valueToJson",
"(",
"property",
",",
"value",
")",
"{",
"if",
"(",
"_neo4jDriver",
".",
"v1",
".",
"isInt",
"(",
"value",
")",
")",
"{",
"return",
"value",
".",
"toNumber",
"(",
")",
";",
"}",
"else",
"if",
"(",
"_neo4jDriver",
".",
"v1"... | Convert a raw property into a JSON friendly format
@param {Property} property
@param {Mixed} value
@return {Mixed} | [
"Convert",
"a",
"raw",
"property",
"into",
"a",
"JSON",
"friendly",
"format"
] | f978655da08715602df32cc6b687dd3c9139a62f | https://github.com/adam-cowley/neode/blob/f978655da08715602df32cc6b687dd3c9139a62f/build/Entity.js#L24-L51 |
12,640 | adam-cowley/neode | build/Services/CleanValue.js | CleanValue | function CleanValue(config, value) {
// Convert temporal to a native date?
if (temporal.indexOf(config.type.toLowerCase()) > -1 && typeof value == 'number') {
value = new Date(value);
}
// Clean Values
switch (config.type.toLowerCase()) {
case 'float':
value = parseFloat... | javascript | function CleanValue(config, value) {
// Convert temporal to a native date?
if (temporal.indexOf(config.type.toLowerCase()) > -1 && typeof value == 'number') {
value = new Date(value);
}
// Clean Values
switch (config.type.toLowerCase()) {
case 'float':
value = parseFloat... | [
"function",
"CleanValue",
"(",
"config",
",",
"value",
")",
"{",
"// Convert temporal to a native date?",
"if",
"(",
"temporal",
".",
"indexOf",
"(",
"config",
".",
"type",
".",
"toLowerCase",
"(",
")",
")",
">",
"-",
"1",
"&&",
"typeof",
"value",
"==",
"'... | Convert a value to it's native type
@param {Object} config Field Configuration
@param {mixed} value Value to be converted
@return {mixed}
/* eslint-disable | [
"Convert",
"a",
"value",
"to",
"it",
"s",
"native",
"type"
] | f978655da08715602df32cc6b687dd3c9139a62f | https://github.com/adam-cowley/neode/blob/f978655da08715602df32cc6b687dd3c9139a62f/build/Services/CleanValue.js#L20-L90 |
12,641 | adam-cowley/neode | src/Services/DeleteNode.js | addCascadeDeleteNode | function addCascadeDeleteNode(neode, builder, from_alias, relationship, aliases, to_depth) {
if ( aliases.length > to_depth ) return;
const rel_alias = from_alias + relationship.name() + '_rel';
const node_alias = from_alias + relationship.name() + '_node';
const target = neode.model( relationship.targ... | javascript | function addCascadeDeleteNode(neode, builder, from_alias, relationship, aliases, to_depth) {
if ( aliases.length > to_depth ) return;
const rel_alias = from_alias + relationship.name() + '_rel';
const node_alias = from_alias + relationship.name() + '_node';
const target = neode.model( relationship.targ... | [
"function",
"addCascadeDeleteNode",
"(",
"neode",
",",
"builder",
",",
"from_alias",
",",
"relationship",
",",
"aliases",
",",
"to_depth",
")",
"{",
"if",
"(",
"aliases",
".",
"length",
">",
"to_depth",
")",
"return",
";",
"const",
"rel_alias",
"=",
"from_al... | Add a recursive cascade deletion
@param {Neode} neode Neode instance
@param {Builder} builder Query Builder
@param {String} alias Alias of node
@param {RelationshipType} relationship relationship type definition
@param {Array} aliases Current a... | [
"Add",
"a",
"recursive",
"cascade",
"deletion"
] | f978655da08715602df32cc6b687dd3c9139a62f | https://github.com/adam-cowley/neode/blob/f978655da08715602df32cc6b687dd3c9139a62f/src/Services/DeleteNode.js#L17-L44 |
12,642 | adam-cowley/neode | build/Services/DeleteNode.js | DeleteNode | function DeleteNode(neode, identity, model) {
var to_depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : MAX_EAGER_DEPTH;
var alias = 'this';
var to_delete = [];
var aliases = [alias];
var depth = 1;
var builder = new _Builder2.default(neode).match(alias, model).whereId... | javascript | function DeleteNode(neode, identity, model) {
var to_depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : MAX_EAGER_DEPTH;
var alias = 'this';
var to_delete = [];
var aliases = [alias];
var depth = 1;
var builder = new _Builder2.default(neode).match(alias, model).whereId... | [
"function",
"DeleteNode",
"(",
"neode",
",",
"identity",
",",
"model",
")",
"{",
"var",
"to_depth",
"=",
"arguments",
".",
"length",
">",
"3",
"&&",
"arguments",
"[",
"3",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"3",
"]",
":",
"MAX_EAGER_DEPTH",
... | Delete the relationship to the other node
@param {Neode} neode Neode instance
@param {Builder} builder Query Builder
@param {String} from_alias Alias of node at start of the match
@param {RelationshipType} relationship model definition
@param {Array} alias... | [
"Delete",
"the",
"relationship",
"to",
"the",
"other",
"node"
] | f978655da08715602df32cc6b687dd3c9139a62f | https://github.com/adam-cowley/neode/blob/f978655da08715602df32cc6b687dd3c9139a62f/build/Services/DeleteNode.js#L87-L114 |
12,643 | adam-cowley/neode | build/Query/EagerUtils.js | eagerPattern | function eagerPattern(neode, depth, alias, rel) {
var builder = new _Builder2.default();
var name = rel.name();
var type = rel.type();
var relationship = rel.relationship();
var direction = rel.direction();
var target = rel.target();
var relationship_variable = alias + '_' + name + '_rel';
... | javascript | function eagerPattern(neode, depth, alias, rel) {
var builder = new _Builder2.default();
var name = rel.name();
var type = rel.type();
var relationship = rel.relationship();
var direction = rel.direction();
var target = rel.target();
var relationship_variable = alias + '_' + name + '_rel';
... | [
"function",
"eagerPattern",
"(",
"neode",
",",
"depth",
",",
"alias",
",",
"rel",
")",
"{",
"var",
"builder",
"=",
"new",
"_Builder2",
".",
"default",
"(",
")",
";",
"var",
"name",
"=",
"rel",
".",
"name",
"(",
")",
";",
"var",
"type",
"=",
"rel",
... | Build a pattern to use in an eager load statement
@param {Neode} neode Neode instance
@param {Integer} depth Maximum depth to stop at
@param {String} alias Alias for the starting node
@param {RelationshipType} rel Type of relationship | [
"Build",
"a",
"pattern",
"to",
"use",
"in",
"an",
"eager",
"load",
"statement"
] | f978655da08715602df32cc6b687dd3c9139a62f | https://github.com/adam-cowley/neode/blob/f978655da08715602df32cc6b687dd3c9139a62f/build/Query/EagerUtils.js#L30-L67 |
12,644 | adam-cowley/neode | build/Query/EagerUtils.js | eagerNode | function eagerNode(neode, depth, alias, model) {
var indent = ' '.repeat(depth * 2);
var pattern = '\n' + indent + ' ' + alias + ' { ';
// Properties
pattern += '\n' + indent + indent + '.*';
// ID
pattern += '\n' + indent + indent + ',' + EAGER_ID + ': id(' + alias + ')';
// Labels
... | javascript | function eagerNode(neode, depth, alias, model) {
var indent = ' '.repeat(depth * 2);
var pattern = '\n' + indent + ' ' + alias + ' { ';
// Properties
pattern += '\n' + indent + indent + '.*';
// ID
pattern += '\n' + indent + indent + ',' + EAGER_ID + ': id(' + alias + ')';
// Labels
... | [
"function",
"eagerNode",
"(",
"neode",
",",
"depth",
",",
"alias",
",",
"model",
")",
"{",
"var",
"indent",
"=",
"' '",
".",
"repeat",
"(",
"depth",
"*",
"2",
")",
";",
"var",
"pattern",
"=",
"'\\n'",
"+",
"indent",
"+",
"' '",
"+",
"alias",
"+",
... | Produces a Cypher pattern for a consistant eager loading format for a
Node and any subsequent eagerly loaded models up to the maximum depth.
@param {Neode} neode Neode instance
@param {Integer} depth Maximum depth to traverse to
@param {String} alias Alias of the node
@param {Model} model Node model | [
"Produces",
"a",
"Cypher",
"pattern",
"for",
"a",
"consistant",
"eager",
"loading",
"format",
"for",
"a",
"Node",
"and",
"any",
"subsequent",
"eagerly",
"loaded",
"models",
"up",
"to",
"the",
"maximum",
"depth",
"."
] | f978655da08715602df32cc6b687dd3c9139a62f | https://github.com/adam-cowley/neode/blob/f978655da08715602df32cc6b687dd3c9139a62f/build/Query/EagerUtils.js#L78-L101 |
12,645 | adam-cowley/neode | build/Query/EagerUtils.js | eagerRelationship | function eagerRelationship(neode, depth, alias, node_alias, node_variable, node_model) {
var indent = ' '.repeat(depth * 2);
var pattern = '\n' + indent + ' ' + alias + ' { ';
// Properties
pattern += '\n' + indent + indent + '.*';
// ID
pattern += '\n' + indent + indent + ',' + EAGER_ID + ':... | javascript | function eagerRelationship(neode, depth, alias, node_alias, node_variable, node_model) {
var indent = ' '.repeat(depth * 2);
var pattern = '\n' + indent + ' ' + alias + ' { ';
// Properties
pattern += '\n' + indent + indent + '.*';
// ID
pattern += '\n' + indent + indent + ',' + EAGER_ID + ':... | [
"function",
"eagerRelationship",
"(",
"neode",
",",
"depth",
",",
"alias",
",",
"node_alias",
",",
"node_variable",
",",
"node_model",
")",
"{",
"var",
"indent",
"=",
"' '",
".",
"repeat",
"(",
"depth",
"*",
"2",
")",
";",
"var",
"pattern",
"=",
"'\\n'"... | Produces a Cypher pattern for a consistant eager loading format for a
Relationship and any subsequent eagerly loaded modules up to the maximum depth.
@param {Neode} neode Neode instance
@param {Integer} depth Maximum depth to traverse to
@param {String} alias Alias of the node
@param {Model} model Node mo... | [
"Produces",
"a",
"Cypher",
"pattern",
"for",
"a",
"consistant",
"eager",
"loading",
"format",
"for",
"a",
"Relationship",
"and",
"any",
"subsequent",
"eagerly",
"loaded",
"modules",
"up",
"to",
"the",
"maximum",
"depth",
"."
] | f978655da08715602df32cc6b687dd3c9139a62f | https://github.com/adam-cowley/neode/blob/f978655da08715602df32cc6b687dd3c9139a62f/build/Query/EagerUtils.js#L112-L133 |
12,646 | liriliri/licia | src/m/moment.js | normalizeUnit | function normalizeUnit(unit) {
unit = toStr(unit);
if (unitShorthandMap[unit]) return unitShorthandMap[unit];
return unit.toLowerCase().replace(regEndS, '');
} | javascript | function normalizeUnit(unit) {
unit = toStr(unit);
if (unitShorthandMap[unit]) return unitShorthandMap[unit];
return unit.toLowerCase().replace(regEndS, '');
} | [
"function",
"normalizeUnit",
"(",
"unit",
")",
"{",
"unit",
"=",
"toStr",
"(",
"unit",
")",
";",
"if",
"(",
"unitShorthandMap",
"[",
"unit",
"]",
")",
"return",
"unitShorthandMap",
"[",
"unit",
"]",
";",
"return",
"unit",
".",
"toLowerCase",
"(",
")",
... | Turn 'y' or 'years' into 'year' | [
"Turn",
"y",
"or",
"years",
"into",
"year"
] | 76b023379f678a6e6e6b3060cd340527ffffb41f | https://github.com/liriliri/licia/blob/76b023379f678a6e6e6b3060cd340527ffffb41f/src/m/moment.js#L289-L295 |
12,647 | liriliri/licia | src/g/getPort.js | isAvailable | function isAvailable(port) {
return new Promise((resolve, reject) => {
const server = net.createServer();
server.unref();
server.on('error', reject);
const options = {};
options.port = port;
server.listen(options, () => {
const { port } = server.... | javascript | function isAvailable(port) {
return new Promise((resolve, reject) => {
const server = net.createServer();
server.unref();
server.on('error', reject);
const options = {};
options.port = port;
server.listen(options, () => {
const { port } = server.... | [
"function",
"isAvailable",
"(",
"port",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"server",
"=",
"net",
".",
"createServer",
"(",
")",
";",
"server",
".",
"unref",
"(",
")",
";",
"server",
".",... | Passing 0 will get an available random port. | [
"Passing",
"0",
"will",
"get",
"an",
"available",
"random",
"port",
"."
] | 76b023379f678a6e6e6b3060cd340527ffffb41f | https://github.com/liriliri/licia/blob/76b023379f678a6e6e6b3060cd340527ffffb41f/src/g/getPort.js#L40-L55 |
12,648 | muicss/loadjs | src/loadjs.js | loadFiles | function loadFiles(paths, callbackFn, args) {
// listify paths
paths = paths.push ? paths : [paths];
var numWaiting = paths.length,
x = numWaiting,
pathsNotFound = [],
fn,
i;
// define callback function
fn = function(path, result, defaultPrevented) {
// handle error
if (resul... | javascript | function loadFiles(paths, callbackFn, args) {
// listify paths
paths = paths.push ? paths : [paths];
var numWaiting = paths.length,
x = numWaiting,
pathsNotFound = [],
fn,
i;
// define callback function
fn = function(path, result, defaultPrevented) {
// handle error
if (resul... | [
"function",
"loadFiles",
"(",
"paths",
",",
"callbackFn",
",",
"args",
")",
"{",
"// listify paths",
"paths",
"=",
"paths",
".",
"push",
"?",
"paths",
":",
"[",
"paths",
"]",
";",
"var",
"numWaiting",
"=",
"paths",
".",
"length",
",",
"x",
"=",
"numWai... | Load multiple files.
@param {string[]} paths - The file paths
@param {Function} callbackFn - The callback function | [
"Load",
"multiple",
"files",
"."
] | a20ea05b7cc6732e8754de16780fca84dd700c40 | https://github.com/muicss/loadjs/blob/a20ea05b7cc6732e8754de16780fca84dd700c40/src/loadjs.js#L180-L208 |
12,649 | muicss/loadjs | examples/assets/log.js | log | function log(msg) {
var d = new Date(), ts;
ts = d.toLocaleTimeString().split(' ');
ts = ts[0] + '.' + d.getMilliseconds() + ' ' + ts[1];
console.log('[' + ts + '] ' + msg);
} | javascript | function log(msg) {
var d = new Date(), ts;
ts = d.toLocaleTimeString().split(' ');
ts = ts[0] + '.' + d.getMilliseconds() + ' ' + ts[1];
console.log('[' + ts + '] ' + msg);
} | [
"function",
"log",
"(",
"msg",
")",
"{",
"var",
"d",
"=",
"new",
"Date",
"(",
")",
",",
"ts",
";",
"ts",
"=",
"d",
".",
"toLocaleTimeString",
"(",
")",
".",
"split",
"(",
"' '",
")",
";",
"ts",
"=",
"ts",
"[",
"0",
"]",
"+",
"'.'",
"+",
"d"... | define global logging function | [
"define",
"global",
"logging",
"function"
] | a20ea05b7cc6732e8754de16780fca84dd700c40 | https://github.com/muicss/loadjs/blob/a20ea05b7cc6732e8754de16780fca84dd700c40/examples/assets/log.js#L2-L8 |
12,650 | freearhey/vue2-filters | src/string/placeholder.js | placeholder | function placeholder (input, property) {
return ( input === undefined || input === '' || input === null ) ? property : input;
} | javascript | function placeholder (input, property) {
return ( input === undefined || input === '' || input === null ) ? property : input;
} | [
"function",
"placeholder",
"(",
"input",
",",
"property",
")",
"{",
"return",
"(",
"input",
"===",
"undefined",
"||",
"input",
"===",
"''",
"||",
"input",
"===",
"null",
")",
"?",
"property",
":",
"input",
";",
"}"
] | If the value is missing outputs the placeholder text
'' => {placeholder}
'foo' => 'foo' | [
"If",
"the",
"value",
"is",
"missing",
"outputs",
"the",
"placeholder",
"text"
] | d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c | https://github.com/freearhey/vue2-filters/blob/d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c/src/string/placeholder.js#L8-L10 |
12,651 | freearhey/vue2-filters | src/string/capitalize.js | capitalize | function capitalize (value, options) {
options = options || {}
var onlyFirstLetter = options.onlyFirstLetter != null ? options.onlyFirstLetter : false
if (!value && value !== 0) return ''
if(onlyFirstLetter === true) {
return value.charAt(0).toUpperCase() + value.slice(1)
} else {
value = value.toStri... | javascript | function capitalize (value, options) {
options = options || {}
var onlyFirstLetter = options.onlyFirstLetter != null ? options.onlyFirstLetter : false
if (!value && value !== 0) return ''
if(onlyFirstLetter === true) {
return value.charAt(0).toUpperCase() + value.slice(1)
} else {
value = value.toStri... | [
"function",
"capitalize",
"(",
"value",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
"var",
"onlyFirstLetter",
"=",
"options",
".",
"onlyFirstLetter",
"!=",
"null",
"?",
"options",
".",
"onlyFirstLetter",
":",
"false",
"if",
"(",
"!... | Converts a string into Capitalize
'abc' => 'Abc'
@param {Object} options | [
"Converts",
"a",
"string",
"into",
"Capitalize"
] | d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c | https://github.com/freearhey/vue2-filters/blob/d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c/src/string/capitalize.js#L9-L21 |
12,652 | freearhey/vue2-filters | src/array/limitBy.js | limitBy | function limitBy (arr, n, offset) {
offset = offset ? parseInt(offset, 10) : 0
n = util.toNumber(n)
return typeof n === 'number'
? arr.slice(offset, offset + n)
: arr
} | javascript | function limitBy (arr, n, offset) {
offset = offset ? parseInt(offset, 10) : 0
n = util.toNumber(n)
return typeof n === 'number'
? arr.slice(offset, offset + n)
: arr
} | [
"function",
"limitBy",
"(",
"arr",
",",
"n",
",",
"offset",
")",
"{",
"offset",
"=",
"offset",
"?",
"parseInt",
"(",
"offset",
",",
"10",
")",
":",
"0",
"n",
"=",
"util",
".",
"toNumber",
"(",
"n",
")",
"return",
"typeof",
"n",
"===",
"'number'",
... | Limit filter for arrays
@param {Number} n
@param {Number} offset (Decimal expected) | [
"Limit",
"filter",
"for",
"arrays"
] | d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c | https://github.com/freearhey/vue2-filters/blob/d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c/src/array/limitBy.js#L10-L16 |
12,653 | freearhey/vue2-filters | src/other/ordinal.js | ordinal | function ordinal (value, options) {
options = options || {}
var output = ''
var includeNumber = options.includeNumber != null ? options.includeNumber : false
if(includeNumber === true) output += value
var j = value % 10,
k = value % 100
if (j == 1 && k != 11) output += 'st'
else if (j == 2 && k != ... | javascript | function ordinal (value, options) {
options = options || {}
var output = ''
var includeNumber = options.includeNumber != null ? options.includeNumber : false
if(includeNumber === true) output += value
var j = value % 10,
k = value % 100
if (j == 1 && k != 11) output += 'st'
else if (j == 2 && k != ... | [
"function",
"ordinal",
"(",
"value",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
"var",
"output",
"=",
"''",
"var",
"includeNumber",
"=",
"options",
".",
"includeNumber",
"!=",
"null",
"?",
"options",
".",
"includeNumber",
":",
"... | 42 => 'nd'
@params {Object} options | [
"42",
"=",
">",
"nd"
] | d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c | https://github.com/freearhey/vue2-filters/blob/d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c/src/other/ordinal.js#L10-L24 |
12,654 | freearhey/vue2-filters | src/string/truncate.js | truncate | function truncate (value, length) {
length = length || 15
if( !value || typeof value !== 'string' ) return ''
if( value.length <= length) return value
return value.substring(0, length) + '...'
} | javascript | function truncate (value, length) {
length = length || 15
if( !value || typeof value !== 'string' ) return ''
if( value.length <= length) return value
return value.substring(0, length) + '...'
} | [
"function",
"truncate",
"(",
"value",
",",
"length",
")",
"{",
"length",
"=",
"length",
"||",
"15",
"if",
"(",
"!",
"value",
"||",
"typeof",
"value",
"!==",
"'string'",
")",
"return",
"''",
"if",
"(",
"value",
".",
"length",
"<=",
"length",
")",
"ret... | Truncate at the given || default length
'lorem ipsum dolor' => 'lorem ipsum dol...' | [
"Truncate",
"at",
"the",
"given",
"||",
"default",
"length"
] | d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c | https://github.com/freearhey/vue2-filters/blob/d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c/src/string/truncate.js#L7-L12 |
12,655 | freearhey/vue2-filters | src/array/find.js | find | function find(arr, search)
{
var array = filterBy.apply(this, arguments);
array.splice(1);
return array;
} | javascript | function find(arr, search)
{
var array = filterBy.apply(this, arguments);
array.splice(1);
return array;
} | [
"function",
"find",
"(",
"arr",
",",
"search",
")",
"{",
"var",
"array",
"=",
"filterBy",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"array",
".",
"splice",
"(",
"1",
")",
";",
"return",
"array",
";",
"}"
] | Get first matching element from a filtered array
@param {Array} arr
@param {String|Number} search
@returns {mixed} | [
"Get",
"first",
"matching",
"element",
"from",
"a",
"filtered",
"array"
] | d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c | https://github.com/freearhey/vue2-filters/blob/d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c/src/array/find.js#L10-L15 |
12,656 | freearhey/vue2-filters | src/other/pluralize.js | pluralize | function pluralize (value, word, options) {
options = options || {}
var output = ''
var includeNumber = options.includeNumber != null ? options.includeNumber : false
if(includeNumber === true) output += value + ' '
if(!value && value !== 0 || !word) return output
if(Array.isArray(word)) {
output += word... | javascript | function pluralize (value, word, options) {
options = options || {}
var output = ''
var includeNumber = options.includeNumber != null ? options.includeNumber : false
if(includeNumber === true) output += value + ' '
if(!value && value !== 0 || !word) return output
if(Array.isArray(word)) {
output += word... | [
"function",
"pluralize",
"(",
"value",
",",
"word",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
"var",
"output",
"=",
"''",
"var",
"includeNumber",
"=",
"options",
".",
"includeNumber",
"!=",
"null",
"?",
"options",
".",
"include... | 'item' => 'items'
@param {String|Array} word
@param {Object} options | [
"item",
"=",
">",
"items"
] | d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c | https://github.com/freearhey/vue2-filters/blob/d9ac0e2d3b7807e01f8aed86d6699e9f9954b67c/src/other/pluralize.js#L11-L24 |
12,657 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(name, source) {
var s = source;
var newEvents = s.events;
if (newEvents) {
newEvents.forEach(function(e) {
if (s[e]) {
this.eventMap[e] = s[e].bind(s);
}
}, this);
this.eventSources[name] = s;
this.eventSourceList.push(s);
... | javascript | function(name, source) {
var s = source;
var newEvents = s.events;
if (newEvents) {
newEvents.forEach(function(e) {
if (s[e]) {
this.eventMap[e] = s[e].bind(s);
}
}, this);
this.eventSources[name] = s;
this.eventSourceList.push(s);
... | [
"function",
"(",
"name",
",",
"source",
")",
"{",
"var",
"s",
"=",
"source",
";",
"var",
"newEvents",
"=",
"s",
".",
"events",
";",
"if",
"(",
"newEvents",
")",
"{",
"newEvents",
".",
"forEach",
"(",
"function",
"(",
"e",
")",
"{",
"if",
"(",
"s"... | Add a new event source that will generate pointer events.
`inSource` must contain an array of event names named `events`, and
functions with the names specified in the `events` array.
@param {string} name A name for the event source
@param {Object} source A new source of platform events. | [
"Add",
"a",
"new",
"event",
"source",
"that",
"will",
"generate",
"pointer",
"events",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L605-L617 | |
12,658 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(target, events) {
for (var i = 0, l = events.length, e; (i < l) && (e = events[i]); i++) {
this.addEvent(target, e);
}
} | javascript | function(target, events) {
for (var i = 0, l = events.length, e; (i < l) && (e = events[i]); i++) {
this.addEvent(target, e);
}
} | [
"function",
"(",
"target",
",",
"events",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"events",
".",
"length",
",",
"e",
";",
"(",
"i",
"<",
"l",
")",
"&&",
"(",
"e",
"=",
"events",
"[",
"i",
"]",
")",
";",
"i",
"++",
")",
... | set up event listeners | [
"set",
"up",
"event",
"listeners"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L721-L725 | |
12,659 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(target, events) {
for (var i = 0, l = events.length, e; (i < l) && (e = events[i]); i++) {
this.removeEvent(target, e);
}
} | javascript | function(target, events) {
for (var i = 0, l = events.length, e; (i < l) && (e = events[i]); i++) {
this.removeEvent(target, e);
}
} | [
"function",
"(",
"target",
",",
"events",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"events",
".",
"length",
",",
"e",
";",
"(",
"i",
"<",
"l",
")",
"&&",
"(",
"e",
"=",
"events",
"[",
"i",
"]",
")",
";",
"i",
"++",
")",
... | remove event listeners | [
"remove",
"event",
"listeners"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L727-L731 | |
12,660 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(inEvent) {
var t = inEvent._target;
if (t) {
t.dispatchEvent(inEvent);
// clone the event for the gesture system to process
// clone after dispatch to pick up gesture prevention code
var clone = this.cloneEvent(inEvent);
clone.target = t;
this.fillGes... | javascript | function(inEvent) {
var t = inEvent._target;
if (t) {
t.dispatchEvent(inEvent);
// clone the event for the gesture system to process
// clone after dispatch to pick up gesture prevention code
var clone = this.cloneEvent(inEvent);
clone.target = t;
this.fillGes... | [
"function",
"(",
"inEvent",
")",
"{",
"var",
"t",
"=",
"inEvent",
".",
"_target",
";",
"if",
"(",
"t",
")",
"{",
"t",
".",
"dispatchEvent",
"(",
"inEvent",
")",
";",
"// clone the event for the gesture system to process",
"// clone after dispatch to pick up gesture ... | Dispatches the event to its target.
@param {Event} inEvent The event to be dispatched.
@return {Boolean} True if an event handler returns true, false otherwise. | [
"Dispatches",
"the",
"event",
"to",
"its",
"target",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L792-L802 | |
12,661 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(inEvent) {
var lts = this.lastTouches;
var x = inEvent.clientX, y = inEvent.clientY;
for (var i = 0, l = lts.length, t; i < l && (t = lts[i]); i++) {
// simulated mouse events will be swallowed near a primary touchend
var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);
... | javascript | function(inEvent) {
var lts = this.lastTouches;
var x = inEvent.clientX, y = inEvent.clientY;
for (var i = 0, l = lts.length, t; i < l && (t = lts[i]); i++) {
// simulated mouse events will be swallowed near a primary touchend
var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);
... | [
"function",
"(",
"inEvent",
")",
"{",
"var",
"lts",
"=",
"this",
".",
"lastTouches",
";",
"var",
"x",
"=",
"inEvent",
".",
"clientX",
",",
"y",
"=",
"inEvent",
".",
"clientY",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"lts",
".",
"l... | collide with the global mouse listener | [
"collide",
"with",
"the",
"global",
"mouse",
"listener"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L995-L1005 | |
12,662 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(touch) {
var dx = Math.abs(x - touch.x), dy = Math.abs(y - touch.y);
return (dx <= DEDUP_DIST && dy <= DEDUP_DIST);
} | javascript | function(touch) {
var dx = Math.abs(x - touch.x), dy = Math.abs(y - touch.y);
return (dx <= DEDUP_DIST && dy <= DEDUP_DIST);
} | [
"function",
"(",
"touch",
")",
"{",
"var",
"dx",
"=",
"Math",
".",
"abs",
"(",
"x",
"-",
"touch",
".",
"x",
")",
",",
"dy",
"=",
"Math",
".",
"abs",
"(",
"y",
"-",
"touch",
".",
"y",
")",
";",
"return",
"(",
"dx",
"<=",
"DEDUP_DIST",
"&&",
... | check if a click is within DEDUP_DIST px radius of the touchstart | [
"check",
"if",
"a",
"click",
"is",
"within",
"DEDUP_DIST",
"px",
"radius",
"of",
"the",
"touchstart"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L1381-L1384 | |
12,663 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | findScope | function findScope(model, prop) {
while (model[parentScopeName] &&
!Object.prototype.hasOwnProperty.call(model, prop)) {
model = model[parentScopeName];
}
return model;
} | javascript | function findScope(model, prop) {
while (model[parentScopeName] &&
!Object.prototype.hasOwnProperty.call(model, prop)) {
model = model[parentScopeName];
}
return model;
} | [
"function",
"findScope",
"(",
"model",
",",
"prop",
")",
"{",
"while",
"(",
"model",
"[",
"parentScopeName",
"]",
"&&",
"!",
"Object",
".",
"prototype",
".",
"hasOwnProperty",
".",
"call",
"(",
"model",
",",
"prop",
")",
")",
"{",
"model",
"=",
"model"... | Single ident paths must bind directly to the appropriate scope object. I.e. Pushed values in two-bindings need to be assigned to the actual model object. | [
"Single",
"ident",
"paths",
"must",
"bind",
"directly",
"to",
"the",
"appropriate",
"scope",
"object",
".",
"I",
".",
"e",
".",
"Pushed",
"values",
"in",
"two",
"-",
"bindings",
"need",
"to",
"be",
"assigned",
"to",
"the",
"actual",
"model",
"object",
".... | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L3698-L3705 |
12,664 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(value) {
var parts = [];
for (var key in value) {
parts.push(convertStylePropertyName(key) + ': ' + value[key]);
}
return parts.join('; ');
} | javascript | function(value) {
var parts = [];
for (var key in value) {
parts.push(convertStylePropertyName(key) + ': ' + value[key]);
}
return parts.join('; ');
} | [
"function",
"(",
"value",
")",
"{",
"var",
"parts",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"value",
")",
"{",
"parts",
".",
"push",
"(",
"convertStylePropertyName",
"(",
"key",
")",
"+",
"': '",
"+",
"value",
"[",
"key",
"]",
")",
";... | "built-in" filters | [
"built",
"-",
"in",
"filters"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L3728-L3734 | |
12,665 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(template) {
var indexIdent = template.polymerExpressionIndexIdent_;
if (!indexIdent)
return;
return function(templateInstance, index) {
templateInstance.model[indexIdent] = index;
};
} | javascript | function(template) {
var indexIdent = template.polymerExpressionIndexIdent_;
if (!indexIdent)
return;
return function(templateInstance, index) {
templateInstance.model[indexIdent] = index;
};
} | [
"function",
"(",
"template",
")",
"{",
"var",
"indexIdent",
"=",
"template",
".",
"polymerExpressionIndexIdent_",
";",
"if",
"(",
"!",
"indexIdent",
")",
"return",
";",
"return",
"function",
"(",
"templateInstance",
",",
"index",
")",
"{",
"templateInstance",
... | binding delegate API | [
"binding",
"delegate",
"API"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L3746-L3754 | |
12,666 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | jURL | function jURL(url, base /* , encoding */) {
if (base !== undefined && !(base instanceof jURL))
base = new jURL(String(base));
this._url = url;
clear.call(this);
var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
// encoding = encoding || 'utf-8'
parse.call(this, input, null, b... | javascript | function jURL(url, base /* , encoding */) {
if (base !== undefined && !(base instanceof jURL))
base = new jURL(String(base));
this._url = url;
clear.call(this);
var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
// encoding = encoding || 'utf-8'
parse.call(this, input, null, b... | [
"function",
"jURL",
"(",
"url",
",",
"base",
"/* , encoding */",
")",
"{",
"if",
"(",
"base",
"!==",
"undefined",
"&&",
"!",
"(",
"base",
"instanceof",
"jURL",
")",
")",
"base",
"=",
"new",
"jURL",
"(",
"String",
"(",
"base",
")",
")",
";",
"this",
... | Does not process domain names or IP addresses. Does not handle encoding for the query parameter. | [
"Does",
"not",
"process",
"domain",
"names",
"or",
"IP",
"addresses",
".",
"Does",
"not",
"handle",
"encoding",
"for",
"the",
"query",
"parameter",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L7961-L7972 |
12,667 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function() {
// only flush if the page is visibile
if (document.visibilityState === 'hidden') {
if (scope.flushPoll) {
clearInterval(scope.flushPoll);
}
} else {
scope.flushPoll = setInterval(flush, FLUSH_POLL_INTERVAL);
}
} | javascript | function() {
// only flush if the page is visibile
if (document.visibilityState === 'hidden') {
if (scope.flushPoll) {
clearInterval(scope.flushPoll);
}
} else {
scope.flushPoll = setInterval(flush, FLUSH_POLL_INTERVAL);
}
} | [
"function",
"(",
")",
"{",
"// only flush if the page is visibile",
"if",
"(",
"document",
".",
"visibilityState",
"===",
"'hidden'",
")",
"{",
"if",
"(",
"scope",
".",
"flushPoll",
")",
"{",
"clearInterval",
"(",
"scope",
".",
"flushPoll",
")",
";",
"}",
"}... | watch document visiblity to toggle dirty-checking | [
"watch",
"document",
"visiblity",
"to",
"toggle",
"dirty",
"-",
"checking"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L8191-L8200 | |
12,668 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | Loader | function Loader(regex) {
this.cache = Object.create(null);
this.map = Object.create(null);
this.requests = 0;
this.regex = regex;
} | javascript | function Loader(regex) {
this.cache = Object.create(null);
this.map = Object.create(null);
this.requests = 0;
this.regex = regex;
} | [
"function",
"Loader",
"(",
"regex",
")",
"{",
"this",
".",
"cache",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"this",
".",
"map",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"this",
".",
"requests",
"=",
"0",
";",
"this",
".",... | Generic url loader | [
"Generic",
"url",
"loader"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L8367-L8372 |
12,669 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(text, root, callback) {
var matches = this.extractUrls(text, root);
// every call to process returns all the text this loader has ever received
var done = callback.bind(null, this.map);
this.fetch(matches, done);
} | javascript | function(text, root, callback) {
var matches = this.extractUrls(text, root);
// every call to process returns all the text this loader has ever received
var done = callback.bind(null, this.map);
this.fetch(matches, done);
} | [
"function",
"(",
"text",
",",
"root",
",",
"callback",
")",
"{",
"var",
"matches",
"=",
"this",
".",
"extractUrls",
"(",
"text",
",",
"root",
")",
";",
"// every call to process returns all the text this loader has ever received",
"var",
"done",
"=",
"callback",
"... | take a text blob, a root url, and a callback and load all the urls found within the text returns a map of absolute url to text | [
"take",
"a",
"text",
"blob",
"a",
"root",
"url",
"and",
"a",
"callback",
"and",
"load",
"all",
"the",
"urls",
"found",
"within",
"the",
"text",
"returns",
"a",
"map",
"of",
"absolute",
"url",
"to",
"text"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L8388-L8394 | |
12,670 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(matches, callback) {
var inflight = matches.length;
// return early if there is no fetching to be done
if (!inflight) {
return callback();
}
// wait for all subrequests to return
var done = function() {
if (--inflight === 0) {
callback();
... | javascript | function(matches, callback) {
var inflight = matches.length;
// return early if there is no fetching to be done
if (!inflight) {
return callback();
}
// wait for all subrequests to return
var done = function() {
if (--inflight === 0) {
callback();
... | [
"function",
"(",
"matches",
",",
"callback",
")",
"{",
"var",
"inflight",
"=",
"matches",
".",
"length",
";",
"// return early if there is no fetching to be done",
"if",
"(",
"!",
"inflight",
")",
"{",
"return",
"callback",
"(",
")",
";",
"}",
"// wait for all s... | build a mapping of url -> text from matches | [
"build",
"a",
"mapping",
"of",
"url",
"-",
">",
"text",
"from",
"matches"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L8396-L8426 | |
12,671 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(style, url, callback) {
var text = style.textContent;
var done = function(text) {
style.textContent = text;
callback(style);
};
this.resolve(text, url, done);
} | javascript | function(style, url, callback) {
var text = style.textContent;
var done = function(text) {
style.textContent = text;
callback(style);
};
this.resolve(text, url, done);
} | [
"function",
"(",
"style",
",",
"url",
",",
"callback",
")",
"{",
"var",
"text",
"=",
"style",
".",
"textContent",
";",
"var",
"done",
"=",
"function",
"(",
"text",
")",
"{",
"style",
".",
"textContent",
"=",
"text",
";",
"callback",
"(",
"style",
")"... | resolve the textContent of a style node | [
"resolve",
"the",
"textContent",
"of",
"a",
"style",
"node"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L8487-L8494 | |
12,672 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(text, base, map) {
var matches = this.loader.extractUrls(text, base);
var match, url, intermediate;
for (var i = 0; i < matches.length; i++) {
match = matches[i];
url = match.url;
// resolve any css text to be relative to the importer, keep absolute url
intermediate = urlRes... | javascript | function(text, base, map) {
var matches = this.loader.extractUrls(text, base);
var match, url, intermediate;
for (var i = 0; i < matches.length; i++) {
match = matches[i];
url = match.url;
// resolve any css text to be relative to the importer, keep absolute url
intermediate = urlRes... | [
"function",
"(",
"text",
",",
"base",
",",
"map",
")",
"{",
"var",
"matches",
"=",
"this",
".",
"loader",
".",
"extractUrls",
"(",
"text",
",",
"base",
")",
";",
"var",
"match",
",",
"url",
",",
"intermediate",
";",
"for",
"(",
"var",
"i",
"=",
"... | flatten all the @imports to text | [
"flatten",
"all",
"the"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L8496-L8509 | |
12,673 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | extend | function extend(prototype, api) {
if (prototype && api) {
// use only own properties of 'api'
Object.getOwnPropertyNames(api).forEach(function(n) {
// acquire property descriptor
var pd = Object.getOwnPropertyDescriptor(api, n);
if (pd) {
// clone property via descripto... | javascript | function extend(prototype, api) {
if (prototype && api) {
// use only own properties of 'api'
Object.getOwnPropertyNames(api).forEach(function(n) {
// acquire property descriptor
var pd = Object.getOwnPropertyDescriptor(api, n);
if (pd) {
// clone property via descripto... | [
"function",
"extend",
"(",
"prototype",
",",
"api",
")",
"{",
"if",
"(",
"prototype",
"&&",
"api",
")",
"{",
"// use only own properties of 'api'",
"Object",
".",
"getOwnPropertyNames",
"(",
"api",
")",
".",
"forEach",
"(",
"function",
"(",
"n",
")",
"{",
... | copy own properties from 'api' to 'prototype, with name hinting for 'super' | [
"copy",
"own",
"properties",
"from",
"api",
"to",
"prototype",
"with",
"name",
"hinting",
"for",
"super"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L8535-L8553 |
12,674 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | copyProperty | function copyProperty(inName, inSource, inTarget) {
var pd = getPropertyDescriptor(inSource, inName);
Object.defineProperty(inTarget, inName, pd);
} | javascript | function copyProperty(inName, inSource, inTarget) {
var pd = getPropertyDescriptor(inSource, inName);
Object.defineProperty(inTarget, inName, pd);
} | [
"function",
"copyProperty",
"(",
"inName",
",",
"inSource",
",",
"inTarget",
")",
"{",
"var",
"pd",
"=",
"getPropertyDescriptor",
"(",
"inSource",
",",
"inName",
")",
";",
"Object",
".",
"defineProperty",
"(",
"inTarget",
",",
"inName",
",",
"pd",
")",
";"... | copy property inName from inSource object to inTarget object | [
"copy",
"property",
"inName",
"from",
"inSource",
"object",
"to",
"inTarget",
"object"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L8574-L8577 |
12,675 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | getPropertyDescriptor | function getPropertyDescriptor(inObject, inName) {
if (inObject) {
var pd = Object.getOwnPropertyDescriptor(inObject, inName);
return pd || getPropertyDescriptor(Object.getPrototypeOf(inObject), inName);
}
} | javascript | function getPropertyDescriptor(inObject, inName) {
if (inObject) {
var pd = Object.getOwnPropertyDescriptor(inObject, inName);
return pd || getPropertyDescriptor(Object.getPrototypeOf(inObject), inName);
}
} | [
"function",
"getPropertyDescriptor",
"(",
"inObject",
",",
"inName",
")",
"{",
"if",
"(",
"inObject",
")",
"{",
"var",
"pd",
"=",
"Object",
".",
"getOwnPropertyDescriptor",
"(",
"inObject",
",",
"inName",
")",
";",
"return",
"pd",
"||",
"getPropertyDescriptor"... | get property descriptor for inName on inObject, even if inName exists on some link in inObject's prototype chain | [
"get",
"property",
"descriptor",
"for",
"inName",
"on",
"inObject",
"even",
"if",
"inName",
"exists",
"on",
"some",
"link",
"in",
"inObject",
"s",
"prototype",
"chain"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L8581-L8586 |
12,676 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | $super | function $super(arrayOfArgs) {
// since we are thunking a method call, performance is important here:
// memoize all lookups, once memoized the fast path calls no other
// functions
//
// find the caller (cannot be `strict` because of 'caller')
var caller = $super.caller;
... | javascript | function $super(arrayOfArgs) {
// since we are thunking a method call, performance is important here:
// memoize all lookups, once memoized the fast path calls no other
// functions
//
// find the caller (cannot be `strict` because of 'caller')
var caller = $super.caller;
... | [
"function",
"$super",
"(",
"arrayOfArgs",
")",
"{",
"// since we are thunking a method call, performance is important here: \r",
"// memoize all lookups, once memoized the fast path calls no other \r",
"// functions\r",
"//\r",
"// find the caller (cannot be `strict` because of 'caller')\r",
"... | will not work if function objects are not unique, for example, when using mixins. The memoization strategy assumes each function exists on only one prototype chain i.e. we use the function object for memoizing) perhaps we can bookkeep on the prototype itself instead | [
"will",
"not",
"work",
"if",
"function",
"objects",
"are",
"not",
"unique",
"for",
"example",
"when",
"using",
"mixins",
".",
"The",
"memoization",
"strategy",
"assumes",
"each",
"function",
"exists",
"on",
"only",
"one",
"prototype",
"chain",
"i",
".",
"e",... | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L8760-L8798 |
12,677 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(anew, old, className) {
if (old) {
old.classList.remove(className);
}
if (anew) {
anew.classList.add(className);
}
} | javascript | function(anew, old, className) {
if (old) {
old.classList.remove(className);
}
if (anew) {
anew.classList.add(className);
}
} | [
"function",
"(",
"anew",
",",
"old",
",",
"className",
")",
"{",
"if",
"(",
"old",
")",
"{",
"old",
".",
"classList",
".",
"remove",
"(",
"className",
")",
";",
"}",
"if",
"(",
"anew",
")",
"{",
"anew",
".",
"classList",
".",
"add",
"(",
"classNa... | Remove class from old, add class to anew, if they exist.
@param classFollows
@param anew A node.
@param old A node
@param className | [
"Remove",
"class",
"from",
"old",
"add",
"class",
"to",
"anew",
"if",
"they",
"exist",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9055-L9062 | |
12,678 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function() {
var events = this.eventDelegates;
log.events && (Object.keys(events).length > 0) && console.log('[%s] addHostListeners:', this.localName, events);
// NOTE: host events look like bindings but really are not;
// (1) we don't want the attribute to be set and (2) we want to support
... | javascript | function() {
var events = this.eventDelegates;
log.events && (Object.keys(events).length > 0) && console.log('[%s] addHostListeners:', this.localName, events);
// NOTE: host events look like bindings but really are not;
// (1) we don't want the attribute to be set and (2) we want to support
... | [
"function",
"(",
")",
"{",
"var",
"events",
"=",
"this",
".",
"eventDelegates",
";",
"log",
".",
"events",
"&&",
"(",
"Object",
".",
"keys",
"(",
"events",
")",
".",
"length",
">",
"0",
")",
"&&",
"console",
".",
"log",
"(",
"'[%s] addHostListeners:'",... | event listeners on host | [
"event",
"listeners",
"on",
"host"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9113-L9124 | |
12,679 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(obj, method, args) {
if (obj) {
log.events && console.group('[%s] dispatch [%s]', obj.localName, method);
var fn = typeof method === 'function' ? method : obj[method];
if (fn) {
fn[args ? 'apply' : 'call'](obj, args);
}
log.events && console.groupEnd();
... | javascript | function(obj, method, args) {
if (obj) {
log.events && console.group('[%s] dispatch [%s]', obj.localName, method);
var fn = typeof method === 'function' ? method : obj[method];
if (fn) {
fn[args ? 'apply' : 'call'](obj, args);
}
log.events && console.groupEnd();
... | [
"function",
"(",
"obj",
",",
"method",
",",
"args",
")",
"{",
"if",
"(",
"obj",
")",
"{",
"log",
".",
"events",
"&&",
"console",
".",
"group",
"(",
"'[%s] dispatch [%s]'",
",",
"obj",
".",
"localName",
",",
"method",
")",
";",
"var",
"fn",
"=",
"ty... | call 'method' or function method on 'obj' with 'args', if the method exists | [
"call",
"method",
"or",
"function",
"method",
"on",
"obj",
"with",
"args",
"if",
"the",
"method",
"exists"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9126-L9140 | |
12,680 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function() {
// if we have no publish lookup table, we have no attributes to take
// TODO(sjmiles): ad hoc
if (this._publishLC) {
for (var i=0, a$=this.attributes, l=a$.length, a; (a=a$[i]) && i<l; i++) {
this.attributeToProperty(a.name, a.value);
}
}
} | javascript | function() {
// if we have no publish lookup table, we have no attributes to take
// TODO(sjmiles): ad hoc
if (this._publishLC) {
for (var i=0, a$=this.attributes, l=a$.length, a; (a=a$[i]) && i<l; i++) {
this.attributeToProperty(a.name, a.value);
}
}
} | [
"function",
"(",
")",
"{",
"// if we have no publish lookup table, we have no attributes to take\r",
"// TODO(sjmiles): ad hoc\r",
"if",
"(",
"this",
".",
"_publishLC",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"a$",
"=",
"this",
".",
"attributes",
",",
"l"... | for each attribute on this, deserialize value to property as needed | [
"for",
"each",
"attribute",
"on",
"this",
"deserialize",
"value",
"to",
"property",
"as",
"needed"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9204-L9212 | |
12,681 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(name, value) {
// try to match this attribute to a property (attributes are
// all lower-case, so this is case-insensitive search)
var name = this.propertyForAttribute(name);
if (name) {
// filter out 'mustached' values, these are to be
// replaced with bound-data ... | javascript | function(name, value) {
// try to match this attribute to a property (attributes are
// all lower-case, so this is case-insensitive search)
var name = this.propertyForAttribute(name);
if (name) {
// filter out 'mustached' values, these are to be
// replaced with bound-data ... | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"// try to match this attribute to a property (attributes are\r",
"// all lower-case, so this is case-insensitive search)\r",
"var",
"name",
"=",
"this",
".",
"propertyForAttribute",
"(",
"name",
")",
";",
"if",
"(",
"name",
... | if attribute 'name' is mapped to a property, deserialize 'value' into that property | [
"if",
"attribute",
"name",
"is",
"mapped",
"to",
"a",
"property",
"deserialize",
"value",
"into",
"that",
"property"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9215-L9236 | |
12,682 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(value, inferredType) {
if (inferredType === 'boolean') {
return value ? '' : undefined;
} else if (inferredType !== 'object' && inferredType !== 'function'
&& value !== undefined) {
return value;
}
} | javascript | function(value, inferredType) {
if (inferredType === 'boolean') {
return value ? '' : undefined;
} else if (inferredType !== 'object' && inferredType !== 'function'
&& value !== undefined) {
return value;
}
} | [
"function",
"(",
"value",
",",
"inferredType",
")",
"{",
"if",
"(",
"inferredType",
"===",
"'boolean'",
")",
"{",
"return",
"value",
"?",
"''",
":",
"undefined",
";",
"}",
"else",
"if",
"(",
"inferredType",
"!==",
"'object'",
"&&",
"inferredType",
"!==",
... | convert to a string value based on the type of `inferredType` | [
"convert",
"to",
"a",
"string",
"value",
"based",
"on",
"the",
"type",
"of",
"inferredType"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9247-L9254 | |
12,683 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(name) {
var inferredType = typeof this[name];
// try to intelligently serialize property value
var serializedValue = this.serializeValue(this[name], inferredType);
// boolean properties must reflect as boolean attributes
if (serializedValue !== undefined) {
this.setA... | javascript | function(name) {
var inferredType = typeof this[name];
// try to intelligently serialize property value
var serializedValue = this.serializeValue(this[name], inferredType);
// boolean properties must reflect as boolean attributes
if (serializedValue !== undefined) {
this.setA... | [
"function",
"(",
"name",
")",
"{",
"var",
"inferredType",
"=",
"typeof",
"this",
"[",
"name",
"]",
";",
"// try to intelligently serialize property value\r",
"var",
"serializedValue",
"=",
"this",
".",
"serializeValue",
"(",
"this",
"[",
"name",
"]",
",",
"infer... | serializes `name` property value and updates the corresponding attribute note that reflection is opt-in. | [
"serializes",
"name",
"property",
"value",
"and",
"updates",
"the",
"corresponding",
"attribute",
"note",
"that",
"reflection",
"is",
"opt",
"-",
"in",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9257-L9272 | |
12,684 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | resolveBindingValue | function resolveBindingValue(oldValue, value) {
if (value === undefined && oldValue === null) {
return value;
}
return (value === null || value === undefined) ? oldValue : value;
} | javascript | function resolveBindingValue(oldValue, value) {
if (value === undefined && oldValue === null) {
return value;
}
return (value === null || value === undefined) ? oldValue : value;
} | [
"function",
"resolveBindingValue",
"(",
"oldValue",
",",
"value",
")",
"{",
"if",
"(",
"value",
"===",
"undefined",
"&&",
"oldValue",
"===",
"null",
")",
"{",
"return",
"value",
";",
"}",
"return",
"(",
"value",
"===",
"null",
"||",
"value",
"===",
"unde... | capture A's value if B's value is null or undefined, otherwise use B's value | [
"capture",
"A",
"s",
"value",
"if",
"B",
"s",
"value",
"is",
"null",
"or",
"undefined",
"otherwise",
"use",
"B",
"s",
"value"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9320-L9325 |
12,685 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function() {
var n$ = this._observeNames;
if (n$ && n$.length) {
var o = this._propertyObserver = new CompoundObserver(true);
this.registerObserver(o);
// TODO(sorvell): may not be kosher to access the value here (this[n]);
// previously we looked at the descriptor on the pro... | javascript | function() {
var n$ = this._observeNames;
if (n$ && n$.length) {
var o = this._propertyObserver = new CompoundObserver(true);
this.registerObserver(o);
// TODO(sorvell): may not be kosher to access the value here (this[n]);
// previously we looked at the descriptor on the pro... | [
"function",
"(",
")",
"{",
"var",
"n$",
"=",
"this",
".",
"_observeNames",
";",
"if",
"(",
"n$",
"&&",
"n$",
".",
"length",
")",
"{",
"var",
"o",
"=",
"this",
".",
"_propertyObserver",
"=",
"new",
"CompoundObserver",
"(",
"true",
")",
";",
"this",
... | creates a CompoundObserver to observe property changes NOTE, this is only done there are any properties in the `observe` object | [
"creates",
"a",
"CompoundObserver",
"to",
"observe",
"property",
"changes",
"NOTE",
"this",
"is",
"only",
"done",
"there",
"are",
"any",
"properties",
"in",
"the",
"observe",
"object"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9331-L9345 | |
12,686 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(name, observable, resolveFn) {
var privateName = name + '_';
var privateObservable = name + 'Observable_';
// Present for properties which are computed and published and have a
// bound value.
var privateComputedBoundValue = name + 'ComputedBoundObservable_';
this[privateOb... | javascript | function(name, observable, resolveFn) {
var privateName = name + '_';
var privateObservable = name + 'Observable_';
// Present for properties which are computed and published and have a
// bound value.
var privateComputedBoundValue = name + 'ComputedBoundObservable_';
this[privateOb... | [
"function",
"(",
"name",
",",
"observable",
",",
"resolveFn",
")",
"{",
"var",
"privateName",
"=",
"name",
"+",
"'_'",
";",
"var",
"privateObservable",
"=",
"name",
"+",
"'Observable_'",
";",
"// Present for properties which are computed and published and have a",
"//... | NOTE property `name` must be published. This makes it an accessor. | [
"NOTE",
"property",
"name",
"must",
"be",
"published",
".",
"This",
"makes",
"it",
"an",
"accessor",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9469-L9509 | |
12,687 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(template) {
// ensure template is decorated (lets' things like <tr template ...> work)
HTMLTemplateElement.decorate(template);
// ensure a default bindingDelegate
var syntax = this.syntax || (!template.bindingDelegate &&
this.element.syntax);
var dom = template.createIns... | javascript | function(template) {
// ensure template is decorated (lets' things like <tr template ...> work)
HTMLTemplateElement.decorate(template);
// ensure a default bindingDelegate
var syntax = this.syntax || (!template.bindingDelegate &&
this.element.syntax);
var dom = template.createIns... | [
"function",
"(",
"template",
")",
"{",
"// ensure template is decorated (lets' things like <tr template ...> work)",
"HTMLTemplateElement",
".",
"decorate",
"(",
"template",
")",
";",
"// ensure a default bindingDelegate",
"var",
"syntax",
"=",
"this",
".",
"syntax",
"||",
... | Creates dom cloned from the given template, instantiating bindings
with this element as the template model and `PolymerExpressions` as the
binding delegate.
@method instanceTemplate
@param {Template} template source template from which to create dom. | [
"Creates",
"dom",
"cloned",
"from",
"the",
"given",
"template",
"instantiating",
"bindings",
"with",
"this",
"element",
"as",
"the",
"template",
"model",
"and",
"PolymerExpressions",
"as",
"the",
"binding",
"delegate",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9610-L9622 | |
12,688 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function() {
if (!this._unbound) {
log.unbind && console.log('[%s] asyncUnbindAll', this.localName);
this._unbindAllJob = this.job(this._unbindAllJob, this.unbindAll, 0);
}
} | javascript | function() {
if (!this._unbound) {
log.unbind && console.log('[%s] asyncUnbindAll', this.localName);
this._unbindAllJob = this.job(this._unbindAllJob, this.unbindAll, 0);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_unbound",
")",
"{",
"log",
".",
"unbind",
"&&",
"console",
".",
"log",
"(",
"'[%s] asyncUnbindAll'",
",",
"this",
".",
"localName",
")",
";",
"this",
".",
"_unbindAllJob",
"=",
"this",
".",
"j... | called at detached time to signal that an element's bindings should be cleaned up. This is done asynchronously so that users have the chance to call `cancelUnbindAll` to prevent unbinding. | [
"called",
"at",
"detached",
"time",
"to",
"signal",
"that",
"an",
"element",
"s",
"bindings",
"should",
"be",
"cleaned",
"up",
".",
"This",
"is",
"done",
"asynchronously",
"so",
"that",
"users",
"have",
"the",
"chance",
"to",
"call",
"cancelUnbindAll",
"to",... | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9665-L9670 | |
12,689 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(job, callback, wait) {
if (typeof job === 'string') {
var n = '___' + job;
this[n] = Polymer.job.call(this, this[n], callback, wait);
} else {
// TODO(sjmiles): suggest we deprecate this call signature
return Polymer.job.call(this, job, callback, wait);
}
} | javascript | function(job, callback, wait) {
if (typeof job === 'string') {
var n = '___' + job;
this[n] = Polymer.job.call(this, this[n], callback, wait);
} else {
// TODO(sjmiles): suggest we deprecate this call signature
return Polymer.job.call(this, job, callback, wait);
}
} | [
"function",
"(",
"job",
",",
"callback",
",",
"wait",
")",
"{",
"if",
"(",
"typeof",
"job",
"===",
"'string'",
")",
"{",
"var",
"n",
"=",
"'___'",
"+",
"job",
";",
"this",
"[",
"n",
"]",
"=",
"Polymer",
".",
"job",
".",
"call",
"(",
"this",
","... | Debounce signals.
Call `job` to defer a named signal, and all subsequent matching signals,
until a wait time has elapsed with no new signal.
debouncedClickAction: function(e) {
// processClick only when it's been 100ms since the last click
this.job('click', function() {
this.processClick;
}, 100);
}
@method job
@par... | [
"Debounce",
"signals",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9778-L9786 | |
12,690 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function() {
if (this.templateInstance && this.templateInstance.model) {
console.warn('Attributes on ' + this.localName + ' were data bound ' +
'prior to Polymer upgrading the element. This may result in ' +
'incorrect binding types.');
}
this.created();
this.prep... | javascript | function() {
if (this.templateInstance && this.templateInstance.model) {
console.warn('Attributes on ' + this.localName + ' were data bound ' +
'prior to Polymer upgrading the element. This may result in ' +
'incorrect binding types.');
}
this.created();
this.prep... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"templateInstance",
"&&",
"this",
".",
"templateInstance",
".",
"model",
")",
"{",
"console",
".",
"warn",
"(",
"'Attributes on '",
"+",
"this",
".",
"localName",
"+",
"' were data bound '",
"+",
"'prior to ... | Low-level lifecycle method called as part of standard Custom Elements
operation. Polymer implements this method to provide basic default
functionality. For custom create-time tasks, implement `created`
instead, which is called immediately after `createdCallback`.
@method createdCallback | [
"Low",
"-",
"level",
"lifecycle",
"method",
"called",
"as",
"part",
"of",
"standard",
"Custom",
"Elements",
"operation",
".",
"Polymer",
"implements",
"this",
"method",
"to",
"provide",
"basic",
"default",
"functionality",
".",
"For",
"custom",
"create",
"-",
... | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9848-L9859 | |
12,691 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function() {
if (this._elementPrepared) {
console.warn('Element already prepared', this.localName);
return;
}
this._elementPrepared = true;
// storage for shadowRoots info
this.shadowRoots = {};
// install property observers
this.createPropertyObserver();
... | javascript | function() {
if (this._elementPrepared) {
console.warn('Element already prepared', this.localName);
return;
}
this._elementPrepared = true;
// storage for shadowRoots info
this.shadowRoots = {};
// install property observers
this.createPropertyObserver();
... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_elementPrepared",
")",
"{",
"console",
".",
"warn",
"(",
"'Element already prepared'",
",",
"this",
".",
"localName",
")",
";",
"return",
";",
"}",
"this",
".",
"_elementPrepared",
"=",
"true",
";",
"/... | system entry point, do not override | [
"system",
"entry",
"point",
"do",
"not",
"override"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9862-L9879 | |
12,692 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(name, oldValue) {
// TODO(sjmiles): adhoc filter
if (name !== 'class' && name !== 'style') {
this.attributeToProperty(name, this.getAttribute(name));
}
if (this.attributeChanged) {
this.attributeChanged.apply(this, arguments);
}
} | javascript | function(name, oldValue) {
// TODO(sjmiles): adhoc filter
if (name !== 'class' && name !== 'style') {
this.attributeToProperty(name, this.getAttribute(name));
}
if (this.attributeChanged) {
this.attributeChanged.apply(this, arguments);
}
} | [
"function",
"(",
"name",
",",
"oldValue",
")",
"{",
"// TODO(sjmiles): adhoc filter",
"if",
"(",
"name",
"!==",
"'class'",
"&&",
"name",
"!==",
"'style'",
")",
"{",
"this",
".",
"attributeToProperty",
"(",
"name",
",",
"this",
".",
"getAttribute",
"(",
"name... | Low-level lifecycle method called as part of standard Custom Elements
operation. Polymer implements this method to provide basic default
functionality. For custom tasks in your element, implement `attributeChanged`
instead, which is called immediately after `attributeChangedCallback`.
@method attributeChangedCallback | [
"Low",
"-",
"level",
"lifecycle",
"method",
"called",
"as",
"part",
"of",
"standard",
"Custom",
"Elements",
"operation",
".",
"Polymer",
"implements",
"this",
"method",
"to",
"provide",
"basic",
"default",
"functionality",
".",
"For",
"custom",
"tasks",
"in",
... | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9904-L9912 | |
12,693 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(p) {
if (p && p.element) {
this.parseDeclarations(p.__proto__);
p.parseDeclaration.call(this, p.element);
}
} | javascript | function(p) {
if (p && p.element) {
this.parseDeclarations(p.__proto__);
p.parseDeclaration.call(this, p.element);
}
} | [
"function",
"(",
"p",
")",
"{",
"if",
"(",
"p",
"&&",
"p",
".",
"element",
")",
"{",
"this",
".",
"parseDeclarations",
"(",
"p",
".",
"__proto__",
")",
";",
"p",
".",
"parseDeclaration",
".",
"call",
"(",
"this",
",",
"p",
".",
"element",
")",
";... | Walks the prototype-chain of this element and allows specific
classes a chance to process static declarations.
In particular, each polymer-element has it's own `template`.
`parseDeclarations` is used to accumulate all element `template`s
from an inheritance chain.
`parseDeclaration` static methods implemented in the ... | [
"Walks",
"the",
"prototype",
"-",
"chain",
"of",
"this",
"element",
"and",
"allows",
"specific",
"classes",
"a",
"chance",
"to",
"process",
"static",
"declarations",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L9985-L9990 | |
12,694 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(template) {
if (template) {
// make a shadow root
var root = this.createShadowRoot();
// stamp template
// which includes parsing and applying MDV bindings before being
// inserted (to avoid {{}} in attribute values)
// e.g. to prevent <img src="images/{{ic... | javascript | function(template) {
if (template) {
// make a shadow root
var root = this.createShadowRoot();
// stamp template
// which includes parsing and applying MDV bindings before being
// inserted (to avoid {{}} in attribute values)
// e.g. to prevent <img src="images/{{ic... | [
"function",
"(",
"template",
")",
"{",
"if",
"(",
"template",
")",
"{",
"// make a shadow root",
"var",
"root",
"=",
"this",
".",
"createShadowRoot",
"(",
")",
";",
"// stamp template",
"// which includes parsing and applying MDV bindings before being",
"// inserted (to a... | Create a shadow-root in this host and stamp `template` as it's
content.
An element may override this method for custom behavior.
@method shadowFromTemplate | [
"Create",
"a",
"shadow",
"-",
"root",
"in",
"this",
"host",
"and",
"stamp",
"template",
"as",
"it",
"s",
"content",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L10032-L10048 | |
12,695 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(node, listener) {
var observer = new MutationObserver(function(mutations) {
listener.call(this, observer, mutations);
observer.disconnect();
}.bind(this));
observer.observe(node, {childList: true, subtree: true});
} | javascript | function(node, listener) {
var observer = new MutationObserver(function(mutations) {
listener.call(this, observer, mutations);
observer.disconnect();
}.bind(this));
observer.observe(node, {childList: true, subtree: true});
} | [
"function",
"(",
"node",
",",
"listener",
")",
"{",
"var",
"observer",
"=",
"new",
"MutationObserver",
"(",
"function",
"(",
"mutations",
")",
"{",
"listener",
".",
"call",
"(",
"this",
",",
"observer",
",",
"mutations",
")",
";",
"observer",
".",
"disco... | Register a one-time callback when a child-list or sub-tree mutation
occurs on node.
For persistent callbacks, call onMutation from your listener.
@method onMutation
@param Node {Node} node Node to watch for mutations.
@param Function {Function} listener Function to call on mutation. The function is invoked as `listen... | [
"Register",
"a",
"one",
"-",
"time",
"callback",
"when",
"a",
"child",
"-",
"list",
"or",
"sub",
"-",
"tree",
"mutation",
"occurs",
"on",
"node",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L10104-L10110 | |
12,696 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(callback) {
var template = this.fetchTemplate();
var content = template && this.templateContent();
if (content) {
this.convertSheetsToStyles(content);
var styles = this.findLoadableStyles(content);
if (styles.length) {
var templateUrl = template.ownerDocument... | javascript | function(callback) {
var template = this.fetchTemplate();
var content = template && this.templateContent();
if (content) {
this.convertSheetsToStyles(content);
var styles = this.findLoadableStyles(content);
if (styles.length) {
var templateUrl = template.ownerDocument... | [
"function",
"(",
"callback",
")",
"{",
"var",
"template",
"=",
"this",
".",
"fetchTemplate",
"(",
")",
";",
"var",
"content",
"=",
"template",
"&&",
"this",
".",
"templateContent",
"(",
")",
";",
"if",
"(",
"content",
")",
"{",
"this",
".",
"convertShe... | returns true if resources are loading | [
"returns",
"true",
"if",
"resources",
"are",
"loading"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L10435-L10449 | |
12,697 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function() {
this.sheets = this.findNodes(SHEET_SELECTOR);
this.sheets.forEach(function(s) {
if (s.parentNode) {
s.parentNode.removeChild(s);
}
});
} | javascript | function() {
this.sheets = this.findNodes(SHEET_SELECTOR);
this.sheets.forEach(function(s) {
if (s.parentNode) {
s.parentNode.removeChild(s);
}
});
} | [
"function",
"(",
")",
"{",
"this",
".",
"sheets",
"=",
"this",
".",
"findNodes",
"(",
"SHEET_SELECTOR",
")",
";",
"this",
".",
"sheets",
".",
"forEach",
"(",
"function",
"(",
"s",
")",
"{",
"if",
"(",
"s",
".",
"parentNode",
")",
"{",
"s",
".",
"... | Remove all sheets from element and store for later use. | [
"Remove",
"all",
"sheets",
"from",
"element",
"and",
"store",
"for",
"later",
"use",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L10492-L10499 | |
12,698 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(name, extendee) {
// build side-chained lists to optimize iterations
this.optimizePropertyMaps(this.prototype);
this.createPropertyAccessors(this.prototype);
// install mdv delegate on template
this.installBindingDelegate(this.fetchTemplate());
// install external stylesheet... | javascript | function(name, extendee) {
// build side-chained lists to optimize iterations
this.optimizePropertyMaps(this.prototype);
this.createPropertyAccessors(this.prototype);
// install mdv delegate on template
this.installBindingDelegate(this.fetchTemplate());
// install external stylesheet... | [
"function",
"(",
"name",
",",
"extendee",
")",
"{",
"// build side-chained lists to optimize iterations",
"this",
".",
"optimizePropertyMaps",
"(",
"this",
".",
"prototype",
")",
";",
"this",
".",
"createPropertyAccessors",
"(",
"this",
".",
"prototype",
")",
";",
... | implement various declarative features | [
"implement",
"various",
"declarative",
"features"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L11187-L11215 | |
12,699 | WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(extnds) {
var prototype = this.findBasePrototype(extnds);
if (!prototype) {
// create a prototype based on tag-name extension
var prototype = HTMLElement.getPrototypeForTag(extnds);
// insert base api in inheritance chain (if needed)
prototype = this.ensureBaseApi(pr... | javascript | function(extnds) {
var prototype = this.findBasePrototype(extnds);
if (!prototype) {
// create a prototype based on tag-name extension
var prototype = HTMLElement.getPrototypeForTag(extnds);
// insert base api in inheritance chain (if needed)
prototype = this.ensureBaseApi(pr... | [
"function",
"(",
"extnds",
")",
"{",
"var",
"prototype",
"=",
"this",
".",
"findBasePrototype",
"(",
"extnds",
")",
";",
"if",
"(",
"!",
"prototype",
")",
"{",
"// create a prototype based on tag-name extension",
"var",
"prototype",
"=",
"HTMLElement",
".",
"get... | build prototype combining extendee, Polymer base, and named api | [
"build",
"prototype",
"combining",
"extendee",
"Polymer",
"base",
"and",
"named",
"api"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L11227-L11238 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.