id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8,600 | babel/minify | packages/babel-plugin-minify-simplify/src/if-statement.js | conditionalReturnToGuards | function conditionalReturnToGuards(path) {
const { node } = path;
if (
!path.inList ||
!path.get("consequent").isBlockStatement() ||
node.alternate
) {
return;
}
let ret;
let test;
const exprs = [];
const statements = node.consequent.body;
for (let i = 0, s... | javascript | function conditionalReturnToGuards(path) {
const { node } = path;
if (
!path.inList ||
!path.get("consequent").isBlockStatement() ||
node.alternate
) {
return;
}
let ret;
let test;
const exprs = [];
const statements = node.consequent.body;
for (let i = 0, s... | [
"function",
"conditionalReturnToGuards",
"(",
"path",
")",
"{",
"const",
"{",
"node",
"}",
"=",
"path",
";",
"if",
"(",
"!",
"path",
".",
"inList",
"||",
"!",
"path",
".",
"get",
"(",
"\"consequent\"",
")",
".",
"isBlockStatement",
"(",
")",
"||",
"nod... | Make if statements with conditional returns in the body into an if statement that guards the rest of the block. | [
"Make",
"if",
"statements",
"with",
"conditional",
"returns",
"in",
"the",
"body",
"into",
"an",
"if",
"statement",
"that",
"guards",
"the",
"rest",
"of",
"the",
"block",
"."
] | 6b8bab6bf5905ebc3a5a9130662a5fef34886de4 | https://github.com/babel/minify/blob/6b8bab6bf5905ebc3a5a9130662a5fef34886de4/packages/babel-plugin-minify-simplify/src/if-statement.js#L346-L394 |
8,601 | babel/minify | utils/unpad/src/unpad.js | unpad | function unpad(str) {
const lines = str.split("\n");
const m = lines[1] && lines[1].match(/^\s+/);
if (!m) {
return str;
}
const spaces = m[0].length;
return lines
.map(line => line.slice(spaces))
.join("\n")
.trim();
} | javascript | function unpad(str) {
const lines = str.split("\n");
const m = lines[1] && lines[1].match(/^\s+/);
if (!m) {
return str;
}
const spaces = m[0].length;
return lines
.map(line => line.slice(spaces))
.join("\n")
.trim();
} | [
"function",
"unpad",
"(",
"str",
")",
"{",
"const",
"lines",
"=",
"str",
".",
"split",
"(",
"\"\\n\"",
")",
";",
"const",
"m",
"=",
"lines",
"[",
"1",
"]",
"&&",
"lines",
"[",
"1",
"]",
".",
"match",
"(",
"/",
"^\\s+",
"/",
")",
";",
"if",
"(... | Remove padding from a string. | [
"Remove",
"padding",
"from",
"a",
"string",
"."
] | 6b8bab6bf5905ebc3a5a9130662a5fef34886de4 | https://github.com/babel/minify/blob/6b8bab6bf5905ebc3a5a9130662a5fef34886de4/utils/unpad/src/unpad.js#L2-L13 |
8,602 | babel/minify | packages/babel-plugin-transform-simplify-comparison-operators/src/index.js | baseTypeStrictlyMatches | function baseTypeStrictlyMatches(left, right) {
let leftTypes, rightTypes;
if (t.isIdentifier(left)) {
leftTypes = customTypeAnnotation(left);
} else if (t.isIdentifier(right)) {
rightTypes = customTypeAnnotation(right);
}
// Early exit
if (t.isAnyTypeAnnotation(leftTypes) || t.isA... | javascript | function baseTypeStrictlyMatches(left, right) {
let leftTypes, rightTypes;
if (t.isIdentifier(left)) {
leftTypes = customTypeAnnotation(left);
} else if (t.isIdentifier(right)) {
rightTypes = customTypeAnnotation(right);
}
// Early exit
if (t.isAnyTypeAnnotation(leftTypes) || t.isA... | [
"function",
"baseTypeStrictlyMatches",
"(",
"left",
",",
"right",
")",
"{",
"let",
"leftTypes",
",",
"rightTypes",
";",
"if",
"(",
"t",
".",
"isIdentifier",
"(",
"left",
")",
")",
"{",
"leftTypes",
"=",
"customTypeAnnotation",
"(",
"left",
")",
";",
"}",
... | Based on the type inference in Babel | [
"Based",
"on",
"the",
"type",
"inference",
"in",
"Babel"
] | 6b8bab6bf5905ebc3a5a9130662a5fef34886de4 | https://github.com/babel/minify/blob/6b8bab6bf5905ebc3a5a9130662a5fef34886de4/packages/babel-plugin-transform-simplify-comparison-operators/src/index.js#L37-L63 |
8,603 | babel/minify | packages/babel-plugin-minify-dead-code-elimination/src/remove-use-strict.js | removeUseStrict | function removeUseStrict(block) {
if (!block.isBlockStatement()) {
throw new Error(
`Received ${block.type}. Expected BlockStatement. ` +
`Please report at ${newIssueUrl}`
);
}
const useStricts = getUseStrictDirectives(block);
// early exit
if (useStricts.length < 1) return;
// only... | javascript | function removeUseStrict(block) {
if (!block.isBlockStatement()) {
throw new Error(
`Received ${block.type}. Expected BlockStatement. ` +
`Please report at ${newIssueUrl}`
);
}
const useStricts = getUseStrictDirectives(block);
// early exit
if (useStricts.length < 1) return;
// only... | [
"function",
"removeUseStrict",
"(",
"block",
")",
"{",
"if",
"(",
"!",
"block",
".",
"isBlockStatement",
"(",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"`",
"${",
"block",
".",
"type",
"}",
"`",
"+",
"`",
"${",
"newIssueUrl",
"}",
"`",
")",
";",... | Remove redundant use strict
If the parent has a "use strict" directive, it is not required in
the children
@param {NodePath} block BlockStatement | [
"Remove",
"redundant",
"use",
"strict",
"If",
"the",
"parent",
"has",
"a",
"use",
"strict",
"directive",
"it",
"is",
"not",
"required",
"in",
"the",
"children"
] | 6b8bab6bf5905ebc3a5a9130662a5fef34886de4 | https://github.com/babel/minify/blob/6b8bab6bf5905ebc3a5a9130662a5fef34886de4/packages/babel-plugin-minify-dead-code-elimination/src/remove-use-strict.js#L16-L40 |
8,604 | babel/minify | scripts/plugin-contribution.js | tableStyle | function tableStyle() {
return {
chars: {
top: "",
"top-mid": "",
"top-left": "",
"top-right": "",
bottom: "",
"bottom-mid": "",
"bottom-left": "",
"bottom-right": "",
left: "",
"left-mid": "",
mid: "",
"mid-mid": "",
right: "",
"... | javascript | function tableStyle() {
return {
chars: {
top: "",
"top-mid": "",
"top-left": "",
"top-right": "",
bottom: "",
"bottom-mid": "",
"bottom-left": "",
"bottom-right": "",
left: "",
"left-mid": "",
mid: "",
"mid-mid": "",
right: "",
"... | [
"function",
"tableStyle",
"(",
")",
"{",
"return",
"{",
"chars",
":",
"{",
"top",
":",
"\"\"",
",",
"\"top-mid\"",
":",
"\"\"",
",",
"\"top-left\"",
":",
"\"\"",
",",
"\"top-right\"",
":",
"\"\"",
",",
"bottom",
":",
"\"\"",
",",
"\"bottom-mid\"",
":",
... | just to keep it at the bottom | [
"just",
"to",
"keep",
"it",
"at",
"the",
"bottom"
] | 6b8bab6bf5905ebc3a5a9130662a5fef34886de4 | https://github.com/babel/minify/blob/6b8bab6bf5905ebc3a5a9130662a5fef34886de4/scripts/plugin-contribution.js#L143-L168 |
8,605 | babel/minify | packages/babel-minify/src/fs.js | readStdin | async function readStdin() {
let code = "";
const stdin = process.stdin;
return new Promise(resolve => {
stdin.setEncoding("utf8");
stdin.on("readable", () => {
const chunk = process.stdin.read();
if (chunk !== null) code += chunk;
});
stdin.on("end", () => {
resolve(code);
}... | javascript | async function readStdin() {
let code = "";
const stdin = process.stdin;
return new Promise(resolve => {
stdin.setEncoding("utf8");
stdin.on("readable", () => {
const chunk = process.stdin.read();
if (chunk !== null) code += chunk;
});
stdin.on("end", () => {
resolve(code);
}... | [
"async",
"function",
"readStdin",
"(",
")",
"{",
"let",
"code",
"=",
"\"\"",
";",
"const",
"stdin",
"=",
"process",
".",
"stdin",
";",
"return",
"new",
"Promise",
"(",
"resolve",
"=>",
"{",
"stdin",
".",
"setEncoding",
"(",
"\"utf8\"",
")",
";",
"stdin... | the async keyword simply exists to denote we are returning a promise even though we don't use await inside it | [
"the",
"async",
"keyword",
"simply",
"exists",
"to",
"denote",
"we",
"are",
"returning",
"a",
"promise",
"even",
"though",
"we",
"don",
"t",
"use",
"await",
"inside",
"it"
] | 6b8bab6bf5905ebc3a5a9130662a5fef34886de4 | https://github.com/babel/minify/blob/6b8bab6bf5905ebc3a5a9130662a5fef34886de4/packages/babel-minify/src/fs.js#L48-L61 |
8,606 | babel/minify | packages/babel-helper-evaluate-path/src/index.js | shouldDeoptBasedOnScope | function shouldDeoptBasedOnScope(binding, refPath) {
if (binding.scope.path.isProgram() && refPath.scope !== binding.scope) {
return true;
}
return false;
} | javascript | function shouldDeoptBasedOnScope(binding, refPath) {
if (binding.scope.path.isProgram() && refPath.scope !== binding.scope) {
return true;
}
return false;
} | [
"function",
"shouldDeoptBasedOnScope",
"(",
"binding",
",",
"refPath",
")",
"{",
"if",
"(",
"binding",
".",
"scope",
".",
"path",
".",
"isProgram",
"(",
")",
"&&",
"refPath",
".",
"scope",
"!==",
"binding",
".",
"scope",
")",
"{",
"return",
"true",
";",
... | check if referenced in a different fn scope we can't determine if this function is called sync or async if the binding is in program scope all it's references inside a different function should be deopted | [
"check",
"if",
"referenced",
"in",
"a",
"different",
"fn",
"scope",
"we",
"can",
"t",
"determine",
"if",
"this",
"function",
"is",
"called",
"sync",
"or",
"async",
"if",
"the",
"binding",
"is",
"in",
"program",
"scope",
"all",
"it",
"s",
"references",
"i... | 6b8bab6bf5905ebc3a5a9130662a5fef34886de4 | https://github.com/babel/minify/blob/6b8bab6bf5905ebc3a5a9130662a5fef34886de4/packages/babel-helper-evaluate-path/src/index.js#L111-L116 |
8,607 | babel/minify | packages/babel-plugin-minify-builtins/src/index.js | getSegmentedSubPaths | function getSegmentedSubPaths(paths) {
let segments = new Map();
// Get earliest Path in tree where paths intersect
paths[0].getDeepestCommonAncestorFrom(
paths,
(lastCommon, index, ancestries) => {
// found the LCA
if (!lastCommon.isProgram()) {
let fnParent;
... | javascript | function getSegmentedSubPaths(paths) {
let segments = new Map();
// Get earliest Path in tree where paths intersect
paths[0].getDeepestCommonAncestorFrom(
paths,
(lastCommon, index, ancestries) => {
// found the LCA
if (!lastCommon.isProgram()) {
let fnParent;
... | [
"function",
"getSegmentedSubPaths",
"(",
"paths",
")",
"{",
"let",
"segments",
"=",
"new",
"Map",
"(",
")",
";",
"// Get earliest Path in tree where paths intersect",
"paths",
"[",
"0",
"]",
".",
"getDeepestCommonAncestorFrom",
"(",
"paths",
",",
"(",
"lastCommon",
... | Creates a segmented map that contains the earliest common Ancestor as the key and array of subpaths that are descendats of the LCA as value | [
"Creates",
"a",
"segmented",
"map",
"that",
"contains",
"the",
"earliest",
"common",
"Ancestor",
"as",
"the",
"key",
"and",
"array",
"of",
"subpaths",
"that",
"are",
"descendats",
"of",
"the",
"LCA",
"as",
"value"
] | 6b8bab6bf5905ebc3a5a9130662a5fef34886de4 | https://github.com/babel/minify/blob/6b8bab6bf5905ebc3a5a9130662a5fef34886de4/packages/babel-plugin-minify-builtins/src/index.js#L190-L228 |
8,608 | babel/minify | packages/babel-plugin-minify-mangle-names/src/index.js | toObject | function toObject(value) {
if (!Array.isArray(value)) {
return value;
}
const map = {};
for (let i = 0; i < value.length; i++) {
map[value[i]] = true;
}
return map;
} | javascript | function toObject(value) {
if (!Array.isArray(value)) {
return value;
}
const map = {};
for (let i = 0; i < value.length; i++) {
map[value[i]] = true;
}
return map;
} | [
"function",
"toObject",
"(",
"value",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"return",
"value",
";",
"}",
"const",
"map",
"=",
"{",
"}",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"value",
"... | convert value to object | [
"convert",
"value",
"to",
"object"
] | 6b8bab6bf5905ebc3a5a9130662a5fef34886de4 | https://github.com/babel/minify/blob/6b8bab6bf5905ebc3a5a9130662a5fef34886de4/packages/babel-plugin-minify-mangle-names/src/index.js#L553-L563 |
8,609 | babel/minify | packages/babel-plugin-transform-merge-sibling-variables/src/index.js | function(path) {
if (!path.inList) {
return;
}
const { node } = path;
let sibling = path.getSibling(path.key + 1);
let declarations = [];
while (sibling.isVariableDeclaration({ kind: node.kind })) {
declarations = de... | javascript | function(path) {
if (!path.inList) {
return;
}
const { node } = path;
let sibling = path.getSibling(path.key + 1);
let declarations = [];
while (sibling.isVariableDeclaration({ kind: node.kind })) {
declarations = de... | [
"function",
"(",
"path",
")",
"{",
"if",
"(",
"!",
"path",
".",
"inList",
")",
"{",
"return",
";",
"}",
"const",
"{",
"node",
"}",
"=",
"path",
";",
"let",
"sibling",
"=",
"path",
".",
"getSibling",
"(",
"path",
".",
"key",
"+",
"1",
")",
";",
... | concat variables of the same kind with their siblings | [
"concat",
"variables",
"of",
"the",
"same",
"kind",
"with",
"their",
"siblings"
] | 6b8bab6bf5905ebc3a5a9130662a5fef34886de4 | https://github.com/babel/minify/blob/6b8bab6bf5905ebc3a5a9130662a5fef34886de4/packages/babel-plugin-transform-merge-sibling-variables/src/index.js#L51-L78 | |
8,610 | babel/minify | packages/babel-plugin-transform-merge-sibling-variables/src/index.js | function(path) {
if (!path.inList) {
return;
}
const { node } = path;
if (node.kind !== "var") {
return;
}
const next = path.getSibling(path.key + 1);
if (!next.isForStatement()) {
return;
... | javascript | function(path) {
if (!path.inList) {
return;
}
const { node } = path;
if (node.kind !== "var") {
return;
}
const next = path.getSibling(path.key + 1);
if (!next.isForStatement()) {
return;
... | [
"function",
"(",
"path",
")",
"{",
"if",
"(",
"!",
"path",
".",
"inList",
")",
"{",
"return",
";",
"}",
"const",
"{",
"node",
"}",
"=",
"path",
";",
"if",
"(",
"node",
".",
"kind",
"!==",
"\"var\"",
")",
"{",
"return",
";",
"}",
"const",
"next"... | concat `var` declarations next to for loops with it's initialisers. block-scoped `let` and `const` are not moved because the for loop is a different block scope. | [
"concat",
"var",
"declarations",
"next",
"to",
"for",
"loops",
"with",
"it",
"s",
"initialisers",
".",
"block",
"-",
"scoped",
"let",
"and",
"const",
"are",
"not",
"moved",
"because",
"the",
"for",
"loop",
"is",
"a",
"different",
"block",
"scope",
"."
] | 6b8bab6bf5905ebc3a5a9130662a5fef34886de4 | https://github.com/babel/minify/blob/6b8bab6bf5905ebc3a5a9130662a5fef34886de4/packages/babel-plugin-transform-merge-sibling-variables/src/index.js#L83-L111 | |
8,611 | KhaosT/homebridge-camera-ffmpeg | drive.js | authorize | function authorize(credentials, callback) {
var clientSecret = credentials.installed.client_secret;
var clientId = credentials.installed.client_id;
var redirectUrl = credentials.installed.redirect_uris[0];
var auth = new googleAuth();
var oauth2Client = new auth.OAuth2(clientId, clientSecret, redire... | javascript | function authorize(credentials, callback) {
var clientSecret = credentials.installed.client_secret;
var clientId = credentials.installed.client_id;
var redirectUrl = credentials.installed.redirect_uris[0];
var auth = new googleAuth();
var oauth2Client = new auth.OAuth2(clientId, clientSecret, redire... | [
"function",
"authorize",
"(",
"credentials",
",",
"callback",
")",
"{",
"var",
"clientSecret",
"=",
"credentials",
".",
"installed",
".",
"client_secret",
";",
"var",
"clientId",
"=",
"credentials",
".",
"installed",
".",
"client_id",
";",
"var",
"redirectUrl",
... | This is all from the Google Drive Quickstart
Create an OAuth2 client with the given credentials, and then execute the
given callback function.
@param {Object} credentials The authorization client credentials.
@param {function} callback The callback to call with the authorized client. | [
"This",
"is",
"all",
"from",
"the",
"Google",
"Drive",
"Quickstart",
"Create",
"an",
"OAuth2",
"client",
"with",
"the",
"given",
"credentials",
"and",
"then",
"execute",
"the",
"given",
"callback",
"function",
"."
] | cd284406d1a67b88b6488fb455128a0b7a220e12 | https://github.com/KhaosT/homebridge-camera-ffmpeg/blob/cd284406d1a67b88b6488fb455128a0b7a220e12/drive.js#L136-L152 |
8,612 | Serhioromano/bootstrap-calendar | components/jstimezonedetect/jstz.js | function () {
var ambiguity_list = AMBIGUITIES[timezone_name],
length = ambiguity_list.length,
i = 0,
tz = ambiguity_list[0];
for (; i < length; i += 1) {
tz = ambiguity_list[i];
if (jstz.dat... | javascript | function () {
var ambiguity_list = AMBIGUITIES[timezone_name],
length = ambiguity_list.length,
i = 0,
tz = ambiguity_list[0];
for (; i < length; i += 1) {
tz = ambiguity_list[i];
if (jstz.dat... | [
"function",
"(",
")",
"{",
"var",
"ambiguity_list",
"=",
"AMBIGUITIES",
"[",
"timezone_name",
"]",
",",
"length",
"=",
"ambiguity_list",
".",
"length",
",",
"i",
"=",
"0",
",",
"tz",
"=",
"ambiguity_list",
"[",
"0",
"]",
";",
"for",
"(",
";",
"i",
"<... | The keys in this object are timezones that we know may be ambiguous after
a preliminary scan through the olson_tz object.
The array of timezones to compare must be in the order that daylight savings
starts for the regions. | [
"The",
"keys",
"in",
"this",
"object",
"are",
"timezones",
"that",
"we",
"know",
"may",
"be",
"ambiguous",
"after",
"a",
"preliminary",
"scan",
"through",
"the",
"olson_tz",
"object",
"."
] | fd5e6fdb69d7e8afdc655b54ffe7a50b8edfffd1 | https://github.com/Serhioromano/bootstrap-calendar/blob/fd5e6fdb69d7e8afdc655b54ffe7a50b8edfffd1/components/jstimezonedetect/jstz.js#L229-L243 | |
8,613 | OptimalBits/redbird | lib/proxy.js | redirectToHttps | function redirectToHttps(req, res, target, ssl, log) {
req.url = req._url || req.url; // Get the original url since we are going to redirect.
var targetPort = ssl.redirectPort || ssl.port;
var hostname = req.headers.host.split(':')[0] + ( targetPort ? ':' + targetPort : '' );
var url = 'https://' + path.join(h... | javascript | function redirectToHttps(req, res, target, ssl, log) {
req.url = req._url || req.url; // Get the original url since we are going to redirect.
var targetPort = ssl.redirectPort || ssl.port;
var hostname = req.headers.host.split(':')[0] + ( targetPort ? ':' + targetPort : '' );
var url = 'https://' + path.join(h... | [
"function",
"redirectToHttps",
"(",
"req",
",",
"res",
",",
"target",
",",
"ssl",
",",
"log",
")",
"{",
"req",
".",
"url",
"=",
"req",
".",
"_url",
"||",
"req",
".",
"url",
";",
"// Get the original url since we are going to redirect.",
"var",
"targetPort",
... | Redirect to the HTTPS proxy | [
"Redirect",
"to",
"the",
"HTTPS",
"proxy"
] | a8779cccde681f27f78c80b9ee6ca373254c73e5 | https://github.com/OptimalBits/redbird/blob/a8779cccde681f27f78c80b9ee6ca373254c73e5/lib/proxy.js#L702-L715 |
8,614 | timdown/rangy | src/modules/inactive/rangy-commands_new.js | getFurthestAncestor | function getFurthestAncestor(node) {
var root = node;
while (root.parentNode != null) {
root = root.parentNode;
}
return root;
} | javascript | function getFurthestAncestor(node) {
var root = node;
while (root.parentNode != null) {
root = root.parentNode;
}
return root;
} | [
"function",
"getFurthestAncestor",
"(",
"node",
")",
"{",
"var",
"root",
"=",
"node",
";",
"while",
"(",
"root",
".",
"parentNode",
"!=",
"null",
")",
"{",
"root",
"=",
"root",
".",
"parentNode",
";",
"}",
"return",
"root",
";",
"}"
] | Returns the furthest ancestor of a Node as defined by DOM Range. | [
"Returns",
"the",
"furthest",
"ancestor",
"of",
"a",
"Node",
"as",
"defined",
"by",
"DOM",
"Range",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/rangy-commands_new.js#L79-L85 |
8,615 | timdown/rangy | src/modules/inactive/rangy-commands_new.js | isCollapsedLineBreak | function isCollapsedLineBreak(br) {
if (!isHtmlElement(br, "br")) {
return false;
}
// Add a zwsp after it and see if that changes the height of the nearest
// non-inline parent. Note: this is not actually reliable, because the
// parent might have a fixed height or... | javascript | function isCollapsedLineBreak(br) {
if (!isHtmlElement(br, "br")) {
return false;
}
// Add a zwsp after it and see if that changes the height of the nearest
// non-inline parent. Note: this is not actually reliable, because the
// parent might have a fixed height or... | [
"function",
"isCollapsedLineBreak",
"(",
"br",
")",
"{",
"if",
"(",
"!",
"isHtmlElement",
"(",
"br",
",",
"\"br\"",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Add a zwsp after it and see if that changes the height of the nearest",
"// non-inline parent. Note: this i... | "A collapsed line break is a br that begins a line box which has nothing else in it, and therefore has zero height." | [
"A",
"collapsed",
"line",
"break",
"is",
"a",
"br",
"that",
"begins",
"a",
"line",
"box",
"which",
"has",
"nothing",
"else",
"in",
"it",
"and",
"therefore",
"has",
"zero",
"height",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/rangy-commands_new.js#L299-L336 |
8,616 | timdown/rangy | src/modules/inactive/rangy-commands_new.js | getEffectiveCommandValue | function getEffectiveCommandValue(node, context) {
var isElement = (node.nodeType == 1);
// "If neither node nor its parent is an Element, return null."
if (!isElement && (!node.parentNode || node.parentNode.nodeType != 1)) {
return null;
}
// "If node is not an Ele... | javascript | function getEffectiveCommandValue(node, context) {
var isElement = (node.nodeType == 1);
// "If neither node nor its parent is an Element, return null."
if (!isElement && (!node.parentNode || node.parentNode.nodeType != 1)) {
return null;
}
// "If node is not an Ele... | [
"function",
"getEffectiveCommandValue",
"(",
"node",
",",
"context",
")",
"{",
"var",
"isElement",
"=",
"(",
"node",
".",
"nodeType",
"==",
"1",
")",
";",
"// \"If neither node nor its parent is an Element, return null.\"",
"if",
"(",
"!",
"isElement",
"&&",
"(",
... | "effective value" per edit command spec | [
"effective",
"value",
"per",
"edit",
"command",
"spec"
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/rangy-commands_new.js#L834-L848 |
8,617 | timdown/rangy | builder/build.js | doSubstituteBuildVars | function doSubstituteBuildVars(file, buildVars) {
var contents = fs.readFileSync(file, FILE_ENCODING);
contents = contents.replace(/%%build:([^%]+)%%/g, function(matched, buildVarName) {
return buildVars[buildVarName];
});
// Now do replacements specified by build dire... | javascript | function doSubstituteBuildVars(file, buildVars) {
var contents = fs.readFileSync(file, FILE_ENCODING);
contents = contents.replace(/%%build:([^%]+)%%/g, function(matched, buildVarName) {
return buildVars[buildVarName];
});
// Now do replacements specified by build dire... | [
"function",
"doSubstituteBuildVars",
"(",
"file",
",",
"buildVars",
")",
"{",
"var",
"contents",
"=",
"fs",
".",
"readFileSync",
"(",
"file",
",",
"FILE_ENCODING",
")",
";",
"contents",
"=",
"contents",
".",
"replace",
"(",
"/",
"%%build:([^%]+)%%",
"/",
"g"... | Substitute build vars in scripts | [
"Substitute",
"build",
"vars",
"in",
"scripts"
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/builder/build.js#L223-L233 |
8,618 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | isAncestor | function isAncestor(ancestor, descendant) {
return ancestor
&& descendant
&& Boolean(ancestor.compareDocumentPosition(descendant) & Node.DOCUMENT_POSITION_CONTAINED_BY);
} | javascript | function isAncestor(ancestor, descendant) {
return ancestor
&& descendant
&& Boolean(ancestor.compareDocumentPosition(descendant) & Node.DOCUMENT_POSITION_CONTAINED_BY);
} | [
"function",
"isAncestor",
"(",
"ancestor",
",",
"descendant",
")",
"{",
"return",
"ancestor",
"&&",
"descendant",
"&&",
"Boolean",
"(",
"ancestor",
".",
"compareDocumentPosition",
"(",
"descendant",
")",
"&",
"Node",
".",
"DOCUMENT_POSITION_CONTAINED_BY",
")",
";"... | Returns true if ancestor is an ancestor of descendant, false otherwise. | [
"Returns",
"true",
"if",
"ancestor",
"is",
"an",
"ancestor",
"of",
"descendant",
"false",
"otherwise",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L55-L59 |
8,619 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | isAncestorContainer | function isAncestorContainer(ancestor, descendant) {
return (ancestor || descendant)
&& (ancestor == descendant || isAncestor(ancestor, descendant));
} | javascript | function isAncestorContainer(ancestor, descendant) {
return (ancestor || descendant)
&& (ancestor == descendant || isAncestor(ancestor, descendant));
} | [
"function",
"isAncestorContainer",
"(",
"ancestor",
",",
"descendant",
")",
"{",
"return",
"(",
"ancestor",
"||",
"descendant",
")",
"&&",
"(",
"ancestor",
"==",
"descendant",
"||",
"isAncestor",
"(",
"ancestor",
",",
"descendant",
")",
")",
";",
"}"
] | Returns true if ancestor is an ancestor of or equal to descendant, false
otherwise. | [
"Returns",
"true",
"if",
"ancestor",
"is",
"an",
"ancestor",
"of",
"or",
"equal",
"to",
"descendant",
"false",
"otherwise",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L65-L68 |
8,620 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | isDescendant | function isDescendant(descendant, ancestor) {
return ancestor
&& descendant
&& Boolean(ancestor.compareDocumentPosition(descendant) & Node.DOCUMENT_POSITION_CONTAINED_BY);
} | javascript | function isDescendant(descendant, ancestor) {
return ancestor
&& descendant
&& Boolean(ancestor.compareDocumentPosition(descendant) & Node.DOCUMENT_POSITION_CONTAINED_BY);
} | [
"function",
"isDescendant",
"(",
"descendant",
",",
"ancestor",
")",
"{",
"return",
"ancestor",
"&&",
"descendant",
"&&",
"Boolean",
"(",
"ancestor",
".",
"compareDocumentPosition",
"(",
"descendant",
")",
"&",
"Node",
".",
"DOCUMENT_POSITION_CONTAINED_BY",
")",
"... | Returns true if descendant is a descendant of ancestor, false otherwise. | [
"Returns",
"true",
"if",
"descendant",
"is",
"a",
"descendant",
"of",
"ancestor",
"false",
"otherwise",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L73-L77 |
8,621 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | getPosition | function getPosition(nodeA, offsetA, nodeB, offsetB) {
// "If node A is the same as node B, return equal if offset A equals offset
// B, before if offset A is less than offset B, and after if offset A is
// greater than offset B."
if (nodeA == nodeB) {
if (offsetA == offsetB) {
return "equal";
}
if (offset... | javascript | function getPosition(nodeA, offsetA, nodeB, offsetB) {
// "If node A is the same as node B, return equal if offset A equals offset
// B, before if offset A is less than offset B, and after if offset A is
// greater than offset B."
if (nodeA == nodeB) {
if (offsetA == offsetB) {
return "equal";
}
if (offset... | [
"function",
"getPosition",
"(",
"nodeA",
",",
"offsetA",
",",
"nodeB",
",",
"offsetB",
")",
"{",
"// \"If node A is the same as node B, return equal if offset A equals offset",
"// B, before if offset A is less than offset B, and after if offset A is",
"// greater than offset B.\"",
"i... | The position of two boundary points relative to one another, as defined by
DOM Range. | [
"The",
"position",
"of",
"two",
"boundary",
"points",
"relative",
"to",
"one",
"another",
"as",
"defined",
"by",
"DOM",
"Range",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L254-L301 |
8,622 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | getContainedNodes | function getContainedNodes(range, condition) {
if (typeof condition == "undefined") {
condition = function() { return true };
}
var node = range.startContainer;
if (node.hasChildNodes()
&& range.startOffset < node.childNodes.length) {
// A child is contained
node = node.childNodes[range.startOffset];
} else... | javascript | function getContainedNodes(range, condition) {
if (typeof condition == "undefined") {
condition = function() { return true };
}
var node = range.startContainer;
if (node.hasChildNodes()
&& range.startOffset < node.childNodes.length) {
// A child is contained
node = node.childNodes[range.startOffset];
} else... | [
"function",
"getContainedNodes",
"(",
"range",
",",
"condition",
")",
"{",
"if",
"(",
"typeof",
"condition",
"==",
"\"undefined\"",
")",
"{",
"condition",
"=",
"function",
"(",
")",
"{",
"return",
"true",
"}",
";",
"}",
"var",
"node",
"=",
"range",
".",
... | Return all nodes contained in range that the provided function returns true
for, omitting any with an ancestor already being returned. | [
"Return",
"all",
"nodes",
"contained",
"in",
"range",
"that",
"the",
"provided",
"function",
"returns",
"true",
"for",
"omitting",
"any",
"with",
"an",
"ancestor",
"already",
"being",
"returned",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L332-L370 |
8,623 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | editCommandMethod | function editCommandMethod(command, range, callback) {
// Set up our global range magic, but only if we're the outermost function
if (executionStackDepth == 0 && typeof range != "undefined") {
globalRange = range;
} else if (executionStackDepth == 0) {
globalRange = null;
globalRange = getActiveRange();
}
/... | javascript | function editCommandMethod(command, range, callback) {
// Set up our global range magic, but only if we're the outermost function
if (executionStackDepth == 0 && typeof range != "undefined") {
globalRange = range;
} else if (executionStackDepth == 0) {
globalRange = null;
globalRange = getActiveRange();
}
/... | [
"function",
"editCommandMethod",
"(",
"command",
",",
"range",
",",
"callback",
")",
"{",
"// Set up our global range magic, but only if we're the outermost function",
"if",
"(",
"executionStackDepth",
"==",
"0",
"&&",
"typeof",
"range",
"!=",
"\"undefined\"",
")",
"{",
... | Helper function for common behavior. | [
"Helper",
"function",
"for",
"common",
"behavior",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L497-L522 |
8,624 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | isEditingHost | function isEditingHost(node) {
return node
&& isHtmlElement(node)
&& (node.contentEditable == "true"
|| (node.parentNode
&& node.parentNode.nodeType == Node.DOCUMENT_NODE
&& node.parentNode.designMode == "on"));
} | javascript | function isEditingHost(node) {
return node
&& isHtmlElement(node)
&& (node.contentEditable == "true"
|| (node.parentNode
&& node.parentNode.nodeType == Node.DOCUMENT_NODE
&& node.parentNode.designMode == "on"));
} | [
"function",
"isEditingHost",
"(",
"node",
")",
"{",
"return",
"node",
"&&",
"isHtmlElement",
"(",
"node",
")",
"&&",
"(",
"node",
".",
"contentEditable",
"==",
"\"true\"",
"||",
"(",
"node",
".",
"parentNode",
"&&",
"node",
".",
"parentNode",
".",
"nodeTyp... | "An editing host is a node that is either an HTML element with a contenteditable attribute set to the true state, or the HTML element child of a Document whose designMode is enabled." | [
"An",
"editing",
"host",
"is",
"a",
"node",
"that",
"is",
"either",
"an",
"HTML",
"element",
"with",
"a",
"contenteditable",
"attribute",
"set",
"to",
"the",
"true",
"state",
"or",
"the",
"HTML",
"element",
"child",
"of",
"a",
"Document",
"whose",
"designM... | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L729-L736 |
8,625 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | isEditable | function isEditable(node) {
return node
&& !isEditingHost(node)
&& (node.nodeType != Node.ELEMENT_NODE || node.contentEditable != "false")
&& (isEditingHost(node.parentNode) || isEditable(node.parentNode))
&& (isHtmlElement(node)
|| (node.nodeType == Node.ELEMENT_NODE && node.namespaceURI == "http://www.w3.o... | javascript | function isEditable(node) {
return node
&& !isEditingHost(node)
&& (node.nodeType != Node.ELEMENT_NODE || node.contentEditable != "false")
&& (isEditingHost(node.parentNode) || isEditable(node.parentNode))
&& (isHtmlElement(node)
|| (node.nodeType == Node.ELEMENT_NODE && node.namespaceURI == "http://www.w3.o... | [
"function",
"isEditable",
"(",
"node",
")",
"{",
"return",
"node",
"&&",
"!",
"isEditingHost",
"(",
"node",
")",
"&&",
"(",
"node",
".",
"nodeType",
"!=",
"Node",
".",
"ELEMENT_NODE",
"||",
"node",
".",
"contentEditable",
"!=",
"\"false\"",
")",
"&&",
"(... | "Something is editable if it is a node; it is not an editing host; it does not have a contenteditable attribute set to the false state; its parent is an editing host or editable; and either it is an HTML element, or it is an svg or math element, or it is not an Element and its parent is an HTML element." | [
"Something",
"is",
"editable",
"if",
"it",
"is",
"a",
"node",
";",
"it",
"is",
"not",
"an",
"editing",
"host",
";",
"it",
"does",
"not",
"have",
"a",
"contenteditable",
"attribute",
"set",
"to",
"the",
"false",
"state",
";",
"its",
"parent",
"is",
"an"... | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L743-L752 |
8,626 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | hasEditableDescendants | function hasEditableDescendants(node) {
for (var i = 0; i < node.childNodes.length; i++) {
if (isEditable(node.childNodes[i])
|| hasEditableDescendants(node.childNodes[i])) {
return true;
}
}
return false;
} | javascript | function hasEditableDescendants(node) {
for (var i = 0; i < node.childNodes.length; i++) {
if (isEditable(node.childNodes[i])
|| hasEditableDescendants(node.childNodes[i])) {
return true;
}
}
return false;
} | [
"function",
"hasEditableDescendants",
"(",
"node",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"node",
".",
"childNodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"isEditable",
"(",
"node",
".",
"childNodes",
"[",
"i",
"]"... | Helper function, not defined in the spec | [
"Helper",
"function",
"not",
"defined",
"in",
"the",
"spec"
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L755-L763 |
8,627 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | getEditingHostOf | function getEditingHostOf(node) {
if (isEditingHost(node)) {
return node;
} else if (isEditable(node)) {
var ancestor = node.parentNode;
while (!isEditingHost(ancestor)) {
ancestor = ancestor.parentNode;
}
return ancestor;
} else {
return null;
}
} | javascript | function getEditingHostOf(node) {
if (isEditingHost(node)) {
return node;
} else if (isEditable(node)) {
var ancestor = node.parentNode;
while (!isEditingHost(ancestor)) {
ancestor = ancestor.parentNode;
}
return ancestor;
} else {
return null;
}
} | [
"function",
"getEditingHostOf",
"(",
"node",
")",
"{",
"if",
"(",
"isEditingHost",
"(",
"node",
")",
")",
"{",
"return",
"node",
";",
"}",
"else",
"if",
"(",
"isEditable",
"(",
"node",
")",
")",
"{",
"var",
"ancestor",
"=",
"node",
".",
"parentNode",
... | "The editing host of node is null if node is neither editable nor an editing host; node itself, if node is an editing host; or the nearest ancestor of node that is an editing host, if node is editable." | [
"The",
"editing",
"host",
"of",
"node",
"is",
"null",
"if",
"node",
"is",
"neither",
"editable",
"nor",
"an",
"editing",
"host",
";",
"node",
"itself",
"if",
"node",
"is",
"an",
"editing",
"host",
";",
"or",
"the",
"nearest",
"ancestor",
"of",
"node",
... | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L768-L780 |
8,628 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | isCollapsedBlockProp | function isCollapsedBlockProp(node) {
if (isCollapsedLineBreak(node)
&& !isExtraneousLineBreak(node)) {
return true;
}
if (!isInlineNode(node)
|| node.nodeType != Node.ELEMENT_NODE) {
return false;
}
var hasCollapsedBlockPropChild = false;
for (var i = 0; i < node.childNodes.length; i++) {
if (!isInvisi... | javascript | function isCollapsedBlockProp(node) {
if (isCollapsedLineBreak(node)
&& !isExtraneousLineBreak(node)) {
return true;
}
if (!isInlineNode(node)
|| node.nodeType != Node.ELEMENT_NODE) {
return false;
}
var hasCollapsedBlockPropChild = false;
for (var i = 0; i < node.childNodes.length; i++) {
if (!isInvisi... | [
"function",
"isCollapsedBlockProp",
"(",
"node",
")",
"{",
"if",
"(",
"isCollapsedLineBreak",
"(",
"node",
")",
"&&",
"!",
"isExtraneousLineBreak",
"(",
"node",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
"isInlineNode",
"(",
"node",
")",
... | "A collapsed block prop is either a collapsed line break that is not an extraneous line break, or an Element that is an inline node and whose children are all either invisible or collapsed block props and that has at least one child that is a collapsed block prop." | [
"A",
"collapsed",
"block",
"prop",
"is",
"either",
"a",
"collapsed",
"line",
"break",
"that",
"is",
"not",
"an",
"extraneous",
"line",
"break",
"or",
"an",
"Element",
"that",
"is",
"an",
"inline",
"node",
"and",
"whose",
"children",
"are",
"all",
"either",... | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L1034-L1057 |
8,629 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | isFormattableNode | function isFormattableNode(node) {
return isEditable(node)
&& isVisible(node)
&& (node.nodeType == Node.TEXT_NODE
|| isHtmlElement(node, ["img", "br"]));
} | javascript | function isFormattableNode(node) {
return isEditable(node)
&& isVisible(node)
&& (node.nodeType == Node.TEXT_NODE
|| isHtmlElement(node, ["img", "br"]));
} | [
"function",
"isFormattableNode",
"(",
"node",
")",
"{",
"return",
"isEditable",
"(",
"node",
")",
"&&",
"isVisible",
"(",
"node",
")",
"&&",
"(",
"node",
".",
"nodeType",
"==",
"Node",
".",
"TEXT_NODE",
"||",
"isHtmlElement",
"(",
"node",
",",
"[",
"\"im... | "A formattable node is an editable visible node that is either a Text node, an img, or a br." | [
"A",
"formattable",
"node",
"is",
"an",
"editable",
"visible",
"node",
"that",
"is",
"either",
"a",
"Text",
"node",
"an",
"img",
"or",
"a",
"br",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L1988-L1993 |
8,630 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | areEquivalentValues | function areEquivalentValues(command, val1, val2) {
if (val1 === null && val2 === null) {
return true;
}
if (typeof val1 == "string"
&& typeof val2 == "string"
&& val1 == val2
&& !("equivalentValues" in commands[command])) {
return true;
}
if (typeof val1 == "string"
&& typeof val2 == "string"
&& "equiv... | javascript | function areEquivalentValues(command, val1, val2) {
if (val1 === null && val2 === null) {
return true;
}
if (typeof val1 == "string"
&& typeof val2 == "string"
&& val1 == val2
&& !("equivalentValues" in commands[command])) {
return true;
}
if (typeof val1 == "string"
&& typeof val2 == "string"
&& "equiv... | [
"function",
"areEquivalentValues",
"(",
"command",
",",
"val1",
",",
"val2",
")",
"{",
"if",
"(",
"val1",
"===",
"null",
"&&",
"val2",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"typeof",
"val1",
"==",
"\"string\"",
"&&",
"typeof",... | "Two quantities are equivalent values for a command if either both are null, or both are strings and they're equal and the command does not define any equivalent values, or both are strings and the command defines equivalent values and they match the definition." | [
"Two",
"quantities",
"are",
"equivalent",
"values",
"for",
"a",
"command",
"if",
"either",
"both",
"are",
"null",
"or",
"both",
"are",
"strings",
"and",
"they",
"re",
"equal",
"and",
"the",
"command",
"does",
"not",
"define",
"any",
"equivalent",
"values",
... | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L1999-L2019 |
8,631 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | normalizeFontSize | function normalizeFontSize(value) {
// "Strip leading and trailing whitespace from value."
//
// Cheap hack, not following the actual algorithm.
value = value.trim();
// "If value is not a valid floating point number, and would not be a valid
// floating point number if a single leading "+" character were stripp... | javascript | function normalizeFontSize(value) {
// "Strip leading and trailing whitespace from value."
//
// Cheap hack, not following the actual algorithm.
value = value.trim();
// "If value is not a valid floating point number, and would not be a valid
// floating point number if a single leading "+" character were stripp... | [
"function",
"normalizeFontSize",
"(",
"value",
")",
"{",
"// \"Strip leading and trailing whitespace from value.\"",
"//",
"// Cheap hack, not following the actual algorithm.",
"value",
"=",
"value",
".",
"trim",
"(",
")",
";",
"// \"If value is not a valid floating point number, a... | Helper function for fontSize's action plus queryOutputHelper. It's just the middle of fontSize's action, ripped out into its own function. Returns null if the size is invalid. | [
"Helper",
"function",
"for",
"fontSize",
"s",
"action",
"plus",
"queryOutputHelper",
".",
"It",
"s",
"just",
"the",
"middle",
"of",
"fontSize",
"s",
"action",
"ripped",
"out",
"into",
"its",
"own",
"function",
".",
"Returns",
"null",
"if",
"the",
"size",
"... | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L3177-L3245 |
8,632 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | function(value) {
// Action is further copy-pasted, same as foreColor
// "If value is not a valid CSS color, prepend "#" to it."
//
// "If value is still not a valid CSS color, or if it is currentColor,
// abort these steps and do nothing."
//
// Cheap hack for testing, no attempt to be comprehensive.
... | javascript | function(value) {
// Action is further copy-pasted, same as foreColor
// "If value is not a valid CSS color, prepend "#" to it."
//
// "If value is still not a valid CSS color, or if it is currentColor,
// abort these steps and do nothing."
//
// Cheap hack for testing, no attempt to be comprehensive.
... | [
"function",
"(",
"value",
")",
"{",
"// Action is further copy-pasted, same as foreColor",
"// \"If value is not a valid CSS color, prepend \"#\" to it.\"",
"//",
"// \"If value is still not a valid CSS color, or if it is currentColor,",
"// abort these steps and do nothing.\"",
"//",
"// Chea... | Copy-pasted, same as backColor | [
"Copy",
"-",
"pasted",
"same",
"as",
"backColor"
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L3394-L3414 | |
8,633 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | isIndentationElement | function isIndentationElement(node) {
if (!isHtmlElement(node)) {
return false;
}
if (node.tagName == "BLOCKQUOTE") {
return true;
}
if (node.tagName != "DIV") {
return false;
}
for (var i = 0; i < node.style.length; i++) {
// Approximate check
if (/^(-[a-z]+-)?margin/.test(node.style[i])) {
retu... | javascript | function isIndentationElement(node) {
if (!isHtmlElement(node)) {
return false;
}
if (node.tagName == "BLOCKQUOTE") {
return true;
}
if (node.tagName != "DIV") {
return false;
}
for (var i = 0; i < node.style.length; i++) {
// Approximate check
if (/^(-[a-z]+-)?margin/.test(node.style[i])) {
retu... | [
"function",
"isIndentationElement",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"isHtmlElement",
"(",
"node",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"node",
".",
"tagName",
"==",
"\"BLOCKQUOTE\"",
")",
"{",
"return",
"true",
";",
"}",
"if",
... | "An indentation element is either a blockquote, or a div that has a style attribute that sets "margin" or some subproperty of it." | [
"An",
"indentation",
"element",
"is",
"either",
"a",
"blockquote",
"or",
"a",
"div",
"that",
"has",
"a",
"style",
"attribute",
"that",
"sets",
"margin",
"or",
"some",
"subproperty",
"of",
"it",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L3702-L3723 |
8,634 | timdown/rangy | src/modules/inactive/commands/aryeh_implementation.js | removePreservingDescendants | function removePreservingDescendants(node) {
if (node.hasChildNodes()) {
splitParent([].slice.call(node.childNodes));
} else {
node.parentNode.removeChild(node);
}
} | javascript | function removePreservingDescendants(node) {
if (node.hasChildNodes()) {
splitParent([].slice.call(node.childNodes));
} else {
node.parentNode.removeChild(node);
}
} | [
"function",
"removePreservingDescendants",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"splitParent",
"(",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"node",
".",
"childNodes",
")",
")",
";",
"}",
"else",
"{",
"... | "To remove a node node while preserving its descendants, split the parent of node's children if it has any. If it has no children, instead remove it from its parent." | [
"To",
"remove",
"a",
"node",
"node",
"while",
"preserving",
"its",
"descendants",
"split",
"the",
"parent",
"of",
"node",
"s",
"children",
"if",
"it",
"has",
"any",
".",
"If",
"it",
"has",
"no",
"children",
"instead",
"remove",
"it",
"from",
"its",
"pare... | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/commands/aryeh_implementation.js#L5146-L5152 |
8,635 | timdown/rangy | src/modules/rangy-classapplier.js | hasClass | function hasClass(el, className) {
if (typeof el.classList == "object") {
return el.classList.contains(className);
} else {
var classNameSupported = (typeof el.className == "string");
var elClass = classNameSupported ? el.className : el.getAttribute("class");
... | javascript | function hasClass(el, className) {
if (typeof el.classList == "object") {
return el.classList.contains(className);
} else {
var classNameSupported = (typeof el.className == "string");
var elClass = classNameSupported ? el.className : el.getAttribute("class");
... | [
"function",
"hasClass",
"(",
"el",
",",
"className",
")",
"{",
"if",
"(",
"typeof",
"el",
".",
"classList",
"==",
"\"object\"",
")",
"{",
"return",
"el",
".",
"classList",
".",
"contains",
"(",
"className",
")",
";",
"}",
"else",
"{",
"var",
"className... | Inefficient, inelegant nonsense for IE's svg element, which has no classList and non-HTML className implementation | [
"Inefficient",
"inelegant",
"nonsense",
"for",
"IE",
"s",
"svg",
"element",
"which",
"has",
"no",
"classList",
"and",
"non",
"-",
"HTML",
"className",
"implementation"
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/rangy-classapplier.js#L48-L56 |
8,636 | timdown/rangy | src/modules/rangy-classapplier.js | function(textNodes, range, positionsToPreserve, isUndo) {
log.group("postApply " + range.toHtml());
var firstNode = textNodes[0], lastNode = textNodes[textNodes.length - 1];
var merges = [], currentMerge;
var rangeStartNode = firstNode, rangeEndNode = lastNode;
... | javascript | function(textNodes, range, positionsToPreserve, isUndo) {
log.group("postApply " + range.toHtml());
var firstNode = textNodes[0], lastNode = textNodes[textNodes.length - 1];
var merges = [], currentMerge;
var rangeStartNode = firstNode, rangeEndNode = lastNode;
... | [
"function",
"(",
"textNodes",
",",
"range",
",",
"positionsToPreserve",
",",
"isUndo",
")",
"{",
"log",
".",
"group",
"(",
"\"postApply \"",
"+",
"range",
".",
"toHtml",
"(",
")",
")",
";",
"var",
"firstNode",
"=",
"textNodes",
"[",
"0",
"]",
",",
"las... | Normalizes nodes after applying a class to a Range. | [
"Normalizes",
"nodes",
"after",
"applying",
"a",
"class",
"to",
"a",
"Range",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/rangy-classapplier.js#L696-L751 | |
8,637 | timdown/rangy | src/modules/rangy-textrange.js | getComputedDisplay | function getComputedDisplay(el, win) {
var display = getComputedStyleProperty(el, "display", win);
var tagName = el.tagName.toLowerCase();
return (display == "block" &&
tableCssDisplayBlock &&
defaultDisplayValueForTag.hasOwnProperty(tagName)) ?
defaul... | javascript | function getComputedDisplay(el, win) {
var display = getComputedStyleProperty(el, "display", win);
var tagName = el.tagName.toLowerCase();
return (display == "block" &&
tableCssDisplayBlock &&
defaultDisplayValueForTag.hasOwnProperty(tagName)) ?
defaul... | [
"function",
"getComputedDisplay",
"(",
"el",
",",
"win",
")",
"{",
"var",
"display",
"=",
"getComputedStyleProperty",
"(",
"el",
",",
"\"display\"",
",",
"win",
")",
";",
"var",
"tagName",
"=",
"el",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
";",
"re... | Corrects IE's "block" value for table-related elements | [
"Corrects",
"IE",
"s",
"block",
"value",
"for",
"table",
"-",
"related",
"elements"
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/rangy-textrange.js#L300-L307 |
8,638 | timdown/rangy | src/modules/rangy-textrange.js | function() {
if (!this.prepopulatedChar) {
this.prepopulateChar();
}
if (this.checkForTrailingSpace) {
var trailingSpace = this.session.getNodeWrapper(this.node.childNodes[this.offset - 1]).getTrailingSpace();
log.debug("resolveLeadingA... | javascript | function() {
if (!this.prepopulatedChar) {
this.prepopulateChar();
}
if (this.checkForTrailingSpace) {
var trailingSpace = this.session.getNodeWrapper(this.node.childNodes[this.offset - 1]).getTrailingSpace();
log.debug("resolveLeadingA... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"prepopulatedChar",
")",
"{",
"this",
".",
"prepopulateChar",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"checkForTrailingSpace",
")",
"{",
"var",
"trailingSpace",
"=",
"this",
".",
"session",
".... | Resolve leading and trailing spaces, which may involve prepopulating other positions | [
"Resolve",
"leading",
"and",
"trailing",
"spaces",
"which",
"may",
"involve",
"prepopulating",
"other",
"positions"
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/rangy-textrange.js#L791-L815 | |
8,639 | timdown/rangy | src/modules/rangy-textrange.js | consumeWord | function consumeWord(forward) {
log.debug("consumeWord called, forward is " + forward);
var pos, textChar;
var newChars = [], it = forward ? forwardIterator : backwardIterator;
var passedWordBoundary = false, insideWord = false;
while ( (pos = it.next()) ) {... | javascript | function consumeWord(forward) {
log.debug("consumeWord called, forward is " + forward);
var pos, textChar;
var newChars = [], it = forward ? forwardIterator : backwardIterator;
var passedWordBoundary = false, insideWord = false;
while ( (pos = it.next()) ) {... | [
"function",
"consumeWord",
"(",
"forward",
")",
"{",
"log",
".",
"debug",
"(",
"\"consumeWord called, forward is \"",
"+",
"forward",
")",
";",
"var",
"pos",
",",
"textChar",
";",
"var",
"newChars",
"=",
"[",
"]",
",",
"it",
"=",
"forward",
"?",
"forwardIt... | Consumes a word and the whitespace beyond it | [
"Consumes",
"a",
"word",
"and",
"the",
"whitespace",
"beyond",
"it"
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/rangy-textrange.js#L1306-L1339 |
8,640 | timdown/rangy | src/modules/inactive/rangy-commands.js | isEditingHost | function isEditingHost(node) {
return node &&
((node.nodeType == 9 && node.designMode == "on") ||
(isEditableElement(node) && !isEditableElement(node.parentNode)));
} | javascript | function isEditingHost(node) {
return node &&
((node.nodeType == 9 && node.designMode == "on") ||
(isEditableElement(node) && !isEditableElement(node.parentNode)));
} | [
"function",
"isEditingHost",
"(",
"node",
")",
"{",
"return",
"node",
"&&",
"(",
"(",
"node",
".",
"nodeType",
"==",
"9",
"&&",
"node",
".",
"designMode",
"==",
"\"on\"",
")",
"||",
"(",
"isEditableElement",
"(",
"node",
")",
"&&",
"!",
"isEditableElemen... | "An editing host is a node that is either an Element whose isContentEditable property returns true but whose parent node is not an element or whose isContentEditable property returns false, or a Document whose designMode is enabled." | [
"An",
"editing",
"host",
"is",
"a",
"node",
"that",
"is",
"either",
"an",
"Element",
"whose",
"isContentEditable",
"property",
"returns",
"true",
"but",
"whose",
"parent",
"node",
"is",
"not",
"an",
"element",
"or",
"whose",
"isContentEditable",
"property",
"r... | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/rangy-commands.js#L85-L89 |
8,641 | timdown/rangy | src/modules/inactive/rangy-commands.js | isEditable | function isEditable(node, options) {
// This is slightly a lie, because we're excluding non-HTML elements with
// contentEditable attributes.
return !options || !options.applyToEditableOnly
|| ( (isEditableElement(node) || isEditableElement(node.parentNode)) && !isEditingHost(node) )... | javascript | function isEditable(node, options) {
// This is slightly a lie, because we're excluding non-HTML elements with
// contentEditable attributes.
return !options || !options.applyToEditableOnly
|| ( (isEditableElement(node) || isEditableElement(node.parentNode)) && !isEditingHost(node) )... | [
"function",
"isEditable",
"(",
"node",
",",
"options",
")",
"{",
"// This is slightly a lie, because we're excluding non-HTML elements with",
"// contentEditable attributes.",
"return",
"!",
"options",
"||",
"!",
"options",
".",
"applyToEditableOnly",
"||",
"(",
"(",
"isEdi... | "A node is editable if it is not an editing host and is or is the child of an Element whose isContentEditable property returns true." | [
"A",
"node",
"is",
"editable",
"if",
"it",
"is",
"not",
"an",
"editing",
"host",
"and",
"is",
"or",
"is",
"the",
"child",
"of",
"an",
"Element",
"whose",
"isContentEditable",
"property",
"returns",
"true",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/rangy-commands.js#L100-L105 |
8,642 | timdown/rangy | src/modules/inactive/rangy-commands.js | isEffectivelyContained | function isEffectivelyContained(node, range) {
if (isContained(node, range)) {
return true;
}
var isCharData = dom.isCharacterDataNode(node);
if (node == range.startContainer && isCharData && dom.getNodeLength(node) != range.startOffset) {
return true;
}
... | javascript | function isEffectivelyContained(node, range) {
if (isContained(node, range)) {
return true;
}
var isCharData = dom.isCharacterDataNode(node);
if (node == range.startContainer && isCharData && dom.getNodeLength(node) != range.startOffset) {
return true;
}
... | [
"function",
"isEffectivelyContained",
"(",
"node",
",",
"range",
")",
"{",
"if",
"(",
"isContained",
"(",
"node",
",",
"range",
")",
")",
"{",
"return",
"true",
";",
"}",
"var",
"isCharData",
"=",
"dom",
".",
"isCharacterDataNode",
"(",
"node",
")",
";",... | "A Node is effectively contained in a Range if either it is contained in the
Range; or it is the Range's start node, it is a Text node, and its length is
different from the Range's start offset; or it is the Range's end node, it
is a Text node, and the Range's end offset is not 0; or it has at least one
child, and all ... | [
"A",
"Node",
"is",
"effectively",
"contained",
"in",
"a",
"Range",
"if",
"either",
"it",
"is",
"contained",
"in",
"the",
"Range",
";",
"or",
"it",
"is",
"the",
"Range",
"s",
"start",
"node",
"it",
"is",
"a",
"Text",
"node",
"and",
"its",
"length",
"i... | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/rangy-commands.js#L128-L149 |
8,643 | timdown/rangy | src/modules/inactive/rangy-commands.js | isInlineNode | function isInlineNode(node) {
return dom.isCharacterDataNode(node) ||
(node.nodeType == 1 && inlineDisplayRegex.test(getComputedStyleProperty(node, "display")));
} | javascript | function isInlineNode(node) {
return dom.isCharacterDataNode(node) ||
(node.nodeType == 1 && inlineDisplayRegex.test(getComputedStyleProperty(node, "display")));
} | [
"function",
"isInlineNode",
"(",
"node",
")",
"{",
"return",
"dom",
".",
"isCharacterDataNode",
"(",
"node",
")",
"||",
"(",
"node",
".",
"nodeType",
"==",
"1",
"&&",
"inlineDisplayRegex",
".",
"test",
"(",
"getComputedStyleProperty",
"(",
"node",
",",
"\"di... | "An inline node is either a Text node, or an Element whose 'display'
property computes to 'inline', 'inline-block', or 'inline-table'." | [
"An",
"inline",
"node",
"is",
"either",
"a",
"Text",
"node",
"or",
"an",
"Element",
"whose",
"display",
"property",
"computes",
"to",
"inline",
"inline",
"-",
"block",
"or",
"inline",
"-",
"table",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/rangy-commands.js#L165-L168 |
8,644 | timdown/rangy | src/modules/inactive/rangy-commands.js | valuesEqual | function valuesEqual(command, val1, val2) {
if (val1 === null || val2 === null) {
return val1 === val2;
}
return command.valuesEqual(val1, val2);
} | javascript | function valuesEqual(command, val1, val2) {
if (val1 === null || val2 === null) {
return val1 === val2;
}
return command.valuesEqual(val1, val2);
} | [
"function",
"valuesEqual",
"(",
"command",
",",
"val1",
",",
"val2",
")",
"{",
"if",
"(",
"val1",
"===",
"null",
"||",
"val2",
"===",
"null",
")",
"{",
"return",
"val1",
"===",
"val2",
";",
"}",
"return",
"command",
".",
"valuesEqual",
"(",
"val1",
"... | This entire function is a massive hack to work around browser incompatibility. It wouldn't work in real life, but it's good enough for a test implementation. It's not clear how all this should actually be specced in practice, since CSS defines no notion of equality, does it? | [
"This",
"entire",
"function",
"is",
"a",
"massive",
"hack",
"to",
"work",
"around",
"browser",
"incompatibility",
".",
"It",
"wouldn",
"t",
"work",
"in",
"real",
"life",
"but",
"it",
"s",
"good",
"enough",
"for",
"a",
"test",
"implementation",
".",
"It",
... | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/rangy-commands.js#L701-L707 |
8,645 | timdown/rangy | src/modules/inactive/rangy-textcommands.js | function(textNodes, range) {
log.group("postApply");
var firstNode = textNodes[0], lastNode = textNodes[textNodes.length - 1];
var merges = [], currentMerge;
var rangeStartNode = firstNode, rangeEndNode = lastNode;
var rangeStartOffset = 0, rangeEndOffset = ... | javascript | function(textNodes, range) {
log.group("postApply");
var firstNode = textNodes[0], lastNode = textNodes[textNodes.length - 1];
var merges = [], currentMerge;
var rangeStartNode = firstNode, rangeEndNode = lastNode;
var rangeStartOffset = 0, rangeEndOffset = ... | [
"function",
"(",
"textNodes",
",",
"range",
")",
"{",
"log",
".",
"group",
"(",
"\"postApply\"",
")",
";",
"var",
"firstNode",
"=",
"textNodes",
"[",
"0",
"]",
",",
"lastNode",
"=",
"textNodes",
"[",
"textNodes",
".",
"length",
"-",
"1",
"]",
";",
"v... | Normalizes nodes after applying a CSS class to a Range. | [
"Normalizes",
"nodes",
"after",
"applying",
"a",
"CSS",
"class",
"to",
"a",
"Range",
"."
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/rangy-textcommands.js#L238-L296 | |
8,646 | timdown/rangy | src/modules/inactive/rangy-position.js | getScrollPosition | function getScrollPosition(win) {
var x = 0, y = 0;
if (typeof win.pageXOffset == NUMBER && typeof win.pageYOffset == NUMBER) {
x = win.pageXOffset;
y = win.pageYOffset;
} else {
var doc = win.document;
var docEl = doc.documentElement;
... | javascript | function getScrollPosition(win) {
var x = 0, y = 0;
if (typeof win.pageXOffset == NUMBER && typeof win.pageYOffset == NUMBER) {
x = win.pageXOffset;
y = win.pageYOffset;
} else {
var doc = win.document;
var docEl = doc.documentElement;
... | [
"function",
"getScrollPosition",
"(",
"win",
")",
"{",
"var",
"x",
"=",
"0",
",",
"y",
"=",
"0",
";",
"if",
"(",
"typeof",
"win",
".",
"pageXOffset",
"==",
"NUMBER",
"&&",
"typeof",
"win",
".",
"pageYOffset",
"==",
"NUMBER",
")",
"{",
"x",
"=",
"wi... | Since Rangy can deal with multiple documents which could be in different modes, we have to do the checks every time, unless we cache a getScrollPosition function in each document. This would necessarily pollute the document's global namespace, which I'm choosing to view as a greater evil than a slight performance hit. | [
"Since",
"Rangy",
"can",
"deal",
"with",
"multiple",
"documents",
"which",
"could",
"be",
"in",
"different",
"modes",
"we",
"have",
"to",
"do",
"the",
"checks",
"every",
"time",
"unless",
"we",
"cache",
"a",
"getScrollPosition",
"function",
"in",
"each",
"do... | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/rangy-position.js#L30-L50 |
8,647 | timdown/rangy | src/modules/inactive/rangy-position.js | function(el) {
var x = 0, y = 0, offsetEl = el, width = el.offsetWidth, height = el.offsetHeight;
while (offsetEl) {
x += offsetEl.offsetLeft;
y += offsetEl.offsetTop;
offsetEl = offsetEl.offsetParent;
... | javascript | function(el) {
var x = 0, y = 0, offsetEl = el, width = el.offsetWidth, height = el.offsetHeight;
while (offsetEl) {
x += offsetEl.offsetLeft;
y += offsetEl.offsetTop;
offsetEl = offsetEl.offsetParent;
... | [
"function",
"(",
"el",
")",
"{",
"var",
"x",
"=",
"0",
",",
"y",
"=",
"0",
",",
"offsetEl",
"=",
"el",
",",
"width",
"=",
"el",
".",
"offsetWidth",
",",
"height",
"=",
"el",
".",
"offsetHeight",
";",
"while",
"(",
"offsetEl",
")",
"{",
"x",
"+=... | This implementation is very naive. There are many browser quirks that make it extremely difficult to get accurate element coordinates in all situations | [
"This",
"implementation",
"is",
"very",
"naive",
".",
"There",
"are",
"many",
"browser",
"quirks",
"that",
"make",
"it",
"extremely",
"difficult",
"to",
"get",
"accurate",
"element",
"coordinates",
"in",
"all",
"situations"
] | 1e55169d2e4d1d9458c2a87119addf47a8265276 | https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/inactive/rangy-position.js#L400-L409 | |
8,648 | artilleryio/artillery | core/lib/engine_util.js | templateObjectOrArray | function templateObjectOrArray(o, context) {
deepForEach(o, (value, key, subj, path) => {
const newPath = template(path, context, true);
let newValue;
if (value && (value.constructor !== Object && value.constructor !== Array)) {
newValue = template(value, context, true);
} else {
newValue... | javascript | function templateObjectOrArray(o, context) {
deepForEach(o, (value, key, subj, path) => {
const newPath = template(path, context, true);
let newValue;
if (value && (value.constructor !== Object && value.constructor !== Array)) {
newValue = template(value, context, true);
} else {
newValue... | [
"function",
"templateObjectOrArray",
"(",
"o",
",",
"context",
")",
"{",
"deepForEach",
"(",
"o",
",",
"(",
"value",
",",
"key",
",",
"subj",
",",
"path",
")",
"=>",
"{",
"const",
"newPath",
"=",
"template",
"(",
"path",
",",
"context",
",",
"true",
... | Mutates the object in place | [
"Mutates",
"the",
"object",
"in",
"place"
] | e8023099e7b05a712dba6d627ce5ea221f75d142 | https://github.com/artilleryio/artillery/blob/e8023099e7b05a712dba6d627ce5ea221f75d142/core/lib/engine_util.js#L240-L262 |
8,649 | artilleryio/artillery | core/lib/engine_util.js | extractJSONPath | function extractJSONPath(doc, expr) {
// typeof null is 'object' hence the explicit check here
if (typeof doc !== 'object' || doc === null) {
return '';
}
let results;
try {
results = jsonpath.query(doc, expr);
} catch (queryErr) {
debug(queryErr);
}
if (!results) {
return '';
}
... | javascript | function extractJSONPath(doc, expr) {
// typeof null is 'object' hence the explicit check here
if (typeof doc !== 'object' || doc === null) {
return '';
}
let results;
try {
results = jsonpath.query(doc, expr);
} catch (queryErr) {
debug(queryErr);
}
if (!results) {
return '';
}
... | [
"function",
"extractJSONPath",
"(",
"doc",
",",
"expr",
")",
"{",
"// typeof null is 'object' hence the explicit check here",
"if",
"(",
"typeof",
"doc",
"!==",
"'object'",
"||",
"doc",
"===",
"null",
")",
"{",
"return",
"''",
";",
"}",
"let",
"results",
";",
... | doc is a JSON object | [
"doc",
"is",
"a",
"JSON",
"object"
] | e8023099e7b05a712dba6d627ce5ea221f75d142 | https://github.com/artilleryio/artillery/blob/e8023099e7b05a712dba6d627ce5ea221f75d142/core/lib/engine_util.js#L499-L522 |
8,650 | artilleryio/artillery | lib/dist.js | divideWork | function divideWork(script, numWorkers) {
let newPhases = [];
for (let i = 0; i < numWorkers; i++) {
newPhases.push(L.cloneDeep(script.config.phases));
}
//
// Adjust phase definitions:
//
L.each(script.config.phases, function(phase, phaseSpecIndex) {
if (phase.arrivalRate && phase.rampTo) {
... | javascript | function divideWork(script, numWorkers) {
let newPhases = [];
for (let i = 0; i < numWorkers; i++) {
newPhases.push(L.cloneDeep(script.config.phases));
}
//
// Adjust phase definitions:
//
L.each(script.config.phases, function(phase, phaseSpecIndex) {
if (phase.arrivalRate && phase.rampTo) {
... | [
"function",
"divideWork",
"(",
"script",
",",
"numWorkers",
")",
"{",
"let",
"newPhases",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"numWorkers",
";",
"i",
"++",
")",
"{",
"newPhases",
".",
"push",
"(",
"L",
".",
"clone... | Create a number of scripts for workers from the script given to use by user. | [
"Create",
"a",
"number",
"of",
"scripts",
"for",
"workers",
"from",
"the",
"script",
"given",
"to",
"use",
"by",
"user",
"."
] | e8023099e7b05a712dba6d627ce5ea221f75d142 | https://github.com/artilleryio/artillery/blob/e8023099e7b05a712dba6d627ce5ea221f75d142/lib/dist.js#L15-L82 |
8,651 | artilleryio/artillery | lib/dist.js | distribute | function distribute(m, n) {
m = Number(m);
n = Number(n);
let result = [];
if (m < n) {
for (let i = 0; i < n; i++) {
result.push(i < m ? 1 : 0);
}
} else {
let baseCount = Math.floor(m / n);
let extraItems = m % n;
for(let i = 0; i < n; i++) {
result.push(baseCount);
i... | javascript | function distribute(m, n) {
m = Number(m);
n = Number(n);
let result = [];
if (m < n) {
for (let i = 0; i < n; i++) {
result.push(i < m ? 1 : 0);
}
} else {
let baseCount = Math.floor(m / n);
let extraItems = m % n;
for(let i = 0; i < n; i++) {
result.push(baseCount);
i... | [
"function",
"distribute",
"(",
"m",
",",
"n",
")",
"{",
"m",
"=",
"Number",
"(",
"m",
")",
";",
"n",
"=",
"Number",
"(",
"n",
")",
";",
"let",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"m",
"<",
"n",
")",
"{",
"for",
"(",
"let",
"i",
"=",
... | Given M "things", distribute them between N peers as equally as possible | [
"Given",
"M",
"things",
"distribute",
"them",
"between",
"N",
"peers",
"as",
"equally",
"as",
"possible"
] | e8023099e7b05a712dba6d627ce5ea221f75d142 | https://github.com/artilleryio/artillery/blob/e8023099e7b05a712dba6d627ce5ea221f75d142/lib/dist.js#L88-L111 |
8,652 | artilleryio/artillery | core/lib/weighted-pick.js | create | function create(list) {
let dist = l.reduce(list, function(acc, el, i) {
for(let j = 0; j < el.weight * 100; j++) {
acc.push(i);
}
return acc;
}, []);
return function() {
let i = dist[l.random(0, dist.length - 1)];
return [i, list[i]];
};
} | javascript | function create(list) {
let dist = l.reduce(list, function(acc, el, i) {
for(let j = 0; j < el.weight * 100; j++) {
acc.push(i);
}
return acc;
}, []);
return function() {
let i = dist[l.random(0, dist.length - 1)];
return [i, list[i]];
};
} | [
"function",
"create",
"(",
"list",
")",
"{",
"let",
"dist",
"=",
"l",
".",
"reduce",
"(",
"list",
",",
"function",
"(",
"acc",
",",
"el",
",",
"i",
")",
"{",
"for",
"(",
"let",
"j",
"=",
"0",
";",
"j",
"<",
"el",
".",
"weight",
"*",
"100",
... | naive implementation of selection with replacement | [
"naive",
"implementation",
"of",
"selection",
"with",
"replacement"
] | e8023099e7b05a712dba6d627ce5ea221f75d142 | https://github.com/artilleryio/artillery/blob/e8023099e7b05a712dba6d627ce5ea221f75d142/core/lib/weighted-pick.js#L12-L24 |
8,653 | artilleryio/artillery | core/lib/runner.js | createContext | function createContext(script) {
const INITIAL_CONTEXT = {
vars: {
target: script.config.target,
$environment: script._environment,
$processEnvironment: process.env
},
funcs: {
$randomNumber: $randomNumber,
$randomString: $randomString,
$template: input => engineUtil.te... | javascript | function createContext(script) {
const INITIAL_CONTEXT = {
vars: {
target: script.config.target,
$environment: script._environment,
$processEnvironment: process.env
},
funcs: {
$randomNumber: $randomNumber,
$randomString: $randomString,
$template: input => engineUtil.te... | [
"function",
"createContext",
"(",
"script",
")",
"{",
"const",
"INITIAL_CONTEXT",
"=",
"{",
"vars",
":",
"{",
"target",
":",
"script",
".",
"config",
".",
"target",
",",
"$environment",
":",
"script",
".",
"_environment",
",",
"$processEnvironment",
":",
"pr... | Create initial context for a scenario. | [
"Create",
"initial",
"context",
"for",
"a",
"scenario",
"."
] | e8023099e7b05a712dba6d627ce5ea221f75d142 | https://github.com/artilleryio/artillery/blob/e8023099e7b05a712dba6d627ce5ea221f75d142/core/lib/runner.js#L450-L476 |
8,654 | artilleryio/artillery | core/lib/stats2.js | combine | function combine(statsObjects) {
let result = create();
L.each(statsObjects, function(stats) {
L.each(stats._latencies, function(latency) {
result._latencies.push(latency);
});
result._generatedScenarios += stats._generatedScenarios;
L.each(stats._scenarioCounter, function(count, name) {
... | javascript | function combine(statsObjects) {
let result = create();
L.each(statsObjects, function(stats) {
L.each(stats._latencies, function(latency) {
result._latencies.push(latency);
});
result._generatedScenarios += stats._generatedScenarios;
L.each(stats._scenarioCounter, function(count, name) {
... | [
"function",
"combine",
"(",
"statsObjects",
")",
"{",
"let",
"result",
"=",
"create",
"(",
")",
";",
"L",
".",
"each",
"(",
"statsObjects",
",",
"function",
"(",
"stats",
")",
"{",
"L",
".",
"each",
"(",
"stats",
".",
"_latencies",
",",
"function",
"... | Combine several stats objects from different workers into one | [
"Combine",
"several",
"stats",
"objects",
"from",
"different",
"workers",
"into",
"one"
] | e8023099e7b05a712dba6d627ce5ea221f75d142 | https://github.com/artilleryio/artillery/blob/e8023099e7b05a712dba6d627ce5ea221f75d142/core/lib/stats2.js#L26-L86 |
8,655 | artilleryio/artillery | core/lib/engine_http.js | ensurePropertyIsAList | function ensurePropertyIsAList(obj, prop) {
obj[prop] = [].concat(
typeof obj[prop] === 'undefined' ?
[] : obj[prop]);
return obj;
} | javascript | function ensurePropertyIsAList(obj, prop) {
obj[prop] = [].concat(
typeof obj[prop] === 'undefined' ?
[] : obj[prop]);
return obj;
} | [
"function",
"ensurePropertyIsAList",
"(",
"obj",
",",
"prop",
")",
"{",
"obj",
"[",
"prop",
"]",
"=",
"[",
"]",
".",
"concat",
"(",
"typeof",
"obj",
"[",
"prop",
"]",
"===",
"'undefined'",
"?",
"[",
"]",
":",
"obj",
"[",
"prop",
"]",
")",
";",
"r... | Helper function to wrap an object's property in a list if it's defined, or set it to an empty list if not. | [
"Helper",
"function",
"to",
"wrap",
"an",
"object",
"s",
"property",
"in",
"a",
"list",
"if",
"it",
"s",
"defined",
"or",
"set",
"it",
"to",
"an",
"empty",
"list",
"if",
"not",
"."
] | e8023099e7b05a712dba6d627ce5ea221f75d142 | https://github.com/artilleryio/artillery/blob/e8023099e7b05a712dba6d627ce5ea221f75d142/core/lib/engine_http.js#L57-L62 |
8,656 | apache/cordova-node-xcode | lib/pbxProject.js | propReplace | function propReplace(obj, prop, value) {
var o = {};
for (var p in obj) {
if (o.hasOwnProperty.call(obj, p)) {
if (typeof obj[p] == 'object' && !Array.isArray(obj[p])) {
propReplace(obj[p], prop, value);
} else if (p == prop) {
obj[p] = value;
... | javascript | function propReplace(obj, prop, value) {
var o = {};
for (var p in obj) {
if (o.hasOwnProperty.call(obj, p)) {
if (typeof obj[p] == 'object' && !Array.isArray(obj[p])) {
propReplace(obj[p], prop, value);
} else if (p == prop) {
obj[p] = value;
... | [
"function",
"propReplace",
"(",
"obj",
",",
"prop",
",",
"value",
")",
"{",
"var",
"o",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"p",
"in",
"obj",
")",
"{",
"if",
"(",
"o",
".",
"hasOwnProperty",
".",
"call",
"(",
"obj",
",",
"p",
")",
")",
"{"... | helper recursive prop search+replace | [
"helper",
"recursive",
"prop",
"search",
"+",
"replace"
] | a65e1943ed8c71d93e4c673d0a7aabf4ebca7623 | https://github.com/apache/cordova-node-xcode/blob/a65e1943ed8c71d93e4c673d0a7aabf4ebca7623/lib/pbxProject.js#L1495-L1506 |
8,657 | apache/cordova-node-xcode | lib/pbxProject.js | pbxBuildFileObj | function pbxBuildFileObj(file) {
var obj = Object.create(null);
obj.isa = 'PBXBuildFile';
obj.fileRef = file.fileRef;
obj.fileRef_comment = file.basename;
if (file.settings) obj.settings = file.settings;
return obj;
} | javascript | function pbxBuildFileObj(file) {
var obj = Object.create(null);
obj.isa = 'PBXBuildFile';
obj.fileRef = file.fileRef;
obj.fileRef_comment = file.basename;
if (file.settings) obj.settings = file.settings;
return obj;
} | [
"function",
"pbxBuildFileObj",
"(",
"file",
")",
"{",
"var",
"obj",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"obj",
".",
"isa",
"=",
"'PBXBuildFile'",
";",
"obj",
".",
"fileRef",
"=",
"file",
".",
"fileRef",
";",
"obj",
".",
"fileRef_commen... | helper object creation functions | [
"helper",
"object",
"creation",
"functions"
] | a65e1943ed8c71d93e4c673d0a7aabf4ebca7623 | https://github.com/apache/cordova-node-xcode/blob/a65e1943ed8c71d93e4c673d0a7aabf4ebca7623/lib/pbxProject.js#L1509-L1518 |
8,658 | johnculviner/jquery.fileDownload | src/Scripts/jquery.fileDownload.js | getiframeDocument | function getiframeDocument($iframe) {
var iframeDoc = $iframe[0].contentWindow || $iframe[0].contentDocument;
if (iframeDoc.document) {
iframeDoc = iframeDoc.document;
}
return iframeDoc;
} | javascript | function getiframeDocument($iframe) {
var iframeDoc = $iframe[0].contentWindow || $iframe[0].contentDocument;
if (iframeDoc.document) {
iframeDoc = iframeDoc.document;
}
return iframeDoc;
} | [
"function",
"getiframeDocument",
"(",
"$iframe",
")",
"{",
"var",
"iframeDoc",
"=",
"$iframe",
"[",
"0",
"]",
".",
"contentWindow",
"||",
"$iframe",
"[",
"0",
"]",
".",
"contentDocument",
";",
"if",
"(",
"iframeDoc",
".",
"document",
")",
"{",
"iframeDoc",... | gets an iframes document in a cross browser compatible manner | [
"gets",
"an",
"iframes",
"document",
"in",
"a",
"cross",
"browser",
"compatible",
"manner"
] | 67859ca512d8ab35a44b2ff26473e18350172fac | https://github.com/johnculviner/jquery.fileDownload/blob/67859ca512d8ab35a44b2ff26473e18350172fac/src/Scripts/jquery.fileDownload.js#L437-L443 |
8,659 | skanaar/nomnoml | src/renderer.js | quadrant | function quadrant(point, node, fallback) {
if (point.x < node.x && point.y < node.y) return 1;
if (point.x > node.x && point.y < node.y) return 2;
if (point.x > node.x && point.y > node.y) return 3;
if (point.x < node.x && point.y > node.y) return 4;
return fallback;
} | javascript | function quadrant(point, node, fallback) {
if (point.x < node.x && point.y < node.y) return 1;
if (point.x > node.x && point.y < node.y) return 2;
if (point.x > node.x && point.y > node.y) return 3;
if (point.x < node.x && point.y > node.y) return 4;
return fallback;
} | [
"function",
"quadrant",
"(",
"point",
",",
"node",
",",
"fallback",
")",
"{",
"if",
"(",
"point",
".",
"x",
"<",
"node",
".",
"x",
"&&",
"point",
".",
"y",
"<",
"node",
".",
"y",
")",
"return",
"1",
";",
"if",
"(",
"point",
".",
"x",
">",
"no... | find basic quadrant using relative position of endpoint and block rectangle | [
"find",
"basic",
"quadrant",
"using",
"relative",
"position",
"of",
"endpoint",
"and",
"block",
"rectangle"
] | 188b359e9cd3cc56b9a7b3d4e897bf1191b9910c | https://github.com/skanaar/nomnoml/blob/188b359e9cd3cc56b9a7b3d4e897bf1191b9910c/src/renderer.js#L108-L114 |
8,660 | skanaar/nomnoml | src/renderer.js | adjustQuadrant | function adjustQuadrant(quadrant, point, opposite) {
if ((opposite.x == point.x) || (opposite.y == point.y)) return quadrant;
var flipHorizontally = [4, 3, 2, 1]
var flipVertically = [2, 1, 4, 3]
var oppositeQuadrant = (opposite.y < point.y) ?
((opposite.x < point.x) ? 2 : 1) :
((opposite.x < poin... | javascript | function adjustQuadrant(quadrant, point, opposite) {
if ((opposite.x == point.x) || (opposite.y == point.y)) return quadrant;
var flipHorizontally = [4, 3, 2, 1]
var flipVertically = [2, 1, 4, 3]
var oppositeQuadrant = (opposite.y < point.y) ?
((opposite.x < point.x) ? 2 : 1) :
((opposite.x < poin... | [
"function",
"adjustQuadrant",
"(",
"quadrant",
",",
"point",
",",
"opposite",
")",
"{",
"if",
"(",
"(",
"opposite",
".",
"x",
"==",
"point",
".",
"x",
")",
"||",
"(",
"opposite",
".",
"y",
"==",
"point",
".",
"y",
")",
")",
"return",
"quadrant",
";... | Flip basic label quadrant if needed, to avoid crossing a bent relationship line | [
"Flip",
"basic",
"label",
"quadrant",
"if",
"needed",
"to",
"avoid",
"crossing",
"a",
"bent",
"relationship",
"line"
] | 188b359e9cd3cc56b9a7b3d4e897bf1191b9910c | https://github.com/skanaar/nomnoml/blob/188b359e9cd3cc56b9a7b3d4e897bf1191b9910c/src/renderer.js#L117-L130 |
8,661 | jscottsmith/react-scroll-parallax | src/classes/ParallaxController.js | _updateAllElements | function _updateAllElements({ updateCache } = {}) {
elements.forEach(element => {
_updateElementPosition(element);
if (updateCache) {
element.setCachedAttributes(view, scroll);
}
});
// reset ticking so more animations can be called
tic... | javascript | function _updateAllElements({ updateCache } = {}) {
elements.forEach(element => {
_updateElementPosition(element);
if (updateCache) {
element.setCachedAttributes(view, scroll);
}
});
// reset ticking so more animations can be called
tic... | [
"function",
"_updateAllElements",
"(",
"{",
"updateCache",
"}",
"=",
"{",
"}",
")",
"{",
"elements",
".",
"forEach",
"(",
"element",
"=>",
"{",
"_updateElementPosition",
"(",
"element",
")",
";",
"if",
"(",
"updateCache",
")",
"{",
"element",
".",
"setCach... | Update element positions.
Determines if the element is in view based on the cached
attributes, if so set the elements parallax styles. | [
"Update",
"element",
"positions",
".",
"Determines",
"if",
"the",
"element",
"is",
"in",
"view",
"based",
"on",
"the",
"cached",
"attributes",
"if",
"so",
"set",
"the",
"elements",
"parallax",
"styles",
"."
] | 6404cf1cef94734bf1bc179e951d7d1dafc4d309 | https://github.com/jscottsmith/react-scroll-parallax/blob/6404cf1cef94734bf1bc179e951d7d1dafc4d309/src/classes/ParallaxController.js#L93-L102 |
8,662 | jscottsmith/react-scroll-parallax | src/classes/ParallaxController.js | _setViewSize | function _setViewSize() {
if (hasScrollContainer) {
const width = viewEl.offsetWidth;
const height = viewEl.offsetHeight;
return view.setSize(width, height);
}
const html = document.documentElement;
const width = window.innerWidth || html.clientWidth;... | javascript | function _setViewSize() {
if (hasScrollContainer) {
const width = viewEl.offsetWidth;
const height = viewEl.offsetHeight;
return view.setSize(width, height);
}
const html = document.documentElement;
const width = window.innerWidth || html.clientWidth;... | [
"function",
"_setViewSize",
"(",
")",
"{",
"if",
"(",
"hasScrollContainer",
")",
"{",
"const",
"width",
"=",
"viewEl",
".",
"offsetWidth",
";",
"const",
"height",
"=",
"viewEl",
".",
"offsetHeight",
";",
"return",
"view",
".",
"setSize",
"(",
"width",
",",... | Cache the window height. | [
"Cache",
"the",
"window",
"height",
"."
] | 6404cf1cef94734bf1bc179e951d7d1dafc4d309 | https://github.com/jscottsmith/react-scroll-parallax/blob/6404cf1cef94734bf1bc179e951d7d1dafc4d309/src/classes/ParallaxController.js#L117-L129 |
8,663 | nx-js/observer-util | src/handlers.js | get | function get (target, key, receiver) {
const result = Reflect.get(target, key, receiver)
// do not register (observable.prop -> reaction) pairs for well known symbols
// these symbols are frequently retrieved in low level JavaScript under the hood
if (typeof key === 'symbol' && wellKnownSymbols.has(key)) {
... | javascript | function get (target, key, receiver) {
const result = Reflect.get(target, key, receiver)
// do not register (observable.prop -> reaction) pairs for well known symbols
// these symbols are frequently retrieved in low level JavaScript under the hood
if (typeof key === 'symbol' && wellKnownSymbols.has(key)) {
... | [
"function",
"get",
"(",
"target",
",",
"key",
",",
"receiver",
")",
"{",
"const",
"result",
"=",
"Reflect",
".",
"get",
"(",
"target",
",",
"key",
",",
"receiver",
")",
"// do not register (observable.prop -> reaction) pairs for well known symbols",
"// these symbols ... | intercept get operations on observables to know which reaction uses their properties | [
"intercept",
"get",
"operations",
"on",
"observables",
"to",
"know",
"which",
"reaction",
"uses",
"their",
"properties"
] | 62aebe1bb8c92572a1dbbd236600f20cba0f6ae9 | https://github.com/nx-js/observer-util/blob/62aebe1bb8c92572a1dbbd236600f20cba0f6ae9/src/handlers.js#L17-L45 |
8,664 | nx-js/observer-util | src/handlers.js | set | function set (target, key, value, receiver) {
// make sure to do not pollute the raw object with observables
if (typeof value === 'object' && value !== null) {
value = proxyToRaw.get(value) || value
}
// save if the object had a descriptor for this key
const hadKey = hasOwnProperty.call(target, key)
// ... | javascript | function set (target, key, value, receiver) {
// make sure to do not pollute the raw object with observables
if (typeof value === 'object' && value !== null) {
value = proxyToRaw.get(value) || value
}
// save if the object had a descriptor for this key
const hadKey = hasOwnProperty.call(target, key)
// ... | [
"function",
"set",
"(",
"target",
",",
"key",
",",
"value",
",",
"receiver",
")",
"{",
"// make sure to do not pollute the raw object with observables",
"if",
"(",
"typeof",
"value",
"===",
"'object'",
"&&",
"value",
"!==",
"null",
")",
"{",
"value",
"=",
"proxy... | intercept set operations on observables to know when to trigger reactions | [
"intercept",
"set",
"operations",
"on",
"observables",
"to",
"know",
"when",
"to",
"trigger",
"reactions"
] | 62aebe1bb8c92572a1dbbd236600f20cba0f6ae9 | https://github.com/nx-js/observer-util/blob/62aebe1bb8c92572a1dbbd236600f20cba0f6ae9/src/handlers.js#L60-L90 |
8,665 | s-yadav/react-number-format | lib/utils.js | splitDecimal | function splitDecimal(numStr) {
var allowNegative = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var hasNagation = numStr[0] === '-';
var addNegation = hasNagation && allowNegative;
numStr = numStr.replace('-', '');
var parts = numStr.split('.');
var beforeDecimal = parts[0];
... | javascript | function splitDecimal(numStr) {
var allowNegative = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var hasNagation = numStr[0] === '-';
var addNegation = hasNagation && allowNegative;
numStr = numStr.replace('-', '');
var parts = numStr.split('.');
var beforeDecimal = parts[0];
... | [
"function",
"splitDecimal",
"(",
"numStr",
")",
"{",
"var",
"allowNegative",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"true",
";",
"var",
"hasNagation",
"=",
... | spilt a float number into different parts beforeDecimal, afterDecimal, and negation | [
"spilt",
"a",
"float",
"number",
"into",
"different",
"parts",
"beforeDecimal",
"afterDecimal",
"and",
"negation"
] | 6a1113ff90ba69e479ec2b9902799f1ab2e69082 | https://github.com/s-yadav/react-number-format/blob/6a1113ff90ba69e479ec2b9902799f1ab2e69082/lib/utils.js#L58-L72 |
8,666 | s-yadav/react-number-format | lib/utils.js | limitToScale | function limitToScale(numStr, scale, fixedDecimalScale) {
var str = '';
var filler = fixedDecimalScale ? '0' : '';
for (var i = 0; i <= scale - 1; i++) {
str += numStr[i] || filler;
}
return str;
} | javascript | function limitToScale(numStr, scale, fixedDecimalScale) {
var str = '';
var filler = fixedDecimalScale ? '0' : '';
for (var i = 0; i <= scale - 1; i++) {
str += numStr[i] || filler;
}
return str;
} | [
"function",
"limitToScale",
"(",
"numStr",
",",
"scale",
",",
"fixedDecimalScale",
")",
"{",
"var",
"str",
"=",
"''",
";",
"var",
"filler",
"=",
"fixedDecimalScale",
"?",
"'0'",
":",
"''",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<=",
"scale... | limit decimal numbers to given scale
Not used .fixedTo because that will break with big numbers | [
"limit",
"decimal",
"numbers",
"to",
"given",
"scale",
"Not",
"used",
".",
"fixedTo",
"because",
"that",
"will",
"break",
"with",
"big",
"numbers"
] | 6a1113ff90ba69e479ec2b9902799f1ab2e69082 | https://github.com/s-yadav/react-number-format/blob/6a1113ff90ba69e479ec2b9902799f1ab2e69082/lib/utils.js#L89-L98 |
8,667 | s-yadav/react-number-format | lib/utils.js | roundToPrecision | function roundToPrecision(numStr, scale, fixedDecimalScale) {
//if number is empty don't do anything return empty string
if (['', '-'].indexOf(numStr) !== -1) return numStr;
var shoudHaveDecimalSeparator = numStr.indexOf('.') !== -1 && scale;
var _splitDecimal = splitDecimal(numStr),
beforeDecimal = _spl... | javascript | function roundToPrecision(numStr, scale, fixedDecimalScale) {
//if number is empty don't do anything return empty string
if (['', '-'].indexOf(numStr) !== -1) return numStr;
var shoudHaveDecimalSeparator = numStr.indexOf('.') !== -1 && scale;
var _splitDecimal = splitDecimal(numStr),
beforeDecimal = _spl... | [
"function",
"roundToPrecision",
"(",
"numStr",
",",
"scale",
",",
"fixedDecimalScale",
")",
"{",
"//if number is empty don't do anything return empty string",
"if",
"(",
"[",
"''",
",",
"'-'",
"]",
".",
"indexOf",
"(",
"numStr",
")",
"!==",
"-",
"1",
")",
"retur... | This method is required to round prop value to given scale.
Not used .round or .fixedTo because that will break with big numbers | [
"This",
"method",
"is",
"required",
"to",
"round",
"prop",
"value",
"to",
"given",
"scale",
".",
"Not",
"used",
".",
"round",
"or",
".",
"fixedTo",
"because",
"that",
"will",
"break",
"with",
"big",
"numbers"
] | 6a1113ff90ba69e479ec2b9902799f1ab2e69082 | https://github.com/s-yadav/react-number-format/blob/6a1113ff90ba69e479ec2b9902799f1ab2e69082/lib/utils.js#L105-L127 |
8,668 | s-yadav/react-number-format | lib/utils.js | findChangedIndex | function findChangedIndex(prevValue, newValue) {
var i = 0,
j = 0;
var prevLength = prevValue.length;
var newLength = newValue.length;
while (prevValue[i] === newValue[i] && i < prevLength) {
i++;
} //check what has been changed from last
while (prevValue[prevLength - 1 - j] === newValue[newLen... | javascript | function findChangedIndex(prevValue, newValue) {
var i = 0,
j = 0;
var prevLength = prevValue.length;
var newLength = newValue.length;
while (prevValue[i] === newValue[i] && i < prevLength) {
i++;
} //check what has been changed from last
while (prevValue[prevLength - 1 - j] === newValue[newLen... | [
"function",
"findChangedIndex",
"(",
"prevValue",
",",
"newValue",
")",
"{",
"var",
"i",
"=",
"0",
",",
"j",
"=",
"0",
";",
"var",
"prevLength",
"=",
"prevValue",
".",
"length",
";",
"var",
"newLength",
"=",
"newValue",
".",
"length",
";",
"while",
"("... | Given previous value and newValue it returns the index
start - end to which values have changed.
This function makes assumption about only consecutive
characters are changed which is correct assumption for caret input. | [
"Given",
"previous",
"value",
"and",
"newValue",
"it",
"returns",
"the",
"index",
"start",
"-",
"end",
"to",
"which",
"values",
"have",
"changed",
".",
"This",
"function",
"makes",
"assumption",
"about",
"only",
"consecutive",
"characters",
"are",
"changed",
"... | 6a1113ff90ba69e479ec2b9902799f1ab2e69082 | https://github.com/s-yadav/react-number-format/blob/6a1113ff90ba69e479ec2b9902799f1ab2e69082/lib/utils.js#L172-L191 |
8,669 | s-yadav/react-number-format | custom_formatters/card_expiry.js | limit | function limit(val, max) {
if (val.length === 1 && val[0] > max[0]) {
val = '0' + val;
}
if (val.length === 2) {
if (Number(val) === 0) {
val = '01';
//this can happen when user paste number
} else if (val > max) {
val = max;
}
}
return val;
} | javascript | function limit(val, max) {
if (val.length === 1 && val[0] > max[0]) {
val = '0' + val;
}
if (val.length === 2) {
if (Number(val) === 0) {
val = '01';
//this can happen when user paste number
} else if (val > max) {
val = max;
}
}
return val;
} | [
"function",
"limit",
"(",
"val",
",",
"max",
")",
"{",
"if",
"(",
"val",
".",
"length",
"===",
"1",
"&&",
"val",
"[",
"0",
"]",
">",
"max",
"[",
"0",
"]",
")",
"{",
"val",
"=",
"'0'",
"+",
"val",
";",
"}",
"if",
"(",
"val",
".",
"length",
... | This method limit val between 1 to max
val and max both are passed as string | [
"This",
"method",
"limit",
"val",
"between",
"1",
"to",
"max",
"val",
"and",
"max",
"both",
"are",
"passed",
"as",
"string"
] | 6a1113ff90ba69e479ec2b9902799f1ab2e69082 | https://github.com/s-yadav/react-number-format/blob/6a1113ff90ba69e479ec2b9902799f1ab2e69082/custom_formatters/card_expiry.js#L5-L21 |
8,670 | wework/speccy | lib/loader.js | readSpecFile | function readSpecFile(file, options) {
if (options.verbose > 1) {
file ? console.error('GET ' + file) : console.error('GET <stdin>');
}
if (!file) {
// standard input
return readFileStdinAsync();
} else if (file && file.startsWith('http')) {
// remote file
return ... | javascript | function readSpecFile(file, options) {
if (options.verbose > 1) {
file ? console.error('GET ' + file) : console.error('GET <stdin>');
}
if (!file) {
// standard input
return readFileStdinAsync();
} else if (file && file.startsWith('http')) {
// remote file
return ... | [
"function",
"readSpecFile",
"(",
"file",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"verbose",
">",
"1",
")",
"{",
"file",
"?",
"console",
".",
"error",
"(",
"'GET '",
"+",
"file",
")",
":",
"console",
".",
"error",
"(",
"'GET <stdin>'",
")... | file can be null, meaning stdin | [
"file",
"can",
"be",
"null",
"meaning",
"stdin"
] | 740d19d88935db7735250c16abc2ad09256b5854 | https://github.com/wework/speccy/blob/740d19d88935db7735250c16abc2ad09256b5854/lib/loader.js#L65-L85 |
8,671 | stdlib-js/stdlib | etc/typedoc/theme/assets/js/theme.js | cleanPath | function cleanPath( txt ) {
var ch;
var j;
if ( txt.charCodeAt( 0 ) === 34 ) {
j = 1;
for ( j = 1; j < txt.length; j++ ) {
ch = txt.charCodeAt( j );
if ( ch === 34 ) {
txt = txt.slice( 1, j );
break;
}
}
}
j = txt.indexOf( '/docs/types/' );
if ( j >= 0 ) {
txt = txt.slice( ... | javascript | function cleanPath( txt ) {
var ch;
var j;
if ( txt.charCodeAt( 0 ) === 34 ) {
j = 1;
for ( j = 1; j < txt.length; j++ ) {
ch = txt.charCodeAt( j );
if ( ch === 34 ) {
txt = txt.slice( 1, j );
break;
}
}
}
j = txt.indexOf( '/docs/types/' );
if ( j >= 0 ) {
txt = txt.slice( ... | [
"function",
"cleanPath",
"(",
"txt",
")",
"{",
"var",
"ch",
";",
"var",
"j",
";",
"if",
"(",
"txt",
".",
"charCodeAt",
"(",
"0",
")",
"===",
"34",
")",
"{",
"j",
"=",
"1",
";",
"for",
"(",
"j",
"=",
"1",
";",
"j",
"<",
"txt",
".",
"length",... | eslint-disable-line func-names, no-restricted-syntax
Removes extraneous information from a path.
@private
@param {string} txt - text 1
@returns {string} cleaned text | [
"eslint",
"-",
"disable",
"-",
"line",
"func",
"-",
"names",
"no",
"-",
"restricted",
"-",
"syntax",
"Removes",
"extraneous",
"information",
"from",
"a",
"path",
"."
] | 1026b15f47f0b4d2c0db8617f22a35873c514919 | https://github.com/stdlib-js/stdlib/blob/1026b15f47f0b4d2c0db8617f22a35873c514919/etc/typedoc/theme/assets/js/theme.js#L29-L52 |
8,672 | stdlib-js/stdlib | etc/typedoc/theme/assets/js/theme.js | cleanTitle | function cleanTitle( el ) {
var txt = cleanPath( el.innerHTML );
var idx = txt.indexOf( 'stdlib' );
if ( idx === -1 || idx === 1 ) { // e.g., '@stdlib/types/iter'
txt = 'stdlib | ' + txt;
} else if ( txt.indexOf( ' | stdlib' ) === txt.length-9 ) { // e.g., 'foo/bar | stdlib'
txt = 'stdlib | ' + txt.slice(... | javascript | function cleanTitle( el ) {
var txt = cleanPath( el.innerHTML );
var idx = txt.indexOf( 'stdlib' );
if ( idx === -1 || idx === 1 ) { // e.g., '@stdlib/types/iter'
txt = 'stdlib | ' + txt;
} else if ( txt.indexOf( ' | stdlib' ) === txt.length-9 ) { // e.g., 'foo/bar | stdlib'
txt = 'stdlib | ' + txt.slice(... | [
"function",
"cleanTitle",
"(",
"el",
")",
"{",
"var",
"txt",
"=",
"cleanPath",
"(",
"el",
".",
"innerHTML",
")",
";",
"var",
"idx",
"=",
"txt",
".",
"indexOf",
"(",
"'stdlib'",
")",
";",
"if",
"(",
"idx",
"===",
"-",
"1",
"||",
"idx",
"===",
"1",... | Cleans up the document title.
@private
@param {DOMElement} el - title element | [
"Cleans",
"up",
"the",
"document",
"title",
"."
] | 1026b15f47f0b4d2c0db8617f22a35873c514919 | https://github.com/stdlib-js/stdlib/blob/1026b15f47f0b4d2c0db8617f22a35873c514919/etc/typedoc/theme/assets/js/theme.js#L60-L69 |
8,673 | stdlib-js/stdlib | etc/typedoc/theme/assets/js/theme.js | cleanLinks | function cleanLinks( el ) {
var i;
for ( i = 0; i < el.length; i++ ) {
el[ i ].innerHTML = cleanPath( el[ i ].innerHTML );
}
} | javascript | function cleanLinks( el ) {
var i;
for ( i = 0; i < el.length; i++ ) {
el[ i ].innerHTML = cleanPath( el[ i ].innerHTML );
}
} | [
"function",
"cleanLinks",
"(",
"el",
")",
"{",
"var",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"el",
".",
"length",
";",
"i",
"++",
")",
"{",
"el",
"[",
"i",
"]",
".",
"innerHTML",
"=",
"cleanPath",
"(",
"el",
"[",
"i",
"]",
".",... | Cleans up link text.
@private
@param {Array<DOMElement>} el - list of anchor elements to clean | [
"Cleans",
"up",
"link",
"text",
"."
] | 1026b15f47f0b4d2c0db8617f22a35873c514919 | https://github.com/stdlib-js/stdlib/blob/1026b15f47f0b4d2c0db8617f22a35873c514919/etc/typedoc/theme/assets/js/theme.js#L77-L82 |
8,674 | stdlib-js/stdlib | etc/typedoc/theme/assets/js/theme.js | cleanHeadings | function cleanHeadings( el ) {
var i;
for ( i = 0; i < el.length; i++ ) {
el[ i ].innerHTML = cleanHeading( el[ i ].innerHTML );
}
} | javascript | function cleanHeadings( el ) {
var i;
for ( i = 0; i < el.length; i++ ) {
el[ i ].innerHTML = cleanHeading( el[ i ].innerHTML );
}
} | [
"function",
"cleanHeadings",
"(",
"el",
")",
"{",
"var",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"el",
".",
"length",
";",
"i",
"++",
")",
"{",
"el",
"[",
"i",
"]",
".",
"innerHTML",
"=",
"cleanHeading",
"(",
"el",
"[",
"i",
"]",
... | Cleans up heading text.
@private
@param {Array<DOMElement>} el - list of heading elements to clean | [
"Cleans",
"up",
"heading",
"text",
"."
] | 1026b15f47f0b4d2c0db8617f22a35873c514919 | https://github.com/stdlib-js/stdlib/blob/1026b15f47f0b4d2c0db8617f22a35873c514919/etc/typedoc/theme/assets/js/theme.js#L104-L109 |
8,675 | stdlib-js/stdlib | etc/typedoc/theme/assets/js/theme.js | updateDescription | function updateDescription( txt ) {
var ch;
if ( txt.length === 0 ) {
return txt;
}
ch = txt[ 0 ].toUpperCase();
if ( ch !== txt[ 0 ] ) {
txt = ch + txt.slice( 1 );
}
if ( txt.charCodeAt( txt.length-1 ) !== 46 ) { // .
txt += '.';
}
return txt;
} | javascript | function updateDescription( txt ) {
var ch;
if ( txt.length === 0 ) {
return txt;
}
ch = txt[ 0 ].toUpperCase();
if ( ch !== txt[ 0 ] ) {
txt = ch + txt.slice( 1 );
}
if ( txt.charCodeAt( txt.length-1 ) !== 46 ) { // .
txt += '.';
}
return txt;
} | [
"function",
"updateDescription",
"(",
"txt",
")",
"{",
"var",
"ch",
";",
"if",
"(",
"txt",
".",
"length",
"===",
"0",
")",
"{",
"return",
"txt",
";",
"}",
"ch",
"=",
"txt",
"[",
"0",
"]",
".",
"toUpperCase",
"(",
")",
";",
"if",
"(",
"ch",
"!==... | Updates a description.
@private
@param {string} txt - description
@returns {string} updated description | [
"Updates",
"a",
"description",
"."
] | 1026b15f47f0b4d2c0db8617f22a35873c514919 | https://github.com/stdlib-js/stdlib/blob/1026b15f47f0b4d2c0db8617f22a35873c514919/etc/typedoc/theme/assets/js/theme.js#L118-L131 |
8,676 | stdlib-js/stdlib | etc/typedoc/theme/assets/js/theme.js | main | function main() {
var el;
el = document.querySelector( 'title' );
cleanTitle( el );
el = document.querySelectorAll( '.tsd-kind-external-module a' );
cleanLinks( el );
el = document.querySelectorAll( '.tsd-is-not-exported a' );
cleanLinks( el );
el = document.querySelectorAll( '.tsd-breadcrumb a' );
... | javascript | function main() {
var el;
el = document.querySelector( 'title' );
cleanTitle( el );
el = document.querySelectorAll( '.tsd-kind-external-module a' );
cleanLinks( el );
el = document.querySelectorAll( '.tsd-is-not-exported a' );
cleanLinks( el );
el = document.querySelectorAll( '.tsd-breadcrumb a' );
... | [
"function",
"main",
"(",
")",
"{",
"var",
"el",
";",
"el",
"=",
"document",
".",
"querySelector",
"(",
"'title'",
")",
";",
"cleanTitle",
"(",
"el",
")",
";",
"el",
"=",
"document",
".",
"querySelectorAll",
"(",
"'.tsd-kind-external-module a'",
")",
";",
... | Main execution sequence.
@private | [
"Main",
"execution",
"sequence",
"."
] | 1026b15f47f0b4d2c0db8617f22a35873c514919 | https://github.com/stdlib-js/stdlib/blob/1026b15f47f0b4d2c0db8617f22a35873c514919/etc/typedoc/theme/assets/js/theme.js#L151-L174 |
8,677 | stdlib-js/stdlib | tools/docs/jsdoc/templates/json/transforms/mixin/index.js | transform | function transform( node ) {
return {
'name': node.name,
'description': node.description || '',
'access': node.access || '',
'virtual': !!node.virtual
};
} | javascript | function transform( node ) {
return {
'name': node.name,
'description': node.description || '',
'access': node.access || '',
'virtual': !!node.virtual
};
} | [
"function",
"transform",
"(",
"node",
")",
"{",
"return",
"{",
"'name'",
":",
"node",
".",
"name",
",",
"'description'",
":",
"node",
".",
"description",
"||",
"''",
",",
"'access'",
":",
"node",
".",
"access",
"||",
"''",
",",
"'virtual'",
":",
"!",
... | Transforms a `mixin` doclet element.
@param {Object} node - doclet element
@returns {Object} filtered object | [
"Transforms",
"a",
"mixin",
"doclet",
"element",
"."
] | 1026b15f47f0b4d2c0db8617f22a35873c514919 | https://github.com/stdlib-js/stdlib/blob/1026b15f47f0b4d2c0db8617f22a35873c514919/tools/docs/jsdoc/templates/json/transforms/mixin/index.js#L9-L16 |
8,678 | stdlib-js/stdlib | tools/docs/jsdoc/templates/json/transforms/member/index.js | transform | function transform( node ) {
var type;
if ( node.type ) {
if ( node.type.length === 1 ) {
type = node.type[ 0 ];
} else {
type = node.type;
}
} else {
type = '';
}
return {
'name': node.name,
'description': node.description || '',
'type': type,
'access': node.access || '',
'virtual': !!node... | javascript | function transform( node ) {
var type;
if ( node.type ) {
if ( node.type.length === 1 ) {
type = node.type[ 0 ];
} else {
type = node.type;
}
} else {
type = '';
}
return {
'name': node.name,
'description': node.description || '',
'type': type,
'access': node.access || '',
'virtual': !!node... | [
"function",
"transform",
"(",
"node",
")",
"{",
"var",
"type",
";",
"if",
"(",
"node",
".",
"type",
")",
"{",
"if",
"(",
"node",
".",
"type",
".",
"length",
"===",
"1",
")",
"{",
"type",
"=",
"node",
".",
"type",
"[",
"0",
"]",
";",
"}",
"els... | Transforms a `member` doclet element.
@param {Object} node - doclet element
@returns {Object} filtered object | [
"Transforms",
"a",
"member",
"doclet",
"element",
"."
] | 1026b15f47f0b4d2c0db8617f22a35873c514919 | https://github.com/stdlib-js/stdlib/blob/1026b15f47f0b4d2c0db8617f22a35873c514919/tools/docs/jsdoc/templates/json/transforms/member/index.js#L9-L27 |
8,679 | stdlib-js/stdlib | tools/snippets/benchmark/benchmark.length.js | benchmark | function benchmark( b ) {
var i;
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
// TODO: synchronous task
if ( TODO/* TODO: condition */ ) {
b.fail( 'something went wrong' );
}
}
b.toc();
if ( TODO/* TODO: condition */ ) {
b.fail( 'something went wrong' );
}
b.pass( 'benchmark finished... | javascript | function benchmark( b ) {
var i;
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
// TODO: synchronous task
if ( TODO/* TODO: condition */ ) {
b.fail( 'something went wrong' );
}
}
b.toc();
if ( TODO/* TODO: condition */ ) {
b.fail( 'something went wrong' );
}
b.pass( 'benchmark finished... | [
"function",
"benchmark",
"(",
"b",
")",
"{",
"var",
"i",
";",
"b",
".",
"tic",
"(",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"b",
".",
"iterations",
";",
"i",
"++",
")",
"{",
"// TODO: synchronous task",
"if",
"(",
"TODO",
"/* TODO: co... | Benchmark function.
@private
@param {Benchmark} b - benchmark instance | [
"Benchmark",
"function",
"."
] | 1026b15f47f0b4d2c0db8617f22a35873c514919 | https://github.com/stdlib-js/stdlib/blob/1026b15f47f0b4d2c0db8617f22a35873c514919/tools/snippets/benchmark/benchmark.length.js#L54-L70 |
8,680 | stdlib-js/stdlib | tools/docs/jsdoc/templates/json/transforms/function/returns.js | transform | function transform( nodes ) {
var type;
var desc;
if ( nodes[ 0 ].type ) {
if ( nodes[ 0 ].type.names.length === 1 ) {
type = nodes[ 0 ].type.names[ 0 ];
} else {
type = nodes[ 0 ].type.names;
}
} else {
type = '';
}
desc = nodes[ 0 ].description || '';
return {
'type': type,
'description': des... | javascript | function transform( nodes ) {
var type;
var desc;
if ( nodes[ 0 ].type ) {
if ( nodes[ 0 ].type.names.length === 1 ) {
type = nodes[ 0 ].type.names[ 0 ];
} else {
type = nodes[ 0 ].type.names;
}
} else {
type = '';
}
desc = nodes[ 0 ].description || '';
return {
'type': type,
'description': des... | [
"function",
"transform",
"(",
"nodes",
")",
"{",
"var",
"type",
";",
"var",
"desc",
";",
"if",
"(",
"nodes",
"[",
"0",
"]",
".",
"type",
")",
"{",
"if",
"(",
"nodes",
"[",
"0",
"]",
".",
"type",
".",
"names",
".",
"length",
"===",
"1",
")",
"... | Transforms `returns` doclet elements.
@param {Object[]} nodes - doclet elements
@returns {Object} filtered object | [
"Transforms",
"returns",
"doclet",
"elements",
"."
] | 1026b15f47f0b4d2c0db8617f22a35873c514919 | https://github.com/stdlib-js/stdlib/blob/1026b15f47f0b4d2c0db8617f22a35873c514919/tools/docs/jsdoc/templates/json/transforms/function/returns.js#L9-L26 |
8,681 | reactjs/react-docgen | src/utils/getMethodDocumentation.js | getMethodReturnDoc | function getMethodReturnDoc(methodPath) {
const functionExpression = methodPath.get('value');
if (functionExpression.node.returnType) {
const returnType = getTypeAnnotation(functionExpression.get('returnType'));
if (returnType && t.Flow.check(returnType.node)) {
return { type: getFlowType(returnType)... | javascript | function getMethodReturnDoc(methodPath) {
const functionExpression = methodPath.get('value');
if (functionExpression.node.returnType) {
const returnType = getTypeAnnotation(functionExpression.get('returnType'));
if (returnType && t.Flow.check(returnType.node)) {
return { type: getFlowType(returnType)... | [
"function",
"getMethodReturnDoc",
"(",
"methodPath",
")",
"{",
"const",
"functionExpression",
"=",
"methodPath",
".",
"get",
"(",
"'value'",
")",
";",
"if",
"(",
"functionExpression",
".",
"node",
".",
"returnType",
")",
"{",
"const",
"returnType",
"=",
"getTy... | Extract flow return type. | [
"Extract",
"flow",
"return",
"type",
"."
] | f78450432c6b1cad788327a2f97f782091958b7a | https://github.com/reactjs/react-docgen/blob/f78450432c6b1cad788327a2f97f782091958b7a/src/utils/getMethodDocumentation.js#L72-L85 |
8,682 | reactjs/react-docgen | src/handlers/propTypeCompositionHandler.js | amendComposes | function amendComposes(documentation, path) {
const moduleName = resolveToModule(path);
if (moduleName) {
documentation.addComposes(moduleName);
}
} | javascript | function amendComposes(documentation, path) {
const moduleName = resolveToModule(path);
if (moduleName) {
documentation.addComposes(moduleName);
}
} | [
"function",
"amendComposes",
"(",
"documentation",
",",
"path",
")",
"{",
"const",
"moduleName",
"=",
"resolveToModule",
"(",
"path",
")",
";",
"if",
"(",
"moduleName",
")",
"{",
"documentation",
".",
"addComposes",
"(",
"moduleName",
")",
";",
"}",
"}"
] | It resolves the path to its module name and adds it to the "composes" entry
in the documentation. | [
"It",
"resolves",
"the",
"path",
"to",
"its",
"module",
"name",
"and",
"adds",
"it",
"to",
"the",
"composes",
"entry",
"in",
"the",
"documentation",
"."
] | f78450432c6b1cad788327a2f97f782091958b7a | https://github.com/reactjs/react-docgen/blob/f78450432c6b1cad788327a2f97f782091958b7a/src/handlers/propTypeCompositionHandler.js#L22-L27 |
8,683 | aws/aws-iot-device-sdk-js | device/lib/tls.js | buildBuilder | function buildBuilder(mqttClient, opts) {
var connection;
connection = tls.connect(opts);
function handleTLSerrors(err) {
mqttClient.emit('error', err);
connection.end();
}
connection.on('secureConnect', function() {
if (!connection.authorized) {
connection.emit('error', new... | javascript | function buildBuilder(mqttClient, opts) {
var connection;
connection = tls.connect(opts);
function handleTLSerrors(err) {
mqttClient.emit('error', err);
connection.end();
}
connection.on('secureConnect', function() {
if (!connection.authorized) {
connection.emit('error', new... | [
"function",
"buildBuilder",
"(",
"mqttClient",
",",
"opts",
")",
"{",
"var",
"connection",
";",
"connection",
"=",
"tls",
".",
"connect",
"(",
"opts",
")",
";",
"function",
"handleTLSerrors",
"(",
"err",
")",
"{",
"mqttClient",
".",
"emit",
"(",
"'error'",... | npm deps app deps | [
"npm",
"deps",
"app",
"deps"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/device/lib/tls.js#L23-L43 |
8,684 | aws/aws-iot-device-sdk-js | examples/jobs-agent.js | errorToString | function errorToString(err) {
if (isUndefined(err)) {
return undefined;
} else if (err.toString().length > maxStatusDetailLength) {
return err.toString().substring(0, maxStatusDetailLength - 3) + '...';
} else {
return err.toString();
}
} | javascript | function errorToString(err) {
if (isUndefined(err)) {
return undefined;
} else if (err.toString().length > maxStatusDetailLength) {
return err.toString().substring(0, maxStatusDetailLength - 3) + '...';
} else {
return err.toString();
}
} | [
"function",
"errorToString",
"(",
"err",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"err",
")",
")",
"{",
"return",
"undefined",
";",
"}",
"else",
"if",
"(",
"err",
".",
"toString",
"(",
")",
".",
"length",
">",
"maxStatusDetailLength",
")",
"{",
"return... | Private function to safely convert errors to strings | [
"Private",
"function",
"to",
"safely",
"convert",
"errors",
"to",
"strings"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/examples/jobs-agent.js#L102-L110 |
8,685 | aws/aws-iot-device-sdk-js | examples/jobs-agent.js | validateChecksum | function validateChecksum(fileName, checksum, cb) {
if (isUndefined(checksum) || isUndefined(checksum.hashAlgorithm)) {
cb();
return;
}
if (isUndefined(checksum.inline) || isUndefined(checksum.inline.value)) {
cb(new Error('Installed jobs agent only supports inline checksum value provided in... | javascript | function validateChecksum(fileName, checksum, cb) {
if (isUndefined(checksum) || isUndefined(checksum.hashAlgorithm)) {
cb();
return;
}
if (isUndefined(checksum.inline) || isUndefined(checksum.inline.value)) {
cb(new Error('Installed jobs agent only supports inline checksum value provided in... | [
"function",
"validateChecksum",
"(",
"fileName",
",",
"checksum",
",",
"cb",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"checksum",
")",
"||",
"isUndefined",
"(",
"checksum",
".",
"hashAlgorithm",
")",
")",
"{",
"cb",
"(",
")",
";",
"return",
";",
"}",
"... | Private function to validate checksum | [
"Private",
"function",
"to",
"validate",
"checksum"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/examples/jobs-agent.js#L115-L150 |
8,686 | aws/aws-iot-device-sdk-js | examples/jobs-agent.js | validateSignature | function validateSignature(fileName, signature, cb) {
if (isUndefined(signature) || isUndefined(signature.codesign)) {
cb();
return;
}
if (isUndefined(codeSignCertFileName)) {
cb(new Error('No code sign certificate file specified'));
return;
}
var codeSignCert;
try {
c... | javascript | function validateSignature(fileName, signature, cb) {
if (isUndefined(signature) || isUndefined(signature.codesign)) {
cb();
return;
}
if (isUndefined(codeSignCertFileName)) {
cb(new Error('No code sign certificate file specified'));
return;
}
var codeSignCert;
try {
c... | [
"function",
"validateSignature",
"(",
"fileName",
",",
"signature",
",",
"cb",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"signature",
")",
"||",
"isUndefined",
"(",
"signature",
".",
"codesign",
")",
")",
"{",
"cb",
"(",
")",
";",
"return",
";",
"}",
"i... | Private function to validate signature | [
"Private",
"function",
"to",
"validate",
"signature"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/examples/jobs-agent.js#L156-L213 |
8,687 | aws/aws-iot-device-sdk-js | examples/jobs-agent.js | backupFiles | function backupFiles(job, iFile, cb) {
if (isUndefined(cb)) {
cb = iFile;
iFile = 0;
}
if (iFile === job.document.files.length) {
cb();
return;
}
var file = job.document.files[iFile];
if (isUndefined(file)) {
cb(new Error('empty file specification'));
return;
... | javascript | function backupFiles(job, iFile, cb) {
if (isUndefined(cb)) {
cb = iFile;
iFile = 0;
}
if (iFile === job.document.files.length) {
cb();
return;
}
var file = job.document.files[iFile];
if (isUndefined(file)) {
cb(new Error('empty file specification'));
return;
... | [
"function",
"backupFiles",
"(",
"job",
",",
"iFile",
",",
"cb",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"cb",
")",
")",
"{",
"cb",
"=",
"iFile",
";",
"iFile",
"=",
"0",
";",
"}",
"if",
"(",
"iFile",
"===",
"job",
".",
"document",
".",
"files",
... | Private function to backup existing files before downloading | [
"Private",
"function",
"to",
"backup",
"existing",
"files",
"before",
"downloading"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/examples/jobs-agent.js#L219-L257 |
8,688 | aws/aws-iot-device-sdk-js | examples/jobs-agent.js | rollbackFiles | function rollbackFiles(job, iFile, cb) {
if (isUndefined(cb)) {
cb = iFile;
iFile = 0;
}
if (iFile === job.document.files.length) {
cb();
return;
}
var file = job.document.files[iFile];
var filePath = path.resolve(job.document.workingDirectory || '', file.fileName);
if (!... | javascript | function rollbackFiles(job, iFile, cb) {
if (isUndefined(cb)) {
cb = iFile;
iFile = 0;
}
if (iFile === job.document.files.length) {
cb();
return;
}
var file = job.document.files[iFile];
var filePath = path.resolve(job.document.workingDirectory || '', file.fileName);
if (!... | [
"function",
"rollbackFiles",
"(",
"job",
",",
"iFile",
",",
"cb",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"cb",
")",
")",
"{",
"cb",
"=",
"iFile",
";",
"iFile",
"=",
"0",
";",
"}",
"if",
"(",
"iFile",
"===",
"job",
".",
"document",
".",
"files",... | Private function to rollback files after a failed install operation | [
"Private",
"function",
"to",
"rollback",
"files",
"after",
"a",
"failed",
"install",
"operation"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/examples/jobs-agent.js#L263-L289 |
8,689 | aws/aws-iot-device-sdk-js | examples/jobs-agent.js | downloadFiles | function downloadFiles(job, iFile, cb) {
if (isUndefined(cb)) {
cb = iFile;
iFile = 0;
}
if (iFile === job.document.files.length) {
cb();
return;
}
var file = job.document.files[iFile];
var filePath = path.resolve(job.document.workingDirectory || '', file.fileName);
if (... | javascript | function downloadFiles(job, iFile, cb) {
if (isUndefined(cb)) {
cb = iFile;
iFile = 0;
}
if (iFile === job.document.files.length) {
cb();
return;
}
var file = job.document.files[iFile];
var filePath = path.resolve(job.document.workingDirectory || '', file.fileName);
if (... | [
"function",
"downloadFiles",
"(",
"job",
",",
"iFile",
",",
"cb",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"cb",
")",
")",
"{",
"cb",
"=",
"iFile",
";",
"iFile",
"=",
"0",
";",
"}",
"if",
"(",
"iFile",
"===",
"job",
".",
"document",
".",
"files",... | Private function to download specified files in sequence to temporary locations | [
"Private",
"function",
"to",
"download",
"specified",
"files",
"in",
"sequence",
"to",
"temporary",
"locations"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/examples/jobs-agent.js#L295-L339 |
8,690 | aws/aws-iot-device-sdk-js | examples/jobs-agent.js | updateInstalledPackage | function updateInstalledPackage(updatedPackage) {
var packageIndex = installedPackages.findIndex(function(element) {
return (element.packageName === updatedPackage.packageName);
});
if (packageIndex < 0) {
packageIndex = installedPackages.length;
installedPackages.push(updatedPackage);
... | javascript | function updateInstalledPackage(updatedPackage) {
var packageIndex = installedPackages.findIndex(function(element) {
return (element.packageName === updatedPackage.packageName);
});
if (packageIndex < 0) {
packageIndex = installedPackages.length;
installedPackages.push(updatedPackage);
... | [
"function",
"updateInstalledPackage",
"(",
"updatedPackage",
")",
"{",
"var",
"packageIndex",
"=",
"installedPackages",
".",
"findIndex",
"(",
"function",
"(",
"element",
")",
"{",
"return",
"(",
"element",
".",
"packageName",
"===",
"updatedPackage",
".",
"packag... | Private function to update installed package | [
"Private",
"function",
"to",
"update",
"installed",
"package"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/examples/jobs-agent.js#L345-L358 |
8,691 | aws/aws-iot-device-sdk-js | examples/jobs-agent.js | startPackage | function startPackage(package, cb) {
if (isUndefined(packageRuntimes[package.packageName])) {
packageRuntimes[package.packageName] = {};
}
var packageRuntime = packageRuntimes[package.packageName];
if (!isUndefined(packageRuntime.process)) {
cb(new Error('package already running'));
retu... | javascript | function startPackage(package, cb) {
if (isUndefined(packageRuntimes[package.packageName])) {
packageRuntimes[package.packageName] = {};
}
var packageRuntime = packageRuntimes[package.packageName];
if (!isUndefined(packageRuntime.process)) {
cb(new Error('package already running'));
retu... | [
"function",
"startPackage",
"(",
"package",
",",
"cb",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"packageRuntimes",
"[",
"package",
".",
"packageName",
"]",
")",
")",
"{",
"packageRuntimes",
"[",
"package",
".",
"packageName",
"]",
"=",
"{",
"}",
";",
"}"... | Private function to start installed package | [
"Private",
"function",
"to",
"start",
"installed",
"package"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/examples/jobs-agent.js#L414-L444 |
8,692 | aws/aws-iot-device-sdk-js | examples/jobs-agent.js | shutdownHandler | function shutdownHandler(job) {
// Change status to IN_PROGRESS
job.inProgress({ operation: job.operation, step: 'attempting' }, function(err) {
showJobsError(err);
var delay = (isUndefined(job.document.delay) ? '0' : job.document.delay.toString());
// Check for adequate permissions to perfor... | javascript | function shutdownHandler(job) {
// Change status to IN_PROGRESS
job.inProgress({ operation: job.operation, step: 'attempting' }, function(err) {
showJobsError(err);
var delay = (isUndefined(job.document.delay) ? '0' : job.document.delay.toString());
// Check for adequate permissions to perfor... | [
"function",
"shutdownHandler",
"(",
"job",
")",
"{",
"// Change status to IN_PROGRESS",
"job",
".",
"inProgress",
"(",
"{",
"operation",
":",
"job",
".",
"operation",
",",
"step",
":",
"'attempting'",
"}",
",",
"function",
"(",
"err",
")",
"{",
"showJobsError"... | Private function to handle gracefull shutdown operation | [
"Private",
"function",
"to",
"handle",
"gracefull",
"shutdown",
"operation"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/examples/jobs-agent.js#L580-L603 |
8,693 | aws/aws-iot-device-sdk-js | examples/jobs-agent.js | rebootHandler | function rebootHandler(job) {
// Check if the reboot job has not yet been initiated
if (job.status.status === 'QUEUED' ||
isUndefined(job.status.statusDetails) ||
isUndefined(job.status.statusDetails.step)) {
// Change status to IN_PROGRESS
job.inProgress({ operation: job.operation, s... | javascript | function rebootHandler(job) {
// Check if the reboot job has not yet been initiated
if (job.status.status === 'QUEUED' ||
isUndefined(job.status.statusDetails) ||
isUndefined(job.status.statusDetails.step)) {
// Change status to IN_PROGRESS
job.inProgress({ operation: job.operation, s... | [
"function",
"rebootHandler",
"(",
"job",
")",
"{",
"// Check if the reboot job has not yet been initiated",
"if",
"(",
"job",
".",
"status",
".",
"status",
"===",
"'QUEUED'",
"||",
"isUndefined",
"(",
"job",
".",
"status",
".",
"statusDetails",
")",
"||",
"isUndef... | Private function to handle reboot operation | [
"Private",
"function",
"to",
"handle",
"reboot",
"operation"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/examples/jobs-agent.js#L609-L637 |
8,694 | aws/aws-iot-device-sdk-js | examples/jobs-agent.js | systemStatusHandler | function systemStatusHandler(job) {
var packageNames = '[';
for (var i = 0; i < installedPackages.length; i++) {
packageNames += installedPackages[i].packageName + ((i !== installedPackages.length - 1) ? ', ' : '');
}
packageNames += ']';
job.succeeded({
operation: job.operation,
inst... | javascript | function systemStatusHandler(job) {
var packageNames = '[';
for (var i = 0; i < installedPackages.length; i++) {
packageNames += installedPackages[i].packageName + ((i !== installedPackages.length - 1) ? ', ' : '');
}
packageNames += ']';
job.succeeded({
operation: job.operation,
inst... | [
"function",
"systemStatusHandler",
"(",
"job",
")",
"{",
"var",
"packageNames",
"=",
"'['",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"installedPackages",
".",
"length",
";",
"i",
"++",
")",
"{",
"packageNames",
"+=",
"installedPackages",
"["... | Private function to handle systemStatus operation | [
"Private",
"function",
"to",
"handle",
"systemStatus",
"operation"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/examples/jobs-agent.js#L643-L661 |
8,695 | aws/aws-iot-device-sdk-js | device/index.js | _markConnectionStable | function _markConnectionStable() {
currentReconnectTimeMs = baseReconnectTimeMs;
device.options.reconnectPeriod = currentReconnectTimeMs;
//
// Mark this timeout as expired
//
connectionTimer = null;
connectionState = 'stable';
} | javascript | function _markConnectionStable() {
currentReconnectTimeMs = baseReconnectTimeMs;
device.options.reconnectPeriod = currentReconnectTimeMs;
//
// Mark this timeout as expired
//
connectionTimer = null;
connectionState = 'stable';
} | [
"function",
"_markConnectionStable",
"(",
")",
"{",
"currentReconnectTimeMs",
"=",
"baseReconnectTimeMs",
";",
"device",
".",
"options",
".",
"reconnectPeriod",
"=",
"currentReconnectTimeMs",
";",
"//",
"// Mark this timeout as expired",
"//",
"connectionTimer",
"=",
"nul... | Timeout expiry function for the connection timer; once a connection is stable, reset the current reconnection time to the base value. | [
"Timeout",
"expiry",
"function",
"for",
"the",
"connection",
"timer",
";",
"once",
"a",
"connection",
"is",
"stable",
"reset",
"the",
"current",
"reconnection",
"time",
"to",
"the",
"base",
"value",
"."
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/device/index.js#L647-L655 |
8,696 | aws/aws-iot-device-sdk-js | device/index.js | _trimOfflinePublishQueueIfNecessary | function _trimOfflinePublishQueueIfNecessary() {
var rc = true;
if ((offlineQueueMaxSize > 0) &&
(offlinePublishQueue.length >= offlineQueueMaxSize)) {
//
// The queue has reached its maximum size, trim it
// according to the defined drop behavior.
//
i... | javascript | function _trimOfflinePublishQueueIfNecessary() {
var rc = true;
if ((offlineQueueMaxSize > 0) &&
(offlinePublishQueue.length >= offlineQueueMaxSize)) {
//
// The queue has reached its maximum size, trim it
// according to the defined drop behavior.
//
i... | [
"function",
"_trimOfflinePublishQueueIfNecessary",
"(",
")",
"{",
"var",
"rc",
"=",
"true",
";",
"if",
"(",
"(",
"offlineQueueMaxSize",
">",
"0",
")",
"&&",
"(",
"offlinePublishQueue",
".",
"length",
">=",
"offlineQueueMaxSize",
")",
")",
"{",
"//",
"// The qu... | Trim the offline queue if required; returns true if another element can be placed in the queue | [
"Trim",
"the",
"offline",
"queue",
"if",
"required",
";",
"returns",
"true",
"if",
"another",
"element",
"can",
"be",
"placed",
"in",
"the",
"queue"
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/device/index.js#L660-L676 |
8,697 | aws/aws-iot-device-sdk-js | device/index.js | _drainOperationQueue | function _drainOperationQueue() {
//
// Handle our active subscriptions first, using a cloned
// copy of the array. We shift them out one-by-one until
// all have been processed, leaving the official record
// of active subscriptions untouched.
//
var subscription = clonedSu... | javascript | function _drainOperationQueue() {
//
// Handle our active subscriptions first, using a cloned
// copy of the array. We shift them out one-by-one until
// all have been processed, leaving the official record
// of active subscriptions untouched.
//
var subscription = clonedSu... | [
"function",
"_drainOperationQueue",
"(",
")",
"{",
"//",
"// Handle our active subscriptions first, using a cloned",
"// copy of the array. We shift them out one-by-one until",
"// all have been processed, leaving the official record",
"// of active subscriptions untouched.",
"// ",
"var",
... | Timeout expiry function for the drain timer; once a connection has been established, begin draining cached transactions. | [
"Timeout",
"expiry",
"function",
"for",
"the",
"drain",
"timer",
";",
"once",
"a",
"connection",
"has",
"been",
"established",
"begin",
"draining",
"cached",
"transactions",
"."
] | 481445639ff6bb92586c63d3c9ee85dd37728453 | https://github.com/aws/aws-iot-device-sdk-js/blob/481445639ff6bb92586c63d3c9ee85dd37728453/device/index.js#L682-L744 |
8,698 | siimon/prom-client | lib/metricAggregators.js | AggregatorFactory | function AggregatorFactory(aggregatorFn) {
return metrics => {
if (metrics.length === 0) return;
const result = {
help: metrics[0].help,
name: metrics[0].name,
type: metrics[0].type,
values: [],
aggregator: metrics[0].aggregator
};
// Gather metrics by metricName and labels.
const byLabels = n... | javascript | function AggregatorFactory(aggregatorFn) {
return metrics => {
if (metrics.length === 0) return;
const result = {
help: metrics[0].help,
name: metrics[0].name,
type: metrics[0].type,
values: [],
aggregator: metrics[0].aggregator
};
// Gather metrics by metricName and labels.
const byLabels = n... | [
"function",
"AggregatorFactory",
"(",
"aggregatorFn",
")",
"{",
"return",
"metrics",
"=>",
"{",
"if",
"(",
"metrics",
".",
"length",
"===",
"0",
")",
"return",
";",
"const",
"result",
"=",
"{",
"help",
":",
"metrics",
"[",
"0",
"]",
".",
"help",
",",
... | Returns a new function that applies the `aggregatorFn` to the values.
@param {Function} aggregatorFn function to apply to values.
@return {Function} aggregator function | [
"Returns",
"a",
"new",
"function",
"that",
"applies",
"the",
"aggregatorFn",
"to",
"the",
"values",
"."
] | b66755a6f79c7483dc899360eaf9759f330cd420 | https://github.com/siimon/prom-client/blob/b66755a6f79c7483dc899360eaf9759f330cd420/lib/metricAggregators.js#L10-L43 |
8,699 | amireh/happypack | lib/HappyForegroundThreadPool.js | HappyForegroundThreadPool | function HappyForegroundThreadPool(config) {
var rpcHandler, worker;
return {
size: config.size,
start: function(compilerId, compiler, compilerOptions, done) {
var fakeCompiler = new HappyFakeCompiler({
id: 'foreground',
compilerId: compilerId,
send: function executeCompilerR... | javascript | function HappyForegroundThreadPool(config) {
var rpcHandler, worker;
return {
size: config.size,
start: function(compilerId, compiler, compilerOptions, done) {
var fakeCompiler = new HappyFakeCompiler({
id: 'foreground',
compilerId: compilerId,
send: function executeCompilerR... | [
"function",
"HappyForegroundThreadPool",
"(",
"config",
")",
"{",
"var",
"rpcHandler",
",",
"worker",
";",
"return",
"{",
"size",
":",
"config",
".",
"size",
",",
"start",
":",
"function",
"(",
"compilerId",
",",
"compiler",
",",
"compilerOptions",
",",
"don... | Create a thread pool that can be shared between multiple plugin instances.
@param {Object} config
@param {Array.<String>} config.loaders
The loaders to configure the (foreground) worker with. | [
"Create",
"a",
"thread",
"pool",
"that",
"can",
"be",
"shared",
"between",
"multiple",
"plugin",
"instances",
"."
] | e45926e9754f42098d882ff129269b15907ef00e | https://github.com/amireh/happypack/blob/e45926e9754f42098d882ff129269b15907ef00e/lib/HappyForegroundThreadPool.js#L13-L68 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.