repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Becklyn/becklyn-gulp | tasks/js_simple.js | compileSingleFile | function compileSingleFile (filePath, isDebug, options)
{
var outputPath = "./" + path.dirname(filePath).replace(/(^|\/)assets\/js/, "$1public/js");
var uglifyOptions = {};
gulpUtil.log(gulpUtil.colors.blue("Uglify"), pathHelper.makeRelative(filePath), " -> ", pathHelper.makeRelative(outputPath) + "/" + pa... | javascript | function compileSingleFile (filePath, isDebug, options)
{
var outputPath = "./" + path.dirname(filePath).replace(/(^|\/)assets\/js/, "$1public/js");
var uglifyOptions = {};
gulpUtil.log(gulpUtil.colors.blue("Uglify"), pathHelper.makeRelative(filePath), " -> ", pathHelper.makeRelative(outputPath) + "/" + pa... | [
"function",
"compileSingleFile",
"(",
"filePath",
",",
"isDebug",
",",
"options",
")",
"{",
"var",
"outputPath",
"=",
"\"./\"",
"+",
"path",
".",
"dirname",
"(",
"filePath",
")",
".",
"replace",
"(",
"/",
"(^|\\/)assets\\/js",
"/",
",",
"\"$1public/js\"",
")... | Compiles a single file
@param {string} filePath
@param {boolean} isDebug
@param {UglifyTaskOptions} options
@returns {*} | [
"Compiles",
"a",
"single",
"file"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/js_simple.js#L31-L53 | train |
tylerbeck/grunt-bower-map | classes/BowerMap.js | validateParameters | function validateParameters() {
grunt.verbose.writeln( 'BowerMap::validateParameters' );
//flag used to determine if validation passes
var check = true;
//lib path must be set
//TODO: get default bowerpath from .bowerrc
bowerPath = bowerPath || "bower_components";
if ( typeof bowerPath !== 'string' ) {
... | javascript | function validateParameters() {
grunt.verbose.writeln( 'BowerMap::validateParameters' );
//flag used to determine if validation passes
var check = true;
//lib path must be set
//TODO: get default bowerpath from .bowerrc
bowerPath = bowerPath || "bower_components";
if ( typeof bowerPath !== 'string' ) {
... | [
"function",
"validateParameters",
"(",
")",
"{",
"grunt",
".",
"verbose",
".",
"writeln",
"(",
"'BowerMap::validateParameters'",
")",
";",
"//flag used to determine if validation passes",
"var",
"check",
"=",
"true",
";",
"//lib path must be set",
"//TODO: get default bower... | validates bower copy task parameters
@returns {boolean} | [
"validates",
"bower",
"copy",
"task",
"parameters"
] | b72e43719123a8a1c09eff5bea48fe494693cb1d | https://github.com/tylerbeck/grunt-bower-map/blob/b72e43719123a8a1c09eff5bea48fe494693cb1d/classes/BowerMap.js#L103-L164 | train |
tylerbeck/grunt-bower-map | classes/BowerMap.js | handleListResults | function handleListResults( results ) {
grunt.verbose.writeln( 'BowerMap::handleListResults' );
for ( var k in results ) {
if ( results.hasOwnProperty( k ) ) {
grunt.verbose.writeln( '------------------------------------' );
grunt.verbose.writeln( ' ' + k + ' - ' + results[k] );
if ( ignore.index... | javascript | function handleListResults( results ) {
grunt.verbose.writeln( 'BowerMap::handleListResults' );
for ( var k in results ) {
if ( results.hasOwnProperty( k ) ) {
grunt.verbose.writeln( '------------------------------------' );
grunt.verbose.writeln( ' ' + k + ' - ' + results[k] );
if ( ignore.index... | [
"function",
"handleListResults",
"(",
"results",
")",
"{",
"grunt",
".",
"verbose",
".",
"writeln",
"(",
"'BowerMap::handleListResults'",
")",
";",
"for",
"(",
"var",
"k",
"in",
"results",
")",
"{",
"if",
"(",
"results",
".",
"hasOwnProperty",
"(",
"k",
")... | bower list results handler
@param results | [
"bower",
"list",
"results",
"handler"
] | b72e43719123a8a1c09eff5bea48fe494693cb1d | https://github.com/tylerbeck/grunt-bower-map/blob/b72e43719123a8a1c09eff5bea48fe494693cb1d/classes/BowerMap.js#L283-L299 | train |
tylerbeck/grunt-bower-map | classes/BowerMap.js | copyComponentFiles | function copyComponentFiles( name, files ) {
grunt.verbose.writeln( 'BowerMap::copyComponentFiles - ' + name );
//get map of files to copy
var componentMap = getComponentMapping( name, files );
//copy files
for ( var k in componentMap ) {
if ( componentMap.hasOwnProperty( k ) ) {
//console.log( path.f... | javascript | function copyComponentFiles( name, files ) {
grunt.verbose.writeln( 'BowerMap::copyComponentFiles - ' + name );
//get map of files to copy
var componentMap = getComponentMapping( name, files );
//copy files
for ( var k in componentMap ) {
if ( componentMap.hasOwnProperty( k ) ) {
//console.log( path.f... | [
"function",
"copyComponentFiles",
"(",
"name",
",",
"files",
")",
"{",
"grunt",
".",
"verbose",
".",
"writeln",
"(",
"'BowerMap::copyComponentFiles - '",
"+",
"name",
")",
";",
"//get map of files to copy",
"var",
"componentMap",
"=",
"getComponentMapping",
"(",
"na... | copies specified component files based on mapping
@param name
@param files
@returns {boolean} | [
"copies",
"specified",
"component",
"files",
"based",
"on",
"mapping"
] | b72e43719123a8a1c09eff5bea48fe494693cb1d | https://github.com/tylerbeck/grunt-bower-map/blob/b72e43719123a8a1c09eff5bea48fe494693cb1d/classes/BowerMap.js#L308-L327 | train |
tylerbeck/grunt-bower-map | classes/BowerMap.js | getComponentMapping | function getComponentMapping( name, files ) {
grunt.verbose.writeln( 'BowerMap::getComponentMapping - ' + name );
//first get list of all files
var fileList = [];
if ( shim[ name ] !== undefined ) {
grunt.verbose.writeln( ' using shim value' );
//use shim value
fileList = fileList.concat( shim[ na... | javascript | function getComponentMapping( name, files ) {
grunt.verbose.writeln( 'BowerMap::getComponentMapping - ' + name );
//first get list of all files
var fileList = [];
if ( shim[ name ] !== undefined ) {
grunt.verbose.writeln( ' using shim value' );
//use shim value
fileList = fileList.concat( shim[ na... | [
"function",
"getComponentMapping",
"(",
"name",
",",
"files",
")",
"{",
"grunt",
".",
"verbose",
".",
"writeln",
"(",
"'BowerMap::getComponentMapping - '",
"+",
"name",
")",
";",
"//first get list of all files",
"var",
"fileList",
"=",
"[",
"]",
";",
"if",
"(",
... | gets file mapping for specified component
@param name
@param files
@returns {{}} | [
"gets",
"file",
"mapping",
"for",
"specified",
"component"
] | b72e43719123a8a1c09eff5bea48fe494693cb1d | https://github.com/tylerbeck/grunt-bower-map/blob/b72e43719123a8a1c09eff5bea48fe494693cb1d/classes/BowerMap.js#L335-L415 | train |
tylerbeck/grunt-bower-map | classes/BowerMap.js | getCommonPathBase | function getCommonPathBase( paths ) {
var list = [];
var minLength = 999999999;
var commonPath = "";
//break up paths into parts
paths.forEach( function( file ) {
//normalize path seperators
file = file.replace( pathSepRegExp, path.sep );
//get resolved path parts for file directory
if ( file... | javascript | function getCommonPathBase( paths ) {
var list = [];
var minLength = 999999999;
var commonPath = "";
//break up paths into parts
paths.forEach( function( file ) {
//normalize path seperators
file = file.replace( pathSepRegExp, path.sep );
//get resolved path parts for file directory
if ( file... | [
"function",
"getCommonPathBase",
"(",
"paths",
")",
"{",
"var",
"list",
"=",
"[",
"]",
";",
"var",
"minLength",
"=",
"999999999",
";",
"var",
"commonPath",
"=",
"\"\"",
";",
"//break up paths into parts",
"paths",
".",
"forEach",
"(",
"function",
"(",
"file"... | determines a shared base path among paths
@param paths {Array} of strings
@returns {String} | [
"determines",
"a",
"shared",
"base",
"path",
"among",
"paths"
] | b72e43719123a8a1c09eff5bea48fe494693cb1d | https://github.com/tylerbeck/grunt-bower-map/blob/b72e43719123a8a1c09eff5bea48fe494693cb1d/classes/BowerMap.js#L423-L493 | train |
shuvava/dev-http-server | lib/httpserver.js | urlWeight | function urlWeight(config) {
if (isUndefined(config) || config.url == undefined) { // eslint-disable-line eqeqeq
return 0;
}
if (config.url instanceof RegExp) {
return 1 + config.url.toString().length;
}
if (isFunction(config.url)) {
return 1;
}
return 100 + config.ur... | javascript | function urlWeight(config) {
if (isUndefined(config) || config.url == undefined) { // eslint-disable-line eqeqeq
return 0;
}
if (config.url instanceof RegExp) {
return 1 + config.url.toString().length;
}
if (isFunction(config.url)) {
return 1;
}
return 100 + config.ur... | [
"function",
"urlWeight",
"(",
"config",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"config",
")",
"||",
"config",
".",
"url",
"==",
"undefined",
")",
"{",
"// eslint-disable-line eqeqeq",
"return",
"0",
";",
"}",
"if",
"(",
"config",
".",
"url",
"instanceof"... | Calculate relative weight of URL comparing object
@param {Object} config Internal object of URL comparing
@param {string|RegExp} [config.url] URL pattern to compare
@return {number} relative weight | [
"Calculate",
"relative",
"weight",
"of",
"URL",
"comparing",
"object"
] | db0f3b28f5805125959679828d81c1919cf519b6 | https://github.com/shuvava/dev-http-server/blob/db0f3b28f5805125959679828d81c1919cf519b6/lib/httpserver.js#L44-L55 | train |
andrewscwei/requiem | src/helpers/defineProperty.js | defineProperty | function defineProperty(element, propertyName, descriptor, scope) {
assert(element, 'Parameter \'element\' must be defined');
assertType(descriptor, 'object', false, 'Parameter \'descriptor\' must be an object literal');
assertType(descriptor.configurable, 'boolean', true, 'Optional configurable key in descriptor... | javascript | function defineProperty(element, propertyName, descriptor, scope) {
assert(element, 'Parameter \'element\' must be defined');
assertType(descriptor, 'object', false, 'Parameter \'descriptor\' must be an object literal');
assertType(descriptor.configurable, 'boolean', true, 'Optional configurable key in descriptor... | [
"function",
"defineProperty",
"(",
"element",
",",
"propertyName",
",",
"descriptor",
",",
"scope",
")",
"{",
"assert",
"(",
"element",
",",
"'Parameter \\'element\\' must be defined'",
")",
";",
"assertType",
"(",
"descriptor",
",",
"'object'",
",",
"false",
",",... | Defines a property in an element instance.
@param {Node} element - Element instance to define the new property in.
@param {string} propertyName - Name of the property to be defined.
@param {Object} descriptor - An object literal that defines the behavior of
this new property. This object literal inherits
that of the d... | [
"Defines",
"a",
"property",
"in",
"an",
"element",
"instance",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/helpers/defineProperty.js#L54-L146 | train |
jmjuanes/readl-async | index.js | function(file, opt)
{
//Check the file
if(typeof file !== 'string'){ throw new Error('Missing file argument'); return null; }
//Check the options
if(typeof opt === 'undefined'){ var opt = {}; }
//Save the file name
this._file = file;
//Check the encoding option
this._encoding = (typeof opt.encoding =... | javascript | function(file, opt)
{
//Check the file
if(typeof file !== 'string'){ throw new Error('Missing file argument'); return null; }
//Check the options
if(typeof opt === 'undefined'){ var opt = {}; }
//Save the file name
this._file = file;
//Check the encoding option
this._encoding = (typeof opt.encoding =... | [
"function",
"(",
"file",
",",
"opt",
")",
"{",
"//Check the file",
"if",
"(",
"typeof",
"file",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Missing file argument'",
")",
";",
"return",
"null",
";",
"}",
"//Check the options",
"if",
"(",
"t... | Read line by line object | [
"Read",
"line",
"by",
"line",
"object"
] | e263adbae41972cf7301360b412f293285305d75 | https://github.com/jmjuanes/readl-async/blob/e263adbae41972cf7301360b412f293285305d75/index.js#L6-L43 | train | |
joerx/grunt-crontab | lib/grunt-crontab.js | setup | function setup(done) {
crontab.load(function(err, ct) {
if (err) return done(err);
clean(ct);
load(ct);
ct.save(done);
});
} | javascript | function setup(done) {
crontab.load(function(err, ct) {
if (err) return done(err);
clean(ct);
load(ct);
ct.save(done);
});
} | [
"function",
"setup",
"(",
"done",
")",
"{",
"crontab",
".",
"load",
"(",
"function",
"(",
"err",
",",
"ct",
")",
"{",
"if",
"(",
"err",
")",
"return",
"done",
"(",
"err",
")",
";",
"clean",
"(",
"ct",
")",
";",
"load",
"(",
"ct",
")",
";",
"c... | Remove cronjobs from given crontab | [
"Remove",
"cronjobs",
"from",
"given",
"crontab"
] | 47e26c3d7897f79524ac1d37cd48acaf963fc1f3 | https://github.com/joerx/grunt-crontab/blob/47e26c3d7897f79524ac1d37cd48acaf963fc1f3/lib/grunt-crontab.js#L21-L28 | train |
joerx/grunt-crontab | lib/grunt-crontab.js | readCronFile | function readCronFile(cronfile) {
var substitutes = {
project: {
baseDir: process.cwd()
},
pkg: pkg
}
var content = _.template(grunt.file.read(cronfile), substitutes);
return JSON.parse(content).jobs;
} | javascript | function readCronFile(cronfile) {
var substitutes = {
project: {
baseDir: process.cwd()
},
pkg: pkg
}
var content = _.template(grunt.file.read(cronfile), substitutes);
return JSON.parse(content).jobs;
} | [
"function",
"readCronFile",
"(",
"cronfile",
")",
"{",
"var",
"substitutes",
"=",
"{",
"project",
":",
"{",
"baseDir",
":",
"process",
".",
"cwd",
"(",
")",
"}",
",",
"pkg",
":",
"pkg",
"}",
"var",
"content",
"=",
"_",
".",
"template",
"(",
"grunt",
... | Read cronjob definition file from disk. | [
"Read",
"cronjob",
"definition",
"file",
"from",
"disk",
"."
] | 47e26c3d7897f79524ac1d37cd48acaf963fc1f3 | https://github.com/joerx/grunt-crontab/blob/47e26c3d7897f79524ac1d37cd48acaf963fc1f3/lib/grunt-crontab.js#L59-L68 | train |
underdogio/resolve-link | lib/resolve-link.js | resolveLink | function resolveLink(srcUrl, targetUrl) {
// Parse the src URL
var srcUrlObj = url.parse(srcUrl);
// If there isn't a protocol
// DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`
if (!srcUrlObj.protocol) {
// With no protocol, we have everything in pathname. Add on `//` and force t... | javascript | function resolveLink(srcUrl, targetUrl) {
// Parse the src URL
var srcUrlObj = url.parse(srcUrl);
// If there isn't a protocol
// DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`
if (!srcUrlObj.protocol) {
// With no protocol, we have everything in pathname. Add on `//` and force t... | [
"function",
"resolveLink",
"(",
"srcUrl",
",",
"targetUrl",
")",
"{",
"// Parse the src URL",
"var",
"srcUrlObj",
"=",
"url",
".",
"parse",
"(",
"srcUrl",
")",
";",
"// If there isn't a protocol",
"// DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`",
... | Define our helper | [
"Define",
"our",
"helper"
] | 075ee9be703806ac0cb4cf36a8550c5357f4a686 | https://github.com/underdogio/resolve-link/blob/075ee9be703806ac0cb4cf36a8550c5357f4a686/lib/resolve-link.js#L6-L54 | train |
Nazariglez/perenquen | lib/pixi/src/core/textures/RenderTexture.js | RenderTexture | function RenderTexture(renderer, width, height, scaleMode, resolution)
{
if (!renderer)
{
throw new Error('Unable to create RenderTexture, you must pass a renderer into the constructor.');
}
width = width || 100;
height = height || 100;
resolution = resolution || CONST.RESOLUTION;
... | javascript | function RenderTexture(renderer, width, height, scaleMode, resolution)
{
if (!renderer)
{
throw new Error('Unable to create RenderTexture, you must pass a renderer into the constructor.');
}
width = width || 100;
height = height || 100;
resolution = resolution || CONST.RESOLUTION;
... | [
"function",
"RenderTexture",
"(",
"renderer",
",",
"width",
",",
"height",
",",
"scaleMode",
",",
"resolution",
")",
"{",
"if",
"(",
"!",
"renderer",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Unable to create RenderTexture, you must pass a renderer into the constructo... | A RenderTexture is a special texture that allows any Pixi display object to be rendered to it.
__Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded
otherwise black rectangles will be drawn instead.
A RenderTexture takes a snapshot of any Display Object given to its render met... | [
"A",
"RenderTexture",
"is",
"a",
"special",
"texture",
"that",
"allows",
"any",
"Pixi",
"display",
"object",
"to",
"be",
"rendered",
"to",
"it",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/textures/RenderTexture.js#L51-L174 | train |
senecajs-labs/seneca-sqlite-store | lib/sqlite-store.js | function (args, done) {
var q = _.clone(args.q)
var qent = args.qent
q.limit$ = 1
var qs = schemastm(qent)
self.connection.all(qs.text, function (err, results) {
if (err) {
return done(err)
}
var schema = {}
results.forEach(function (row) {
... | javascript | function (args, done) {
var q = _.clone(args.q)
var qent = args.qent
q.limit$ = 1
var qs = schemastm(qent)
self.connection.all(qs.text, function (err, results) {
if (err) {
return done(err)
}
var schema = {}
results.forEach(function (row) {
... | [
"function",
"(",
"args",
",",
"done",
")",
"{",
"var",
"q",
"=",
"_",
".",
"clone",
"(",
"args",
".",
"q",
")",
"var",
"qent",
"=",
"args",
".",
"qent",
"q",
".",
"limit$",
"=",
"1",
"var",
"qs",
"=",
"schemastm",
"(",
"qent",
")",
"self",
".... | load the first matching entity | [
"load",
"the",
"first",
"matching",
"entity"
] | 9d3f45f1ae093de30d709dbb990c4921263bf45e | https://github.com/senecajs-labs/seneca-sqlite-store/blob/9d3f45f1ae093de30d709dbb990c4921263bf45e/lib/sqlite-store.js#L52-L81 | train | |
forumone/yeoman-generator-bluebird | index.js | promptAsync | function promptAsync(prompts) {
return new Promise(function(resolve, reject) {
parent.prompt.call(parent, prompts, function(answers) {
resolve(answers)
});
});
} | javascript | function promptAsync(prompts) {
return new Promise(function(resolve, reject) {
parent.prompt.call(parent, prompts, function(answers) {
resolve(answers)
});
});
} | [
"function",
"promptAsync",
"(",
"prompts",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"parent",
".",
"prompt",
".",
"call",
"(",
"parent",
",",
"prompts",
",",
"function",
"(",
"answers",
")",
"{",
"... | Asynchronous prompt function that returns a Promise
@param prompts
@returns {Promise} | [
"Asynchronous",
"prompt",
"function",
"that",
"returns",
"a",
"Promise"
] | 01d917fe4bc9081e512a206d390b9661947d1f2f | https://github.com/forumone/yeoman-generator-bluebird/blob/01d917fe4bc9081e512a206d390b9661947d1f2f/index.js#L17-L23 | train |
forumone/yeoman-generator-bluebird | index.js | remoteAsync | function remoteAsync() {
var generator = this.generator;
var username;
var repo;
var branch;
var refresh;
var url;
// With URL and refresh
if (arguments.length <= 2) {
url = arguments[0];
refresh = arguments[1];
} else {
username = arguments[0];
repo = arguments[1];
branch = ar... | javascript | function remoteAsync() {
var generator = this.generator;
var username;
var repo;
var branch;
var refresh;
var url;
// With URL and refresh
if (arguments.length <= 2) {
url = arguments[0];
refresh = arguments[1];
} else {
username = arguments[0];
repo = arguments[1];
branch = ar... | [
"function",
"remoteAsync",
"(",
")",
"{",
"var",
"generator",
"=",
"this",
".",
"generator",
";",
"var",
"username",
";",
"var",
"repo",
";",
"var",
"branch",
";",
"var",
"refresh",
";",
"var",
"url",
";",
"// With URL and refresh",
"if",
"(",
"arguments",... | Asynchronous remote function that returns a Promise
@returns {Promise} | [
"Asynchronous",
"remote",
"function",
"that",
"returns",
"a",
"Promise"
] | 01d917fe4bc9081e512a206d390b9661947d1f2f | https://github.com/forumone/yeoman-generator-bluebird/blob/01d917fe4bc9081e512a206d390b9661947d1f2f/index.js#L30-L61 | train |
Wizcorp/panopticon | lib/TimedSample.js | TimedSample | function TimedSample(dt, timeStamp, persistObj, scaleFactor) {
var time = (dt[0] + dt[1] / 1e9) * 1000 / scaleFactor;
this.scaleFactor = scaleFactor;
this.min = time;
this.max = time;
this.sigma = new StandardDeviation(time);
this.average = new Average(time);
this.timeStamp = timeStamp;
if (persistObj) {
va... | javascript | function TimedSample(dt, timeStamp, persistObj, scaleFactor) {
var time = (dt[0] + dt[1] / 1e9) * 1000 / scaleFactor;
this.scaleFactor = scaleFactor;
this.min = time;
this.max = time;
this.sigma = new StandardDeviation(time);
this.average = new Average(time);
this.timeStamp = timeStamp;
if (persistObj) {
va... | [
"function",
"TimedSample",
"(",
"dt",
",",
"timeStamp",
",",
"persistObj",
",",
"scaleFactor",
")",
"{",
"var",
"time",
"=",
"(",
"dt",
"[",
"0",
"]",
"+",
"dt",
"[",
"1",
"]",
"/",
"1e9",
")",
"*",
"1000",
"/",
"scaleFactor",
";",
"this",
".",
"... | Timed sample object constructor.
@param {Number[]} dt Takes the output of a diff produced by feeding the result of one
hrtime as the parameter to another.
@param {Number} timeStamp A unix time stamp (in ms).
@param {Object} persistObj Emits reset events. An instance of timed sample belongs to this
object.
@p... | [
"Timed",
"sample",
"object",
"constructor",
"."
] | e0d660cd5287b45aafdb5a91e54affa7364b14e0 | https://github.com/Wizcorp/panopticon/blob/e0d660cd5287b45aafdb5a91e54affa7364b14e0/lib/TimedSample.js#L18-L35 | train |
MaximTovstashev/brest | lib/middleware/bodyparser.js | addMode | function addMode(middle, mode, settings) {
if (!modes.includes(mode)) throw `Incorrect bodyparser mode ${mode}`;
middle.push(bodyParser[mode](settings[mode]));
} | javascript | function addMode(middle, mode, settings) {
if (!modes.includes(mode)) throw `Incorrect bodyparser mode ${mode}`;
middle.push(bodyParser[mode](settings[mode]));
} | [
"function",
"addMode",
"(",
"middle",
",",
"mode",
",",
"settings",
")",
"{",
"if",
"(",
"!",
"modes",
".",
"includes",
"(",
"mode",
")",
")",
"throw",
"`",
"${",
"mode",
"}",
"`",
";",
"middle",
".",
"push",
"(",
"bodyParser",
"[",
"mode",
"]",
... | Add a single parse mode to the route middleware
@param middle
@param mode
@param settings | [
"Add",
"a",
"single",
"parse",
"mode",
"to",
"the",
"route",
"middleware"
] | 9b0bd6ee452e55b86cd01d1647f0dff460ad191f | https://github.com/MaximTovstashev/brest/blob/9b0bd6ee452e55b86cd01d1647f0dff460ad191f/lib/middleware/bodyparser.js#L29-L32 | train |
MaximTovstashev/brest | lib/middleware/bodyparser.js | initEndpoint | function initEndpoint(brest, description) {
const settings = _.defaultsDeep(description.bodyParser, settingsDefault);
if (description.bodyParserModes) {
description.bodyParserModes.forEach((mode) => addMode(description.middle, mode, settings));
} else {
const mode = description.bodyParserM... | javascript | function initEndpoint(brest, description) {
const settings = _.defaultsDeep(description.bodyParser, settingsDefault);
if (description.bodyParserModes) {
description.bodyParserModes.forEach((mode) => addMode(description.middle, mode, settings));
} else {
const mode = description.bodyParserM... | [
"function",
"initEndpoint",
"(",
"brest",
",",
"description",
")",
"{",
"const",
"settings",
"=",
"_",
".",
"defaultsDeep",
"(",
"description",
".",
"bodyParser",
",",
"settingsDefault",
")",
";",
"if",
"(",
"description",
".",
"bodyParserModes",
")",
"{",
"... | Setup bodyParser middleware according to settings
@param brest
@param description | [
"Setup",
"bodyParser",
"middleware",
"according",
"to",
"settings"
] | 9b0bd6ee452e55b86cd01d1647f0dff460ad191f | https://github.com/MaximTovstashev/brest/blob/9b0bd6ee452e55b86cd01d1647f0dff460ad191f/lib/middleware/bodyparser.js#L39-L51 | train |
ritenv/ng-wistia-components | ng-wistia-components.js | function (e, data) {
ctrl.coreWistia.setError(); //clear any previous errors
data
.submit()
.then(function (result, textStatus, jqXHR) {
ctrl.coreWistia.playVideo(result.hashed_id);
})
.catch(fun... | javascript | function (e, data) {
ctrl.coreWistia.setError(); //clear any previous errors
data
.submit()
.then(function (result, textStatus, jqXHR) {
ctrl.coreWistia.playVideo(result.hashed_id);
})
.catch(fun... | [
"function",
"(",
"e",
",",
"data",
")",
"{",
"ctrl",
".",
"coreWistia",
".",
"setError",
"(",
")",
";",
"//clear any previous errors",
"data",
".",
"submit",
"(",
")",
".",
"then",
"(",
"function",
"(",
"result",
",",
"textStatus",
",",
"jqXHR",
")",
"... | Called when a file is added for uploading | [
"Called",
"when",
"a",
"file",
"is",
"added",
"for",
"uploading"
] | d3aa58c2c52550e8784168073d91f1d62d90ed76 | https://github.com/ritenv/ng-wistia-components/blob/d3aa58c2c52550e8784168073d91f1d62d90ed76/ng-wistia-components.js#L194-L208 | train | |
ritenv/ng-wistia-components | ng-wistia-components.js | function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$timeout(function() {
ctrl.coreWistia.setProgress(progress);
});
} | javascript | function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$timeout(function() {
ctrl.coreWistia.setProgress(progress);
});
} | [
"function",
"(",
"e",
",",
"data",
")",
"{",
"var",
"progress",
"=",
"parseInt",
"(",
"data",
".",
"loaded",
"/",
"data",
".",
"total",
"*",
"100",
",",
"10",
")",
";",
"$timeout",
"(",
"function",
"(",
")",
"{",
"ctrl",
".",
"coreWistia",
".",
"... | Called whenever upload progress is updated | [
"Called",
"whenever",
"upload",
"progress",
"is",
"updated"
] | d3aa58c2c52550e8784168073d91f1d62d90ed76 | https://github.com/ritenv/ng-wistia-components/blob/d3aa58c2c52550e8784168073d91f1d62d90ed76/ng-wistia-components.js#L213-L219 | train | |
andreaswillems/mongo-crud-layer | lib/mongo-crud-layer.js | MongoCrud | function MongoCrud(uri, options, gridFS) {
this.uri = uri || 'mongodb://localhost:27017/mongo-crud-test';
this.options = options || {};
this.gridFS = gridFS;
} | javascript | function MongoCrud(uri, options, gridFS) {
this.uri = uri || 'mongodb://localhost:27017/mongo-crud-test';
this.options = options || {};
this.gridFS = gridFS;
} | [
"function",
"MongoCrud",
"(",
"uri",
",",
"options",
",",
"gridFS",
")",
"{",
"this",
".",
"uri",
"=",
"uri",
"||",
"'mongodb://localhost:27017/mongo-crud-test'",
";",
"this",
".",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"gridFS",
"=",... | Creates a MongoCrudLayer instance with given properties.
@param uri - the MongoDB URI, defaults to 'mongodb://localhost:27017/mongo-crud-test
@param options - Options used when connecting to MongoDB, defaults to an empty object
@param gridFS - set to true, if objects exceed MongoDB document limit of 16mb, to store
obj... | [
"Creates",
"a",
"MongoCrudLayer",
"instance",
"with",
"given",
"properties",
"."
] | 571c523c6b4f37226626c7eff339f745d94cbe68 | https://github.com/andreaswillems/mongo-crud-layer/blob/571c523c6b4f37226626c7eff339f745d94cbe68/lib/mongo-crud-layer.js#L24-L28 | train |
origin1tech/mustr | dist/cli.js | help | function help() {
var padBtm = [0, 0, 1, 0];
var msg = ' See additional required/optional arguments for each command below. \n';
pargv
.logo('Mustr', 'cyan')
.ui(95)
.join(chalk.magenta('Usage:'), 'mu', chalk.cyan('<cmd>'), '\n')
.div({ text: chalk.bgBlue.white(msg) })
... | javascript | function help() {
var padBtm = [0, 0, 1, 0];
var msg = ' See additional required/optional arguments for each command below. \n';
pargv
.logo('Mustr', 'cyan')
.ui(95)
.join(chalk.magenta('Usage:'), 'mu', chalk.cyan('<cmd>'), '\n')
.div({ text: chalk.bgBlue.white(msg) })
... | [
"function",
"help",
"(",
")",
"{",
"var",
"padBtm",
"=",
"[",
"0",
",",
"0",
",",
"1",
",",
"0",
"]",
";",
"var",
"msg",
"=",
"' See additional required/optional arguments for each command below. \\n'",
";",
"pargv",
".",
"logo",
"(",
"'Mustr'",
",",
"'cyan'... | Handler for help. | [
"Handler",
"for",
"help",
"."
] | 66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8 | https://github.com/origin1tech/mustr/blob/66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8/dist/cli.js#L37-L56 | train |
origin1tech/mustr | dist/cli.js | generate | function generate() {
var parsed = ensureConfig();
if (!parsed.name)
mu.log.error('cannot generate template using name of undefined.\n').write().exit();
// Generate the template.
mu.render(parsed.name, parsed.output, parsed.options);
} | javascript | function generate() {
var parsed = ensureConfig();
if (!parsed.name)
mu.log.error('cannot generate template using name of undefined.\n').write().exit();
// Generate the template.
mu.render(parsed.name, parsed.output, parsed.options);
} | [
"function",
"generate",
"(",
")",
"{",
"var",
"parsed",
"=",
"ensureConfig",
"(",
")",
";",
"if",
"(",
"!",
"parsed",
".",
"name",
")",
"mu",
".",
"log",
".",
"error",
"(",
"'cannot generate template using name of undefined.\\n'",
")",
".",
"write",
"(",
"... | Handler for generating templates. | [
"Handler",
"for",
"generating",
"templates",
"."
] | 66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8 | https://github.com/origin1tech/mustr/blob/66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8/dist/cli.js#L62-L68 | train |
origin1tech/mustr | dist/cli.js | rollback | function rollback() {
var parsed = ensureConfig();
var name = parsed.name;
// check if is an index number.
// if yes try to lookup the id
// by its index.
try {
var idx = void 0;
if (/^[0-9]+$/.test(name)) {
idx = parseInt(parsed.name) - 1;
if (idx >= 0) {... | javascript | function rollback() {
var parsed = ensureConfig();
var name = parsed.name;
// check if is an index number.
// if yes try to lookup the id
// by its index.
try {
var idx = void 0;
if (/^[0-9]+$/.test(name)) {
idx = parseInt(parsed.name) - 1;
if (idx >= 0) {... | [
"function",
"rollback",
"(",
")",
"{",
"var",
"parsed",
"=",
"ensureConfig",
"(",
")",
";",
"var",
"name",
"=",
"parsed",
".",
"name",
";",
"// check if is an index number.",
"// if yes try to lookup the id",
"// by its index.",
"try",
"{",
"var",
"idx",
"=",
"v... | Handler for rollbacks | [
"Handler",
"for",
"rollbacks"
] | 66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8 | https://github.com/origin1tech/mustr/blob/66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8/dist/cli.js#L70-L90 | train |
origin1tech/mustr | dist/cli.js | show | function show() {
var parsed = ensureConfig();
function showRollbacks() {
var rollbacks = mu.getRollbacks();
var keys = Object.keys(rollbacks);
var padBtm = [0, 0, 1, 0];
var ui = pargv.ui(105);
var i = keys.length;
var hdrNo = { text: " ", width: 5 };
var... | javascript | function show() {
var parsed = ensureConfig();
function showRollbacks() {
var rollbacks = mu.getRollbacks();
var keys = Object.keys(rollbacks);
var padBtm = [0, 0, 1, 0];
var ui = pargv.ui(105);
var i = keys.length;
var hdrNo = { text: " ", width: 5 };
var... | [
"function",
"show",
"(",
")",
"{",
"var",
"parsed",
"=",
"ensureConfig",
"(",
")",
";",
"function",
"showRollbacks",
"(",
")",
"{",
"var",
"rollbacks",
"=",
"mu",
".",
"getRollbacks",
"(",
")",
";",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"ro... | Handler for show | [
"Handler",
"for",
"show"
] | 66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8 | https://github.com/origin1tech/mustr/blob/66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8/dist/cli.js#L92-L128 | train |
syntheticore/declaire | src/clientAuth.js | function(username, pw) {
return _.ajax({
verb: 'POST',
url: '/login',
data: {
username: username,
password: pw
}
}).then(function(id) {
document.cookie = 'user=' + id;
return id;
});
} | javascript | function(username, pw) {
return _.ajax({
verb: 'POST',
url: '/login',
data: {
username: username,
password: pw
}
}).then(function(id) {
document.cookie = 'user=' + id;
return id;
});
} | [
"function",
"(",
"username",
",",
"pw",
")",
"{",
"return",
"_",
".",
"ajax",
"(",
"{",
"verb",
":",
"'POST'",
",",
"url",
":",
"'/login'",
",",
"data",
":",
"{",
"username",
":",
"username",
",",
"password",
":",
"pw",
"}",
"}",
")",
".",
"then"... | Return a promise that resolves to a user ID if authorization was successful | [
"Return",
"a",
"promise",
"that",
"resolves",
"to",
"a",
"user",
"ID",
"if",
"authorization",
"was",
"successful"
] | cb5ea205eeb3aa26fd0c6348e86d840c04e9ba9f | https://github.com/syntheticore/declaire/blob/cb5ea205eeb3aa26fd0c6348e86d840c04e9ba9f/src/clientAuth.js#L6-L18 | train | |
tableflip/uri-to-multiaddr | index.js | multiaddrFromUri | function multiaddrFromUri (uriStr, opts) {
opts = opts || {}
const defaultDnsType = opts.defaultDnsType || 'dns4'
const { scheme, hostname, port } = parseUri(uriStr)
const parts = [
tupleForHostname(hostname, defaultDnsType),
tupleForPort(port, scheme),
tupleForScheme(scheme)
]
const multiaddrSt... | javascript | function multiaddrFromUri (uriStr, opts) {
opts = opts || {}
const defaultDnsType = opts.defaultDnsType || 'dns4'
const { scheme, hostname, port } = parseUri(uriStr)
const parts = [
tupleForHostname(hostname, defaultDnsType),
tupleForPort(port, scheme),
tupleForScheme(scheme)
]
const multiaddrSt... | [
"function",
"multiaddrFromUri",
"(",
"uriStr",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
"const",
"defaultDnsType",
"=",
"opts",
".",
"defaultDnsType",
"||",
"'dns4'",
"const",
"{",
"scheme",
",",
"hostname",
",",
"port",
"}",
"=",
"par... | Convert a URI to a multiaddr
http://foobar.com => /dns4/foobar.com/tcp/80/http
https://foobar.com => /dns4/foobar.com/tcp/443/https
https://foobar.com:5001 => /dns4/foobar.com/tcp/5001/https
https://127.0.0.1:8080 => /ip4/127.0.0.1/tcp/8080/https
http://[::1]:8080 => /ip6/::1/tcp/8080/http
tcp://foobar.com:8080 => /dn... | [
"Convert",
"a",
"URI",
"to",
"a",
"multiaddr"
] | f92410ebc04f0d46eede7905c06e235f5c698758 | https://github.com/tableflip/uri-to-multiaddr/blob/f92410ebc04f0d46eede7905c06e235f5c698758/index.js#L16-L31 | train |
makanaleu/wmt-marketplace-auth | lib/headers.js | sign | function sign(custom, request) {
/**
* An Epoch timestamp is required for the digital signature.
*/
let epoch = Util.epochInMilliseconds();
/**
* Override the generated Epoch timestamp if a timestamp was included in the
* custom headers.
*/
if (custom.WMSecurity && custom.WMSecu... | javascript | function sign(custom, request) {
/**
* An Epoch timestamp is required for the digital signature.
*/
let epoch = Util.epochInMilliseconds();
/**
* Override the generated Epoch timestamp if a timestamp was included in the
* custom headers.
*/
if (custom.WMSecurity && custom.WMSecu... | [
"function",
"sign",
"(",
"custom",
",",
"request",
")",
"{",
"/**\n * An Epoch timestamp is required for the digital signature.\n */",
"let",
"epoch",
"=",
"Util",
".",
"epochInMilliseconds",
"(",
")",
";",
"/**\n * Override the generated Epoch timestamp if a timestam... | Returns the signed headers required for the API request.
@param custom Walmart authentication headers. Use the custom class to set custom
values to the headers before adding to the request.
@param request The request properties required to generate the digital signature. | [
"Returns",
"the",
"signed",
"headers",
"required",
"for",
"the",
"API",
"request",
"."
] | 1c48336293d52709bdda774ec1158193edf90773 | https://github.com/makanaleu/wmt-marketplace-auth/blob/1c48336293d52709bdda774ec1158193edf90773/lib/headers.js#L58-L95 | train |
makanaleu/wmt-marketplace-auth | lib/headers.js | digitalSignature | function digitalSignature(custom, request, epoch) {
/**
* Node Crypto Sign object that uses the given algorithm.
*
* @see {@link https://nodejs.org/api/crypto.html#crypto_class_sign}
*/
const signer = crypto_1.createSign('RSA-SHA256');
/**
* Walmart API request string to be signed.
... | javascript | function digitalSignature(custom, request, epoch) {
/**
* Node Crypto Sign object that uses the given algorithm.
*
* @see {@link https://nodejs.org/api/crypto.html#crypto_class_sign}
*/
const signer = crypto_1.createSign('RSA-SHA256');
/**
* Walmart API request string to be signed.
... | [
"function",
"digitalSignature",
"(",
"custom",
",",
"request",
",",
"epoch",
")",
"{",
"/**\n * Node Crypto Sign object that uses the given algorithm.\n *\n * @see {@link https://nodejs.org/api/crypto.html#crypto_class_sign}\n */",
"const",
"signer",
"=",
"crypto_1",
".... | Generates the digital signature required for the API request.
@param custom Walmart authentication headers. Use the custom class to set custom
values to the headers before adding to the request.
@param request The request properties required to generate the digital signature.
@param epoch An Epoch timestamp is requ... | [
"Generates",
"the",
"digital",
"signature",
"required",
"for",
"the",
"API",
"request",
"."
] | 1c48336293d52709bdda774ec1158193edf90773 | https://github.com/makanaleu/wmt-marketplace-auth/blob/1c48336293d52709bdda774ec1158193edf90773/lib/headers.js#L105-L127 | train |
andrewscwei/requiem | src/dom/namespace.js | namespace | function namespace(path, scope) {
assertType(path, 'string', true, 'Invalid parameter: path');
assertType(scope, 'object', true, 'Invalid optional parameter: scope');
if (!scope) scope = (window) ? window : {};
if (path === undefined || path === '') return scope;
let groups = path.split('.');
let currentS... | javascript | function namespace(path, scope) {
assertType(path, 'string', true, 'Invalid parameter: path');
assertType(scope, 'object', true, 'Invalid optional parameter: scope');
if (!scope) scope = (window) ? window : {};
if (path === undefined || path === '') return scope;
let groups = path.split('.');
let currentS... | [
"function",
"namespace",
"(",
"path",
",",
"scope",
")",
"{",
"assertType",
"(",
"path",
",",
"'string'",
",",
"true",
",",
"'Invalid parameter: path'",
")",
";",
"assertType",
"(",
"scope",
",",
"'object'",
",",
"true",
",",
"'Invalid optional parameter: scope'... | Generates a nested namespace in the specified scope, as described by the dot-
notated namespace path.
@param {string} [path] - Namespace path with keywords separated by dots.
@param {Object|window} [scope=window|{}] - Scope/object to create the nested
namespace in. If browser
environment is detected, this
param will d... | [
"Generates",
"a",
"nested",
"namespace",
"in",
"the",
"specified",
"scope",
"as",
"described",
"by",
"the",
"dot",
"-",
"notated",
"namespace",
"path",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/namespace.js#L23-L38 | train |
tolokoban/ToloFrameWork | lib/boilerplate.view.template.js | isSpecial | function isSpecial( obj, name ) {
if ( !obj ) return false;
if ( typeof obj[ 0 ] !== 'string' ) return false;
if ( typeof name === 'string' ) {
return obj[ 0 ].toLowerCase() === name;
}
return true;
} | javascript | function isSpecial( obj, name ) {
if ( !obj ) return false;
if ( typeof obj[ 0 ] !== 'string' ) return false;
if ( typeof name === 'string' ) {
return obj[ 0 ].toLowerCase() === name;
}
return true;
} | [
"function",
"isSpecial",
"(",
"obj",
",",
"name",
")",
"{",
"if",
"(",
"!",
"obj",
")",
"return",
"false",
";",
"if",
"(",
"typeof",
"obj",
"[",
"0",
"]",
"!==",
"'string'",
")",
"return",
"false",
";",
"if",
"(",
"typeof",
"name",
"===",
"'string'... | An object is special of and only if it's attribute of key "0" is a
string. | [
"An",
"object",
"is",
"special",
"of",
"and",
"only",
"if",
"it",
"s",
"attribute",
"of",
"key",
"0",
"is",
"a",
"string",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/boilerplate.view.template.js#L557-L564 | train |
tolokoban/ToloFrameWork | lib/boilerplate.view.template.js | createSectionStructure | function createSectionStructure() {
return {
init: null,
comments: [],
attribs: {
define: [],
init: []
},
elements: {
define: [],
init: []
},
events: [],
links: [],
ons: [],
statics: []
... | javascript | function createSectionStructure() {
return {
init: null,
comments: [],
attribs: {
define: [],
init: []
},
elements: {
define: [],
init: []
},
events: [],
links: [],
ons: [],
statics: []
... | [
"function",
"createSectionStructure",
"(",
")",
"{",
"return",
"{",
"init",
":",
"null",
",",
"comments",
":",
"[",
"]",
",",
"attribs",
":",
"{",
"define",
":",
"[",
"]",
",",
"init",
":",
"[",
"]",
"}",
",",
"elements",
":",
"{",
"define",
":",
... | Returns the initial content of Template.section.
@returns {object} Initial content of Template.section. | [
"Returns",
"the",
"initial",
"content",
"of",
"Template",
".",
"section",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/boilerplate.view.template.js#L595-L612 | train |
goblindegook/findup-node-modules | index.js | findPath | function findPath(path, directories) {
var cwd = directories[0];
if (!cwd) {
return null;
}
return findup(path, {cwd: cwd}) || findPath(path, slice.call(directories, 1));
} | javascript | function findPath(path, directories) {
var cwd = directories[0];
if (!cwd) {
return null;
}
return findup(path, {cwd: cwd}) || findPath(path, slice.call(directories, 1));
} | [
"function",
"findPath",
"(",
"path",
",",
"directories",
")",
"{",
"var",
"cwd",
"=",
"directories",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"cwd",
")",
"{",
"return",
"null",
";",
"}",
"return",
"findup",
"(",
"path",
",",
"{",
"cwd",
":",
"cwd",
"}... | Find the requested path inside a list of candidate directories.
@param {String} path Path to locate.
@param {Array} directories Array of directories.
@return {String} Located path, or null if not found. | [
"Find",
"the",
"requested",
"path",
"inside",
"a",
"list",
"of",
"candidate",
"directories",
"."
] | 9baecb55c615bd36d804226dc1568218ba059b11 | https://github.com/goblindegook/findup-node-modules/blob/9baecb55c615bd36d804226dc1568218ba059b11/index.js#L14-L22 | train |
tgi-io/tgi-store-local | spec/html-runner.js | log | function log(txt) {
var p = document.createElement("p");
p.style.margin = '2px';
p.style.padding = '1px';
p.style.backgroundColor = "#FFFFF0";
p.style.border = "solid";
p.style.borderWidth = "1px";
p.style.borderColor = "#7F7F8F";
p.style.l... | javascript | function log(txt) {
var p = document.createElement("p");
p.style.margin = '2px';
p.style.padding = '1px';
p.style.backgroundColor = "#FFFFF0";
p.style.border = "solid";
p.style.borderWidth = "1px";
p.style.borderColor = "#7F7F8F";
p.style.l... | [
"function",
"log",
"(",
"txt",
")",
"{",
"var",
"p",
"=",
"document",
".",
"createElement",
"(",
"\"p\"",
")",
";",
"p",
".",
"style",
".",
"margin",
"=",
"'2px'",
";",
"p",
".",
"style",
".",
"padding",
"=",
"'1px'",
";",
"p",
".",
"style",
".",... | DOM rendering functions | [
"DOM",
"rendering",
"functions"
] | e046eb06c1b2f9594988ecbad184d94176d267ae | https://github.com/tgi-io/tgi-store-local/blob/e046eb06c1b2f9594988ecbad184d94176d267ae/spec/html-runner.js#L33-L44 | train |
nbrownus/ppunit | lib/reporters/Dependencies.js | function (ppunit, writer) {
Dependencies.super_.call(this, ppunit, writer)
var self = this
self.subGraphs = []
ppunit.on('start', function () {
writer.write('digraph PPUnit {')
self.printNodes()
self.printSubGraphs()
self.printDependencies()
writer.write('}')
... | javascript | function (ppunit, writer) {
Dependencies.super_.call(this, ppunit, writer)
var self = this
self.subGraphs = []
ppunit.on('start', function () {
writer.write('digraph PPUnit {')
self.printNodes()
self.printSubGraphs()
self.printDependencies()
writer.write('}')
... | [
"function",
"(",
"ppunit",
",",
"writer",
")",
"{",
"Dependencies",
".",
"super_",
".",
"call",
"(",
"this",
",",
"ppunit",
",",
"writer",
")",
"var",
"self",
"=",
"this",
"self",
".",
"subGraphs",
"=",
"[",
"]",
"ppunit",
".",
"on",
"(",
"'start'",
... | Outputs graphviz dot notation of the test dependency graph
@param {PPUnit} ppunit PPUnit instance
@param {Object} writer An object that has a write method
@param {function} writer.write A method that writes the output
@constructor | [
"Outputs",
"graphviz",
"dot",
"notation",
"of",
"the",
"test",
"dependency",
"graph"
] | dcce602497d9548ce9085a8db115e65561dcc3de | https://github.com/nbrownus/ppunit/blob/dcce602497d9548ce9085a8db115e65561dcc3de/lib/reporters/Dependencies.js#L14-L27 | train | |
icelab/attache-upload.js | lib/index.js | abortXHRRequest | function abortXHRRequest(uid, fn) {
if (reqs.hasOwnProperty(uid)) {
if (!reqs[uid]) return;
if (fn) {
fn();
} else {
reqs[uid].abort();
}
delete reqs[uid];
return reqs;
}
} | javascript | function abortXHRRequest(uid, fn) {
if (reqs.hasOwnProperty(uid)) {
if (!reqs[uid]) return;
if (fn) {
fn();
} else {
reqs[uid].abort();
}
delete reqs[uid];
return reqs;
}
} | [
"function",
"abortXHRRequest",
"(",
"uid",
",",
"fn",
")",
"{",
"if",
"(",
"reqs",
".",
"hasOwnProperty",
"(",
"uid",
")",
")",
"{",
"if",
"(",
"!",
"reqs",
"[",
"uid",
"]",
")",
"return",
";",
"if",
"(",
"fn",
")",
"{",
"fn",
"(",
")",
";",
... | abortXHRRequest
Abort a XHR request by 'uid'
@param {String} uid
@param {Function} optional function
@return {Object} | [
"abortXHRRequest",
"Abort",
"a",
"XHR",
"request",
"by",
"uid"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/lib/index.js#L62-L74 | train |
icelab/attache-upload.js | lib/index.js | customError | function customError(name, error) {
return {
error: error,
message: error.message,
name: name
};
} | javascript | function customError(name, error) {
return {
error: error,
message: error.message,
name: name
};
} | [
"function",
"customError",
"(",
"name",
",",
"error",
")",
"{",
"return",
"{",
"error",
":",
"error",
",",
"message",
":",
"error",
".",
"message",
",",
"name",
":",
"name",
"}",
";",
"}"
] | customError
return an object forming a custom error message
@param {String} name
@param {Object} error
@return {Object} | [
"customError",
"return",
"an",
"object",
"forming",
"a",
"custom",
"error",
"message"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/lib/index.js#L84-L90 | train |
icelab/attache-upload.js | lib/index.js | responseStatus | function responseStatus(res) {
if (res.status >= 200 && res.status < 300) {
return res;
} else {
var error = new Error(res.statusText);
error.response = res;
throw customError('responseStatus', error);
}
} | javascript | function responseStatus(res) {
if (res.status >= 200 && res.status < 300) {
return res;
} else {
var error = new Error(res.statusText);
error.response = res;
throw customError('responseStatus', error);
}
} | [
"function",
"responseStatus",
"(",
"res",
")",
"{",
"if",
"(",
"res",
".",
"status",
">=",
"200",
"&&",
"res",
".",
"status",
"<",
"300",
")",
"{",
"return",
"res",
";",
"}",
"else",
"{",
"var",
"error",
"=",
"new",
"Error",
"(",
"res",
".",
"sta... | responseStatus
take a response and check the response `status` property
if between 200-300 return the response object
else throw a custom error
@param {Object} res
@return {Object} | [
"responseStatus",
"take",
"a",
"response",
"and",
"check",
"the",
"response",
"status",
"property",
"if",
"between",
"200",
"-",
"300",
"return",
"the",
"response",
"object",
"else",
"throw",
"a",
"custom",
"error"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/lib/index.js#L101-L109 | train |
icelab/attache-upload.js | lib/index.js | buildUploadURL | function buildUploadURL(url, uuid, expiration, hmac, filename) {
return url + '?uuid=' + uuid + '&expiration=' + expiration + '&hmac=' + hmac + '&file=' + filename;
} | javascript | function buildUploadURL(url, uuid, expiration, hmac, filename) {
return url + '?uuid=' + uuid + '&expiration=' + expiration + '&hmac=' + hmac + '&file=' + filename;
} | [
"function",
"buildUploadURL",
"(",
"url",
",",
"uuid",
",",
"expiration",
",",
"hmac",
",",
"filename",
")",
"{",
"return",
"url",
"+",
"'?uuid='",
"+",
"uuid",
"+",
"'&expiration='",
"+",
"expiration",
"+",
"'&hmac='",
"+",
"hmac",
"+",
"'&file='",
"+",
... | buildUploadURL
Construct a string using params
@param {String} url
@param {String} uuid
@param {String} expiration
@param {String} hmac
@param {String} filename
@return {String} | [
"buildUploadURL",
"Construct",
"a",
"string",
"using",
"params"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/lib/index.js#L133-L135 | train |
icelab/attache-upload.js | lib/index.js | uploadRequest | function uploadRequest(res, fileObject, showProgress) {
var url = res.url;
var expiration = res.expiration;
var hmac = res.hmac;
var uuid = res.uuid;
var file = fileObject.file;
var uid = fileObject.uid;
var upload_url = buildUploadURL(url, uuid, expiration, hmac, file.name);
return new Promise(functi... | javascript | function uploadRequest(res, fileObject, showProgress) {
var url = res.url;
var expiration = res.expiration;
var hmac = res.hmac;
var uuid = res.uuid;
var file = fileObject.file;
var uid = fileObject.uid;
var upload_url = buildUploadURL(url, uuid, expiration, hmac, file.name);
return new Promise(functi... | [
"function",
"uploadRequest",
"(",
"res",
",",
"fileObject",
",",
"showProgress",
")",
"{",
"var",
"url",
"=",
"res",
".",
"url",
";",
"var",
"expiration",
"=",
"res",
".",
"expiration",
";",
"var",
"hmac",
"=",
"res",
".",
"hmac",
";",
"var",
"uuid",
... | uploadRequest
Assign an XHR request to the `reqs` hash using the `uid`.
@param {Object} res - the response from presignRequest()
@param {File Object} file
@param {Function} on progress event handler
@return {Promise} | [
"uploadRequest",
"Assign",
"an",
"XHR",
"request",
"to",
"the",
"reqs",
"hash",
"using",
"the",
"uid",
"."
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/lib/index.js#L146-L171 | train |
tndinhbao/ngoto | index.spec.js | parseMiddleware | function parseMiddleware(ctx, next) {
try {
ctx.event = JSON.parse(ctx.content.toString());
next();
} catch (e) {
throw e;
}
} | javascript | function parseMiddleware(ctx, next) {
try {
ctx.event = JSON.parse(ctx.content.toString());
next();
} catch (e) {
throw e;
}
} | [
"function",
"parseMiddleware",
"(",
"ctx",
",",
"next",
")",
"{",
"try",
"{",
"ctx",
".",
"event",
"=",
"JSON",
".",
"parse",
"(",
"ctx",
".",
"content",
".",
"toString",
"(",
")",
")",
";",
"next",
"(",
")",
";",
"}",
"catch",
"(",
"e",
")",
"... | Parse JSON middleware
@param {String} msg | [
"Parse",
"JSON",
"middleware"
] | ed9877af5b31cb7afaebb4da2c497b3342d61f3c | https://github.com/tndinhbao/ngoto/blob/ed9877af5b31cb7afaebb4da2c497b3342d61f3c/index.spec.js#L27-L34 | train |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.common.resizing.js | function (e)
{
if (!RGraph.Resizing || !RGraph.Resizing.div || !RGraph.Resizing.mousedown) {
return;
}
if (RGraph.Resizing.div) {
var div = RGraph.Resizing.div;
var canvas = div.__canvas__;
... | javascript | function (e)
{
if (!RGraph.Resizing || !RGraph.Resizing.div || !RGraph.Resizing.mousedown) {
return;
}
if (RGraph.Resizing.div) {
var div = RGraph.Resizing.div;
var canvas = div.__canvas__;
... | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"RGraph",
".",
"Resizing",
"||",
"!",
"RGraph",
".",
"Resizing",
".",
"div",
"||",
"!",
"RGraph",
".",
"Resizing",
".",
"mousedown",
")",
"{",
"return",
";",
"}",
"if",
"(",
"RGraph",
".",
"Resizing",... | The window onmouseup function | [
"The",
"window",
"onmouseup",
"function"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.common.resizing.js#L184-L283 | train | |
aureooms/js-random | lib/kernel/_shuffle.js | _shuffle | function _shuffle(sample) {
var shuffle = function shuffle(a, i, j) {
sample(j - i, a, i, j);
};
return shuffle;
} | javascript | function _shuffle(sample) {
var shuffle = function shuffle(a, i, j) {
sample(j - i, a, i, j);
};
return shuffle;
} | [
"function",
"_shuffle",
"(",
"sample",
")",
"{",
"var",
"shuffle",
"=",
"function",
"shuffle",
"(",
"a",
",",
"i",
",",
"j",
")",
"{",
"sample",
"(",
"j",
"-",
"i",
",",
"a",
",",
"i",
",",
"j",
")",
";",
"}",
";",
"return",
"shuffle",
";",
"... | Shuffle array by sampling the complete array. | [
"Shuffle",
"array",
"by",
"sampling",
"the",
"complete",
"array",
"."
] | 4bc04ed5ddb90494d02d04ef4633915d383b9931 | https://github.com/aureooms/js-random/blob/4bc04ed5ddb90494d02d04ef4633915d383b9931/lib/kernel/_shuffle.js#L12-L19 | train |
me-box-archive/nodeZestClient | zest.js | function (token, path, payload, contentFormat) {
return new Promise((resolve,reject)=>{
let zh = NewZestHeader();
zh.code = 2;
zh.token = token;
zh.tkl = token.length;
zh.payload = payload;
zh.oc = 3;
... | javascript | function (token, path, payload, contentFormat) {
return new Promise((resolve,reject)=>{
let zh = NewZestHeader();
zh.code = 2;
zh.token = token;
zh.tkl = token.length;
zh.payload = payload;
zh.oc = 3;
... | [
"function",
"(",
"token",
",",
"path",
",",
"payload",
",",
"contentFormat",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"zh",
"=",
"NewZestHeader",
"(",
")",
";",
"zh",
".",
"code",
"=",
"2",
";... | a dict to keep track of observers so they can be closed | [
"a",
"dict",
"to",
"keep",
"track",
"of",
"observers",
"so",
"they",
"can",
"be",
"closed"
] | 4c2ef36f4bd21d9cbf4cdde74fd030ec7c807dd6 | https://github.com/me-box-archive/nodeZestClient/blob/4c2ef36f4bd21d9cbf4cdde74fd030ec7c807dd6/zest.js#L27-L50 | train | |
kulakowka/mithril-firebase-mixin | index.js | positionAfter | function positionAfter (arr, prevChild) {
var idx
if (prevChild === null) {
return 0
} else {
idx = findIndex(arr, prevChild)
return (idx === -1) ? arr.length : idx + 1
}
} | javascript | function positionAfter (arr, prevChild) {
var idx
if (prevChild === null) {
return 0
} else {
idx = findIndex(arr, prevChild)
return (idx === -1) ? arr.length : idx + 1
}
} | [
"function",
"positionAfter",
"(",
"arr",
",",
"prevChild",
")",
"{",
"var",
"idx",
"if",
"(",
"prevChild",
"===",
"null",
")",
"{",
"return",
"0",
"}",
"else",
"{",
"idx",
"=",
"findIndex",
"(",
"arr",
",",
"prevChild",
")",
"return",
"(",
"idx",
"==... | using the Firebase API's prevChild behavior, we place each element in the list after it's prev sibling or, if prevChild is null, at the beginning | [
"using",
"the",
"Firebase",
"API",
"s",
"prevChild",
"behavior",
"we",
"place",
"each",
"element",
"in",
"the",
"list",
"after",
"it",
"s",
"prev",
"sibling",
"or",
"if",
"prevChild",
"is",
"null",
"at",
"the",
"beginning"
] | d1ad7fde3918bed7df823b2da853d53a0f1358e9 | https://github.com/kulakowka/mithril-firebase-mixin/blob/d1ad7fde3918bed7df823b2da853d53a0f1358e9/index.js#L31-L39 | train |
aarki/grunt-lessvars | tasks/lib/extractor.js | toJS | function toJS(node, options, context) {
switch (node.type) {
// process numeric values and units
case 'Dimension':
var value = node.value;
var unit = options.units ? node.unit.toCSS(context) : null;
// if given a list of units to preserve, check if compiled unit ... | javascript | function toJS(node, options, context) {
switch (node.type) {
// process numeric values and units
case 'Dimension':
var value = node.value;
var unit = options.units ? node.unit.toCSS(context) : null;
// if given a list of units to preserve, check if compiled unit ... | [
"function",
"toJS",
"(",
"node",
",",
"options",
",",
"context",
")",
"{",
"switch",
"(",
"node",
".",
"type",
")",
"{",
"// process numeric values and units",
"case",
"'Dimension'",
":",
"var",
"value",
"=",
"node",
".",
"value",
";",
"var",
"unit",
"=",
... | modify how value nodes are coerced into JS values, if different from CSS | [
"modify",
"how",
"value",
"nodes",
"are",
"coerced",
"into",
"JS",
"values",
"if",
"different",
"from",
"CSS"
] | 9e4f5a5ef2df62f9633b7278dc67361398bb601b | https://github.com/aarki/grunt-lessvars/blob/9e4f5a5ef2df62f9633b7278dc67361398bb601b/tasks/lib/extractor.js#L99-L125 | train |
andrewscwei/requiem | src/dom/createElement.js | createElement | function createElement(value) {
if (!document) return null;
assertType(value, 'string', true, 'Value must be a string');
if (value.match(/^([a-z0-9]+-)+[a-z0-9]+$/)) {
return new (getElementRegistry(value))();
}
else {
let div = document.createElement('div');
if (value.indexOf('<') !== 0 && valu... | javascript | function createElement(value) {
if (!document) return null;
assertType(value, 'string', true, 'Value must be a string');
if (value.match(/^([a-z0-9]+-)+[a-z0-9]+$/)) {
return new (getElementRegistry(value))();
}
else {
let div = document.createElement('div');
if (value.indexOf('<') !== 0 && valu... | [
"function",
"createElement",
"(",
"value",
")",
"{",
"if",
"(",
"!",
"document",
")",
"return",
"null",
";",
"assertType",
"(",
"value",
",",
"'string'",
",",
"true",
",",
"'Value must be a string'",
")",
";",
"if",
"(",
"value",
".",
"match",
"(",
"/",
... | Creates a DOM element from the provided string.
@param {string} value - String describing the DOM element.
@return {Node} DOM element.
@alias module:requiem~dom.createElement | [
"Creates",
"a",
"DOM",
"element",
"from",
"the",
"provided",
"string",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/createElement.js#L17-L31 | train |
fengzilong/regular-router | src/installSync.js | install | function install(definition, Component) {
const Ctor = register(definition, Component);
// no dependencies
if (!definition.components) {
return Ctor;
}
const components = definition.components || {};
// avoid unnecessary re-registering for next time
delete definition.components;
// register comp... | javascript | function install(definition, Component) {
const Ctor = register(definition, Component);
// no dependencies
if (!definition.components) {
return Ctor;
}
const components = definition.components || {};
// avoid unnecessary re-registering for next time
delete definition.components;
// register comp... | [
"function",
"install",
"(",
"definition",
",",
"Component",
")",
"{",
"const",
"Ctor",
"=",
"register",
"(",
"definition",
",",
"Component",
")",
";",
"// no dependencies",
"if",
"(",
"!",
"definition",
".",
"components",
")",
"{",
"return",
"Ctor",
";",
"... | install single component | [
"install",
"single",
"component"
] | 897a6c571a935cec31dd0e51da0fb39f61e3a5d3 | https://github.com/fengzilong/regular-router/blob/897a6c571a935cec31dd0e51da0fb39f61e3a5d3/src/installSync.js#L6-L26 | train |
webmarketingroi/optimizely-x-node | lib/OptimizelyClient.js | parseHttpHeaders | function parseHttpHeaders(headers) {
var meta = {};
for (var headerName in headers) {
var headerValue = headers[headerName];
if (headerName=="x-ratelimit-limit") {
meta.rateLimit = headerValue;
} else if (headerName=="x-ratelimit-remaining") {
meta.r... | javascript | function parseHttpHeaders(headers) {
var meta = {};
for (var headerName in headers) {
var headerValue = headers[headerName];
if (headerName=="x-ratelimit-limit") {
meta.rateLimit = headerValue;
} else if (headerName=="x-ratelimit-remaining") {
meta.r... | [
"function",
"parseHttpHeaders",
"(",
"headers",
")",
"{",
"var",
"meta",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"headerName",
"in",
"headers",
")",
"{",
"var",
"headerValue",
"=",
"headers",
"[",
"headerName",
"]",
";",
"if",
"(",
"headerName",
"==",
"... | Private function that retrieves meta information from HTTP headers. | [
"Private",
"function",
"that",
"retrieves",
"meta",
"information",
"from",
"HTTP",
"headers",
"."
] | 64ac76f2aa44630c3d871d5003016f4910078c5e | https://github.com/webmarketingroi/optimizely-x-node/blob/64ac76f2aa44630c3d871d5003016f4910078c5e/lib/OptimizelyClient.js#L158-L197 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_CubeTexture | function getter_THREE_CubeTexture(inst) {
return [
inst.name,
inst.mipmaps,
inst.flipY,
inst.mapping,
inst.wrapS,
inst.wrapT,
inst.magFilter,
inst.minFilter,
inst.anisotropy,
inst.format,
inst.type,
inst.offset,
inst.repeat,
inst.unpackAlignment,
inst.image];
} | javascript | function getter_THREE_CubeTexture(inst) {
return [
inst.name,
inst.mipmaps,
inst.flipY,
inst.mapping,
inst.wrapS,
inst.wrapT,
inst.magFilter,
inst.minFilter,
inst.anisotropy,
inst.format,
inst.type,
inst.offset,
inst.repeat,
inst.unpackAlignment,
inst.image];
} | [
"function",
"getter_THREE_CubeTexture",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"name",
",",
"inst",
".",
"mipmaps",
",",
"inst",
".",
"flipY",
",",
"inst",
".",
"mapping",
",",
"inst",
".",
"wrapS",
",",
"inst",
".",
"wrapT",
",",
"inst",
... | Property getter THREE.CubeTexture | [
"Property",
"getter",
"THREE",
".",
"CubeTexture"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L30-L47 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_LineBasicMaterial | function getter_THREE_LineBasicMaterial(inst) {
return [
inst.name,
inst.side,
inst.opacity,
inst.blending,
inst.blendSrc,
inst.blendDst,
inst.blendEquation,
inst.depthFunc,
inst.polygonOffsetFactor,
inst.polygonOffsetUnits,
inst.alphaTest,
inst.overdraw,
inst.blendSrcAlpha,
inst.blendDstAl... | javascript | function getter_THREE_LineBasicMaterial(inst) {
return [
inst.name,
inst.side,
inst.opacity,
inst.blending,
inst.blendSrc,
inst.blendDst,
inst.blendEquation,
inst.depthFunc,
inst.polygonOffsetFactor,
inst.polygonOffsetUnits,
inst.alphaTest,
inst.overdraw,
inst.blendSrcAlpha,
inst.blendDstAl... | [
"function",
"getter_THREE_LineBasicMaterial",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"name",
",",
"inst",
".",
"side",
",",
"inst",
".",
"opacity",
",",
"inst",
".",
"blending",
",",
"inst",
".",
"blendSrc",
",",
"inst",
".",
"blendDst",
",",... | Property getter THREE.LineBasicMaterial | [
"Property",
"getter",
"THREE",
".",
"LineBasicMaterial"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L96-L126 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_SpriteMaterial | function getter_THREE_SpriteMaterial(inst) {
return [
inst.name,
inst.side,
inst.opacity,
inst.blending,
inst.blendSrc,
inst.blendDst,
inst.blendEquation,
inst.depthFunc,
inst.polygonOffsetFactor,
inst.polygonOffsetUnits,
inst.alphaTest,
inst.overdraw,
inst.blendSrcAlpha,
inst.blendDstAlpha... | javascript | function getter_THREE_SpriteMaterial(inst) {
return [
inst.name,
inst.side,
inst.opacity,
inst.blending,
inst.blendSrc,
inst.blendDst,
inst.blendEquation,
inst.depthFunc,
inst.polygonOffsetFactor,
inst.polygonOffsetUnits,
inst.alphaTest,
inst.overdraw,
inst.blendSrcAlpha,
inst.blendDstAlpha... | [
"function",
"getter_THREE_SpriteMaterial",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"name",
",",
"inst",
".",
"side",
",",
"inst",
".",
"opacity",
",",
"inst",
".",
"blending",
",",
"inst",
".",
"blendSrc",
",",
"inst",
".",
"blendDst",
",",
... | Property getter THREE.SpriteMaterial | [
"Property",
"getter",
"THREE",
".",
"SpriteMaterial"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L131-L159 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_MeshDepthMaterial | function getter_THREE_MeshDepthMaterial(inst) {
return [
inst.name,
inst.side,
inst.opacity,
inst.blending,
inst.blendSrc,
inst.blendDst,
inst.blendEquation,
inst.depthFunc,
inst.polygonOffsetFactor,
inst.polygonOffsetUnits,
inst.alphaTest,
inst.overdraw,
inst.blendSrcAlpha,
inst.blendDstAl... | javascript | function getter_THREE_MeshDepthMaterial(inst) {
return [
inst.name,
inst.side,
inst.opacity,
inst.blending,
inst.blendSrc,
inst.blendDst,
inst.blendEquation,
inst.depthFunc,
inst.polygonOffsetFactor,
inst.polygonOffsetUnits,
inst.alphaTest,
inst.overdraw,
inst.blendSrcAlpha,
inst.blendDstAl... | [
"function",
"getter_THREE_MeshDepthMaterial",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"name",
",",
"inst",
".",
"side",
",",
"inst",
".",
"opacity",
",",
"inst",
".",
"blending",
",",
"inst",
".",
"blendSrc",
",",
"inst",
".",
"blendDst",
",",... | Property getter THREE.MeshDepthMaterial | [
"Property",
"getter",
"THREE",
".",
"MeshDepthMaterial"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L231-L258 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_MeshLambertMaterial | function getter_THREE_MeshLambertMaterial(inst) {
return [
inst.name,
inst.side,
inst.opacity,
inst.blending,
inst.blendSrc,
inst.blendDst,
inst.blendEquation,
inst.depthFunc,
inst.polygonOffsetFactor,
inst.polygonOffsetUnits,
inst.alphaTest,
inst.overdraw,
inst.blendSrcAlpha,
inst.blendDst... | javascript | function getter_THREE_MeshLambertMaterial(inst) {
return [
inst.name,
inst.side,
inst.opacity,
inst.blending,
inst.blendSrc,
inst.blendDst,
inst.blendEquation,
inst.depthFunc,
inst.polygonOffsetFactor,
inst.polygonOffsetUnits,
inst.alphaTest,
inst.overdraw,
inst.blendSrcAlpha,
inst.blendDst... | [
"function",
"getter_THREE_MeshLambertMaterial",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"name",
",",
"inst",
".",
"side",
",",
"inst",
".",
"opacity",
",",
"inst",
".",
"blending",
",",
"inst",
".",
"blendSrc",
",",
"inst",
".",
"blendDst",
",... | Property getter THREE.MeshLambertMaterial | [
"Property",
"getter",
"THREE",
".",
"MeshLambertMaterial"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L263-L305 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_MeshPhongMaterial | function getter_THREE_MeshPhongMaterial(inst) {
return [
inst.name,
inst.side,
inst.opacity,
inst.blending,
inst.blendSrc,
inst.blendDst,
inst.blendEquation,
inst.depthFunc,
inst.polygonOffsetFactor,
inst.polygonOffsetUnits,
inst.alphaTest,
inst.overdraw,
inst.blendSrcAlpha,
inst.blendDstAl... | javascript | function getter_THREE_MeshPhongMaterial(inst) {
return [
inst.name,
inst.side,
inst.opacity,
inst.blending,
inst.blendSrc,
inst.blendDst,
inst.blendEquation,
inst.depthFunc,
inst.polygonOffsetFactor,
inst.polygonOffsetUnits,
inst.alphaTest,
inst.overdraw,
inst.blendSrcAlpha,
inst.blendDstAl... | [
"function",
"getter_THREE_MeshPhongMaterial",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"name",
",",
"inst",
".",
"side",
",",
"inst",
".",
"opacity",
",",
"inst",
".",
"blending",
",",
"inst",
".",
"blendSrc",
",",
"inst",
".",
"blendDst",
",",... | Property getter THREE.MeshPhongMaterial | [
"Property",
"getter",
"THREE",
".",
"MeshPhongMaterial"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L310-L369 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_Scene | function getter_THREE_Scene(inst) {
return [
inst.name,
inst.up,
inst.position,
inst.quaternion,
inst.scale,
inst.rotationAutoUpdate,
inst.matrix,
inst.matrixWorld,
inst.matrixAutoUpdate,
inst.visible,
inst.castShadow,
inst.receiveShadow,
inst.frustumCulled,
inst.renderOrder,
inst.userDat... | javascript | function getter_THREE_Scene(inst) {
return [
inst.name,
inst.up,
inst.position,
inst.quaternion,
inst.scale,
inst.rotationAutoUpdate,
inst.matrix,
inst.matrixWorld,
inst.matrixAutoUpdate,
inst.visible,
inst.castShadow,
inst.receiveShadow,
inst.frustumCulled,
inst.renderOrder,
inst.userDat... | [
"function",
"getter_THREE_Scene",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"name",
",",
"inst",
".",
"up",
",",
"inst",
".",
"position",
",",
"inst",
".",
"quaternion",
",",
"inst",
".",
"scale",
",",
"inst",
".",
"rotationAutoUpdate",
",",
"... | Property getter THREE.Scene | [
"Property",
"getter",
"THREE",
".",
"Scene"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L451-L471 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_Mesh | function getter_THREE_Mesh(inst) {
return [
inst.name,
inst.up,
inst.position,
inst.quaternion,
inst.scale,
inst.rotationAutoUpdate,
inst.matrix,
inst.matrixWorld,
inst.matrixAutoUpdate,
inst.visible,
inst.castShadow,
inst.receiveShadow,
inst.frustumCulled,
inst.renderOrder,
inst.userData... | javascript | function getter_THREE_Mesh(inst) {
return [
inst.name,
inst.up,
inst.position,
inst.quaternion,
inst.scale,
inst.rotationAutoUpdate,
inst.matrix,
inst.matrixWorld,
inst.matrixAutoUpdate,
inst.visible,
inst.castShadow,
inst.receiveShadow,
inst.frustumCulled,
inst.renderOrder,
inst.userData... | [
"function",
"getter_THREE_Mesh",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"name",
",",
"inst",
".",
"up",
",",
"inst",
".",
"position",
",",
"inst",
".",
"quaternion",
",",
"inst",
".",
"scale",
",",
"inst",
".",
"rotationAutoUpdate",
",",
"i... | Property getter THREE.Mesh | [
"Property",
"getter",
"THREE",
".",
"Mesh"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L607-L629 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_BufferGeometry | function getter_THREE_BufferGeometry(inst) {
return [
inst.vertices,
inst.faces,
inst.faceVertexUvs,
inst.morphTargets,
inst.morphNormals,
inst.morphColors,
inst.animations,
inst.boundingSphere,
inst.boundingBox,
inst.name,
inst.attributes,
inst.index];
} | javascript | function getter_THREE_BufferGeometry(inst) {
return [
inst.vertices,
inst.faces,
inst.faceVertexUvs,
inst.morphTargets,
inst.morphNormals,
inst.morphColors,
inst.animations,
inst.boundingSphere,
inst.boundingBox,
inst.name,
inst.attributes,
inst.index];
} | [
"function",
"getter_THREE_BufferGeometry",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"vertices",
",",
"inst",
".",
"faces",
",",
"inst",
".",
"faceVertexUvs",
",",
"inst",
".",
"morphTargets",
",",
"inst",
".",
"morphNormals",
",",
"inst",
".",
"m... | Property getter THREE.BufferGeometry | [
"Property",
"getter",
"THREE",
".",
"BufferGeometry"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L657-L671 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_Geometry | function getter_THREE_Geometry(inst) {
return [
inst.vertices,
inst.faces,
inst.faceVertexUvs,
inst.morphTargets,
inst.morphNormals,
inst.morphColors,
inst.animations,
inst.boundingSphere,
inst.boundingBox,
inst.name];
} | javascript | function getter_THREE_Geometry(inst) {
return [
inst.vertices,
inst.faces,
inst.faceVertexUvs,
inst.morphTargets,
inst.morphNormals,
inst.morphColors,
inst.animations,
inst.boundingSphere,
inst.boundingBox,
inst.name];
} | [
"function",
"getter_THREE_Geometry",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"vertices",
",",
"inst",
".",
"faces",
",",
"inst",
".",
"faceVertexUvs",
",",
"inst",
".",
"morphTargets",
",",
"inst",
".",
"morphNormals",
",",
"inst",
".",
"morphCo... | Property getter THREE.Geometry | [
"Property",
"getter",
"THREE",
".",
"Geometry"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L847-L859 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_Vector4 | function getter_THREE_Vector4(inst) {
return [
inst.x,
inst.y,
inst.z,
inst.w];
} | javascript | function getter_THREE_Vector4(inst) {
return [
inst.x,
inst.y,
inst.z,
inst.w];
} | [
"function",
"getter_THREE_Vector4",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"x",
",",
"inst",
".",
"y",
",",
"inst",
".",
"z",
",",
"inst",
".",
"w",
"]",
";",
"}"
] | Property getter THREE.Vector4 | [
"Property",
"getter",
"THREE",
".",
"Vector4"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L883-L889 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_Face3 | function getter_THREE_Face3(inst) {
return [
inst.a,
inst.b,
inst.c,
inst.materialIndex,
inst.normal,
inst.color,
inst.vertexNormals,
inst.vertexColors];
} | javascript | function getter_THREE_Face3(inst) {
return [
inst.a,
inst.b,
inst.c,
inst.materialIndex,
inst.normal,
inst.color,
inst.vertexNormals,
inst.vertexColors];
} | [
"function",
"getter_THREE_Face3",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"a",
",",
"inst",
".",
"b",
",",
"inst",
".",
"c",
",",
"inst",
".",
"materialIndex",
",",
"inst",
".",
"normal",
",",
"inst",
".",
"color",
",",
"inst",
".",
"ver... | Property getter THREE.Face3 | [
"Property",
"getter",
"THREE",
".",
"Face3"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L894-L904 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_Quaternion | function getter_THREE_Quaternion(inst) {
return [
inst._x,
inst._y,
inst._z,
inst._w];
} | javascript | function getter_THREE_Quaternion(inst) {
return [
inst._x,
inst._y,
inst._z,
inst._w];
} | [
"function",
"getter_THREE_Quaternion",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"_x",
",",
"inst",
".",
"_y",
",",
"inst",
".",
"_z",
",",
"inst",
".",
"_w",
"]",
";",
"}"
] | Property getter THREE.Quaternion | [
"Property",
"getter",
"THREE",
".",
"Quaternion"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L919-L925 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_Euler | function getter_THREE_Euler(inst) {
return [
inst._x,
inst._y,
inst._z,
inst._order];
} | javascript | function getter_THREE_Euler(inst) {
return [
inst._x,
inst._y,
inst._z,
inst._order];
} | [
"function",
"getter_THREE_Euler",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"_x",
",",
"inst",
".",
"_y",
",",
"inst",
".",
"_z",
",",
"inst",
".",
"_order",
"]",
";",
"}"
] | Property getter THREE.Euler | [
"Property",
"getter",
"THREE",
".",
"Euler"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L930-L936 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_BufferAttribute | function getter_THREE_BufferAttribute(inst) {
return [
inst.array,
inst.itemSize,
inst.dynamic,
inst.updateRange];
} | javascript | function getter_THREE_BufferAttribute(inst) {
return [
inst.array,
inst.itemSize,
inst.dynamic,
inst.updateRange];
} | [
"function",
"getter_THREE_BufferAttribute",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"array",
",",
"inst",
".",
"itemSize",
",",
"inst",
".",
"dynamic",
",",
"inst",
".",
"updateRange",
"]",
";",
"}"
] | Property getter THREE.BufferAttribute | [
"Property",
"getter",
"THREE",
".",
"BufferAttribute"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L984-L990 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_PerspectiveCamera | function getter_THREE_PerspectiveCamera(inst) {
return [
inst.fov,
inst.aspect,
inst.near,
inst.far];
} | javascript | function getter_THREE_PerspectiveCamera(inst) {
return [
inst.fov,
inst.aspect,
inst.near,
inst.far];
} | [
"function",
"getter_THREE_PerspectiveCamera",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"fov",
",",
"inst",
".",
"aspect",
",",
"inst",
".",
"near",
",",
"inst",
".",
"far",
"]",
";",
"}"
] | Property getter THREE.PerspectiveCamera | [
"Property",
"getter",
"THREE",
".",
"PerspectiveCamera"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L1078-L1084 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_OrthographicCamera | function getter_THREE_OrthographicCamera(inst) {
return [
inst.left,
inst.right,
inst.top,
inst.bottom,
inst.near,
inst.far];
} | javascript | function getter_THREE_OrthographicCamera(inst) {
return [
inst.left,
inst.right,
inst.top,
inst.bottom,
inst.near,
inst.far];
} | [
"function",
"getter_THREE_OrthographicCamera",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"left",
",",
"inst",
".",
"right",
",",
"inst",
".",
"top",
",",
"inst",
".",
"bottom",
",",
"inst",
".",
"near",
",",
"inst",
".",
"far",
"]",
";",
"}"... | Property getter THREE.OrthographicCamera | [
"Property",
"getter",
"THREE",
".",
"OrthographicCamera"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L1089-L1097 | train |
wavesoft/jbb-profile-three | profile-encode.js | getter_THREE_MD2Character | function getter_THREE_MD2Character(inst) {
return [
inst.scale,
inst.animationFPS,
inst.root,
inst.meshBody,
inst.skinsBody,
inst.meshWeapon,
inst.skinsWeapon,
inst.weapons,
inst.activeAnimation];
} | javascript | function getter_THREE_MD2Character(inst) {
return [
inst.scale,
inst.animationFPS,
inst.root,
inst.meshBody,
inst.skinsBody,
inst.meshWeapon,
inst.skinsWeapon,
inst.weapons,
inst.activeAnimation];
} | [
"function",
"getter_THREE_MD2Character",
"(",
"inst",
")",
"{",
"return",
"[",
"inst",
".",
"scale",
",",
"inst",
".",
"animationFPS",
",",
"inst",
".",
"root",
",",
"inst",
".",
"meshBody",
",",
"inst",
".",
"skinsBody",
",",
"inst",
".",
"meshWeapon",
... | Property getter THREE.MD2Character | [
"Property",
"getter",
"THREE",
".",
"MD2Character"
] | 8539cfbb2d04b67999eee6e530fcaf03083e0e04 | https://github.com/wavesoft/jbb-profile-three/blob/8539cfbb2d04b67999eee6e530fcaf03083e0e04/profile-encode.js#L1112-L1123 | train |
Lindurion/closure-pro-build | lib/graph-util.js | addSetValues | function addSetValues(args) {
for (var key in args.from) {
if (args.from[key]) {
args.to[key] = true;
}
}
} | javascript | function addSetValues(args) {
for (var key in args.from) {
if (args.from[key]) {
args.to[key] = true;
}
}
} | [
"function",
"addSetValues",
"(",
"args",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"args",
".",
"from",
")",
"{",
"if",
"(",
"args",
".",
"from",
"[",
"key",
"]",
")",
"{",
"args",
".",
"to",
"[",
"key",
"]",
"=",
"true",
";",
"}",
"}",
"}"
] | Makes 'to' the set union of 'from' and 'to'.
@param {!{from: !Object.<string, boolean>, to: !Object.<string, boolean>}}
args | [
"Makes",
"to",
"the",
"set",
"union",
"of",
"from",
"and",
"to",
"."
] | c279d0fcc3a65969d2fe965f55e627b074792f1a | https://github.com/Lindurion/closure-pro-build/blob/c279d0fcc3a65969d2fe965f55e627b074792f1a/lib/graph-util.js#L32-L38 | train |
sendanor/nor-errors | src/HTTPError.js | HTTPError | function HTTPError() {
var args = Array.prototype.slice.call(arguments);
if(!(this instanceof HTTPError)) {
if(args.length === 1) {
return new HTTPError(args[0]);
} else if(args.length === 2) {
return new HTTPError(args[0], args[1]);
} else if(args.length === 3) {
return new HTTPError(args[0], args[1],... | javascript | function HTTPError() {
var args = Array.prototype.slice.call(arguments);
if(!(this instanceof HTTPError)) {
if(args.length === 1) {
return new HTTPError(args[0]);
} else if(args.length === 2) {
return new HTTPError(args[0], args[1]);
} else if(args.length === 3) {
return new HTTPError(args[0], args[1],... | [
"function",
"HTTPError",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"HTTPError",
")",
")",
"{",
"if",
"(",
"args",
".",
"length",
"... | Exception type for HTTP errors | [
"Exception",
"type",
"for",
"HTTP",
"errors"
] | 17e0f00816db53023fcae4847ed7ce67e993ddbf | https://github.com/sendanor/nor-errors/blob/17e0f00816db53023fcae4847ed7ce67e993ddbf/src/HTTPError.js#L10-L46 | train |
nodejitsu/packages-pagelet | resolve.js | reduce | function reduce(data, fn) {
delete data.package.readmeFilename; // README is already parsed.
delete data.package.versions; // Adds to much bloat.
delete data.package.readme; // README is already parsed.
//
// Remove circular references as it would prevent us from caching in Redis or
// ... | javascript | function reduce(data, fn) {
delete data.package.readmeFilename; // README is already parsed.
delete data.package.versions; // Adds to much bloat.
delete data.package.readme; // README is already parsed.
//
// Remove circular references as it would prevent us from caching in Redis or
// ... | [
"function",
"reduce",
"(",
"data",
",",
"fn",
")",
"{",
"delete",
"data",
".",
"package",
".",
"readmeFilename",
";",
"// README is already parsed.",
"delete",
"data",
".",
"package",
".",
"versions",
";",
"// Adds to much bloat.",
"delete",
"data",
".",
"packag... | Reduce the massive data structure to something useful.
@param {Object} data The received data structure.
@param {Function} fn The callback.
@api private | [
"Reduce",
"the",
"massive",
"data",
"structure",
"to",
"something",
"useful",
"."
] | 10c4bdb1a99a808b58e41d87c8e7ec8c9947a3d8 | https://github.com/nodejitsu/packages-pagelet/blob/10c4bdb1a99a808b58e41d87c8e7ec8c9947a3d8/resolve.js#L105-L160 | train |
nodejitsu/packages-pagelet | resolve.js | clients | function clients(options) {
options = options || {};
options.registry = options.registry || Registry.mirrors.nodejitsu;
var githulk = options.githulk || new GitHulk();
//
// Only create a new Registry instance if we've been supplied with a string.
//
var npm = 'string' !== typeof options.registry
? ... | javascript | function clients(options) {
options = options || {};
options.registry = options.registry || Registry.mirrors.nodejitsu;
var githulk = options.githulk || new GitHulk();
//
// Only create a new Registry instance if we've been supplied with a string.
//
var npm = 'string' !== typeof options.registry
? ... | [
"function",
"clients",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"options",
".",
"registry",
"=",
"options",
".",
"registry",
"||",
"Registry",
".",
"mirrors",
".",
"nodejitsu",
";",
"var",
"githulk",
"=",
"options",
".",
... | Simple helper function to get a working npm and githulk client.
@param {Object} options Configuration.
@returns {Object} Pre-configured npm and git.
@api private | [
"Simple",
"helper",
"function",
"to",
"get",
"a",
"working",
"npm",
"and",
"githulk",
"client",
"."
] | 10c4bdb1a99a808b58e41d87c8e7ec8c9947a3d8 | https://github.com/nodejitsu/packages-pagelet/blob/10c4bdb1a99a808b58e41d87c8e7ec8c9947a3d8/resolve.js#L169-L189 | train |
ayan4m1/pg-redis | dist/index.js | function(text, options) {
var execute, queried;
queried = p.defer();
// caching disabled unless duration is specified
options = options != null ? options : {
duration: 0
};
execute = function(params) {
return db.prepare(text).then(function(stmt) {
return stmt.execute(params).... | javascript | function(text, options) {
var execute, queried;
queried = p.defer();
// caching disabled unless duration is specified
options = options != null ? options : {
duration: 0
};
execute = function(params) {
return db.prepare(text).then(function(stmt) {
return stmt.execute(params).... | [
"function",
"(",
"text",
",",
"options",
")",
"{",
"var",
"execute",
",",
"queried",
";",
"queried",
"=",
"p",
".",
"defer",
"(",
")",
";",
"// caching disabled unless duration is specified",
"options",
"=",
"options",
"!=",
"null",
"?",
"options",
":",
"{",... | expose simplified, cache-enabled api | [
"expose",
"simplified",
"cache",
"-",
"enabled",
"api"
] | 131b1a7e566bfc73472bd53e42a07a753ed1b528 | https://github.com/ayan4m1/pg-redis/blob/131b1a7e566bfc73472bd53e42a07a753ed1b528/dist/index.js#L14-L42 | train | |
feedhenry/fh-mbaas-middleware | lib/middleware/app.js | findOrCreateMbaasApp | function findOrCreateMbaasApp(req, res, next){
log.logger.debug("findOrCreateMbaasApp ", req.params);
var models = mbaas.getModels();
//Checking For Required Params
var missingParams = _.filter(["appGuid", "apiKey", "coreHost"], function(requiredKey){
return validation.validateParamPresent(requiredKey, re... | javascript | function findOrCreateMbaasApp(req, res, next){
log.logger.debug("findOrCreateMbaasApp ", req.params);
var models = mbaas.getModels();
//Checking For Required Params
var missingParams = _.filter(["appGuid", "apiKey", "coreHost"], function(requiredKey){
return validation.validateParamPresent(requiredKey, re... | [
"function",
"findOrCreateMbaasApp",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"log",
".",
"logger",
".",
"debug",
"(",
"\"findOrCreateMbaasApp \"",
",",
"req",
".",
"params",
")",
";",
"var",
"models",
"=",
"mbaas",
".",
"getModels",
"(",
")",
";",
... | Middleware To Find Or Create An Mbaas App
@param req
@param res
@param next | [
"Middleware",
"To",
"Find",
"Or",
"Create",
"An",
"Mbaas",
"App"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/middleware/app.js#L14-L65 | train |
feedhenry/fh-mbaas-middleware | lib/middleware/app.js | findMbaasApp | function findMbaasApp(req, res, next){
log.logger.debug("findMbaasApp for appname " + req.params.appname);
getMbaasApp({
'$or': [{name: req.params.appname}, {guid: req.params.appname}]
}, function(err, appMbaas){
if(err){
log.logger.debug("findMbaasApp Error ", err);
return next(err);
}
... | javascript | function findMbaasApp(req, res, next){
log.logger.debug("findMbaasApp for appname " + req.params.appname);
getMbaasApp({
'$or': [{name: req.params.appname}, {guid: req.params.appname}]
}, function(err, appMbaas){
if(err){
log.logger.debug("findMbaasApp Error ", err);
return next(err);
}
... | [
"function",
"findMbaasApp",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"log",
".",
"logger",
".",
"debug",
"(",
"\"findMbaasApp for appname \"",
"+",
"req",
".",
"params",
".",
"appname",
")",
";",
"getMbaasApp",
"(",
"{",
"'$or'",
":",
"[",
"{",
"... | Middleware For Finding An App
@param req
@param res
@param next | [
"Middleware",
"For",
"Finding",
"An",
"App"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/middleware/app.js#L73-L87 | train |
feedhenry/fh-mbaas-middleware | lib/middleware/app.js | getMbaasApp | function getMbaasApp(params, cb){
var models = mbaas.getModels();
models.AppMbaas.findOne(params, cb);
} | javascript | function getMbaasApp(params, cb){
var models = mbaas.getModels();
models.AppMbaas.findOne(params, cb);
} | [
"function",
"getMbaasApp",
"(",
"params",
",",
"cb",
")",
"{",
"var",
"models",
"=",
"mbaas",
".",
"getModels",
"(",
")",
";",
"models",
".",
"AppMbaas",
".",
"findOne",
"(",
"params",
",",
"cb",
")",
";",
"}"
] | Function to get an mbaas app model. | [
"Function",
"to",
"get",
"an",
"mbaas",
"app",
"model",
"."
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/middleware/app.js#L90-L93 | train |
feedhenry/fh-mbaas-middleware | lib/middleware/app.js | updateMbaasApp | function updateMbaasApp(req, res, next){
var model = req.appMbaasModel;
model.name = req.params.appname;
model.domain = req.params.domain;
model.environment = req.params.environment;
model.guid = req.body.appGuid;
model.apiKey = req.body.apiKey;
model.coreHost = req.body.coreHost;
model.type = req.body... | javascript | function updateMbaasApp(req, res, next){
var model = req.appMbaasModel;
model.name = req.params.appname;
model.domain = req.params.domain;
model.environment = req.params.environment;
model.guid = req.body.appGuid;
model.apiKey = req.body.apiKey;
model.coreHost = req.body.coreHost;
model.type = req.body... | [
"function",
"updateMbaasApp",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"model",
"=",
"req",
".",
"appMbaasModel",
";",
"model",
".",
"name",
"=",
"req",
".",
"params",
".",
"appname",
";",
"model",
".",
"domain",
"=",
"req",
".",
"params... | Middleware To Update An Existing App Deployment
@param req
@param res
@param next | [
"Middleware",
"To",
"Update",
"An",
"Existing",
"App",
"Deployment"
] | f906e98efbb4b0963bf5137b34b5e0589ba24e69 | https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/middleware/app.js#L101-L118 | train |
redisjs/jsr-server | lib/command/transaction/discard.js | execute | function execute(req, res) {
// unwatch keys, clear references,
// and destroy the transaction reference on the conn
// and send the reply
req.conn.transaction.destroy(req, res, null, Constants.OK);
} | javascript | function execute(req, res) {
// unwatch keys, clear references,
// and destroy the transaction reference on the conn
// and send the reply
req.conn.transaction.destroy(req, res, null, Constants.OK);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"// unwatch keys, clear references,",
"// and destroy the transaction reference on the conn",
"// and send the reply",
"req",
".",
"conn",
".",
"transaction",
".",
"destroy",
"(",
"req",
",",
"res",
",",
"null",
... | Respond to the DISCARD command. | [
"Respond",
"to",
"the",
"DISCARD",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/transaction/discard.js#L19-L24 | train |
redisjs/jsr-server | lib/command/transaction/discard.js | validate | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
if(!info.conn.transaction) {
throw DiscardWithoutMulti;
}
} | javascript | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
if(!info.conn.transaction) {
throw DiscardWithoutMulti;
}
} | [
"function",
"validate",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"AbstractCommand",
".",
"prototype",
".",
"validate",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"if",
"(",
"!",
"info",
".",
"conn",
".",
"transaction",
")",
"{",
"t... | Validate the DISCARD command. | [
"Validate",
"the",
"DISCARD",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/transaction/discard.js#L29-L34 | train |
ottojs/otto-errors | lib/unauthorized.error.js | ErrorUnauthorized | function ErrorUnauthorized (message) {
Error.call(this);
// Add Information
this.name = 'ErrorUnauthorized';
this.type = 'client';
this.status = 401;
if (message) {
this.message = message;
}
} | javascript | function ErrorUnauthorized (message) {
Error.call(this);
// Add Information
this.name = 'ErrorUnauthorized';
this.type = 'client';
this.status = 401;
if (message) {
this.message = message;
}
} | [
"function",
"ErrorUnauthorized",
"(",
"message",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"// Add Information",
"this",
".",
"name",
"=",
"'ErrorUnauthorized'",
";",
"this",
".",
"type",
"=",
"'client'",
";",
"this",
".",
"status",
"=",
"401"... | Error - ErrorUnauthorized | [
"Error",
"-",
"ErrorUnauthorized"
] | a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9 | https://github.com/ottojs/otto-errors/blob/a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9/lib/unauthorized.error.js#L8-L20 | train |
skylarklangx/skylark-langx | dist/uncompressed/skylark-langx/objects.js | allKeys | function allKeys(obj) {
if (!isObject(obj)) return [];
var keys = [];
for (var key in obj) keys.push(key);
return keys;
} | javascript | function allKeys(obj) {
if (!isObject(obj)) return [];
var keys = [];
for (var key in obj) keys.push(key);
return keys;
} | [
"function",
"allKeys",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"isObject",
"(",
"obj",
")",
")",
"return",
"[",
"]",
";",
"var",
"keys",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"keys",
".",
"push",
"(",
"key",
")",
";",
... | Retrieve all the property names of an object. | [
"Retrieve",
"all",
"the",
"property",
"names",
"of",
"an",
"object",
"."
] | 49a5ca4de8d292a0fb902564566af8e149ac4e65 | https://github.com/skylarklangx/skylark-langx/blob/49a5ca4de8d292a0fb902564566af8e149ac4e65/dist/uncompressed/skylark-langx/objects.js#L144-L149 | train |
folktale/core.inspect | index.js | showArray | function showArray(maxDepth, array) {
return '['
+ array.map(function(a) {
return show(maxDepth - 1, a)
}).join(', ')
+ ']';
} | javascript | function showArray(maxDepth, array) {
return '['
+ array.map(function(a) {
return show(maxDepth - 1, a)
}).join(', ')
+ ']';
} | [
"function",
"showArray",
"(",
"maxDepth",
",",
"array",
")",
"{",
"return",
"'['",
"+",
"array",
".",
"map",
"(",
"function",
"(",
"a",
")",
"{",
"return",
"show",
"(",
"maxDepth",
"-",
"1",
",",
"a",
")",
"}",
")",
".",
"join",
"(",
"', '",
")",... | Displays the representation of an array.
@method
@private
@summary Number → [α] → String | [
"Displays",
"the",
"representation",
"of",
"an",
"array",
"."
] | aaf5cab00abbcaa3e5140e9f9581a2c4c7ffb57c | https://github.com/folktale/core.inspect/blob/aaf5cab00abbcaa3e5140e9f9581a2c4c7ffb57c/index.js#L118-L124 | train |
folktale/core.inspect | index.js | showObject | function showObject(maxDepth, object) {
return '{'
+ pairs(object).map(function(pair){
return showString(pair.key) + ': ' + show(maxDepth - 1, pair.value)
}).join(', ')
+ '}'
} | javascript | function showObject(maxDepth, object) {
return '{'
+ pairs(object).map(function(pair){
return showString(pair.key) + ': ' + show(maxDepth - 1, pair.value)
}).join(', ')
+ '}'
} | [
"function",
"showObject",
"(",
"maxDepth",
",",
"object",
")",
"{",
"return",
"'{'",
"+",
"pairs",
"(",
"object",
")",
".",
"map",
"(",
"function",
"(",
"pair",
")",
"{",
"return",
"showString",
"(",
"pair",
".",
"key",
")",
"+",
"': '",
"+",
"show",... | Displays the representation of an object.
@method
@private
@summary Number → { String → * } → String | [
"Displays",
"the",
"representation",
"of",
"an",
"object",
"."
] | aaf5cab00abbcaa3e5140e9f9581a2c4c7ffb57c | https://github.com/folktale/core.inspect/blob/aaf5cab00abbcaa3e5140e9f9581a2c4c7ffb57c/index.js#L133-L139 | train |
avetjs/avet-styled-jsx | lib/utils.js | styledJsxOptions | function styledJsxOptions(opts) {
if (!opts) {
return {};
}
if (!Array.isArray(opts.plugins)) {
return opts;
}
opts.plugins = opts.plugins.map(plugin => {
if (Array.isArray(plugin)) {
const [ name, options ] = plugin;
return [ require.resolve(name), options ];
}
return requi... | javascript | function styledJsxOptions(opts) {
if (!opts) {
return {};
}
if (!Array.isArray(opts.plugins)) {
return opts;
}
opts.plugins = opts.plugins.map(plugin => {
if (Array.isArray(plugin)) {
const [ name, options ] = plugin;
return [ require.resolve(name), options ];
}
return requi... | [
"function",
"styledJsxOptions",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"opts",
")",
"{",
"return",
"{",
"}",
";",
"}",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"opts",
".",
"plugins",
")",
")",
"{",
"return",
"opts",
";",
"}",
"opts",
".",
... | Resolve styled-jsx plugins | [
"Resolve",
"styled",
"-",
"jsx",
"plugins"
] | 306fb476b65f978110ac60291e0893dc3d0556c7 | https://github.com/avetjs/avet-styled-jsx/blob/306fb476b65f978110ac60291e0893dc3d0556c7/lib/utils.js#L2-L21 | train |
derdesign/protos | drivers/mongodb.js | MongoDB | function MongoDB(config) {
var self = this;
this.events = new EventEmitter();
config = protos.extend({
host: 'localhost',
port: 27017,
database: 'default',
storage: null,
username: '',
password: '',
safe: true
}, config || {});
if (typeof confi... | javascript | function MongoDB(config) {
var self = this;
this.events = new EventEmitter();
config = protos.extend({
host: 'localhost',
port: 27017,
database: 'default',
storage: null,
username: '',
password: '',
safe: true
}, config || {});
if (typeof confi... | [
"function",
"MongoDB",
"(",
"config",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"events",
"=",
"new",
"EventEmitter",
"(",
")",
";",
"config",
"=",
"protos",
".",
"extend",
"(",
"{",
"host",
":",
"'localhost'",
",",
"port",
":",
"27017"... | MongoDB Driver class
@class MongoDB
@extends Driver
@constructor
@param {object} app Application instance
@param {object} config Driver configuration | [
"MongoDB",
"Driver",
"class"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/drivers/mongodb.js#L25-L123 | train |
andrewscwei/requiem | src/helpers/debounce.js | debounce | function debounce(method, delay, leading) {
assertType(method, 'function', false, 'Invalid parameter: method');
assertType(delay, 'number', true, 'Invalid optional parameter: delay');
assertType(leading, 'boolean', true, 'Invalid optional parameter: leading');
if (delay === undefined) delay = 0;
if (leading ... | javascript | function debounce(method, delay, leading) {
assertType(method, 'function', false, 'Invalid parameter: method');
assertType(delay, 'number', true, 'Invalid optional parameter: delay');
assertType(leading, 'boolean', true, 'Invalid optional parameter: leading');
if (delay === undefined) delay = 0;
if (leading ... | [
"function",
"debounce",
"(",
"method",
",",
"delay",
",",
"leading",
")",
"{",
"assertType",
"(",
"method",
",",
"'function'",
",",
"false",
",",
"'Invalid parameter: method'",
")",
";",
"assertType",
"(",
"delay",
",",
"'number'",
",",
"true",
",",
"'Invali... | Returns a function that, as long as it continues to be invoked, will not be
triggered. The function will be called after it stops being called for N
milliseconds. If 'leading' is passed, the function will be triggered on the
leading edge instead of the trailing.
@param {Function} method - Method to be debounced.
@para... | [
"Returns",
"a",
"function",
"that",
"as",
"long",
"as",
"it",
"continues",
"to",
"be",
"invoked",
"will",
"not",
"be",
"triggered",
".",
"The",
"function",
"will",
"be",
"called",
"after",
"it",
"stops",
"being",
"called",
"for",
"N",
"milliseconds",
".",
... | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/helpers/debounce.js#L23-L48 | train |
rearjs/rear | packages/rear-sql/query.js | exec | function exec(sqlQuery, poolName) {
return new Promise((resolve, reject) => {
db.connect((err, client, done) => {
if (err) {
reject(err);
}
client.query(sqlQuery, (err, results) => {
if (err) {
reject(err);
}
resolve(results);
});
}, poolName |... | javascript | function exec(sqlQuery, poolName) {
return new Promise((resolve, reject) => {
db.connect((err, client, done) => {
if (err) {
reject(err);
}
client.query(sqlQuery, (err, results) => {
if (err) {
reject(err);
}
resolve(results);
});
}, poolName |... | [
"function",
"exec",
"(",
"sqlQuery",
",",
"poolName",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"db",
".",
"connect",
"(",
"(",
"err",
",",
"client",
",",
"done",
")",
"=>",
"{",
"if",
"(",
"err",
"... | Execute a sql query with pg.Pool
@param {ParametizedQuery} sqlQuery Parametized pg query object
@return {Promise<Object>} Resolve with query results
@example
const query = require('./query')
const SQL = query.SQL
const id = 2
query.exec(SQL`SELECT * FROM "Users" WHERE id = ${id}`)
.then((result) => {
co... | [
"Execute",
"a",
"sql",
"query",
"with",
"pg",
".",
"Pool"
] | 0b4a1fa42653a1b9ef200994cc9eef49baa43052 | https://github.com/rearjs/rear/blob/0b4a1fa42653a1b9ef200994cc9eef49baa43052/packages/rear-sql/query.js#L49-L63 | train |
koumoul-dev/sd-express | index.js | _cors | function _cors (cookieDomain, publicUrl) {
return ({ acceptServers, acceptAllOrigins }) => {
// accept server 2 server requests by default
acceptServers = acceptServers === undefined ? true : acceptServers
// do not accept call by outside origins by default
acceptAllOrigins = acceptAllOrigins === unde... | javascript | function _cors (cookieDomain, publicUrl) {
return ({ acceptServers, acceptAllOrigins }) => {
// accept server 2 server requests by default
acceptServers = acceptServers === undefined ? true : acceptServers
// do not accept call by outside origins by default
acceptAllOrigins = acceptAllOrigins === unde... | [
"function",
"_cors",
"(",
"cookieDomain",
",",
"publicUrl",
")",
"{",
"return",
"(",
"{",
"acceptServers",
",",
"acceptAllOrigins",
"}",
")",
"=>",
"{",
"// accept server 2 server requests by default",
"acceptServers",
"=",
"acceptServers",
"===",
"undefined",
"?",
... | Return a function that can build a CORS middleware | [
"Return",
"a",
"function",
"that",
"can",
"build",
"a",
"CORS",
"middleware"
] | d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9 | https://github.com/koumoul-dev/sd-express/blob/d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9/index.js#L61-L95 | train |
koumoul-dev/sd-express | index.js | _getCookieToken | function _getCookieToken (cookies, req, cookieName, cookieDomain, publicUrl) {
let token = cookies.get(cookieName)
if (!token) return null
const reqOrigin = req.headers['origin']
const originDomain = reqOrigin && new URL(reqOrigin).host
// check that the origin of the request is part of the accepted domain
... | javascript | function _getCookieToken (cookies, req, cookieName, cookieDomain, publicUrl) {
let token = cookies.get(cookieName)
if (!token) return null
const reqOrigin = req.headers['origin']
const originDomain = reqOrigin && new URL(reqOrigin).host
// check that the origin of the request is part of the accepted domain
... | [
"function",
"_getCookieToken",
"(",
"cookies",
",",
"req",
",",
"cookieName",
",",
"cookieDomain",
",",
"publicUrl",
")",
"{",
"let",
"token",
"=",
"cookies",
".",
"get",
"(",
"cookieName",
")",
"if",
"(",
"!",
"token",
")",
"return",
"null",
"const",
"r... | Fetch a session token from cookies if the same site policy is respected | [
"Fetch",
"a",
"session",
"token",
"from",
"cookies",
"if",
"the",
"same",
"site",
"policy",
"is",
"respected"
] | d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9 | https://github.com/koumoul-dev/sd-express/blob/d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9/index.js#L98-L123 | train |
koumoul-dev/sd-express | index.js | _setCookieToken | function _setCookieToken (cookies, cookieName, cookieDomain, token, payload) {
const parts = token.split('.')
const opts = { sameSite: 'lax', expires: new Date(payload.exp * 1000) }
if (cookieDomain) {
opts.domain = cookieDomain
// to support subdomains we can't use the sameSite opt
// we rely on our ... | javascript | function _setCookieToken (cookies, cookieName, cookieDomain, token, payload) {
const parts = token.split('.')
const opts = { sameSite: 'lax', expires: new Date(payload.exp * 1000) }
if (cookieDomain) {
opts.domain = cookieDomain
// to support subdomains we can't use the sameSite opt
// we rely on our ... | [
"function",
"_setCookieToken",
"(",
"cookies",
",",
"cookieName",
",",
"cookieDomain",
",",
"token",
",",
"payload",
")",
"{",
"const",
"parts",
"=",
"token",
".",
"split",
"(",
"'.'",
")",
"const",
"opts",
"=",
"{",
"sameSite",
":",
"'lax'",
",",
"expir... | Split JWT strategy, the signature is in a httpOnly cookie for XSS prevention the header and payload are not httpOnly to be readable by client all cookies use sameSite for CSRF prevention | [
"Split",
"JWT",
"strategy",
"the",
"signature",
"is",
"in",
"a",
"httpOnly",
"cookie",
"for",
"XSS",
"prevention",
"the",
"header",
"and",
"payload",
"are",
"not",
"httpOnly",
"to",
"be",
"readable",
"by",
"client",
"all",
"cookies",
"use",
"sameSite",
"for"... | d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9 | https://github.com/koumoul-dev/sd-express/blob/d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9/index.js#L128-L139 | train |
koumoul-dev/sd-express | index.js | _setOrganization | function _setOrganization (cookies, cookieName, req, user) {
if (!user) return
// The order is important. The header can set explicitly on a query even if the cookie contradicts.
const organizationId = req.headers['x-organizationid'] || cookies.get(cookieName + '_org')
if (organizationId) {
user.organizatio... | javascript | function _setOrganization (cookies, cookieName, req, user) {
if (!user) return
// The order is important. The header can set explicitly on a query even if the cookie contradicts.
const organizationId = req.headers['x-organizationid'] || cookies.get(cookieName + '_org')
if (organizationId) {
user.organizatio... | [
"function",
"_setOrganization",
"(",
"cookies",
",",
"cookieName",
",",
"req",
",",
"user",
")",
"{",
"if",
"(",
"!",
"user",
")",
"return",
"// The order is important. The header can set explicitly on a query even if the cookie contradicts.",
"const",
"organizationId",
"="... | Use complementary cookie id_token_org to set the current active organization of the user also set consumerFlag that is used by applications to decide if they should ask confirmation to the user of the right quotas or other organization related context to apply it is 'user' if id_token_org is an empty string or is equal... | [
"Use",
"complementary",
"cookie",
"id_token_org",
"to",
"set",
"the",
"current",
"active",
"organization",
"of",
"the",
"user",
"also",
"set",
"consumerFlag",
"that",
"is",
"used",
"by",
"applications",
"to",
"decide",
"if",
"they",
"should",
"ask",
"confirmatio... | d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9 | https://github.com/koumoul-dev/sd-express/blob/d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9/index.js#L147-L160 | train |
koumoul-dev/sd-express | index.js | _verifyToken | async function _verifyToken (jwksClient, token) {
const decoded = jwt.decode(token, { complete: true })
const signingKey = await jwksClient.getSigningKeyAsync(decoded.header.kid)
return jwt.verifyAsync(token, signingKey.publicKey || signingKey.rsaPublicKey)
} | javascript | async function _verifyToken (jwksClient, token) {
const decoded = jwt.decode(token, { complete: true })
const signingKey = await jwksClient.getSigningKeyAsync(decoded.header.kid)
return jwt.verifyAsync(token, signingKey.publicKey || signingKey.rsaPublicKey)
} | [
"async",
"function",
"_verifyToken",
"(",
"jwksClient",
",",
"token",
")",
"{",
"const",
"decoded",
"=",
"jwt",
".",
"decode",
"(",
"token",
",",
"{",
"complete",
":",
"true",
"}",
")",
"const",
"signingKey",
"=",
"await",
"jwksClient",
".",
"getSigningKey... | Fetch the public info of signing key from the directory that acts as jwks provider | [
"Fetch",
"the",
"public",
"info",
"of",
"signing",
"key",
"from",
"the",
"directory",
"that",
"acts",
"as",
"jwks",
"provider"
] | d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9 | https://github.com/koumoul-dev/sd-express/blob/d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9/index.js#L163-L167 | train |
koumoul-dev/sd-express | index.js | _decode | function _decode (cookieName, cookieDomain, publicUrl) {
return (req, res, next) => {
// JWT in a cookie = already active session
const cookies = new Cookies(req, res)
const token = _getCookieToken(cookies, req, cookieName, cookieDomain, publicUrl)
if (token) {
req.user = jwt.decode(token)
... | javascript | function _decode (cookieName, cookieDomain, publicUrl) {
return (req, res, next) => {
// JWT in a cookie = already active session
const cookies = new Cookies(req, res)
const token = _getCookieToken(cookies, req, cookieName, cookieDomain, publicUrl)
if (token) {
req.user = jwt.decode(token)
... | [
"function",
"_decode",
"(",
"cookieName",
",",
"cookieDomain",
",",
"publicUrl",
")",
"{",
"return",
"(",
"req",
",",
"res",
",",
"next",
")",
"=>",
"{",
"// JWT in a cookie = already active session",
"const",
"cookies",
"=",
"new",
"Cookies",
"(",
"req",
",",... | This middleware checks if a user has an active session and defines req.user Contrary to auth it does not validate the token, only decode it.. so it faster but it is limited to routes where req.user is informative | [
"This",
"middleware",
"checks",
"if",
"a",
"user",
"has",
"an",
"active",
"session",
"and",
"defines",
"req",
".",
"user",
"Contrary",
"to",
"auth",
"it",
"does",
"not",
"validate",
"the",
"token",
"only",
"decode",
"it",
"..",
"so",
"it",
"faster",
"but... | d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9 | https://github.com/koumoul-dev/sd-express/blob/d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9/index.js#L208-L219 | train |
koumoul-dev/sd-express | index.js | _auth | function _auth (privateDirectoryUrl, publicUrl, jwksClient, cookieName, cookieDomain, forceExchange) {
return asyncWrap(async (req, res, next) => {
// JWT in a cookie = already active session
const cookies = new Cookies(req, res)
const token = _getCookieToken(cookies, req, cookieName, cookieDomain, public... | javascript | function _auth (privateDirectoryUrl, publicUrl, jwksClient, cookieName, cookieDomain, forceExchange) {
return asyncWrap(async (req, res, next) => {
// JWT in a cookie = already active session
const cookies = new Cookies(req, res)
const token = _getCookieToken(cookies, req, cookieName, cookieDomain, public... | [
"function",
"_auth",
"(",
"privateDirectoryUrl",
",",
"publicUrl",
",",
"jwksClient",
",",
"cookieName",
",",
"cookieDomain",
",",
"forceExchange",
")",
"{",
"return",
"asyncWrap",
"(",
"async",
"(",
"req",
",",
"res",
",",
"next",
")",
"=>",
"{",
"// JWT in... | This middleware checks if a user has an active session with a valid token it defines req.user and it can extend the session if necessary. | [
"This",
"middleware",
"checks",
"if",
"a",
"user",
"has",
"an",
"active",
"session",
"with",
"a",
"valid",
"token",
"it",
"defines",
"req",
".",
"user",
"and",
"it",
"can",
"extend",
"the",
"session",
"if",
"necessary",
"."
] | d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9 | https://github.com/koumoul-dev/sd-express/blob/d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9/index.js#L223-L268 | train |
koumoul-dev/sd-express | index.js | _login | function _login (directoryUrl, publicUrl) {
return (req, res) => {
res.redirect(directoryUrl + '/login?redirect=' + encodeURIComponent(req.query.redirect || publicUrl))
}
} | javascript | function _login (directoryUrl, publicUrl) {
return (req, res) => {
res.redirect(directoryUrl + '/login?redirect=' + encodeURIComponent(req.query.redirect || publicUrl))
}
} | [
"function",
"_login",
"(",
"directoryUrl",
",",
"publicUrl",
")",
"{",
"return",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"res",
".",
"redirect",
"(",
"directoryUrl",
"+",
"'/login?redirect='",
"+",
"encodeURIComponent",
"(",
"req",
".",
"query",
".",
"redi... | Login is simply a link to the right page of the directory. Going to the directory through a redirect, not throug a link in UI allows us to send along some optional client id or any kind of trust enhancing secret | [
"Login",
"is",
"simply",
"a",
"link",
"to",
"the",
"right",
"page",
"of",
"the",
"directory",
".",
"Going",
"to",
"the",
"directory",
"through",
"a",
"redirect",
"not",
"throug",
"a",
"link",
"in",
"UI",
"allows",
"us",
"to",
"send",
"along",
"some",
"... | d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9 | https://github.com/koumoul-dev/sd-express/blob/d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9/index.js#L273-L277 | train |
koumoul-dev/sd-express | index.js | _logout | function _logout (cookieName, cookieDomain) {
return (req, res) => {
const cookies = new Cookies(req, res)
cookies.set(cookieName, null, { domain: cookieDomain })
cookies.set(cookieName + '_sign', null, { domain: cookieDomain })
// case where the cookies were set before assigning domain
if (cookie... | javascript | function _logout (cookieName, cookieDomain) {
return (req, res) => {
const cookies = new Cookies(req, res)
cookies.set(cookieName, null, { domain: cookieDomain })
cookies.set(cookieName + '_sign', null, { domain: cookieDomain })
// case where the cookies were set before assigning domain
if (cookie... | [
"function",
"_logout",
"(",
"cookieName",
",",
"cookieDomain",
")",
"{",
"return",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"const",
"cookies",
"=",
"new",
"Cookies",
"(",
"req",
",",
"res",
")",
"cookies",
".",
"set",
"(",
"cookieName",
",",
"null",
... | Sessions are only the persistence of the JWT token in cookies no need to call the directory | [
"Sessions",
"are",
"only",
"the",
"persistence",
"of",
"the",
"JWT",
"token",
"in",
"cookies",
"no",
"need",
"to",
"call",
"the",
"directory"
] | d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9 | https://github.com/koumoul-dev/sd-express/blob/d7da1af5b9bcf893d9f9f82a67668f0d4b8099f9/index.js#L281-L293 | train |
francium/highlight-page | src/highlight-page.js | refineRangeBoundaries | function refineRangeBoundaries(range) {
let startContainer = range.startContainer,
endContainer = range.endContainer,
ancestor = range.commonAncestorContainer,
goDeeper = true;
if (range.endOffset === 0) {
while (!endContainer.previousSibling && endContainer.parentNode !== ances... | javascript | function refineRangeBoundaries(range) {
let startContainer = range.startContainer,
endContainer = range.endContainer,
ancestor = range.commonAncestorContainer,
goDeeper = true;
if (range.endOffset === 0) {
while (!endContainer.previousSibling && endContainer.parentNode !== ances... | [
"function",
"refineRangeBoundaries",
"(",
"range",
")",
"{",
"let",
"startContainer",
"=",
"range",
".",
"startContainer",
",",
"endContainer",
"=",
"range",
".",
"endContainer",
",",
"ancestor",
"=",
"range",
".",
"commonAncestorContainer",
",",
"goDeeper",
"=",
... | Takes range object as parameter and refines it boundaries
@param range
@returns {object} refined boundaries and initial state of highlighting algorithm. | [
"Takes",
"range",
"object",
"as",
"parameter",
"and",
"refines",
"it",
"boundaries"
] | 4e67fc531321f9987397dc247abba59b9d5ee521 | https://github.com/francium/highlight-page/blob/4e67fc531321f9987397dc247abba59b9d5ee521/src/highlight-page.js#L72-L111 | train |
francium/highlight-page | src/highlight-page.js | groupHighlights | function groupHighlights(highlights) {
let order = [],
chunks = {},
grouped = [];
highlights.forEach(function (hl) {
let timestamp = hl.getAttribute(TIMESTAMP_ATTR);
if (typeof chunks[timestamp] === 'undefined') {
chunks[timestamp] = [];
order.push(times... | javascript | function groupHighlights(highlights) {
let order = [],
chunks = {},
grouped = [];
highlights.forEach(function (hl) {
let timestamp = hl.getAttribute(TIMESTAMP_ATTR);
if (typeof chunks[timestamp] === 'undefined') {
chunks[timestamp] = [];
order.push(times... | [
"function",
"groupHighlights",
"(",
"highlights",
")",
"{",
"let",
"order",
"=",
"[",
"]",
",",
"chunks",
"=",
"{",
"}",
",",
"grouped",
"=",
"[",
"]",
";",
"highlights",
".",
"forEach",
"(",
"function",
"(",
"hl",
")",
"{",
"let",
"timestamp",
"=",
... | Groups given highlights by timestamp.
@param {Array} highlights
@returns {Array} Grouped highlights. | [
"Groups",
"given",
"highlights",
"by",
"timestamp",
"."
] | 4e67fc531321f9987397dc247abba59b9d5ee521 | https://github.com/francium/highlight-page/blob/4e67fc531321f9987397dc247abba59b9d5ee521/src/highlight-page.js#L129-L160 | train |
francium/highlight-page | src/highlight-page.js | function (nodesToAppend) {
let nodes = Array.prototype.slice.call(nodesToAppend);
for (let i = 0, len = nodes.length; i < len; ++i) {
el.appendChild(nodes[i]);
}
} | javascript | function (nodesToAppend) {
let nodes = Array.prototype.slice.call(nodesToAppend);
for (let i = 0, len = nodes.length; i < len; ++i) {
el.appendChild(nodes[i]);
}
} | [
"function",
"(",
"nodesToAppend",
")",
"{",
"let",
"nodes",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"nodesToAppend",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"len",
"=",
"nodes",
".",
"length",
";",
"i",
"<",
"len",
... | Appends child nodes to base element.
@param {Node[]} nodesToAppend | [
"Appends",
"child",
"nodes",
"to",
"base",
"element",
"."
] | 4e67fc531321f9987397dc247abba59b9d5ee521 | https://github.com/francium/highlight-page/blob/4e67fc531321f9987397dc247abba59b9d5ee521/src/highlight-page.js#L214-L220 | train | |
francium/highlight-page | src/highlight-page.js | function () {
if (!el) {
return;
}
if (el.nodeType === NODE_TYPE.TEXT_NODE) {
while (el.nextSibling && el.nextSibling.nodeType === NODE_TYPE.TEXT_NODE) {
el.nodeValue += el.nextSibling.nodeValue;
el.parentNode.r... | javascript | function () {
if (!el) {
return;
}
if (el.nodeType === NODE_TYPE.TEXT_NODE) {
while (el.nextSibling && el.nextSibling.nodeType === NODE_TYPE.TEXT_NODE) {
el.nodeValue += el.nextSibling.nodeValue;
el.parentNode.r... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"el",
")",
"{",
"return",
";",
"}",
"if",
"(",
"el",
".",
"nodeType",
"===",
"NODE_TYPE",
".",
"TEXT_NODE",
")",
"{",
"while",
"(",
"el",
".",
"nextSibling",
"&&",
"el",
".",
"nextSibling",
".",
"nodeType"... | Normalizes text nodes within base element, ie. merges sibling text nodes and assures that every
element node has only one text node.
It should does the same as standard element.normalize, but IE implements it incorrectly. | [
"Normalizes",
"text",
"nodes",
"within",
"base",
"element",
"ie",
".",
"merges",
"sibling",
"text",
"nodes",
"and",
"assures",
"that",
"every",
"element",
"node",
"has",
"only",
"one",
"text",
"node",
".",
"It",
"should",
"does",
"the",
"same",
"as",
"stan... | 4e67fc531321f9987397dc247abba59b9d5ee521 | https://github.com/francium/highlight-page/blob/4e67fc531321f9987397dc247abba59b9d5ee521/src/highlight-page.js#L308-L322 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.