id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
46,500 | rask/gulp-yaml-data | index.js | function (file, enc, cb) {
var yaml_files = options.src;
if (typeof yaml_files === 'string') {
yaml_files = [yaml_files];
}
var yaml_data = {};
// Read all files in order, and override if later files contain same values.
for (var i = 0; i < yaml_files.lengt... | javascript | function (file, enc, cb) {
var yaml_files = options.src;
if (typeof yaml_files === 'string') {
yaml_files = [yaml_files];
}
var yaml_data = {};
// Read all files in order, and override if later files contain same values.
for (var i = 0; i < yaml_files.lengt... | [
"function",
"(",
"file",
",",
"enc",
",",
"cb",
")",
"{",
"var",
"yaml_files",
"=",
"options",
".",
"src",
";",
"if",
"(",
"typeof",
"yaml_files",
"===",
"'string'",
")",
"{",
"yaml_files",
"=",
"[",
"yaml_files",
"]",
";",
"}",
"var",
"yaml_data",
"... | Transform current stream to include a YAML data file. | [
"Transform",
"current",
"stream",
"to",
"include",
"a",
"YAML",
"data",
"file",
"."
] | c4a86a4ec4bed2f622a2267f23fdcdf58033ce1c | https://github.com/rask/gulp-yaml-data/blob/c4a86a4ec4bed2f622a2267f23fdcdf58033ce1c/index.js#L40-L67 | |
46,501 | looeee/npm-three-app | demo/module-import/js/vendor/GLTFLoader.js | GLTFDracoMeshCompressionExtension | function GLTFDracoMeshCompressionExtension( json, dracoLoader ) {
if ( !dracoLoader ) {
throw new Error( 'THREE.GLTFLoader: No DRACOLoader instance provided.' );
}
this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;
this.json = json;
this.dracoLoader = dracoLoader;
THREE.DRACOLoader.getDecoderModule(... | javascript | function GLTFDracoMeshCompressionExtension( json, dracoLoader ) {
if ( !dracoLoader ) {
throw new Error( 'THREE.GLTFLoader: No DRACOLoader instance provided.' );
}
this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;
this.json = json;
this.dracoLoader = dracoLoader;
THREE.DRACOLoader.getDecoderModule(... | [
"function",
"GLTFDracoMeshCompressionExtension",
"(",
"json",
",",
"dracoLoader",
")",
"{",
"if",
"(",
"!",
"dracoLoader",
")",
"{",
"throw",
"new",
"Error",
"(",
"'THREE.GLTFLoader: No DRACOLoader instance provided.'",
")",
";",
"}",
"this",
".",
"name",
"=",
"EX... | DRACO Mesh Compression Extension
Specification: https://github.com/KhronosGroup/glTF/pull/874 | [
"DRACO",
"Mesh",
"Compression",
"Extension"
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/GLTFLoader.js#L501-L514 |
46,502 | fin-hypergrid/rectangular | index.js | function(iteratee, context) {
context = context || this;
for (var x = this.origin.x, x2 = this.corner.x; x < x2; x++) {
for (var y = this.origin.y, y2 = this.corner.y; y < y2; y++) {
iteratee.call(context, x, y);
}
}
} | javascript | function(iteratee, context) {
context = context || this;
for (var x = this.origin.x, x2 = this.corner.x; x < x2; x++) {
for (var y = this.origin.y, y2 = this.corner.y; y < y2; y++) {
iteratee.call(context, x, y);
}
}
} | [
"function",
"(",
"iteratee",
",",
"context",
")",
"{",
"context",
"=",
"context",
"||",
"this",
";",
"for",
"(",
"var",
"x",
"=",
"this",
".",
"origin",
".",
"x",
",",
"x2",
"=",
"this",
".",
"corner",
".",
"x",
";",
"x",
"<",
"x2",
";",
"x",
... | iterate over all points within this rect, invoking `iteratee` for each.
@param {function(number,number)} iteratee - Function to call for each point.
Bound to `context` when given; otherwise it is bound to this rect.
Each invocation of `iteratee` is called with two arguments:
the horizontal and vertical coordinates of t... | [
"iterate",
"over",
"all",
"points",
"within",
"this",
"rect",
"invoking",
"iteratee",
"for",
"each",
"."
] | da7517823973c847ddb18c4ba4c0d25f8e55f52f | https://github.com/fin-hypergrid/rectangular/blob/da7517823973c847ddb18c4ba4c0d25f8e55f52f/index.js#L493-L500 | |
46,503 | Yomguithereal/dolman | index.js | makeRouter | function makeRouter() {
// Solving arguments
var args = [].slice.call(arguments);
var beforeMiddlewares = args.slice(0, -1),
routes = args[args.length - 1];
var router = express.Router();
routes.forEach(function(route) {
if (!route.url)
throw Error('dolman.router: one route... | javascript | function makeRouter() {
// Solving arguments
var args = [].slice.call(arguments);
var beforeMiddlewares = args.slice(0, -1),
routes = args[args.length - 1];
var router = express.Router();
routes.forEach(function(route) {
if (!route.url)
throw Error('dolman.router: one route... | [
"function",
"makeRouter",
"(",
")",
"{",
"// Solving arguments",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"var",
"beforeMiddlewares",
"=",
"args",
".",
"slice",
"(",
"0",
",",
"-",
"1",
")",
",",
"routes",
... | Router function. | [
"Router",
"function",
"."
] | b0c5fe40fa43467ce39e064a5361d6b5b24ed58a | https://github.com/Yomguithereal/dolman/blob/b0c5fe40fa43467ce39e064a5361d6b5b24ed58a/index.js#L45-L100 |
46,504 | Yomguithereal/dolman | index.js | specs | function specs() {
var routes = {};
// Reducing the app's recursive stack
function reduceStack(path, items, item) {
var nextPath;
if (item.handle && item.handle.stack) {
nextPath = join(path, (item.path || helpers.unescapeRegex(item.regexp) || ''));
return items.concat(item.han... | javascript | function specs() {
var routes = {};
// Reducing the app's recursive stack
function reduceStack(path, items, item) {
var nextPath;
if (item.handle && item.handle.stack) {
nextPath = join(path, (item.path || helpers.unescapeRegex(item.regexp) || ''));
return items.concat(item.han... | [
"function",
"specs",
"(",
")",
"{",
"var",
"routes",
"=",
"{",
"}",
";",
"// Reducing the app's recursive stack",
"function",
"reduceStack",
"(",
"path",
",",
"items",
",",
"item",
")",
"{",
"var",
"nextPath",
";",
"if",
"(",
"item",
".",
"handle",
"&&",
... | Specifications functions. | [
"Specifications",
"functions",
"."
] | b0c5fe40fa43467ce39e064a5361d6b5b24ed58a | https://github.com/Yomguithereal/dolman/blob/b0c5fe40fa43467ce39e064a5361d6b5b24ed58a/index.js#L105-L162 |
46,505 | Yomguithereal/dolman | index.js | reduceStack | function reduceStack(path, items, item) {
var nextPath;
if (item.handle && item.handle.stack) {
nextPath = join(path, (item.path || helpers.unescapeRegex(item.regexp) || ''));
return items.concat(item.handle.stack.reduce(reduceStack.bind(null, nextPath), []));
}
if (item.route)... | javascript | function reduceStack(path, items, item) {
var nextPath;
if (item.handle && item.handle.stack) {
nextPath = join(path, (item.path || helpers.unescapeRegex(item.regexp) || ''));
return items.concat(item.handle.stack.reduce(reduceStack.bind(null, nextPath), []));
}
if (item.route)... | [
"function",
"reduceStack",
"(",
"path",
",",
"items",
",",
"item",
")",
"{",
"var",
"nextPath",
";",
"if",
"(",
"item",
".",
"handle",
"&&",
"item",
".",
"handle",
".",
"stack",
")",
"{",
"nextPath",
"=",
"join",
"(",
"path",
",",
"(",
"item",
".",... | Reducing the app's recursive stack | [
"Reducing",
"the",
"app",
"s",
"recursive",
"stack"
] | b0c5fe40fa43467ce39e064a5361d6b5b24ed58a | https://github.com/Yomguithereal/dolman/blob/b0c5fe40fa43467ce39e064a5361d6b5b24ed58a/index.js#L109-L126 |
46,506 | codeactual/grunt-horde | lib/grunt-horde/index.js | GruntHorde | function GruntHorde(grunt) {
this.cwd = process.cwd();
this.config = {
initConfig: {},
loadNpmTasks: {},
loadTasks: {},
registerMultiTask: {},
registerTask: {}
};
this.frozenConfig = {};
this.grunt = grunt;
this.lootBatch = [];
} | javascript | function GruntHorde(grunt) {
this.cwd = process.cwd();
this.config = {
initConfig: {},
loadNpmTasks: {},
loadTasks: {},
registerMultiTask: {},
registerTask: {}
};
this.frozenConfig = {};
this.grunt = grunt;
this.lootBatch = [];
} | [
"function",
"GruntHorde",
"(",
"grunt",
")",
"{",
"this",
".",
"cwd",
"=",
"process",
".",
"cwd",
"(",
")",
";",
"this",
".",
"config",
"=",
"{",
"initConfig",
":",
"{",
"}",
",",
"loadNpmTasks",
":",
"{",
"}",
",",
"loadTasks",
":",
"{",
"}",
",... | GruntHorde constructor.
Usage:
// Gruntfile.js
module.exports = function(grunt) {
require('grunt-horde')
.create(grunt)
.loot('my-base-config-module')
.loot('./config/grunt')
.attack();
};
Properties:
- `{object} config` Gruntfile.js values indexed by `grunt` method name
- `{object} initConfig`
- `{object} loadNpmT... | [
"GruntHorde",
"constructor",
"."
] | 6ddbb70972cc961988af9f2a8d39e60552903972 | https://github.com/codeactual/grunt-horde/blob/6ddbb70972cc961988af9f2a8d39e60552903972/lib/grunt-horde/index.js#L68-L80 |
46,507 | d-oliveros/isomorphine | src/server/router.js | createRouter | function createRouter(modules) {
debug('Creating a new router. Modules: ' + JSON.stringify(modules, null, 3));
var router = express();
router.use(bodyParser.json());
// Map the requested entity path with the actual serverside entity
router.use('/isomorphine', methodLoader(modules));
// Proxy request pipe... | javascript | function createRouter(modules) {
debug('Creating a new router. Modules: ' + JSON.stringify(modules, null, 3));
var router = express();
router.use(bodyParser.json());
// Map the requested entity path with the actual serverside entity
router.use('/isomorphine', methodLoader(modules));
// Proxy request pipe... | [
"function",
"createRouter",
"(",
"modules",
")",
"{",
"debug",
"(",
"'Creating a new router. Modules: '",
"+",
"JSON",
".",
"stringify",
"(",
"modules",
",",
"null",
",",
"3",
")",
")",
";",
"var",
"router",
"=",
"express",
"(",
")",
";",
"router",
".",
... | Creates an express or connect-styled router,
and exposes the provided modules in the router's API surface area.
@param {Object} modules The entities to use.
@returns {Function} An express app instance.
@providesModule router | [
"Creates",
"an",
"express",
"or",
"connect",
"-",
"styled",
"router",
"and",
"exposes",
"the",
"provided",
"modules",
"in",
"the",
"router",
"s",
"API",
"surface",
"area",
"."
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/server/router.js#L23-L36 |
46,508 | d-oliveros/isomorphine | src/server/router.js | methodLoader | function methodLoader(modules) {
return function(req, res, next) {
if (req.path === '/') return next();
var path = req.path.substr(1).split('/');
var currModule = modules;
var isLastIndex, p, method;
debug('Looking for isomorphine entity in: ' + path.join('.'));
for (var i = 0, len = path.l... | javascript | function methodLoader(modules) {
return function(req, res, next) {
if (req.path === '/') return next();
var path = req.path.substr(1).split('/');
var currModule = modules;
var isLastIndex, p, method;
debug('Looking for isomorphine entity in: ' + path.join('.'));
for (var i = 0, len = path.l... | [
"function",
"methodLoader",
"(",
"modules",
")",
"{",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"if",
"(",
"req",
".",
"path",
"===",
"'/'",
")",
"return",
"next",
"(",
")",
";",
"var",
"path",
"=",
"req",
".",
"path",
... | Maps the parameter "entity" to the actual server-side entity.
@param {Object} modules The entities available in this api.
@returns {Function} Middleware function that maps the :entity param
with the real entity, and exposes it in req. | [
"Maps",
"the",
"parameter",
"entity",
"to",
"the",
"actual",
"server",
"-",
"side",
"entity",
"."
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/server/router.js#L45-L81 |
46,509 | walbo/grunt-px-to-rem | tasks/px_to_rem.js | checkFallback | function checkFallback(obj) {
var props = [];
var hasFallback = [];
var values = [];
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
var pro = obj[prop].prop;
if (obj[prop].type === 'comment') {
continue;
}
if (props.indexOf(... | javascript | function checkFallback(obj) {
var props = [];
var hasFallback = [];
var values = [];
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
var pro = obj[prop].prop;
if (obj[prop].type === 'comment') {
continue;
}
if (props.indexOf(... | [
"function",
"checkFallback",
"(",
"obj",
")",
"{",
"var",
"props",
"=",
"[",
"]",
";",
"var",
"hasFallback",
"=",
"[",
"]",
";",
"var",
"values",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"prop",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"hasO... | Function to check if rem and px exist | [
"Function",
"to",
"check",
"if",
"rem",
"and",
"px",
"exist"
] | 6d14790e33dae9b9c37270c90249c80c17719f61 | https://github.com/walbo/grunt-px-to-rem/blob/6d14790e33dae9b9c37270c90249c80c17719f61/tasks/px_to_rem.js#L149-L181 |
46,510 | adityamukho/node-box-sdk | lib/connector.js | function () {
if (this.auth_url) {
return this.auth_url;
}
var self = this,
destination = {
protocol: 'https',
host: 'www.box.com',
pathname: '/api/oauth2/authorize',
search: querystring.stringify({
response_type: 'code',
... | javascript | function () {
if (this.auth_url) {
return this.auth_url;
}
var self = this,
destination = {
protocol: 'https',
host: 'www.box.com',
pathname: '/api/oauth2/authorize',
search: querystring.stringify({
response_type: 'code',
... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"auth_url",
")",
"{",
"return",
"this",
".",
"auth_url",
";",
"}",
"var",
"self",
"=",
"this",
",",
"destination",
"=",
"{",
"protocol",
":",
"'https'",
",",
"host",
":",
"'www.box.com'",
",",
"pathn... | The returned URL should be provided to the end user when running in standalone mode.
@summary Get the authentication URL to manually navigate to.
@returns {string} The authentication URL. | [
"The",
"returned",
"URL",
"should",
"be",
"provided",
"to",
"the",
"end",
"user",
"when",
"running",
"in",
"standalone",
"mode",
"."
] | b8403df59d53ba4e8bed5de3675467544981a683 | https://github.com/adityamukho/node-box-sdk/blob/b8403df59d53ba4e8bed5de3675467544981a683/lib/connector.js#L47-L66 | |
46,511 | freakimkaefig/musicjson2abc | index.js | getAbcKey | function getAbcKey(fifths, mode) {
if (typeof mode === 'undefined' || mode === null) mode = 'major';
return circleOfFifths[mode][fifths];
} | javascript | function getAbcKey(fifths, mode) {
if (typeof mode === 'undefined' || mode === null) mode = 'major';
return circleOfFifths[mode][fifths];
} | [
"function",
"getAbcKey",
"(",
"fifths",
",",
"mode",
")",
"{",
"if",
"(",
"typeof",
"mode",
"===",
"'undefined'",
"||",
"mode",
"===",
"null",
")",
"mode",
"=",
"'major'",
";",
"return",
"circleOfFifths",
"[",
"mode",
"]",
"[",
"fifths",
"]",
";",
"}"
... | Returns the key for abc notation from given fifths
@param {number} fifths - The position inside the circle of fifths
@param {string|undefined} mode - The mode (major / minor)
@returns {string} | [
"Returns",
"the",
"key",
"for",
"abc",
"notation",
"from",
"given",
"fifths"
] | c119c7927c3c9b6aa5f3558cc73990478472dfbb | https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/index.js#L281-L284 |
46,512 | freakimkaefig/musicjson2abc | index.js | getJSONId | function getJSONId(data) {
var lines = data.split('\n');
for (var i = 0; i < lines.length; i++) {
if (lines[i].indexOf('T:') > -1) {
return lines[i].substr(lines[i].indexOf(':') + 1, lines[i].length);
}
}
throw new Error('Could not determine "T:" field');
} | javascript | function getJSONId(data) {
var lines = data.split('\n');
for (var i = 0; i < lines.length; i++) {
if (lines[i].indexOf('T:') > -1) {
return lines[i].substr(lines[i].indexOf(':') + 1, lines[i].length);
}
}
throw new Error('Could not determine "T:" field');
} | [
"function",
"getJSONId",
"(",
"data",
")",
"{",
"var",
"lines",
"=",
"data",
".",
"split",
"(",
"'\\n'",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"lines",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"lines",
"[",
"i"... | Get id from abc string
@param {String} data - The abc string
@returns {string} | [
"Get",
"id",
"from",
"abc",
"string"
] | c119c7927c3c9b6aa5f3558cc73990478472dfbb | https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/index.js#L335-L343 |
46,513 | freakimkaefig/musicjson2abc | index.js | function(tune) {
var ret = {
attributes: {
divisions: 1 /tune.getBeatLength(),
clef: {
line: 2
},
key: {},
time: {}
}
};
var measures = [];
var measureCounter = 0;
var barlineCounter = 0;
// parse lines
for (var l = 0; l < tune.lines.length; l++) {
for (v... | javascript | function(tune) {
var ret = {
attributes: {
divisions: 1 /tune.getBeatLength(),
clef: {
line: 2
},
key: {},
time: {}
}
};
var measures = [];
var measureCounter = 0;
var barlineCounter = 0;
// parse lines
for (var l = 0; l < tune.lines.length; l++) {
for (v... | [
"function",
"(",
"tune",
")",
"{",
"var",
"ret",
"=",
"{",
"attributes",
":",
"{",
"divisions",
":",
"1",
"/",
"tune",
".",
"getBeatLength",
"(",
")",
",",
"clef",
":",
"{",
"line",
":",
"2",
"}",
",",
"key",
":",
"{",
"}",
",",
"time",
":",
... | Creates json object from abc tunes object
@param {object} tune - The parsed tune object
@returns {object} | [
"Creates",
"json",
"object",
"from",
"abc",
"tunes",
"object"
] | c119c7927c3c9b6aa5f3558cc73990478472dfbb | https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/index.js#L350-L422 | |
46,514 | freakimkaefig/musicjson2abc | index.js | function() {
var attributes = {
repeat: {
left: false,
right: false
}
};
var notes = [];
/**
* Set repeat left for measure
*/
this.setRepeatLeft = function () {
attributes.repeat.left = true;
};
/**
* Set repeat right for measure
*/
this.setRepeatRight = function ()... | javascript | function() {
var attributes = {
repeat: {
left: false,
right: false
}
};
var notes = [];
/**
* Set repeat left for measure
*/
this.setRepeatLeft = function () {
attributes.repeat.left = true;
};
/**
* Set repeat right for measure
*/
this.setRepeatRight = function ()... | [
"function",
"(",
")",
"{",
"var",
"attributes",
"=",
"{",
"repeat",
":",
"{",
"left",
":",
"false",
",",
"right",
":",
"false",
"}",
"}",
";",
"var",
"notes",
"=",
"[",
"]",
";",
"/**\n * Set repeat left for measure\n */",
"this",
".",
"setRepeatLeft",... | Constructor for measure objects
@constructor | [
"Constructor",
"for",
"measure",
"objects"
] | c119c7927c3c9b6aa5f3558cc73990478472dfbb | https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/index.js#L428-L519 | |
46,515 | Hugo-ter-Doest/chart-parsers | lib/HeadCornerParser.js | HeadCornerChartParser | function HeadCornerChartParser(grammar) {
this.grammar = grammar;
this.grammar.computeHCRelation();
logger.debug("HeadCornerChartParser: " + JSON.stringify(grammar.hc));
} | javascript | function HeadCornerChartParser(grammar) {
this.grammar = grammar;
this.grammar.computeHCRelation();
logger.debug("HeadCornerChartParser: " + JSON.stringify(grammar.hc));
} | [
"function",
"HeadCornerChartParser",
"(",
"grammar",
")",
"{",
"this",
".",
"grammar",
"=",
"grammar",
";",
"this",
".",
"grammar",
".",
"computeHCRelation",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"HeadCornerChartParser: \"",
"+",
"JSON",
".",
"stringif... | Constructor for the left-corner parser | [
"Constructor",
"for",
"the",
"left",
"-",
"corner",
"parser"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/HeadCornerParser.js#L181-L185 |
46,516 | d-oliveros/isomorphine | src/server/factory.js | requireMethods | function requireMethods(dir) {
if (!dir) dir = getCallerDirname();
var modules = {};
fs
.readdirSync(dir)
.filter(function(filename) {
return filename !== 'index.js';
})
.forEach(function(filename) {
var filePath = path.join(dir, filename);
var Stats = fs.lstatSync(filePath);
... | javascript | function requireMethods(dir) {
if (!dir) dir = getCallerDirname();
var modules = {};
fs
.readdirSync(dir)
.filter(function(filename) {
return filename !== 'index.js';
})
.forEach(function(filename) {
var filePath = path.join(dir, filename);
var Stats = fs.lstatSync(filePath);
... | [
"function",
"requireMethods",
"(",
"dir",
")",
"{",
"if",
"(",
"!",
"dir",
")",
"dir",
"=",
"getCallerDirname",
"(",
")",
";",
"var",
"modules",
"=",
"{",
"}",
";",
"fs",
".",
"readdirSync",
"(",
"dir",
")",
".",
"filter",
"(",
"function",
"(",
"fi... | Recursively requires the modules in current dir.
@param {String} dir The base directory to require entities from.
@return {Object} An object with all the modules loaded. | [
"Recursively",
"requires",
"the",
"modules",
"in",
"current",
"dir",
"."
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/server/factory.js#L50-L86 |
46,517 | d-oliveros/isomorphine | src/server/factory.js | getCallerDirname | function getCallerDirname() {
var orig = Error.prepareStackTrace;
Error.prepareStackTrace = function(_, stack){ return stack; };
var err = new Error();
Error.captureStackTrace(err, arguments.callee);
var stack = err.stack;
Error.prepareStackTrace = orig;
var requester = stack[2].getFileName();
return p... | javascript | function getCallerDirname() {
var orig = Error.prepareStackTrace;
Error.prepareStackTrace = function(_, stack){ return stack; };
var err = new Error();
Error.captureStackTrace(err, arguments.callee);
var stack = err.stack;
Error.prepareStackTrace = orig;
var requester = stack[2].getFileName();
return p... | [
"function",
"getCallerDirname",
"(",
")",
"{",
"var",
"orig",
"=",
"Error",
".",
"prepareStackTrace",
";",
"Error",
".",
"prepareStackTrace",
"=",
"function",
"(",
"_",
",",
"stack",
")",
"{",
"return",
"stack",
";",
"}",
";",
"var",
"err",
"=",
"new",
... | Gets the dirname of the caller function that is calling this method.
@return {String} Absolute path to the caller's directory. | [
"Gets",
"the",
"dirname",
"of",
"the",
"caller",
"function",
"that",
"is",
"calling",
"this",
"method",
"."
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/server/factory.js#L92-L102 |
46,518 | adityamukho/node-box-sdk | lib/api/content/folders.js | function (name, parent_id, done, config) {
if (!_.isString(name) || !_.isNumber(parseInt(parent_id, 10))) {
return done(new Error('Invalid params. Required - name: string, parent_id: number'));
}
this._request(['folders'], 'POST', done, null, {
name: name,
parent: {... | javascript | function (name, parent_id, done, config) {
if (!_.isString(name) || !_.isNumber(parseInt(parent_id, 10))) {
return done(new Error('Invalid params. Required - name: string, parent_id: number'));
}
this._request(['folders'], 'POST', done, null, {
name: name,
parent: {... | [
"function",
"(",
"name",
",",
"parent_id",
",",
"done",
",",
"config",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"name",
")",
"||",
"!",
"_",
".",
"isNumber",
"(",
"parseInt",
"(",
"parent_id",
",",
"10",
")",
")",
")",
"{",
"return",
... | Used to create a new empty folder. The new folder will be created inside of the
specified parent folder.
@summary Create a New Folder.
@see {@link https://developers.box.com/docs/#folders-create-a-new-folder}
@param {string} name - The folder's name.
@param {number} parent_id - The parent folder's ID.
@param {requestCa... | [
"Used",
"to",
"create",
"a",
"new",
"empty",
"folder",
".",
"The",
"new",
"folder",
"will",
"be",
"created",
"inside",
"of",
"the",
"specified",
"parent",
"folder",
"."
] | b8403df59d53ba4e8bed5de3675467544981a683 | https://github.com/adityamukho/node-box-sdk/blob/b8403df59d53ba4e8bed5de3675467544981a683/lib/api/content/folders.js#L59-L69 | |
46,519 | svanderburg/nijs | lib/ast/NixAttrReference.js | NixAttrReference | function NixAttrReference(args) {
this.attrSetExpr = args.attrSetExpr;
this.refExpr = args.refExpr;
this.orExpr = args.orExpr;
} | javascript | function NixAttrReference(args) {
this.attrSetExpr = args.attrSetExpr;
this.refExpr = args.refExpr;
this.orExpr = args.orExpr;
} | [
"function",
"NixAttrReference",
"(",
"args",
")",
"{",
"this",
".",
"attrSetExpr",
"=",
"args",
".",
"attrSetExpr",
";",
"this",
".",
"refExpr",
"=",
"args",
".",
"refExpr",
";",
"this",
".",
"orExpr",
"=",
"args",
".",
"orExpr",
";",
"}"
] | Creates a new NixAttrReference instance.
@class NixAttrReference
@extends NixObject
@classdesc Captures the abstract syntax of a Nix of an expression yielding an
attribute set and an expression yielding an attribute name that references a
member of the former attribute set.
@constructor
@param {Object} args Arguments... | [
"Creates",
"a",
"new",
"NixAttrReference",
"instance",
"."
] | 4e2738cbff3a43aba9297315ca5120cecf8dae3e | https://github.com/svanderburg/nijs/blob/4e2738cbff3a43aba9297315ca5120cecf8dae3e/lib/ast/NixAttrReference.js#L20-L24 |
46,520 | ericprud/jsg | lib/json-grammar.js | throwUnexpected | function throwUnexpected (attr, obj) {
var e = Unexpected(attr, obj);
Error.captureStackTrace(e, throwUnexpected);
throw e;
} | javascript | function throwUnexpected (attr, obj) {
var e = Unexpected(attr, obj);
Error.captureStackTrace(e, throwUnexpected);
throw e;
} | [
"function",
"throwUnexpected",
"(",
"attr",
",",
"obj",
")",
"{",
"var",
"e",
"=",
"Unexpected",
"(",
"attr",
",",
"obj",
")",
";",
"Error",
".",
"captureStackTrace",
"(",
"e",
",",
"throwUnexpected",
")",
";",
"throw",
"e",
";",
"}"
] | thrower for inline conditionals | [
"thrower",
"for",
"inline",
"conditionals"
] | 0be3fcf487356c23c88117081214d00bb2fb3274 | https://github.com/ericprud/jsg/blob/0be3fcf487356c23c88117081214d00bb2fb3274/lib/json-grammar.js#L21-L25 |
46,521 | thlorenz/dockerify | index.js | targz | function targz(stream, opts) {
return exports.tar(stream.pipe(zlib.createGunzip()), opts);
} | javascript | function targz(stream, opts) {
return exports.tar(stream.pipe(zlib.createGunzip()), opts);
} | [
"function",
"targz",
"(",
"stream",
",",
"opts",
")",
"{",
"return",
"exports",
".",
"tar",
"(",
"stream",
".",
"pipe",
"(",
"zlib",
".",
"createGunzip",
"(",
")",
")",
",",
"opts",
")",
";",
"}"
] | Gunzips the .tar.gz stream and passes it along to `tar`.
@name targz
@function
@param {ReadableStream} stream .tar.gz stream
@param {Object} opts @see `tar`
@return {ReadableStream} the transformed tar stream | [
"Gunzips",
"the",
".",
"tar",
".",
"gz",
"stream",
"and",
"passes",
"it",
"along",
"to",
"tar",
"."
] | 5f769115c32782cc60db50c2ce4b3bbc7e5d68b5 | https://github.com/thlorenz/dockerify/blob/5f769115c32782cc60db50c2ce4b3bbc7e5d68b5/index.js#L142-L144 |
46,522 | deepstreamIO/deepstream.io-tools-react | src/deepstream-react.js | function( state ) {
var key,
clonedState = {};
for( key in state ) {
if( key !== LOCAL ) {
clonedState[ key ] = state[ key ];
}
}
return clonedState;
} | javascript | function( state ) {
var key,
clonedState = {};
for( key in state ) {
if( key !== LOCAL ) {
clonedState[ key ] = state[ key ];
}
}
return clonedState;
} | [
"function",
"(",
"state",
")",
"{",
"var",
"key",
",",
"clonedState",
"=",
"{",
"}",
";",
"for",
"(",
"key",
"in",
"state",
")",
"{",
"if",
"(",
"key",
"!==",
"LOCAL",
")",
"{",
"clonedState",
"[",
"key",
"]",
"=",
"state",
"[",
"key",
"]",
";"... | Creates a shallow copy of the state and omits the local namespace
@param {Object} state a serializable component state
@private
@returns {Object} clonedState a serializable component state | [
"Creates",
"a",
"shallow",
"copy",
"of",
"the",
"state",
"and",
"omits",
"the",
"local",
"namespace"
] | aec3b3fe3c9b12da0b05daf7a878173a3763e864 | https://github.com/deepstreamIO/deepstream.io-tools-react/blob/aec3b3fe3c9b12da0b05daf7a878173a3763e864/src/deepstream-react.js#L143-L154 | |
46,523 | deepstreamIO/deepstream.io-tools-react | src/deepstream-react.js | function() {
if( this.dsRecord && this.dsRecord.isReady && Object.keys( this.dsRecord.get() ).length === 0 && this.state ) {
this.dsRecord.set( this.state );
}
} | javascript | function() {
if( this.dsRecord && this.dsRecord.isReady && Object.keys( this.dsRecord.get() ).length === 0 && this.state ) {
this.dsRecord.set( this.state );
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"dsRecord",
"&&",
"this",
".",
"dsRecord",
".",
"isReady",
"&&",
"Object",
".",
"keys",
"(",
"this",
".",
"dsRecord",
".",
"get",
"(",
")",
")",
".",
"length",
"===",
"0",
"&&",
"this",
".",
"sta... | Set's the record's initial dataset, but only if the record is present, is empty and
the state is populated. This would most likely be the case for new react components that
expose a getInitialState method
@private
@returns {void} | [
"Set",
"s",
"the",
"record",
"s",
"initial",
"dataset",
"but",
"only",
"if",
"the",
"record",
"is",
"present",
"is",
"empty",
"and",
"the",
"state",
"is",
"populated",
".",
"This",
"would",
"most",
"likely",
"be",
"the",
"case",
"for",
"new",
"react",
... | aec3b3fe3c9b12da0b05daf7a878173a3763e864 | https://github.com/deepstreamIO/deepstream.io-tools-react/blob/aec3b3fe3c9b12da0b05daf7a878173a3763e864/src/deepstream-react.js#L164-L168 | |
46,524 | Liby99/keeling-js | lib/crypto.js | encrypt | function encrypt(salt, password) {
var hash = crypto.createHash('sha256').update(salt + password).digest('base64');
return salt + hash;
} | javascript | function encrypt(salt, password) {
var hash = crypto.createHash('sha256').update(salt + password).digest('base64');
return salt + hash;
} | [
"function",
"encrypt",
"(",
"salt",
",",
"password",
")",
"{",
"var",
"hash",
"=",
"crypto",
".",
"createHash",
"(",
"'sha256'",
")",
".",
"update",
"(",
"salt",
"+",
"password",
")",
".",
"digest",
"(",
"'base64'",
")",
";",
"return",
"salt",
"+",
"... | Encrypt the password with the salt
@param salt
@param password | [
"Encrypt",
"the",
"password",
"with",
"the",
"salt"
] | a49d7669c9a5425185068554c0b013cf87fffe20 | https://github.com/Liby99/keeling-js/blob/a49d7669c9a5425185068554c0b013cf87fffe20/lib/crypto.js#L51-L54 |
46,525 | jub3i/node-mem-stat | index.js | _toCamelCase | function _toCamelCase(str) {
var newString = '';
var insideParens = false;
newString += str[0].toLowerCase();
for (var i = 1; i < str.length; i++) {
var char = str[i];
switch (char) {
case ')':
case '_':
break;
case '(':
insideParens = true;
break;
default... | javascript | function _toCamelCase(str) {
var newString = '';
var insideParens = false;
newString += str[0].toLowerCase();
for (var i = 1; i < str.length; i++) {
var char = str[i];
switch (char) {
case ')':
case '_':
break;
case '(':
insideParens = true;
break;
default... | [
"function",
"_toCamelCase",
"(",
"str",
")",
"{",
"var",
"newString",
"=",
"''",
";",
"var",
"insideParens",
"=",
"false",
";",
"newString",
"+=",
"str",
"[",
"0",
"]",
".",
"toLowerCase",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"1",
";",
"i",
... | quick dirty to handle parens and underscores | [
"quick",
"dirty",
"to",
"handle",
"parens",
"and",
"underscores"
] | 8481e35560bfcdf73a76c9be4b869ed3eef2f009 | https://github.com/jub3i/node-mem-stat/blob/8481e35560bfcdf73a76c9be4b869ed3eef2f009/index.js#L131-L156 |
46,526 | doowb/githubbot | index.js | GithubBot | function GithubBot(options) {
if (!(this instanceof GithubBot)) {
return new GithubBot(options);
}
BaseBot.call(this, options);
this.handlers(events);
this.define('events', events);
} | javascript | function GithubBot(options) {
if (!(this instanceof GithubBot)) {
return new GithubBot(options);
}
BaseBot.call(this, options);
this.handlers(events);
this.define('events', events);
} | [
"function",
"GithubBot",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"GithubBot",
")",
")",
"{",
"return",
"new",
"GithubBot",
"(",
"options",
")",
";",
"}",
"BaseBot",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"thi... | Create a new instance of a GithubBot with provided options.
```js
var bot = new GithubBot();
```
@param {Object} `options` Options to configure the github bot.
@api public | [
"Create",
"a",
"new",
"instance",
"of",
"a",
"GithubBot",
"with",
"provided",
"options",
"."
] | aa084bd2c432fa1edea58431db5d8ffee1f4da7c | https://github.com/doowb/githubbot/blob/aa084bd2c432fa1edea58431db5d8ffee1f4da7c/index.js#L24-L32 |
46,527 | adityamukho/node-box-sdk | lib/api/content/events.js | function () {
var self = this;
async.waterfall([
function (next) {
if (!self.events) {
self.events = new Datastore();
self.events.ensureIndex({
fieldName: 'event_id',
unique: true
});
self.eve... | javascript | function () {
var self = this;
async.waterfall([
function (next) {
if (!self.events) {
self.events = new Datastore();
self.events.ensureIndex({
fieldName: 'event_id',
unique: true
});
self.eve... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"async",
".",
"waterfall",
"(",
"[",
"function",
"(",
"next",
")",
"{",
"if",
"(",
"!",
"self",
".",
"events",
")",
"{",
"self",
".",
"events",
"=",
"new",
"Datastore",
"(",
")",
";",
... | Start long-polling for events.
@see {@link https://developers.box.com/docs/#events-long-polling}
@fires Connection#"polling.error"
@fires Connection#"polling.end" | [
"Start",
"long",
"-",
"polling",
"for",
"events",
"."
] | b8403df59d53ba4e8bed5de3675467544981a683 | https://github.com/adityamukho/node-box-sdk/blob/b8403df59d53ba4e8bed5de3675467544981a683/lib/api/content/events.js#L17-L79 | |
46,528 | adityamukho/node-box-sdk | lib/api/content/search.js | function (query, opts, done, config) {
if (!_.isString(query)) {
return done(new Error('query must be a string.'));
}
opts = opts || {};
opts.query = query;
this._request(['search'], 'GET', done, opts, null, null, null, null, config);
} | javascript | function (query, opts, done, config) {
if (!_.isString(query)) {
return done(new Error('query must be a string.'));
}
opts = opts || {};
opts.query = query;
this._request(['search'], 'GET', done, opts, null, null, null, null, config);
} | [
"function",
"(",
"query",
",",
"opts",
",",
"done",
",",
"config",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"query",
")",
")",
"{",
"return",
"done",
"(",
"new",
"Error",
"(",
"'query must be a string.'",
")",
")",
";",
"}",
"opts",
"="... | Options and parameters for search.
@typedef {Object} OptsSearch
@property {string} [scope] - The scope for which you want to limit your search to. Can be
{@linkcode user_content} for a search limited to only the current user or {@linkcode enterprise_content}
for the entire enterprise.
@property {string} [file_extension... | [
"Options",
"and",
"parameters",
"for",
"search",
"."
] | b8403df59d53ba4e8bed5de3675467544981a683 | https://github.com/adityamukho/node-box-sdk/blob/b8403df59d53ba4e8bed5de3675467544981a683/lib/api/content/search.js#L59-L68 | |
46,529 | paritytech/js-jsonrpc | scripts/build-rpc-markdown.js | hasExample | function hasExample ({ optional, example, details } = {}) {
if (optional || example !== undefined) {
return true;
}
if (details !== undefined) {
const values = Object.keys(details).map((key) => details[key]);
return values.every(hasExample);
}
return false;
} | javascript | function hasExample ({ optional, example, details } = {}) {
if (optional || example !== undefined) {
return true;
}
if (details !== undefined) {
const values = Object.keys(details).map((key) => details[key]);
return values.every(hasExample);
}
return false;
} | [
"function",
"hasExample",
"(",
"{",
"optional",
",",
"example",
",",
"details",
"}",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"optional",
"||",
"example",
"!==",
"undefined",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"details",
"!==",
"undefined",
... | Checks if a field definition has an example, or describes an object with fields that recursively have examples of their own, or is optional. | [
"Checks",
"if",
"a",
"field",
"definition",
"has",
"an",
"example",
"or",
"describes",
"an",
"object",
"with",
"fields",
"that",
"recursively",
"have",
"examples",
"of",
"their",
"own",
"or",
"is",
"optional",
"."
] | 045b8953926cbc0f663de328954f1ca4ba8a4e7c | https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/scripts/build-rpc-markdown.js#L88-L100 |
46,530 | paritytech/js-jsonrpc | scripts/build-rpc-markdown.js | getExample | function getExample (obj) {
if (isArray(obj)) {
return removeOptionalWithoutExamples(obj).map(getExample);
}
const { example, details } = obj;
if (example === undefined && details !== undefined) {
const nested = {};
Object.keys(details).forEach((key) => {
nested[key] = getExample(details[ke... | javascript | function getExample (obj) {
if (isArray(obj)) {
return removeOptionalWithoutExamples(obj).map(getExample);
}
const { example, details } = obj;
if (example === undefined && details !== undefined) {
const nested = {};
Object.keys(details).forEach((key) => {
nested[key] = getExample(details[ke... | [
"function",
"getExample",
"(",
"obj",
")",
"{",
"if",
"(",
"isArray",
"(",
"obj",
")",
")",
"{",
"return",
"removeOptionalWithoutExamples",
"(",
"obj",
")",
".",
"map",
"(",
"getExample",
")",
";",
"}",
"const",
"{",
"example",
",",
"details",
"}",
"="... | Grabs JSON compatible | [
"Grabs",
"JSON",
"compatible"
] | 045b8953926cbc0f663de328954f1ca4ba8a4e7c | https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/scripts/build-rpc-markdown.js#L110-L128 |
46,531 | paritytech/js-jsonrpc | scripts/build-rpc-markdown.js | methodComparator | function methodComparator (a, b) {
const sectionA = spec[a].section || '';
const sectionB = spec[b].section || '';
return sectionA.localeCompare(sectionB) || a.localeCompare(b);
} | javascript | function methodComparator (a, b) {
const sectionA = spec[a].section || '';
const sectionB = spec[b].section || '';
return sectionA.localeCompare(sectionB) || a.localeCompare(b);
} | [
"function",
"methodComparator",
"(",
"a",
",",
"b",
")",
"{",
"const",
"sectionA",
"=",
"spec",
"[",
"a",
"]",
".",
"section",
"||",
"''",
";",
"const",
"sectionB",
"=",
"spec",
"[",
"b",
"]",
".",
"section",
"||",
"''",
";",
"return",
"sectionA",
... | Comparator that will sort by sections first, names second | [
"Comparator",
"that",
"will",
"sort",
"by",
"sections",
"first",
"names",
"second"
] | 045b8953926cbc0f663de328954f1ca4ba8a4e7c | https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/scripts/build-rpc-markdown.js#L283-L288 |
46,532 | quantmind/d3-visualize | src/transforms/aggregate.js | group | function group (frame) {
let v, name, op;
const entries = fields.map((field, index) => {
name = ops[index];
op = scalar_operations.get('count');
if (name) {
op = scalar_operations.get(name);
if (!op) {
op = scalar_op... | javascript | function group (frame) {
let v, name, op;
const entries = fields.map((field, index) => {
name = ops[index];
op = scalar_operations.get('count');
if (name) {
op = scalar_operations.get(name);
if (!op) {
op = scalar_op... | [
"function",
"group",
"(",
"frame",
")",
"{",
"let",
"v",
",",
"name",
",",
"op",
";",
"const",
"entries",
"=",
"fields",
".",
"map",
"(",
"(",
"field",
",",
"index",
")",
"=>",
"{",
"name",
"=",
"ops",
"[",
"index",
"]",
";",
"op",
"=",
"scalar... | Perform aggregation with a set of data fields to group by | [
"Perform",
"aggregation",
"with",
"a",
"set",
"of",
"data",
"fields",
"to",
"group",
"by"
] | 67dac5a3ea5146eb70eb975667b49cf3827a5df7 | https://github.com/quantmind/d3-visualize/blob/67dac5a3ea5146eb70eb975667b49cf3827a5df7/src/transforms/aggregate.js#L93-L123 |
46,533 | ralphv/zoran | index.js | function(func, name) {
return proxy.createProxy(func, handlers.beforeFunc, handlers.afterFunc, {attachMonitor: true}, name);
} | javascript | function(func, name) {
return proxy.createProxy(func, handlers.beforeFunc, handlers.afterFunc, {attachMonitor: true}, name);
} | [
"function",
"(",
"func",
",",
"name",
")",
"{",
"return",
"proxy",
".",
"createProxy",
"(",
"func",
",",
"handlers",
".",
"beforeFunc",
",",
"handlers",
".",
"afterFunc",
",",
"{",
"attachMonitor",
":",
"true",
"}",
",",
"name",
")",
";",
"}"
] | Manually attach a monitor to a single function
@param {function} func the function reference to monitor
@param {string} name the name of the function, this will be the main identifier in the statistics produced
@returns {function} the new function reference that should replace the passed in reference | [
"Manually",
"attach",
"a",
"monitor",
"to",
"a",
"single",
"function"
] | b8f83d37e32ca496353b6e1981fa09e25de3cc35 | https://github.com/ralphv/zoran/blob/b8f83d37e32ca496353b6e1981fa09e25de3cc35/index.js#L112-L114 | |
46,534 | ralphv/zoran | index.js | function(name, args) {
var callInstance = {name: name};
handlers.beforeFunc({name: name}, null, args, callInstance);
return callInstance;
} | javascript | function(name, args) {
var callInstance = {name: name};
handlers.beforeFunc({name: name}, null, args, callInstance);
return callInstance;
} | [
"function",
"(",
"name",
",",
"args",
")",
"{",
"var",
"callInstance",
"=",
"{",
"name",
":",
"name",
"}",
";",
"handlers",
".",
"beforeFunc",
"(",
"{",
"name",
":",
"name",
"}",
",",
"null",
",",
"args",
",",
"callInstance",
")",
";",
"return",
"c... | Manually call at the beginning of a certain operation you want to measure
@param {string} name this will be the main identifier in the statistics produced
@param {array} args arguments of arguments
@returns {{}} the callInstance object, you must pass this to the matching end function | [
"Manually",
"call",
"at",
"the",
"beginning",
"of",
"a",
"certain",
"operation",
"you",
"want",
"to",
"measure"
] | b8f83d37e32ca496353b6e1981fa09e25de3cc35 | https://github.com/ralphv/zoran/blob/b8f83d37e32ca496353b6e1981fa09e25de3cc35/index.js#L122-L126 | |
46,535 | ralphv/zoran | index.js | function(args, callInstance) {
handlers.afterFunc({name: callInstance.name}, null, args, callInstance);
} | javascript | function(args, callInstance) {
handlers.afterFunc({name: callInstance.name}, null, args, callInstance);
} | [
"function",
"(",
"args",
",",
"callInstance",
")",
"{",
"handlers",
".",
"afterFunc",
"(",
"{",
"name",
":",
"callInstance",
".",
"name",
"}",
",",
"null",
",",
"args",
",",
"callInstance",
")",
";",
"}"
] | Manually call at the end of a certain operation you want to measure
@param {array} args args arguments of arguments
@param callInstance the return value you got from begin function must be passed here | [
"Manually",
"call",
"at",
"the",
"end",
"of",
"a",
"certain",
"operation",
"you",
"want",
"to",
"measure"
] | b8f83d37e32ca496353b6e1981fa09e25de3cc35 | https://github.com/ralphv/zoran/blob/b8f83d37e32ca496353b6e1981fa09e25de3cc35/index.js#L133-L135 | |
46,536 | reactbits/fiber | lib/message/uploadbutton.js | UploadButton | function UploadButton(props) {
var onClick = function onClick() {
var inputStyle = 'display:block;visibility:hidden;width:0;height:0';
var input = $('<input style="' + inputStyle + '" type="file" name="somename" size="chars">');
input.appendTo($('body'));
input.change(function () {
console.log('... | javascript | function UploadButton(props) {
var onClick = function onClick() {
var inputStyle = 'display:block;visibility:hidden;width:0;height:0';
var input = $('<input style="' + inputStyle + '" type="file" name="somename" size="chars">');
input.appendTo($('body'));
input.change(function () {
console.log('... | [
"function",
"UploadButton",
"(",
"props",
")",
"{",
"var",
"onClick",
"=",
"function",
"onClick",
"(",
")",
"{",
"var",
"inputStyle",
"=",
"'display:block;visibility:hidden;width:0;height:0'",
";",
"var",
"input",
"=",
"$",
"(",
"'<input style=\"'",
"+",
"inputSty... | import Upload from 'component-upload'; | [
"import",
"Upload",
"from",
"component",
"-",
"upload",
";"
] | 69704fc2083ac3cbd2246a326ee6b8e9c8f52074 | https://github.com/reactbits/fiber/blob/69704fc2083ac3cbd2246a326ee6b8e9c8f52074/lib/message/uploadbutton.js#L63-L99 |
46,537 | d-oliveros/isomorphine | src/client/factory.js | createProxies | function createProxies(config, map, parentPath) {
parentPath = parentPath || [];
var isBase = parentPath.length === 0;
var proxies = {};
var path;
for (var key in map) {
if (map.hasOwnProperty(key)) {
if (isObject(map[key])) {
proxies[key] = createProxies(config, map[key], parentPath.conca... | javascript | function createProxies(config, map, parentPath) {
parentPath = parentPath || [];
var isBase = parentPath.length === 0;
var proxies = {};
var path;
for (var key in map) {
if (map.hasOwnProperty(key)) {
if (isObject(map[key])) {
proxies[key] = createProxies(config, map[key], parentPath.conca... | [
"function",
"createProxies",
"(",
"config",
",",
"map",
",",
"parentPath",
")",
"{",
"parentPath",
"=",
"parentPath",
"||",
"[",
"]",
";",
"var",
"isBase",
"=",
"parentPath",
".",
"length",
"===",
"0",
";",
"var",
"proxies",
"=",
"{",
"}",
";",
"var",
... | Creates proxied methods using a provided map. If parentPath is provided,
it will be used to build the proxied method's endpoint.
@param {Object} map The entity map to use.
@param {Array} parentPath The path to the parent entity. | [
"Creates",
"proxied",
"methods",
"using",
"a",
"provided",
"map",
".",
"If",
"parentPath",
"is",
"provided",
"it",
"will",
"be",
"used",
"to",
"build",
"the",
"proxied",
"method",
"s",
"endpoint",
"."
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/client/factory.js#L68-L88 |
46,538 | d-oliveros/isomorphine | src/client/factory.js | getConfigFromBrowser | function getConfigFromBrowser() {
var defaultLocation = {
port: '80',
hostname: 'localhost',
protocol: 'http:'
};
var wLocation = (global.location)
? global.location
: defaultLocation;
var location = {
port: wLocation.port,
host: wLocation.protocol + '//' + wLocation.hostname
};
... | javascript | function getConfigFromBrowser() {
var defaultLocation = {
port: '80',
hostname: 'localhost',
protocol: 'http:'
};
var wLocation = (global.location)
? global.location
: defaultLocation;
var location = {
port: wLocation.port,
host: wLocation.protocol + '//' + wLocation.hostname
};
... | [
"function",
"getConfigFromBrowser",
"(",
")",
"{",
"var",
"defaultLocation",
"=",
"{",
"port",
":",
"'80'",
",",
"hostname",
":",
"'localhost'",
",",
"protocol",
":",
"'http:'",
"}",
";",
"var",
"wLocation",
"=",
"(",
"global",
".",
"location",
")",
"?",
... | Gets the default configuration based on environmental variables
@return {Object} Initial config | [
"Gets",
"the",
"default",
"configuration",
"based",
"on",
"environmental",
"variables"
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/client/factory.js#L94-L117 |
46,539 | paritytech/js-jsonrpc | src/helpers.js | withPreamble | function withPreamble (preamble, spec) {
Object.defineProperty(spec, '_preamble', {
value: preamble.trim(),
enumerable: false
});
return spec;
} | javascript | function withPreamble (preamble, spec) {
Object.defineProperty(spec, '_preamble', {
value: preamble.trim(),
enumerable: false
});
return spec;
} | [
"function",
"withPreamble",
"(",
"preamble",
",",
"spec",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"spec",
",",
"'_preamble'",
",",
"{",
"value",
":",
"preamble",
".",
"trim",
"(",
")",
",",
"enumerable",
":",
"false",
"}",
")",
";",
"return",
"... | Enrich the API spec by additional markdown-formatted preamble | [
"Enrich",
"the",
"API",
"spec",
"by",
"additional",
"markdown",
"-",
"formatted",
"preamble"
] | 045b8953926cbc0f663de328954f1ca4ba8a4e7c | https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/src/helpers.js#L52-L59 |
46,540 | paritytech/js-jsonrpc | src/helpers.js | withComment | function withComment (example, comment) {
const constructor = example == null ? null : example.constructor;
if (constructor === Object || constructor === Array) {
Object.defineProperty(example, '_comment', {
value: comment,
enumerable: false
});
return example;
}
// Convert primitives... | javascript | function withComment (example, comment) {
const constructor = example == null ? null : example.constructor;
if (constructor === Object || constructor === Array) {
Object.defineProperty(example, '_comment', {
value: comment,
enumerable: false
});
return example;
}
// Convert primitives... | [
"function",
"withComment",
"(",
"example",
",",
"comment",
")",
"{",
"const",
"constructor",
"=",
"example",
"==",
"null",
"?",
"null",
":",
"example",
".",
"constructor",
";",
"if",
"(",
"constructor",
"===",
"Object",
"||",
"constructor",
"===",
"Array",
... | Enrich any example value with a comment to print in the docs | [
"Enrich",
"any",
"example",
"value",
"with",
"a",
"comment",
"to",
"print",
"in",
"the",
"docs"
] | 045b8953926cbc0f663de328954f1ca4ba8a4e7c | https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/src/helpers.js#L62-L76 |
46,541 | vicanso/performance-nodejs | index.js | getDelay | function getDelay(start, interval) {
const delta = process.hrtime(start);
const nanosec = (delta[0] * 1e9) + delta[1];
/* eslint no-bitwise: ["error", { "int32Hint": true }] */
return Math.max((nanosec / 1e6 | 0) - interval, 0);
} | javascript | function getDelay(start, interval) {
const delta = process.hrtime(start);
const nanosec = (delta[0] * 1e9) + delta[1];
/* eslint no-bitwise: ["error", { "int32Hint": true }] */
return Math.max((nanosec / 1e6 | 0) - interval, 0);
} | [
"function",
"getDelay",
"(",
"start",
",",
"interval",
")",
"{",
"const",
"delta",
"=",
"process",
".",
"hrtime",
"(",
"start",
")",
";",
"const",
"nanosec",
"=",
"(",
"delta",
"[",
"0",
"]",
"*",
"1e9",
")",
"+",
"delta",
"[",
"1",
"]",
";",
"/*... | Get the dalay of interval
@param {Array} start The start time
@param {Number} interval The value of interval, ms
@returns {Number} The dalay ms | [
"Get",
"the",
"dalay",
"of",
"interval"
] | 8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca | https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L34-L39 |
46,542 | vicanso/performance-nodejs | index.js | format | function format(value, unitInfo) {
const unit = unitInfo.unit;
const precision = unitInfo.precision || 0;
let v = 0;
switch (unit) {
case 'GB':
v = value / GB;
break;
case 'MB':
v = value / MB;
break;
default:
v = value;
break;
}
v = parseFloat(Number(v).toFix... | javascript | function format(value, unitInfo) {
const unit = unitInfo.unit;
const precision = unitInfo.precision || 0;
let v = 0;
switch (unit) {
case 'GB':
v = value / GB;
break;
case 'MB':
v = value / MB;
break;
default:
v = value;
break;
}
v = parseFloat(Number(v).toFix... | [
"function",
"format",
"(",
"value",
",",
"unitInfo",
")",
"{",
"const",
"unit",
"=",
"unitInfo",
".",
"unit",
";",
"const",
"precision",
"=",
"unitInfo",
".",
"precision",
"||",
"0",
";",
"let",
"v",
"=",
"0",
";",
"switch",
"(",
"unit",
")",
"{",
... | Format the bytes by unit
@param {Number} value Bytes count
@param {Object} unitInfo {unit: String, precision: Number}
unit: 'GB', 'MB' or 'B'
precision: the precision of size, default is 0
@returns {Number} | [
"Format",
"the",
"bytes",
"by",
"unit"
] | 8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca | https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L49-L66 |
46,543 | vicanso/performance-nodejs | index.js | getHeapStatistics | function getHeapStatistics(unitInfo) {
const data = v8.getHeapStatistics();
const keys = Object.keys(data);
const result = {};
keys.forEach((key) => {
result[key] = format(data[key], unitInfo);
});
return result;
} | javascript | function getHeapStatistics(unitInfo) {
const data = v8.getHeapStatistics();
const keys = Object.keys(data);
const result = {};
keys.forEach((key) => {
result[key] = format(data[key], unitInfo);
});
return result;
} | [
"function",
"getHeapStatistics",
"(",
"unitInfo",
")",
"{",
"const",
"data",
"=",
"v8",
".",
"getHeapStatistics",
"(",
")",
";",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"data",
")",
";",
"const",
"result",
"=",
"{",
"}",
";",
"keys",
".",
"... | Get the heap statistics
@param {Object} unitInfo The unit format setting
@returns {Object} The heap statistics | [
"Get",
"the",
"heap",
"statistics"
] | 8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca | https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L73-L81 |
46,544 | vicanso/performance-nodejs | index.js | getHeapSpaceStatistics | function getHeapSpaceStatistics(unitInfo) {
const arr = v8.getHeapSpaceStatistics();
const result = {};
arr.forEach((item) => {
const data = {};
const keys = Object.keys(item);
keys.forEach((key) => {
if (key === 'space_name') {
return;
}
// replace the space_ key prefix
... | javascript | function getHeapSpaceStatistics(unitInfo) {
const arr = v8.getHeapSpaceStatistics();
const result = {};
arr.forEach((item) => {
const data = {};
const keys = Object.keys(item);
keys.forEach((key) => {
if (key === 'space_name') {
return;
}
// replace the space_ key prefix
... | [
"function",
"getHeapSpaceStatistics",
"(",
"unitInfo",
")",
"{",
"const",
"arr",
"=",
"v8",
".",
"getHeapSpaceStatistics",
"(",
")",
";",
"const",
"result",
"=",
"{",
"}",
";",
"arr",
".",
"forEach",
"(",
"(",
"item",
")",
"=>",
"{",
"const",
"data",
"... | Get the heap space statistics
@param {Object} unitInfo The unit format setting
@returns {Object} The heap space statistics | [
"Get",
"the",
"heap",
"space",
"statistics"
] | 8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca | https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L88-L104 |
46,545 | vicanso/performance-nodejs | index.js | getMemoryUsage | function getMemoryUsage(unitInfo) {
const data = process.memoryUsage();
const keys = Object.keys(data);
const result = {};
keys.forEach((key) => {
result[key] = format(data[key], unitInfo);
});
return result;
} | javascript | function getMemoryUsage(unitInfo) {
const data = process.memoryUsage();
const keys = Object.keys(data);
const result = {};
keys.forEach((key) => {
result[key] = format(data[key], unitInfo);
});
return result;
} | [
"function",
"getMemoryUsage",
"(",
"unitInfo",
")",
"{",
"const",
"data",
"=",
"process",
".",
"memoryUsage",
"(",
")",
";",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"data",
")",
";",
"const",
"result",
"=",
"{",
"}",
";",
"keys",
".",
"forE... | Get the memory usage
@param {Object} unitInfo The unit format setting
@returns {Object} The memory usage | [
"Get",
"the",
"memory",
"usage"
] | 8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca | https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L111-L119 |
46,546 | vicanso/performance-nodejs | index.js | get | function get(arr, filter, defaultValue) {
let result;
arr.forEach((tmp) => {
if (tmp && filter(tmp)) {
result = tmp;
}
});
return result || defaultValue;
} | javascript | function get(arr, filter, defaultValue) {
let result;
arr.forEach((tmp) => {
if (tmp && filter(tmp)) {
result = tmp;
}
});
return result || defaultValue;
} | [
"function",
"get",
"(",
"arr",
",",
"filter",
",",
"defaultValue",
")",
"{",
"let",
"result",
";",
"arr",
".",
"forEach",
"(",
"(",
"tmp",
")",
"=>",
"{",
"if",
"(",
"tmp",
"&&",
"filter",
"(",
"tmp",
")",
")",
"{",
"result",
"=",
"tmp",
";",
"... | Get the value from array by filter
@param {Array} arr The array to filter
@param {Function} filter The filter function
@param {any} defaultValue The default value for no value is valid
@returns {any} The value of filter | [
"Get",
"the",
"value",
"from",
"array",
"by",
"filter"
] | 8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca | https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L128-L136 |
46,547 | vicanso/performance-nodejs | index.js | convertUnit | function convertUnit(str) {
const reg = /\.\d*/;
const result = reg.exec(str);
if (result && result[0]) {
return {
precision: result[0].length - 1,
unit: str.substring(result[0].length + 1),
};
}
return {
unit: str,
};
} | javascript | function convertUnit(str) {
const reg = /\.\d*/;
const result = reg.exec(str);
if (result && result[0]) {
return {
precision: result[0].length - 1,
unit: str.substring(result[0].length + 1),
};
}
return {
unit: str,
};
} | [
"function",
"convertUnit",
"(",
"str",
")",
"{",
"const",
"reg",
"=",
"/",
"\\.\\d*",
"/",
";",
"const",
"result",
"=",
"reg",
".",
"exec",
"(",
"str",
")",
";",
"if",
"(",
"result",
"&&",
"result",
"[",
"0",
"]",
")",
"{",
"return",
"{",
"precis... | Convert the unit info
@param {String} str The unit info
@returns {Object} The format unit info | [
"Convert",
"the",
"unit",
"info"
] | 8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca | https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L143-L155 |
46,548 | vicanso/performance-nodejs | index.js | getCpuUsage | function getCpuUsage(previousValue, start) {
if (!previousValue) {
return null;
}
const usage = process.cpuUsage(previousValue);
const delta = process.hrtime(start);
const total = Math.ceil(((delta[0] * 1e9) + delta[1]) / 1000);
const usedPercent = Math.round(((usage.user + usage.system) / total) * 100)... | javascript | function getCpuUsage(previousValue, start) {
if (!previousValue) {
return null;
}
const usage = process.cpuUsage(previousValue);
const delta = process.hrtime(start);
const total = Math.ceil(((delta[0] * 1e9) + delta[1]) / 1000);
const usedPercent = Math.round(((usage.user + usage.system) / total) * 100)... | [
"function",
"getCpuUsage",
"(",
"previousValue",
",",
"start",
")",
"{",
"if",
"(",
"!",
"previousValue",
")",
"{",
"return",
"null",
";",
"}",
"const",
"usage",
"=",
"process",
".",
"cpuUsage",
"(",
"previousValue",
")",
";",
"const",
"delta",
"=",
"pro... | Get the cpu usage
@param {Object} previousValue The previous cpu usage
@param {Array} start The previous process.hrtime
@returns {Object} The cpu usage {
user: Number,
system: Number,
usedPercent: Number,
userUsedPercent: Number,
systemUsedPercent: Number,
total: total
} | [
"Get",
"the",
"cpu",
"usage"
] | 8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca | https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L170-L183 |
46,549 | vicanso/performance-nodejs | index.js | camelCaseData | function camelCaseData(data) {
const result = {};
const keys = Object.keys(data);
keys.forEach((k) => {
const key = camelCase(k);
const value = data[k];
if (isObject(value)) {
result[key] = camelCaseData(value);
} else {
result[key] = value;
}
});
return result;
} | javascript | function camelCaseData(data) {
const result = {};
const keys = Object.keys(data);
keys.forEach((k) => {
const key = camelCase(k);
const value = data[k];
if (isObject(value)) {
result[key] = camelCaseData(value);
} else {
result[key] = value;
}
});
return result;
} | [
"function",
"camelCaseData",
"(",
"data",
")",
"{",
"const",
"result",
"=",
"{",
"}",
";",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"data",
")",
";",
"keys",
".",
"forEach",
"(",
"(",
"k",
")",
"=>",
"{",
"const",
"key",
"=",
"camelCase",
... | Convert the data to camel case
@param {Object} data
@returns | [
"Convert",
"the",
"data",
"to",
"camel",
"case"
] | 8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca | https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L191-L204 |
46,550 | vicanso/performance-nodejs | index.js | flatten | function flatten(data, pre) {
const prefix = pre || '';
const keys = Object.keys(data);
const result = {};
keys.forEach((k) => {
const value = data[k];
const key = [prefix, k].join('-');
if (isObject(value)) {
Object.assign(result, flatten(value, key));
} else {
result[key] = value;
... | javascript | function flatten(data, pre) {
const prefix = pre || '';
const keys = Object.keys(data);
const result = {};
keys.forEach((k) => {
const value = data[k];
const key = [prefix, k].join('-');
if (isObject(value)) {
Object.assign(result, flatten(value, key));
} else {
result[key] = value;
... | [
"function",
"flatten",
"(",
"data",
",",
"pre",
")",
"{",
"const",
"prefix",
"=",
"pre",
"||",
"''",
";",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"data",
")",
";",
"const",
"result",
"=",
"{",
"}",
";",
"keys",
".",
"forEach",
"(",
"(",... | Flatten the data
@param {Object} data
@returns | [
"Flatten",
"the",
"data"
] | 8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca | https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L212-L226 |
46,551 | vicanso/performance-nodejs | index.js | performance | function performance() {
/* eslint prefer-rest-params: 0 */
const args = Array.from(arguments);
const interval = get(args, isNumber, 100);
const fn = get(args, isFunction, noop);
const unitInfo = convertUnit(get(args, isString, 'B').toUpperCase());
let start = process.hrtime();
let cpuUsage = process.cpuU... | javascript | function performance() {
/* eslint prefer-rest-params: 0 */
const args = Array.from(arguments);
const interval = get(args, isNumber, 100);
const fn = get(args, isFunction, noop);
const unitInfo = convertUnit(get(args, isString, 'B').toUpperCase());
let start = process.hrtime();
let cpuUsage = process.cpuU... | [
"function",
"performance",
"(",
")",
"{",
"/* eslint prefer-rest-params: 0 */",
"const",
"args",
"=",
"Array",
".",
"from",
"(",
"arguments",
")",
";",
"const",
"interval",
"=",
"get",
"(",
"args",
",",
"isNumber",
",",
"100",
")",
";",
"const",
"fn",
"=",... | Get the performance of node, include lag, heap, heapSpace, cpuUsage, memoryUsage
@param {Function} fn The callback function of performance
@param {Interval} interval The interval of get performance
@returns {Timer} The setInterval timer | [
"Get",
"the",
"performance",
"of",
"node",
"include",
"lag",
"heap",
"heapSpace",
"cpuUsage",
"memoryUsage"
] | 8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca | https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L234-L266 |
46,552 | epeli/node-clim | index.js | consoleProxy | function consoleProxy(ob){
// list from http://nodejs.org/api/stdio.html
var methods = ["dir", "time", "timeEnd", "trace", "assert"];
methods.forEach(function(method){
if (ob[method]) return;
ob[method] = function(){
return console[method].apply(console, arguments);
};
});
} | javascript | function consoleProxy(ob){
// list from http://nodejs.org/api/stdio.html
var methods = ["dir", "time", "timeEnd", "trace", "assert"];
methods.forEach(function(method){
if (ob[method]) return;
ob[method] = function(){
return console[method].apply(console, arguments);
};
});
} | [
"function",
"consoleProxy",
"(",
"ob",
")",
"{",
"// list from http://nodejs.org/api/stdio.html",
"var",
"methods",
"=",
"[",
"\"dir\"",
",",
"\"time\"",
",",
"\"timeEnd\"",
",",
"\"trace\"",
",",
"\"assert\"",
"]",
";",
"methods",
".",
"forEach",
"(",
"function",... | Just proxy methods we don't care about to original console object | [
"Just",
"proxy",
"methods",
"we",
"don",
"t",
"care",
"about",
"to",
"original",
"console",
"object"
] | 93a692976d4dda04992f729d4b6483af11394ad9 | https://github.com/epeli/node-clim/blob/93a692976d4dda04992f729d4b6483af11394ad9/index.js#L65-L74 |
46,553 | dunckr/retext-overuse | index.js | getOveruse | function getOveruse(duplicates, limit) {
var duplicate;
for (duplicate in duplicates) {
if (duplicates[duplicate] < limit) {
delete duplicates[duplicate]
}
}
return keys(duplicates);
} | javascript | function getOveruse(duplicates, limit) {
var duplicate;
for (duplicate in duplicates) {
if (duplicates[duplicate] < limit) {
delete duplicates[duplicate]
}
}
return keys(duplicates);
} | [
"function",
"getOveruse",
"(",
"duplicates",
",",
"limit",
")",
"{",
"var",
"duplicate",
";",
"for",
"(",
"duplicate",
"in",
"duplicates",
")",
"{",
"if",
"(",
"duplicates",
"[",
"duplicate",
"]",
"<",
"limit",
")",
"{",
"delete",
"duplicates",
"[",
"dup... | Get duplicates that are used too frequently.
@param {Object} duplicates - Phrases to search for.
@param {number} limit - Number of times phrase must have been used.
@return {Array.<string>} | [
"Get",
"duplicates",
"that",
"are",
"used",
"too",
"frequently",
"."
] | 4fc1a408cf24c11976f65a88f7e958dc3f868198 | https://github.com/dunckr/retext-overuse/blob/4fc1a408cf24c11976f65a88f7e958dc3f868198/index.js#L49-L57 |
46,554 | thysultan/jsx.js | index.js | use | function use (filepath, destination) {
var startTime = Date.now();
var text = read(filepath);
if (text !== false) {
fs.writeFile(destination, jsx(text), function (err) {
if (err) { throw err; }
var endTime = Date.now();
log('[Finished in ' + (endTime - startTime) + 'ms]');
});
} else... | javascript | function use (filepath, destination) {
var startTime = Date.now();
var text = read(filepath);
if (text !== false) {
fs.writeFile(destination, jsx(text), function (err) {
if (err) { throw err; }
var endTime = Date.now();
log('[Finished in ' + (endTime - startTime) + 'ms]');
});
} else... | [
"function",
"use",
"(",
"filepath",
",",
"destination",
")",
"{",
"var",
"startTime",
"=",
"Date",
".",
"now",
"(",
")",
";",
"var",
"text",
"=",
"read",
"(",
"filepath",
")",
";",
"if",
"(",
"text",
"!==",
"false",
")",
"{",
"fs",
".",
"writeFile"... | use the file to transpile | [
"use",
"the",
"file",
"to",
"transpile"
] | 8bac10d311d30dd9f2eb9c5b853635518414782a | https://github.com/thysultan/jsx.js/blob/8bac10d311d30dd9f2eb9c5b853635518414782a/index.js#L36-L50 |
46,555 | alexindigo/node-envar | index.js | envar | function envar(key)
{
var i, value;
// be extra paranoid
if (typeof key != 'string' || !key) return undefined;
// lookup according to the order
for (i=0; i<state.order.length; i++)
{
if ((value = lookup[state.order[i]](key)) !== undefined)
{
return value;
}
}
// nothing found
retu... | javascript | function envar(key)
{
var i, value;
// be extra paranoid
if (typeof key != 'string' || !key) return undefined;
// lookup according to the order
for (i=0; i<state.order.length; i++)
{
if ((value = lookup[state.order[i]](key)) !== undefined)
{
return value;
}
}
// nothing found
retu... | [
"function",
"envar",
"(",
"key",
")",
"{",
"var",
"i",
",",
"value",
";",
"// be extra paranoid",
"if",
"(",
"typeof",
"key",
"!=",
"'string'",
"||",
"!",
"key",
")",
"return",
"undefined",
";",
"// lookup according to the order",
"for",
"(",
"i",
"=",
"0"... | Looks up requested variable
@param {string} key - variable name to look for
@returns {mixed} - found variable or `undefined` if nothing found | [
"Looks",
"up",
"requested",
"variable"
] | 8599dbb82d6e160704543ff5d6623b6d49c501fb | https://github.com/alexindigo/node-envar/blob/8599dbb82d6e160704543ff5d6623b6d49c501fb/index.js#L41-L59 |
46,556 | ndp/csster | src/ie/rounded_corners.js | roundedCorners | function roundedCorners(side, radius) {
if (!radius) {
radius = side || 10;
side = 'all';
}
if (side == 'all') {
if (browserInfo().msie) {
return {
'border-radius': radius,
behavior: 'url(border-radius-ie.htc)',
visibility: 'hidden'
}
} else if (br... | javascript | function roundedCorners(side, radius) {
if (!radius) {
radius = side || 10;
side = 'all';
}
if (side == 'all') {
if (browserInfo().msie) {
return {
'border-radius': radius,
behavior: 'url(border-radius-ie.htc)',
visibility: 'hidden'
}
} else if (br... | [
"function",
"roundedCorners",
"(",
"side",
",",
"radius",
")",
"{",
"if",
"(",
"!",
"radius",
")",
"{",
"radius",
"=",
"side",
"||",
"10",
";",
"side",
"=",
"'all'",
";",
"}",
"if",
"(",
"side",
"==",
"'all'",
")",
"{",
"if",
"(",
"browserInfo",
... | Override of Csster's built-in method to support rounded corners on IE.
See docs there for description. | [
"Override",
"of",
"Csster",
"s",
"built",
"-",
"in",
"method",
"to",
"support",
"rounded",
"corners",
"on",
"IE",
".",
"See",
"docs",
"there",
"for",
"description",
"."
] | d836680b58dc8d6d06dc62c9893aca34c69d3de5 | https://github.com/ndp/csster/blob/d836680b58dc8d6d06dc62c9893aca34c69d3de5/src/ie/rounded_corners.js#L7-L54 |
46,557 | graemeboy/matrix-rotate | lib/rotateMatrix.js | transpose | function transpose(matrix) {
// For NxN matrix
var n = matrix[0].length;
var temp;
// Walk through columns
for (var i = 0, j = 0; i < n; i++) {
j = i;
// Walk through rows
while (j < n) {
if (i !== j) {
temp = matrix[i][j];
matrix[i][j] = matrix[j][i];
matrix[j][i] = temp;
}
j++;
}
}... | javascript | function transpose(matrix) {
// For NxN matrix
var n = matrix[0].length;
var temp;
// Walk through columns
for (var i = 0, j = 0; i < n; i++) {
j = i;
// Walk through rows
while (j < n) {
if (i !== j) {
temp = matrix[i][j];
matrix[i][j] = matrix[j][i];
matrix[j][i] = temp;
}
j++;
}
}... | [
"function",
"transpose",
"(",
"matrix",
")",
"{",
"// For NxN matrix",
"var",
"n",
"=",
"matrix",
"[",
"0",
"]",
".",
"length",
";",
"var",
"temp",
";",
"// Walk through columns",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"j",
"=",
"0",
";",
"i",
"<",
... | Transpose a 2D matrix | [
"Transpose",
"a",
"2D",
"matrix"
] | 126f52de06cb9c165505db7ba626cf308d586d4a | https://github.com/graemeboy/matrix-rotate/blob/126f52de06cb9c165505db7ba626cf308d586d4a/lib/rotateMatrix.js#L21-L39 |
46,558 | thealjey/webcompiler | lib/webpack.js | getConfig | function getConfig(react) {
const loaders = [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: _util.babelFEOptions
}, {
test: /\.json$/,
loader: 'json'
}, {
test: /jsdom/,
loader: 'null'
}];
if (react) {
loaders.unshift({
test: /\.js$/,
exclude... | javascript | function getConfig(react) {
const loaders = [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: _util.babelFEOptions
}, {
test: /\.json$/,
loader: 'json'
}, {
test: /jsdom/,
loader: 'null'
}];
if (react) {
loaders.unshift({
test: /\.js$/,
exclude... | [
"function",
"getConfig",
"(",
"react",
")",
"{",
"const",
"loaders",
"=",
"[",
"{",
"test",
":",
"/",
"\\.js$",
"/",
",",
"exclude",
":",
"/",
"node_modules",
"/",
",",
"loader",
":",
"'babel'",
",",
"query",
":",
"_util",
".",
"babelFEOptions",
"}",
... | Webpack helpers. Mostly for internal use.
You can use it to tweak the Babel options.
@module webpack
@private
Returns a webpack configuration object.
@memberof module:webpack
@private
@method getConfig
@param {boolean} react - true if the react loader is needed
@return {Object} webpack configuration object | [
"Webpack",
"helpers",
".",
"Mostly",
"for",
"internal",
"use",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/webpack.js#L59-L94 |
46,559 | thealjey/webcompiler | lib/webpack.js | getCompiler | function getCompiler(inPath, outPath, { library, libraryTarget }) {
const compiler = (0, _webpack2.default)(_extends({}, getConfig(false), {
devtool: _util.isProduction ? 'source-map' : 'eval-source-map',
entry: ['babel-polyfill', inPath],
output: { path: (0, _path.dirname)(outPath), filename: (0, _path.b... | javascript | function getCompiler(inPath, outPath, { library, libraryTarget }) {
const compiler = (0, _webpack2.default)(_extends({}, getConfig(false), {
devtool: _util.isProduction ? 'source-map' : 'eval-source-map',
entry: ['babel-polyfill', inPath],
output: { path: (0, _path.dirname)(outPath), filename: (0, _path.b... | [
"function",
"getCompiler",
"(",
"inPath",
",",
"outPath",
",",
"{",
"library",
",",
"libraryTarget",
"}",
")",
"{",
"const",
"compiler",
"=",
"(",
"0",
",",
"_webpack2",
".",
"default",
")",
"(",
"_extends",
"(",
"{",
"}",
",",
"getConfig",
"(",
"false... | Returns a webpack Compiler instance.
@memberof module:webpack
@private
@method getCompiler
@param {string} inPath - the path to an input file
@param {string} outPath - the path to an output file
@param {JSCompilerConfig} options - configuration object
@return {Object} webpack Compiler instance | [
"Returns",
"a",
"webpack",
"Compiler",
"instance",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/webpack.js#L107-L118 |
46,560 | 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 |
46,561 | 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 |
46,562 | 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 |
46,563 | 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 |
46,564 | 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 |
46,565 | 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 |
46,566 | 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 |
46,567 | 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 |
46,568 | 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 |
46,569 | 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 |
46,570 | 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 |
46,571 | 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 |
46,572 | 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 | |
46,573 | 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 |
46,574 | 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 |
46,575 | 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 |
46,576 | 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 |
46,577 | 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 |
46,578 | 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 |
46,579 | 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 |
46,580 | 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 |
46,581 | 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 |
46,582 | 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 |
46,583 | 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 |
46,584 | 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 |
46,585 | 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 |
46,586 | 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 |
46,587 | 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 |
46,588 | 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 | |
46,589 | 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 | |
46,590 | 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 | |
46,591 | 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 | |
46,592 | 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 |
46,593 | 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 |
46,594 | 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 |
46,595 | 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 |
46,596 | 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 |
46,597 | 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 |
46,598 | 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 | |
46,599 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.