repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train | |
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 | train | |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train |
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 | train | |
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 | train | |
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 | train |
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 | train | |
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 | train |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(prototype) {
if (prototype.PolymerBase) {
return prototype;
}
var extended = Object.create(prototype);
// we need a unique copy of base api for each base prototype
// therefore we 'extend' here instead of simply chaining
api.publish(api.instance, extended);
// ... | javascript | function(prototype) {
if (prototype.PolymerBase) {
return prototype;
}
var extended = Object.create(prototype);
// we need a unique copy of base api for each base prototype
// therefore we 'extend' here instead of simply chaining
api.publish(api.instance, extended);
// ... | [
"function",
"(",
"prototype",
")",
"{",
"if",
"(",
"prototype",
".",
"PolymerBase",
")",
"{",
"return",
"prototype",
";",
"}",
"var",
"extended",
"=",
"Object",
".",
"create",
"(",
"prototype",
")",
";",
"// we need a unique copy of base api for each base prototyp... | install Polymer instance api into prototype chain, as needed | [
"install",
"Polymer",
"instance",
"api",
"into",
"prototype",
"chain",
"as",
"needed"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L11245-L11268 | train | |
WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(name, extendee) {
var info = {
prototype: this.prototype
}
// native element must be specified in extends
var typeExtension = this.findTypeExtension(extendee);
if (typeExtension) {
info.extends = typeExtension;
}
// register the prototype with HTMLElem... | javascript | function(name, extendee) {
var info = {
prototype: this.prototype
}
// native element must be specified in extends
var typeExtension = this.findTypeExtension(extendee);
if (typeExtension) {
info.extends = typeExtension;
}
// register the prototype with HTMLElem... | [
"function",
"(",
"name",
",",
"extendee",
")",
"{",
"var",
"info",
"=",
"{",
"prototype",
":",
"this",
".",
"prototype",
"}",
"// native element must be specified in extends",
"var",
"typeExtension",
"=",
"this",
".",
"findTypeExtension",
"(",
"extendee",
")",
"... | register 'prototype' to custom element 'name', store constructor | [
"register",
"prototype",
"to",
"custom",
"element",
"name",
"store",
"constructor"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L11289-L11302 | train | |
WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(element, check, go) {
var shouldAdd = element.__queue && !element.__queue.check;
if (shouldAdd) {
queueForElement(element).push(element);
element.__queue.check = check;
element.__queue.go = go;
}
return (this.indexOf(element) !== 0);
} | javascript | function(element, check, go) {
var shouldAdd = element.__queue && !element.__queue.check;
if (shouldAdd) {
queueForElement(element).push(element);
element.__queue.check = check;
element.__queue.go = go;
}
return (this.indexOf(element) !== 0);
} | [
"function",
"(",
"element",
",",
"check",
",",
"go",
")",
"{",
"var",
"shouldAdd",
"=",
"element",
".",
"__queue",
"&&",
"!",
"element",
".",
"__queue",
".",
"check",
";",
"if",
"(",
"shouldAdd",
")",
"{",
"queueForElement",
"(",
"element",
")",
".",
... | enqueue an element to the next spot in the queue. | [
"enqueue",
"an",
"element",
"to",
"the",
"next",
"spot",
"in",
"the",
"queue",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L11392-L11400 | train | |
WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function(element) {
var readied = this.remove(element);
if (readied) {
element.__queue.flushable = true;
this.addToFlushQueue(readied);
this.check();
}
} | javascript | function(element) {
var readied = this.remove(element);
if (readied) {
element.__queue.flushable = true;
this.addToFlushQueue(readied);
this.check();
}
} | [
"function",
"(",
"element",
")",
"{",
"var",
"readied",
"=",
"this",
".",
"remove",
"(",
"element",
")",
";",
"if",
"(",
"readied",
")",
"{",
"element",
".",
"__queue",
".",
"flushable",
"=",
"true",
";",
"this",
".",
"addToFlushQueue",
"(",
"readied",... | tell the queue an element is ready to be registered | [
"tell",
"the",
"queue",
"an",
"element",
"is",
"ready",
"to",
"be",
"registered"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L11412-L11419 | train | |
WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | function() {
var e$ = [];
for (var i=0, l=elements.length, e; (i<l) &&
(e=elements[i]); i++) {
if (e.__queue && !e.__queue.flushable) {
e$.push(e);
}
}
return e$;
} | javascript | function() {
var e$ = [];
for (var i=0, l=elements.length, e; (i<l) &&
(e=elements[i]); i++) {
if (e.__queue && !e.__queue.flushable) {
e$.push(e);
}
}
return e$;
} | [
"function",
"(",
")",
"{",
"var",
"e$",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"elements",
".",
"length",
",",
"e",
";",
"(",
"i",
"<",
"l",
")",
"&&",
"(",
"e",
"=",
"elements",
"[",
"i",
"]",
")",
";",
"i... | Returns a list of elements that have had polymer-elements created but
are not yet ready to register. The list is an array of element definitions. | [
"Returns",
"a",
"list",
"of",
"elements",
"that",
"have",
"had",
"polymer",
"-",
"elements",
"created",
"but",
"are",
"not",
"yet",
"ready",
"to",
"register",
".",
"The",
"list",
"is",
"an",
"array",
"of",
"element",
"definitions",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L11517-L11526 | train | |
WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | forceReady | function forceReady(timeout) {
if (timeout === undefined) {
queue.ready();
return;
}
var handle = setTimeout(function() {
queue.ready();
}, timeout);
Polymer.whenReady(function() {
clearTimeout(handle);
});
} | javascript | function forceReady(timeout) {
if (timeout === undefined) {
queue.ready();
return;
}
var handle = setTimeout(function() {
queue.ready();
}, timeout);
Polymer.whenReady(function() {
clearTimeout(handle);
});
} | [
"function",
"forceReady",
"(",
"timeout",
")",
"{",
"if",
"(",
"timeout",
"===",
"undefined",
")",
"{",
"queue",
".",
"ready",
"(",
")",
";",
"return",
";",
"}",
"var",
"handle",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"queue",
".",
"ready... | Forces polymer to register any pending elements. Can be used to abort
waiting for elements that are partially defined.
@param timeout {Integer} Optional timeout in milliseconds | [
"Forces",
"polymer",
"to",
"register",
"any",
"pending",
"elements",
".",
"Can",
"be",
"used",
"to",
"abort",
"waiting",
"for",
"elements",
"that",
"are",
"partially",
"defined",
"."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L11562-L11573 | train |
WebReflection/document-register-element | examples/bower_components/polymer/polymer.js | _import | function _import(urls, callback) {
if (urls && urls.length) {
var frag = document.createDocumentFragment();
for (var i=0, l=urls.length, url, link; (i<l) && (url=urls[i]); i++) {
link = document.createElement('link');
link.rel = 'import';
link.href = url;
frag.appendChild(l... | javascript | function _import(urls, callback) {
if (urls && urls.length) {
var frag = document.createDocumentFragment();
for (var i=0, l=urls.length, url, link; (i<l) && (url=urls[i]); i++) {
link = document.createElement('link');
link.rel = 'import';
link.href = url;
frag.appendChild(l... | [
"function",
"_import",
"(",
"urls",
",",
"callback",
")",
"{",
"if",
"(",
"urls",
"&&",
"urls",
".",
"length",
")",
"{",
"var",
"frag",
"=",
"document",
".",
"createDocumentFragment",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
... | Loads an HTMLImport for each url specified in the `urls` array.
Notifies when all the imports have loaded by calling the `callback`
function argument. This method can be used to lazily load imports.
For example,
Polymer.import(['my-import1.html', 'my-import2.html'], function() {
console.log('imports lazily loaded');
}... | [
"Loads",
"an",
"HTMLImport",
"for",
"each",
"url",
"specified",
"in",
"the",
"urls",
"array",
".",
"Notifies",
"when",
"all",
"the",
"imports",
"have",
"loaded",
"by",
"calling",
"the",
"callback",
"function",
"argument",
".",
"This",
"method",
"can",
"be",
... | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/bower_components/polymer/polymer.js#L11763-L11776 | train |
WebReflection/document-register-element | examples/js/sor-table.js | slice | function slice(what, start) {
for (var j = 0, i = start || 0, arr = []; i < what.length; i++) {
arr[j++] = what[i];
}
return arr;
} | javascript | function slice(what, start) {
for (var j = 0, i = start || 0, arr = []; i < what.length; i++) {
arr[j++] = what[i];
}
return arr;
} | [
"function",
"slice",
"(",
"what",
",",
"start",
")",
"{",
"for",
"(",
"var",
"j",
"=",
"0",
",",
"i",
"=",
"start",
"||",
"0",
",",
"arr",
"=",
"[",
"]",
";",
"i",
"<",
"what",
".",
"length",
";",
"i",
"++",
")",
"{",
"arr",
"[",
"j",
"++... | es5 shim is broken | [
"es5",
"shim",
"is",
"broken"
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/js/sor-table.js#L12-L17 | train |
WebReflection/document-register-element | examples/js/Object.prototype.watch.js | function (newValue) {
// and no inheritance is involved
if (this === self) {
// notify the method but ...
var value = oldValue;
updateValue(newValue);
// ... do not update the get value
... | javascript | function (newValue) {
// and no inheritance is involved
if (this === self) {
// notify the method but ...
var value = oldValue;
updateValue(newValue);
// ... do not update the get value
... | [
"function",
"(",
"newValue",
")",
"{",
"// and no inheritance is involved",
"if",
"(",
"this",
"===",
"self",
")",
"{",
"// notify the method but ...",
"var",
"value",
"=",
"oldValue",
";",
"updateValue",
"(",
"newValue",
")",
";",
"// ... do not update the get value"... | if not writable ... | [
"if",
"not",
"writable",
"..."
] | f50fb6d3a712745e9f317db241f4c3c523eecb25 | https://github.com/WebReflection/document-register-element/blob/f50fb6d3a712745e9f317db241f4c3c523eecb25/examples/js/Object.prototype.watch.js#L110-L123 | train | |
emberjs/ember-inspector | ember_debug/adapters/web-extension.js | deepClone | function deepClone(item) {
let clone = item;
if (isArray(item)) {
clone = new Array(item.length);
item.forEach((child, key) => {
clone[key] = deepClone(child);
});
} else if (item && typeOf(item) === 'object') {
clone = {};
keys(item).forEach(key => {
clone[key] = deepClone(item[ke... | javascript | function deepClone(item) {
let clone = item;
if (isArray(item)) {
clone = new Array(item.length);
item.forEach((child, key) => {
clone[key] = deepClone(child);
});
} else if (item && typeOf(item) === 'object') {
clone = {};
keys(item).forEach(key => {
clone[key] = deepClone(item[ke... | [
"function",
"deepClone",
"(",
"item",
")",
"{",
"let",
"clone",
"=",
"item",
";",
"if",
"(",
"isArray",
"(",
"item",
")",
")",
"{",
"clone",
"=",
"new",
"Array",
"(",
"item",
".",
"length",
")",
";",
"item",
".",
"forEach",
"(",
"(",
"child",
","... | Recursively clones all arrays. Needed because Chrome
refuses to clone Ember Arrays when extend prototypes is disabled.
If the item passed is an array, a clone of the array is returned.
If the item is an object or an array, or array properties/items are cloned.
@param {Mixed} item The item to clone
@return {Mixed} | [
"Recursively",
"clones",
"all",
"arrays",
".",
"Needed",
"because",
"Chrome",
"refuses",
"to",
"clone",
"Ember",
"Arrays",
"when",
"extend",
"prototypes",
"is",
"disabled",
"."
] | 2237dc1b4818e31a856f3348f35305b10f42f60a | https://github.com/emberjs/ember-inspector/blob/2237dc1b4818e31a856f3348f35305b10f42f60a/ember_debug/adapters/web-extension.js#L78-L92 | train |
emberjs/ember-inspector | skeletons/web-extension/options.js | loadOptions | function loadOptions() {
chrome.storage.sync.get('options', function(data) {
var options = data.options;
document.querySelector('[data-settings=tomster]').checked = options && options.showTomster;
});
} | javascript | function loadOptions() {
chrome.storage.sync.get('options', function(data) {
var options = data.options;
document.querySelector('[data-settings=tomster]').checked = options && options.showTomster;
});
} | [
"function",
"loadOptions",
"(",
")",
"{",
"chrome",
".",
"storage",
".",
"sync",
".",
"get",
"(",
"'options'",
",",
"function",
"(",
"data",
")",
"{",
"var",
"options",
"=",
"data",
".",
"options",
";",
"document",
".",
"querySelector",
"(",
"'[data-sett... | Load the options from storage. | [
"Load",
"the",
"options",
"from",
"storage",
"."
] | 2237dc1b4818e31a856f3348f35305b10f42f60a | https://github.com/emberjs/ember-inspector/blob/2237dc1b4818e31a856f3348f35305b10f42f60a/skeletons/web-extension/options.js#L17-L23 | train |
emberjs/ember-inspector | skeletons/web-extension/options.js | storeOptions | function storeOptions() {
var showTomster = this.checked;
chrome.storage.sync.set({
options: { showTomster: showTomster }
}, function optionsSaved() {
console.log("saved!");
});
} | javascript | function storeOptions() {
var showTomster = this.checked;
chrome.storage.sync.set({
options: { showTomster: showTomster }
}, function optionsSaved() {
console.log("saved!");
});
} | [
"function",
"storeOptions",
"(",
")",
"{",
"var",
"showTomster",
"=",
"this",
".",
"checked",
";",
"chrome",
".",
"storage",
".",
"sync",
".",
"set",
"(",
"{",
"options",
":",
"{",
"showTomster",
":",
"showTomster",
"}",
"}",
",",
"function",
"optionsSav... | Save the updated options to storage. | [
"Save",
"the",
"updated",
"options",
"to",
"storage",
"."
] | 2237dc1b4818e31a856f3348f35305b10f42f60a | https://github.com/emberjs/ember-inspector/blob/2237dc1b4818e31a856f3348f35305b10f42f60a/skeletons/web-extension/options.js#L28-L36 | train |
emberjs/ember-inspector | ember_debug/object-inspector.js | customizeProperties | function customizeProperties(mixinDetails, propertyInfo) {
let newMixinDetails = [];
let neededProperties = {};
let groups = propertyInfo.groups || [];
let skipProperties = propertyInfo.skipProperties || [];
let skipMixins = propertyInfo.skipMixins || [];
if (groups.length) {
mixinDetails[0].expand = f... | javascript | function customizeProperties(mixinDetails, propertyInfo) {
let newMixinDetails = [];
let neededProperties = {};
let groups = propertyInfo.groups || [];
let skipProperties = propertyInfo.skipProperties || [];
let skipMixins = propertyInfo.skipMixins || [];
if (groups.length) {
mixinDetails[0].expand = f... | [
"function",
"customizeProperties",
"(",
"mixinDetails",
",",
"propertyInfo",
")",
"{",
"let",
"newMixinDetails",
"=",
"[",
"]",
";",
"let",
"neededProperties",
"=",
"{",
"}",
";",
"let",
"groups",
"=",
"propertyInfo",
".",
"groups",
"||",
"[",
"]",
";",
"l... | Customizes an object's properties
based on the property `propertyInfo` of
the object's `_debugInfo` method.
Possible options:
- `groups` An array of groups that contains the properties for each group
For example:
```javascript
groups: [
{ name: 'Attributes', properties: ['firstName', 'lastName'] },
{ name: 'Belongs To... | [
"Customizes",
"an",
"object",
"s",
"properties",
"based",
"on",
"the",
"property",
"propertyInfo",
"of",
"the",
"object",
"s",
"_debugInfo",
"method",
"."
] | 2237dc1b4818e31a856f3348f35305b10f42f60a | https://github.com/emberjs/ember-inspector/blob/2237dc1b4818e31a856f3348f35305b10f42f60a/ember_debug/object-inspector.js#L678-L731 | train |
emberjs/ember-inspector | skeletons/web-extension/background-script.js | generateVersionsTooltip | function generateVersionsTooltip(versions) {
return versions.map(function(lib) {
return lib.name + " " + lib.version;
}).join("\n");
} | javascript | function generateVersionsTooltip(versions) {
return versions.map(function(lib) {
return lib.name + " " + lib.version;
}).join("\n");
} | [
"function",
"generateVersionsTooltip",
"(",
"versions",
")",
"{",
"return",
"versions",
".",
"map",
"(",
"function",
"(",
"lib",
")",
"{",
"return",
"lib",
".",
"name",
"+",
"\" \"",
"+",
"lib",
".",
"version",
";",
"}",
")",
".",
"join",
"(",
"\"\\n\"... | Creates the tooltip string to show the version of libraries used in the ClientApp
@param {Array} versions - array of library objects
@return {String} - string of library names and versions | [
"Creates",
"the",
"tooltip",
"string",
"to",
"show",
"the",
"version",
"of",
"libraries",
"used",
"in",
"the",
"ClientApp"
] | 2237dc1b4818e31a856f3348f35305b10f42f60a | https://github.com/emberjs/ember-inspector/blob/2237dc1b4818e31a856f3348f35305b10f42f60a/skeletons/web-extension/background-script.js#L28-L32 | train |
emberjs/ember-inspector | skeletons/web-extension/background-script.js | setActionTitle | function setActionTitle(tabId) {
chrome.pageAction.setTitle({
tabId: tabId,
title: generateVersionsTooltip(activeTabs[tabId])
});
} | javascript | function setActionTitle(tabId) {
chrome.pageAction.setTitle({
tabId: tabId,
title: generateVersionsTooltip(activeTabs[tabId])
});
} | [
"function",
"setActionTitle",
"(",
"tabId",
")",
"{",
"chrome",
".",
"pageAction",
".",
"setTitle",
"(",
"{",
"tabId",
":",
"tabId",
",",
"title",
":",
"generateVersionsTooltip",
"(",
"activeTabs",
"[",
"tabId",
"]",
")",
"}",
")",
";",
"}"
] | Creates the title for the pageAction for the current ClientApp
@param {Number} tabId - the current tab | [
"Creates",
"the",
"title",
"for",
"the",
"pageAction",
"for",
"the",
"current",
"ClientApp"
] | 2237dc1b4818e31a856f3348f35305b10f42f60a | https://github.com/emberjs/ember-inspector/blob/2237dc1b4818e31a856f3348f35305b10f42f60a/skeletons/web-extension/background-script.js#L38-L43 | train |
emberjs/ember-inspector | ember_debug/vendor/source-map.js | relative | function relative(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
aRoot = aRoot.replace(/\/$/, '');
// It is possible for the path to be above the root. In this case, simply
// checking whether the root is a prefix of the path won't work. Instead, we
// need to remove components from ... | javascript | function relative(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
aRoot = aRoot.replace(/\/$/, '');
// It is possible for the path to be above the root. In this case, simply
// checking whether the root is a prefix of the path won't work. Instead, we
// need to remove components from ... | [
"function",
"relative",
"(",
"aRoot",
",",
"aPath",
")",
"{",
"if",
"(",
"aRoot",
"===",
"\"\"",
")",
"{",
"aRoot",
"=",
"\".\"",
";",
"}",
"aRoot",
"=",
"aRoot",
".",
"replace",
"(",
"/",
"\\/$",
"/",
",",
"''",
")",
";",
"// It is possible for the ... | Make a path relative to a URL or another path.
@param aRoot The root path or URL.
@param aPath The path or URL to be made relative to aRoot. | [
"Make",
"a",
"path",
"relative",
"to",
"a",
"URL",
"or",
"another",
"path",
"."
] | 2237dc1b4818e31a856f3348f35305b10f42f60a | https://github.com/emberjs/ember-inspector/blob/2237dc1b4818e31a856f3348f35305b10f42f60a/ember_debug/vendor/source-map.js#L958-L989 | train |
emberjs/ember-inspector | ember_debug/vendor/source-map.js | recursiveSearch | function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
// This function terminates when one of the following is true:
//
// 1. We find the exact element we are looking for.
//
// 2. We did not find the exact element, but we can return the index of
// the next-close... | javascript | function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
// This function terminates when one of the following is true:
//
// 1. We find the exact element we are looking for.
//
// 2. We did not find the exact element, but we can return the index of
// the next-close... | [
"function",
"recursiveSearch",
"(",
"aLow",
",",
"aHigh",
",",
"aNeedle",
",",
"aHaystack",
",",
"aCompare",
",",
"aBias",
")",
"{",
"// This function terminates when one of the following is true:",
"//",
"// 1. We find the exact element we are looking for.",
"//",
"// 2.... | Recursive implementation of binary search.
@param aLow Indices here and lower do not contain the needle.
@param aHigh Indices here and higher do not contain the needle.
@param aNeedle The element being searched for.
@param aHaystack The non-empty array being searched.
@param aCompare Function which takes two elements ... | [
"Recursive",
"implementation",
"of",
"binary",
"search",
"."
] | 2237dc1b4818e31a856f3348f35305b10f42f60a | https://github.com/emberjs/ember-inspector/blob/2237dc1b4818e31a856f3348f35305b10f42f60a/ember_debug/vendor/source-map.js#L2430-L2475 | train |
emberjs/ember-inspector | ember_debug/vendor/source-map.js | randomIntInRange | function randomIntInRange(low, high) {
return Math.round(low + (Math.random() * (high - low)));
} | javascript | function randomIntInRange(low, high) {
return Math.round(low + (Math.random() * (high - low)));
} | [
"function",
"randomIntInRange",
"(",
"low",
",",
"high",
")",
"{",
"return",
"Math",
".",
"round",
"(",
"low",
"+",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"high",
"-",
"low",
")",
")",
")",
";",
"}"
] | Returns a random integer within the range `low .. high` inclusive.
@param {Number} low
The lower bound on the range.
@param {Number} high
The upper bound on the range. | [
"Returns",
"a",
"random",
"integer",
"within",
"the",
"range",
"low",
"..",
"high",
"inclusive",
"."
] | 2237dc1b4818e31a856f3348f35305b10f42f60a | https://github.com/emberjs/ember-inspector/blob/2237dc1b4818e31a856f3348f35305b10f42f60a/ember_debug/vendor/source-map.js#L2562-L2564 | train |
emberjs/ember-inspector | ember_debug/general-debug.js | findMetaTag | function findMetaTag(attribute, regExp = /.*/) {
let metas = document.querySelectorAll(`meta[${attribute}]`);
for (let i = 0; i < metas.length; i++) {
let match = metas[i].getAttribute(attribute).match(regExp);
if (match) {
return metas[i];
}
}
return null;
} | javascript | function findMetaTag(attribute, regExp = /.*/) {
let metas = document.querySelectorAll(`meta[${attribute}]`);
for (let i = 0; i < metas.length; i++) {
let match = metas[i].getAttribute(attribute).match(regExp);
if (match) {
return metas[i];
}
}
return null;
} | [
"function",
"findMetaTag",
"(",
"attribute",
",",
"regExp",
"=",
"/",
".*",
"/",
")",
"{",
"let",
"metas",
"=",
"document",
".",
"querySelectorAll",
"(",
"`",
"${",
"attribute",
"}",
"`",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
... | Finds a meta tag by searching through a certain meta attribute.
@param {String} attribute
@param {RegExp} regExp
@return {Element} | [
"Finds",
"a",
"meta",
"tag",
"by",
"searching",
"through",
"a",
"certain",
"meta",
"attribute",
"."
] | 2237dc1b4818e31a856f3348f35305b10f42f60a | https://github.com/emberjs/ember-inspector/blob/2237dc1b4818e31a856f3348f35305b10f42f60a/ember_debug/general-debug.js#L115-L124 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.