repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
thealjey/webcompiler | lib/webpack.js | getServer | function getServer(inPath, { react, port, contentBase, configureApplication }) {
const server = new _webpackDevServer2.default((0, _webpack2.default)(_extends({}, getConfig(react), {
devtool: 'eval-source-map',
entry: [`webpack-dev-server/client?http://0.0.0.0:${port}`, 'webpack/hot/only-dev-server', 'babel-p... | javascript | function getServer(inPath, { react, port, contentBase, configureApplication }) {
const server = new _webpackDevServer2.default((0, _webpack2.default)(_extends({}, getConfig(react), {
devtool: 'eval-source-map',
entry: [`webpack-dev-server/client?http://0.0.0.0:${port}`, 'webpack/hot/only-dev-server', 'babel-p... | [
"function",
"getServer",
"(",
"inPath",
",",
"{",
"react",
",",
"port",
",",
"contentBase",
",",
"configureApplication",
"}",
")",
"{",
"const",
"server",
"=",
"new",
"_webpackDevServer2",
".",
"default",
"(",
"(",
"0",
",",
"_webpack2",
".",
"default",
")... | Returns a webpack development server instance.
@memberof module:webpack
@private
@method getServer
@param {string} inPath - the path to an input file
@param {DevServerConfig} options - a config object
@return {Object} an instance of the webpack development server | [
"Returns",
"a",
"webpack",
"development",
"server",
"instance",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/webpack.js#L130-L142 | train |
svanderburg/nijs | lib/ast/NixInlineJS.js | NixInlineJS | function NixInlineJS(args) {
/* Compose the NixInlineJS function's parameters */
var params = {};
if(typeof args.code == "function") {
params.codeIsFunction = true;
params.code = args.code.toString();
} else {
params.codeIsFunction = false;
params.code = args.code;
... | javascript | function NixInlineJS(args) {
/* Compose the NixInlineJS function's parameters */
var params = {};
if(typeof args.code == "function") {
params.codeIsFunction = true;
params.code = args.code.toString();
} else {
params.codeIsFunction = false;
params.code = args.code;
... | [
"function",
"NixInlineJS",
"(",
"args",
")",
"{",
"/* Compose the NixInlineJS function's parameters */",
"var",
"params",
"=",
"{",
"}",
";",
"if",
"(",
"typeof",
"args",
".",
"code",
"==",
"\"function\"",
")",
"{",
"params",
".",
"codeIsFunction",
"=",
"true",
... | Creates a new NixInlineJS instance.
@class NixInlineJS
@extends NixFunInvocation
@classdesc Creates embedded shell code in a string performing a Node.js
invocation to execute an inline JavaScript code fragment.
@constructor
@param {Object} args Arguments to the function
@param {Function} args.code A JavaScript functi... | [
"Creates",
"a",
"new",
"NixInlineJS",
"instance",
"."
] | 4e2738cbff3a43aba9297315ca5120cecf8dae3e | https://github.com/svanderburg/nijs/blob/4e2738cbff3a43aba9297315ca5120cecf8dae3e/lib/ast/NixInlineJS.js#L20-L48 | train |
d-oliveros/isomorphine | src/server/controllers.js | getPayload | function getPayload(req, res, next) {
req.hasCallback = false;
req.payload = req.body.payload || [];
// Determines if the request is asynchronous or not
req.payload.forEach(function(arg, i) {
if (arg === '__clientCallback__') {
req.hasCallback = true;
req.clientCallbackIndex = i;
}
});
... | javascript | function getPayload(req, res, next) {
req.hasCallback = false;
req.payload = req.body.payload || [];
// Determines if the request is asynchronous or not
req.payload.forEach(function(arg, i) {
if (arg === '__clientCallback__') {
req.hasCallback = true;
req.clientCallbackIndex = i;
}
});
... | [
"function",
"getPayload",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"req",
".",
"hasCallback",
"=",
"false",
";",
"req",
".",
"payload",
"=",
"req",
".",
"body",
".",
"payload",
"||",
"[",
"]",
";",
"// Determines if the request is asynchronous or not",... | Processes the client-side payload, and transforms the client-side
callback function signal to an actual callback function | [
"Processes",
"the",
"client",
"-",
"side",
"payload",
"and",
"transforms",
"the",
"client",
"-",
"side",
"callback",
"function",
"signal",
"to",
"an",
"actual",
"callback",
"function"
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/server/controllers.js#L15-L31 | train |
d-oliveros/isomorphine | src/server/controllers.js | callEntityMethod | function callEntityMethod(req, res, next) {
var payload = req.payload;
var method = req.serversideMethod;
if (req.hasCallback) {
debug('Transforming callback function');
payload[req.clientCallbackIndex] = function(err) {
if (err) {
return next(err);
}
var values = Array.protot... | javascript | function callEntityMethod(req, res, next) {
var payload = req.payload;
var method = req.serversideMethod;
if (req.hasCallback) {
debug('Transforming callback function');
payload[req.clientCallbackIndex] = function(err) {
if (err) {
return next(err);
}
var values = Array.protot... | [
"function",
"callEntityMethod",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"payload",
"=",
"req",
".",
"payload",
";",
"var",
"method",
"=",
"req",
".",
"serversideMethod",
";",
"if",
"(",
"req",
".",
"hasCallback",
")",
"{",
"debug",
"(",
... | Calls the server-side entity, and returns the results to the client | [
"Calls",
"the",
"server",
"-",
"side",
"entity",
"and",
"returns",
"the",
"results",
"to",
"the",
"client"
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/server/controllers.js#L36-L95 | train |
d-oliveros/isomorphine | src/server/controllers.js | serve | function serve(req, res) {
var responseIsArray = Array.isArray(res.entityResponse);
util.invariant(responseIsArray, 'Response values are required.');
res.json({ values: res.entityResponse });
} | javascript | function serve(req, res) {
var responseIsArray = Array.isArray(res.entityResponse);
util.invariant(responseIsArray, 'Response values are required.');
res.json({ values: res.entityResponse });
} | [
"function",
"serve",
"(",
"req",
",",
"res",
")",
"{",
"var",
"responseIsArray",
"=",
"Array",
".",
"isArray",
"(",
"res",
".",
"entityResponse",
")",
";",
"util",
".",
"invariant",
"(",
"responseIsArray",
",",
"'Response values are required.'",
")",
";",
"r... | Serves the value in req.entityResponse as a JSON object. | [
"Serves",
"the",
"value",
"in",
"req",
".",
"entityResponse",
"as",
"a",
"JSON",
"object",
"."
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/server/controllers.js#L100-L105 | train |
sebelga/promised-hooks | hooks.js | nextPreHook | function nextPreHook() {
/**
* read the arguments from previous "hook" response
*/
const args = Array.prototype.slice.apply(arguments);
/**
* Check if the arguments contains an "__override" proper... | javascript | function nextPreHook() {
/**
* read the arguments from previous "hook" response
*/
const args = Array.prototype.slice.apply(arguments);
/**
* Check if the arguments contains an "__override" proper... | [
"function",
"nextPreHook",
"(",
")",
"{",
"/**\n * read the arguments from previous \"hook\" response\n */",
"const",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
"arguments",
")",
";",
"/**\n ... | "pre" hook handler | [
"pre",
"hook",
"handler"
] | 6eeebe085f3e11d8597002ad918c78db3bb30ad4 | https://github.com/sebelga/promised-hooks/blob/6eeebe085f3e11d8597002ad918c78db3bb30ad4/hooks.js#L88-L128 | train |
sebelga/promised-hooks | hooks.js | nextPostHook | function nextPostHook(res) {
response = checkResponse(res, response);
if (currentPost + 1 < totalPost && self.__hooksEnabled !== false) {
currentPost += 1;
// Reference to current post hook
const currPost =... | javascript | function nextPostHook(res) {
response = checkResponse(res, response);
if (currentPost + 1 < totalPost && self.__hooksEnabled !== false) {
currentPost += 1;
// Reference to current post hook
const currPost =... | [
"function",
"nextPostHook",
"(",
"res",
")",
"{",
"response",
"=",
"checkResponse",
"(",
"res",
",",
"response",
")",
";",
"if",
"(",
"currentPost",
"+",
"1",
"<",
"totalPost",
"&&",
"self",
".",
"__hooksEnabled",
"!==",
"false",
")",
"{",
"currentPost",
... | "post" hook handler
@param {*} res the response coming from the target method
or the reponse from any "post" hook | [
"post",
"hook",
"handler"
] | 6eeebe085f3e11d8597002ad918c78db3bb30ad4 | https://github.com/sebelga/promised-hooks/blob/6eeebe085f3e11d8597002ad918c78db3bb30ad4/hooks.js#L147-L171 | train |
sebelga/promised-hooks | hooks.js | postHookErrorHandler | function postHookErrorHandler(err) {
/**
* Helper to add an error to an Object "errors" Symbol
*/
const addError = (obj) => {
obj[ERR_KEY] = obj[ERR_KEY] || [];
obj[ERR_KEY].push(err);
... | javascript | function postHookErrorHandler(err) {
/**
* Helper to add an error to an Object "errors" Symbol
*/
const addError = (obj) => {
obj[ERR_KEY] = obj[ERR_KEY] || [];
obj[ERR_KEY].push(err);
... | [
"function",
"postHookErrorHandler",
"(",
"err",
")",
"{",
"/**\n * Helper to add an error to an Object \"errors\" Symbol\n */",
"const",
"addError",
"=",
"(",
"obj",
")",
"=>",
"{",
"obj",
"[",
"ERR_KEY",
"]",
"=",
"obj",
"[",
"ERR_... | "post" hook Error handling
@param {*} err the error returned by latest "post" hook | [
"post",
"hook",
"Error",
"handling"
] | 6eeebe085f3e11d8597002ad918c78db3bb30ad4 | https://github.com/sebelga/promised-hooks/blob/6eeebe085f3e11d8597002ad918c78db3bb30ad4/hooks.js#L177-L206 | train |
mayanklahiri/node-genesis-device | src/HCL.js | renderInlines | function renderInlines(val, indent) {
const indentStr = Array(indent + 1).join(' ');
return '\n' + map(orderBy(val, first), (pair) =>
[
`${indentStr}${pair[0]} {
${exports.renderDefinition(pair[1], indent + 2)}
${indentStr}}`,
].join('\n')
).join('\n\n');
} | javascript | function renderInlines(val, indent) {
const indentStr = Array(indent + 1).join(' ');
return '\n' + map(orderBy(val, first), (pair) =>
[
`${indentStr}${pair[0]} {
${exports.renderDefinition(pair[1], indent + 2)}
${indentStr}}`,
].join('\n')
).join('\n\n');
} | [
"function",
"renderInlines",
"(",
"val",
",",
"indent",
")",
"{",
"const",
"indentStr",
"=",
"Array",
"(",
"indent",
"+",
"1",
")",
".",
"join",
"(",
"' '",
")",
";",
"return",
"'\\n'",
"+",
"map",
"(",
"orderBy",
"(",
"val",
",",
"first",
")",
","... | Renders inline values.
@private
@param {*} val
@param {*} indent
@return {string} Rendered inlines. | [
"Renders",
"inline",
"values",
"."
] | c31b624b040ab0005afe5e204e96929c67147205 | https://github.com/mayanklahiri/node-genesis-device/blob/c31b624b040ab0005afe5e204e96929c67147205/src/HCL.js#L71-L80 | train |
mayanklahiri/node-genesis-device | src/HCL.js | renderDefinitionRhs | function renderDefinitionRhs(val, indent) {
indent = indent || 0;
const indentStr = Array(indent + 1).join(' ');
if (isUndefined(val)) {
throw new Error('Undefined value in definition RHS.');
}
if (isBoolean(val)) {
return val.toString();
}
if (isInteger(val)) {
return val;
}
if (isString... | javascript | function renderDefinitionRhs(val, indent) {
indent = indent || 0;
const indentStr = Array(indent + 1).join(' ');
if (isUndefined(val)) {
throw new Error('Undefined value in definition RHS.');
}
if (isBoolean(val)) {
return val.toString();
}
if (isInteger(val)) {
return val;
}
if (isString... | [
"function",
"renderDefinitionRhs",
"(",
"val",
",",
"indent",
")",
"{",
"indent",
"=",
"indent",
"||",
"0",
";",
"const",
"indentStr",
"=",
"Array",
"(",
"indent",
"+",
"1",
")",
".",
"join",
"(",
"' '",
")",
";",
"if",
"(",
"isUndefined",
"(",
"val"... | Render the right-hand side of a definition.
@param {*} val Value to render
@param {?number} indent Number of spaces to indent.
@return {string} Rendered RHS. | [
"Render",
"the",
"right",
"-",
"hand",
"side",
"of",
"a",
"definition",
"."
] | c31b624b040ab0005afe5e204e96929c67147205 | https://github.com/mayanklahiri/node-genesis-device/blob/c31b624b040ab0005afe5e204e96929c67147205/src/HCL.js#L88-L114 | train |
reactbits/make-reducer | lib/index.js | makePrefixMapReducer | function makePrefixMapReducer() {
for (var _len2 = arguments.length, reducers = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
reducers[_key2] = arguments[_key2];
}
if (reducers.some(function (r) {
return !_lodash2.default.isFunction(r);
})) {
throw new Error('all arguments must be a function')... | javascript | function makePrefixMapReducer() {
for (var _len2 = arguments.length, reducers = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
reducers[_key2] = arguments[_key2];
}
if (reducers.some(function (r) {
return !_lodash2.default.isFunction(r);
})) {
throw new Error('all arguments must be a function')... | [
"function",
"makePrefixMapReducer",
"(",
")",
"{",
"for",
"(",
"var",
"_len2",
"=",
"arguments",
".",
"length",
",",
"reducers",
"=",
"Array",
"(",
"_len2",
")",
",",
"_key2",
"=",
"0",
";",
"_key2",
"<",
"_len2",
";",
"_key2",
"++",
")",
"{",
"reduc... | Combines reducers into reducer that dispatches action to appropriate reducer depending on action type prefix.
@param {functions} ...reducers List of reducer functions to dispatch.
@return {function} A reducer function that dispatches action to appropriate reducer depending on action type prefix. | [
"Combines",
"reducers",
"into",
"reducer",
"that",
"dispatches",
"action",
"to",
"appropriate",
"reducer",
"depending",
"on",
"action",
"type",
"prefix",
"."
] | b0c59e32e67b232a22d791d7bf477c67f508ae43 | https://github.com/reactbits/make-reducer/blob/b0c59e32e67b232a22d791d7bf477c67f508ae43/lib/index.js#L198-L246 | train |
svanderburg/nijs | lib/ast/NixIf.js | NixIf | function NixIf(args) {
this.ifExpr = args.ifExpr;
this.thenExpr = args.thenExpr;
this.elseExpr = args.elseExpr;
} | javascript | function NixIf(args) {
this.ifExpr = args.ifExpr;
this.thenExpr = args.thenExpr;
this.elseExpr = args.elseExpr;
} | [
"function",
"NixIf",
"(",
"args",
")",
"{",
"this",
".",
"ifExpr",
"=",
"args",
".",
"ifExpr",
";",
"this",
".",
"thenExpr",
"=",
"args",
".",
"thenExpr",
";",
"this",
".",
"elseExpr",
"=",
"args",
".",
"elseExpr",
";",
"}"
] | Creates a new NixIf instance.
@class NixIf
@extends NixBlock
@classdesc Captures the abstract syntax of a Nix of if-then-else statement.
@constructor
@param {Object} args Arguments to this function
@param {Mixed} args.ifExpr An object representing an expression evaluating to a boolean
@param {Mixed} args.thenExpr Exp... | [
"Creates",
"a",
"new",
"NixIf",
"instance",
"."
] | 4e2738cbff3a43aba9297315ca5120cecf8dae3e | https://github.com/svanderburg/nijs/blob/4e2738cbff3a43aba9297315ca5120cecf8dae3e/lib/ast/NixIf.js#L18-L22 | train |
adityamukho/node-box-sdk | lib/api/content/files.js | function (id, version, done, headers, config) {
if (!_.isNumber(parseInt(id, 10))) {
return done(new Error('id must be specified.'));
}
if (!_.isEmpty(version) && !_.isNumber(parseInt(version, 10))) {
return done(new Error('version must be a number.'));
}
thi... | javascript | function (id, version, done, headers, config) {
if (!_.isNumber(parseInt(id, 10))) {
return done(new Error('id must be specified.'));
}
if (!_.isEmpty(version) && !_.isNumber(parseInt(version, 10))) {
return done(new Error('version must be a number.'));
}
thi... | [
"function",
"(",
"id",
",",
"version",
",",
"done",
",",
"headers",
",",
"config",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isNumber",
"(",
"parseInt",
"(",
"id",
",",
"10",
")",
")",
")",
"{",
"return",
"done",
"(",
"new",
"Error",
"(",
"'id must be... | Discards a specific file version to the trash.
@summary Delete an Old Version of a File.
@see {@link https://developers.box.com/docs/#files-delete-version}
@param {number} id - The file's ID.
@param {number} version - File version to promote.
@param {requestCallback} done - The callback to invoke (with possible errors)... | [
"Discards",
"a",
"specific",
"file",
"version",
"to",
"the",
"trash",
"."
] | b8403df59d53ba4e8bed5de3675467544981a683 | https://github.com/adityamukho/node-box-sdk/blob/b8403df59d53ba4e8bed5de3675467544981a683/lib/api/content/files.js#L248-L257 | train | |
Hugo-ter-Doest/chart-parsers | lib/DoubleDottedItem.js | DoubleDottedItem | function DoubleDottedItem(parameters) {
// An identifier is constructed from rule, dots, from and to
this.id = "DoubleDottedItem(" + parameters.rule.lhs + "->" +
parameters.rule.rhs + ", " + parameters.left_dot + ", " +
parameters.right_dot + ", " + parameters.from + ", " + parameters.to +")";
logger.de... | javascript | function DoubleDottedItem(parameters) {
// An identifier is constructed from rule, dots, from and to
this.id = "DoubleDottedItem(" + parameters.rule.lhs + "->" +
parameters.rule.rhs + ", " + parameters.left_dot + ", " +
parameters.right_dot + ", " + parameters.from + ", " + parameters.to +")";
logger.de... | [
"function",
"DoubleDottedItem",
"(",
"parameters",
")",
"{",
"// An identifier is constructed from rule, dots, from and to",
"this",
".",
"id",
"=",
"\"DoubleDottedItem(\"",
"+",
"parameters",
".",
"rule",
".",
"lhs",
"+",
"\"->\"",
"+",
"parameters",
".",
"rule",
"."... | Creates a doubledotted item; left_dot is an index in the RHS of the rule as well as right_dot from is the starting point in the sentence Data structure is prepared for use with InfoVis | [
"Creates",
"a",
"doubledotted",
"item",
";",
"left_dot",
"is",
"an",
"index",
"in",
"the",
"RHS",
"of",
"the",
"rule",
"as",
"well",
"as",
"right_dot",
"from",
"is",
"the",
"starting",
"point",
"in",
"the",
"sentence",
"Data",
"structure",
"is",
"prepared"... | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/DoubleDottedItem.js#L38-L55 | train |
Hugo-ter-Doest/chart-parsers | lib/EarleyItem.js | EarleyItem | function EarleyItem(parameters) {
// A unique identifier is constructed from rule, dot and from
this.id = "Earley(" + parameters.rule.lhs + "->" + parameters.rule.rhs +
", " + parameters.dot + ", " + parameters.from + ", " + parameters.to +")";
logger.debug("EarleyItem: " + this.id);
this.name = parameters... | javascript | function EarleyItem(parameters) {
// A unique identifier is constructed from rule, dot and from
this.id = "Earley(" + parameters.rule.lhs + "->" + parameters.rule.rhs +
", " + parameters.dot + ", " + parameters.from + ", " + parameters.to +")";
logger.debug("EarleyItem: " + this.id);
this.name = parameters... | [
"function",
"EarleyItem",
"(",
"parameters",
")",
"{",
"// A unique identifier is constructed from rule, dot and from",
"this",
".",
"id",
"=",
"\"Earley(\"",
"+",
"parameters",
".",
"rule",
".",
"lhs",
"+",
"\"->\"",
"+",
"parameters",
".",
"rule",
".",
"rhs",
"+... | Creates an item; dot is an index in the RHS of the rule, from is the starting point in the sentence Data structure is prepared for InfoVis | [
"Creates",
"an",
"item",
";",
"dot",
"is",
"an",
"index",
"in",
"the",
"RHS",
"of",
"the",
"rule",
"from",
"is",
"the",
"starting",
"point",
"in",
"the",
"sentence",
"Data",
"structure",
"is",
"prepared",
"for",
"InfoVis"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/EarleyItem.js#L32-L48 | train |
brettz9/jamilih | dist/jml-polyglot.js | _applyAnyStylesheet | function _applyAnyStylesheet(node) {
if (!doc.createStyleSheet) {
return;
}
if (_getHTMLNodeName(node) === 'style') {
// IE
var ss = doc.createStyleSheet(); // Create a stylesheet to actually do something useful
ss.cssText = node.cssText; // We continue to add the style tag, however
}
} | javascript | function _applyAnyStylesheet(node) {
if (!doc.createStyleSheet) {
return;
}
if (_getHTMLNodeName(node) === 'style') {
// IE
var ss = doc.createStyleSheet(); // Create a stylesheet to actually do something useful
ss.cssText = node.cssText; // We continue to add the style tag, however
}
} | [
"function",
"_applyAnyStylesheet",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"doc",
".",
"createStyleSheet",
")",
"{",
"return",
";",
"}",
"if",
"(",
"_getHTMLNodeName",
"(",
"node",
")",
"===",
"'style'",
")",
"{",
"// IE",
"var",
"ss",
"=",
"doc",
".",
... | Apply styles if this is a style tag
@static
@param {Node} node The element to check whether it is a style tag | [
"Apply",
"styles",
"if",
"this",
"is",
"a",
"style",
"tag"
] | 9cf3bef69169b1ea3db574866fb6abcab613a3ed | https://github.com/brettz9/jamilih/blob/9cf3bef69169b1ea3db574866fb6abcab613a3ed/dist/jml-polyglot.js#L765-L776 | train |
brettz9/jamilih | dist/jml-polyglot.js | _appendNode | function _appendNode(parent, child) {
var parentName = _getHTMLNodeName(parent);
var childName = _getHTMLNodeName(child);
if (doc.createStyleSheet) {
if (parentName === 'script') {
parent.text = child.nodeValue;
return;
}
if (parentName === 'style') {
parent.cssText = child.nodeVa... | javascript | function _appendNode(parent, child) {
var parentName = _getHTMLNodeName(parent);
var childName = _getHTMLNodeName(child);
if (doc.createStyleSheet) {
if (parentName === 'script') {
parent.text = child.nodeValue;
return;
}
if (parentName === 'style') {
parent.cssText = child.nodeVa... | [
"function",
"_appendNode",
"(",
"parent",
",",
"child",
")",
"{",
"var",
"parentName",
"=",
"_getHTMLNodeName",
"(",
"parent",
")",
";",
"var",
"childName",
"=",
"_getHTMLNodeName",
"(",
"child",
")",
";",
"if",
"(",
"doc",
".",
"createStyleSheet",
")",
"{... | Need this function for IE since options weren't otherwise getting added
@private
@static
@param {DOMElement} parent The parent to which to append the element
@param {DOMNode} child The element or other node to append to the parent | [
"Need",
"this",
"function",
"for",
"IE",
"since",
"options",
"weren",
"t",
"otherwise",
"getting",
"added"
] | 9cf3bef69169b1ea3db574866fb6abcab613a3ed | https://github.com/brettz9/jamilih/blob/9cf3bef69169b1ea3db574866fb6abcab613a3ed/dist/jml-polyglot.js#L786-L826 | train |
brettz9/jamilih | dist/jml-polyglot.js | _addEvent | function _addEvent(el, type, handler, capturing) {
el.addEventListener(type, handler, !!capturing);
} | javascript | function _addEvent(el, type, handler, capturing) {
el.addEventListener(type, handler, !!capturing);
} | [
"function",
"_addEvent",
"(",
"el",
",",
"type",
",",
"handler",
",",
"capturing",
")",
"{",
"el",
".",
"addEventListener",
"(",
"type",
",",
"handler",
",",
"!",
"!",
"capturing",
")",
";",
"}"
] | Attach event in a cross-browser fashion
@static
@param {DOMElement} el DOM element to which to attach the event
@param {String} type The DOM event (without 'on') to attach to the element
@param {Function} handler The event handler to attach to the element
@param {Boolean} [capturing] Whether or not the event should be
... | [
"Attach",
"event",
"in",
"a",
"cross",
"-",
"browser",
"fashion"
] | 9cf3bef69169b1ea3db574866fb6abcab613a3ed | https://github.com/brettz9/jamilih/blob/9cf3bef69169b1ea3db574866fb6abcab613a3ed/dist/jml-polyglot.js#L838-L840 | train |
brettz9/jamilih | dist/jml-polyglot.js | _createSafeReference | function _createSafeReference(type, prefix, arg) {
// For security reasons related to innerHTML, we ensure this string only contains potential entity characters
if (!arg.match(/^\w+$/)) {
throw new TypeError('Bad ' + type);
}
var elContainer = doc.createElement('div'); // Todo: No workaround for XML?
el... | javascript | function _createSafeReference(type, prefix, arg) {
// For security reasons related to innerHTML, we ensure this string only contains potential entity characters
if (!arg.match(/^\w+$/)) {
throw new TypeError('Bad ' + type);
}
var elContainer = doc.createElement('div'); // Todo: No workaround for XML?
el... | [
"function",
"_createSafeReference",
"(",
"type",
",",
"prefix",
",",
"arg",
")",
"{",
"// For security reasons related to innerHTML, we ensure this string only contains potential entity characters",
"if",
"(",
"!",
"arg",
".",
"match",
"(",
"/",
"^\\w+$",
"/",
")",
")",
... | Creates a text node of the result of resolving an entity or character reference
@param {'entity'|'decimal'|'hexadecimal'} type Type of reference
@param {String} prefix Text to prefix immediately after the "&"
@param {String} arg The body of the reference
@returns {Text} The text node of the resolved reference | [
"Creates",
"a",
"text",
"node",
"of",
"the",
"result",
"of",
"resolving",
"an",
"entity",
"or",
"character",
"reference"
] | 9cf3bef69169b1ea3db574866fb6abcab613a3ed | https://github.com/brettz9/jamilih/blob/9cf3bef69169b1ea3db574866fb6abcab613a3ed/dist/jml-polyglot.js#L850-L860 | train |
brettz9/jamilih | dist/jml-polyglot.js | glue | function glue(jmlArray, glu) {
return _toConsumableArray(jmlArray).reduce(function (arr, item) {
arr.push(item, glu);
return arr;
}, []).slice(0, -1);
} | javascript | function glue(jmlArray, glu) {
return _toConsumableArray(jmlArray).reduce(function (arr, item) {
arr.push(item, glu);
return arr;
}, []).slice(0, -1);
} | [
"function",
"glue",
"(",
"jmlArray",
",",
"glu",
")",
"{",
"return",
"_toConsumableArray",
"(",
"jmlArray",
")",
".",
"reduce",
"(",
"function",
"(",
"arr",
",",
"item",
")",
"{",
"arr",
".",
"push",
"(",
"item",
",",
"glu",
")",
";",
"return",
"arr"... | Does not run Jamilih so can be further processed.
@param {Array} jmlArray
@param {string|Array|Element} glu
@returns {Element} | [
"Does",
"not",
"run",
"Jamilih",
"so",
"can",
"be",
"further",
"processed",
"."
] | 9cf3bef69169b1ea3db574866fb6abcab613a3ed | https://github.com/brettz9/jamilih/blob/9cf3bef69169b1ea3db574866fb6abcab613a3ed/dist/jml-polyglot.js#L2476-L2481 | train |
patrinhani-ciandt/fortune-datastore | lib/helpers.js | inputRecord | function inputRecord (type, record) {
const clone = {};
const recordTypes = this.recordTypes;
const primaryKey = this.keys.primary;
const isArrayKey = this.keys.isArray;
const generateId = this.options.generateId;
const fields = recordTypes[type];
// ID business.
const id = record[primaryKey];
clone[... | javascript | function inputRecord (type, record) {
const clone = {};
const recordTypes = this.recordTypes;
const primaryKey = this.keys.primary;
const isArrayKey = this.keys.isArray;
const generateId = this.options.generateId;
const fields = recordTypes[type];
// ID business.
const id = record[primaryKey];
clone[... | [
"function",
"inputRecord",
"(",
"type",
",",
"record",
")",
"{",
"const",
"clone",
"=",
"{",
"}",
";",
"const",
"recordTypes",
"=",
"this",
".",
"recordTypes",
";",
"const",
"primaryKey",
"=",
"this",
".",
"keys",
".",
"primary",
";",
"const",
"isArrayKe... | Cast and assign values per field definition. | [
"Cast",
"and",
"assign",
"values",
"per",
"field",
"definition",
"."
] | 63dee9093412d1d68481297f4480e2439ddb9a4a | https://github.com/patrinhani-ciandt/fortune-datastore/blob/63dee9093412d1d68481297f4480e2439ddb9a4a/lib/helpers.js#L8-L30 | train |
thealjey/webcompiler | lib/jsx.js | parseHTML | function parseHTML(html) {
const dom = (0, _cheerio.load)(html),
{ children } = dom.root().toArray()[0];
return { dom, children };
} | javascript | function parseHTML(html) {
const dom = (0, _cheerio.load)(html),
{ children } = dom.root().toArray()[0];
return { dom, children };
} | [
"function",
"parseHTML",
"(",
"html",
")",
"{",
"const",
"dom",
"=",
"(",
"0",
",",
"_cheerio",
".",
"load",
")",
"(",
"html",
")",
",",
"{",
"children",
"}",
"=",
"dom",
".",
"root",
"(",
")",
".",
"toArray",
"(",
")",
"[",
"0",
"]",
";",
"r... | Useful utilities for working with JSX.
@module jsx
Parses an HTML string.
@memberof module:jsx
@private
@method parseHTML
@param {string} html - an arbitrary HTML string
@return {Object} an object containing a CheerioDOM object and a CheerioCollection of the `pre.CodeMirror-line`
elements | [
"Useful",
"utilities",
"for",
"working",
"with",
"JSX",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/jsx.js#L84-L89 | train |
thealjey/webcompiler | lib/jsx.js | toJSXKey | function toJSXKey(key) {
return (0, _replace2.default)(/^-ms-/.test(key) ? key.substr(1) : key, /-(.)/g, (match, chr) => (0, _toUpper2.default)(chr));
} | javascript | function toJSXKey(key) {
return (0, _replace2.default)(/^-ms-/.test(key) ? key.substr(1) : key, /-(.)/g, (match, chr) => (0, _toUpper2.default)(chr));
} | [
"function",
"toJSXKey",
"(",
"key",
")",
"{",
"return",
"(",
"0",
",",
"_replace2",
".",
"default",
")",
"(",
"/",
"^-ms-",
"/",
".",
"test",
"(",
"key",
")",
"?",
"key",
".",
"substr",
"(",
"1",
")",
":",
"key",
",",
"/",
"-(.)",
"/",
"g",
"... | Convert the CSS style key to a JSX style key.
@memberof module:jsx
@private
@method toJSXKey
@param {string} key - CSS style key
@return {string} JSX style key | [
"Convert",
"the",
"CSS",
"style",
"key",
"to",
"a",
"JSX",
"style",
"key",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/jsx.js#L100-L102 | train |
thealjey/webcompiler | lib/jsx.js | transformStyle | function transformStyle(object) {
if ((0, _has2.default)(object, 'style')) {
object.style = (0, _transform2.default)((0, _split2.default)(object.style, ';'), (result, style) => {
const firstColon = style.indexOf(':'),
key = (0, _trim2.default)(style.substr(0, firstColon));
if (key) {
... | javascript | function transformStyle(object) {
if ((0, _has2.default)(object, 'style')) {
object.style = (0, _transform2.default)((0, _split2.default)(object.style, ';'), (result, style) => {
const firstColon = style.indexOf(':'),
key = (0, _trim2.default)(style.substr(0, firstColon));
if (key) {
... | [
"function",
"transformStyle",
"(",
"object",
")",
"{",
"if",
"(",
"(",
"0",
",",
"_has2",
".",
"default",
")",
"(",
"object",
",",
"'style'",
")",
")",
"{",
"object",
".",
"style",
"=",
"(",
"0",
",",
"_transform2",
".",
"default",
")",
"(",
"(",
... | Parse the specified inline style attribute value.
@memberof module:jsx
@private
@method transformStyle
@param {Object} object - the object to perform replacements on | [
"Parse",
"the",
"specified",
"inline",
"style",
"attribute",
"value",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/jsx.js#L112-L123 | train |
thealjey/webcompiler | lib/jsx.js | rename | function rename(object, fromKey, toKey) {
if ((0, _has2.default)(object, fromKey)) {
object[toKey] = object[fromKey];
delete object[fromKey];
}
} | javascript | function rename(object, fromKey, toKey) {
if ((0, _has2.default)(object, fromKey)) {
object[toKey] = object[fromKey];
delete object[fromKey];
}
} | [
"function",
"rename",
"(",
"object",
",",
"fromKey",
",",
"toKey",
")",
"{",
"if",
"(",
"(",
"0",
",",
"_has2",
".",
"default",
")",
"(",
"object",
",",
"fromKey",
")",
")",
"{",
"object",
"[",
"toKey",
"]",
"=",
"object",
"[",
"fromKey",
"]",
";... | Renames specified attributes if present.
@memberof module:jsx
@private
@method rename
@param {Object} object - the object to perform replacements on
@param {string} fromKey - a key to look for
@param {string} toKey - a key to rename to | [
"Renames",
"specified",
"attributes",
"if",
"present",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/jsx.js#L135-L140 | train |
thealjey/webcompiler | lib/jsx.js | transformElement | function transformElement({ name: type, attribs: props, children: childElements }) {
transformStyle(props);
rename(props, 'for', 'htmlFor');
rename(props, 'class', 'className');
if ('input' === type) {
rename(props, 'checked', 'defaultChecked');
rename(props, 'value', 'defaultValue');
}
let children... | javascript | function transformElement({ name: type, attribs: props, children: childElements }) {
transformStyle(props);
rename(props, 'for', 'htmlFor');
rename(props, 'class', 'className');
if ('input' === type) {
rename(props, 'checked', 'defaultChecked');
rename(props, 'value', 'defaultValue');
}
let children... | [
"function",
"transformElement",
"(",
"{",
"name",
":",
"type",
",",
"attribs",
":",
"props",
",",
"children",
":",
"childElements",
"}",
")",
"{",
"transformStyle",
"(",
"props",
")",
";",
"rename",
"(",
"props",
",",
"'for'",
",",
"'htmlFor'",
")",
";",... | Converts a Cheerio Element into an object that can later be used to create a React Element.
@memberof module:jsx
@private
@method transformElement
@param {Object} element - a Cheerio Element
@return {Object} a plain object describing a React Element | [
"Converts",
"a",
"Cheerio",
"Element",
"into",
"an",
"object",
"that",
"can",
"later",
"be",
"used",
"to",
"create",
"a",
"React",
"Element",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/jsx.js#L151-L167 | train |
thealjey/webcompiler | lib/jsx.js | flatten | function flatten(...args) {
return (0, _transform2.default)((0, _flattenDeep2.default)(args), (accumulator, value) => {
if (!value) {
return;
}
const lastIndex = accumulator.length - 1;
if ((0, _isString2.default)(value) && (0, _isString2.default)(accumulator[lastIndex])) {
accumulator[la... | javascript | function flatten(...args) {
return (0, _transform2.default)((0, _flattenDeep2.default)(args), (accumulator, value) => {
if (!value) {
return;
}
const lastIndex = accumulator.length - 1;
if ((0, _isString2.default)(value) && (0, _isString2.default)(accumulator[lastIndex])) {
accumulator[la... | [
"function",
"flatten",
"(",
"...",
"args",
")",
"{",
"return",
"(",
"0",
",",
"_transform2",
".",
"default",
")",
"(",
"(",
"0",
",",
"_flattenDeep2",
".",
"default",
")",
"(",
"args",
")",
",",
"(",
"accumulator",
",",
"value",
")",
"=>",
"{",
"if... | Recursively flattens `args`, removes falsy values and combines string values.
Can be used as a simple optimization step on the JSX children-to-be to simplify the resulting DOM structure by
joining adjacent text nodes together.
@memberof module:jsx
@method flatten
@param {...*} args - the input values
@return {Array<*... | [
"Recursively",
"flattens",
"args",
"removes",
"falsy",
"values",
"and",
"combines",
"string",
"values",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/jsx.js#L201-L214 | train |
thealjey/webcompiler | lib/jsx.js | arrayToJSX | function arrayToJSX(arr = []) {
return (0, _map2.default)(arr, (el, key) => {
if ((0, _isString2.default)(el)) {
return el;
}
const { type, props, children } = el;
return (0, _react.createElement)(type, _extends({}, props, { key }), ...arrayToJSX(children));
});
} | javascript | function arrayToJSX(arr = []) {
return (0, _map2.default)(arr, (el, key) => {
if ((0, _isString2.default)(el)) {
return el;
}
const { type, props, children } = el;
return (0, _react.createElement)(type, _extends({}, props, { key }), ...arrayToJSX(children));
});
} | [
"function",
"arrayToJSX",
"(",
"arr",
"=",
"[",
"]",
")",
"{",
"return",
"(",
"0",
",",
"_map2",
".",
"default",
")",
"(",
"arr",
",",
"(",
"el",
",",
"key",
")",
"=>",
"{",
"if",
"(",
"(",
"0",
",",
"_isString2",
".",
"default",
")",
"(",
"e... | Converts an array of plain objects describing React Elements to an array of React Elements.
@memberof module:jsx
@method arrayToJSX
@param {Array<string|Object>} [arr=[]] - an array of plain objects describing React Elements
@return {Array<ReactElement>} an array of React Elements
@example
import {arrayToJSX} from 'we... | [
"Converts",
"an",
"array",
"of",
"plain",
"objects",
"describing",
"React",
"Elements",
"to",
"an",
"array",
"of",
"React",
"Elements",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/jsx.js#L231-L240 | train |
CocktailJS/cocktail | lib/processor/annotation/Merge.js | function (mine, their, strategy) {
this._doMerge(mine, their, function(key){
if (typeof their[key] === 'object') {
if (their[key] instanceof Array) {
mine[key] = [].concat(mine[key], their[key]);
} else {
mine[key] = this[strate... | javascript | function (mine, their, strategy) {
this._doMerge(mine, their, function(key){
if (typeof their[key] === 'object') {
if (their[key] instanceof Array) {
mine[key] = [].concat(mine[key], their[key]);
} else {
mine[key] = this[strate... | [
"function",
"(",
"mine",
",",
"their",
",",
"strategy",
")",
"{",
"this",
".",
"_doMerge",
"(",
"mine",
",",
"their",
",",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"typeof",
"their",
"[",
"key",
"]",
"===",
"'object'",
")",
"{",
"if",
"(",
"t... | runs the deep merge using the given strategy | [
"runs",
"the",
"deep",
"merge",
"using",
"the",
"given",
"strategy"
] | 0c963d8afa18d6387c5fae29f5749cd51efc04aa | https://github.com/CocktailJS/cocktail/blob/0c963d8afa18d6387c5fae29f5749cd51efc04aa/lib/processor/annotation/Merge.js#L116-L130 | train | |
freakimkaefig/musicjson2abc | lib/abc_parser/index.js | function(line, curr_pos)
{
var ret = tokenizer.getBarLine(line, curr_pos);
if (ret.len === 0)
return [0,""];
if (ret.warn) {
warn(ret.warn, line, curr_pos);
return [ret.len,""];
}
// Now see if this is a repeated ending
// A repeated ending is all of the characters 1,2,3,4,5... | javascript | function(line, curr_pos)
{
var ret = tokenizer.getBarLine(line, curr_pos);
if (ret.len === 0)
return [0,""];
if (ret.warn) {
warn(ret.warn, line, curr_pos);
return [ret.len,""];
}
// Now see if this is a repeated ending
// A repeated ending is all of the characters 1,2,3,4,5... | [
"function",
"(",
"line",
",",
"curr_pos",
")",
"{",
"var",
"ret",
"=",
"tokenizer",
".",
"getBarLine",
"(",
"line",
",",
"curr_pos",
")",
";",
"if",
"(",
"ret",
".",
"len",
"===",
"0",
")",
"return",
"[",
"0",
",",
"\"\"",
"]",
";",
"if",
"(",
... | returns the class of the bar line the number of the repeat and the number of characters used up if 0 is returned, then the next element was not a bar line | [
"returns",
"the",
"class",
"of",
"the",
"bar",
"line",
"the",
"number",
"of",
"the",
"repeat",
"and",
"the",
"number",
"of",
"characters",
"used",
"up",
"if",
"0",
"is",
"returned",
"then",
"the",
"next",
"element",
"was",
"not",
"a",
"bar",
"line"
] | c119c7927c3c9b6aa5f3558cc73990478472dfbb | https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/lib/abc_parser/index.js#L308-L340 | train | |
freakimkaefig/musicjson2abc | lib/abc_parser/index.js | function(all, backslash, comment){
var spaces = " ";
var padding = comment ? spaces.substring(0, comment.length)... | javascript | function(all, backslash, comment){
var spaces = " ";
var padding = comment ? spaces.substring(0, comment.length)... | [
"function",
"(",
"all",
",",
"backslash",
",",
"comment",
")",
"{",
"var",
"spaces",
"=",
"\" \"... | get rid of latex commands. | [
"get",
"rid",
"of",
"latex",
"commands",
"."
] | c119c7927c3c9b6aa5f3558cc73990478472dfbb | https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/lib/abc_parser/index.js#L1407-L1411 | train | |
Zerg00s/spforms | src/Templates/App/directives/commonDirectives.js | function (attachment) {
// Define custom metadata properties for the file before saving
var customFileMetadata = {};
var parentItemId = model.getParentItemId();
if (parentItemId && parentItemId != '') customFileMetadata[scope.attachmentFilt... | javascript | function (attachment) {
// Define custom metadata properties for the file before saving
var customFileMetadata = {};
var parentItemId = model.getParentItemId();
if (parentItemId && parentItemId != '') customFileMetadata[scope.attachmentFilt... | [
"function",
"(",
"attachment",
")",
"{",
"// Define custom metadata properties for the file before saving",
"var",
"customFileMetadata",
"=",
"{",
"}",
";",
"var",
"parentItemId",
"=",
"model",
".",
"getParentItemId",
"(",
")",
";",
"if",
"(",
"parentItemId",
"&&",
... | Upload the file. You can upload files up to 2 GB with the REST API. | [
"Upload",
"the",
"file",
".",
"You",
"can",
"upload",
"files",
"up",
"to",
"2",
"GB",
"with",
"the",
"REST",
"API",
"."
] | f8eaa19eeefa6ca7a3664138b76744f9c1d9ecec | https://github.com/Zerg00s/spforms/blob/f8eaa19eeefa6ca7a3664138b76744f9c1d9ecec/src/Templates/App/directives/commonDirectives.js#L116-L124 | train | |
bitinn/decent | lib/decent.js | Queue | function Queue(name, opts) {
// allow call as function
if (!(this instanceof Queue))
return new Queue(name, opts);
if (!name) {
throw new Error('queue name is required');
}
opts = opts || {};
// basic
this.name = name;
this.port = opts.port || 6379;
this.host = opts.host || '127.0.0.1';
// queue conf... | javascript | function Queue(name, opts) {
// allow call as function
if (!(this instanceof Queue))
return new Queue(name, opts);
if (!name) {
throw new Error('queue name is required');
}
opts = opts || {};
// basic
this.name = name;
this.port = opts.port || 6379;
this.host = opts.host || '127.0.0.1';
// queue conf... | [
"function",
"Queue",
"(",
"name",
",",
"opts",
")",
"{",
"// allow call as function",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Queue",
")",
")",
"return",
"new",
"Queue",
"(",
"name",
",",
"opts",
")",
";",
"if",
"(",
"!",
"name",
")",
"{",
"throw... | Create an instance of Queue
@param String name Name of this queue
@param Object opts Redis options
@return Object | [
"Create",
"an",
"instance",
"of",
"Queue"
] | 410f24a71161ccacb7ff7cc11d3976bd039f434a | https://github.com/bitinn/decent/blob/410f24a71161ccacb7ff7cc11d3976bd039f434a/lib/decent.js#L25-L70 | train |
reklatsmasters/ip2buf | lib/pton4.js | pton4 | function pton4(addr, dest, index = 0) {
if (typeof addr !== 'string') {
throw new TypeError('Argument 1 should be a string.')
}
if (arguments.length >= 3) {
if (typeof index !== 'number') {
throw new TypeError('Argument 3 should be a Number.')
}
}
const isbuffer = Buffer.isBuffer(dest)
... | javascript | function pton4(addr, dest, index = 0) {
if (typeof addr !== 'string') {
throw new TypeError('Argument 1 should be a string.')
}
if (arguments.length >= 3) {
if (typeof index !== 'number') {
throw new TypeError('Argument 3 should be a Number.')
}
}
const isbuffer = Buffer.isBuffer(dest)
... | [
"function",
"pton4",
"(",
"addr",
",",
"dest",
",",
"index",
"=",
"0",
")",
"{",
"if",
"(",
"typeof",
"addr",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'Argument 1 should be a string.'",
")",
"}",
"if",
"(",
"arguments",
".",
"lengt... | Convert IPv4 to the Buffer.
@param {string} addr
@param {Buffer} [dest]
@param {number} [index=0]
@returns {Buffer} | [
"Convert",
"IPv4",
"to",
"the",
"Buffer",
"."
] | 439c55cc7605423929808d42a29b9cd284914cd6 | https://github.com/reklatsmasters/ip2buf/blob/439c55cc7605423929808d42a29b9cd284914cd6/lib/pton4.js#L17-L84 | train |
looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | BufferGeometry | function BufferGeometry() {
Object.defineProperty( this, 'id', { value: bufferGeometryId += 2 } );
this.uuid = _Math.generateUUID();
this.name = '';
this.type = 'BufferGeometry';
this.index = null;
this.attributes = {};
this.morphAttributes = {};
this.groups = [];
this.boundingBox = null;
this.bounding... | javascript | function BufferGeometry() {
Object.defineProperty( this, 'id', { value: bufferGeometryId += 2 } );
this.uuid = _Math.generateUUID();
this.name = '';
this.type = 'BufferGeometry';
this.index = null;
this.attributes = {};
this.morphAttributes = {};
this.groups = [];
this.boundingBox = null;
this.bounding... | [
"function",
"BufferGeometry",
"(",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"this",
",",
"'id'",
",",
"{",
"value",
":",
"bufferGeometryId",
"+=",
"2",
"}",
")",
";",
"this",
".",
"uuid",
"=",
"_Math",
".",
"generateUUID",
"(",
")",
";",
"this",... | BufferGeometry uses odd numbers as Id | [
"BufferGeometry",
"uses",
"odd",
"numbers",
"as",
"Id"
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L11161-L11184 | train |
looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | getSingularSetter | function getSingularSetter( type ) {
switch ( type ) {
case 0x1406: return setValue1f; // FLOAT
case 0x8b50: return setValue2fv; // _VEC2
case 0x8b51: return setValue3fv; // _VEC3
case 0x8b52: return setValue4fv; // _VEC4
case 0x8b5a: return setValue2fm; // _MAT2
case 0x8b5b: return setValue3fm; // _MAT... | javascript | function getSingularSetter( type ) {
switch ( type ) {
case 0x1406: return setValue1f; // FLOAT
case 0x8b50: return setValue2fv; // _VEC2
case 0x8b51: return setValue3fv; // _VEC3
case 0x8b52: return setValue4fv; // _VEC4
case 0x8b5a: return setValue2fm; // _MAT2
case 0x8b5b: return setValue3fm; // _MAT... | [
"function",
"getSingularSetter",
"(",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"0x1406",
":",
"return",
"setValue1f",
";",
"// FLOAT",
"case",
"0x8b50",
":",
"return",
"setValue2fv",
";",
"// _VEC2",
"case",
"0x8b51",
":",
"return",
"setVal... | Helper to pick the right setter for the singular case | [
"Helper",
"to",
"pick",
"the",
"right",
"setter",
"for",
"the",
"singular",
"case"
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L16194-L16218 | train |
looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | setValue1fv | function setValue1fv( gl, v ) {
var cache = this.cache;
if ( arraysEqual( cache, v ) ) return;
gl.uniform1fv( this.addr, v );
copyArray( cache, v );
} | javascript | function setValue1fv( gl, v ) {
var cache = this.cache;
if ( arraysEqual( cache, v ) ) return;
gl.uniform1fv( this.addr, v );
copyArray( cache, v );
} | [
"function",
"setValue1fv",
"(",
"gl",
",",
"v",
")",
"{",
"var",
"cache",
"=",
"this",
".",
"cache",
";",
"if",
"(",
"arraysEqual",
"(",
"cache",
",",
"v",
")",
")",
"return",
";",
"gl",
".",
"uniform1fv",
"(",
"this",
".",
"addr",
",",
"v",
")",... | Array of scalars | [
"Array",
"of",
"scalars"
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L16222-L16232 | train |
looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | CubicInterpolant | function CubicInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
this._weightPrev = - 0;
this._offsetPrev = - 0;
this._weightNext = - 0;
this._offsetNext = - 0;
} | javascript | function CubicInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
this._weightPrev = - 0;
this._offsetPrev = - 0;
this._weightNext = - 0;
this._offsetNext = - 0;
} | [
"function",
"CubicInterpolant",
"(",
"parameterPositions",
",",
"sampleValues",
",",
"sampleSize",
",",
"resultBuffer",
")",
"{",
"Interpolant",
".",
"call",
"(",
"this",
",",
"parameterPositions",
",",
"sampleValues",
",",
"sampleSize",
",",
"resultBuffer",
")",
... | Fast and simple cubic spline interpolant.
It was derived from a Hermitian construction setting the first derivative
at each sample position to the linear slope between neighboring positions
over their parameter interval.
@author tschw | [
"Fast",
"and",
"simple",
"cubic",
"spline",
"interpolant",
"."
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L32339-L32348 | train |
looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | function () {
var valid = true;
var valueSize = this.getValueSize();
if ( valueSize - Math.floor( valueSize ) !== 0 ) {
console.error( 'THREE.KeyframeTrack: Invalid value size in track.', this );
valid = false;
}
var times = this.times,
values = this.values,
nKeys = times.length;
if ( nKe... | javascript | function () {
var valid = true;
var valueSize = this.getValueSize();
if ( valueSize - Math.floor( valueSize ) !== 0 ) {
console.error( 'THREE.KeyframeTrack: Invalid value size in track.', this );
valid = false;
}
var times = this.times,
values = this.values,
nKeys = times.length;
if ( nKe... | [
"function",
"(",
")",
"{",
"var",
"valid",
"=",
"true",
";",
"var",
"valueSize",
"=",
"this",
".",
"getValueSize",
"(",
")",
";",
"if",
"(",
"valueSize",
"-",
"Math",
".",
"floor",
"(",
"valueSize",
")",
"!==",
"0",
")",
"{",
"console",
".",
"error... | ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable | [
"ensure",
"we",
"do",
"not",
"get",
"a",
"GarbageInGarbageOut",
"situation",
"make",
"sure",
"tracks",
"are",
"at",
"least",
"minimally",
"viable"
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L32804-L32878 | train | |
looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | QuaternionLinearInterpolant | function QuaternionLinearInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
} | javascript | function QuaternionLinearInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
} | [
"function",
"QuaternionLinearInterpolant",
"(",
"parameterPositions",
",",
"sampleValues",
",",
"sampleSize",
",",
"resultBuffer",
")",
"{",
"Interpolant",
".",
"call",
"(",
"this",
",",
"parameterPositions",
",",
"sampleValues",
",",
"sampleSize",
",",
"resultBuffer"... | Spherical linear unit quaternion interpolant.
@author tschw | [
"Spherical",
"linear",
"unit",
"quaternion",
"interpolant",
"."
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L33086-L33090 | train |
looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | function ( animation, bones ) {
if ( ! animation ) {
console.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );
return null;
}
var addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {
// only return track if there are actually keys.
if ( a... | javascript | function ( animation, bones ) {
if ( ! animation ) {
console.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );
return null;
}
var addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {
// only return track if there are actually keys.
if ( a... | [
"function",
"(",
"animation",
",",
"bones",
")",
"{",
"if",
"(",
"!",
"animation",
")",
"{",
"console",
".",
"error",
"(",
"'THREE.AnimationClip: No animation in JSONLoader data.'",
")",
";",
"return",
"null",
";",
"}",
"var",
"addNonemptyTrack",
"=",
"function"... | parse the animation.hierarchy format | [
"parse",
"the",
"animation",
".",
"hierarchy",
"format"
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L33468-L33589 | train | |
looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | function ( clip, optionalRoot ) {
var root = optionalRoot || this._root,
rootUuid = root.uuid,
clipObject = typeof clip === 'string' ?
AnimationClip.findByName( root, clip ) : clip,
clipUuid = clipObject ? clipObject.uuid : clip,
actionsForClip = this._actionsByClip[ clipUuid ];
if ( actionsFor... | javascript | function ( clip, optionalRoot ) {
var root = optionalRoot || this._root,
rootUuid = root.uuid,
clipObject = typeof clip === 'string' ?
AnimationClip.findByName( root, clip ) : clip,
clipUuid = clipObject ? clipObject.uuid : clip,
actionsForClip = this._actionsByClip[ clipUuid ];
if ( actionsFor... | [
"function",
"(",
"clip",
",",
"optionalRoot",
")",
"{",
"var",
"root",
"=",
"optionalRoot",
"||",
"this",
".",
"_root",
",",
"rootUuid",
"=",
"root",
".",
"uuid",
",",
"clipObject",
"=",
"typeof",
"clip",
"===",
"'string'",
"?",
"AnimationClip",
".",
"fi... | get an existing action | [
"get",
"an",
"existing",
"action"
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L42945-L42965 | train | |
looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | function ( deltaTime ) {
deltaTime *= this.timeScale;
var actions = this._actions,
nActions = this._nActiveActions,
time = this.time += deltaTime,
timeDirection = Math.sign( deltaTime ),
accuIndex = this._accuIndex ^= 1;
// run active actions
for ( var i = 0; i !== nActions; ++ i ) {
var a... | javascript | function ( deltaTime ) {
deltaTime *= this.timeScale;
var actions = this._actions,
nActions = this._nActiveActions,
time = this.time += deltaTime,
timeDirection = Math.sign( deltaTime ),
accuIndex = this._accuIndex ^= 1;
// run active actions
for ( var i = 0; i !== nActions; ++ i ) {
var a... | [
"function",
"(",
"deltaTime",
")",
"{",
"deltaTime",
"*=",
"this",
".",
"timeScale",
";",
"var",
"actions",
"=",
"this",
".",
"_actions",
",",
"nActions",
"=",
"this",
".",
"_nActiveActions",
",",
"time",
"=",
"this",
".",
"time",
"+=",
"deltaTime",
",",... | advance the time and update apply the animation | [
"advance",
"the",
"time",
"and",
"update",
"apply",
"the",
"animation"
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L42995-L43030 | train | |
ifraixedes/node-hmac-validator | src/hmac-validator.js | checkConfig | function checkConfig(config) {
let requiredProps = ['algorithm', 'format'];
const errMsg = `Configuration isn't an object with the required properties: ${requiredProps.join(', ')}`;
if ((!config) || (typeof config !== 'object')) {
throw new Error(errMsg);
}
requiredProps.forEach(p => {
if (!config[p... | javascript | function checkConfig(config) {
let requiredProps = ['algorithm', 'format'];
const errMsg = `Configuration isn't an object with the required properties: ${requiredProps.join(', ')}`;
if ((!config) || (typeof config !== 'object')) {
throw new Error(errMsg);
}
requiredProps.forEach(p => {
if (!config[p... | [
"function",
"checkConfig",
"(",
"config",
")",
"{",
"let",
"requiredProps",
"=",
"[",
"'algorithm'",
",",
"'format'",
"]",
";",
"const",
"errMsg",
"=",
"`",
"${",
"requiredProps",
".",
"join",
"(",
"', '",
")",
"}",
"`",
";",
"if",
"(",
"(",
"!",
"co... | Makes basic checks on Hmac validator configuration like required parameters.
@param {Object} config - The configuration used to create a new Hmac validator
@throws {Error} When one of the checks fails | [
"Makes",
"basic",
"checks",
"on",
"Hmac",
"validator",
"configuration",
"like",
"required",
"parameters",
"."
] | 995c0d17ca0acd2bfcad895b2dde9a6c833fb570 | https://github.com/ifraixedes/node-hmac-validator/blob/995c0d17ca0acd2bfcad895b2dde9a6c833fb570/src/hmac-validator.js#L79-L92 | train |
iamso/u.js | dist/u.packed.js | function(arg) {
return /^f/.test(typeof arg) ? /c/.test(document.readyState) ? arg() : u._defInit.push(arg) : new Init(arg);
} | javascript | function(arg) {
return /^f/.test(typeof arg) ? /c/.test(document.readyState) ? arg() : u._defInit.push(arg) : new Init(arg);
} | [
"function",
"(",
"arg",
")",
"{",
"return",
"/",
"^f",
"/",
".",
"test",
"(",
"typeof",
"arg",
")",
"?",
"/",
"c",
"/",
".",
"test",
"(",
"document",
".",
"readyState",
")",
"?",
"arg",
"(",
")",
":",
"u",
".",
"_defInit",
".",
"push",
"(",
"... | u main function
@param {(string|object|function)} arg - selector, dom element or function
@return {(object|undefined)} instance or execute function on dom ready | [
"u",
"main",
"function"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L41-L43 | train | |
iamso/u.js | dist/u.packed.js | function(event, selector, handler, fn) {
if (/^f/.test(typeof selector)) {
handler = selector;
fn = handler;
}
else if (/^s/.test(typeof selector)) {
fn = handler;
handler = function(e) {
var element;
if (u(e.target).is(selector)) {
eleme... | javascript | function(event, selector, handler, fn) {
if (/^f/.test(typeof selector)) {
handler = selector;
fn = handler;
}
else if (/^s/.test(typeof selector)) {
fn = handler;
handler = function(e) {
var element;
if (u(e.target).is(selector)) {
eleme... | [
"function",
"(",
"event",
",",
"selector",
",",
"handler",
",",
"fn",
")",
"{",
"if",
"(",
"/",
"^f",
"/",
".",
"test",
"(",
"typeof",
"selector",
")",
")",
"{",
"handler",
"=",
"selector",
";",
"fn",
"=",
"handler",
";",
"}",
"else",
"if",
"(",
... | one method
add one time event listeners to elements
@param {string} event - event type i.e 'click'
@param {function} handler - event handler function
@return {object} this | [
"one",
"method",
"add",
"one",
"time",
"event",
"listeners",
"to",
"elements"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L724-L755 | train | |
iamso/u.js | dist/u.packed.js | function(event, selector, handler, fn) {
if (/^f/.test(typeof selector)) {
handler = selector;
}
fn = handler;
return this.each(function(index, el) {
var events = event.split(' ');
u.each(events, function(i, event, origEvent){
origEvent = u._events.remove(el, ev... | javascript | function(event, selector, handler, fn) {
if (/^f/.test(typeof selector)) {
handler = selector;
}
fn = handler;
return this.each(function(index, el) {
var events = event.split(' ');
u.each(events, function(i, event, origEvent){
origEvent = u._events.remove(el, ev... | [
"function",
"(",
"event",
",",
"selector",
",",
"handler",
",",
"fn",
")",
"{",
"if",
"(",
"/",
"^f",
"/",
".",
"test",
"(",
"typeof",
"selector",
")",
")",
"{",
"handler",
"=",
"selector",
";",
"}",
"fn",
"=",
"handler",
";",
"return",
"this",
"... | off method
remove event listeners from elements
@param {string} event - event type i.e 'click'
@param {function} handler - event handler function
@return {object} this | [
"off",
"method",
"remove",
"event",
"listeners",
"from",
"elements"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L765-L778 | train | |
iamso/u.js | dist/u.packed.js | function(e, data, evt) {
if (/^f/.test(typeof CustomEvent)) {
evt = new CustomEvent(e, {
detail: data,
bubbles: true,
cancelable: false
});
}
else {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(e, true, false, data);
... | javascript | function(e, data, evt) {
if (/^f/.test(typeof CustomEvent)) {
evt = new CustomEvent(e, {
detail: data,
bubbles: true,
cancelable: false
});
}
else {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(e, true, false, data);
... | [
"function",
"(",
"e",
",",
"data",
",",
"evt",
")",
"{",
"if",
"(",
"/",
"^f",
"/",
".",
"test",
"(",
"typeof",
"CustomEvent",
")",
")",
"{",
"evt",
"=",
"new",
"CustomEvent",
"(",
"e",
",",
"{",
"detail",
":",
"data",
",",
"bubbles",
":",
"tru... | trigger method
trigger an event for an element
@param {string} e - event name
@param {string} [data] - custom data
@param {string} evt - placeholder for the event object
@return {object} this | [
"trigger",
"method",
"trigger",
"an",
"event",
"for",
"an",
"element"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L789-L806 | train | |
iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? (this[0].scrollTop !== undefined ? this[0].scrollTop : (this[0].scrollY || this[0].pageYOffset)) : 0) : this.each(function(index, el) {
el.scrollTop === undefined || el.scrollTo !== undefined ? el.scrollTo(0, val) : el.scrollTop = val;
});
... | javascript | function(val) {
return val === undefined ? (this.length ? (this[0].scrollTop !== undefined ? this[0].scrollTop : (this[0].scrollY || this[0].pageYOffset)) : 0) : this.each(function(index, el) {
el.scrollTop === undefined || el.scrollTo !== undefined ? el.scrollTo(0, val) : el.scrollTop = val;
});
... | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"(",
"this",
"[",
"0",
"]",
".",
"scrollTop",
"!==",
"undefined",
"?",
"this",
"[",
"0",
"]",
".",
"scrollTop",
":",
"(",
"this",
"[",
"0... | scrollTop method
get or set element scrollTop
@param {number} [val] - new scrollTop
@return {number} scrollTop | [
"scrollTop",
"method",
"get",
"or",
"set",
"element",
"scrollTop"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L856-L860 | train | |
iamso/u.js | dist/u.packed.js | function(to, duration, callback) {
return this.each(function(index, el) {
var _el = u(el),
start = _el.scrollTop(),
change = to - start,
currentTime = 0,
increment = 20;
duration = duration || 1500;
function easing(t, b, c, d) {
t ... | javascript | function(to, duration, callback) {
return this.each(function(index, el) {
var _el = u(el),
start = _el.scrollTop(),
change = to - start,
currentTime = 0,
increment = 20;
duration = duration || 1500;
function easing(t, b, c, d) {
t ... | [
"function",
"(",
"to",
",",
"duration",
",",
"callback",
")",
"{",
"return",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{",
"var",
"_el",
"=",
"u",
"(",
"el",
")",
",",
"start",
"=",
"_el",
".",
"scrollTop",
"(",
")",
... | scrollTo method
scroll to a certain position inside the element
@param {number} to - position to scroll to
@param {number} duration - duration for the animation
@param {function} callback - function to call when finished
@return {object} this | [
"scrollTo",
"method",
"scroll",
"to",
"a",
"certain",
"position",
"inside",
"the",
"element"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L871-L901 | train | |
iamso/u.js | dist/u.packed.js | function(duration, callback) {
return this.each(function(index, el) {
u(el).scrollTo(0, duration, callback);
});
} | javascript | function(duration, callback) {
return this.each(function(index, el) {
u(el).scrollTo(0, duration, callback);
});
} | [
"function",
"(",
"duration",
",",
"callback",
")",
"{",
"return",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{",
"u",
"(",
"el",
")",
".",
"scrollTo",
"(",
"0",
",",
"duration",
",",
"callback",
")",
";",
"}",
")",
";",
... | scrollToTop method
shortcut for scroll to 0
@param {number} duration - duration for the animation
@param {function} callback - function to call when finished
@return {object} this | [
"scrollToTop",
"method",
"shortcut",
"for",
"scroll",
"to",
"0"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L911-L915 | train | |
iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].clientWidth || this[0].innerWidth : 0) : this.each(function(index, el) {
el.style.width = val + 'px';
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].clientWidth || this[0].innerWidth : 0) : this.each(function(index, el) {
el.style.width = val + 'px';
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"clientWidth",
"||",
"this",
"[",
"0",
"]",
".",
"innerWidth",
":",
"0",
")",
":",
"this",
".",
"each",
"(",
... | width method
get or set element width
@param {number} [val] - new width
@return {number} width | [
"width",
"method",
"get",
"or",
"set",
"element",
"width"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L924-L928 | train | |
iamso/u.js | dist/u.packed.js | function(margin) {
if (!this.length) {
return 0;
}
return margin ? this[0].offsetWidth + parseInt(getComputedStyle(this[0]).marginLeft) + parseInt(getComputedStyle(this[0]).marginRight) : this[0].offsetWidth;
} | javascript | function(margin) {
if (!this.length) {
return 0;
}
return margin ? this[0].offsetWidth + parseInt(getComputedStyle(this[0]).marginLeft) + parseInt(getComputedStyle(this[0]).marginRight) : this[0].offsetWidth;
} | [
"function",
"(",
"margin",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"0",
";",
"}",
"return",
"margin",
"?",
"this",
"[",
"0",
"]",
".",
"offsetWidth",
"+",
"parseInt",
"(",
"getComputedStyle",
"(",
"this",
"[",
"0",
"]",... | outerWidth method
get element outer width
@param {boolean} [margin] - if true, includes margin
@return {number} outerWidth | [
"outerWidth",
"method",
"get",
"element",
"outer",
"width"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L937-L942 | train | |
iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].clientHeight || this[0].innerHeight : 0) : this.each(function(index, el) {
el.style.height = val + 'px';
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].clientHeight || this[0].innerHeight : 0) : this.each(function(index, el) {
el.style.height = val + 'px';
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"clientHeight",
"||",
"this",
"[",
"0",
"]",
".",
"innerHeight",
":",
"0",
")",
":",
"this",
".",
"each",
"("... | height method
get or set element height
@param {number} [val] - new height
@return {number} height | [
"height",
"method",
"get",
"or",
"set",
"element",
"height"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L951-L955 | train | |
iamso/u.js | dist/u.packed.js | function(margin) {
if (!this.length) {
return 0;
}
return margin ? this[0].offsetHeight + parseInt(getComputedStyle(this[0]).marginTop) + parseInt(getComputedStyle(this[0]).marginBottom) : this[0].offsetHeight;
} | javascript | function(margin) {
if (!this.length) {
return 0;
}
return margin ? this[0].offsetHeight + parseInt(getComputedStyle(this[0]).marginTop) + parseInt(getComputedStyle(this[0]).marginBottom) : this[0].offsetHeight;
} | [
"function",
"(",
"margin",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"0",
";",
"}",
"return",
"margin",
"?",
"this",
"[",
"0",
"]",
".",
"offsetHeight",
"+",
"parseInt",
"(",
"getComputedStyle",
"(",
"this",
"[",
"0",
"]"... | outerHeight method
get element outer height
@param {boolean} [margin] - if true, includes margin
@return {number} outerHeight | [
"outerHeight",
"method",
"get",
"element",
"outer",
"height"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L964-L969 | train | |
iamso/u.js | dist/u.packed.js | function(attr, val) {
return val === undefined ? (this.length ? this[0].getAttribute(attr) : null) : this.each(function(index, el) {
el.setAttribute(attr, val);
});
} | javascript | function(attr, val) {
return val === undefined ? (this.length ? this[0].getAttribute(attr) : null) : this.each(function(index, el) {
el.setAttribute(attr, val);
});
} | [
"function",
"(",
"attr",
",",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"getAttribute",
"(",
"attr",
")",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"... | attr method
get or set an attribute
@param {string} attr - attribute name
@param {string} [val] - attribute value
@return {(string|object)} attribute value or this | [
"attr",
"method",
"get",
"or",
"set",
"an",
"attribute"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1003-L1007 | train | |
iamso/u.js | dist/u.packed.js | function(prop, val) {
return val === undefined ? (this.length ? this[0][prop] : null) : this.each(function(index, el) {
el[prop] = val;
});
} | javascript | function(prop, val) {
return val === undefined ? (this.length ? this[0][prop] : null) : this.each(function(index, el) {
el[prop] = val;
});
} | [
"function",
"(",
"prop",
",",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
"[",
"prop",
"]",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"... | prop method
get or set a property of the underlying DOM object
@param {string} prop - property name
@param {string} [val] - property value
@return {(string|object)} property value or this | [
"prop",
"method",
"get",
"or",
"set",
"a",
"property",
"of",
"the",
"underlying",
"DOM",
"object"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1041-L1045 | train | |
iamso/u.js | dist/u.packed.js | function(attr, val, el, index, obj, attrCamel) {
if (attr === undefined) {
if (!this.length) {
return {};
}
el = this[0];
obj = u.extend({}, el.dataset || {});
if ((index = el[u._id]) === undefined) {
el[u._id] = index = u._data.push(obj) - 1;
... | javascript | function(attr, val, el, index, obj, attrCamel) {
if (attr === undefined) {
if (!this.length) {
return {};
}
el = this[0];
obj = u.extend({}, el.dataset || {});
if ((index = el[u._id]) === undefined) {
el[u._id] = index = u._data.push(obj) - 1;
... | [
"function",
"(",
"attr",
",",
"val",
",",
"el",
",",
"index",
",",
"obj",
",",
"attrCamel",
")",
"{",
"if",
"(",
"attr",
"===",
"undefined",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"{",
"}",
";",
"}",
"el",
"=",
"... | data method
get or set a data attribute
@param {string} attr - attribute name
@param {string} [val] - attribute value
@param {undefined} [el] - element placeholder
@param {undefined} [index] - index placeholder
@param {undefined} [obj] - object plac... | [
"data",
"method",
"get",
"or",
"set",
"a",
"data",
"attribute"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1059-L1107 | train | |
iamso/u.js | dist/u.packed.js | function(attr, index, attrCamel) {
return this.each(function(i, el) {
if (attr !== undefined) {
attrCamel = u.toCamel(u.toDash(attr));
if ((index = el[u._id]) !== undefined) {
el.dataset ? delete el.dataset[attrCamel] : el.removeAttribute('data-' + attr);
delete... | javascript | function(attr, index, attrCamel) {
return this.each(function(i, el) {
if (attr !== undefined) {
attrCamel = u.toCamel(u.toDash(attr));
if ((index = el[u._id]) !== undefined) {
el.dataset ? delete el.dataset[attrCamel] : el.removeAttribute('data-' + attr);
delete... | [
"function",
"(",
"attr",
",",
"index",
",",
"attrCamel",
")",
"{",
"return",
"this",
".",
"each",
"(",
"function",
"(",
"i",
",",
"el",
")",
"{",
"if",
"(",
"attr",
"!==",
"undefined",
")",
"{",
"attrCamel",
"=",
"u",
".",
"toCamel",
"(",
"u",
".... | removeData method
remove data attribute
@param {string} attr - attribute name
@param {undefined} [index] - index placeholder
@param {undefined} [attrCamel] - placeholder for attribute name in camelCase
@return {object} this | [
"removeData",
"method",
"remove",
"data",
"attribute"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1118-L1128 | train | |
iamso/u.js | dist/u.packed.js | function(props, val) {
if (/^o/.test(typeof props)) {
for(var prop in props) {
var prefixed = u.prfx(prop);
if (props.hasOwnProperty(prop)) {
this.each(function(index, el) {
el.style[prefixed] = props[prop];
});
}
}
return... | javascript | function(props, val) {
if (/^o/.test(typeof props)) {
for(var prop in props) {
var prefixed = u.prfx(prop);
if (props.hasOwnProperty(prop)) {
this.each(function(index, el) {
el.style[prefixed] = props[prop];
});
}
}
return... | [
"function",
"(",
"props",
",",
"val",
")",
"{",
"if",
"(",
"/",
"^o",
"/",
".",
"test",
"(",
"typeof",
"props",
")",
")",
"{",
"for",
"(",
"var",
"prop",
"in",
"props",
")",
"{",
"var",
"prefixed",
"=",
"u",
".",
"prfx",
"(",
"prop",
")",
";"... | css method
get or set css properties
@param {(string|object)} props - property name or object with names and values
@param {string} [val] - property value
@return {(string|object)} property value or this | [
"css",
"method",
"get",
"or",
"set",
"css",
"properties"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1138-L1156 | train | |
iamso/u.js | dist/u.packed.js | function(child) {
return this.length ? (/^o/.test(typeof child) ? this[0] !== child[0] && this[0].contains(child[0]) : this[0].querySelector(child) !== null) : false;
} | javascript | function(child) {
return this.length ? (/^o/.test(typeof child) ? this[0] !== child[0] && this[0].contains(child[0]) : this[0].querySelector(child) !== null) : false;
} | [
"function",
"(",
"child",
")",
"{",
"return",
"this",
".",
"length",
"?",
"(",
"/",
"^o",
"/",
".",
"test",
"(",
"typeof",
"child",
")",
"?",
"this",
"[",
"0",
"]",
"!==",
"child",
"[",
"0",
"]",
"&&",
"this",
"[",
"0",
"]",
".",
"contains",
... | contains method
check if child is contained in this element
@param {(string|object)} child - element or css selector
@return {boolean} | [
"contains",
"method",
"check",
"if",
"child",
"is",
"contained",
"in",
"this",
"element"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1278-L1280 | train | |
iamso/u.js | dist/u.packed.js | function(filter) {
return u(array.filter.call(this, function(el, index) {
return /^f/.test(typeof filter) ? filter(index, el) : u(el).is(filter);
}));
} | javascript | function(filter) {
return u(array.filter.call(this, function(el, index) {
return /^f/.test(typeof filter) ? filter(index, el) : u(el).is(filter);
}));
} | [
"function",
"(",
"filter",
")",
"{",
"return",
"u",
"(",
"array",
".",
"filter",
".",
"call",
"(",
"this",
",",
"function",
"(",
"el",
",",
"index",
")",
"{",
"return",
"/",
"^f",
"/",
".",
"test",
"(",
"typeof",
"filter",
")",
"?",
"filter",
"("... | filter method
filter elements by selector or filter function
@param {string|function} filter - selector or filter function
@return {object} matching elements | [
"filter",
"method",
"filter",
"elements",
"by",
"selector",
"or",
"filter",
"function"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1300-L1304 | train | |
iamso/u.js | dist/u.packed.js | function(sel) {
if (!this.length) {
return false;
}
var m = (this[0].matches || this[0].matchesSelector || this[0].msMatchesSelector || this[0].mozMatchesSelector || this[0].webkitMatchesSelector || this[0].oMatchesSelector || function(s) {
return [].indexOf.call(document.querySelector... | javascript | function(sel) {
if (!this.length) {
return false;
}
var m = (this[0].matches || this[0].matchesSelector || this[0].msMatchesSelector || this[0].mozMatchesSelector || this[0].webkitMatchesSelector || this[0].oMatchesSelector || function(s) {
return [].indexOf.call(document.querySelector... | [
"function",
"(",
"sel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"var",
"m",
"=",
"(",
"this",
"[",
"0",
"]",
".",
"matches",
"||",
"this",
"[",
"0",
"]",
".",
"matchesSelector",
"||",
"this",
"[",... | is method
matches the element against a selector
@param {string} sel - selector to match
@return {boolean} | [
"is",
"method",
"matches",
"the",
"element",
"against",
"a",
"selector"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1313-L1321 | train | |
iamso/u.js | dist/u.packed.js | function(el) {
if (!el) {
return this[0] ? this.first().prevAll().length : -1;
}
if (''+el === el) {
return u.toArray(u(el)).indexOf(this[0]);
}
el = el.ujs ? el[0] : el;
return u.toArray(this).indexOf(el);
} | javascript | function(el) {
if (!el) {
return this[0] ? this.first().prevAll().length : -1;
}
if (''+el === el) {
return u.toArray(u(el)).indexOf(this[0]);
}
el = el.ujs ? el[0] : el;
return u.toArray(this).indexOf(el);
} | [
"function",
"(",
"el",
")",
"{",
"if",
"(",
"!",
"el",
")",
"{",
"return",
"this",
"[",
"0",
"]",
"?",
"this",
".",
"first",
"(",
")",
".",
"prevAll",
"(",
")",
".",
"length",
":",
"-",
"1",
";",
"}",
"if",
"(",
"''",
"+",
"el",
"===",
"e... | index method
get the index of an element
@param {object|string} [el] - elements or css selector
@return {number} index | [
"index",
"method",
"get",
"the",
"index",
"of",
"an",
"element"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1340-L1349 | train | |
iamso/u.js | dist/u.packed.js | function(sel) {
if (!this.length) {
return this;
}
var matched = [],
el = this[0];
while (el = el.previousElementSibling) {
sel ?
(u(el).is(sel) && matched.push(el)) :
matched.push(el);
}
return u(matched);
} | javascript | function(sel) {
if (!this.length) {
return this;
}
var matched = [],
el = this[0];
while (el = el.previousElementSibling) {
sel ?
(u(el).is(sel) && matched.push(el)) :
matched.push(el);
}
return u(matched);
} | [
"function",
"(",
"sel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"this",
";",
"}",
"var",
"matched",
"=",
"[",
"]",
",",
"el",
"=",
"this",
"[",
"0",
"]",
";",
"while",
"(",
"el",
"=",
"el",
".",
"previousElementSibl... | prevAll method
get all previous element siblings
@param {string} [sel] - selector to filter siblings
@return {object} sibling elements | [
"prevAll",
"method",
"get",
"all",
"previous",
"element",
"siblings"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1369-L1382 | train | |
iamso/u.js | dist/u.packed.js | function(sel) {
if (!this.length) {
return this;
}
var matched = [],
el = this[0];
while (el = el.nextElementSibling) {
sel ?
(u(el).is(sel) && matched.push(el)) :
matched.push(el);
}
return u(matched);
} | javascript | function(sel) {
if (!this.length) {
return this;
}
var matched = [],
el = this[0];
while (el = el.nextElementSibling) {
sel ?
(u(el).is(sel) && matched.push(el)) :
matched.push(el);
}
return u(matched);
} | [
"function",
"(",
"sel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"this",
";",
"}",
"var",
"matched",
"=",
"[",
"]",
",",
"el",
"=",
"this",
"[",
"0",
"]",
";",
"while",
"(",
"el",
"=",
"el",
".",
"nextElementSibling"... | nextAll method
get all next element siblings
@param {string} [sel] - selector to filter siblings
@return {object} sibling elements | [
"nextAll",
"method",
"get",
"all",
"next",
"element",
"siblings"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1402-L1415 | train | |
iamso/u.js | dist/u.packed.js | function(sel) {
if (!this.length) {
return this;
}
var el = this[0];
return u(array.filter.call(el.parentNode.children, function(child) {
return sel ? child !== el && u(child).is(sel) : child !== el;
}));
} | javascript | function(sel) {
if (!this.length) {
return this;
}
var el = this[0];
return u(array.filter.call(el.parentNode.children, function(child) {
return sel ? child !== el && u(child).is(sel) : child !== el;
}));
} | [
"function",
"(",
"sel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"this",
";",
"}",
"var",
"el",
"=",
"this",
"[",
"0",
"]",
";",
"return",
"u",
"(",
"array",
".",
"filter",
".",
"call",
"(",
"el",
".",
"parentNode",
... | siblings method
get element siblings
@param {string} [sel] - selector to filter siblings
@return {object} sibling elements | [
"siblings",
"method",
"get",
"element",
"siblings"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1424-L1432 | train | |
iamso/u.js | dist/u.packed.js | function(sel) {
if (!this.length) {
return this;
}
var parents = [],
finished = false,
currentElement = this[0];
while (!finished) {
currentElement = currentElement.parentNode;
if (currentElement) {
if (sel === undefined) {
paren... | javascript | function(sel) {
if (!this.length) {
return this;
}
var parents = [],
finished = false,
currentElement = this[0];
while (!finished) {
currentElement = currentElement.parentNode;
if (currentElement) {
if (sel === undefined) {
paren... | [
"function",
"(",
"sel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"this",
";",
"}",
"var",
"parents",
"=",
"[",
"]",
",",
"finished",
"=",
"false",
",",
"currentElement",
"=",
"this",
"[",
"0",
"]",
";",
"while",
"(",
... | parents method
get the parent elements
@return {object} element | [
"parents",
"method",
"get",
"the",
"parent",
"elements"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1450-L1473 | train | |
iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].textContent : null) : this.each(function(index, el) {
el.textContent = val;
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].textContent : null) : this.each(function(index, el) {
el.textContent = val;
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"textContent",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{"... | text method
get or set the textContent value
@param {string} [val] - text value
@return {(string|object)} text value or this | [
"text",
"method",
"get",
"or",
"set",
"the",
"textContent",
"value"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1482-L1486 | train | |
iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].innerHTML : null) : this.each(function(index, el) {
el.innerHTML = val;
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].innerHTML : null) : this.each(function(index, el) {
el.innerHTML = val;
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"innerHTML",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{",
... | html method
get or set innerHTML value
@param {string} [val] - html value
@return {(string|object)} html value or this | [
"html",
"method",
"get",
"or",
"set",
"innerHTML",
"value"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1495-L1499 | train | |
iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].outerHTML : null) : this.each(function(index, el) {
el.outerHTML = val;
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].outerHTML : null) : this.each(function(index, el) {
el.outerHTML = val;
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"outerHTML",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{",
... | outerHTML method
get or set outerHTML value
@param {string} [val] - html value
@return {(string|object)} html value or this | [
"outerHTML",
"method",
"get",
"or",
"set",
"outerHTML",
"value"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1508-L1512 | train | |
iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].value : null) : this.each(function(index, el) {
el.value = val;
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].value : null) : this.each(function(index, el) {
el.value = val;
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"value",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{",
"e... | val method
get or set the value property of inputs and textareas
@param {string} [val] - text value
@return {(string|object)} text value or this | [
"val",
"method",
"get",
"or",
"set",
"the",
"value",
"property",
"of",
"inputs",
"and",
"textareas"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1521-L1525 | train | |
iamso/u.js | dist/u.packed.js | function() {
var args = u.toArray(arguments);
args.unshift(u.fn);
return u.extend.apply(this, args);
} | javascript | function() {
var args = u.toArray(arguments);
args.unshift(u.fn);
return u.extend.apply(this, args);
} | [
"function",
"(",
")",
"{",
"var",
"args",
"=",
"u",
".",
"toArray",
"(",
"arguments",
")",
";",
"args",
".",
"unshift",
"(",
"u",
".",
"fn",
")",
";",
"return",
"u",
".",
"extend",
".",
"apply",
"(",
"this",
",",
"args",
")",
";",
"}"
] | extend method
extend the u.js prototype object
@return {object} u.js prototype | [
"extend",
"method",
"extend",
"the",
"u",
".",
"js",
"prototype",
"object"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1600-L1604 | train | |
freakimkaefig/musicjson2abc | lib/abc_parser/data/Tune.js | function(params) {
This.lines[This.lineNum].staff[This.staffNum].voices[This.voiceNum] = [];
if (This.isFirstLine(This.lineNum)) {
if (params.name) {if (!This.lines[This.lineNum].staff[This.staffNum].title) This.lines[This.lineNum].staff[This.staffNum].title = [];This.lines[This.lineNum].staff[This.... | javascript | function(params) {
This.lines[This.lineNum].staff[This.staffNum].voices[This.voiceNum] = [];
if (This.isFirstLine(This.lineNum)) {
if (params.name) {if (!This.lines[This.lineNum].staff[This.staffNum].title) This.lines[This.lineNum].staff[This.staffNum].title = [];This.lines[This.lineNum].staff[This.... | [
"function",
"(",
"params",
")",
"{",
"This",
".",
"lines",
"[",
"This",
".",
"lineNum",
"]",
".",
"staff",
"[",
"This",
".",
"staffNum",
"]",
".",
"voices",
"[",
"This",
".",
"voiceNum",
"]",
"=",
"[",
"]",
";",
"if",
"(",
"This",
".",
"isFirstLi... | Close the previous line. | [
"Close",
"the",
"previous",
"line",
"."
] | c119c7927c3c9b6aa5f3558cc73990478472dfbb | https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/lib/abc_parser/data/Tune.js#L585-L612 | train | |
Hugo-ter-Doest/chart-parsers | lib/TypedFeatureStructure.js | featureIsUnifiable | function featureIsUnifiable(feature) {
logger.debug('TypedFeatureStructure.unifiable: checking feature: ' + feature + fs2.features[feature]);
if (fs1.features[feature]) {
// If feature of fs2 is a back pointer we want it to overrule feature
// of the fs1.
if (newStackb.inde... | javascript | function featureIsUnifiable(feature) {
logger.debug('TypedFeatureStructure.unifiable: checking feature: ' + feature + fs2.features[feature]);
if (fs1.features[feature]) {
// If feature of fs2 is a back pointer we want it to overrule feature
// of the fs1.
if (newStackb.inde... | [
"function",
"featureIsUnifiable",
"(",
"feature",
")",
"{",
"logger",
".",
"debug",
"(",
"'TypedFeatureStructure.unifiable: checking feature: '",
"+",
"feature",
"+",
"fs2",
".",
"features",
"[",
"feature",
"]",
")",
";",
"if",
"(",
"fs1",
".",
"features",
"[",
... | Checks if a feature of two features structures can be unified | [
"Checks",
"if",
"a",
"feature",
"of",
"two",
"features",
"structures",
"can",
"be",
"unified"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/TypedFeatureStructure.js#L243-L268 | train |
Hugo-ter-Doest/chart-parsers | lib/TypedFeatureStructure.js | prettyPrint0 | function prettyPrint0(fs, indent) {
logger.debug('prettyPrint0: ' + fs);
var result = '';
if (fs) {
if (Object.keys(fs.incoming).length > 1) {
if (fs.printed) {
// Return the label
return (fs.getLabel());
}
else {
// Print the label
resu... | javascript | function prettyPrint0(fs, indent) {
logger.debug('prettyPrint0: ' + fs);
var result = '';
if (fs) {
if (Object.keys(fs.incoming).length > 1) {
if (fs.printed) {
// Return the label
return (fs.getLabel());
}
else {
// Print the label
resu... | [
"function",
"prettyPrint0",
"(",
"fs",
",",
"indent",
")",
"{",
"logger",
".",
"debug",
"(",
"'prettyPrint0: '",
"+",
"fs",
")",
";",
"var",
"result",
"=",
"''",
";",
"if",
"(",
"fs",
")",
"{",
"if",
"(",
"Object",
".",
"keys",
"(",
"fs",
".",
"i... | Actual pretty printer | [
"Actual",
"pretty",
"printer"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/TypedFeatureStructure.js#L705-L816 | train |
thealjey/webcompiler | lib/livereload.js | livereload | function livereload() {
if (!reloadFn) {
const lr = (0, _tinyLr2.default)();
lr.listen(LIVERELOAD_PORT);
reloadFn = (file = '*') => {
lr.changed({ body: { files: [file] } });
};
}
return reloadFn;
} | javascript | function livereload() {
if (!reloadFn) {
const lr = (0, _tinyLr2.default)();
lr.listen(LIVERELOAD_PORT);
reloadFn = (file = '*') => {
lr.changed({ body: { files: [file] } });
};
}
return reloadFn;
} | [
"function",
"livereload",
"(",
")",
"{",
"if",
"(",
"!",
"reloadFn",
")",
"{",
"const",
"lr",
"=",
"(",
"0",
",",
"_tinyLr2",
".",
"default",
")",
"(",
")",
";",
"lr",
".",
"listen",
"(",
"LIVERELOAD_PORT",
")",
";",
"reloadFn",
"=",
"(",
"file",
... | Starts a LiveReload server and returns a function that triggers the reload.
@function livereload
@return {LiveReloadTrigger} the trigger function
@example
<link rel="stylesheet" href="css/style.css">
@example
import {livereload} from 'webcompiler';
// or - import {livereload} from 'webcompiler/lib/livereload';
// or -... | [
"Starts",
"a",
"LiveReload",
"server",
"and",
"returns",
"a",
"function",
"that",
"triggers",
"the",
"reload",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/livereload.js#L40-L52 | train |
Aigeec/mandrill-webhook-authenticator | src/mandrill-webhook-authenticator.js | function(fullUrl, body, key, signature) {
var data = fullUrl + sortPostParameters(body);
var expected = getHash(data, key);
return expected === signature;
} | javascript | function(fullUrl, body, key, signature) {
var data = fullUrl + sortPostParameters(body);
var expected = getHash(data, key);
return expected === signature;
} | [
"function",
"(",
"fullUrl",
",",
"body",
",",
"key",
",",
"signature",
")",
"{",
"var",
"data",
"=",
"fullUrl",
"+",
"sortPostParameters",
"(",
"body",
")",
";",
"var",
"expected",
"=",
"getHash",
"(",
"data",
",",
"key",
")",
";",
"return",
"expected"... | Generate the signature from the full url and sorted post data to compart to the one provided.
When mandrill is testing the existence of a url it can send a post request with no events and key set to 'test-webhook'.
@param { string } fullUrl - domain and url of request - should match exactly the url specified in the web... | [
"Generate",
"the",
"signature",
"from",
"the",
"full",
"url",
"and",
"sorted",
"post",
"data",
"to",
"compart",
"to",
"the",
"one",
"provided",
".",
"When",
"mandrill",
"is",
"testing",
"the",
"existence",
"of",
"a",
"url",
"it",
"can",
"send",
"a",
"pos... | d140241b5f274d4e951b1a294e35195a7e4177f9 | https://github.com/Aigeec/mandrill-webhook-authenticator/blob/d140241b5f274d4e951b1a294e35195a7e4177f9/src/mandrill-webhook-authenticator.js#L70-L74 | train | |
Aigeec/mandrill-webhook-authenticator | src/mandrill-webhook-authenticator.js | function(body) {
body = Object(body);
var sortedKeys = Object.keys(body).sort();
return sortedKeys.reduce(function(signature, key) {
return signature + key + body[key];
}, '');
} | javascript | function(body) {
body = Object(body);
var sortedKeys = Object.keys(body).sort();
return sortedKeys.reduce(function(signature, key) {
return signature + key + body[key];
}, '');
} | [
"function",
"(",
"body",
")",
"{",
"body",
"=",
"Object",
"(",
"body",
")",
";",
"var",
"sortedKeys",
"=",
"Object",
".",
"keys",
"(",
"body",
")",
".",
"sort",
"(",
")",
";",
"return",
"sortedKeys",
".",
"reduce",
"(",
"function",
"(",
"signature",
... | Sort the post parameters alphabetically and append each POST variable's key and value with no delimiter.
@param { string } body - Post body
@returns { string } string of sorted key values with no delimiter | [
"Sort",
"the",
"post",
"parameters",
"alphabetically",
"and",
"append",
"each",
"POST",
"variable",
"s",
"key",
"and",
"value",
"with",
"no",
"delimiter",
"."
] | d140241b5f274d4e951b1a294e35195a7e4177f9 | https://github.com/Aigeec/mandrill-webhook-authenticator/blob/d140241b5f274d4e951b1a294e35195a7e4177f9/src/mandrill-webhook-authenticator.js#L81-L87 | train | |
Aigeec/mandrill-webhook-authenticator | src/mandrill-webhook-authenticator.js | function(req, res, next) {
var signature = req.headers[MANDRILL_SIGNATURE_HEADER];
var fullUrl = options.domain + req.url;
var isValid = validator(fullUrl, req.body, signature);
var respondWith = responder(res);
if (!signature) {
respondWith(401, NOT_AUTHORIZED);
}else if (... | javascript | function(req, res, next) {
var signature = req.headers[MANDRILL_SIGNATURE_HEADER];
var fullUrl = options.domain + req.url;
var isValid = validator(fullUrl, req.body, signature);
var respondWith = responder(res);
if (!signature) {
respondWith(401, NOT_AUTHORIZED);
}else if (... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"signature",
"=",
"req",
".",
"headers",
"[",
"MANDRILL_SIGNATURE_HEADER",
"]",
";",
"var",
"fullUrl",
"=",
"options",
".",
"domain",
"+",
"req",
".",
"url",
";",
"var",
"isValid",
"=",
... | Express middleware compatible function to process requests and only continure if the signature is valid. Will return 200 if the request is a test request. It does not update the request.
@param { Request } req
@param { Response } res
@param { function } next | [
"Express",
"middleware",
"compatible",
"function",
"to",
"process",
"requests",
"and",
"only",
"continure",
"if",
"the",
"signature",
"is",
"valid",
".",
"Will",
"return",
"200",
"if",
"the",
"request",
"is",
"a",
"test",
"request",
".",
"It",
"does",
"not",... | d140241b5f274d4e951b1a294e35195a7e4177f9 | https://github.com/Aigeec/mandrill-webhook-authenticator/blob/d140241b5f274d4e951b1a294e35195a7e4177f9/src/mandrill-webhook-authenticator.js#L134-L150 | train | |
souporserious/create-styled-element | example/index.js | Column | function Column({ size, ...props }) {
const staticStyles = {
display: 'flex',
flexDirection: 'column',
}
const dynamicStyles = {
flex: `0 0 ${size / 12 * 100}`,
}
return createStyledElement('div', props)(staticStyles, dynamicStyles)
} | javascript | function Column({ size, ...props }) {
const staticStyles = {
display: 'flex',
flexDirection: 'column',
}
const dynamicStyles = {
flex: `0 0 ${size / 12 * 100}`,
}
return createStyledElement('div', props)(staticStyles, dynamicStyles)
} | [
"function",
"Column",
"(",
"{",
"size",
",",
"...",
"props",
"}",
")",
"{",
"const",
"staticStyles",
"=",
"{",
"display",
":",
"'flex'",
",",
"flexDirection",
":",
"'column'",
",",
"}",
"const",
"dynamicStyles",
"=",
"{",
"flex",
":",
"`",
"${",
"size"... | Multiple Styled Components Example | [
"Multiple",
"Styled",
"Components",
"Example"
] | 3abe540520cc25a44e4cb9e157e0eceeacf8f08f | https://github.com/souporserious/create-styled-element/blob/3abe540520cc25a44e4cb9e157e0eceeacf8f08f/example/index.js#L19-L28 | train |
meerkats/winston-slacker | index.js | Slack | function Slack(options) {
var suppliedOptions = options ? options : {};
if (!suppliedOptions.webhook || typeof suppliedOptions.webhook !== 'string') {
throw new Error('Invalid webhook parameter');
}
this.name = 'slack';
this.webhook = suppliedOptions.webhook;
this.customFormatter = suppliedOptions.custo... | javascript | function Slack(options) {
var suppliedOptions = options ? options : {};
if (!suppliedOptions.webhook || typeof suppliedOptions.webhook !== 'string') {
throw new Error('Invalid webhook parameter');
}
this.name = 'slack';
this.webhook = suppliedOptions.webhook;
this.customFormatter = suppliedOptions.custo... | [
"function",
"Slack",
"(",
"options",
")",
"{",
"var",
"suppliedOptions",
"=",
"options",
"?",
"options",
":",
"{",
"}",
";",
"if",
"(",
"!",
"suppliedOptions",
".",
"webhook",
"||",
"typeof",
"suppliedOptions",
".",
"webhook",
"!==",
"'string'",
")",
"{",
... | Slack integration for Winston
@param {object} Options parameter | [
"Slack",
"integration",
"for",
"Winston"
] | fdd4c3ff41b600749708f9d6b64f298e5c9beb30 | https://github.com/meerkats/winston-slacker/blob/fdd4c3ff41b600749708f9d6b64f298e5c9beb30/index.js#L19-L40 | train |
meerkats/winston-slacker | index.js | send | function send(message, callback) {
const suppliedCallback = callback || function () {};
if (!message) {
return suppliedCallback(new Error('No message'));
}
const requestParams = {
url: this.webhook,
body: extend(this.options, { text: message }),
json: true
};
return request.post(requestParam... | javascript | function send(message, callback) {
const suppliedCallback = callback || function () {};
if (!message) {
return suppliedCallback(new Error('No message'));
}
const requestParams = {
url: this.webhook,
body: extend(this.options, { text: message }),
json: true
};
return request.post(requestParam... | [
"function",
"send",
"(",
"message",
",",
"callback",
")",
"{",
"const",
"suppliedCallback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"if",
"(",
"!",
"message",
")",
"{",
"return",
"suppliedCallback",
"(",
"new",
"Error",
"(",
"'No mess... | Handles the sending of a message to an Incoming webhook
@param {text} Message text
@param {function} Callback function for post execution | [
"Handles",
"the",
"sending",
"of",
"a",
"message",
"to",
"an",
"Incoming",
"webhook"
] | fdd4c3ff41b600749708f9d6b64f298e5c9beb30 | https://github.com/meerkats/winston-slacker/blob/fdd4c3ff41b600749708f9d6b64f298e5c9beb30/index.js#L47-L63 | train |
Hugo-ter-Doest/chart-parsers | example/example_with_wordnet.js | tokenize_sentence | function tokenize_sentence(sentence) {
var tokenized = tokenizer.tokenize(sentence);
logger.info("tokenize_sentence: " + tokenized);
return(tokenized);
} | javascript | function tokenize_sentence(sentence) {
var tokenized = tokenizer.tokenize(sentence);
logger.info("tokenize_sentence: " + tokenized);
return(tokenized);
} | [
"function",
"tokenize_sentence",
"(",
"sentence",
")",
"{",
"var",
"tokenized",
"=",
"tokenizer",
".",
"tokenize",
"(",
"sentence",
")",
";",
"logger",
".",
"info",
"(",
"\"tokenize_sentence: \"",
"+",
"tokenized",
")",
";",
"return",
"(",
"tokenized",
")",
... | Split sentence in words and punctuation | [
"Split",
"sentence",
"in",
"words",
"and",
"punctuation"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/example/example_with_wordnet.js#L73-L77 | train |
Hugo-ter-Doest/chart-parsers | example/example_with_wordnet.js | stem_sentence | function stem_sentence(sentence) {
for (var i = 0; i < sentence.length; i++) {
sentence[i] = natural.PorterStemmer.stem(sentence[i]);
}
logger.info("stem_sentence: " + sentence);
return(sentence);
} | javascript | function stem_sentence(sentence) {
for (var i = 0; i < sentence.length; i++) {
sentence[i] = natural.PorterStemmer.stem(sentence[i]);
}
logger.info("stem_sentence: " + sentence);
return(sentence);
} | [
"function",
"stem_sentence",
"(",
"sentence",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"sentence",
".",
"length",
";",
"i",
"++",
")",
"{",
"sentence",
"[",
"i",
"]",
"=",
"natural",
".",
"PorterStemmer",
".",
"stem",
"(",
"senten... | Stem the words of the sentence Not used in the example, because Wordnet cannot recognise all stems | [
"Stem",
"the",
"words",
"of",
"the",
"sentence",
"Not",
"used",
"in",
"the",
"example",
"because",
"Wordnet",
"cannot",
"recognise",
"all",
"stems"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/example/example_with_wordnet.js#L81-L87 | train |
Hugo-ter-Doest/chart-parsers | lib/Type.js | Type | function Type(name, super_types, fs) {
this.super_types = [];
this.name = name;
if (super_types) {
this.super_types = super_types;
}
this.fs = fs;
} | javascript | function Type(name, super_types, fs) {
this.super_types = [];
this.name = name;
if (super_types) {
this.super_types = super_types;
}
this.fs = fs;
} | [
"function",
"Type",
"(",
"name",
",",
"super_types",
",",
"fs",
")",
"{",
"this",
".",
"super_types",
"=",
"[",
"]",
";",
"this",
".",
"name",
"=",
"name",
";",
"if",
"(",
"super_types",
")",
"{",
"this",
".",
"super_types",
"=",
"super_types",
";",
... | Constructor - name is a string - super_types is an array of types; it should be nonempty | [
"Constructor",
"-",
"name",
"is",
"a",
"string",
"-",
"super_types",
"is",
"an",
"array",
"of",
"types",
";",
"it",
"should",
"be",
"nonempty"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/Type.js#L28-L35 | train |
svanderburg/nijs | lib/ast/NixFunction.js | NixFunction | function NixFunction(args) {
if(args.argSpec === null) {
throw "Cannot derivate function argument specification from a null reference";
} else if(typeof args.argSpec == "string" || typeof args.argSpec == "object") {
this.argSpec = args.argSpec;
this.body = args.body;
} else {
... | javascript | function NixFunction(args) {
if(args.argSpec === null) {
throw "Cannot derivate function argument specification from a null reference";
} else if(typeof args.argSpec == "string" || typeof args.argSpec == "object") {
this.argSpec = args.argSpec;
this.body = args.body;
} else {
... | [
"function",
"NixFunction",
"(",
"args",
")",
"{",
"if",
"(",
"args",
".",
"argSpec",
"===",
"null",
")",
"{",
"throw",
"\"Cannot derivate function argument specification from a null reference\"",
";",
"}",
"else",
"if",
"(",
"typeof",
"args",
".",
"argSpec",
"==",... | Creates a new NixFunction instance.
@class NixFunction
@extends NixBlock
@classdesc Captures the abstract syntax of a Nix function consisting of an
argument and function body.
@constructor
@param {Object} args Arguments to this function
@param {Mixed} args.argSpec Argument specification of the function. If a string i... | [
"Creates",
"a",
"new",
"NixFunction",
"instance",
"."
] | 4e2738cbff3a43aba9297315ca5120cecf8dae3e | https://github.com/svanderburg/nijs/blob/4e2738cbff3a43aba9297315ca5120cecf8dae3e/lib/ast/NixFunction.js#L23-L32 | train |
cosmojs/loopback-satellizer | index.js | function(req, res, next) {
var requestTokenUrl = 'https://api.twitter.com/oauth/request_token';
var accessTokenUrl = 'https://api.twitter.com/oauth/access_token';
var authenticateUrl = 'https://api.twitter.com/oauth/authenticate';
// Step 2. Redirect to the authorization screen.
if (!req.query.oaut... | javascript | function(req, res, next) {
var requestTokenUrl = 'https://api.twitter.com/oauth/request_token';
var accessTokenUrl = 'https://api.twitter.com/oauth/access_token';
var authenticateUrl = 'https://api.twitter.com/oauth/authenticate';
// Step 2. Redirect to the authorization screen.
if (!req.query.oaut... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"requestTokenUrl",
"=",
"'https://api.twitter.com/oauth/request_token'",
";",
"var",
"accessTokenUrl",
"=",
"'https://api.twitter.com/oauth/access_token'",
";",
"var",
"authenticateUrl",
"=",
"'https://api.... | Step 1. Obtain request token for the authorization popup. | [
"Step",
"1",
".",
"Obtain",
"request",
"token",
"for",
"the",
"authorization",
"popup",
"."
] | 1c365d49eeb358f63c03b029fee4b16c50115fe1 | https://github.com/cosmojs/loopback-satellizer/blob/1c365d49eeb358f63c03b029fee4b16c50115fe1/index.js#L729-L767 | train | |
cosmojs/loopback-satellizer | index.js | function (req, res, next) {
var prifile = req.profile;
var filter = { or: [{ twitter: profile.user_id }, { email: profile.email }] };
User.find({ where: filter }, function(err, users) {
var user = users[0];
if (user) {
if (!user.twitter) {
user.twitter = profile.user_id;
... | javascript | function (req, res, next) {
var prifile = req.profile;
var filter = { or: [{ twitter: profile.user_id }, { email: profile.email }] };
User.find({ where: filter }, function(err, users) {
var user = users[0];
if (user) {
if (!user.twitter) {
user.twitter = profile.user_id;
... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"prifile",
"=",
"req",
".",
"profile",
";",
"var",
"filter",
"=",
"{",
"or",
":",
"[",
"{",
"twitter",
":",
"profile",
".",
"user_id",
"}",
",",
"{",
"email",
":",
"profile",
".",
... | Step 4b. Create a new user account or return an existing one. | [
"Step",
"4b",
".",
"Create",
"a",
"new",
"user",
"account",
"or",
"return",
"an",
"existing",
"one",
"."
] | 1c365d49eeb358f63c03b029fee4b16c50115fe1 | https://github.com/cosmojs/loopback-satellizer/blob/1c365d49eeb358f63c03b029fee4b16c50115fe1/index.js#L802-L836 | train | |
cosmojs/loopback-satellizer | index.js | function (req, res, next) {
var profileUrl = 'https://api.foursquare.com/v2/users/self';
var params = {
v: '20140806',
oauth_token: req.accessToken
};
request.get({ url: profileUrl, qs: params, json: true }, function(err, response, profile) {
if (err) {
res.status(500).send(er... | javascript | function (req, res, next) {
var profileUrl = 'https://api.foursquare.com/v2/users/self';
var params = {
v: '20140806',
oauth_token: req.accessToken
};
request.get({ url: profileUrl, qs: params, json: true }, function(err, response, profile) {
if (err) {
res.status(500).send(er... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"profileUrl",
"=",
"'https://api.foursquare.com/v2/users/self'",
";",
"var",
"params",
"=",
"{",
"v",
":",
"'20140806'",
",",
"oauth_token",
":",
"req",
".",
"accessToken",
"}",
";",
"request"... | Step 2. Retrieve information about the current user. | [
"Step",
"2",
".",
"Retrieve",
"information",
"about",
"the",
"current",
"user",
"."
] | 1c365d49eeb358f63c03b029fee4b16c50115fe1 | https://github.com/cosmojs/loopback-satellizer/blob/1c365d49eeb358f63c03b029fee4b16c50115fe1/index.js#L862-L877 | train | |
Jellyvision/lateralus | src/lateralus.mixins.js | getAugmentedOptionsObject | function getAugmentedOptionsObject (initialObject) {
// jshint validthis:true
const thisIsLateralus = isLateralus(this);
const augmentedOptions = _.extend(initialObject || {}, {
lateralus: thisIsLateralus ? this : this.lateralus
});
if (!thisIsLateralus) {
augmentedOptions.component = this.component ... | javascript | function getAugmentedOptionsObject (initialObject) {
// jshint validthis:true
const thisIsLateralus = isLateralus(this);
const augmentedOptions = _.extend(initialObject || {}, {
lateralus: thisIsLateralus ? this : this.lateralus
});
if (!thisIsLateralus) {
augmentedOptions.component = this.component ... | [
"function",
"getAugmentedOptionsObject",
"(",
"initialObject",
")",
"{",
"// jshint validthis:true",
"const",
"thisIsLateralus",
"=",
"isLateralus",
"(",
"this",
")",
";",
"const",
"augmentedOptions",
"=",
"_",
".",
"extend",
"(",
"initialObject",
"||",
"{",
"}",
... | Helper function for initModel and initCollection.
@param {Object} [initialObject]
@return {{ lateralus: Lateralus, component: Lateralus.Component= }}
`component` is not defined if `this` is the Lateralus instance.
@private | [
"Helper",
"function",
"for",
"initModel",
"and",
"initCollection",
"."
] | feaa3e27536de6d53cf9648529a4c61380535be8 | https://github.com/Jellyvision/lateralus/blob/feaa3e27536de6d53cf9648529a4c61380535be8/src/lateralus.mixins.js#L393-L405 | train |
thealjey/webcompiler | lib/logger.js | formatLine | function formatLine(message, file, line, column) {
const { yellow, cyan, magenta } = consoleStyles;
return ['"', yellow(message), '" in ', cyan((0, _path.relative)('', file)), ' on ', magenta(line), ':', magenta(column)];
} | javascript | function formatLine(message, file, line, column) {
const { yellow, cyan, magenta } = consoleStyles;
return ['"', yellow(message), '" in ', cyan((0, _path.relative)('', file)), ' on ', magenta(line), ':', magenta(column)];
} | [
"function",
"formatLine",
"(",
"message",
",",
"file",
",",
"line",
",",
"column",
")",
"{",
"const",
"{",
"yellow",
",",
"cyan",
",",
"magenta",
"}",
"=",
"consoleStyles",
";",
"return",
"[",
"'\"'",
",",
"yellow",
"(",
"message",
")",
",",
"'\" in '"... | Formats an error line with colors.
@memberof module:logger
@private
@function formatLine
@param {string} message - error message
@param {string} file - offending file
@param {number | string} line - offending line
@param {number | string} column - offending column
@return {Array<string | modul... | [
"Formats",
"an",
"error",
"line",
"with",
"colors",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L284-L288 | train |
thealjey/webcompiler | lib/logger.js | formatErrorMarker | function formatErrorMarker(message = 'Error') {
const { bold, bgRed, white } = consoleStyles;
return bgRed(bold(white(message)));
} | javascript | function formatErrorMarker(message = 'Error') {
const { bold, bgRed, white } = consoleStyles;
return bgRed(bold(white(message)));
} | [
"function",
"formatErrorMarker",
"(",
"message",
"=",
"'Error'",
")",
"{",
"const",
"{",
"bold",
",",
"bgRed",
",",
"white",
"}",
"=",
"consoleStyles",
";",
"return",
"bgRed",
"(",
"bold",
"(",
"white",
"(",
"message",
")",
")",
")",
";",
"}"
] | Returns a string "Error" styled as a bold white text on a red background, ready to be printed to the console.
@memberof module:logger
@private
@function formatErrorMarker
@param {string} [message="Error"] - a message to apply styles to
@return {module:logger.Message} a styled message | [
"Returns",
"a",
"string",
"Error",
"styled",
"as",
"a",
"bold",
"white",
"text",
"on",
"a",
"red",
"background",
"ready",
"to",
"be",
"printed",
"to",
"the",
"console",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L299-L303 | train |
thealjey/webcompiler | lib/logger.js | log | function log(...messages) {
const { message, styles } = new Message({ ansi: ['', ''], css: '' }).addMessages(messages);
console.log(message, ...styles);
} | javascript | function log(...messages) {
const { message, styles } = new Message({ ansi: ['', ''], css: '' }).addMessages(messages);
console.log(message, ...styles);
} | [
"function",
"log",
"(",
"...",
"messages",
")",
"{",
"const",
"{",
"message",
",",
"styles",
"}",
"=",
"new",
"Message",
"(",
"{",
"ansi",
":",
"[",
"''",
",",
"''",
"]",
",",
"css",
":",
"''",
"}",
")",
".",
"addMessages",
"(",
"messages",
")",
... | Log colorful messages out to the console on Node.js as well as in a browser in the simplest and most composable way.
@memberof module:logger
@function log
@param {...(string | number | module:logger.Message)} messages - messages to log
@example
import {log, consoleStyles} from 'webcompiler';
// or - import {log, conso... | [
"Log",
"colorful",
"messages",
"out",
"to",
"the",
"console",
"on",
"Node",
".",
"js",
"as",
"well",
"as",
"in",
"a",
"browser",
"in",
"the",
"simplest",
"and",
"most",
"composable",
"way",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L325-L329 | train |
thealjey/webcompiler | lib/logger.js | logPostCSSWarnings | function logPostCSSWarnings(warnings) {
(0, _forEach2.default)(warnings, ({ text, plugin, node: { source: { input: { file } } }, line, column }) => {
log(formatErrorMarker('Warning'), ': ', ...formatLine(`${text}(${plugin})`, file, line, column));
});
log('PostCSS warnings: ', warnings.length);
} | javascript | function logPostCSSWarnings(warnings) {
(0, _forEach2.default)(warnings, ({ text, plugin, node: { source: { input: { file } } }, line, column }) => {
log(formatErrorMarker('Warning'), ': ', ...formatLine(`${text}(${plugin})`, file, line, column));
});
log('PostCSS warnings: ', warnings.length);
} | [
"function",
"logPostCSSWarnings",
"(",
"warnings",
")",
"{",
"(",
"0",
",",
"_forEach2",
".",
"default",
")",
"(",
"warnings",
",",
"(",
"{",
"text",
",",
"plugin",
",",
"node",
":",
"{",
"source",
":",
"{",
"input",
":",
"{",
"file",
"}",
"}",
"}"... | Prints PostCSS Warning objects out to the console.
@memberof module:logger
@function logPostCSSWarnings
@param {Array<PostCSSWarning>} warnings - warning objects
@example
import {logPostCSSWarnings} from 'webcompiler';
// or - import {logPostCSSWarnings} from 'webcompiler/lib/logger';
// or - var logPostCSSWarnings = ... | [
"Prints",
"PostCSS",
"Warning",
"objects",
"out",
"to",
"the",
"console",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L382-L387 | train |
thealjey/webcompiler | lib/logger.js | logSASSError | function logSASSError({ message, file, line, column }) {
log(formatErrorMarker('SASS error'), ': ', ...formatLine(message, file, line, column));
} | javascript | function logSASSError({ message, file, line, column }) {
log(formatErrorMarker('SASS error'), ': ', ...formatLine(message, file, line, column));
} | [
"function",
"logSASSError",
"(",
"{",
"message",
",",
"file",
",",
"line",
",",
"column",
"}",
")",
"{",
"log",
"(",
"formatErrorMarker",
"(",
"'SASS error'",
")",
",",
"': '",
",",
"...",
"formatLine",
"(",
"message",
",",
"file",
",",
"line",
",",
"c... | Prints a Node SASS error object out to the console.
@memberof module:logger
@function logSASSError
@param {NodeSassError} error - error object
@example
import {logSASSError} from 'webcompiler';
// or - import {logSASSError} from 'webcompiler/lib/logger';
// or - var logSASSError = require('webcompiler').logSASSError;
... | [
"Prints",
"a",
"Node",
"SASS",
"error",
"object",
"out",
"to",
"the",
"console",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L409-L411 | train |
thealjey/webcompiler | lib/logger.js | logLintingErrors | function logLintingErrors(errors, prefix = null) {
(0, _forEach2.default)(errors, ({ message, rule, file, line, column }) => {
log(formatErrorMarker(), ': ', ...formatLine(`${message}${rule ? ` (${rule})` : ''}`, file, line, column));
});
log(prefix ? `${prefix} l` : 'L', 'inting errors: ', errors.length);
} | javascript | function logLintingErrors(errors, prefix = null) {
(0, _forEach2.default)(errors, ({ message, rule, file, line, column }) => {
log(formatErrorMarker(), ': ', ...formatLine(`${message}${rule ? ` (${rule})` : ''}`, file, line, column));
});
log(prefix ? `${prefix} l` : 'L', 'inting errors: ', errors.length);
} | [
"function",
"logLintingErrors",
"(",
"errors",
",",
"prefix",
"=",
"null",
")",
"{",
"(",
"0",
",",
"_forEach2",
".",
"default",
")",
"(",
"errors",
",",
"(",
"{",
"message",
",",
"rule",
",",
"file",
",",
"line",
",",
"column",
"}",
")",
"=>",
"{"... | Prints linting errors out to the console.
@memberof module:logger
@function logLintingErrors
@param {Array<LintError>} errors - error objects
@param {string} [prefix=null] - will be printed on the last line along with the total number of messages
@example
import {logLintingErrors} from 'webcompiler';
... | [
"Prints",
"linting",
"errors",
"out",
"to",
"the",
"console",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L426-L431 | train |
Hugo-ter-Doest/chart-parsers | lib/ProductionRule.js | ProductionRule | function ProductionRule(lhs, rhs, head) {
this.lhs = lhs;
this.rhs = rhs;
this.head = head;
// feature structure of the constraints specified with the rule
this.fs = null;
} | javascript | function ProductionRule(lhs, rhs, head) {
this.lhs = lhs;
this.rhs = rhs;
this.head = head;
// feature structure of the constraints specified with the rule
this.fs = null;
} | [
"function",
"ProductionRule",
"(",
"lhs",
",",
"rhs",
",",
"head",
")",
"{",
"this",
".",
"lhs",
"=",
"lhs",
";",
"this",
".",
"rhs",
"=",
"rhs",
";",
"this",
".",
"head",
"=",
"head",
";",
"// feature structure of the constraints specified with the rule",
"... | Constructor - lhs is a string - rhs is an array of strings - head is a number pointing to a rhs nonterminal | [
"Constructor",
"-",
"lhs",
"is",
"a",
"string",
"-",
"rhs",
"is",
"an",
"array",
"of",
"strings",
"-",
"head",
"is",
"a",
"number",
"pointing",
"to",
"a",
"rhs",
"nonterminal"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/ProductionRule.js#L33-L39 | train |
paritytech/js-jsonrpc | scripts/helpers/parsed-rpc-traits.js | parseMethodsFromRust | function parseMethodsFromRust (source) {
// Matching the custom `rpc` attribute with it's doc comment
const attributePattern = /((?:\s*\/\/\/.*$)*)\s*#\[rpc\(([^)]+)\)]/gm;
const commentPattern = /\s*\/\/\/\s*/g;
const separatorPattern = /\s*,\s*/g;
const assignPattern = /([\S]+)\s*=\s*"([^"]*)"/;
const ign... | javascript | function parseMethodsFromRust (source) {
// Matching the custom `rpc` attribute with it's doc comment
const attributePattern = /((?:\s*\/\/\/.*$)*)\s*#\[rpc\(([^)]+)\)]/gm;
const commentPattern = /\s*\/\/\/\s*/g;
const separatorPattern = /\s*,\s*/g;
const assignPattern = /([\S]+)\s*=\s*"([^"]*)"/;
const ign... | [
"function",
"parseMethodsFromRust",
"(",
"source",
")",
"{",
"// Matching the custom `rpc` attribute with it's doc comment",
"const",
"attributePattern",
"=",
"/",
"((?:\\s*\\/\\/\\/.*$)*)\\s*#\\[rpc\\(([^)]+)\\)]",
"/",
"gm",
";",
"const",
"commentPattern",
"=",
"/",
"\\s*\\/\... | Get a list of JSON-RPC from Rust trait source code | [
"Get",
"a",
"list",
"of",
"JSON",
"-",
"RPC",
"from",
"Rust",
"trait",
"source",
"code"
] | 045b8953926cbc0f663de328954f1ca4ba8a4e7c | https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/scripts/helpers/parsed-rpc-traits.js#L26-L56 | train |
paritytech/js-jsonrpc | scripts/helpers/parsed-rpc-traits.js | getMethodsFromRustTraits | function getMethodsFromRustTraits () {
const traitsDir = path.join(__dirname, '../../.parity/rpc/src/v1/traits');
return fs
.readdirSync(traitsDir)
.filter((name) => name !== 'mod.rs' && /\.rs$/.test(name))
.map((name) => fs.readFileSync(path.join(traitsDir, name)))
.map(parseMethodsFromRust)
.... | javascript | function getMethodsFromRustTraits () {
const traitsDir = path.join(__dirname, '../../.parity/rpc/src/v1/traits');
return fs
.readdirSync(traitsDir)
.filter((name) => name !== 'mod.rs' && /\.rs$/.test(name))
.map((name) => fs.readFileSync(path.join(traitsDir, name)))
.map(parseMethodsFromRust)
.... | [
"function",
"getMethodsFromRustTraits",
"(",
")",
"{",
"const",
"traitsDir",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'../../.parity/rpc/src/v1/traits'",
")",
";",
"return",
"fs",
".",
"readdirSync",
"(",
"traitsDir",
")",
".",
"filter",
"(",
"(",
"na... | Get a list of all JSON-RPC methods from all defined traits | [
"Get",
"a",
"list",
"of",
"all",
"JSON",
"-",
"RPC",
"methods",
"from",
"all",
"defined",
"traits"
] | 045b8953926cbc0f663de328954f1ca4ba8a4e7c | https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/scripts/helpers/parsed-rpc-traits.js#L59-L68 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.