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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
wix/react-templates | src/reactTemplates.js | parseScopeSyntax | function parseScopeSyntax(text) {
// the regex below was built using the following pseudo-code:
// double_quoted_string = `"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"`
// single_quoted_string = `'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'`
// text_out_of_quotes = `[^"']*?`
// expr_parts = double_quoted_string + "|" + single_... | javascript | function parseScopeSyntax(text) {
// the regex below was built using the following pseudo-code:
// double_quoted_string = `"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"`
// single_quoted_string = `'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'`
// text_out_of_quotes = `[^"']*?`
// expr_parts = double_quoted_string + "|" + single_... | [
"function",
"parseScopeSyntax",
"(",
"text",
")",
"{",
"// the regex below was built using the following pseudo-code:",
"// double_quoted_string = `\"[^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*\"`",
"// single_quoted_string = `'[^'\\\\\\\\]*(?:\\\\\\\\.[^'\\\\\\\\]*)*'`",
"// text_out_of_quotes = `... | Parses the rt-scope attribute returning an array of parsed sections
@param {String} scope The scope attribute to parse
@returns {Array} an array of {expression,identifier}
@throws {String} the part of the string that failed to parse | [
"Parses",
"the",
"rt",
"-",
"scope",
"attribute",
"returning",
"an",
"array",
"of",
"parsed",
"sections"
] | becfc2b789c412c9189c35dc900ab6185713cdae | https://github.com/wix/react-templates/blob/becfc2b789c412c9189c35dc900ab6185713cdae/src/reactTemplates.js#L479-L508 | train |
wix/react-templates | src/cli.js | execute | function execute(args) {
try {
const currentOptions = options.parse(args)
return executeOptions(currentOptions)
} catch (error) {
console.error(error.message)
return 1
}
} | javascript | function execute(args) {
try {
const currentOptions = options.parse(args)
return executeOptions(currentOptions)
} catch (error) {
console.error(error.message)
return 1
}
} | [
"function",
"execute",
"(",
"args",
")",
"{",
"try",
"{",
"const",
"currentOptions",
"=",
"options",
".",
"parse",
"(",
"args",
")",
"return",
"executeOptions",
"(",
"currentOptions",
")",
"}",
"catch",
"(",
"error",
")",
"{",
"console",
".",
"error",
"(... | Executes the CLI based on an array of arguments that is passed in.
@param {string|Array|Object} args The arguments to process.
@returns {int} The exit code for the operation. | [
"Executes",
"the",
"CLI",
"based",
"on",
"an",
"array",
"of",
"arguments",
"that",
"is",
"passed",
"in",
"."
] | becfc2b789c412c9189c35dc900ab6185713cdae | https://github.com/wix/react-templates/blob/becfc2b789c412c9189c35dc900ab6185713cdae/src/cli.js#L95-L103 | train |
AnalyticalGraphicsInc/obj2gltf | lib/getJsonBufferPadded.js | getJsonBufferPadded | function getJsonBufferPadded(json) {
let string = JSON.stringify(json);
const boundary = 4;
const byteLength = Buffer.byteLength(string);
const remainder = byteLength % boundary;
const padding = (remainder === 0) ? 0 : boundary - remainder;
let whitespace = '';
for (let i = 0; i < padding; ... | javascript | function getJsonBufferPadded(json) {
let string = JSON.stringify(json);
const boundary = 4;
const byteLength = Buffer.byteLength(string);
const remainder = byteLength % boundary;
const padding = (remainder === 0) ? 0 : boundary - remainder;
let whitespace = '';
for (let i = 0; i < padding; ... | [
"function",
"getJsonBufferPadded",
"(",
"json",
")",
"{",
"let",
"string",
"=",
"JSON",
".",
"stringify",
"(",
"json",
")",
";",
"const",
"boundary",
"=",
"4",
";",
"const",
"byteLength",
"=",
"Buffer",
".",
"byteLength",
"(",
"string",
")",
";",
"const"... | Convert the JSON object to a padded buffer.
Pad the JSON with extra whitespace to fit the next 4-byte boundary. This ensures proper alignment
for the section that follows.
@param {Object} [json] The JSON object.
@returns {Buffer} The padded JSON buffer.
@private | [
"Convert",
"the",
"JSON",
"object",
"to",
"a",
"padded",
"buffer",
"."
] | 67b95daa8cd99dd64324115675c968ef9f1c195c | https://github.com/AnalyticalGraphicsInc/obj2gltf/blob/67b95daa8cd99dd64324115675c968ef9f1c195c/lib/getJsonBufferPadded.js#L15-L29 | train |
AnalyticalGraphicsInc/obj2gltf | lib/readLines.js | readLines | function readLines(path, callback) {
return new Promise(function(resolve, reject) {
const stream = fsExtra.createReadStream(path);
stream.on('error', reject);
stream.on('end', resolve);
const lineReader = readline.createInterface({
input : stream
});
line... | javascript | function readLines(path, callback) {
return new Promise(function(resolve, reject) {
const stream = fsExtra.createReadStream(path);
stream.on('error', reject);
stream.on('end', resolve);
const lineReader = readline.createInterface({
input : stream
});
line... | [
"function",
"readLines",
"(",
"path",
",",
"callback",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"const",
"stream",
"=",
"fsExtra",
".",
"createReadStream",
"(",
"path",
")",
";",
"stream",
".",
"on",... | Read a file line-by-line.
@param {String} path Path to the file.
@param {Function} callback Function to call when reading each line.
@returns {Promise} A promise when the reader is finished.
@private | [
"Read",
"a",
"file",
"line",
"-",
"by",
"-",
"line",
"."
] | 67b95daa8cd99dd64324115675c968ef9f1c195c | https://github.com/AnalyticalGraphicsInc/obj2gltf/blob/67b95daa8cd99dd64324115675c968ef9f1c195c/lib/readLines.js#L17-L28 | train |
AnalyticalGraphicsInc/obj2gltf | lib/gltfToGlb.js | gltfToGlb | function gltfToGlb(gltf, binaryBuffer) {
const buffer = gltf.buffers[0];
if (defined(buffer.uri)) {
binaryBuffer = Buffer.alloc(0);
}
// Create padded binary scene string
const jsonBuffer = getJsonBufferPadded(gltf);
// Allocate buffer (Global header) + (JSON chunk header) + (JSON chun... | javascript | function gltfToGlb(gltf, binaryBuffer) {
const buffer = gltf.buffers[0];
if (defined(buffer.uri)) {
binaryBuffer = Buffer.alloc(0);
}
// Create padded binary scene string
const jsonBuffer = getJsonBufferPadded(gltf);
// Allocate buffer (Global header) + (JSON chunk header) + (JSON chun... | [
"function",
"gltfToGlb",
"(",
"gltf",
",",
"binaryBuffer",
")",
"{",
"const",
"buffer",
"=",
"gltf",
".",
"buffers",
"[",
"0",
"]",
";",
"if",
"(",
"defined",
"(",
"buffer",
".",
"uri",
")",
")",
"{",
"binaryBuffer",
"=",
"Buffer",
".",
"alloc",
"(",... | Convert a glTF to binary glTF.
The glTF is expected to have a single buffer and all embedded resources stored in bufferViews.
@param {Object} gltf The glTF asset.
@param {Buffer} binaryBuffer The binary buffer.
@returns {Buffer} The glb buffer.
@private | [
"Convert",
"a",
"glTF",
"to",
"binary",
"glTF",
"."
] | 67b95daa8cd99dd64324115675c968ef9f1c195c | https://github.com/AnalyticalGraphicsInc/obj2gltf/blob/67b95daa8cd99dd64324115675c968ef9f1c195c/lib/gltfToGlb.js#L20-L61 | train |
AnalyticalGraphicsInc/obj2gltf | lib/obj2gltf.js | obj2gltf | function obj2gltf(objPath, options) {
const defaults = obj2gltf.defaults;
options = defaultValue(options, {});
options.binary = defaultValue(options.binary, defaults.binary);
options.separate = defaultValue(options.separate, defaults.separate);
options.separateTextures = defaultValue(options.separat... | javascript | function obj2gltf(objPath, options) {
const defaults = obj2gltf.defaults;
options = defaultValue(options, {});
options.binary = defaultValue(options.binary, defaults.binary);
options.separate = defaultValue(options.separate, defaults.separate);
options.separateTextures = defaultValue(options.separat... | [
"function",
"obj2gltf",
"(",
"objPath",
",",
"options",
")",
"{",
"const",
"defaults",
"=",
"obj2gltf",
".",
"defaults",
";",
"options",
"=",
"defaultValue",
"(",
"options",
",",
"{",
"}",
")",
";",
"options",
".",
"binary",
"=",
"defaultValue",
"(",
"op... | Converts an obj file to a glTF or glb.
@param {String} objPath Path to the obj file.
@param {Object} [options] An object with the following properties:
@param {Boolean} [options.binary=false] Convert to binary glTF.
@param {Boolean} [options.separate=false] Write out separate buffer files and textures instead of embed... | [
"Converts",
"an",
"obj",
"file",
"to",
"a",
"glTF",
"or",
"glb",
"."
] | 67b95daa8cd99dd64324115675c968ef9f1c195c | https://github.com/AnalyticalGraphicsInc/obj2gltf/blob/67b95daa8cd99dd64324115675c968ef9f1c195c/lib/obj2gltf.js#L42-L92 | train |
AnalyticalGraphicsInc/obj2gltf | lib/loadTexture.js | loadTexture | function loadTexture(texturePath, options) {
options = defaultValue(options, {});
options.checkTransparency = defaultValue(options.checkTransparency, false);
options.decode = defaultValue(options.decode, false);
return fsExtra.readFile(texturePath)
.then(function(source) {
const nam... | javascript | function loadTexture(texturePath, options) {
options = defaultValue(options, {});
options.checkTransparency = defaultValue(options.checkTransparency, false);
options.decode = defaultValue(options.decode, false);
return fsExtra.readFile(texturePath)
.then(function(source) {
const nam... | [
"function",
"loadTexture",
"(",
"texturePath",
",",
"options",
")",
"{",
"options",
"=",
"defaultValue",
"(",
"options",
",",
"{",
"}",
")",
";",
"options",
".",
"checkTransparency",
"=",
"defaultValue",
"(",
"options",
".",
"checkTransparency",
",",
"false",
... | Load a texture file.
@param {String} texturePath Path to the texture file.
@param {Object} [options] An object with the following properties:
@param {Boolean} [options.checkTransparency=false] Do a more exhaustive check for texture transparency by looking at the alpha channel of each pixel.
@param {Boolean} [options.d... | [
"Load",
"a",
"texture",
"file",
"."
] | 67b95daa8cd99dd64324115675c968ef9f1c195c | https://github.com/AnalyticalGraphicsInc/obj2gltf/blob/67b95daa8cd99dd64324115675c968ef9f1c195c/lib/loadTexture.js#L26-L54 | train |
AnalyticalGraphicsInc/obj2gltf | lib/Texture.js | Texture | function Texture() {
this.transparent = false;
this.source = undefined;
this.name = undefined;
this.extension = undefined;
this.path = undefined;
this.pixels = undefined;
this.width = undefined;
this.height = undefined;
} | javascript | function Texture() {
this.transparent = false;
this.source = undefined;
this.name = undefined;
this.extension = undefined;
this.path = undefined;
this.pixels = undefined;
this.width = undefined;
this.height = undefined;
} | [
"function",
"Texture",
"(",
")",
"{",
"this",
".",
"transparent",
"=",
"false",
";",
"this",
".",
"source",
"=",
"undefined",
";",
"this",
".",
"name",
"=",
"undefined",
";",
"this",
".",
"extension",
"=",
"undefined",
";",
"this",
".",
"path",
"=",
... | An object containing information about a texture.
@private | [
"An",
"object",
"containing",
"information",
"about",
"a",
"texture",
"."
] | 67b95daa8cd99dd64324115675c968ef9f1c195c | https://github.com/AnalyticalGraphicsInc/obj2gltf/blob/67b95daa8cd99dd64324115675c968ef9f1c195c/lib/Texture.js#L10-L19 | train |
AnalyticalGraphicsInc/obj2gltf | lib/getBufferPadded.js | getBufferPadded | function getBufferPadded(buffer) {
const boundary = 4;
const byteLength = buffer.length;
const remainder = byteLength % boundary;
if (remainder === 0) {
return buffer;
}
const padding = (remainder === 0) ? 0 : boundary - remainder;
const emptyBuffer = Buffer.alloc(padding);
retur... | javascript | function getBufferPadded(buffer) {
const boundary = 4;
const byteLength = buffer.length;
const remainder = byteLength % boundary;
if (remainder === 0) {
return buffer;
}
const padding = (remainder === 0) ? 0 : boundary - remainder;
const emptyBuffer = Buffer.alloc(padding);
retur... | [
"function",
"getBufferPadded",
"(",
"buffer",
")",
"{",
"const",
"boundary",
"=",
"4",
";",
"const",
"byteLength",
"=",
"buffer",
".",
"length",
";",
"const",
"remainder",
"=",
"byteLength",
"%",
"boundary",
";",
"if",
"(",
"remainder",
"===",
"0",
")",
... | Pad the buffer to the next 4-byte boundary to ensure proper alignment for the section that follows.
@param {Buffer} buffer The buffer.
@returns {Buffer} The padded buffer.
@private | [
"Pad",
"the",
"buffer",
"to",
"the",
"next",
"4",
"-",
"byte",
"boundary",
"to",
"ensure",
"proper",
"alignment",
"for",
"the",
"section",
"that",
"follows",
"."
] | 67b95daa8cd99dd64324115675c968ef9f1c195c | https://github.com/AnalyticalGraphicsInc/obj2gltf/blob/67b95daa8cd99dd64324115675c968ef9f1c195c/lib/getBufferPadded.js#L12-L22 | train |
AnalyticalGraphicsInc/obj2gltf | lib/createGltf.js | createGltf | function createGltf(objData, options) {
const nodes = objData.nodes;
let materials = objData.materials;
const name = objData.name;
// Split materials used by primitives with different types of attributes
materials = splitIncompatibleMaterials(nodes, materials, options);
const gltf = {
... | javascript | function createGltf(objData, options) {
const nodes = objData.nodes;
let materials = objData.materials;
const name = objData.name;
// Split materials used by primitives with different types of attributes
materials = splitIncompatibleMaterials(nodes, materials, options);
const gltf = {
... | [
"function",
"createGltf",
"(",
"objData",
",",
"options",
")",
"{",
"const",
"nodes",
"=",
"objData",
".",
"nodes",
";",
"let",
"materials",
"=",
"objData",
".",
"materials",
";",
"const",
"name",
"=",
"objData",
".",
"name",
";",
"// Split materials used by... | Create a glTF from obj data.
@param {Object} objData An object containing an array of nodes containing geometry information and an array of materials.
@param {Object} options The options object passed along from lib/obj2gltf.js
@returns {Object} A glTF asset.
@private | [
"Create",
"a",
"glTF",
"from",
"obj",
"data",
"."
] | 67b95daa8cd99dd64324115675c968ef9f1c195c | https://github.com/AnalyticalGraphicsInc/obj2gltf/blob/67b95daa8cd99dd64324115675c968ef9f1c195c/lib/createGltf.js#L23-L112 | train |
AnalyticalGraphicsInc/obj2gltf | lib/writeGltf.js | writeGltf | function writeGltf(gltf, options) {
return encodeTextures(gltf)
.then(function() {
const binary = options.binary;
const separate = options.separate;
const separateTextures = options.separateTextures;
const promises = [];
if (separateTextures) {
... | javascript | function writeGltf(gltf, options) {
return encodeTextures(gltf)
.then(function() {
const binary = options.binary;
const separate = options.separate;
const separateTextures = options.separateTextures;
const promises = [];
if (separateTextures) {
... | [
"function",
"writeGltf",
"(",
"gltf",
",",
"options",
")",
"{",
"return",
"encodeTextures",
"(",
"gltf",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"const",
"binary",
"=",
"options",
".",
"binary",
";",
"const",
"separate",
"=",
"options",
".",
... | Write glTF resources as embedded data uris or external files.
@param {Object} gltf The glTF asset.
@param {Object} options The options object passed along from lib/obj2gltf.js
@returns {Promise} A promise that resolves to the glTF JSON or glb buffer.
@private | [
"Write",
"glTF",
"resources",
"as",
"embedded",
"data",
"uris",
"or",
"external",
"files",
"."
] | 67b95daa8cd99dd64324115675c968ef9f1c195c | https://github.com/AnalyticalGraphicsInc/obj2gltf/blob/67b95daa8cd99dd64324115675c968ef9f1c195c/lib/writeGltf.js#L23-L55 | train |
Netflix/unleash | lib/ls.js | ls | function ls (onEnd) {
const FN = require('fstream-npm')
const color = require('chalk')
const glob = require('glob')
const exclude = require('lodash.difference')
const included = [ ]
const all = glob.sync('**/**', { ignore : [ 'node_modules/**/**' ], nodir : true })
FN({ path: process.cwd() })... | javascript | function ls (onEnd) {
const FN = require('fstream-npm')
const color = require('chalk')
const glob = require('glob')
const exclude = require('lodash.difference')
const included = [ ]
const all = glob.sync('**/**', { ignore : [ 'node_modules/**/**' ], nodir : true })
FN({ path: process.cwd() })... | [
"function",
"ls",
"(",
"onEnd",
")",
"{",
"const",
"FN",
"=",
"require",
"(",
"'fstream-npm'",
")",
"const",
"color",
"=",
"require",
"(",
"'chalk'",
")",
"const",
"glob",
"=",
"require",
"(",
"'glob'",
")",
"const",
"exclude",
"=",
"require",
"(",
"'l... | ls module.
@module lib/ls | [
"ls",
"module",
"."
] | 0414ab9938d20b36c99587d84fbc0b52533085ee | https://github.com/Netflix/unleash/blob/0414ab9938d20b36c99587d84fbc0b52533085ee/lib/ls.js#L8-L39 | train |
Netflix/unleash | lib/changelog.js | createBitbucketEnterpriseCommitLink | function createBitbucketEnterpriseCommitLink () {
const pkg = require(process.cwd() + '/package')
const repository = pkg.repository.url
return function (commit) {
const commitStr = commit.substring(0,8)
return repository ?
`[${commitStr}](${repository}/commits/${commitStr})` :
commitStr
}
} | javascript | function createBitbucketEnterpriseCommitLink () {
const pkg = require(process.cwd() + '/package')
const repository = pkg.repository.url
return function (commit) {
const commitStr = commit.substring(0,8)
return repository ?
`[${commitStr}](${repository}/commits/${commitStr})` :
commitStr
}
} | [
"function",
"createBitbucketEnterpriseCommitLink",
"(",
")",
"{",
"const",
"pkg",
"=",
"require",
"(",
"process",
".",
"cwd",
"(",
")",
"+",
"'/package'",
")",
"const",
"repository",
"=",
"pkg",
".",
"repository",
".",
"url",
"return",
"function",
"(",
"comm... | changelog module.
@module lib/changelog | [
"changelog",
"module",
"."
] | 0414ab9938d20b36c99587d84fbc0b52533085ee | https://github.com/Netflix/unleash/blob/0414ab9938d20b36c99587d84fbc0b52533085ee/lib/changelog.js#L10-L20 | train |
Netflix/unleash | lib/changelog.js | writeChangelog | function writeChangelog (options, done) {
options.repoType = options.repoType || 'github'
log('Using repo type: ', colors.magenta(options.repoType))
const pkg = require(process.cwd() + '/package')
const opts = {
log: log,
repository: pkg.repository.url,
version: options.version
}
// Github u... | javascript | function writeChangelog (options, done) {
options.repoType = options.repoType || 'github'
log('Using repo type: ', colors.magenta(options.repoType))
const pkg = require(process.cwd() + '/package')
const opts = {
log: log,
repository: pkg.repository.url,
version: options.version
}
// Github u... | [
"function",
"writeChangelog",
"(",
"options",
",",
"done",
")",
"{",
"options",
".",
"repoType",
"=",
"options",
".",
"repoType",
"||",
"'github'",
"log",
"(",
"'Using repo type: '",
",",
"colors",
".",
"magenta",
"(",
"options",
".",
"repoType",
")",
")",
... | Output change information from git commits to CHANGELOG.md
@param options - {Object} that contains all the options of the changelog writer
- repoType: The {String} repo type (github or bitbucket) of the project (default to `"github"`),
- version: The {String} semantic version to add a change log for
@param done - {Fun... | [
"Output",
"change",
"information",
"from",
"git",
"commits",
"to",
"CHANGELOG",
".",
"md"
] | 0414ab9938d20b36c99587d84fbc0b52533085ee | https://github.com/Netflix/unleash/blob/0414ab9938d20b36c99587d84fbc0b52533085ee/lib/changelog.js#L32-L58 | train |
Netflix/unleash | lib/git.js | caller | function caller() {
const returnedArgs = Array.prototype.slice.call(arguments)
const fn = returnedArgs.shift()
const self = this
return wrapPromise(function (resolve, reject) {
returnedArgs.push(function (err, args) {
if (err) {
reject(err)
return
}
resolve(args)
})
... | javascript | function caller() {
const returnedArgs = Array.prototype.slice.call(arguments)
const fn = returnedArgs.shift()
const self = this
return wrapPromise(function (resolve, reject) {
returnedArgs.push(function (err, args) {
if (err) {
reject(err)
return
}
resolve(args)
})
... | [
"function",
"caller",
"(",
")",
"{",
"const",
"returnedArgs",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
"const",
"fn",
"=",
"returnedArgs",
".",
"shift",
"(",
")",
"const",
"self",
"=",
"this",
"return",
"wrapPromi... | Caller abstract method
for promisifying traditional callback methods | [
"Caller",
"abstract",
"method",
"for",
"promisifying",
"traditional",
"callback",
"methods"
] | 0414ab9938d20b36c99587d84fbc0b52533085ee | https://github.com/Netflix/unleash/blob/0414ab9938d20b36c99587d84fbc0b52533085ee/lib/git.js#L29-L46 | train |
twilio/twilio-node | lib/jwt/taskrouter/util.js | defaultWorkerPolicies | function defaultWorkerPolicies(version, workspaceSid, workerSid) {
var activities = new Policy({
url: _.join([TASKROUTER_BASE_URL, version, 'Workspaces', workspaceSid, 'Activities'], '/'),
method: 'GET',
allow: true
});
var tasks = new Policy({
url: _.join([TASKROUTER_BASE_URL, version, 'Workspace... | javascript | function defaultWorkerPolicies(version, workspaceSid, workerSid) {
var activities = new Policy({
url: _.join([TASKROUTER_BASE_URL, version, 'Workspaces', workspaceSid, 'Activities'], '/'),
method: 'GET',
allow: true
});
var tasks = new Policy({
url: _.join([TASKROUTER_BASE_URL, version, 'Workspace... | [
"function",
"defaultWorkerPolicies",
"(",
"version",
",",
"workspaceSid",
",",
"workerSid",
")",
"{",
"var",
"activities",
"=",
"new",
"Policy",
"(",
"{",
"url",
":",
"_",
".",
"join",
"(",
"[",
"TASKROUTER_BASE_URL",
",",
"version",
",",
"'Workspaces'",
","... | Build the default Policies for a worker
@param {string} version TaskRouter version
@param {string} workspaceSid workspace sid
@param {string} workerSid worker sid
@returns {Array<Policy>} list of Policies | [
"Build",
"the",
"default",
"Policies",
"for",
"a",
"worker"
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/jwt/taskrouter/util.js#L18-L44 | train |
twilio/twilio-node | lib/jwt/taskrouter/util.js | defaultEventBridgePolicies | function defaultEventBridgePolicies(accountSid, channelId) {
var url = _.join([EVENT_URL_BASE, accountSid, channelId], '/');
return [
new Policy({
url: url,
method: 'GET',
allow: true
}),
new Policy({
url: url,
method: 'POST',
allow: true
})
];
} | javascript | function defaultEventBridgePolicies(accountSid, channelId) {
var url = _.join([EVENT_URL_BASE, accountSid, channelId], '/');
return [
new Policy({
url: url,
method: 'GET',
allow: true
}),
new Policy({
url: url,
method: 'POST',
allow: true
})
];
} | [
"function",
"defaultEventBridgePolicies",
"(",
"accountSid",
",",
"channelId",
")",
"{",
"var",
"url",
"=",
"_",
".",
"join",
"(",
"[",
"EVENT_URL_BASE",
",",
"accountSid",
",",
"channelId",
"]",
",",
"'/'",
")",
";",
"return",
"[",
"new",
"Policy",
"(",
... | Build the default Event Bridge Policies
@param {string} accountSid account sid
@param {string} channelId channel id
@returns {Array<Policy>} list of Policies | [
"Build",
"the",
"default",
"Event",
"Bridge",
"Policies"
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/jwt/taskrouter/util.js#L53-L67 | train |
twilio/twilio-node | lib/jwt/taskrouter/util.js | workspacesUrl | function workspacesUrl(workspaceSid) {
return _.join(
_.filter([TASKROUTER_BASE_URL, TASKROUTER_VERSION, 'Workspaces', workspaceSid], _.isString),
'/'
);
} | javascript | function workspacesUrl(workspaceSid) {
return _.join(
_.filter([TASKROUTER_BASE_URL, TASKROUTER_VERSION, 'Workspaces', workspaceSid], _.isString),
'/'
);
} | [
"function",
"workspacesUrl",
"(",
"workspaceSid",
")",
"{",
"return",
"_",
".",
"join",
"(",
"_",
".",
"filter",
"(",
"[",
"TASKROUTER_BASE_URL",
",",
"TASKROUTER_VERSION",
",",
"'Workspaces'",
",",
"workspaceSid",
"]",
",",
"_",
".",
"isString",
")",
",",
... | Generate TaskRouter workspace url
@param {string} [workspaceSid] workspace sid or '**' for all workspaces
@return {string} generated url | [
"Generate",
"TaskRouter",
"workspace",
"url"
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/jwt/taskrouter/util.js#L75-L80 | train |
twilio/twilio-node | lib/jwt/taskrouter/util.js | taskQueuesUrl | function taskQueuesUrl(workspaceSid, taskQueueSid) {
return _.join(
_.filter([workspacesUrl(workspaceSid), 'TaskQueues', taskQueueSid], _.isString),
'/'
);
} | javascript | function taskQueuesUrl(workspaceSid, taskQueueSid) {
return _.join(
_.filter([workspacesUrl(workspaceSid), 'TaskQueues', taskQueueSid], _.isString),
'/'
);
} | [
"function",
"taskQueuesUrl",
"(",
"workspaceSid",
",",
"taskQueueSid",
")",
"{",
"return",
"_",
".",
"join",
"(",
"_",
".",
"filter",
"(",
"[",
"workspacesUrl",
"(",
"workspaceSid",
")",
",",
"'TaskQueues'",
",",
"taskQueueSid",
"]",
",",
"_",
".",
"isStri... | Generate TaskRouter task queue url
@param {string} workspaceSid workspace sid
@param {string} [taskQueueSid] task queue sid or '**' for all task queues
@return {string} generated url | [
"Generate",
"TaskRouter",
"task",
"queue",
"url"
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/jwt/taskrouter/util.js#L89-L94 | train |
twilio/twilio-node | lib/jwt/taskrouter/util.js | tasksUrl | function tasksUrl(workspaceSid, taskSid) {
return _.join(
_.filter([workspacesUrl(workspaceSid), 'Tasks', taskSid], _.isString),
'/'
);
} | javascript | function tasksUrl(workspaceSid, taskSid) {
return _.join(
_.filter([workspacesUrl(workspaceSid), 'Tasks', taskSid], _.isString),
'/'
);
} | [
"function",
"tasksUrl",
"(",
"workspaceSid",
",",
"taskSid",
")",
"{",
"return",
"_",
".",
"join",
"(",
"_",
".",
"filter",
"(",
"[",
"workspacesUrl",
"(",
"workspaceSid",
")",
",",
"'Tasks'",
",",
"taskSid",
"]",
",",
"_",
".",
"isString",
")",
",",
... | Generate TaskRouter task url
@param {string} workspaceSid workspace sid
@param {string} [taskSid] task sid or '**' for all tasks
@returns {string} generated url | [
"Generate",
"TaskRouter",
"task",
"url"
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/jwt/taskrouter/util.js#L103-L108 | train |
twilio/twilio-node | lib/jwt/taskrouter/util.js | activitiesUrl | function activitiesUrl(workspaceSid, activitySid) {
return _.join(
_.filter([workspacesUrl(workspaceSid), 'Activities', activitySid], _.isString),
'/'
);
} | javascript | function activitiesUrl(workspaceSid, activitySid) {
return _.join(
_.filter([workspacesUrl(workspaceSid), 'Activities', activitySid], _.isString),
'/'
);
} | [
"function",
"activitiesUrl",
"(",
"workspaceSid",
",",
"activitySid",
")",
"{",
"return",
"_",
".",
"join",
"(",
"_",
".",
"filter",
"(",
"[",
"workspacesUrl",
"(",
"workspaceSid",
")",
",",
"'Activities'",
",",
"activitySid",
"]",
",",
"_",
".",
"isString... | Generate TaskRouter activity url
@param {string} workspaceSid workspace sid
@param {string} [activitySid] activity sid or '**' for all activities
@returns {string} generated url | [
"Generate",
"TaskRouter",
"activity",
"url"
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/jwt/taskrouter/util.js#L117-L122 | train |
twilio/twilio-node | lib/jwt/taskrouter/util.js | workersUrl | function workersUrl(workspaceSid, workerSid) {
return _.join(
_.filter([workspacesUrl(workspaceSid), 'Workers', workerSid], _.isString),
'/'
);
} | javascript | function workersUrl(workspaceSid, workerSid) {
return _.join(
_.filter([workspacesUrl(workspaceSid), 'Workers', workerSid], _.isString),
'/'
);
} | [
"function",
"workersUrl",
"(",
"workspaceSid",
",",
"workerSid",
")",
"{",
"return",
"_",
".",
"join",
"(",
"_",
".",
"filter",
"(",
"[",
"workspacesUrl",
"(",
"workspaceSid",
")",
",",
"'Workers'",
",",
"workerSid",
"]",
",",
"_",
".",
"isString",
")",
... | Generate TaskRouter worker url
@param {string} workspaceSid workspace sid
@param {string} [workerSid] worker sid or '**' for all workers
@returns {string} generated url | [
"Generate",
"TaskRouter",
"worker",
"url"
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/jwt/taskrouter/util.js#L131-L136 | train |
twilio/twilio-node | lib/jwt/taskrouter/util.js | reservationsUrl | function reservationsUrl(workspaceSid, workerSid, reservationSid) {
return _.join(
_.filter([workersUrl(workspaceSid, workerSid), 'Reservations', reservationSid], _.isString),
'/'
);
} | javascript | function reservationsUrl(workspaceSid, workerSid, reservationSid) {
return _.join(
_.filter([workersUrl(workspaceSid, workerSid), 'Reservations', reservationSid], _.isString),
'/'
);
} | [
"function",
"reservationsUrl",
"(",
"workspaceSid",
",",
"workerSid",
",",
"reservationSid",
")",
"{",
"return",
"_",
".",
"join",
"(",
"_",
".",
"filter",
"(",
"[",
"workersUrl",
"(",
"workspaceSid",
",",
"workerSid",
")",
",",
"'Reservations'",
",",
"reser... | Generate TaskRouter worker reservation url
@param {string} workspaceSid workspace sid
@param {string} workerSid worker sid
@param {string} [reservationSid] reservation sid or '**' for all reservations
@returns {string} generated url | [
"Generate",
"TaskRouter",
"worker",
"reservation",
"url"
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/jwt/taskrouter/util.js#L146-L151 | train |
twilio/twilio-node | lib/jwt/taskrouter/TaskRouterCapability.js | Policy | function Policy(options) {
options = options || {};
this.url = options.url;
this.method = options.method || 'GET';
this.queryFilter = options.queryFilter || {};
this.postFilter = options.postFilter || {};
this.allow = options.allow || true;
} | javascript | function Policy(options) {
options = options || {};
this.url = options.url;
this.method = options.method || 'GET';
this.queryFilter = options.queryFilter || {};
this.postFilter = options.postFilter || {};
this.allow = options.allow || true;
} | [
"function",
"Policy",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"url",
"=",
"options",
".",
"url",
";",
"this",
".",
"method",
"=",
"options",
".",
"method",
"||",
"'GET'",
";",
"this",
".",
"queryFilter",... | Create a new Policy
@constructor
@param {object} options - ...
@param {string} [options.url] - Policy URL
@param {string} [options.method] - HTTP Method
@param {object} [options.queryFilter] - Request query filter allowances
@param {object} [options.postFilter] - Request post filter allowances
@param {boolean} [option... | [
"Create",
"a",
"new",
"Policy"
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/jwt/taskrouter/TaskRouterCapability.js#L17-L24 | train |
twilio/twilio-node | lib/webhooks/webhooks.js | getExpectedTwilioSignature | function getExpectedTwilioSignature(authToken, url, params) {
if (url.indexOf('bodySHA256') != -1) params = {};
var data = Object.keys(params)
.sort()
.reduce((acc, key) => acc + key + params[key], url);
return crypto
.createHmac('sha1', authToken)
.update(Buffer.from(data, 'utf-8'))
.diges... | javascript | function getExpectedTwilioSignature(authToken, url, params) {
if (url.indexOf('bodySHA256') != -1) params = {};
var data = Object.keys(params)
.sort()
.reduce((acc, key) => acc + key + params[key], url);
return crypto
.createHmac('sha1', authToken)
.update(Buffer.from(data, 'utf-8'))
.diges... | [
"function",
"getExpectedTwilioSignature",
"(",
"authToken",
",",
"url",
",",
"params",
")",
"{",
"if",
"(",
"url",
".",
"indexOf",
"(",
"'bodySHA256'",
")",
"!=",
"-",
"1",
")",
"params",
"=",
"{",
"}",
";",
"var",
"data",
"=",
"Object",
".",
"keys",
... | Utility function to get the expected signature for a given request
@param {string} authToken - The auth token, as seen in the Twilio portal
@param {string} url - The full URL (with query string) you configured to handle this request
@param {object} params - the parameters sent with this request
@returns {string} - sig... | [
"Utility",
"function",
"to",
"get",
"the",
"expected",
"signature",
"for",
"a",
"given",
"request"
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/webhooks/webhooks.js#L16-L26 | train |
twilio/twilio-node | lib/webhooks/webhooks.js | validateRequest | function validateRequest(authToken, twilioHeader, url, params) {
var expectedSignature = getExpectedTwilioSignature(authToken, url, params);
return scmp(Buffer.from(twilioHeader), Buffer.from(expectedSignature));
} | javascript | function validateRequest(authToken, twilioHeader, url, params) {
var expectedSignature = getExpectedTwilioSignature(authToken, url, params);
return scmp(Buffer.from(twilioHeader), Buffer.from(expectedSignature));
} | [
"function",
"validateRequest",
"(",
"authToken",
",",
"twilioHeader",
",",
"url",
",",
"params",
")",
"{",
"var",
"expectedSignature",
"=",
"getExpectedTwilioSignature",
"(",
"authToken",
",",
"url",
",",
"params",
")",
";",
"return",
"scmp",
"(",
"Buffer",
".... | Utility function to validate an incoming request is indeed from Twilio
@param {string} authToken - The auth token, as seen in the Twilio portal
@param {string} twilioHeader - The value of the X-Twilio-Signature header from the request
@param {string} url - The full URL (with query string) you configured to handle this... | [
"Utility",
"function",
"to",
"validate",
"an",
"incoming",
"request",
"is",
"indeed",
"from",
"Twilio"
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/webhooks/webhooks.js#L49-L52 | train |
twilio/twilio-node | lib/webhooks/webhooks.js | validateRequestWithBody | function validateRequestWithBody(authToken, twilioHeader, requestUrl, body) {
var urlObject = new url.URL(requestUrl);
return validateRequest(authToken, twilioHeader, requestUrl, {}) && validateBody(body, urlObject.searchParams.get('bodySHA256'));
} | javascript | function validateRequestWithBody(authToken, twilioHeader, requestUrl, body) {
var urlObject = new url.URL(requestUrl);
return validateRequest(authToken, twilioHeader, requestUrl, {}) && validateBody(body, urlObject.searchParams.get('bodySHA256'));
} | [
"function",
"validateRequestWithBody",
"(",
"authToken",
",",
"twilioHeader",
",",
"requestUrl",
",",
"body",
")",
"{",
"var",
"urlObject",
"=",
"new",
"url",
".",
"URL",
"(",
"requestUrl",
")",
";",
"return",
"validateRequest",
"(",
"authToken",
",",
"twilioH... | Utility function to validate an incoming request is indeed from Twilio. This also validates
the request body against the bodySHA256 post parameter.
@param {string} authToken - The auth token, as seen in the Twilio portal
@param {string} twilioHeader - The value of the X-Twilio-Signature header from the request
@param ... | [
"Utility",
"function",
"to",
"validate",
"an",
"incoming",
"request",
"is",
"indeed",
"from",
"Twilio",
".",
"This",
"also",
"validates",
"the",
"request",
"body",
"against",
"the",
"bodySHA256",
"post",
"parameter",
"."
] | 61c56f8345c49ed7fa73fbfc1cdf943b6c324542 | https://github.com/twilio/twilio-node/blob/61c56f8345c49ed7fa73fbfc1cdf943b6c324542/lib/webhooks/webhooks.js#L64-L67 | train |
ericgio/react-bootstrap-typeahead | src/utils/getTruncatedOptions.js | getTruncatedOptions | function getTruncatedOptions(options, maxResults) {
if (!maxResults || maxResults >= options.length) {
return options;
}
return options.slice(0, maxResults);
} | javascript | function getTruncatedOptions(options, maxResults) {
if (!maxResults || maxResults >= options.length) {
return options;
}
return options.slice(0, maxResults);
} | [
"function",
"getTruncatedOptions",
"(",
"options",
",",
"maxResults",
")",
"{",
"if",
"(",
"!",
"maxResults",
"||",
"maxResults",
">=",
"options",
".",
"length",
")",
"{",
"return",
"options",
";",
"}",
"return",
"options",
".",
"slice",
"(",
"0",
",",
"... | Truncates the result set based on `maxResults` and returns the new set. | [
"Truncates",
"the",
"result",
"set",
"based",
"on",
"maxResults",
"and",
"returns",
"the",
"new",
"set",
"."
] | 528cc8081b634bfd58727f6d95939fb515ab3cb1 | https://github.com/ericgio/react-bootstrap-typeahead/blob/528cc8081b634bfd58727f6d95939fb515ab3cb1/src/utils/getTruncatedOptions.js#L4-L10 | train |
cronvel/terminal-kit | lib/termconfig/linux.js | gpmMouse | function gpmMouse( mode ) {
var self = this ;
if ( this.root.gpmHandler ) {
this.root.gpmHandler.close() ;
this.root.gpmHandler = undefined ;
}
if ( ! mode ) {
//console.log( '>>>>> off <<<<<' ) ;
return ;
}
this.root.gpmHandler = gpm.createHandler( { stdin: this.root.stdin , raw: false , mode: mode }... | javascript | function gpmMouse( mode ) {
var self = this ;
if ( this.root.gpmHandler ) {
this.root.gpmHandler.close() ;
this.root.gpmHandler = undefined ;
}
if ( ! mode ) {
//console.log( '>>>>> off <<<<<' ) ;
return ;
}
this.root.gpmHandler = gpm.createHandler( { stdin: this.root.stdin , raw: false , mode: mode }... | [
"function",
"gpmMouse",
"(",
"mode",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"this",
".",
"root",
".",
"gpmHandler",
")",
"{",
"this",
".",
"root",
".",
"gpmHandler",
".",
"close",
"(",
")",
";",
"this",
".",
"root",
".",
"gpmHandler"... | This is the code that handle GPM | [
"This",
"is",
"the",
"code",
"that",
"handle",
"GPM"
] | e0a3ff6cd7dac62cc222e9ac10a5d95d9eee1d73 | https://github.com/cronvel/terminal-kit/blob/e0a3ff6cd7dac62cc222e9ac10a5d95d9eee1d73/lib/termconfig/linux.js#L268-L293 | train |
cronvel/terminal-kit | lib/TextBuffer.js | TextBuffer | function TextBuffer( options = {} ) {
this.ScreenBuffer = options.ScreenBuffer || ( options.dst && options.dst.constructor ) || termkit.ScreenBuffer ;
// a screenBuffer
this.dst = options.dst ;
// virtually infinity by default
this.width = options.width || Infinity ;
this.height = options.height || Infinity ;
... | javascript | function TextBuffer( options = {} ) {
this.ScreenBuffer = options.ScreenBuffer || ( options.dst && options.dst.constructor ) || termkit.ScreenBuffer ;
// a screenBuffer
this.dst = options.dst ;
// virtually infinity by default
this.width = options.width || Infinity ;
this.height = options.height || Infinity ;
... | [
"function",
"TextBuffer",
"(",
"options",
"=",
"{",
"}",
")",
"{",
"this",
".",
"ScreenBuffer",
"=",
"options",
".",
"ScreenBuffer",
"||",
"(",
"options",
".",
"dst",
"&&",
"options",
".",
"dst",
".",
"constructor",
")",
"||",
"termkit",
".",
"ScreenBuff... | A buffer suitable for text editor | [
"A",
"buffer",
"suitable",
"for",
"text",
"editor"
] | e0a3ff6cd7dac62cc222e9ac10a5d95d9eee1d73 | https://github.com/cronvel/terminal-kit/blob/e0a3ff6cd7dac62cc222e9ac10a5d95d9eee1d73/lib/TextBuffer.js#L40-L68 | train |
cronvel/terminal-kit | lib/Terminal.js | onResize | function onResize() {
if ( this.stdout.columns && this.stdout.rows ) {
this.width = this.stdout.columns ;
this.height = this.stdout.rows ;
}
this.emit( 'resize' , this.width , this.height ) ;
} | javascript | function onResize() {
if ( this.stdout.columns && this.stdout.rows ) {
this.width = this.stdout.columns ;
this.height = this.stdout.rows ;
}
this.emit( 'resize' , this.width , this.height ) ;
} | [
"function",
"onResize",
"(",
")",
"{",
"if",
"(",
"this",
".",
"stdout",
".",
"columns",
"&&",
"this",
".",
"stdout",
".",
"rows",
")",
"{",
"this",
".",
"width",
"=",
"this",
".",
"stdout",
".",
"columns",
";",
"this",
".",
"height",
"=",
"this",
... | Called by either SIGWINCH signal or stdout's 'resize' event. It is not meant to be used by end-user. | [
"Called",
"by",
"either",
"SIGWINCH",
"signal",
"or",
"stdout",
"s",
"resize",
"event",
".",
"It",
"is",
"not",
"meant",
"to",
"be",
"used",
"by",
"end",
"-",
"user",
"."
] | e0a3ff6cd7dac62cc222e9ac10a5d95d9eee1d73 | https://github.com/cronvel/terminal-kit/blob/e0a3ff6cd7dac62cc222e9ac10a5d95d9eee1d73/lib/Terminal.js#L932-L939 | train |
catamphetamine/read-excel-file | source/convertToJson.js | parseValueOfType | function parseValueOfType(value, type, options) {
switch (type) {
case String:
return { value }
case Number:
case 'Integer':
case Integer:
// The global isFinite() function determines
// whether the passed value is a finite number.
// If needed, the parameter is first convert... | javascript | function parseValueOfType(value, type, options) {
switch (type) {
case String:
return { value }
case Number:
case 'Integer':
case Integer:
// The global isFinite() function determines
// whether the passed value is a finite number.
// If needed, the parameter is first convert... | [
"function",
"parseValueOfType",
"(",
"value",
",",
"type",
",",
"options",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"String",
":",
"return",
"{",
"value",
"}",
"case",
"Number",
":",
"case",
"'Integer'",
":",
"case",
"Integer",
":",
"// The glo... | Converts textual value to a javascript typed value.
@param {string} value
@param {} type
@return {{ value: (string|number|Date|boolean), error: string }} | [
"Converts",
"textual",
"value",
"to",
"a",
"javascript",
"typed",
"value",
"."
] | 78b3a47bdf01788c12d6674b3a1f42fd7cc92510 | https://github.com/catamphetamine/read-excel-file/blob/78b3a47bdf01788c12d6674b3a1f42fd7cc92510/source/convertToJson.js#L183-L251 | train |
FaridSafi/react-native-gifted-listview | GiftedListView.js | MergeRowsWithHeaders | function MergeRowsWithHeaders(obj1, obj2) {
for(var p in obj2){
if(obj1[p] instanceof Array && obj1[p] instanceof Array){
obj1[p] = obj1[p].concat(obj2[p])
} else {
obj1[p] = obj2[p]
}
}
return obj1;
} | javascript | function MergeRowsWithHeaders(obj1, obj2) {
for(var p in obj2){
if(obj1[p] instanceof Array && obj1[p] instanceof Array){
obj1[p] = obj1[p].concat(obj2[p])
} else {
obj1[p] = obj2[p]
}
}
return obj1;
} | [
"function",
"MergeRowsWithHeaders",
"(",
"obj1",
",",
"obj2",
")",
"{",
"for",
"(",
"var",
"p",
"in",
"obj2",
")",
"{",
"if",
"(",
"obj1",
"[",
"p",
"]",
"instanceof",
"Array",
"&&",
"obj1",
"[",
"p",
"]",
"instanceof",
"Array",
")",
"{",
"obj1",
"... | small helper function which merged two objects into one | [
"small",
"helper",
"function",
"which",
"merged",
"two",
"objects",
"into",
"one"
] | 1415f0f4656245c139c94195073a44243e1c4c8c | https://github.com/FaridSafi/react-native-gifted-listview/blob/1415f0f4656245c139c94195073a44243e1c4c8c/GiftedListView.js#L17-L26 | train |
remarkjs/remark | packages/remark-parse/lib/parse.js | parse | function parse() {
var self = this
var value = String(self.file)
var start = {line: 1, column: 1, offset: 0}
var content = xtend(start)
var node
// Clean non-unix newlines: `\r\n` and `\r` are all changed to `\n`.
// This should not affect positional information.
value = value.replace(lineBreaksExpress... | javascript | function parse() {
var self = this
var value = String(self.file)
var start = {line: 1, column: 1, offset: 0}
var content = xtend(start)
var node
// Clean non-unix newlines: `\r\n` and `\r` are all changed to `\n`.
// This should not affect positional information.
value = value.replace(lineBreaksExpress... | [
"function",
"parse",
"(",
")",
"{",
"var",
"self",
"=",
"this",
"var",
"value",
"=",
"String",
"(",
"self",
".",
"file",
")",
"var",
"start",
"=",
"{",
"line",
":",
"1",
",",
"column",
":",
"1",
",",
"offset",
":",
"0",
"}",
"var",
"content",
"... | Parse the bound file. | [
"Parse",
"the",
"bound",
"file",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/parse.js#L12-L42 | train |
remarkjs/remark | packages/remark-stringify/lib/escape.js | alignment | function alignment(value, index) {
var start = value.lastIndexOf(lineFeed, index)
var end = value.indexOf(lineFeed, index)
var char
end = end === -1 ? value.length : end
while (++start < end) {
char = value.charAt(start)
if (
char !== colon &&
char !== dash &&
char !== space &&
... | javascript | function alignment(value, index) {
var start = value.lastIndexOf(lineFeed, index)
var end = value.indexOf(lineFeed, index)
var char
end = end === -1 ? value.length : end
while (++start < end) {
char = value.charAt(start)
if (
char !== colon &&
char !== dash &&
char !== space &&
... | [
"function",
"alignment",
"(",
"value",
",",
"index",
")",
"{",
"var",
"start",
"=",
"value",
".",
"lastIndexOf",
"(",
"lineFeed",
",",
"index",
")",
"var",
"end",
"=",
"value",
".",
"indexOf",
"(",
"lineFeed",
",",
"index",
")",
"var",
"char",
"end",
... | Check if `index` in `value` is inside an alignment row. | [
"Check",
"if",
"index",
"in",
"value",
"is",
"inside",
"an",
"alignment",
"row",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-stringify/lib/escape.js#L267-L288 | train |
remarkjs/remark | packages/remark-stringify/lib/escape.js | protocol | function protocol(value) {
var val = value.slice(-6).toLowerCase()
return val === mailto || val.slice(-5) === https || val.slice(-4) === http
} | javascript | function protocol(value) {
var val = value.slice(-6).toLowerCase()
return val === mailto || val.slice(-5) === https || val.slice(-4) === http
} | [
"function",
"protocol",
"(",
"value",
")",
"{",
"var",
"val",
"=",
"value",
".",
"slice",
"(",
"-",
"6",
")",
".",
"toLowerCase",
"(",
")",
"return",
"val",
"===",
"mailto",
"||",
"val",
".",
"slice",
"(",
"-",
"5",
")",
"===",
"https",
"||",
"va... | Check if `value` ends in a protocol. | [
"Check",
"if",
"value",
"ends",
"in",
"a",
"protocol",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-stringify/lib/escape.js#L296-L299 | train |
remarkjs/remark | packages/remark-stringify/lib/compiler.js | Compiler | function Compiler(tree, file) {
this.inLink = false
this.inTable = false
this.tree = tree
this.file = file
this.options = xtend(this.options)
this.setOptions({})
} | javascript | function Compiler(tree, file) {
this.inLink = false
this.inTable = false
this.tree = tree
this.file = file
this.options = xtend(this.options)
this.setOptions({})
} | [
"function",
"Compiler",
"(",
"tree",
",",
"file",
")",
"{",
"this",
".",
"inLink",
"=",
"false",
"this",
".",
"inTable",
"=",
"false",
"this",
".",
"tree",
"=",
"tree",
"this",
".",
"file",
"=",
"file",
"this",
".",
"options",
"=",
"xtend",
"(",
"t... | Construct a new compiler. | [
"Construct",
"a",
"new",
"compiler",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-stringify/lib/compiler.js#L9-L16 | train |
remarkjs/remark | packages/remark-parse/lib/tokenize/list.js | pedanticListItem | function pedanticListItem(ctx, value, position) {
var offsets = ctx.offset
var line = position.line
// Remove the list-item’s bullet.
value = value.replace(pedanticBulletExpression, replacer)
// The initial line was also matched by the below, so we reset the `line`.
line = position.line
return value.re... | javascript | function pedanticListItem(ctx, value, position) {
var offsets = ctx.offset
var line = position.line
// Remove the list-item’s bullet.
value = value.replace(pedanticBulletExpression, replacer)
// The initial line was also matched by the below, so we reset the `line`.
line = position.line
return value.re... | [
"function",
"pedanticListItem",
"(",
"ctx",
",",
"value",
",",
"position",
")",
"{",
"var",
"offsets",
"=",
"ctx",
".",
"offset",
"var",
"line",
"=",
"position",
".",
"line",
"// Remove the list-item’s bullet.",
"value",
"=",
"value",
".",
"replace",
"(",
"p... | Create a list-item using overly simple mechanics. | [
"Create",
"a",
"list",
"-",
"item",
"using",
"overly",
"simple",
"mechanics",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/tokenize/list.js#L376-L396 | train |
remarkjs/remark | packages/remark-parse/lib/tokenize/list.js | normalListItem | function normalListItem(ctx, value, position) {
var offsets = ctx.offset
var line = position.line
var max
var bullet
var rest
var lines
var trimmedLines
var index
var length
// Remove the list-item’s bullet.
value = value.replace(bulletExpression, replacer)
lines = value.split(lineFeed)
tri... | javascript | function normalListItem(ctx, value, position) {
var offsets = ctx.offset
var line = position.line
var max
var bullet
var rest
var lines
var trimmedLines
var index
var length
// Remove the list-item’s bullet.
value = value.replace(bulletExpression, replacer)
lines = value.split(lineFeed)
tri... | [
"function",
"normalListItem",
"(",
"ctx",
",",
"value",
",",
"position",
")",
"{",
"var",
"offsets",
"=",
"ctx",
".",
"offset",
"var",
"line",
"=",
"position",
".",
"line",
"var",
"max",
"var",
"bullet",
"var",
"rest",
"var",
"lines",
"var",
"trimmedLine... | Create a list-item using sane mechanics. | [
"Create",
"a",
"list",
"-",
"item",
"using",
"sane",
"mechanics",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/tokenize/list.js#L399-L452 | train |
remarkjs/remark | packages/remark-parse/lib/util/get-indentation.js | indentation | function indentation(value) {
var index = 0
var indent = 0
var character = value.charAt(index)
var stops = {}
var size
while (character === tab || character === space) {
size = character === tab ? tabSize : spaceSize
indent += size
if (size > 1) {
indent = Math.floor(indent / size) * si... | javascript | function indentation(value) {
var index = 0
var indent = 0
var character = value.charAt(index)
var stops = {}
var size
while (character === tab || character === space) {
size = character === tab ? tabSize : spaceSize
indent += size
if (size > 1) {
indent = Math.floor(indent / size) * si... | [
"function",
"indentation",
"(",
"value",
")",
"{",
"var",
"index",
"=",
"0",
"var",
"indent",
"=",
"0",
"var",
"character",
"=",
"value",
".",
"charAt",
"(",
"index",
")",
"var",
"stops",
"=",
"{",
"}",
"var",
"size",
"while",
"(",
"character",
"==="... | Gets indentation information for a line. | [
"Gets",
"indentation",
"information",
"for",
"a",
"line",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/util/get-indentation.js#L12-L33 | train |
remarkjs/remark | packages/remark-stringify/lib/macro/all.js | all | function all(parent) {
var self = this
var children = parent.children
var length = children.length
var results = []
var index = -1
while (++index < length) {
results[index] = self.visit(children[index], parent)
}
return results
} | javascript | function all(parent) {
var self = this
var children = parent.children
var length = children.length
var results = []
var index = -1
while (++index < length) {
results[index] = self.visit(children[index], parent)
}
return results
} | [
"function",
"all",
"(",
"parent",
")",
"{",
"var",
"self",
"=",
"this",
"var",
"children",
"=",
"parent",
".",
"children",
"var",
"length",
"=",
"children",
".",
"length",
"var",
"results",
"=",
"[",
"]",
"var",
"index",
"=",
"-",
"1",
"while",
"(",
... | Visit all children of `parent`. | [
"Visit",
"all",
"children",
"of",
"parent",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-stringify/lib/macro/all.js#L6-L18 | train |
remarkjs/remark | packages/remark-parse/lib/unescape.js | factory | function factory(ctx, key) {
return unescape
// De-escape a string using the expression at `key` in `ctx`.
function unescape(value) {
var prev = 0
var index = value.indexOf(backslash)
var escape = ctx[key]
var queue = []
var character
while (index !== -1) {
queue.push(value.slice(p... | javascript | function factory(ctx, key) {
return unescape
// De-escape a string using the expression at `key` in `ctx`.
function unescape(value) {
var prev = 0
var index = value.indexOf(backslash)
var escape = ctx[key]
var queue = []
var character
while (index !== -1) {
queue.push(value.slice(p... | [
"function",
"factory",
"(",
"ctx",
",",
"key",
")",
"{",
"return",
"unescape",
"// De-escape a string using the expression at `key` in `ctx`.",
"function",
"unescape",
"(",
"value",
")",
"{",
"var",
"prev",
"=",
"0",
"var",
"index",
"=",
"value",
".",
"indexOf",
... | Factory to de-escape a value, based on a list at `key` in `ctx`. | [
"Factory",
"to",
"de",
"-",
"escape",
"a",
"value",
"based",
"on",
"a",
"list",
"at",
"key",
"in",
"ctx",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/unescape.js#L8-L36 | train |
remarkjs/remark | packages/remark-parse/lib/tokenize/paragraph.js | paragraph | function paragraph(eat, value, silent) {
var self = this
var settings = self.options
var commonmark = settings.commonmark
var gfm = settings.gfm
var tokenizers = self.blockTokenizers
var interruptors = self.interruptParagraph
var index = value.indexOf(lineFeed)
var length = value.length
var position
... | javascript | function paragraph(eat, value, silent) {
var self = this
var settings = self.options
var commonmark = settings.commonmark
var gfm = settings.gfm
var tokenizers = self.blockTokenizers
var interruptors = self.interruptParagraph
var index = value.indexOf(lineFeed)
var length = value.length
var position
... | [
"function",
"paragraph",
"(",
"eat",
",",
"value",
",",
"silent",
")",
"{",
"var",
"self",
"=",
"this",
"var",
"settings",
"=",
"self",
".",
"options",
"var",
"commonmark",
"=",
"settings",
".",
"commonmark",
"var",
"gfm",
"=",
"settings",
".",
"gfm",
... | Tokenise paragraph. | [
"Tokenise",
"paragraph",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/tokenize/paragraph.js#L17-L117 | train |
remarkjs/remark | packages/remark-parse/lib/parser.js | keys | function keys(value) {
var result = []
var key
for (key in value) {
result.push(key)
}
return result
} | javascript | function keys(value) {
var result = []
var key
for (key in value) {
result.push(key)
}
return result
} | [
"function",
"keys",
"(",
"value",
")",
"{",
"var",
"result",
"=",
"[",
"]",
"var",
"key",
"for",
"(",
"key",
"in",
"value",
")",
"{",
"result",
".",
"push",
"(",
"key",
")",
"}",
"return",
"result",
"}"
] | Get all keys in `value`. | [
"Get",
"all",
"keys",
"in",
"value",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/parser.js#L140-L149 | train |
remarkjs/remark | packages/remark-parse/lib/tokenizer.js | updatePosition | function updatePosition(subvalue) {
var lastIndex = -1
var index = subvalue.indexOf('\n')
while (index !== -1) {
line++
lastIndex = index
index = subvalue.indexOf('\n', index + 1)
}
if (lastIndex === -1) {
column += subvalue.length
} else {
c... | javascript | function updatePosition(subvalue) {
var lastIndex = -1
var index = subvalue.indexOf('\n')
while (index !== -1) {
line++
lastIndex = index
index = subvalue.indexOf('\n', index + 1)
}
if (lastIndex === -1) {
column += subvalue.length
} else {
c... | [
"function",
"updatePosition",
"(",
"subvalue",
")",
"{",
"var",
"lastIndex",
"=",
"-",
"1",
"var",
"index",
"=",
"subvalue",
".",
"indexOf",
"(",
"'\\n'",
")",
"while",
"(",
"index",
"!==",
"-",
"1",
")",
"{",
"line",
"++",
"lastIndex",
"=",
"index",
... | Update line, column, and offset based on `value`. | [
"Update",
"line",
"column",
"and",
"offset",
"based",
"on",
"value",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/tokenizer.js#L79-L102 | train |
remarkjs/remark | packages/remark-parse/lib/tokenizer.js | now | function now() {
var pos = {line: line, column: column}
pos.offset = self.toOffset(pos)
return pos
} | javascript | function now() {
var pos = {line: line, column: column}
pos.offset = self.toOffset(pos)
return pos
} | [
"function",
"now",
"(",
")",
"{",
"var",
"pos",
"=",
"{",
"line",
":",
"line",
",",
"column",
":",
"column",
"}",
"pos",
".",
"offset",
"=",
"self",
".",
"toOffset",
"(",
"pos",
")",
"return",
"pos",
"}"
] | Get the current position. | [
"Get",
"the",
"current",
"position",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/tokenizer.js#L126-L132 | train |
remarkjs/remark | packages/remark-parse/lib/tokenizer.js | add | function add(node, parent) {
var children = parent ? parent.children : tokens
var prev = children[children.length - 1]
var fn
if (
prev &&
node.type === prev.type &&
(node.type === 'text' || node.type === 'blockquote') &&
mergeable(prev) &&
mergeable(node... | javascript | function add(node, parent) {
var children = parent ? parent.children : tokens
var prev = children[children.length - 1]
var fn
if (
prev &&
node.type === prev.type &&
(node.type === 'text' || node.type === 'blockquote') &&
mergeable(prev) &&
mergeable(node... | [
"function",
"add",
"(",
"node",
",",
"parent",
")",
"{",
"var",
"children",
"=",
"parent",
"?",
"parent",
".",
"children",
":",
"tokens",
"var",
"prev",
"=",
"children",
"[",
"children",
".",
"length",
"-",
"1",
"]",
"var",
"fn",
"if",
"(",
"prev",
... | Add `node` to `parent`s children or to `tokens`. Performs merges where possible. | [
"Add",
"node",
"to",
"parent",
"s",
"children",
"or",
"to",
"tokens",
".",
"Performs",
"merges",
"where",
"possible",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/tokenizer.js#L198-L223 | train |
remarkjs/remark | packages/remark-parse/lib/tokenizer.js | eat | function eat(subvalue) {
var indent = getOffset()
var pos = position()
var current = now()
validateEat(subvalue)
apply.reset = reset
reset.test = test
apply.test = test
value = value.substring(subvalue.length)
updatePosition(subvalue)
indent = indent()
... | javascript | function eat(subvalue) {
var indent = getOffset()
var pos = position()
var current = now()
validateEat(subvalue)
apply.reset = reset
reset.test = test
apply.test = test
value = value.substring(subvalue.length)
updatePosition(subvalue)
indent = indent()
... | [
"function",
"eat",
"(",
"subvalue",
")",
"{",
"var",
"indent",
"=",
"getOffset",
"(",
")",
"var",
"pos",
"=",
"position",
"(",
")",
"var",
"current",
"=",
"now",
"(",
")",
"validateEat",
"(",
"subvalue",
")",
"apply",
".",
"reset",
"=",
"reset",
"res... | Remove `subvalue` from `value`. `subvalue` must be at the start of `value`. | [
"Remove",
"subvalue",
"from",
"value",
".",
"subvalue",
"must",
"be",
"at",
"the",
"start",
"of",
"value",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/tokenizer.js#L227-L276 | train |
remarkjs/remark | packages/remark-parse/lib/tokenizer.js | mergeable | function mergeable(node) {
var start
var end
if (node.type !== 'text' || !node.position) {
return true
}
start = node.position.start
end = node.position.end
// Only merge nodes which occupy the same size as their `value`.
return (
start.line !== end.line || end.column - start.column === node.... | javascript | function mergeable(node) {
var start
var end
if (node.type !== 'text' || !node.position) {
return true
}
start = node.position.start
end = node.position.end
// Only merge nodes which occupy the same size as their `value`.
return (
start.line !== end.line || end.column - start.column === node.... | [
"function",
"mergeable",
"(",
"node",
")",
"{",
"var",
"start",
"var",
"end",
"if",
"(",
"node",
".",
"type",
"!==",
"'text'",
"||",
"!",
"node",
".",
"position",
")",
"{",
"return",
"true",
"}",
"start",
"=",
"node",
".",
"position",
".",
"start",
... | Check whether a node is mergeable with adjacent nodes. | [
"Check",
"whether",
"a",
"node",
"is",
"mergeable",
"with",
"adjacent",
"nodes",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/tokenizer.js#L281-L296 | train |
remarkjs/remark | packages/remark-parse/lib/decode.js | factory | function factory(ctx) {
decoder.raw = decodeRaw
return decoder
// Normalize `position` to add an `indent`.
function normalize(position) {
var offsets = ctx.offset
var line = position.line
var result = []
while (++line) {
if (!(line in offsets)) {
break
}
result.push... | javascript | function factory(ctx) {
decoder.raw = decodeRaw
return decoder
// Normalize `position` to add an `indent`.
function normalize(position) {
var offsets = ctx.offset
var line = position.line
var result = []
while (++line) {
if (!(line in offsets)) {
break
}
result.push... | [
"function",
"factory",
"(",
"ctx",
")",
"{",
"decoder",
".",
"raw",
"=",
"decodeRaw",
"return",
"decoder",
"// Normalize `position` to add an `indent`.",
"function",
"normalize",
"(",
"position",
")",
"{",
"var",
"offsets",
"=",
"ctx",
".",
"offset",
"var",
"lin... | Factory to create an entity decoder. | [
"Factory",
"to",
"create",
"an",
"entity",
"decoder",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/decode.js#L9-L58 | train |
remarkjs/remark | packages/remark-parse/lib/decode.js | normalize | function normalize(position) {
var offsets = ctx.offset
var line = position.line
var result = []
while (++line) {
if (!(line in offsets)) {
break
}
result.push((offsets[line] || 0) + 1)
}
return {start: position, indent: result}
} | javascript | function normalize(position) {
var offsets = ctx.offset
var line = position.line
var result = []
while (++line) {
if (!(line in offsets)) {
break
}
result.push((offsets[line] || 0) + 1)
}
return {start: position, indent: result}
} | [
"function",
"normalize",
"(",
"position",
")",
"{",
"var",
"offsets",
"=",
"ctx",
".",
"offset",
"var",
"line",
"=",
"position",
".",
"line",
"var",
"result",
"=",
"[",
"]",
"while",
"(",
"++",
"line",
")",
"{",
"if",
"(",
"!",
"(",
"line",
"in",
... | Normalize `position` to add an `indent`. | [
"Normalize",
"position",
"to",
"add",
"an",
"indent",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-parse/lib/decode.js#L15-L29 | train |
remarkjs/remark | packages/remark-stringify/lib/set-options.js | setOptions | function setOptions(options) {
var self = this
var current = self.options
var ruleRepetition
var key
if (options == null) {
options = {}
} else if (typeof options === 'object') {
options = xtend(options)
} else {
throw new Error('Invalid value `' + options + '` for setting `options`')
}
... | javascript | function setOptions(options) {
var self = this
var current = self.options
var ruleRepetition
var key
if (options == null) {
options = {}
} else if (typeof options === 'object') {
options = xtend(options)
} else {
throw new Error('Invalid value `' + options + '` for setting `options`')
}
... | [
"function",
"setOptions",
"(",
"options",
")",
"{",
"var",
"self",
"=",
"this",
"var",
"current",
"=",
"self",
".",
"options",
"var",
"ruleRepetition",
"var",
"key",
"if",
"(",
"options",
"==",
"null",
")",
"{",
"options",
"=",
"{",
"}",
"}",
"else",
... | Set options. Does not overwrite previously set options. | [
"Set",
"options",
".",
"Does",
"not",
"overwrite",
"previously",
"set",
"options",
"."
] | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-stringify/lib/set-options.js#L31-L61 | train |
remarkjs/remark | packages/remark-stringify/lib/set-options.js | encodeFactory | function encodeFactory(type) {
var options = {}
if (type === 'false') {
return identity
}
if (type === 'true') {
options.useNamedReferences = true
}
if (type === 'escape') {
options.escapeOnly = true
options.useNamedReferences = true
}
return wrapped
// Encode HTML entities using ... | javascript | function encodeFactory(type) {
var options = {}
if (type === 'false') {
return identity
}
if (type === 'true') {
options.useNamedReferences = true
}
if (type === 'escape') {
options.escapeOnly = true
options.useNamedReferences = true
}
return wrapped
// Encode HTML entities using ... | [
"function",
"encodeFactory",
"(",
"type",
")",
"{",
"var",
"options",
"=",
"{",
"}",
"if",
"(",
"type",
"===",
"'false'",
")",
"{",
"return",
"identity",
"}",
"if",
"(",
"type",
"===",
"'true'",
")",
"{",
"options",
".",
"useNamedReferences",
"=",
"tru... | Factory to encode HTML entities. Creates a no-operation function when `type` is `'false'`, a function which encodes using named references when `type` is `'true'`, and a function which encodes using numbered references when `type` is `'numbers'`. | [
"Factory",
"to",
"encode",
"HTML",
"entities",
".",
"Creates",
"a",
"no",
"-",
"operation",
"function",
"when",
"type",
"is",
"false",
"a",
"function",
"which",
"encodes",
"using",
"named",
"references",
"when",
"type",
"is",
"true",
"and",
"a",
"function",
... | cca8385746c2f3489b2d491e91ab8c581901ae8a | https://github.com/remarkjs/remark/blob/cca8385746c2f3489b2d491e91ab8c581901ae8a/packages/remark-stringify/lib/set-options.js#L133-L155 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | getLocaleDateTimeFormat | function getLocaleDateTimeFormat(locale, width) {
var data = findLocaleData(locale);
var dateTimeFormatData = data[12 /* DateTimeFormat */];
return getLastDefinedValue(dateTimeFormatData, width);
} | javascript | function getLocaleDateTimeFormat(locale, width) {
var data = findLocaleData(locale);
var dateTimeFormatData = data[12 /* DateTimeFormat */];
return getLastDefinedValue(dateTimeFormatData, width);
} | [
"function",
"getLocaleDateTimeFormat",
"(",
"locale",
",",
"width",
")",
"{",
"var",
"data",
"=",
"findLocaleData",
"(",
"locale",
")",
";",
"var",
"dateTimeFormatData",
"=",
"data",
"[",
"12",
"/* DateTimeFormat */",
"]",
";",
"return",
"getLastDefinedValue",
"... | Date-time format that depends on the locale.
The date-time pattern shows how to combine separate patterns for date (represented by {1})
and time (represented by {0}) into a single pattern. It usually doesn't need to be changed.
What you want to pay attention to are:
- possibly removing a space for languages that don't... | [
"Date",
"-",
"time",
"format",
"that",
"depends",
"on",
"the",
"locale",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L1057-L1061 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | getLastDefinedValue | function getLastDefinedValue(data, index) {
for (var i = index; i > -1; i--) {
if (typeof data[i] !== 'undefined') {
return data[i];
}
}
throw new Error('Locale data API: locale data undefined');
} | javascript | function getLastDefinedValue(data, index) {
for (var i = index; i > -1; i--) {
if (typeof data[i] !== 'undefined') {
return data[i];
}
}
throw new Error('Locale data API: locale data undefined');
} | [
"function",
"getLastDefinedValue",
"(",
"data",
",",
"index",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"index",
";",
"i",
">",
"-",
"1",
";",
"i",
"--",
")",
"{",
"if",
"(",
"typeof",
"data",
"[",
"i",
"]",
"!==",
"'undefined'",
")",
"{",
"return",... | Returns the first value that is defined in an array, going backwards.
To avoid repeating the same data (e.g. when "format" and "standalone" are the same) we only
add the first one to the locale data arrays, the other ones are only defined when different.
We use this function to retrieve the first defined value.
@expe... | [
"Returns",
"the",
"first",
"value",
"that",
"is",
"defined",
"in",
"an",
"array",
"going",
"backwards",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L1218-L1225 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | findLocaleData | function findLocaleData(locale) {
var normalizedLocale = locale.toLowerCase().replace(/_/g, '-');
var match = LOCALE_DATA[normalizedLocale];
if (match) {
return match;
}
// let's try to find a parent locale
var parentLocale = normalizedLocale.split('-')[0];
match = LOCALE_DATA[parent... | javascript | function findLocaleData(locale) {
var normalizedLocale = locale.toLowerCase().replace(/_/g, '-');
var match = LOCALE_DATA[normalizedLocale];
if (match) {
return match;
}
// let's try to find a parent locale
var parentLocale = normalizedLocale.split('-')[0];
match = LOCALE_DATA[parent... | [
"function",
"findLocaleData",
"(",
"locale",
")",
"{",
"var",
"normalizedLocale",
"=",
"locale",
".",
"toLowerCase",
"(",
")",
".",
"replace",
"(",
"/",
"_",
"/",
"g",
",",
"'-'",
")",
";",
"var",
"match",
"=",
"LOCALE_DATA",
"[",
"normalizedLocale",
"]"... | Finds the locale data for a locale id
@experimental i18n support is experimental. | [
"Finds",
"the",
"locale",
"data",
"for",
"a",
"locale",
"id"
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L1238-L1254 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | getNumberOfCurrencyDigits | function getNumberOfCurrencyDigits(code) {
var digits;
var currency = CURRENCIES_EN[code];
if (currency) {
digits = currency[2 /* NbOfDigits */];
}
return typeof digits === 'number' ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS;
} | javascript | function getNumberOfCurrencyDigits(code) {
var digits;
var currency = CURRENCIES_EN[code];
if (currency) {
digits = currency[2 /* NbOfDigits */];
}
return typeof digits === 'number' ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS;
} | [
"function",
"getNumberOfCurrencyDigits",
"(",
"code",
")",
"{",
"var",
"digits",
";",
"var",
"currency",
"=",
"CURRENCIES_EN",
"[",
"code",
"]",
";",
"if",
"(",
"currency",
")",
"{",
"digits",
"=",
"currency",
"[",
"2",
"/* NbOfDigits */",
"]",
";",
"}",
... | Returns the number of decimal digits for the given currency.
Its value depends upon the presence of cents in that particular currency.
@experimental i18n support is experimental. | [
"Returns",
"the",
"number",
"of",
"decimal",
"digits",
"for",
"the",
"given",
"currency",
".",
"Its",
"value",
"depends",
"upon",
"the",
"presence",
"of",
"cents",
"in",
"that",
"particular",
"currency",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L1279-L1286 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | dateStrGetter | function dateStrGetter(name, width, form, extended) {
if (form === void 0) { form = FormStyle.Format; }
if (extended === void 0) { extended = false; }
return function (date, locale) {
return getDateTranslation(date, locale, name, width, form, extended);
};
} | javascript | function dateStrGetter(name, width, form, extended) {
if (form === void 0) { form = FormStyle.Format; }
if (extended === void 0) { extended = false; }
return function (date, locale) {
return getDateTranslation(date, locale, name, width, form, extended);
};
} | [
"function",
"dateStrGetter",
"(",
"name",
",",
"width",
",",
"form",
",",
"extended",
")",
"{",
"if",
"(",
"form",
"===",
"void",
"0",
")",
"{",
"form",
"=",
"FormStyle",
".",
"Format",
";",
"}",
"if",
"(",
"extended",
"===",
"void",
"0",
")",
"{",... | Returns a date formatter that transforms a date into its locale string representation | [
"Returns",
"a",
"date",
"formatter",
"that",
"transforms",
"a",
"date",
"into",
"its",
"locale",
"string",
"representation"
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L1519-L1525 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | toDate | function toDate(value) {
if (isDate(value)) {
return value;
}
if (typeof value === 'number' && !isNaN(value)) {
return new Date(value);
}
if (typeof value === 'string') {
value = value.trim();
var parsedNb = parseFloat(value);
// any string that only contains ... | javascript | function toDate(value) {
if (isDate(value)) {
return value;
}
if (typeof value === 'number' && !isNaN(value)) {
return new Date(value);
}
if (typeof value === 'string') {
value = value.trim();
var parsedNb = parseFloat(value);
// any string that only contains ... | [
"function",
"toDate",
"(",
"value",
")",
"{",
"if",
"(",
"isDate",
"(",
"value",
")",
")",
"{",
"return",
"value",
";",
"}",
"if",
"(",
"typeof",
"value",
"===",
"'number'",
"&&",
"!",
"isNaN",
"(",
"value",
")",
")",
"{",
"return",
"new",
"Date",
... | Converts a value to date.
Supported input formats:
- `Date`
- number: timestamp
- string: numeric (e.g. "1234"), ISO and date strings in a format supported by
[Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).
Note: ISO strings without time return a date withou... | [
"Converts",
"a",
"value",
"to",
"date",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L1879-L1914 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | toPercent | function toPercent(parsedNumber) {
// if the number is 0, don't do anything
if (parsedNumber.digits[0] === 0) {
return parsedNumber;
}
// Getting the current number of decimals
var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
if (parsedNumber.exponent) {
pa... | javascript | function toPercent(parsedNumber) {
// if the number is 0, don't do anything
if (parsedNumber.digits[0] === 0) {
return parsedNumber;
}
// Getting the current number of decimals
var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
if (parsedNumber.exponent) {
pa... | [
"function",
"toPercent",
"(",
"parsedNumber",
")",
"{",
"// if the number is 0, don't do anything",
"if",
"(",
"parsedNumber",
".",
"digits",
"[",
"0",
"]",
"===",
"0",
")",
"{",
"return",
"parsedNumber",
";",
"}",
"// Getting the current number of decimals",
"var",
... | Transforms a parsed number into a percentage by multiplying it by 100 | [
"Transforms",
"a",
"parsed",
"number",
"into",
"a",
"percentage",
"by",
"multiplying",
"it",
"by",
"100"
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L2165-L2185 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | HttpHeaderResponse | function HttpHeaderResponse(init) {
if (init === void 0) { init = {}; }
var _this = _super.call(this, init) || this;
_this.type = HttpEventType.ResponseHeader;
return _this;
} | javascript | function HttpHeaderResponse(init) {
if (init === void 0) { init = {}; }
var _this = _super.call(this, init) || this;
_this.type = HttpEventType.ResponseHeader;
return _this;
} | [
"function",
"HttpHeaderResponse",
"(",
"init",
")",
"{",
"if",
"(",
"init",
"===",
"void",
"0",
")",
"{",
"init",
"=",
"{",
"}",
";",
"}",
"var",
"_this",
"=",
"_super",
".",
"call",
"(",
"this",
",",
"init",
")",
"||",
"this",
";",
"_this",
".",... | Create a new `HttpHeaderResponse` with the given parameters. | [
"Create",
"a",
"new",
"HttpHeaderResponse",
"with",
"the",
"given",
"parameters",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L6709-L6714 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | HttpResponse | function HttpResponse(init) {
if (init === void 0) { init = {}; }
var _this = _super.call(this, init) || this;
_this.type = HttpEventType.Response;
_this.body = init.body !== undefined ? init.body : null;
return _this;
} | javascript | function HttpResponse(init) {
if (init === void 0) { init = {}; }
var _this = _super.call(this, init) || this;
_this.type = HttpEventType.Response;
_this.body = init.body !== undefined ? init.body : null;
return _this;
} | [
"function",
"HttpResponse",
"(",
"init",
")",
"{",
"if",
"(",
"init",
"===",
"void",
"0",
")",
"{",
"init",
"=",
"{",
"}",
";",
"}",
"var",
"_this",
"=",
"_super",
".",
"call",
"(",
"this",
",",
"init",
")",
"||",
"this",
";",
"_this",
".",
"ty... | Construct a new `HttpResponse`. | [
"Construct",
"a",
"new",
"HttpResponse",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L6746-L6752 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | getResponseUrl | function getResponseUrl(xhr) {
if ('responseURL' in xhr && xhr.responseURL) {
return xhr.responseURL;
}
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
return xhr.getResponseHeader('X-Request-URL');
}
return null;
} | javascript | function getResponseUrl(xhr) {
if ('responseURL' in xhr && xhr.responseURL) {
return xhr.responseURL;
}
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
return xhr.getResponseHeader('X-Request-URL');
}
return null;
} | [
"function",
"getResponseUrl",
"(",
"xhr",
")",
"{",
"if",
"(",
"'responseURL'",
"in",
"xhr",
"&&",
"xhr",
".",
"responseURL",
")",
"{",
"return",
"xhr",
".",
"responseURL",
";",
"}",
"if",
"(",
"/",
"^X-Request-URL:",
"/",
"m",
".",
"test",
"(",
"xhr",... | Determine an appropriate URL for the response, by checking either
XMLHttpRequest.responseURL or the X-Request-URL header. | [
"Determine",
"an",
"appropriate",
"URL",
"for",
"the",
"response",
"by",
"checking",
"either",
"XMLHttpRequest",
".",
"responseURL",
"or",
"the",
"X",
"-",
"Request",
"-",
"URL",
"header",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L7315-L7323 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | function () {
if (headerResponse !== null) {
return headerResponse;
}
// Read status and normalize an IE9 bug (http://bugs.jquery.com/ticket/1450).
var status = xhr.status === 1223 ? 204 : xhr.status;
var statusText = xh... | javascript | function () {
if (headerResponse !== null) {
return headerResponse;
}
// Read status and normalize an IE9 bug (http://bugs.jquery.com/ticket/1450).
var status = xhr.status === 1223 ? 204 : xhr.status;
var statusText = xh... | [
"function",
"(",
")",
"{",
"if",
"(",
"headerResponse",
"!==",
"null",
")",
"{",
"return",
"headerResponse",
";",
"}",
"// Read status and normalize an IE9 bug (http://bugs.jquery.com/ticket/1450).",
"var",
"status",
"=",
"xhr",
".",
"status",
"===",
"1223",
"?",
"2... | partialFromXhr extracts the HttpHeaderResponse from the current XMLHttpRequest state, and memoizes it into headerResponse. | [
"partialFromXhr",
"extracts",
"the",
"HttpHeaderResponse",
"from",
"the",
"current",
"XMLHttpRequest",
"state",
"and",
"memoizes",
"it",
"into",
"headerResponse",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L7412-L7427 | train | |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | function () {
// Read response state from the memoized partial data.
var _a = partialFromXhr(), headers = _a.headers, status = _a.status, statusText = _a.statusText, url = _a.url;
// The body will be read out if present.
var body = null;
if... | javascript | function () {
// Read response state from the memoized partial data.
var _a = partialFromXhr(), headers = _a.headers, status = _a.status, statusText = _a.statusText, url = _a.url;
// The body will be read out if present.
var body = null;
if... | [
"function",
"(",
")",
"{",
"// Read response state from the memoized partial data.",
"var",
"_a",
"=",
"partialFromXhr",
"(",
")",
",",
"headers",
"=",
"_a",
".",
"headers",
",",
"status",
"=",
"_a",
".",
"status",
",",
"statusText",
"=",
"_a",
".",
"statusTex... | Next, a few closures are defined for the various events which XMLHttpRequest can emit. This allows them to be unregistered as event listeners later. First up is the load event, which represents a response being fully available. | [
"Next",
"a",
"few",
"closures",
"are",
"defined",
"for",
"the",
"various",
"events",
"which",
"XMLHttpRequest",
"can",
"emit",
".",
"This",
"allows",
"them",
"to",
"be",
"unregistered",
"as",
"event",
"listeners",
"later",
".",
"First",
"up",
"is",
"the",
... | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L7431-L7498 | train | |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | function (error) {
var res = new HttpErrorResponse({
error: error,
status: xhr.status || 0,
statusText: xhr.statusText || 'Unknown Error',
});
observer.error(res);
} | javascript | function (error) {
var res = new HttpErrorResponse({
error: error,
status: xhr.status || 0,
statusText: xhr.statusText || 'Unknown Error',
});
observer.error(res);
} | [
"function",
"(",
"error",
")",
"{",
"var",
"res",
"=",
"new",
"HttpErrorResponse",
"(",
"{",
"error",
":",
"error",
",",
"status",
":",
"xhr",
".",
"status",
"||",
"0",
",",
"statusText",
":",
"xhr",
".",
"statusText",
"||",
"'Unknown Error'",
",",
"}"... | The onError callback is called when something goes wrong at the network level. Connection timeout, DNS error, offline, etc. These are actual errors, and are transmitted on the error channel. | [
"The",
"onError",
"callback",
"is",
"called",
"when",
"something",
"goes",
"wrong",
"at",
"the",
"network",
"level",
".",
"Connection",
"timeout",
"DNS",
"error",
"offline",
"etc",
".",
"These",
"are",
"actual",
"errors",
"and",
"are",
"transmitted",
"on",
"... | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L7502-L7509 | train | |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | function (event) {
// Send the HttpResponseHeaders event if it hasn't been sent already.
if (!sentHeaders) {
observer.next(partialFromXhr());
sentHeaders = true;
}
// Start building the download progress event to del... | javascript | function (event) {
// Send the HttpResponseHeaders event if it hasn't been sent already.
if (!sentHeaders) {
observer.next(partialFromXhr());
sentHeaders = true;
}
// Start building the download progress event to del... | [
"function",
"(",
"event",
")",
"{",
"// Send the HttpResponseHeaders event if it hasn't been sent already.",
"if",
"(",
"!",
"sentHeaders",
")",
"{",
"observer",
".",
"next",
"(",
"partialFromXhr",
"(",
")",
")",
";",
"sentHeaders",
"=",
"true",
";",
"}",
"// Star... | The download progress event handler, which is only registered if progress events are enabled. | [
"The",
"download",
"progress",
"event",
"handler",
"which",
"is",
"only",
"registered",
"if",
"progress",
"events",
"are",
"enabled",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L7517-L7541 | train | |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | function (event) {
// Upload progress events are simpler. Begin building the progress
// event.
var progress = {
type: HttpEventType.UploadProgress,
loaded: event.loaded,
};
// If the total number of ... | javascript | function (event) {
// Upload progress events are simpler. Begin building the progress
// event.
var progress = {
type: HttpEventType.UploadProgress,
loaded: event.loaded,
};
// If the total number of ... | [
"function",
"(",
"event",
")",
"{",
"// Upload progress events are simpler. Begin building the progress",
"// event.",
"var",
"progress",
"=",
"{",
"type",
":",
"HttpEventType",
".",
"UploadProgress",
",",
"loaded",
":",
"event",
".",
"loaded",
",",
"}",
";",
"// If... | The upload progress event handler, which is only registered if progress events are enabled. | [
"The",
"upload",
"progress",
"event",
"handler",
"which",
"is",
"only",
"registered",
"if",
"progress",
"events",
"are",
"enabled",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L7544-L7558 | train | |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | defineInjector | function defineInjector(options) {
return {
factory: options.factory, providers: options.providers || [], imports: options.imports || [],
};
} | javascript | function defineInjector(options) {
return {
factory: options.factory, providers: options.providers || [], imports: options.imports || [],
};
} | [
"function",
"defineInjector",
"(",
"options",
")",
"{",
"return",
"{",
"factory",
":",
"options",
".",
"factory",
",",
"providers",
":",
"options",
".",
"providers",
"||",
"[",
"]",
",",
"imports",
":",
"options",
".",
"imports",
"||",
"[",
"]",
",",
"... | Construct an `InjectorDef` which configures an injector.
This should be assigned to a static `ngInjectorDef` field on a type, which will then be an
`InjectorType`.
Options:
* `factory`: an `InjectorType` is an instantiable type, so a zero argument `factory` function to
create the type must be provided. If that facto... | [
"Construct",
"an",
"InjectorDef",
"which",
"configures",
"an",
"injector",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L8248-L8252 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | resolveForwardRef | function resolveForwardRef(type) {
if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
type.__forward_ref__ === forwardRef) {
return type();
}
else {
return type;
}
} | javascript | function resolveForwardRef(type) {
if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
type.__forward_ref__ === forwardRef) {
return type();
}
else {
return type;
}
} | [
"function",
"resolveForwardRef",
"(",
"type",
")",
"{",
"if",
"(",
"typeof",
"type",
"===",
"'function'",
"&&",
"type",
".",
"hasOwnProperty",
"(",
"'__forward_ref__'",
")",
"&&",
"type",
".",
"__forward_ref__",
"===",
"forwardRef",
")",
"{",
"return",
"type",... | Lazily retrieves the reference value from a forwardRef.
Acts as the identity function when given a non-forward-ref value.
@usageNotes
### Example
{@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
@see `forwardRef`
@experimental | [
"Lazily",
"retrieves",
"the",
"reference",
"value",
"from",
"a",
"forwardRef",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L9174-L9182 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | resolveReflectiveProvider | function resolveReflectiveProvider(provider) {
return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
} | javascript | function resolveReflectiveProvider(provider) {
return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
} | [
"function",
"resolveReflectiveProvider",
"(",
"provider",
")",
"{",
"return",
"new",
"ResolvedReflectiveProvider_",
"(",
"ReflectiveKey",
".",
"get",
"(",
"provider",
".",
"provide",
")",
",",
"[",
"resolveReflectiveFactory",
"(",
"provider",
")",
"]",
",",
"provi... | Converts the `Provider` into `ResolvedProvider`.
`Injector` internally only uses `ResolvedProvider`, `Provider` contains convenience provider
syntax. | [
"Converts",
"the",
"Provider",
"into",
"ResolvedProvider",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L10368-L10370 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | EventEmitter | function EventEmitter(isAsync) {
if (isAsync === void 0) { isAsync = false; }
var _this = _super.call(this) || this;
_this.__isAsync = isAsync;
return _this;
} | javascript | function EventEmitter(isAsync) {
if (isAsync === void 0) { isAsync = false; }
var _this = _super.call(this) || this;
_this.__isAsync = isAsync;
return _this;
} | [
"function",
"EventEmitter",
"(",
"isAsync",
")",
"{",
"if",
"(",
"isAsync",
"===",
"void",
"0",
")",
"{",
"isAsync",
"=",
"false",
";",
"}",
"var",
"_this",
"=",
"_super",
".",
"call",
"(",
"this",
")",
"||",
"this",
";",
"_this",
".",
"__isAsync",
... | Creates an instance of this class that can
deliver events synchronously or asynchronously.
@param isAsync When true, deliver events asynchronously. | [
"Creates",
"an",
"instance",
"of",
"this",
"class",
"that",
"can",
"deliver",
"events",
"synchronously",
"or",
"asynchronously",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L11714-L11719 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | registerModuleFactory | function registerModuleFactory(id, factory) {
var existing = moduleFactories.get(id);
if (existing) {
throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
}
moduleFactories.set(id, factory);
} | javascript | function registerModuleFactory(id, factory) {
var existing = moduleFactories.get(id);
if (existing) {
throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
}
moduleFactories.set(id, factory);
} | [
"function",
"registerModuleFactory",
"(",
"id",
",",
"factory",
")",
"{",
"var",
"existing",
"=",
"moduleFactories",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"existing",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Duplicate module registered for \"",
"+",
... | Registers a loaded module. Should only be called from generated NgModuleFactory code.
@experimental | [
"Registers",
"a",
"loaded",
"module",
".",
"Should",
"only",
"be",
"called",
"from",
"generated",
"NgModuleFactory",
"code",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L13005-L13011 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | shouldCallLifecycleInitHook | function shouldCallLifecycleInitHook(view, initState, index) {
if ((view.state & 1792 /* InitState_Mask */) === initState && view.initIndex <= index) {
view.initIndex = index + 1;
return true;
}
return false;
} | javascript | function shouldCallLifecycleInitHook(view, initState, index) {
if ((view.state & 1792 /* InitState_Mask */) === initState && view.initIndex <= index) {
view.initIndex = index + 1;
return true;
}
return false;
} | [
"function",
"shouldCallLifecycleInitHook",
"(",
"view",
",",
"initState",
",",
"index",
")",
"{",
"if",
"(",
"(",
"view",
".",
"state",
"&",
"1792",
"/* InitState_Mask */",
")",
"===",
"initState",
"&&",
"view",
".",
"initIndex",
"<=",
"index",
")",
"{",
"... | Returns true if the lifecycle init method should be called for the node with the given init index. | [
"Returns",
"true",
"if",
"the",
"lifecycle",
"init",
"method",
"should",
"be",
"called",
"for",
"the",
"node",
"with",
"the",
"given",
"init",
"index",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L15691-L15697 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | viewParentEl | function viewParentEl(view) {
var parentView = view.parent;
if (parentView) {
return view.parentNodeDef.parent;
}
else {
return null;
}
} | javascript | function viewParentEl(view) {
var parentView = view.parent;
if (parentView) {
return view.parentNodeDef.parent;
}
else {
return null;
}
} | [
"function",
"viewParentEl",
"(",
"view",
")",
"{",
"var",
"parentView",
"=",
"view",
".",
"parent",
";",
"if",
"(",
"parentView",
")",
"{",
"return",
"view",
".",
"parentNodeDef",
".",
"parent",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | for component views, this is the host element.
for embedded views, this is the index of the parent node
that contains the view container. | [
"for",
"component",
"views",
"this",
"is",
"the",
"host",
"element",
".",
"for",
"embedded",
"views",
"this",
"is",
"the",
"index",
"of",
"the",
"parent",
"node",
"that",
"contains",
"the",
"view",
"container",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L15918-L15926 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | queueLifecycleHooks | function queueLifecycleHooks(flags, tView) {
if (tView.firstTemplatePass) {
var start = flags >> 14 /* DirectiveStartingIndexShift */;
var count = flags & 4095 /* DirectiveCountMask */;
var end = start + count;
// It's necessary to loop through the directives at elementEnd() (rather ... | javascript | function queueLifecycleHooks(flags, tView) {
if (tView.firstTemplatePass) {
var start = flags >> 14 /* DirectiveStartingIndexShift */;
var count = flags & 4095 /* DirectiveCountMask */;
var end = start + count;
// It's necessary to loop through the directives at elementEnd() (rather ... | [
"function",
"queueLifecycleHooks",
"(",
"flags",
",",
"tView",
")",
"{",
"if",
"(",
"tView",
".",
"firstTemplatePass",
")",
"{",
"var",
"start",
"=",
"flags",
">>",
"14",
"/* DirectiveStartingIndexShift */",
";",
"var",
"count",
"=",
"flags",
"&",
"4095",
"/... | Loops through the directives on a node and queues all their hooks except ngOnInit
and ngDoCheck, which are queued separately in directiveCreate. | [
"Loops",
"through",
"the",
"directives",
"on",
"a",
"node",
"and",
"queues",
"all",
"their",
"hooks",
"except",
"ngOnInit",
"and",
"ngDoCheck",
"which",
"are",
"queued",
"separately",
"in",
"directiveCreate",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L19898-L19913 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | queueContentHooks | function queueContentHooks(def, tView, i) {
if (def.afterContentInit) {
(tView.contentHooks || (tView.contentHooks = [])).push(i, def.afterContentInit);
}
if (def.afterContentChecked) {
(tView.contentHooks || (tView.contentHooks = [])).push(i, def.afterContentChecked);
(tView.content... | javascript | function queueContentHooks(def, tView, i) {
if (def.afterContentInit) {
(tView.contentHooks || (tView.contentHooks = [])).push(i, def.afterContentInit);
}
if (def.afterContentChecked) {
(tView.contentHooks || (tView.contentHooks = [])).push(i, def.afterContentChecked);
(tView.content... | [
"function",
"queueContentHooks",
"(",
"def",
",",
"tView",
",",
"i",
")",
"{",
"if",
"(",
"def",
".",
"afterContentInit",
")",
"{",
"(",
"tView",
".",
"contentHooks",
"||",
"(",
"tView",
".",
"contentHooks",
"=",
"[",
"]",
")",
")",
".",
"push",
"(",... | Queues afterContentInit and afterContentChecked hooks on TView | [
"Queues",
"afterContentInit",
"and",
"afterContentChecked",
"hooks",
"on",
"TView"
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L19915-L19923 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | queueViewHooks | function queueViewHooks(def, tView, i) {
if (def.afterViewInit) {
(tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewInit);
}
if (def.afterViewChecked) {
(tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewChecked);
(tView.viewCheckHooks || (tView.viewCheck... | javascript | function queueViewHooks(def, tView, i) {
if (def.afterViewInit) {
(tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewInit);
}
if (def.afterViewChecked) {
(tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewChecked);
(tView.viewCheckHooks || (tView.viewCheck... | [
"function",
"queueViewHooks",
"(",
"def",
",",
"tView",
",",
"i",
")",
"{",
"if",
"(",
"def",
".",
"afterViewInit",
")",
"{",
"(",
"tView",
".",
"viewHooks",
"||",
"(",
"tView",
".",
"viewHooks",
"=",
"[",
"]",
")",
")",
".",
"push",
"(",
"i",
",... | Queues afterViewInit and afterViewChecked hooks on TView | [
"Queues",
"afterViewInit",
"and",
"afterViewChecked",
"hooks",
"on",
"TView"
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L19925-L19933 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | queueDestroyHooks | function queueDestroyHooks(def, tView, i) {
if (def.onDestroy != null) {
(tView.destroyHooks || (tView.destroyHooks = [])).push(i, def.onDestroy);
}
} | javascript | function queueDestroyHooks(def, tView, i) {
if (def.onDestroy != null) {
(tView.destroyHooks || (tView.destroyHooks = [])).push(i, def.onDestroy);
}
} | [
"function",
"queueDestroyHooks",
"(",
"def",
",",
"tView",
",",
"i",
")",
"{",
"if",
"(",
"def",
".",
"onDestroy",
"!=",
"null",
")",
"{",
"(",
"tView",
".",
"destroyHooks",
"||",
"(",
"tView",
".",
"destroyHooks",
"=",
"[",
"]",
")",
")",
".",
"pu... | Queues onDestroy hooks on TView | [
"Queues",
"onDestroy",
"hooks",
"on",
"TView"
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L19935-L19939 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | executeInitHooks | function executeInitHooks(currentView, tView, creationMode) {
if (currentView[FLAGS] & 16 /* RunInit */) {
executeHooks(currentView[DIRECTIVES], tView.initHooks, tView.checkHooks, creationMode);
currentView[FLAGS] &= ~16 /* RunInit */;
}
} | javascript | function executeInitHooks(currentView, tView, creationMode) {
if (currentView[FLAGS] & 16 /* RunInit */) {
executeHooks(currentView[DIRECTIVES], tView.initHooks, tView.checkHooks, creationMode);
currentView[FLAGS] &= ~16 /* RunInit */;
}
} | [
"function",
"executeInitHooks",
"(",
"currentView",
",",
"tView",
",",
"creationMode",
")",
"{",
"if",
"(",
"currentView",
"[",
"FLAGS",
"]",
"&",
"16",
"/* RunInit */",
")",
"{",
"executeHooks",
"(",
"currentView",
"[",
"DIRECTIVES",
"]",
",",
"tView",
".",... | Calls onInit and doCheck calls if they haven't already been called.
@param currentView The current view | [
"Calls",
"onInit",
"and",
"doCheck",
"calls",
"if",
"they",
"haven",
"t",
"already",
"been",
"called",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L19945-L19950 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | executeHooks | function executeHooks(data, allHooks, checkHooks, creationMode) {
var hooksToCall = creationMode ? allHooks : checkHooks;
if (hooksToCall) {
callHooks(data, hooksToCall);
}
} | javascript | function executeHooks(data, allHooks, checkHooks, creationMode) {
var hooksToCall = creationMode ? allHooks : checkHooks;
if (hooksToCall) {
callHooks(data, hooksToCall);
}
} | [
"function",
"executeHooks",
"(",
"data",
",",
"allHooks",
",",
"checkHooks",
",",
"creationMode",
")",
"{",
"var",
"hooksToCall",
"=",
"creationMode",
"?",
"allHooks",
":",
"checkHooks",
";",
"if",
"(",
"hooksToCall",
")",
"{",
"callHooks",
"(",
"data",
",",... | Iterates over afterViewInit and afterViewChecked functions and calls them.
@param currentView The current view | [
"Iterates",
"over",
"afterViewInit",
"and",
"afterViewChecked",
"functions",
"and",
"calls",
"them",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L19956-L19961 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | throwErrorIfNoChangesMode | function throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, oldValue, currValue) {
if (checkNoChangesMode) {
var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
if (cre... | javascript | function throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, oldValue, currValue) {
if (checkNoChangesMode) {
var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
if (cre... | [
"function",
"throwErrorIfNoChangesMode",
"(",
"creationMode",
",",
"checkNoChangesMode",
",",
"oldValue",
",",
"currValue",
")",
"{",
"if",
"(",
"checkNoChangesMode",
")",
"{",
"var",
"msg",
"=",
"\"ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it ... | Throws an ExpressionChangedAfterChecked error if checkNoChanges mode is on. | [
"Throws",
"an",
"ExpressionChangedAfterChecked",
"error",
"if",
"checkNoChanges",
"mode",
"is",
"on",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20041-L20052 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | flatten$1 | function flatten$1(list) {
var result = [];
var i = 0;
while (i < list.length) {
var item = list[i];
if (Array.isArray(item)) {
if (item.length > 0) {
list = item.concat(list.slice(i + 1));
i = 0;
}
else {
i+... | javascript | function flatten$1(list) {
var result = [];
var i = 0;
while (i < list.length) {
var item = list[i];
if (Array.isArray(item)) {
if (item.length > 0) {
list = item.concat(list.slice(i + 1));
i = 0;
}
else {
i+... | [
"function",
"flatten$1",
"(",
"list",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"var",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"list",
".",
"length",
")",
"{",
"var",
"item",
"=",
"list",
"[",
"i",
"]",
";",
"if",
"(",
"Array",
".",
... | Flattens an array in non-recursive way. Input arrays are not modified. | [
"Flattens",
"an",
"array",
"in",
"non",
"-",
"recursive",
"way",
".",
"Input",
"arrays",
"are",
"not",
"modified",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20169-L20189 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | loadInternal | function loadInternal(index, arr) {
ngDevMode && assertDataInRangeInternal(index + HEADER_OFFSET, arr);
return arr[index + HEADER_OFFSET];
} | javascript | function loadInternal(index, arr) {
ngDevMode && assertDataInRangeInternal(index + HEADER_OFFSET, arr);
return arr[index + HEADER_OFFSET];
} | [
"function",
"loadInternal",
"(",
"index",
",",
"arr",
")",
"{",
"ngDevMode",
"&&",
"assertDataInRangeInternal",
"(",
"index",
"+",
"HEADER_OFFSET",
",",
"arr",
")",
";",
"return",
"arr",
"[",
"index",
"+",
"HEADER_OFFSET",
"]",
";",
"}"
] | Retrieves a value from any `LViewData`. | [
"Retrieves",
"a",
"value",
"from",
"any",
"LViewData",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20191-L20194 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | getChildLNode | function getChildLNode(node) {
if (node.tNode.child) {
var viewData = node.tNode.type === 2 /* View */ ? node.data : node.view;
return readElementValue(viewData[node.tNode.child.index]);
}
return null;
} | javascript | function getChildLNode(node) {
if (node.tNode.child) {
var viewData = node.tNode.type === 2 /* View */ ? node.data : node.view;
return readElementValue(viewData[node.tNode.child.index]);
}
return null;
} | [
"function",
"getChildLNode",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"tNode",
".",
"child",
")",
"{",
"var",
"viewData",
"=",
"node",
".",
"tNode",
".",
"type",
"===",
"2",
"/* View */",
"?",
"node",
".",
"data",
":",
"node",
".",
"view",
";... | Retrieves the first child of a given node | [
"Retrieves",
"the",
"first",
"child",
"of",
"a",
"given",
"node"
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20228-L20234 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | walkLNodeTree | function walkLNodeTree(startingNode, rootNode, action, renderer, renderParentNode, beforeNode) {
var node = startingNode;
var projectionNodeIndex = -1;
while (node) {
var nextNode = null;
var parent_1 = renderParentNode ? renderParentNode.native : null;
var nodeType = node.tNode.type... | javascript | function walkLNodeTree(startingNode, rootNode, action, renderer, renderParentNode, beforeNode) {
var node = startingNode;
var projectionNodeIndex = -1;
while (node) {
var nextNode = null;
var parent_1 = renderParentNode ? renderParentNode.native : null;
var nodeType = node.tNode.type... | [
"function",
"walkLNodeTree",
"(",
"startingNode",
",",
"rootNode",
",",
"action",
",",
"renderer",
",",
"renderParentNode",
",",
"beforeNode",
")",
"{",
"var",
"node",
"=",
"startingNode",
";",
"var",
"projectionNodeIndex",
"=",
"-",
"1",
";",
"while",
"(",
... | Walks a tree of LNodes, applying a transformation on the LElement nodes, either only on the first
one found, or on all of them.
@param startingNode the node from which the walk is started.
@param rootNode the root node considered. This prevents walking past that node.
@param action identifies the action to be performe... | [
"Walks",
"a",
"tree",
"of",
"LNodes",
"applying",
"a",
"transformation",
"on",
"the",
"LElement",
"nodes",
"either",
"only",
"on",
"the",
"first",
"one",
"found",
"or",
"on",
"all",
"of",
"them",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20266-L20335 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | destroyViewTree | function destroyViewTree(rootView) {
// If the view has no children, we can clean it up and return early.
if (rootView[TVIEW].childIndex === -1) {
return cleanUpView(rootView);
}
var viewOrContainer = getLViewChild(rootView);
while (viewOrContainer) {
var next = null;
if (vie... | javascript | function destroyViewTree(rootView) {
// If the view has no children, we can clean it up and return early.
if (rootView[TVIEW].childIndex === -1) {
return cleanUpView(rootView);
}
var viewOrContainer = getLViewChild(rootView);
while (viewOrContainer) {
var next = null;
if (vie... | [
"function",
"destroyViewTree",
"(",
"rootView",
")",
"{",
"// If the view has no children, we can clean it up and return early.",
"if",
"(",
"rootView",
"[",
"TVIEW",
"]",
".",
"childIndex",
"===",
"-",
"1",
")",
"{",
"return",
"cleanUpView",
"(",
"rootView",
")",
"... | Traverses down and up the tree of views and containers to remove listeners and
call onDestroy callbacks.
Notes:
- Because it's used for onDestroy calls, it needs to be bottom-up.
- Must process containers instead of their views to avoid splicing
when views are destroyed and re-added.
- Using a while loop because it's ... | [
"Traverses",
"down",
"and",
"up",
"the",
"tree",
"of",
"views",
"and",
"containers",
"to",
"remove",
"listeners",
"and",
"call",
"onDestroy",
"callbacks",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20401-L20433 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | insertView | function insertView(container, viewNode, index) {
var state = container.data;
var views = state[VIEWS];
var lView = viewNode.data;
if (index > 0) {
// This is a new view, we need to add it to the children.
views[index - 1].data[NEXT] = lView;
}
if (index < views.length) {
... | javascript | function insertView(container, viewNode, index) {
var state = container.data;
var views = state[VIEWS];
var lView = viewNode.data;
if (index > 0) {
// This is a new view, we need to add it to the children.
views[index - 1].data[NEXT] = lView;
}
if (index < views.length) {
... | [
"function",
"insertView",
"(",
"container",
",",
"viewNode",
",",
"index",
")",
"{",
"var",
"state",
"=",
"container",
".",
"data",
";",
"var",
"views",
"=",
"state",
"[",
"VIEWS",
"]",
";",
"var",
"lView",
"=",
"viewNode",
".",
"data",
";",
"if",
"(... | Inserts a view into a container.
This adds the view to the container's array of active views in the correct
position. It also adds the view's elements to the DOM if the container isn't a
root node of another view (in that case, the view's elements will be added when
the container's parent view is added later).
@param... | [
"Inserts",
"a",
"view",
"into",
"a",
"container",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20447-L20476 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | detachView | function detachView(container, removeIndex) {
var views = container.data[VIEWS];
var viewNode = views[removeIndex];
if (removeIndex > 0) {
views[removeIndex - 1].data[NEXT] = viewNode.data[NEXT];
}
views.splice(removeIndex, 1);
if (!container.tNode.detached) {
addRemoveViewFromCo... | javascript | function detachView(container, removeIndex) {
var views = container.data[VIEWS];
var viewNode = views[removeIndex];
if (removeIndex > 0) {
views[removeIndex - 1].data[NEXT] = viewNode.data[NEXT];
}
views.splice(removeIndex, 1);
if (!container.tNode.detached) {
addRemoveViewFromCo... | [
"function",
"detachView",
"(",
"container",
",",
"removeIndex",
")",
"{",
"var",
"views",
"=",
"container",
".",
"data",
"[",
"VIEWS",
"]",
";",
"var",
"viewNode",
"=",
"views",
"[",
"removeIndex",
"]",
";",
"if",
"(",
"removeIndex",
">",
"0",
")",
"{"... | Detaches a view from a container.
This method splices the view from the container's array of active views. It also
removes the view's elements from the DOM.
@param container The container from which to detach a view
@param removeIndex The index of the view to detach
@returns The detached view | [
"Detaches",
"a",
"view",
"from",
"a",
"container",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20487-L20507 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | removeView | function removeView(container, removeIndex) {
var viewNode = container.data[VIEWS][removeIndex];
detachView(container, removeIndex);
destroyLView(viewNode.data);
return viewNode;
} | javascript | function removeView(container, removeIndex) {
var viewNode = container.data[VIEWS][removeIndex];
detachView(container, removeIndex);
destroyLView(viewNode.data);
return viewNode;
} | [
"function",
"removeView",
"(",
"container",
",",
"removeIndex",
")",
"{",
"var",
"viewNode",
"=",
"container",
".",
"data",
"[",
"VIEWS",
"]",
"[",
"removeIndex",
"]",
";",
"detachView",
"(",
"container",
",",
"removeIndex",
")",
";",
"destroyLView",
"(",
... | Removes a view from a container, i.e. detaches it and then destroys the underlying LView.
@param container The container from which to remove a view
@param removeIndex The index of the view to remove
@returns The removed view | [
"Removes",
"a",
"view",
"from",
"a",
"container",
"i",
".",
"e",
".",
"detaches",
"it",
"and",
"then",
"destroys",
"the",
"underlying",
"LView",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20515-L20520 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | getLViewChild | function getLViewChild(viewData) {
if (viewData[TVIEW].childIndex === -1)
return null;
var hostNode = viewData[viewData[TVIEW].childIndex];
return hostNode.data ? hostNode.data : hostNode.dynamicLContainerNode.data;
} | javascript | function getLViewChild(viewData) {
if (viewData[TVIEW].childIndex === -1)
return null;
var hostNode = viewData[viewData[TVIEW].childIndex];
return hostNode.data ? hostNode.data : hostNode.dynamicLContainerNode.data;
} | [
"function",
"getLViewChild",
"(",
"viewData",
")",
"{",
"if",
"(",
"viewData",
"[",
"TVIEW",
"]",
".",
"childIndex",
"===",
"-",
"1",
")",
"return",
"null",
";",
"var",
"hostNode",
"=",
"viewData",
"[",
"viewData",
"[",
"TVIEW",
"]",
".",
"childIndex",
... | Gets the child of the given LViewData | [
"Gets",
"the",
"child",
"of",
"the",
"given",
"LViewData"
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20522-L20527 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | getParentState | function getParentState(state, rootView) {
var node;
if ((node = state[HOST_NODE]) && node.tNode.type === 2 /* View */) {
// if it's an embedded view, the state needs to go up to the container, in case the
// container has a next
return getParentLNode(node).data;
}
else {
... | javascript | function getParentState(state, rootView) {
var node;
if ((node = state[HOST_NODE]) && node.tNode.type === 2 /* View */) {
// if it's an embedded view, the state needs to go up to the container, in case the
// container has a next
return getParentLNode(node).data;
}
else {
... | [
"function",
"getParentState",
"(",
"state",
",",
"rootView",
")",
"{",
"var",
"node",
";",
"if",
"(",
"(",
"node",
"=",
"state",
"[",
"HOST_NODE",
"]",
")",
"&&",
"node",
".",
"tNode",
".",
"type",
"===",
"2",
"/* View */",
")",
"{",
"// if it's an emb... | Determines which LViewOrLContainer to jump to when traversing back up the
tree in destroyViewTree.
Normally, the view's parent LView should be checked, but in the case of
embedded views, the container (which is the view node's parent, but not the
LView's parent) needs to be checked for a possible next property.
@para... | [
"Determines",
"which",
"LViewOrLContainer",
"to",
"jump",
"to",
"when",
"traversing",
"back",
"up",
"the",
"tree",
"in",
"destroyViewTree",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20555-L20566 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | cleanUpView | function cleanUpView(viewOrContainer) {
if (viewOrContainer[TVIEW]) {
var view = viewOrContainer;
removeListeners(view);
executeOnDestroys(view);
executePipeOnDestroys(view);
// For component views only, the local renderer is destroyed as clean up time.
if (view[TVIEW... | javascript | function cleanUpView(viewOrContainer) {
if (viewOrContainer[TVIEW]) {
var view = viewOrContainer;
removeListeners(view);
executeOnDestroys(view);
executePipeOnDestroys(view);
// For component views only, the local renderer is destroyed as clean up time.
if (view[TVIEW... | [
"function",
"cleanUpView",
"(",
"viewOrContainer",
")",
"{",
"if",
"(",
"viewOrContainer",
"[",
"TVIEW",
"]",
")",
"{",
"var",
"view",
"=",
"viewOrContainer",
";",
"removeListeners",
"(",
"view",
")",
";",
"executeOnDestroys",
"(",
"view",
")",
";",
"execute... | Removes all listeners and call all onDestroys in a given view.
@param view The LViewData to clean up | [
"Removes",
"all",
"listeners",
"and",
"call",
"all",
"onDestroys",
"in",
"a",
"given",
"view",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20572-L20584 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | removeListeners | function removeListeners(viewData) {
var cleanup = viewData[TVIEW].cleanup;
if (cleanup != null) {
for (var i = 0; i < cleanup.length - 1; i += 2) {
if (typeof cleanup[i] === 'string') {
// This is a listener with the native renderer
var native = readElementVa... | javascript | function removeListeners(viewData) {
var cleanup = viewData[TVIEW].cleanup;
if (cleanup != null) {
for (var i = 0; i < cleanup.length - 1; i += 2) {
if (typeof cleanup[i] === 'string') {
// This is a listener with the native renderer
var native = readElementVa... | [
"function",
"removeListeners",
"(",
"viewData",
")",
"{",
"var",
"cleanup",
"=",
"viewData",
"[",
"TVIEW",
"]",
".",
"cleanup",
";",
"if",
"(",
"cleanup",
"!=",
"null",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"cleanup",
".",
"len... | Removes listeners and unsubscribes from output subscriptions | [
"Removes",
"listeners",
"and",
"unsubscribes",
"from",
"output",
"subscriptions"
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20586-L20610 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | executeOnDestroys | function executeOnDestroys(view) {
var tView = view[TVIEW];
var destroyHooks;
if (tView != null && (destroyHooks = tView.destroyHooks) != null) {
callHooks(view[DIRECTIVES], destroyHooks);
}
} | javascript | function executeOnDestroys(view) {
var tView = view[TVIEW];
var destroyHooks;
if (tView != null && (destroyHooks = tView.destroyHooks) != null) {
callHooks(view[DIRECTIVES], destroyHooks);
}
} | [
"function",
"executeOnDestroys",
"(",
"view",
")",
"{",
"var",
"tView",
"=",
"view",
"[",
"TVIEW",
"]",
";",
"var",
"destroyHooks",
";",
"if",
"(",
"tView",
"!=",
"null",
"&&",
"(",
"destroyHooks",
"=",
"tView",
".",
"destroyHooks",
")",
"!=",
"null",
... | Calls onDestroy hooks for this view | [
"Calls",
"onDestroy",
"hooks",
"for",
"this",
"view"
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20612-L20618 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | executePipeOnDestroys | function executePipeOnDestroys(viewData) {
var pipeDestroyHooks = viewData[TVIEW] && viewData[TVIEW].pipeDestroyHooks;
if (pipeDestroyHooks) {
callHooks(viewData, pipeDestroyHooks);
}
} | javascript | function executePipeOnDestroys(viewData) {
var pipeDestroyHooks = viewData[TVIEW] && viewData[TVIEW].pipeDestroyHooks;
if (pipeDestroyHooks) {
callHooks(viewData, pipeDestroyHooks);
}
} | [
"function",
"executePipeOnDestroys",
"(",
"viewData",
")",
"{",
"var",
"pipeDestroyHooks",
"=",
"viewData",
"[",
"TVIEW",
"]",
"&&",
"viewData",
"[",
"TVIEW",
"]",
".",
"pipeDestroyHooks",
";",
"if",
"(",
"pipeDestroyHooks",
")",
"{",
"callHooks",
"(",
"viewDa... | Calls pipe destroy hooks for this view | [
"Calls",
"pipe",
"destroy",
"hooks",
"for",
"this",
"view"
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20620-L20625 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | canInsertNativeNode | function canInsertNativeNode(parent, currentView) {
// We can only insert into a Component or View. Any other type should be an Error.
ngDevMode && assertNodeOfPossibleTypes(parent, 3 /* Element */, 2 /* View */);
if (parent.tNode.type === 3 /* Element */) {
// Parent is an element.
if (pare... | javascript | function canInsertNativeNode(parent, currentView) {
// We can only insert into a Component or View. Any other type should be an Error.
ngDevMode && assertNodeOfPossibleTypes(parent, 3 /* Element */, 2 /* View */);
if (parent.tNode.type === 3 /* Element */) {
// Parent is an element.
if (pare... | [
"function",
"canInsertNativeNode",
"(",
"parent",
",",
"currentView",
")",
"{",
"// We can only insert into a Component or View. Any other type should be an Error.",
"ngDevMode",
"&&",
"assertNodeOfPossibleTypes",
"(",
"parent",
",",
"3",
"/* Element */",
",",
"2",
"/* View */"... | Returns whether a native element can be inserted into the given parent.
There are two reasons why we may not be able to insert a element immediately.
- Projection: When creating a child content element of a component, we have to skip the
insertion because the content of a component will be projected.
`<component><cont... | [
"Returns",
"whether",
"a",
"native",
"element",
"can",
"be",
"inserted",
"into",
"the",
"given",
"parent",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20644-L20688 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | appendChild | function appendChild(parent, child, currentView) {
if (child !== null && canInsertNativeNode(parent, currentView)) {
var renderer = currentView[RENDERER];
if (parent.tNode.type === 2 /* View */) {
var container = getParentLNode(parent);
var renderParent = container.data[RENDE... | javascript | function appendChild(parent, child, currentView) {
if (child !== null && canInsertNativeNode(parent, currentView)) {
var renderer = currentView[RENDERER];
if (parent.tNode.type === 2 /* View */) {
var container = getParentLNode(parent);
var renderParent = container.data[RENDE... | [
"function",
"appendChild",
"(",
"parent",
",",
"child",
",",
"currentView",
")",
"{",
"if",
"(",
"child",
"!==",
"null",
"&&",
"canInsertNativeNode",
"(",
"parent",
",",
"currentView",
")",
")",
"{",
"var",
"renderer",
"=",
"currentView",
"[",
"RENDERER",
... | Appends the `child` element to the `parent`.
The element insertion might be delayed {@link canInsertNativeNode}.
@param parent The parent to which to append the child
@param child The child that should be appended
@param currentView The current LView
@returns Whether or not the child was appended | [
"Appends",
"the",
"child",
"element",
"to",
"the",
"parent",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20699-L20719 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | removeChild | function removeChild(parent, child, currentView) {
if (child !== null && canInsertNativeNode(parent, currentView)) {
// We only remove the element if not in View or not projected.
var renderer = currentView[RENDERER];
isProceduralRenderer(renderer) ? renderer.removeChild(parent.native, child... | javascript | function removeChild(parent, child, currentView) {
if (child !== null && canInsertNativeNode(parent, currentView)) {
// We only remove the element if not in View or not projected.
var renderer = currentView[RENDERER];
isProceduralRenderer(renderer) ? renderer.removeChild(parent.native, child... | [
"function",
"removeChild",
"(",
"parent",
",",
"child",
",",
"currentView",
")",
"{",
"if",
"(",
"child",
"!==",
"null",
"&&",
"canInsertNativeNode",
"(",
"parent",
",",
"currentView",
")",
")",
"{",
"// We only remove the element if not in View or not projected.",
... | Removes the `child` element of the `parent` from the DOM.
@param parent The parent from which to remove the child
@param child The child that should be removed
@param currentView The current LView
@returns Whether or not the child was removed | [
"Removes",
"the",
"child",
"element",
"of",
"the",
"parent",
"from",
"the",
"DOM",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20728-L20737 | train |
CuppaLabs/angular2-multiselect-dropdown | docs/vendor.js | appendProjectedNode | function appendProjectedNode(node, currentParent, currentView, renderParent) {
appendChild(currentParent, node.native, currentView);
if (node.tNode.type === 0 /* Container */) {
// The node we are adding is a container and we are adding it to an element which
// is not a component (no more re-pr... | javascript | function appendProjectedNode(node, currentParent, currentView, renderParent) {
appendChild(currentParent, node.native, currentView);
if (node.tNode.type === 0 /* Container */) {
// The node we are adding is a container and we are adding it to an element which
// is not a component (no more re-pr... | [
"function",
"appendProjectedNode",
"(",
"node",
",",
"currentParent",
",",
"currentView",
",",
"renderParent",
")",
"{",
"appendChild",
"(",
"currentParent",
",",
"node",
".",
"native",
",",
"currentView",
")",
";",
"if",
"(",
"node",
".",
"tNode",
".",
"typ... | Appends a projected node to the DOM, or in the case of a projected container,
appends the nodes from all of the container's active views to the DOM.
@param node The node to process
@param currentParent The last parent element to be processed
@param currentView Current LView | [
"Appends",
"a",
"projected",
"node",
"to",
"the",
"DOM",
"or",
"in",
"the",
"case",
"of",
"a",
"projected",
"container",
"appends",
"the",
"nodes",
"from",
"all",
"of",
"the",
"container",
"s",
"active",
"views",
"to",
"the",
"DOM",
"."
] | cb94eb9af46de79c69d61b4fd37a800009fb70d3 | https://github.com/CuppaLabs/angular2-multiselect-dropdown/blob/cb94eb9af46de79c69d61b4fd37a800009fb70d3/docs/vendor.js#L20746-L20765 | 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.