id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
56,400 | activethread/vulpejs | lib/models/index.js | function (query, page, callback) {
var History = exports.get('History');
History.paginate(query, {
page: page,
limit: vulpejs.app.pagination.history,
}, function (error, items, pageCount, itemCount) {
if (error) {
vulpejs.log.error('HISTORY', error);
} else {
callback(error, {
... | javascript | function (query, page, callback) {
var History = exports.get('History');
History.paginate(query, {
page: page,
limit: vulpejs.app.pagination.history,
}, function (error, items, pageCount, itemCount) {
if (error) {
vulpejs.log.error('HISTORY', error);
} else {
callback(error, {
... | [
"function",
"(",
"query",
",",
"page",
",",
"callback",
")",
"{",
"var",
"History",
"=",
"exports",
".",
"get",
"(",
"'History'",
")",
";",
"History",
".",
"paginate",
"(",
"query",
",",
"{",
"page",
":",
"page",
",",
"limit",
":",
"vulpejs",
".",
... | Find and page histories of object in database.
@param {Object} query Query
@param {Number} page Page
@param {Function} callback Callback function | [
"Find",
"and",
"page",
"histories",
"of",
"object",
"in",
"database",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/models/index.js#L445-L465 | |
56,401 | byu-oit/sans-server | bin/server/request.js | Request | function Request(server, keys, rejectable, config) {
if (!config) config = {};
if (typeof config !== 'object') config = { path: config };
const promise = new Promise((resolve, reject) => {
let fulfilled = false;
this.on('res-complete', () => {
if (fulfilled) {
r... | javascript | function Request(server, keys, rejectable, config) {
if (!config) config = {};
if (typeof config !== 'object') config = { path: config };
const promise = new Promise((resolve, reject) => {
let fulfilled = false;
this.on('res-complete', () => {
if (fulfilled) {
r... | [
"function",
"Request",
"(",
"server",
",",
"keys",
",",
"rejectable",
",",
"config",
")",
"{",
"if",
"(",
"!",
"config",
")",
"config",
"=",
"{",
"}",
";",
"if",
"(",
"typeof",
"config",
"!==",
"'object'",
")",
"config",
"=",
"{",
"path",
":",
"con... | Generate a request instance.
@param {SansServer} server
@param {object} keys
@param {boolean} rejectable
@param {string|Object} [config] A string representing the path or a configuration representing all properties
to accompany the request.
@returns {Request}
@constructor
@augments {EventEmitter}
@augments {Promise} | [
"Generate",
"a",
"request",
"instance",
"."
] | 022bcf7b47321e6e8aa20467cd96a6a84a457ec8 | https://github.com/byu-oit/sans-server/blob/022bcf7b47321e6e8aa20467cd96a6a84a457ec8/bin/server/request.js#L40-L229 |
56,402 | ericsaboia/migrate-database | tasks/lib/migrate.js | Migrate | function Migrate (grunt, adapter, config, steps) {
this.grunt = grunt;
this.adapter = adapter;
this.path = path.resolve(config.path);
this.steps = steps;
} | javascript | function Migrate (grunt, adapter, config, steps) {
this.grunt = grunt;
this.adapter = adapter;
this.path = path.resolve(config.path);
this.steps = steps;
} | [
"function",
"Migrate",
"(",
"grunt",
",",
"adapter",
",",
"config",
",",
"steps",
")",
"{",
"this",
".",
"grunt",
"=",
"grunt",
";",
"this",
".",
"adapter",
"=",
"adapter",
";",
"this",
".",
"path",
"=",
"path",
".",
"resolve",
"(",
"config",
".",
... | Initialize a new migration `Migrate` with the given `grunt, adapter, path and steps`
@param {Object} grunt
@param {Adapter} adapter
@param {String} path
@param {Number} steps
@api private | [
"Initialize",
"a",
"new",
"migration",
"Migrate",
"with",
"the",
"given",
"grunt",
"adapter",
"path",
"and",
"steps"
] | 7a9afb4d1b4aeb1bb5e6c1ae7a2a7c7e0fa16e5d | https://github.com/ericsaboia/migrate-database/blob/7a9afb4d1b4aeb1bb5e6c1ae7a2a7c7e0fa16e5d/tasks/lib/migrate.js#L35-L40 |
56,403 | kmalakoff/backbone-articulation | vendor/lifecycle-1.0.2.js | function(parent, protoProps, staticProps) {
var child;
// The constructor function for the new subclass is either defined by you
// (the "constructor" property in your extend definition), or defaulted
// by us to simply call the parent's constructor.
if (protoProps && protoProps.hasOwnProperty('constructor')... | javascript | function(parent, protoProps, staticProps) {
var child;
// The constructor function for the new subclass is either defined by you
// (the "constructor" property in your extend definition), or defaulted
// by us to simply call the parent's constructor.
if (protoProps && protoProps.hasOwnProperty('constructor')... | [
"function",
"(",
"parent",
",",
"protoProps",
",",
"staticProps",
")",
"{",
"var",
"child",
";",
"// The constructor function for the new subclass is either defined by you",
"// (the \"constructor\" property in your extend definition), or defaulted",
"// by us to simply call the parent's... | Helper function to correctly set up the prototype chain, for subclasses. Similar to 'goog.inherits', but uses a hash of prototype properties and class properties to be extended. | [
"Helper",
"function",
"to",
"correctly",
"set",
"up",
"the",
"prototype",
"chain",
"for",
"subclasses",
".",
"Similar",
"to",
"goog",
".",
"inherits",
"but",
"uses",
"a",
"hash",
"of",
"prototype",
"properties",
"and",
"class",
"properties",
"to",
"be",
"ext... | ce093551bab078369b5f9f4244873d108a344eb5 | https://github.com/kmalakoff/backbone-articulation/blob/ce093551bab078369b5f9f4244873d108a344eb5/vendor/lifecycle-1.0.2.js#L56-L90 | |
56,404 | jpitts/rapt-modelrizerly | lib/datastores/mongodb.js | function (finder) {
if (mongo_query_options && mongo_query_options.sort) {
finder.sort(mongo_query_options.sort).toArray(cb);
} else {
finder.toArray(cb);
}
} | javascript | function (finder) {
if (mongo_query_options && mongo_query_options.sort) {
finder.sort(mongo_query_options.sort).toArray(cb);
} else {
finder.toArray(cb);
}
} | [
"function",
"(",
"finder",
")",
"{",
"if",
"(",
"mongo_query_options",
"&&",
"mongo_query_options",
".",
"sort",
")",
"{",
"finder",
".",
"sort",
"(",
"mongo_query_options",
".",
"sort",
")",
".",
"toArray",
"(",
"cb",
")",
";",
"}",
"else",
"{",
"finder... | final sorting and rendering to array | [
"final",
"sorting",
"and",
"rendering",
"to",
"array"
] | 4b6b5bd0e7838c05029e7c20d500c9f4f7b0cc92 | https://github.com/jpitts/rapt-modelrizerly/blob/4b6b5bd0e7838c05029e7c20d500c9f4f7b0cc92/lib/datastores/mongodb.js#L227-L236 | |
56,405 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/link/plugin.js | function( editor ) {
var selection = editor.getSelection();
var selectedElement = selection.getSelectedElement();
if ( selectedElement && selectedElement.is( 'a' ) )
return selectedElement;
var range = selection.getRanges()[ 0 ];
if ( range ) {
range.shrink( CKEDITOR.SHRINK_TEXT );
... | javascript | function( editor ) {
var selection = editor.getSelection();
var selectedElement = selection.getSelectedElement();
if ( selectedElement && selectedElement.is( 'a' ) )
return selectedElement;
var range = selection.getRanges()[ 0 ];
if ( range ) {
range.shrink( CKEDITOR.SHRINK_TEXT );
... | [
"function",
"(",
"editor",
")",
"{",
"var",
"selection",
"=",
"editor",
".",
"getSelection",
"(",
")",
";",
"var",
"selectedElement",
"=",
"selection",
".",
"getSelectedElement",
"(",
")",
";",
"if",
"(",
"selectedElement",
"&&",
"selectedElement",
".",
"is"... | Get the surrounding link element of the current selection.
CKEDITOR.plugins.link.getSelectedLink( editor );
// The following selections will all return the link element.
<a href="#">li^nk</a>
<a href="#">[link]</a>
text[<a href="#">link]</a>
<a href="#">li[nk</a>]
[<b><a href="#">li]nk</a></b>]
[<a href="#"><b>li]nk... | [
"Get",
"the",
"surrounding",
"link",
"element",
"of",
"the",
"current",
"selection",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/link/plugin.js#L312-L325 | |
56,406 | christophercrouzet/pillr | lib/load_templates.js | loadTemplate | function loadTemplate(template, name, callback) {
async.waterfall([
cb => source(template.path, template.filter, template.readMode, cb),
(files, cb) => asDataMap(files, template.mapping, cb),
], (error, result) => {
async.nextTick(callback, error, result);
});
} | javascript | function loadTemplate(template, name, callback) {
async.waterfall([
cb => source(template.path, template.filter, template.readMode, cb),
(files, cb) => asDataMap(files, template.mapping, cb),
], (error, result) => {
async.nextTick(callback, error, result);
});
} | [
"function",
"loadTemplate",
"(",
"template",
",",
"name",
",",
"callback",
")",
"{",
"async",
".",
"waterfall",
"(",
"[",
"cb",
"=>",
"source",
"(",
"template",
".",
"path",
",",
"template",
".",
"filter",
",",
"template",
".",
"readMode",
",",
"cb",
"... | Load a single template. | [
"Load",
"a",
"single",
"template",
"."
] | 411ccd344a03478776c4e8d2e2f9bdc45dc8ee45 | https://github.com/christophercrouzet/pillr/blob/411ccd344a03478776c4e8d2e2f9bdc45dc8ee45/lib/load_templates.js#L23-L30 |
56,407 | michaelnisi/pushup | index.js | Headers | function Headers (size, type, ttl, enc) {
if (!(this instanceof Headers)) return new Headers(size, type, ttl, enc)
if (size) this['Content-Length'] = size
if (type) this['Content-Type'] = type
if (!isNaN(ttl)) this['Cache-Control'] = 'max-age=' + ttl
if (enc) this['Content-Encoding'] = enc
} | javascript | function Headers (size, type, ttl, enc) {
if (!(this instanceof Headers)) return new Headers(size, type, ttl, enc)
if (size) this['Content-Length'] = size
if (type) this['Content-Type'] = type
if (!isNaN(ttl)) this['Cache-Control'] = 'max-age=' + ttl
if (enc) this['Content-Encoding'] = enc
} | [
"function",
"Headers",
"(",
"size",
",",
"type",
",",
"ttl",
",",
"enc",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Headers",
")",
")",
"return",
"new",
"Headers",
"(",
"size",
",",
"type",
",",
"ttl",
",",
"enc",
")",
"if",
"(",
"size... | - size the size of the entity-body in decimal number of octets - type the media type of the entity-body - ttl the maximum age in seconds - enc the modifier to the media-type | [
"-",
"size",
"the",
"size",
"of",
"the",
"entity",
"-",
"body",
"in",
"decimal",
"number",
"of",
"octets",
"-",
"type",
"the",
"media",
"type",
"of",
"the",
"entity",
"-",
"body",
"-",
"ttl",
"the",
"maximum",
"age",
"in",
"seconds",
"-",
"enc",
"the... | 104c4db4a1938d89cf9e77cb97090c42ea3d35ed | https://github.com/michaelnisi/pushup/blob/104c4db4a1938d89cf9e77cb97090c42ea3d35ed/index.js#L70-L76 |
56,408 | EyalAr/fume | bin/fume.js | function (next) {
async.each(input, function (path, done) {
fs.stat(path, function (err, stats) {
if (err) return done(err);
if (stats.isDirectory())
return done("Cannot have a directory as input");
done();
});
... | javascript | function (next) {
async.each(input, function (path, done) {
fs.stat(path, function (err, stats) {
if (err) return done(err);
if (stats.isDirectory())
return done("Cannot have a directory as input");
done();
});
... | [
"function",
"(",
"next",
")",
"{",
"async",
".",
"each",
"(",
"input",
",",
"function",
"(",
"path",
",",
"done",
")",
"{",
"fs",
".",
"stat",
"(",
"path",
",",
"function",
"(",
"err",
",",
"stats",
")",
"{",
"if",
"(",
"err",
")",
"return",
"d... | make sure no directories in the input list | [
"make",
"sure",
"no",
"directories",
"in",
"the",
"input",
"list"
] | 66f555d39b9cee18bbdf7a0a565919247163a227 | https://github.com/EyalAr/fume/blob/66f555d39b9cee18bbdf7a0a565919247163a227/bin/fume.js#L55-L66 | |
56,409 | codenothing/munit | lib/render.js | function( name ) {
if ( ! munit.isString( name ) || ! name.length ) {
throw new Error( "Name not found for removing formatter" );
}
if ( render._formatHash[ name ] ) {
delete render._formatHash[ name ];
render._formats = render._formats.filter(function( f ) {
return f.name !== name;
});
}
} | javascript | function( name ) {
if ( ! munit.isString( name ) || ! name.length ) {
throw new Error( "Name not found for removing formatter" );
}
if ( render._formatHash[ name ] ) {
delete render._formatHash[ name ];
render._formats = render._formats.filter(function( f ) {
return f.name !== name;
});
}
} | [
"function",
"(",
"name",
")",
"{",
"if",
"(",
"!",
"munit",
".",
"isString",
"(",
"name",
")",
"||",
"!",
"name",
".",
"length",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Name not found for removing formatter\"",
")",
";",
"}",
"if",
"(",
"render",
".... | Removing a formatter | [
"Removing",
"a",
"formatter"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L119-L130 | |
56,410 | codenothing/munit | lib/render.js | function( path, callback ) {
var parts = ( path || '' ).split( /\//g ),
filepath = '/';
// Trim Left
if ( ! parts[ 0 ].length ) {
parts.shift();
}
// Trim right
if ( parts.length && ! parts[ parts.length - 1 ].length ) {
parts.pop();
}
// Handle root '/' error
if ( ! parts.length ) {
re... | javascript | function( path, callback ) {
var parts = ( path || '' ).split( /\//g ),
filepath = '/';
// Trim Left
if ( ! parts[ 0 ].length ) {
parts.shift();
}
// Trim right
if ( parts.length && ! parts[ parts.length - 1 ].length ) {
parts.pop();
}
// Handle root '/' error
if ( ! parts.length ) {
re... | [
"function",
"(",
"path",
",",
"callback",
")",
"{",
"var",
"parts",
"=",
"(",
"path",
"||",
"''",
")",
".",
"split",
"(",
"/",
"\\/",
"/",
"g",
")",
",",
"filepath",
"=",
"'/'",
";",
"// Trim Left",
"if",
"(",
"!",
"parts",
"[",
"0",
"]",
".",
... | Creates directory path if not already | [
"Creates",
"directory",
"path",
"if",
"not",
"already"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L145-L178 | |
56,411 | codenothing/munit | lib/render.js | function( path, callback ) {
var match = munit.isRegExp( render.options.file_match ) ? render.options.file_match : rtestfile;
path += '/';
fs.readdir( path, function( e, files ) {
if ( e ) {
return callback( e );
}
async.each( files || [],
function( file, callback ) {
var fullpath = path +... | javascript | function( path, callback ) {
var match = munit.isRegExp( render.options.file_match ) ? render.options.file_match : rtestfile;
path += '/';
fs.readdir( path, function( e, files ) {
if ( e ) {
return callback( e );
}
async.each( files || [],
function( file, callback ) {
var fullpath = path +... | [
"function",
"(",
"path",
",",
"callback",
")",
"{",
"var",
"match",
"=",
"munit",
".",
"isRegExp",
"(",
"render",
".",
"options",
".",
"file_match",
")",
"?",
"render",
".",
"options",
".",
"file_match",
":",
"rtestfile",
";",
"path",
"+=",
"'/'",
";",... | Loads up each possible test file | [
"Loads",
"up",
"each",
"possible",
"test",
"file"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L181-L213 | |
56,412 | codenothing/munit | lib/render.js | function( nspath ) {
var found = true,
nsparts = nspath.split( rpathsplit ),
focus = render.options.focus;
// Allow single path string
if ( munit.isString( focus ) ) {
focus = [ focus ];
}
// If set, only add modules that belong on the focus path(s)
if ( munit.isArray( focus ) && focus.length ) {... | javascript | function( nspath ) {
var found = true,
nsparts = nspath.split( rpathsplit ),
focus = render.options.focus;
// Allow single path string
if ( munit.isString( focus ) ) {
focus = [ focus ];
}
// If set, only add modules that belong on the focus path(s)
if ( munit.isArray( focus ) && focus.length ) {... | [
"function",
"(",
"nspath",
")",
"{",
"var",
"found",
"=",
"true",
",",
"nsparts",
"=",
"nspath",
".",
"split",
"(",
"rpathsplit",
")",
",",
"focus",
"=",
"render",
".",
"options",
".",
"focus",
";",
"// Allow single path string",
"if",
"(",
"munit",
".",... | Testing path to see if it exists in the focus option | [
"Testing",
"path",
"to",
"see",
"if",
"it",
"exists",
"in",
"the",
"focus",
"option"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L216-L248 | |
56,413 | codenothing/munit | lib/render.js | function( required, startFunc ) {
if ( required !== render.state ) {
render._stateError( startFunc || render.requireState );
}
} | javascript | function( required, startFunc ) {
if ( required !== render.state ) {
render._stateError( startFunc || render.requireState );
}
} | [
"function",
"(",
"required",
",",
"startFunc",
")",
"{",
"if",
"(",
"required",
"!==",
"render",
".",
"state",
")",
"{",
"render",
".",
"_stateError",
"(",
"startFunc",
"||",
"render",
".",
"requireState",
")",
";",
"}",
"}"
] | Throws an error if munit isn't in the required state | [
"Throws",
"an",
"error",
"if",
"munit",
"isn",
"t",
"in",
"the",
"required",
"state"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L265-L269 | |
56,414 | codenothing/munit | lib/render.js | function( ns ) {
munit.each( ns, function( assert, name ) {
if ( render.focusPath( assert.nsPath ) ) {
munit.tests.push( assert );
}
else {
assert.trigger();
}
// Traverse down the module tree
render._renderNS( assert.ns );
});
return munit.tests;
} | javascript | function( ns ) {
munit.each( ns, function( assert, name ) {
if ( render.focusPath( assert.nsPath ) ) {
munit.tests.push( assert );
}
else {
assert.trigger();
}
// Traverse down the module tree
render._renderNS( assert.ns );
});
return munit.tests;
} | [
"function",
"(",
"ns",
")",
"{",
"munit",
".",
"each",
"(",
"ns",
",",
"function",
"(",
"assert",
",",
"name",
")",
"{",
"if",
"(",
"render",
".",
"focusPath",
"(",
"assert",
".",
"nsPath",
")",
")",
"{",
"munit",
".",
"tests",
".",
"push",
"(",
... | Renders each module | [
"Renders",
"each",
"module"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L286-L300 | |
56,415 | codenothing/munit | lib/render.js | function( assert ) {
var stack = [], depends, i, l, module;
// Should only be checking dependencies when in compile mode
render.requireMinState( munit.RENDER_STATE_COMPILE, render.checkDepency );
// Build up the list of dependency paths
do {
depends = assert.option( 'depends' );
// Allow single path
... | javascript | function( assert ) {
var stack = [], depends, i, l, module;
// Should only be checking dependencies when in compile mode
render.requireMinState( munit.RENDER_STATE_COMPILE, render.checkDepency );
// Build up the list of dependency paths
do {
depends = assert.option( 'depends' );
// Allow single path
... | [
"function",
"(",
"assert",
")",
"{",
"var",
"stack",
"=",
"[",
"]",
",",
"depends",
",",
"i",
",",
"l",
",",
"module",
";",
"// Should only be checking dependencies when in compile mode",
"render",
".",
"requireMinState",
"(",
"munit",
".",
"RENDER_STATE_COMPILE",... | Checks test modules depencies to see if it can be run | [
"Checks",
"test",
"modules",
"depencies",
"to",
"see",
"if",
"it",
"can",
"be",
"run"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L303-L331 | |
56,416 | codenothing/munit | lib/render.js | function(){
var options = render.options,
path = options.render = render._normalizePath( options.render );
// Ensure render path actually exists
fs.stat( path, function( e, stat ) {
if ( e || ! stat || ! stat.isDirectory() ) {
return munit.exit( 1, e, "'" + path + "' is not a directory" );
}
// ... | javascript | function(){
var options = render.options,
path = options.render = render._normalizePath( options.render );
// Ensure render path actually exists
fs.stat( path, function( e, stat ) {
if ( e || ! stat || ! stat.isDirectory() ) {
return munit.exit( 1, e, "'" + path + "' is not a directory" );
}
// ... | [
"function",
"(",
")",
"{",
"var",
"options",
"=",
"render",
".",
"options",
",",
"path",
"=",
"options",
".",
"render",
"=",
"render",
".",
"_normalizePath",
"(",
"options",
".",
"render",
")",
";",
"// Ensure render path actually exists",
"fs",
".",
"stat",... | Setup for rendering a path | [
"Setup",
"for",
"rendering",
"a",
"path"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L334-L360 | |
56,417 | codenothing/munit | lib/render.js | function(){
// Swap render state to compile mode for priority generation
render.requireState( munit.RENDER_STATE_READ, render._compile );
render.state = munit.RENDER_STATE_COMPILE;
render._renderNS( munit.ns );
// Just in case triggers set off any undesired state
render.requireState( munit.RENDER_STATE_COM... | javascript | function(){
// Swap render state to compile mode for priority generation
render.requireState( munit.RENDER_STATE_READ, render._compile );
render.state = munit.RENDER_STATE_COMPILE;
render._renderNS( munit.ns );
// Just in case triggers set off any undesired state
render.requireState( munit.RENDER_STATE_COM... | [
"function",
"(",
")",
"{",
"// Swap render state to compile mode for priority generation",
"render",
".",
"requireState",
"(",
"munit",
".",
"RENDER_STATE_READ",
",",
"render",
".",
"_compile",
")",
";",
"render",
".",
"state",
"=",
"munit",
".",
"RENDER_STATE_COMPILE... | Triggered after all file paths have been loaded | [
"Triggered",
"after",
"all",
"file",
"paths",
"have",
"been",
"loaded"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L363-L396 | |
56,418 | codenothing/munit | lib/render.js | function(){
var color = munit.color.get[ munit.failed > 0 ? 'red' : 'green' ],
callback = render.callback;
// Can only complete a finished munit state
// (dont pass startFunc, we want _complete as part of the trace here)
render.requireState( munit.RENDER_STATE_FINISHED );
render.state = munit.RENDER_STATE... | javascript | function(){
var color = munit.color.get[ munit.failed > 0 ? 'red' : 'green' ],
callback = render.callback;
// Can only complete a finished munit state
// (dont pass startFunc, we want _complete as part of the trace here)
render.requireState( munit.RENDER_STATE_FINISHED );
render.state = munit.RENDER_STATE... | [
"function",
"(",
")",
"{",
"var",
"color",
"=",
"munit",
".",
"color",
".",
"get",
"[",
"munit",
".",
"failed",
">",
"0",
"?",
"'red'",
":",
"'green'",
"]",
",",
"callback",
"=",
"render",
".",
"callback",
";",
"// Can only complete a finished munit state"... | Finished off test result writing, print out suite results | [
"Finished",
"off",
"test",
"result",
"writing",
"print",
"out",
"suite",
"results"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L399-L427 | |
56,419 | codenothing/munit | lib/render.js | function( dir ) {
// Make the root results directory first
render._mkdir( dir, function( e ) {
if ( e ) {
return munit.exit( 1, e, "Failed to make root results directory" );
}
// Make a working directory for each format
async.each( render._formats,
function( format, callback ) {
var path =... | javascript | function( dir ) {
// Make the root results directory first
render._mkdir( dir, function( e ) {
if ( e ) {
return munit.exit( 1, e, "Failed to make root results directory" );
}
// Make a working directory for each format
async.each( render._formats,
function( format, callback ) {
var path =... | [
"function",
"(",
"dir",
")",
"{",
"// Make the root results directory first",
"render",
".",
"_mkdir",
"(",
"dir",
",",
"function",
"(",
"e",
")",
"{",
"if",
"(",
"e",
")",
"{",
"return",
"munit",
".",
"exit",
"(",
"1",
",",
"e",
",",
"\"Failed to make r... | Generates result directories | [
"Generates",
"result",
"directories"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L430-L461 | |
56,420 | codenothing/munit | lib/render.js | function(){
var finished = true,
now = Date.now(),
options = render.options,
results = options.results ? render._normalizePath( options.results ) : null;
// Wait until all modules have been triggered before checking states
if ( render.state < munit.RENDER_STATE_ACTIVE ) {
return;
}
// Can only c... | javascript | function(){
var finished = true,
now = Date.now(),
options = render.options,
results = options.results ? render._normalizePath( options.results ) : null;
// Wait until all modules have been triggered before checking states
if ( render.state < munit.RENDER_STATE_ACTIVE ) {
return;
}
// Can only c... | [
"function",
"(",
")",
"{",
"var",
"finished",
"=",
"true",
",",
"now",
"=",
"Date",
".",
"now",
"(",
")",
",",
"options",
"=",
"render",
".",
"options",
",",
"results",
"=",
"options",
".",
"results",
"?",
"render",
".",
"_normalizePath",
"(",
"optio... | Checks all modules to see if they are finished | [
"Checks",
"all",
"modules",
"to",
"see",
"if",
"they",
"are",
"finished"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/render.js#L464-L509 | |
56,421 | mgesmundo/authorify-client | build/authorify.js | function(api, id, key, data) {
// get storage object
var obj = _getStorageObject(api, id);
if(obj === null) {
// create a new storage object
obj = {};
}
// update key
obj[key] = data;
// set storage object
_setStorageObject(api, id, obj);
} | javascript | function(api, id, key, data) {
// get storage object
var obj = _getStorageObject(api, id);
if(obj === null) {
// create a new storage object
obj = {};
}
// update key
obj[key] = data;
// set storage object
_setStorageObject(api, id, obj);
} | [
"function",
"(",
"api",
",",
"id",
",",
"key",
",",
"data",
")",
"{",
"// get storage object",
"var",
"obj",
"=",
"_getStorageObject",
"(",
"api",
",",
"id",
")",
";",
"if",
"(",
"obj",
"===",
"null",
")",
"{",
"// create a new storage object",
"obj",
"=... | Stores an item in local storage.
@param api the storage interface.
@param id the storage ID to use.
@param key the key for the item.
@param data the data for the item (any javascript object/primitive). | [
"Stores",
"an",
"item",
"in",
"local",
"storage",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L1420-L1432 | |
56,422 | mgesmundo/authorify-client | build/authorify.js | function(api, id, key) {
// get storage object
var rval = _getStorageObject(api, id);
if(rval !== null) {
// return data at key
rval = (key in rval) ? rval[key] : null;
}
return rval;
} | javascript | function(api, id, key) {
// get storage object
var rval = _getStorageObject(api, id);
if(rval !== null) {
// return data at key
rval = (key in rval) ? rval[key] : null;
}
return rval;
} | [
"function",
"(",
"api",
",",
"id",
",",
"key",
")",
"{",
"// get storage object",
"var",
"rval",
"=",
"_getStorageObject",
"(",
"api",
",",
"id",
")",
";",
"if",
"(",
"rval",
"!==",
"null",
")",
"{",
"// return data at key",
"rval",
"=",
"(",
"key",
"i... | Gets an item from local storage.
@param api the storage interface.
@param id the storage ID to use.
@param key the key for the item.
@return the item. | [
"Gets",
"an",
"item",
"from",
"local",
"storage",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L1443-L1452 | |
56,423 | mgesmundo/authorify-client | build/authorify.js | function(api, id, key) {
// get storage object
var obj = _getStorageObject(api, id);
if(obj !== null && key in obj) {
// remove key
delete obj[key];
// see if entry has no keys remaining
var empty = true;
for(var prop in obj) {
empty = false;
break;
}
if(empty) {
// ... | javascript | function(api, id, key) {
// get storage object
var obj = _getStorageObject(api, id);
if(obj !== null && key in obj) {
// remove key
delete obj[key];
// see if entry has no keys remaining
var empty = true;
for(var prop in obj) {
empty = false;
break;
}
if(empty) {
// ... | [
"function",
"(",
"api",
",",
"id",
",",
"key",
")",
"{",
"// get storage object",
"var",
"obj",
"=",
"_getStorageObject",
"(",
"api",
",",
"id",
")",
";",
"if",
"(",
"obj",
"!==",
"null",
"&&",
"key",
"in",
"obj",
")",
"{",
"// remove key",
"delete",
... | Removes an item from local storage.
@param api the storage interface.
@param id the storage ID to use.
@param key the key for the item. | [
"Removes",
"an",
"item",
"from",
"local",
"storage",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L1461-L1482 | |
56,424 | mgesmundo/authorify-client | build/authorify.js | function(func, args, location) {
var rval = null;
// default storage types
if(typeof(location) === 'undefined') {
location = ['web', 'flash'];
}
// apply storage types in order of preference
var type;
var done = false;
var exception = null;
for(var idx in location) {
type = location[idx];
... | javascript | function(func, args, location) {
var rval = null;
// default storage types
if(typeof(location) === 'undefined') {
location = ['web', 'flash'];
}
// apply storage types in order of preference
var type;
var done = false;
var exception = null;
for(var idx in location) {
type = location[idx];
... | [
"function",
"(",
"func",
",",
"args",
",",
"location",
")",
"{",
"var",
"rval",
"=",
"null",
";",
"// default storage types",
"if",
"(",
"typeof",
"(",
"location",
")",
"===",
"'undefined'",
")",
"{",
"location",
"=",
"[",
"'web'",
",",
"'flash'",
"]",
... | Calls a storage function.
@param func the function to call.
@param args the arguments for the function.
@param location the location argument.
@return the return value from the function. | [
"Calls",
"a",
"storage",
"function",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L1503-L1544 | |
56,425 | mgesmundo/authorify-client | build/authorify.js | function(b) {
var b2 = b.getByte();
if(b2 === 0x80) {
return undefined;
}
// see if the length is "short form" or "long form" (bit 8 set)
var length;
var longForm = b2 & 0x80;
if(!longForm) {
// length is just the first byte
length = b2;
} else {
// the number of bytes the length is spe... | javascript | function(b) {
var b2 = b.getByte();
if(b2 === 0x80) {
return undefined;
}
// see if the length is "short form" or "long form" (bit 8 set)
var length;
var longForm = b2 & 0x80;
if(!longForm) {
// length is just the first byte
length = b2;
} else {
// the number of bytes the length is spe... | [
"function",
"(",
"b",
")",
"{",
"var",
"b2",
"=",
"b",
".",
"getByte",
"(",
")",
";",
"if",
"(",
"b2",
"===",
"0x80",
")",
"{",
"return",
"undefined",
";",
"}",
"// see if the length is \"short form\" or \"long form\" (bit 8 set)",
"var",
"length",
";",
"var... | Gets the length of an ASN.1 value.
In case the length is not specified, undefined is returned.
@param b the ASN.1 byte buffer.
@return the length of the ASN.1 value. | [
"Gets",
"the",
"length",
"of",
"an",
"ASN",
".",
"1",
"value",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L5142-L5160 | |
56,426 | mgesmundo/authorify-client | build/authorify.js | _reseedSync | function _reseedSync() {
if(ctx.pools[0].messageLength >= 32) {
return _seed();
}
// not enough seed data...
var needed = (32 - ctx.pools[0].messageLength) << 5;
ctx.collect(ctx.seedFileSync(needed));
_seed();
} | javascript | function _reseedSync() {
if(ctx.pools[0].messageLength >= 32) {
return _seed();
}
// not enough seed data...
var needed = (32 - ctx.pools[0].messageLength) << 5;
ctx.collect(ctx.seedFileSync(needed));
_seed();
} | [
"function",
"_reseedSync",
"(",
")",
"{",
"if",
"(",
"ctx",
".",
"pools",
"[",
"0",
"]",
".",
"messageLength",
">=",
"32",
")",
"{",
"return",
"_seed",
"(",
")",
";",
"}",
"// not enough seed data...",
"var",
"needed",
"=",
"(",
"32",
"-",
"ctx",
"."... | Private function that synchronously reseeds a generator. | [
"Private",
"function",
"that",
"synchronously",
"reseeds",
"a",
"generator",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L9113-L9121 |
56,427 | mgesmundo/authorify-client | build/authorify.js | _seed | function _seed() {
// create a plugin-based message digest
var md = ctx.plugin.md.create();
// digest pool 0's entropy and restart it
md.update(ctx.pools[0].digest().getBytes());
ctx.pools[0].start();
// digest the entropy of other pools whose index k meet the
// condition '2^k mod n == 0'... | javascript | function _seed() {
// create a plugin-based message digest
var md = ctx.plugin.md.create();
// digest pool 0's entropy and restart it
md.update(ctx.pools[0].digest().getBytes());
ctx.pools[0].start();
// digest the entropy of other pools whose index k meet the
// condition '2^k mod n == 0'... | [
"function",
"_seed",
"(",
")",
"{",
"// create a plugin-based message digest",
"var",
"md",
"=",
"ctx",
".",
"plugin",
".",
"md",
".",
"create",
"(",
")",
";",
"// digest pool 0's entropy and restart it",
"md",
".",
"update",
"(",
"ctx",
".",
"pools",
"[",
"0"... | Private function that seeds a generator once enough bytes are available. | [
"Private",
"function",
"that",
"seeds",
"a",
"generator",
"once",
"enough",
"bytes",
"are",
"available",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L9126-L9157 |
56,428 | mgesmundo/authorify-client | build/authorify.js | defaultSeedFile | function defaultSeedFile(needed) {
// use window.crypto.getRandomValues strong source of entropy if available
var getRandomValues = null;
if(typeof window !== 'undefined') {
var _crypto = window.crypto || window.msCrypto;
if(_crypto && _crypto.getRandomValues) {
getRandomValues = functio... | javascript | function defaultSeedFile(needed) {
// use window.crypto.getRandomValues strong source of entropy if available
var getRandomValues = null;
if(typeof window !== 'undefined') {
var _crypto = window.crypto || window.msCrypto;
if(_crypto && _crypto.getRandomValues) {
getRandomValues = functio... | [
"function",
"defaultSeedFile",
"(",
"needed",
")",
"{",
"// use window.crypto.getRandomValues strong source of entropy if available",
"var",
"getRandomValues",
"=",
"null",
";",
"if",
"(",
"typeof",
"window",
"!==",
"'undefined'",
")",
"{",
"var",
"_crypto",
"=",
"windo... | The built-in default seedFile. This seedFile is used when entropy
is needed immediately.
@param needed the number of bytes that are needed.
@return the random bytes. | [
"The",
"built",
"-",
"in",
"default",
"seedFile",
".",
"This",
"seedFile",
"is",
"used",
"when",
"entropy",
"is",
"needed",
"immediately",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L9167-L9227 |
56,429 | mgesmundo/authorify-client | build/authorify.js | spawnPrng | function spawnPrng() {
var ctx = forge.prng.create(prng_aes);
/**
* Gets random bytes. If a native secure crypto API is unavailable, this
* method tries to make the bytes more unpredictable by drawing from data that
* can be collected from the user of the browser, eg: mouse movement.
*
* If a callba... | javascript | function spawnPrng() {
var ctx = forge.prng.create(prng_aes);
/**
* Gets random bytes. If a native secure crypto API is unavailable, this
* method tries to make the bytes more unpredictable by drawing from data that
* can be collected from the user of the browser, eg: mouse movement.
*
* If a callba... | [
"function",
"spawnPrng",
"(",
")",
"{",
"var",
"ctx",
"=",
"forge",
".",
"prng",
".",
"create",
"(",
"prng_aes",
")",
";",
"/**\n * Gets random bytes. If a native secure crypto API is unavailable, this\n * method tries to make the bytes more unpredictable by drawing from data t... | Creates a new PRNG. | [
"Creates",
"a",
"new",
"PRNG",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L9447-L9481 |
56,430 | mgesmundo/authorify-client | build/authorify.js | function(plan) {
var R = [];
/* Get data from input buffer and fill the four words into R */
for(i = 0; i < 4; i ++) {
var val = _input.getInt16Le();
if(_iv !== null) {
if(encrypt) {
/* We're encrypting, apply the IV first. */
val ^= _iv.getInt16Le();
} else... | javascript | function(plan) {
var R = [];
/* Get data from input buffer and fill the four words into R */
for(i = 0; i < 4; i ++) {
var val = _input.getInt16Le();
if(_iv !== null) {
if(encrypt) {
/* We're encrypting, apply the IV first. */
val ^= _iv.getInt16Le();
} else... | [
"function",
"(",
"plan",
")",
"{",
"var",
"R",
"=",
"[",
"]",
";",
"/* Get data from input buffer and fill the four words into R */",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"var",
"val",
"=",
"_input",
".",
"getInt16Le",... | Run the specified cipher execution plan.
This function takes four words from the input buffer, applies the IV on
it (if requested) and runs the provided execution plan.
The plan must be put together in form of a array of arrays. Where the
outer one is simply a list of steps to perform and the inner one needs
to have... | [
"Run",
"the",
"specified",
"cipher",
"execution",
"plan",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L9803-L9847 | |
56,431 | mgesmundo/authorify-client | build/authorify.js | function(input) {
if(!_finish) {
// not finishing, so fill the input buffer with more input
_input.putBuffer(input);
}
while(_input.length() >= 8) {
runPlan([
[ 5, mixRound ],
[ 1, mashRound ],
[ 6, mixRound ],
[ 1, mashRound ],
... | javascript | function(input) {
if(!_finish) {
// not finishing, so fill the input buffer with more input
_input.putBuffer(input);
}
while(_input.length() >= 8) {
runPlan([
[ 5, mixRound ],
[ 1, mashRound ],
[ 6, mixRound ],
[ 1, mashRound ],
... | [
"function",
"(",
"input",
")",
"{",
"if",
"(",
"!",
"_finish",
")",
"{",
"// not finishing, so fill the input buffer with more input",
"_input",
".",
"putBuffer",
"(",
"input",
")",
";",
"}",
"while",
"(",
"_input",
".",
"length",
"(",
")",
">=",
"8",
")",
... | Updates the next block.
@param input the buffer to read from. | [
"Updates",
"the",
"next",
"block",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L9884-L9899 | |
56,432 | mgesmundo/authorify-client | build/authorify.js | function(pad) {
var rval = true;
if(encrypt) {
if(pad) {
rval = pad(8, _input, !encrypt);
} else {
// add PKCS#7 padding to block (each pad byte is the
// value of the number of pad bytes)
var padding = (_input.length() === 8) ? 8 : (8 - _input.length... | javascript | function(pad) {
var rval = true;
if(encrypt) {
if(pad) {
rval = pad(8, _input, !encrypt);
} else {
// add PKCS#7 padding to block (each pad byte is the
// value of the number of pad bytes)
var padding = (_input.length() === 8) ? 8 : (8 - _input.length... | [
"function",
"(",
"pad",
")",
"{",
"var",
"rval",
"=",
"true",
";",
"if",
"(",
"encrypt",
")",
"{",
"if",
"(",
"pad",
")",
"{",
"rval",
"=",
"pad",
"(",
"8",
",",
"_input",
",",
"!",
"encrypt",
")",
";",
"}",
"else",
"{",
"// add PKCS#7 padding to... | Finishes encrypting or decrypting.
@param pad a padding function to use, null for PKCS#7 padding,
signature(blockSize, buffer, decrypt).
@return true if successful, false on error. | [
"Finishes",
"encrypting",
"or",
"decrypting",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L9909-L9951 | |
56,433 | mgesmundo/authorify-client | build/authorify.js | bnGetPrng | function bnGetPrng() {
// create prng with api that matches BigInteger secure random
return {
// x is an array to fill with bytes
nextBytes: function(x) {
for(var i = 0; i < x.length; ++i) {
x[i] = Math.floor(Math.random() * 0xFF);
}
}
};
} | javascript | function bnGetPrng() {
// create prng with api that matches BigInteger secure random
return {
// x is an array to fill with bytes
nextBytes: function(x) {
for(var i = 0; i < x.length; ++i) {
x[i] = Math.floor(Math.random() * 0xFF);
}
}
};
} | [
"function",
"bnGetPrng",
"(",
")",
"{",
"// create prng with api that matches BigInteger secure random",
"return",
"{",
"// x is an array to fill with bytes",
"nextBytes",
":",
"function",
"(",
"x",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"x",
"... | get pseudo random number generator | [
"get",
"pseudo",
"random",
"number",
"generator"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L11280-L11290 |
56,434 | mgesmundo/authorify-client | build/authorify.js | getPrime | function getPrime(bits, callback) {
// TODO: consider optimizing by starting workers outside getPrime() ...
// note that in order to clean up they will have to be made internally
// asynchronous which may actually be slower
// start workers immediately
var workers = [];
for(var i = 0; i < numWo... | javascript | function getPrime(bits, callback) {
// TODO: consider optimizing by starting workers outside getPrime() ...
// note that in order to clean up they will have to be made internally
// asynchronous which may actually be slower
// start workers immediately
var workers = [];
for(var i = 0; i < numWo... | [
"function",
"getPrime",
"(",
"bits",
",",
"callback",
")",
"{",
"// TODO: consider optimizing by starting workers outside getPrime() ...",
"// note that in order to clean up they will have to be made internally",
"// asynchronous which may actually be slower",
"// start workers immediately",
... | implement prime number generation using web workers | [
"implement",
"prime",
"number",
"generation",
"using",
"web",
"workers"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L13286-L13368 |
56,435 | mgesmundo/authorify-client | build/authorify.js | _bnToBytes | function _bnToBytes(b) {
// prepend 0x00 if first byte >= 0x80
var hex = b.toString(16);
if(hex[0] >= '8') {
hex = '00' + hex;
}
return forge.util.hexToBytes(hex);
} | javascript | function _bnToBytes(b) {
// prepend 0x00 if first byte >= 0x80
var hex = b.toString(16);
if(hex[0] >= '8') {
hex = '00' + hex;
}
return forge.util.hexToBytes(hex);
} | [
"function",
"_bnToBytes",
"(",
"b",
")",
"{",
"// prepend 0x00 if first byte >= 0x80",
"var",
"hex",
"=",
"b",
".",
"toString",
"(",
"16",
")",
";",
"if",
"(",
"hex",
"[",
"0",
"]",
">=",
"'8'",
")",
"{",
"hex",
"=",
"'00'",
"+",
"hex",
";",
"}",
"... | Converts a positive BigInteger into 2's-complement big-endian bytes.
@param b the big integer to convert.
@return the bytes. | [
"Converts",
"a",
"positive",
"BigInteger",
"into",
"2",
"s",
"-",
"complement",
"big",
"-",
"endian",
"bytes",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L13424-L13431 |
56,436 | mgesmundo/authorify-client | build/authorify.js | evpBytesToKey | function evpBytesToKey(password, salt, dkLen) {
var digests = [md5(password + salt)];
for(var length = 16, i = 1; length < dkLen; ++i, length += 16) {
digests.push(md5(digests[i - 1] + password + salt));
}
return digests.join('').substr(0, dkLen);
} | javascript | function evpBytesToKey(password, salt, dkLen) {
var digests = [md5(password + salt)];
for(var length = 16, i = 1; length < dkLen; ++i, length += 16) {
digests.push(md5(digests[i - 1] + password + salt));
}
return digests.join('').substr(0, dkLen);
} | [
"function",
"evpBytesToKey",
"(",
"password",
",",
"salt",
",",
"dkLen",
")",
"{",
"var",
"digests",
"=",
"[",
"md5",
"(",
"password",
"+",
"salt",
")",
"]",
";",
"for",
"(",
"var",
"length",
"=",
"16",
",",
"i",
"=",
"1",
";",
"length",
"<",
"dk... | OpenSSL's legacy key derivation function.
See: http://www.openssl.org/docs/crypto/EVP_BytesToKey.html
@param password the password to derive the key from.
@param salt the salt to use.
@param dkLen the number of bytes needed for the derived key. | [
"OpenSSL",
"s",
"legacy",
"key",
"derivation",
"function",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L14408-L14414 |
56,437 | mgesmundo/authorify-client | build/authorify.js | _extensionsToAsn1 | function _extensionsToAsn1(exts) {
// create top-level extension container
var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 3, true, []);
// create extension sequence (stores a sequence for each extension)
var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);
rval.value.push(seq);
... | javascript | function _extensionsToAsn1(exts) {
// create top-level extension container
var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 3, true, []);
// create extension sequence (stores a sequence for each extension)
var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);
rval.value.push(seq);
... | [
"function",
"_extensionsToAsn1",
"(",
"exts",
")",
"{",
"// create top-level extension container",
"var",
"rval",
"=",
"asn1",
".",
"create",
"(",
"asn1",
".",
"Class",
".",
"CONTEXT_SPECIFIC",
",",
"3",
",",
"true",
",",
"[",
"]",
")",
";",
"// create extensi... | Converts X.509v3 certificate extensions to ASN.1.
@param exts the extensions to convert.
@return the extensions in ASN.1 format. | [
"Converts",
"X",
".",
"509v3",
"certificate",
"extensions",
"to",
"ASN",
".",
"1",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L17430-L17471 |
56,438 | mgesmundo/authorify-client | build/authorify.js | _CRIAttributesToAsn1 | function _CRIAttributesToAsn1(csr) {
// create an empty context-specific container
var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, []);
// no attributes, return empty container
if(csr.attributes.length === 0) {
return rval;
}
// each attribute has a sequence with a type and a set of value... | javascript | function _CRIAttributesToAsn1(csr) {
// create an empty context-specific container
var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, []);
// no attributes, return empty container
if(csr.attributes.length === 0) {
return rval;
}
// each attribute has a sequence with a type and a set of value... | [
"function",
"_CRIAttributesToAsn1",
"(",
"csr",
")",
"{",
"// create an empty context-specific container",
"var",
"rval",
"=",
"asn1",
".",
"create",
"(",
"asn1",
".",
"Class",
".",
"CONTEXT_SPECIFIC",
",",
"0",
",",
"true",
",",
"[",
"]",
")",
";",
"// no att... | Converts a certification request's attributes to an ASN.1 set of
CRIAttributes.
@param csr certification request.
@return the ASN.1 set of CRIAttributes. | [
"Converts",
"a",
"certification",
"request",
"s",
"attributes",
"to",
"an",
"ASN",
".",
"1",
"set",
"of",
"CRIAttributes",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L17608-L17649 |
56,439 | mgesmundo/authorify-client | build/authorify.js | function(filter) {
var rval = {};
var localKeyId;
if('localKeyId' in filter) {
localKeyId = filter.localKeyId;
} else if('localKeyIdHex' in filter) {
localKeyId = forge.util.hexToBytes(filter.localKeyIdHex);
}
// filter on bagType only
if(localKeyId === undefi... | javascript | function(filter) {
var rval = {};
var localKeyId;
if('localKeyId' in filter) {
localKeyId = filter.localKeyId;
} else if('localKeyIdHex' in filter) {
localKeyId = forge.util.hexToBytes(filter.localKeyIdHex);
}
// filter on bagType only
if(localKeyId === undefi... | [
"function",
"(",
"filter",
")",
"{",
"var",
"rval",
"=",
"{",
"}",
";",
"var",
"localKeyId",
";",
"if",
"(",
"'localKeyId'",
"in",
"filter",
")",
"{",
"localKeyId",
"=",
"filter",
".",
"localKeyId",
";",
"}",
"else",
"if",
"(",
"'localKeyIdHex'",
"in",... | Gets bags with matching attributes.
@param filter the attributes to filter by:
[localKeyId] the localKeyId to search for.
[localKeyIdHex] the localKeyId in hex to search for.
[friendlyName] the friendly name to search for.
[bagType] bag type to narrow each attribute search by.
@return a map of attribute type to an ar... | [
"Gets",
"bags",
"with",
"matching",
"attributes",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L18696-L18725 | |
56,440 | mgesmundo/authorify-client | build/authorify.js | function(secret, label, seed, length) {
var rval = forge.util.createBuffer();
/* For TLS 1.0, the secret is split in half, into two secrets of equal
length. If the secret has an odd length then the last byte of the first
half will be the same as the first byte of the second. The length of the
two secre... | javascript | function(secret, label, seed, length) {
var rval = forge.util.createBuffer();
/* For TLS 1.0, the secret is split in half, into two secrets of equal
length. If the secret has an odd length then the last byte of the first
half will be the same as the first byte of the second. The length of the
two secre... | [
"function",
"(",
"secret",
",",
"label",
",",
"seed",
",",
"length",
")",
"{",
"var",
"rval",
"=",
"forge",
".",
"util",
".",
"createBuffer",
"(",
")",
";",
"/* For TLS 1.0, the secret is split in half, into two secrets of equal\n length. If the secret has an odd lengt... | Generates pseudo random bytes by mixing the result of two hash functions,
MD5 and SHA-1.
prf_TLS1(secret, label, seed) =
P_MD5(S1, label + seed) XOR P_SHA-1(S2, label + seed);
Each P_hash function functions as follows:
P_hash(secret, seed) = HMAC_hash(secret, A(1) + seed) +
HMAC_hash(secret, A(2) + seed) +
HMAC_hash... | [
"Generates",
"pseudo",
"random",
"bytes",
"by",
"mixing",
"the",
"result",
"of",
"two",
"hash",
"functions",
"MD5",
"and",
"SHA",
"-",
"1",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L19920-L19978 | |
56,441 | mgesmundo/authorify-client | build/authorify.js | function(key, seqNum, record) {
/* MAC is computed like so:
HMAC_hash(
key, seqNum +
TLSCompressed.type +
TLSCompressed.version +
TLSCompressed.length +
TLSCompressed.fragment)
*/
var hmac = forge.hmac.create();
hmac.start('SHA1', key);
var b = forge.util.createBuffer();
b.putI... | javascript | function(key, seqNum, record) {
/* MAC is computed like so:
HMAC_hash(
key, seqNum +
TLSCompressed.type +
TLSCompressed.version +
TLSCompressed.length +
TLSCompressed.fragment)
*/
var hmac = forge.hmac.create();
hmac.start('SHA1', key);
var b = forge.util.createBuffer();
b.putI... | [
"function",
"(",
"key",
",",
"seqNum",
",",
"record",
")",
"{",
"/* MAC is computed like so:\n HMAC_hash(\n key, seqNum +\n TLSCompressed.type +\n TLSCompressed.version +\n TLSCompressed.length +\n TLSCompressed.fragment)\n */",
"var",
"hmac",
"=",
"forge",
".",
... | Gets a MAC for a record using the SHA-1 hash algorithm.
@param key the mac key.
@param state the sequence number (array of two 32-bit integers).
@param record the record.
@return the sha-1 hash (20 bytes) for the given record. | [
"Gets",
"a",
"MAC",
"for",
"a",
"record",
"using",
"the",
"SHA",
"-",
"1",
"hash",
"algorithm",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L20003-L20024 | |
56,442 | mgesmundo/authorify-client | build/authorify.js | encrypt_aes_cbc_sha1 | function encrypt_aes_cbc_sha1(record, s) {
var rval = false;
// append MAC to fragment, update sequence number
var mac = s.macFunction(s.macKey, s.sequenceNumber, record);
record.fragment.putBytes(mac);
s.updateSequenceNumber();
// TLS 1.1+ use an explicit IV every time to protect against CBC attacks
va... | javascript | function encrypt_aes_cbc_sha1(record, s) {
var rval = false;
// append MAC to fragment, update sequence number
var mac = s.macFunction(s.macKey, s.sequenceNumber, record);
record.fragment.putBytes(mac);
s.updateSequenceNumber();
// TLS 1.1+ use an explicit IV every time to protect against CBC attacks
va... | [
"function",
"encrypt_aes_cbc_sha1",
"(",
"record",
",",
"s",
")",
"{",
"var",
"rval",
"=",
"false",
";",
"// append MAC to fragment, update sequence number",
"var",
"mac",
"=",
"s",
".",
"macFunction",
"(",
"s",
".",
"macKey",
",",
"s",
".",
"sequenceNumber",
... | Encrypts the TLSCompressed record into a TLSCipherText record using AES
in CBC mode.
@param record the TLSCompressed record to encrypt.
@param s the ConnectionState to use.
@return true on success, false on failure. | [
"Encrypts",
"the",
"TLSCompressed",
"record",
"into",
"a",
"TLSCipherText",
"record",
"using",
"AES",
"in",
"CBC",
"mode",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L24037-L24076 |
56,443 | mgesmundo/authorify-client | build/authorify.js | decrypt_aes_cbc_sha1_padding | function decrypt_aes_cbc_sha1_padding(blockSize, output, decrypt) {
var rval = true;
if(decrypt) {
/* The last byte in the output specifies the number of padding bytes not
including itself. Each of the padding bytes has the same value as that
last byte (known as the padding_length). Here we check al... | javascript | function decrypt_aes_cbc_sha1_padding(blockSize, output, decrypt) {
var rval = true;
if(decrypt) {
/* The last byte in the output specifies the number of padding bytes not
including itself. Each of the padding bytes has the same value as that
last byte (known as the padding_length). Here we check al... | [
"function",
"decrypt_aes_cbc_sha1_padding",
"(",
"blockSize",
",",
"output",
",",
"decrypt",
")",
"{",
"var",
"rval",
"=",
"true",
";",
"if",
"(",
"decrypt",
")",
"{",
"/* The last byte in the output specifies the number of padding bytes not\n including itself. Each of t... | Handles padding for aes_cbc_sha1 in decrypt mode.
@param blockSize the block size.
@param output the output buffer.
@param decrypt true in decrypt mode, false in encrypt mode.
@return true on success, false on failure. | [
"Handles",
"padding",
"for",
"aes_cbc_sha1",
"in",
"decrypt",
"mode",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L24125-L24144 |
56,444 | mgesmundo/authorify-client | build/authorify.js | function(objArr) {
var ret = [];
for(var i = 0; i < objArr.length; i ++) {
ret.push(_recipientInfoFromAsn1(objArr[i]));
}
return ret;
} | javascript | function(objArr) {
var ret = [];
for(var i = 0; i < objArr.length; i ++) {
ret.push(_recipientInfoFromAsn1(objArr[i]));
}
return ret;
} | [
"function",
"(",
"objArr",
")",
"{",
"var",
"ret",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"objArr",
".",
"length",
";",
"i",
"++",
")",
"{",
"ret",
".",
"push",
"(",
"_recipientInfoFromAsn1",
"(",
"objArr",
"[",
"i... | Map a set of RecipientInfo ASN.1 objects to recipientInfo objects.
@param objArr Array of ASN.1 representations RecipientInfo (i.e. SET OF).
@return array of recipientInfo objects. | [
"Map",
"a",
"set",
"of",
"RecipientInfo",
"ASN",
".",
"1",
"objects",
"to",
"recipientInfo",
"objects",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L24961-L24967 | |
56,445 | mgesmundo/authorify-client | build/authorify.js | function(recipientsArr) {
var ret = [];
for(var i = 0; i < recipientsArr.length; i ++) {
ret.push(_recipientInfoToAsn1(recipientsArr[i]));
}
return ret;
} | javascript | function(recipientsArr) {
var ret = [];
for(var i = 0; i < recipientsArr.length; i ++) {
ret.push(_recipientInfoToAsn1(recipientsArr[i]));
}
return ret;
} | [
"function",
"(",
"recipientsArr",
")",
"{",
"var",
"ret",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"recipientsArr",
".",
"length",
";",
"i",
"++",
")",
"{",
"ret",
".",
"push",
"(",
"_recipientInfoToAsn1",
"(",
"recipien... | Map an array of recipientInfo objects to ASN.1 objects.
@param recipientsArr Array of recipientInfo objects.
@return Array of ASN.1 representations RecipientInfo. | [
"Map",
"an",
"array",
"of",
"recipientInfo",
"objects",
"to",
"ASN",
".",
"1",
"objects",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L24976-L24982 | |
56,446 | mgesmundo/authorify-client | build/authorify.js | function(task, recurse) {
// get time since last context swap (ms), if enough time has passed set
// swap to true to indicate that doNext was performed asynchronously
// also, if recurse is too high do asynchronously
var swap =
(recurse > sMaxRecursions) ||
(+new Date() - task.swapTime) > sTimeSlice;
... | javascript | function(task, recurse) {
// get time since last context swap (ms), if enough time has passed set
// swap to true to indicate that doNext was performed asynchronously
// also, if recurse is too high do asynchronously
var swap =
(recurse > sMaxRecursions) ||
(+new Date() - task.swapTime) > sTimeSlice;
... | [
"function",
"(",
"task",
",",
"recurse",
")",
"{",
"// get time since last context swap (ms), if enough time has passed set",
"// swap to true to indicate that doNext was performed asynchronously",
"// also, if recurse is too high do asynchronously",
"var",
"swap",
"=",
"(",
"recurse",
... | Run the next subtask or finish this task.
@param task the task to process.
@param recurse the recursion count. | [
"Run",
"the",
"next",
"subtask",
"or",
"finish",
"this",
"task",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L26112-L26165 | |
56,447 | mgesmundo/authorify-client | build/authorify.js | function(task, suppressCallbacks) {
// subtask is now done
task.state = DONE;
delete sTasks[task.id];
if(sVL >= 1) {
forge.log.verbose(cat, '[%s][%s] finish',
task.id, task.name, task);
}
// only do queue processing for root tasks
if(task.parent === null) {
// report error if queue is miss... | javascript | function(task, suppressCallbacks) {
// subtask is now done
task.state = DONE;
delete sTasks[task.id];
if(sVL >= 1) {
forge.log.verbose(cat, '[%s][%s] finish',
task.id, task.name, task);
}
// only do queue processing for root tasks
if(task.parent === null) {
// report error if queue is miss... | [
"function",
"(",
"task",
",",
"suppressCallbacks",
")",
"{",
"// subtask is now done",
"task",
".",
"state",
"=",
"DONE",
";",
"delete",
"sTasks",
"[",
"task",
".",
"id",
"]",
";",
"if",
"(",
"sVL",
">=",
"1",
")",
"{",
"forge",
".",
"log",
".",
"ver... | Finishes a task and looks for the next task in the queue to start.
@param task the task to finish.
@param suppressCallbacks true to suppress callbacks. | [
"Finishes",
"a",
"task",
"and",
"looks",
"for",
"the",
"next",
"task",
"in",
"the",
"queue",
"to",
"start",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L26173-L26235 | |
56,448 | mgesmundo/authorify-client | build/authorify.js | function() {
var cert;
try {
cert = this.keychain.getCertPem();
} catch (e) {
throw new CError({
body: {
code: 'ImATeapot',
message: 'missing certificate',
cause: e
}
}).log('body');
}
if (!cert) {
thro... | javascript | function() {
var cert;
try {
cert = this.keychain.getCertPem();
} catch (e) {
throw new CError({
body: {
code: 'ImATeapot',
message: 'missing certificate',
cause: e
}
}).log('body');
}
if (!cert) {
thro... | [
"function",
"(",
")",
"{",
"var",
"cert",
";",
"try",
"{",
"cert",
"=",
"this",
".",
"keychain",
".",
"getCertPem",
"(",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"throw",
"new",
"CError",
"(",
"{",
"body",
":",
"{",
"code",
":",
"'ImATeapot'",... | Generate a new token
@returns {String} The generated token | [
"Generate",
"a",
"new",
"token"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L29468-L29516 | |
56,449 | mgesmundo/authorify-client | build/authorify.js | function(data) {
if (!(data && 'function' === typeof data.isBase64 && data.isBase64())) {
throw new CError('wrong data format to decrypt').log();
}
return JSON.parse(this.encoder.decryptAes(data, this.getSecret()));
} | javascript | function(data) {
if (!(data && 'function' === typeof data.isBase64 && data.isBase64())) {
throw new CError('wrong data format to decrypt').log();
}
return JSON.parse(this.encoder.decryptAes(data, this.getSecret()));
} | [
"function",
"(",
"data",
")",
"{",
"if",
"(",
"!",
"(",
"data",
"&&",
"'function'",
"===",
"typeof",
"data",
".",
"isBase64",
"&&",
"data",
".",
"isBase64",
"(",
")",
")",
")",
"{",
"throw",
"new",
"CError",
"(",
"'wrong data format to decrypt'",
")",
... | Decrypt content.
@param {String} The data to decrypt
@return {Object} The decrypted result | [
"Decrypt",
"content",
"."
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L29599-L29604 | |
56,450 | mgesmundo/authorify-client | build/authorify.js | getConfigOptions | function getConfigOptions(opts) {
opts = formatOptions(opts);
_.forEach(config, function(value, key) {
opts[key] = opts[key] || value;
});
opts.headers = opts.headers || {};
return opts;
} | javascript | function getConfigOptions(opts) {
opts = formatOptions(opts);
_.forEach(config, function(value, key) {
opts[key] = opts[key] || value;
});
opts.headers = opts.headers || {};
return opts;
} | [
"function",
"getConfigOptions",
"(",
"opts",
")",
"{",
"opts",
"=",
"formatOptions",
"(",
"opts",
")",
";",
"_",
".",
"forEach",
"(",
"config",
",",
"function",
"(",
"value",
",",
"key",
")",
"{",
"opts",
"[",
"key",
"]",
"=",
"opts",
"[",
"key",
"... | Get all options with default values if empty
@param {Object/String} opts The options object or string with the required name
@returns {Object} The configuration with default values
@private
@ignore | [
"Get",
"all",
"options",
"with",
"default",
"values",
"if",
"empty"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L30469-L30477 |
56,451 | mgesmundo/authorify-client | build/authorify.js | fixRequestOptions | function fixRequestOptions(method, path, transport, plain, callback) {
var opts = {
method: method,
path: path
};
if (_.isFunction(transport)) {
opts.callback = transport;
opts.plain = false;
opts.transport = 'http';
} else {
if (_.isString(transport)) {
opts.... | javascript | function fixRequestOptions(method, path, transport, plain, callback) {
var opts = {
method: method,
path: path
};
if (_.isFunction(transport)) {
opts.callback = transport;
opts.plain = false;
opts.transport = 'http';
} else {
if (_.isString(transport)) {
opts.... | [
"function",
"fixRequestOptions",
"(",
"method",
",",
"path",
",",
"transport",
",",
"plain",
",",
"callback",
")",
"{",
"var",
"opts",
"=",
"{",
"method",
":",
"method",
",",
"path",
":",
"path",
"}",
";",
"if",
"(",
"_",
".",
"isFunction",
"(",
"tra... | Make an object with all params
@param {String} method The required method
@param {String} path The required path
@param {String} [transport = 'http'] The transport protocol ('http' or 'ws')
@param {Boolean} [plain = false] The required plain
@param {Function} callback The required callback
@return {Object} An object w... | [
"Make",
"an",
"object",
"with",
"all",
"params"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L30491-L30515 |
56,452 | mgesmundo/authorify-client | build/authorify.js | logResponse | function logResponse(err, res) {
if (err || (res && !res.ok)) {
if (err) {
log.warn('%s on response -> read plaintext body due an error (%s)', app.name, err.message);
} else {
log.warn('%s on response -> read plaintext body due an error (%s)', app.name, res.error);
}
} else if ... | javascript | function logResponse(err, res) {
if (err || (res && !res.ok)) {
if (err) {
log.warn('%s on response -> read plaintext body due an error (%s)', app.name, err.message);
} else {
log.warn('%s on response -> read plaintext body due an error (%s)', app.name, res.error);
}
} else if ... | [
"function",
"logResponse",
"(",
"err",
",",
"res",
")",
"{",
"if",
"(",
"err",
"||",
"(",
"res",
"&&",
"!",
"res",
".",
"ok",
")",
")",
"{",
"if",
"(",
"err",
")",
"{",
"log",
".",
"warn",
"(",
"'%s on response -> read plaintext body due an error (%s)'",... | Log the response
@param {Object} err The error if occurred
@param {Object} res The response
@private
@ignore | [
"Log",
"the",
"response"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L30538-L30552 |
56,453 | mgesmundo/authorify-client | build/authorify.js | getModuleName | function getModuleName(module) {
var script = module.replace(/[^a-zA-Z0-9]/g, '.'),
parts = script.split('.'),
name = parts.shift();
if (parts.length) {
for (var p in parts) {
name += parts[p].charAt(0).toUpperCase() + parts[p].substr(1, parts[p].length);
}
}
return ... | javascript | function getModuleName(module) {
var script = module.replace(/[^a-zA-Z0-9]/g, '.'),
parts = script.split('.'),
name = parts.shift();
if (parts.length) {
for (var p in parts) {
name += parts[p].charAt(0).toUpperCase() + parts[p].substr(1, parts[p].length);
}
}
return ... | [
"function",
"getModuleName",
"(",
"module",
")",
"{",
"var",
"script",
"=",
"module",
".",
"replace",
"(",
"/",
"[^a-zA-Z0-9]",
"/",
"g",
",",
"'.'",
")",
",",
"parts",
"=",
"script",
".",
"split",
"(",
"'.'",
")",
",",
"name",
"=",
"parts",
".",
"... | Formats the name of the module loaded into the browser
@param module {String} The original module name
@return {String} Name of the module
@private
@ignore | [
"Formats",
"the",
"name",
"of",
"the",
"module",
"loaded",
"into",
"the",
"browser"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L30562-L30573 |
56,454 | mgesmundo/authorify-client | build/authorify.js | function(opts) {
opts = opts || {};
var path = opts.path || this.path,
callback = opts.callback,
method = opts.method || this.method,
ws = getWebsocketPlugin(),
transports = app.config.transports,
self = this,
i = 0,
error,
resp... | javascript | function(opts) {
opts = opts || {};
var path = opts.path || this.path,
callback = opts.callback,
method = opts.method || this.method,
ws = getWebsocketPlugin(),
transports = app.config.transports,
self = this,
i = 0,
error,
resp... | [
"function",
"(",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"var",
"path",
"=",
"opts",
".",
"path",
"||",
"this",
".",
"path",
",",
"callback",
"=",
"opts",
".",
"callback",
",",
"method",
"=",
"opts",
".",
"method",
"||",
"this... | A request without Authorization header
@inheritdoc #authorize
@private | [
"A",
"request",
"without",
"Authorization",
"header"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L30885-L30931 | |
56,455 | mgesmundo/authorify-client | build/authorify.js | function(value) {
if (value) {
if (config.encryptQuery) {
this._pendingQuery = this._pendingQuery || [];
this._pendingQuery.push(value);
} else {
this.request.query(value);
}
}
return this;
} | javascript | function(value) {
if (value) {
if (config.encryptQuery) {
this._pendingQuery = this._pendingQuery || [];
this._pendingQuery.push(value);
} else {
this.request.query(value);
}
}
return this;
} | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"value",
")",
"{",
"if",
"(",
"config",
".",
"encryptQuery",
")",
"{",
"this",
".",
"_pendingQuery",
"=",
"this",
".",
"_pendingQuery",
"||",
"[",
"]",
";",
"this",
".",
"_pendingQuery",
".",
"push",
"("... | Compose a query-string
## Example
To compose a query-string like "?format=json&data=here" in a GET request:
var client = require('authorify-client')({
// set your options
});
client
.get('/someroute')
.query({ format: 'json' })
.query({ data: 'here' })
.end(function(err, res){
// your logic
});
@chainable
@param {O... | [
"Compose",
"a",
"query",
"-",
"string"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L31144-L31154 | |
56,456 | mgesmundo/authorify-client | build/authorify.js | function(callback) {
if (res.session && res.session.cert) {
if (res.parsedHeader.payload.mode === 'handshake') {
if (my.config.crypter.verifyCertificate(res.session.cert)) {
callback(null);
} else {
callback('unknown certificate');
}
... | javascript | function(callback) {
if (res.session && res.session.cert) {
if (res.parsedHeader.payload.mode === 'handshake') {
if (my.config.crypter.verifyCertificate(res.session.cert)) {
callback(null);
} else {
callback('unknown certificate');
}
... | [
"function",
"(",
"callback",
")",
"{",
"if",
"(",
"res",
".",
"session",
"&&",
"res",
".",
"session",
".",
"cert",
")",
"{",
"if",
"(",
"res",
".",
"parsedHeader",
".",
"payload",
".",
"mode",
"===",
"'handshake'",
")",
"{",
"if",
"(",
"my",
".",
... | verify certificate authenticity | [
"verify",
"certificate",
"authenticity"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L31326-L31340 | |
56,457 | mgesmundo/authorify-client | build/authorify.js | function(callback) {
if (!res.parsedHeader.signature) {
callback('unsigned');
} else {
var signVerifier = new Crypter({
cert: res.session.cert
});
if (signVerifier.verifySignature(JSON.stringify(res.parsedHeader.content), res.parsedHeader.signature)) {... | javascript | function(callback) {
if (!res.parsedHeader.signature) {
callback('unsigned');
} else {
var signVerifier = new Crypter({
cert: res.session.cert
});
if (signVerifier.verifySignature(JSON.stringify(res.parsedHeader.content), res.parsedHeader.signature)) {... | [
"function",
"(",
"callback",
")",
"{",
"if",
"(",
"!",
"res",
".",
"parsedHeader",
".",
"signature",
")",
"{",
"callback",
"(",
"'unsigned'",
")",
";",
"}",
"else",
"{",
"var",
"signVerifier",
"=",
"new",
"Crypter",
"(",
"{",
"cert",
":",
"res",
".",... | verify signature using sender certificate | [
"verify",
"signature",
"using",
"sender",
"certificate"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L31342-L31355 | |
56,458 | mgesmundo/authorify-client | build/authorify.js | function(callback) {
if (parseInt(config.clockSkew, 10) > 0) {
var now = new Date().toSerialNumber(),
sent = res.parsedHeader.content.date;
if ((now - sent) > config.clockSkew * 1000) {
callback('date too old');
} else {
callback(null);
... | javascript | function(callback) {
if (parseInt(config.clockSkew, 10) > 0) {
var now = new Date().toSerialNumber(),
sent = res.parsedHeader.content.date;
if ((now - sent) > config.clockSkew * 1000) {
callback('date too old');
} else {
callback(null);
... | [
"function",
"(",
"callback",
")",
"{",
"if",
"(",
"parseInt",
"(",
"config",
".",
"clockSkew",
",",
"10",
")",
">",
"0",
")",
"{",
"var",
"now",
"=",
"new",
"Date",
"(",
")",
".",
"toSerialNumber",
"(",
")",
",",
"sent",
"=",
"res",
".",
"parsedH... | verify the date | [
"verify",
"the",
"date"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L31357-L31369 | |
56,459 | mgesmundo/authorify-client | build/authorify.js | function(secret) {
var keyIv;
if (!secret) {
throw new CError('missing secret').log();
}
// secret is a Base64 string
if(secret.isBase64()){
try {
keyIv = forge.util.decode64(secret);
} catch (e) {
throw new CError('secret not... | javascript | function(secret) {
var keyIv;
if (!secret) {
throw new CError('missing secret').log();
}
// secret is a Base64 string
if(secret.isBase64()){
try {
keyIv = forge.util.decode64(secret);
} catch (e) {
throw new CError('secret not... | [
"function",
"(",
"secret",
")",
"{",
"var",
"keyIv",
";",
"if",
"(",
"!",
"secret",
")",
"{",
"throw",
"new",
"CError",
"(",
"'missing secret'",
")",
".",
"log",
"(",
")",
";",
"}",
"// secret is a Base64 string",
"if",
"(",
"secret",
".",
"isBase64",
... | Get bytes from a secret key
@param {String} secret The secret in Base64 format
@return {Bytes} The secret bytes
@static
@private | [
"Get",
"bytes",
"from",
"a",
"secret",
"key"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L32309-L32325 | |
56,460 | mgesmundo/authorify-client | build/authorify.js | function (data, scheme) {
// scheme = RSA-OAEP, RSAES-PKCS1-V1_5
scheme = scheme || SCHEME;
return forge.util.encode64(this._cert.publicKey.encrypt(data, scheme));
} | javascript | function (data, scheme) {
// scheme = RSA-OAEP, RSAES-PKCS1-V1_5
scheme = scheme || SCHEME;
return forge.util.encode64(this._cert.publicKey.encrypt(data, scheme));
} | [
"function",
"(",
"data",
",",
"scheme",
")",
"{",
"// scheme = RSA-OAEP, RSAES-PKCS1-V1_5",
"scheme",
"=",
"scheme",
"||",
"SCHEME",
";",
"return",
"forge",
".",
"util",
".",
"encode64",
"(",
"this",
".",
"_cert",
".",
"publicKey",
".",
"encrypt",
"(",
"data... | Encrypt data using RSA public key inside the X.509 certificate
@param {String} data The data to encrypt
@param {String} [scheme='RSA-OAEP'] The scheme to be used in encryption.
Use 'RSAES-PKCS1-V1_5' in legacy applications.
@return {String} The RSA encryption result in Base64 | [
"Encrypt",
"data",
"using",
"RSA",
"public",
"key",
"inside",
"the",
"X",
".",
"509",
"certificate"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L32413-L32417 | |
56,461 | mgesmundo/authorify-client | build/authorify.js | function (data, scheme) {
scheme = scheme || SCHEME;
return this._key.decrypt(forge.util.decode64(data), scheme);
} | javascript | function (data, scheme) {
scheme = scheme || SCHEME;
return this._key.decrypt(forge.util.decode64(data), scheme);
} | [
"function",
"(",
"data",
",",
"scheme",
")",
"{",
"scheme",
"=",
"scheme",
"||",
"SCHEME",
";",
"return",
"this",
".",
"_key",
".",
"decrypt",
"(",
"forge",
".",
"util",
".",
"decode64",
"(",
"data",
")",
",",
"scheme",
")",
";",
"}"
] | Decrypt RSA encrypted data
@param {String} data The data to decrypt
@param {String} [scheme='RSA-OAEP'] The mode to use in decryption. 'RSA-OAEP', 'RSAES-PKCS1-V1_5' are allowed schemes.
@return {String} The decrypted data | [
"Decrypt",
"RSA",
"encrypted",
"data"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L32424-L32427 | |
56,462 | mgesmundo/authorify-client | build/authorify.js | function (data, secret, encoder, mode) {
// mode = CBC, CFB, OFB, CTR
mode = mode || MODE;
var keyIv = this.getBytesFromSecret(secret);
var cipher = forge.aes.createEncryptionCipher(keyIv, mode);
cipher.start(keyIv);
cipher.update(forge.util.createBuffer(data));
cipher.finish()... | javascript | function (data, secret, encoder, mode) {
// mode = CBC, CFB, OFB, CTR
mode = mode || MODE;
var keyIv = this.getBytesFromSecret(secret);
var cipher = forge.aes.createEncryptionCipher(keyIv, mode);
cipher.start(keyIv);
cipher.update(forge.util.createBuffer(data));
cipher.finish()... | [
"function",
"(",
"data",
",",
"secret",
",",
"encoder",
",",
"mode",
")",
"{",
"// mode = CBC, CFB, OFB, CTR",
"mode",
"=",
"mode",
"||",
"MODE",
";",
"var",
"keyIv",
"=",
"this",
".",
"getBytesFromSecret",
"(",
"secret",
")",
";",
"var",
"cipher",
"=",
... | Encrypt data using AES cipher
@param {String} data The data to encrypt
@param {Bytes} secret The secret to use in encryption
@param {String} [encoder = 'base64'] base64 or url final encoding
@param {String} [mode = 'CTR'] The mode to use in encryption. 'CBC', 'CFB', 'OFB', 'CTR' are allowed modes.
@return {String} The ... | [
"Encrypt",
"data",
"using",
"AES",
"cipher"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L32436-L32448 | |
56,463 | mgesmundo/authorify-client | build/authorify.js | function (data, secret, encoder, mode) {
// mode = CBC, CFB, OFB, CTR
mode = mode || MODE;
var keyIv = this.getBytesFromSecret(secret);
var cipher = forge.aes.createDecryptionCipher(keyIv, mode);
cipher.start(keyIv);
var decoded;
if (encoder === 'url') {
decoded = base6... | javascript | function (data, secret, encoder, mode) {
// mode = CBC, CFB, OFB, CTR
mode = mode || MODE;
var keyIv = this.getBytesFromSecret(secret);
var cipher = forge.aes.createDecryptionCipher(keyIv, mode);
cipher.start(keyIv);
var decoded;
if (encoder === 'url') {
decoded = base6... | [
"function",
"(",
"data",
",",
"secret",
",",
"encoder",
",",
"mode",
")",
"{",
"// mode = CBC, CFB, OFB, CTR",
"mode",
"=",
"mode",
"||",
"MODE",
";",
"var",
"keyIv",
"=",
"this",
".",
"getBytesFromSecret",
"(",
"secret",
")",
";",
"var",
"cipher",
"=",
... | Decrypt AES encrypted data
@param {String} data The data to decrypt
@param {String} secret The secret to use in decryption in Base64 format
@param {String} [encoder = 'base64'] base64 or url encoding
@param {String} [mode='CTR'] The mode to use in decryption. 'CBC', 'CFB', 'OFB', 'CTR' are allowed modes.
@return {Strin... | [
"Decrypt",
"AES",
"encrypted",
"data"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L32457-L32472 | |
56,464 | mgesmundo/authorify-client | build/authorify.js | function (pem) {
var certificate = forge.pki.certificateFromPem(pem);
var issuerCert = caStore.getIssuer(certificate);
if (issuerCert) {
try {
return issuerCert.verify(certificate);
} catch (e) {
return false;
}
}
return false;
} | javascript | function (pem) {
var certificate = forge.pki.certificateFromPem(pem);
var issuerCert = caStore.getIssuer(certificate);
if (issuerCert) {
try {
return issuerCert.verify(certificate);
} catch (e) {
return false;
}
}
return false;
} | [
"function",
"(",
"pem",
")",
"{",
"var",
"certificate",
"=",
"forge",
".",
"pki",
".",
"certificateFromPem",
"(",
"pem",
")",
";",
"var",
"issuerCert",
"=",
"caStore",
".",
"getIssuer",
"(",
"certificate",
")",
";",
"if",
"(",
"issuerCert",
")",
"{",
"... | Verify that a X.509 certificate is generated by the CA
@param {String} pem The certificate to verify in pem format
@returns {Boolean} True if the X.509 certificate is original | [
"Verify",
"that",
"a",
"X",
".",
"509",
"certificate",
"is",
"generated",
"by",
"the",
"CA"
] | 39fb57db897eaa49b76444ff62bbc0ccedc7ee16 | https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/build/authorify.js#L32503-L32514 | |
56,465 | molecuel/mlcl_collections | index.js | function () {
var self = this;
this.collectionRegistry = {};
// emit molecuel elements pre init event
molecuel.emit('mlcl::collections::init:pre', self);
/**
* Schema directory config
*/
if (molecuel.config.collections && molecuel.config.collections.collectionDir) {
this.collectionDir = molecuel... | javascript | function () {
var self = this;
this.collectionRegistry = {};
// emit molecuel elements pre init event
molecuel.emit('mlcl::collections::init:pre', self);
/**
* Schema directory config
*/
if (molecuel.config.collections && molecuel.config.collections.collectionDir) {
this.collectionDir = molecuel... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"collectionRegistry",
"=",
"{",
"}",
";",
"// emit molecuel elements pre init event",
"molecuel",
".",
"emit",
"(",
"'mlcl::collections::init:pre'",
",",
"self",
")",
";",
"/**\n * Schema d... | This module serves the molecuel elements the type definition for database objects
@todo implement the dynamic generation of elements
@constructor | [
"This",
"module",
"serves",
"the",
"molecuel",
"elements",
"the",
"type",
"definition",
"for",
"database",
"objects"
] | 4b3160b1af1632ff3121ad5a1da2b3c70beb2466 | https://github.com/molecuel/mlcl_collections/blob/4b3160b1af1632ff3121ad5a1da2b3c70beb2466/index.js#L18-L50 | |
56,466 | gummesson/ez-map | index.js | EzMap | function EzMap(arr) {
this._keys = []
this._values = []
if (isArray(arr) && arr.length)
this._initial(arr)
} | javascript | function EzMap(arr) {
this._keys = []
this._values = []
if (isArray(arr) && arr.length)
this._initial(arr)
} | [
"function",
"EzMap",
"(",
"arr",
")",
"{",
"this",
".",
"_keys",
"=",
"[",
"]",
"this",
".",
"_values",
"=",
"[",
"]",
"if",
"(",
"isArray",
"(",
"arr",
")",
"&&",
"arr",
".",
"length",
")",
"this",
".",
"_initial",
"(",
"arr",
")",
"}"
] | Initialize `EzMap`.
@constructor
@param {array} [arr]
@api public | [
"Initialize",
"EzMap",
"."
] | 268157f1b78119d2d7e7e14b35e5283f80c0174a | https://github.com/gummesson/ez-map/blob/268157f1b78119d2d7e7e14b35e5283f80c0174a/index.js#L16-L21 |
56,467 | antonycourtney/tabli-core | src/js/tabWindow.js | getOpenTabInfo | function getOpenTabInfo(tabItems, openTabs) {
const chromeOpenTabItems = Immutable.Seq(openTabs.map(makeOpenTabItem));
// console.log("getOpenTabInfo: openTabs: ", openTabs);
// console.log("getOpenTabInfo: chromeOpenTabItems: " + JSON.stringify(chromeOpenTabItems,null,4));
const openUrlMap = Immutable.Map(chr... | javascript | function getOpenTabInfo(tabItems, openTabs) {
const chromeOpenTabItems = Immutable.Seq(openTabs.map(makeOpenTabItem));
// console.log("getOpenTabInfo: openTabs: ", openTabs);
// console.log("getOpenTabInfo: chromeOpenTabItems: " + JSON.stringify(chromeOpenTabItems,null,4));
const openUrlMap = Immutable.Map(chr... | [
"function",
"getOpenTabInfo",
"(",
"tabItems",
",",
"openTabs",
")",
"{",
"const",
"chromeOpenTabItems",
"=",
"Immutable",
".",
"Seq",
"(",
"openTabs",
".",
"map",
"(",
"makeOpenTabItem",
")",
")",
";",
"// console.log(\"getOpenTabInfo: openTabs: \", openTabs);",
"// ... | Gather open tab items and a set of non-open saved tabItems from the given
open tabs and tab items based on URL matching, without regard to
tab ordering. Auxiliary helper function for mergeOpenTabs. | [
"Gather",
"open",
"tab",
"items",
"and",
"a",
"set",
"of",
"non",
"-",
"open",
"saved",
"tabItems",
"from",
"the",
"given",
"open",
"tabs",
"and",
"tab",
"items",
"based",
"on",
"URL",
"matching",
"without",
"regard",
"to",
"tab",
"ordering",
".",
"Auxil... | 76cc540891421bc6c8bdcf00f277ebb6e716fdd9 | https://github.com/antonycourtney/tabli-core/blob/76cc540891421bc6c8bdcf00f277ebb6e716fdd9/src/js/tabWindow.js#L232-L277 |
56,468 | directiv/data-hyper-bind | index.js | hyperBind | function hyperBind(store) {
this.compile = function(input) {
var path = input.split('.');
return {
path: input,
target: path[path.length - 1]
};
};
this.state = function(config, state) {
var res = store.get(config.path, state);
if (!res.completed) return false;
return state.se... | javascript | function hyperBind(store) {
this.compile = function(input) {
var path = input.split('.');
return {
path: input,
target: path[path.length - 1]
};
};
this.state = function(config, state) {
var res = store.get(config.path, state);
if (!res.completed) return false;
return state.se... | [
"function",
"hyperBind",
"(",
"store",
")",
"{",
"this",
".",
"compile",
"=",
"function",
"(",
"input",
")",
"{",
"var",
"path",
"=",
"input",
".",
"split",
"(",
"'.'",
")",
";",
"return",
"{",
"path",
":",
"input",
",",
"target",
":",
"path",
"[",... | Initialize the 'hyper-bind' directive
@param {StoreHyper} store | [
"Initialize",
"the",
"hyper",
"-",
"bind",
"directive"
] | e9d5640f7087a30d90ce2652e9b6713da72f4b7b | https://github.com/directiv/data-hyper-bind/blob/e9d5640f7087a30d90ce2652e9b6713da72f4b7b/index.js#L19-L39 |
56,469 | pgarrison/tweet-matches | lib/get-fields.js | getFields | function getFields(tweet) {
return _.flatten(tweetLikeObjectsToCheck.map(function(tweetLikeName) {
var tweetLike;
if (tweetLikeName === null) {
tweetLike = tweet;
} else {
tweetLike = _.get(tweet, tweetLikeName);
}
if (!tweetLike) return [];
return getFieldsFromTweetLike(tweetLike)... | javascript | function getFields(tweet) {
return _.flatten(tweetLikeObjectsToCheck.map(function(tweetLikeName) {
var tweetLike;
if (tweetLikeName === null) {
tweetLike = tweet;
} else {
tweetLike = _.get(tweet, tweetLikeName);
}
if (!tweetLike) return [];
return getFieldsFromTweetLike(tweetLike)... | [
"function",
"getFields",
"(",
"tweet",
")",
"{",
"return",
"_",
".",
"flatten",
"(",
"tweetLikeObjectsToCheck",
".",
"map",
"(",
"function",
"(",
"tweetLikeName",
")",
"{",
"var",
"tweetLike",
";",
"if",
"(",
"tweetLikeName",
"===",
"null",
")",
"{",
"twee... | Create an array of the strings at the positions in the tweet object specified by the above arrays of field names | [
"Create",
"an",
"array",
"of",
"the",
"strings",
"at",
"the",
"positions",
"in",
"the",
"tweet",
"object",
"specified",
"by",
"the",
"above",
"arrays",
"of",
"field",
"names"
] | e68a59d53b02f65f53edf10b6483dda4196150a2 | https://github.com/pgarrison/tweet-matches/blob/e68a59d53b02f65f53edf10b6483dda4196150a2/lib/get-fields.js#L43-L54 |
56,470 | pgarrison/tweet-matches | lib/get-fields.js | getFieldsFromTweetLike | function getFieldsFromTweetLike(tweetLike) {
var fields = fieldsToCheck.map(function(fieldName) {
return _.get(tweetLike, fieldName);
});
arrayFieldsToCheck.forEach(function(fieldDescription) {
var arr = _.get(tweetLike, fieldDescription.arrayAt);
if (_.isArray(arr)) {
arr.forEach(function(elem... | javascript | function getFieldsFromTweetLike(tweetLike) {
var fields = fieldsToCheck.map(function(fieldName) {
return _.get(tweetLike, fieldName);
});
arrayFieldsToCheck.forEach(function(fieldDescription) {
var arr = _.get(tweetLike, fieldDescription.arrayAt);
if (_.isArray(arr)) {
arr.forEach(function(elem... | [
"function",
"getFieldsFromTweetLike",
"(",
"tweetLike",
")",
"{",
"var",
"fields",
"=",
"fieldsToCheck",
".",
"map",
"(",
"function",
"(",
"fieldName",
")",
"{",
"return",
"_",
".",
"get",
"(",
"tweetLike",
",",
"fieldName",
")",
";",
"}",
")",
";",
"arr... | Takes a tweet or a subobject of tweet and looks for strings in the positions listed in fieldsToCheck and arrayFieldsToCheck | [
"Takes",
"a",
"tweet",
"or",
"a",
"subobject",
"of",
"tweet",
"and",
"looks",
"for",
"strings",
"in",
"the",
"positions",
"listed",
"in",
"fieldsToCheck",
"and",
"arrayFieldsToCheck"
] | e68a59d53b02f65f53edf10b6483dda4196150a2 | https://github.com/pgarrison/tweet-matches/blob/e68a59d53b02f65f53edf10b6483dda4196150a2/lib/get-fields.js#L58-L77 |
56,471 | paukan-org/core | service/index.js | Service | function Service(config, callback) {
ld.bindAll(this);
var eventEmitter = new EventEmitter2({ wildcard: true, delimiter: '.'});
this.cfg = {};
this.network = { local: eventEmitter };
ld.defaults(this.cfg, config, {
// id // required, unique service id [^a-zA-Z0-9_]
... | javascript | function Service(config, callback) {
ld.bindAll(this);
var eventEmitter = new EventEmitter2({ wildcard: true, delimiter: '.'});
this.cfg = {};
this.network = { local: eventEmitter };
ld.defaults(this.cfg, config, {
// id // required, unique service id [^a-zA-Z0-9_]
... | [
"function",
"Service",
"(",
"config",
",",
"callback",
")",
"{",
"ld",
".",
"bindAll",
"(",
"this",
")",
";",
"var",
"eventEmitter",
"=",
"new",
"EventEmitter2",
"(",
"{",
"wildcard",
":",
"true",
",",
"delimiter",
":",
"'.'",
"}",
")",
";",
"this",
... | required fields for device
Service - interaction interface between automated network and end devices.
Provice necessary functional and act as router.
@param {object} config configuration parameters for service initialisation
@param {function} callback if not set - only class will be instances | [
"required",
"fields",
"for",
"device",
"Service",
"-",
"interaction",
"interface",
"between",
"automated",
"network",
"and",
"end",
"devices",
".",
"Provice",
"necessary",
"functional",
"and",
"act",
"as",
"router",
"."
] | e6ff0667d50bc9b25ab5678852316e89521942ad | https://github.com/paukan-org/core/blob/e6ff0667d50bc9b25ab5678852316e89521942ad/service/index.js#L18-L48 |
56,472 | paukan-org/core | service/index.js | exitHandler | function exitHandler(options, err) {
if (err) {
log.error(err.stack);
}
if (options.exit) {
process.exit();
}
if(network) {
network.emit('state.'+id+'.service.offline');
}
} | javascript | function exitHandler(options, err) {
if (err) {
log.error(err.stack);
}
if (options.exit) {
process.exit();
}
if(network) {
network.emit('state.'+id+'.service.offline');
}
} | [
"function",
"exitHandler",
"(",
"options",
",",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"log",
".",
"error",
"(",
"err",
".",
"stack",
")",
";",
"}",
"if",
"(",
"options",
".",
"exit",
")",
"{",
"process",
".",
"exit",
"(",
")",
";",
"}",
... | so the program will not close instantly | [
"so",
"the",
"program",
"will",
"not",
"close",
"instantly"
] | e6ff0667d50bc9b25ab5678852316e89521942ad | https://github.com/paukan-org/core/blob/e6ff0667d50bc9b25ab5678852316e89521942ad/service/index.js#L487-L498 |
56,473 | altshift/altshift | lib/altshift/cli/style.js | applyStyle | function applyStyle(str, property, value) {
var styleDefinition = CONSOLE_STYLES[property][value];
//No style defined return non modified string
if (styleDefinition === null) {
return str;
}
return ESCAPE + '[' + styleDefinition[0] + 'm' + str + ESCAPE + '[' + styleDefinition[1] + 'm';
} | javascript | function applyStyle(str, property, value) {
var styleDefinition = CONSOLE_STYLES[property][value];
//No style defined return non modified string
if (styleDefinition === null) {
return str;
}
return ESCAPE + '[' + styleDefinition[0] + 'm' + str + ESCAPE + '[' + styleDefinition[1] + 'm';
} | [
"function",
"applyStyle",
"(",
"str",
",",
"property",
",",
"value",
")",
"{",
"var",
"styleDefinition",
"=",
"CONSOLE_STYLES",
"[",
"property",
"]",
"[",
"value",
"]",
";",
"//No style defined return non modified string",
"if",
"(",
"styleDefinition",
"===",
"nul... | Apply one single style on str
@param {string} str
@param {string} property
@param {string} value
@return {string} | [
"Apply",
"one",
"single",
"style",
"on",
"str"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/cli/style.js#L70-L79 |
56,474 | altshift/altshift | lib/altshift/cli/style.js | applyStyles | function applyStyles(str, style) {
//Check if not style
if (! style) {
return str;
}
//Check shortcut if string is empty
//str = '' + str;
if (!str || str.length === 0) {
return str;
}
var output, i, rule, textdecoration;
//style = style || {};
output = str;
... | javascript | function applyStyles(str, style) {
//Check if not style
if (! style) {
return str;
}
//Check shortcut if string is empty
//str = '' + str;
if (!str || str.length === 0) {
return str;
}
var output, i, rule, textdecoration;
//style = style || {};
output = str;
... | [
"function",
"applyStyles",
"(",
"str",
",",
"style",
")",
"{",
"//Check if not style",
"if",
"(",
"!",
"style",
")",
"{",
"return",
"str",
";",
"}",
"//Check shortcut if string is empty",
"//str = '' + str;",
"if",
"(",
"!",
"str",
"||",
"str",
".",
"length",
... | Return a formatted str
@param {string} str
@param {Object} style
- font-weight : normal|bold
- font-style : normal|italic
- background-color : transparent|black|red|green|yellow|blue|magenta|cyan|white
- color : default|black|red|green|yellow|blue|magenta|cyan|white
- text-decoration : [underline|blink|reverse|invisib... | [
"Return",
"a",
"formatted",
"str"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/cli/style.js#L94-L147 |
56,475 | robertblackwell/yake | src/yake/yakefile.js | recursiveFindFile | function recursiveFindFile(aDirectory, arrayOfFileNames)
{
if (debug) debugLog(`recursiveFindFile dir: ${aDirectory}, filenames: ${util.inspect(arrayOfFileNames)}`);
// var directory = process.cwd();
let directory = aDirectory;
const tmp = directoryHasFile(directory, arrayOfFileNames);
if ((tmp ==... | javascript | function recursiveFindFile(aDirectory, arrayOfFileNames)
{
if (debug) debugLog(`recursiveFindFile dir: ${aDirectory}, filenames: ${util.inspect(arrayOfFileNames)}`);
// var directory = process.cwd();
let directory = aDirectory;
const tmp = directoryHasFile(directory, arrayOfFileNames);
if ((tmp ==... | [
"function",
"recursiveFindFile",
"(",
"aDirectory",
",",
"arrayOfFileNames",
")",
"{",
"if",
"(",
"debug",
")",
"debugLog",
"(",
"`",
"${",
"aDirectory",
"}",
"${",
"util",
".",
"inspect",
"(",
"arrayOfFileNames",
")",
"}",
"`",
")",
";",
"// var directory =... | Search upwards from and including aDirectory to find one of the files named in arrayOfFiles
returns the full path of the file if it exists
@param {string} path to a directory where the search should start
@param {array of strings} arrayOfFileNames The array of file name... | [
"Search",
"upwards",
"from",
"and",
"including",
"aDirectory",
"to",
"find",
"one",
"of",
"the",
"files",
"named",
"in",
"arrayOfFiles",
"returns",
"the",
"full",
"path",
"of",
"the",
"file",
"if",
"it",
"exists"
] | 172b02e29303fb718bac88bbda9b85749c57169c | https://github.com/robertblackwell/yake/blob/172b02e29303fb718bac88bbda9b85749c57169c/src/yake/yakefile.js#L89-L112 |
56,476 | MaiaVictor/dattata | Vector2.js | angle | function angle(a, b){
var ang = (Math.atan2(b.y, b.x) - Math.atan2(a.y, a.x) + Math.PI*2) % (Math.PI*2);
if (ang > Math.PI) ang -= Math.PI*2;
return ang;
} | javascript | function angle(a, b){
var ang = (Math.atan2(b.y, b.x) - Math.atan2(a.y, a.x) + Math.PI*2) % (Math.PI*2);
if (ang > Math.PI) ang -= Math.PI*2;
return ang;
} | [
"function",
"angle",
"(",
"a",
",",
"b",
")",
"{",
"var",
"ang",
"=",
"(",
"Math",
".",
"atan2",
"(",
"b",
".",
"y",
",",
"b",
".",
"x",
")",
"-",
"Math",
".",
"atan2",
"(",
"a",
".",
"y",
",",
"a",
".",
"x",
")",
"+",
"Math",
".",
"PI"... | V2, V2 -> Number | [
"V2",
"V2",
"-",
">",
"Number"
] | 890d83b89b7193ce8863bb9ac9b296b3510e8db9 | https://github.com/MaiaVictor/dattata/blob/890d83b89b7193ce8863bb9ac9b296b3510e8db9/Vector2.js#L8-L12 |
56,477 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/focusmanager.js | function( noDelay ) {
if ( this._.locked )
return;
function doBlur() {
if ( this.hasFocus ) {
this.hasFocus = false;
var ct = this._.editor.container;
ct && ct.removeClass( 'cke_focus' );
this._.editor.fire( 'blur' );
}
}
if ( this._.timer )
clearTimeout( this._.timer ... | javascript | function( noDelay ) {
if ( this._.locked )
return;
function doBlur() {
if ( this.hasFocus ) {
this.hasFocus = false;
var ct = this._.editor.container;
ct && ct.removeClass( 'cke_focus' );
this._.editor.fire( 'blur' );
}
}
if ( this._.timer )
clearTimeout( this._.timer ... | [
"function",
"(",
"noDelay",
")",
"{",
"if",
"(",
"this",
".",
"_",
".",
"locked",
")",
"return",
";",
"function",
"doBlur",
"(",
")",
"{",
"if",
"(",
"this",
".",
"hasFocus",
")",
"{",
"this",
".",
"hasFocus",
"=",
"false",
";",
"var",
"ct",
"=",... | Used to indicate that the editor instance has been deactivated by the specified
element which has just lost focus.
**Note:** This function acts asynchronously with a delay of 100ms to
avoid temporary deactivation. Use the `noDelay` parameter instead
to deactivate immediately.
var editor = CKEDITOR.instances.editor1;
... | [
"Used",
"to",
"indicate",
"that",
"the",
"editor",
"instance",
"has",
"been",
"deactivated",
"by",
"the",
"specified",
"element",
"which",
"has",
"just",
"lost",
"focus",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/focusmanager.js#L149-L175 | |
56,478 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/focusmanager.js | function( element, isCapture ) {
var fm = element.getCustomData( SLOT_NAME );
if ( !fm || fm != this ) {
// If this element is already taken by another instance, dismiss it first.
fm && fm.remove( element );
var focusEvent = 'focus',
blurEvent = 'blur';
// Bypass the element's internal DOM ... | javascript | function( element, isCapture ) {
var fm = element.getCustomData( SLOT_NAME );
if ( !fm || fm != this ) {
// If this element is already taken by another instance, dismiss it first.
fm && fm.remove( element );
var focusEvent = 'focus',
blurEvent = 'blur';
// Bypass the element's internal DOM ... | [
"function",
"(",
"element",
",",
"isCapture",
")",
"{",
"var",
"fm",
"=",
"element",
".",
"getCustomData",
"(",
"SLOT_NAME",
")",
";",
"if",
"(",
"!",
"fm",
"||",
"fm",
"!=",
"this",
")",
"{",
"// If this element is already taken by another instance, dismiss it ... | Registers a UI DOM element to the focus manager, which will make the focus manager "hasFocus"
once the input focus is relieved on the element.
This method is designed to be used by plugins to expand the jurisdiction of the editor focus.
@param {CKEDITOR.dom.element} element The container (topmost) element of one UI pa... | [
"Registers",
"a",
"UI",
"DOM",
"element",
"to",
"the",
"focus",
"manager",
"which",
"will",
"make",
"the",
"focus",
"manager",
"hasFocus",
"once",
"the",
"input",
"focus",
"is",
"relieved",
"on",
"the",
"element",
".",
"This",
"method",
"is",
"designed",
"... | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/focusmanager.js#L186-L227 | |
56,479 | n1ru4l/ember-cli-postcss-fixed | index.js | PostcssCompiler | function PostcssCompiler(inputTrees, inputFile, outputFile, plugins, map, useSass, includePaths) {
if (!(this instanceof PostcssCompiler)) {
return new PostcssCompiler(inputTrees, inputFile, outputFile, plugins, map);
}
if (!Array.isArray(inputTrees)) {
throw new Error('Expected array for first argument - did y... | javascript | function PostcssCompiler(inputTrees, inputFile, outputFile, plugins, map, useSass, includePaths) {
if (!(this instanceof PostcssCompiler)) {
return new PostcssCompiler(inputTrees, inputFile, outputFile, plugins, map);
}
if (!Array.isArray(inputTrees)) {
throw new Error('Expected array for first argument - did y... | [
"function",
"PostcssCompiler",
"(",
"inputTrees",
",",
"inputFile",
",",
"outputFile",
",",
"plugins",
",",
"map",
",",
"useSass",
",",
"includePaths",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"PostcssCompiler",
")",
")",
"{",
"return",
"new",
... | rip of broccoli-postcss | [
"rip",
"of",
"broccoli",
"-",
"postcss"
] | 7bcceaba60cfbe74e9db8e643e0ccf5ee0293bcc | https://github.com/n1ru4l/ember-cli-postcss-fixed/blob/7bcceaba60cfbe74e9db8e643e0ccf5ee0293bcc/index.js#L17-L35 |
56,480 | jgrund/grunt-coverjs | tasks/cover.js | coverFile | function coverFile(srcFile) {
var srcCode = grunt.file.read(srcFile);
Instrument = require('coverjs').Instrument;
try {
return new Instrument(srcCode, {name: srcFile}).instrument();
} catch (e) {
grunt.log.error('File ' + srcFile + ' could not be instrumented.');
grunt.f... | javascript | function coverFile(srcFile) {
var srcCode = grunt.file.read(srcFile);
Instrument = require('coverjs').Instrument;
try {
return new Instrument(srcCode, {name: srcFile}).instrument();
} catch (e) {
grunt.log.error('File ' + srcFile + ' could not be instrumented.');
grunt.f... | [
"function",
"coverFile",
"(",
"srcFile",
")",
"{",
"var",
"srcCode",
"=",
"grunt",
".",
"file",
".",
"read",
"(",
"srcFile",
")",
";",
"Instrument",
"=",
"require",
"(",
"'coverjs'",
")",
".",
"Instrument",
";",
"try",
"{",
"return",
"new",
"Instrument",... | Instruments the given source file.
@param srcFile
@return {String} Returns the instrumented source file as a string. | [
"Instruments",
"the",
"given",
"source",
"file",
"."
] | 6727af0446848af11ab36eb5a961fe4735ae7064 | https://github.com/jgrund/grunt-coverjs/blob/6727af0446848af11ab36eb5a961fe4735ae7064/tasks/cover.js#L39-L49 |
56,481 | fieosa/webcomponent-mdl | src/utils/custom-element.js | createBaseCustomElementClass | function createBaseCustomElementClass(win) {
if (win.BaseCustomElementClass) {
return win.BaseCustomElementClass;
}
const htmlElement = win.HTMLElement;
/** @abstract @extends {HTMLElement} */
class BaseCustomElement extends htmlElement {
/**
* @see https://github.com/WebReflection/document-regis... | javascript | function createBaseCustomElementClass(win) {
if (win.BaseCustomElementClass) {
return win.BaseCustomElementClass;
}
const htmlElement = win.HTMLElement;
/** @abstract @extends {HTMLElement} */
class BaseCustomElement extends htmlElement {
/**
* @see https://github.com/WebReflection/document-regis... | [
"function",
"createBaseCustomElementClass",
"(",
"win",
")",
"{",
"if",
"(",
"win",
".",
"BaseCustomElementClass",
")",
"{",
"return",
"win",
".",
"BaseCustomElementClass",
";",
"}",
"const",
"htmlElement",
"=",
"win",
".",
"HTMLElement",
";",
"/** @abstract @exte... | Creates a base custom element class.
@param {!Window} win The window in which to register the custom element.
@return {!Function} | [
"Creates",
"a",
"base",
"custom",
"element",
"class",
"."
] | 5aec1bfd5110addcbeedd01ba07b8a01c836c511 | https://github.com/fieosa/webcomponent-mdl/blob/5aec1bfd5110addcbeedd01ba07b8a01c836c511/src/utils/custom-element.js#L7-L67 |
56,482 | jsguy/mithril.component.mdl | lib/polyfills/dialog-polyfill.js | function(backdropZ, dialogZ) {
this.backdrop_.style.zIndex = backdropZ;
this.dialog_.style.zIndex = dialogZ;
} | javascript | function(backdropZ, dialogZ) {
this.backdrop_.style.zIndex = backdropZ;
this.dialog_.style.zIndex = dialogZ;
} | [
"function",
"(",
"backdropZ",
",",
"dialogZ",
")",
"{",
"this",
".",
"backdrop_",
".",
"style",
".",
"zIndex",
"=",
"backdropZ",
";",
"this",
".",
"dialog_",
".",
"style",
".",
"zIndex",
"=",
"dialogZ",
";",
"}"
] | Sets the zIndex for the backdrop and dialog.
@param {number} backdropZ
@param {number} dialogZ | [
"Sets",
"the",
"zIndex",
"for",
"the",
"backdrop",
"and",
"dialog",
"."
] | 89a132fd475e55a98b239a229842661745a53372 | https://github.com/jsguy/mithril.component.mdl/blob/89a132fd475e55a98b239a229842661745a53372/lib/polyfills/dialog-polyfill.js#L168-L171 | |
56,483 | nfantone/mu-koan | lib/server.js | initialize | function initialize(app, options) {
var log = logger.get(options);
app._mukoan = app._mukoan || {};
if (!app._mukoan.initialized) {
var config = defaults({}, options, DEFAULT_CONFIGURATION);
log.info('Starting and configuring Koa server');
// Setup global error handler and logger
app.use(middlewa... | javascript | function initialize(app, options) {
var log = logger.get(options);
app._mukoan = app._mukoan || {};
if (!app._mukoan.initialized) {
var config = defaults({}, options, DEFAULT_CONFIGURATION);
log.info('Starting and configuring Koa server');
// Setup global error handler and logger
app.use(middlewa... | [
"function",
"initialize",
"(",
"app",
",",
"options",
")",
"{",
"var",
"log",
"=",
"logger",
".",
"get",
"(",
"options",
")",
";",
"app",
".",
"_mukoan",
"=",
"app",
".",
"_mukoan",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"app",
".",
"_mukoan",
".",... | Configures top level middlewares and
error logging. This should be called before `bootstrap`.
@param {Object} app A Koa app instance as created by `new Koa()`
@return {Object} The `app` instance with middleware already declared. | [
"Configures",
"top",
"level",
"middlewares",
"and",
"error",
"logging",
".",
"This",
"should",
"be",
"called",
"before",
"bootstrap",
"."
] | 3a5c5eec94509ef73263d8e30d9ef7df54611ece | https://github.com/nfantone/mu-koan/blob/3a5c5eec94509ef73263d8e30d9ef7df54611ece/lib/server.js#L28-L42 |
56,484 | nfantone/mu-koan | lib/server.js | bootstrap | function bootstrap(app, options) {
var config = defaults({}, options, DEFAULT_CONFIGURATION);
var log = logger.get(options);
app._mukoan = app._mukoan || {};
if (!app._mukoan.initialized) {
initialize(app, options);
}
if (!app._mukoan.bootstrapped) {
// Configure and setup middlewares
app.use(... | javascript | function bootstrap(app, options) {
var config = defaults({}, options, DEFAULT_CONFIGURATION);
var log = logger.get(options);
app._mukoan = app._mukoan || {};
if (!app._mukoan.initialized) {
initialize(app, options);
}
if (!app._mukoan.bootstrapped) {
// Configure and setup middlewares
app.use(... | [
"function",
"bootstrap",
"(",
"app",
",",
"options",
")",
"{",
"var",
"config",
"=",
"defaults",
"(",
"{",
"}",
",",
"options",
",",
"DEFAULT_CONFIGURATION",
")",
";",
"var",
"log",
"=",
"logger",
".",
"get",
"(",
"options",
")",
";",
"app",
".",
"_m... | Sets up a Koa app instance.
@param {Object} app A Koa app instance as created by `new Koa()`
@return {Object} The `app` instance with middleware already declared. | [
"Sets",
"up",
"a",
"Koa",
"app",
"instance",
"."
] | 3a5c5eec94509ef73263d8e30d9ef7df54611ece | https://github.com/nfantone/mu-koan/blob/3a5c5eec94509ef73263d8e30d9ef7df54611ece/lib/server.js#L50-L81 |
56,485 | wilmoore/sum.js | sum.js | accessor | function accessor(object) {
var ref = object || (1, eval)('this');
var len = parts.length;
var idx = 0;
// iteratively save each segment's reference
for (; idx < len; idx += 1) {
if (ref) ref = ref[parts[idx]];
}
return ref;
} | javascript | function accessor(object) {
var ref = object || (1, eval)('this');
var len = parts.length;
var idx = 0;
// iteratively save each segment's reference
for (; idx < len; idx += 1) {
if (ref) ref = ref[parts[idx]];
}
return ref;
} | [
"function",
"accessor",
"(",
"object",
")",
"{",
"var",
"ref",
"=",
"object",
"||",
"(",
"1",
",",
"eval",
")",
"(",
"'this'",
")",
";",
"var",
"len",
"=",
"parts",
".",
"length",
";",
"var",
"idx",
"=",
"0",
";",
"// iteratively save each segment's re... | Accessor function that accepts an object to be queried
@private
@param {Object} object
object to access
@return {Mixed}
value at given reference or undefined if it does not exist | [
"Accessor",
"function",
"that",
"accepts",
"an",
"object",
"to",
"be",
"queried"
] | 23630999bf8b2c4d33bb6acef6387f8597ad3a85 | https://github.com/wilmoore/sum.js/blob/23630999bf8b2c4d33bb6acef6387f8597ad3a85/sum.js#L100-L111 |
56,486 | willmark/img-canvas-helper | index.js | function (imgsrc, width, height, callback) {
var args = new Args(arguments);
checkCommonArgs(args);
var Image = Canvas.Image, fs = require("fs");
var img = new Image();
img.onerror = function(err) {
callback(false, err);
};
img.onload = function() {
var w = img.width;
... | javascript | function (imgsrc, width, height, callback) {
var args = new Args(arguments);
checkCommonArgs(args);
var Image = Canvas.Image, fs = require("fs");
var img = new Image();
img.onerror = function(err) {
callback(false, err);
};
img.onload = function() {
var w = img.width;
... | [
"function",
"(",
"imgsrc",
",",
"width",
",",
"height",
",",
"callback",
")",
"{",
"var",
"args",
"=",
"new",
"Args",
"(",
"arguments",
")",
";",
"checkCommonArgs",
"(",
"args",
")",
";",
"var",
"Image",
"=",
"Canvas",
".",
"Image",
",",
"fs",
"=",
... | Crops an image to bounds specified by width and height
imgsrc - string path to image to crop
width - integer width of cropped image
height - integer height of cropped image
callback - callback function(
result - boolean true on success
data - canvas object on success, Error on failure | [
"Crops",
"an",
"image",
"to",
"bounds",
"specified",
"by",
"width",
"and",
"height",
"imgsrc",
"-",
"string",
"path",
"to",
"image",
"to",
"crop",
"width",
"-",
"integer",
"width",
"of",
"cropped",
"image",
"height",
"-",
"integer",
"height",
"of",
"croppe... | d05ec8026eb2a74fd2dc8eec85dae3a3491ecaf1 | https://github.com/willmark/img-canvas-helper/blob/d05ec8026eb2a74fd2dc8eec85dae3a3491ecaf1/index.js#L111-L135 | |
56,487 | mwyatt/dialogue | js/dialogue.js | handleMousedown | function handleMousedown(event) {
// get currently open dialogue
var dialogue = getDialogueCurrent();
if (dialogue.options.hardClose) {
return;
}
var result = helper.isInside(event.target, dialogue.dialogue);
if (!result) {
closeInstance(dialogue);
}
} | javascript | function handleMousedown(event) {
// get currently open dialogue
var dialogue = getDialogueCurrent();
if (dialogue.options.hardClose) {
return;
}
var result = helper.isInside(event.target, dialogue.dialogue);
if (!result) {
closeInstance(dialogue);
}
} | [
"function",
"handleMousedown",
"(",
"event",
")",
"{",
"// get currently open dialogue",
"var",
"dialogue",
"=",
"getDialogueCurrent",
"(",
")",
";",
"if",
"(",
"dialogue",
".",
"options",
".",
"hardClose",
")",
"{",
"return",
";",
"}",
"var",
"result",
"=",
... | clicking anything not inside the most current dialogue | [
"clicking",
"anything",
"not",
"inside",
"the",
"most",
"current",
"dialogue"
] | c3d403262ce44d020438cb1e768556e459a7fd5e | https://github.com/mwyatt/dialogue/blob/c3d403262ce44d020438cb1e768556e459a7fd5e/js/dialogue.js#L152-L165 |
56,488 | mwyatt/dialogue | js/dialogue.js | applyCssPosition | function applyCssPosition(dialogue) {
var positionalEl = dialogue.options.positionTo;
var containerPadding = 20;
var cssSettings = {
top: '',
left: '',
position: '',
margin: '',
marginTop: 0,
marginRight: 0,
marginBottom: 0,
marginLeft: 0,
maxWidth: dialogue.options.width
};
... | javascript | function applyCssPosition(dialogue) {
var positionalEl = dialogue.options.positionTo;
var containerPadding = 20;
var cssSettings = {
top: '',
left: '',
position: '',
margin: '',
marginTop: 0,
marginRight: 0,
marginBottom: 0,
marginLeft: 0,
maxWidth: dialogue.options.width
};
... | [
"function",
"applyCssPosition",
"(",
"dialogue",
")",
"{",
"var",
"positionalEl",
"=",
"dialogue",
".",
"options",
".",
"positionTo",
";",
"var",
"containerPadding",
"=",
"20",
";",
"var",
"cssSettings",
"=",
"{",
"top",
":",
"''",
",",
"left",
":",
"''",
... | apply the css to the dialogue to position correctly | [
"apply",
"the",
"css",
"to",
"the",
"dialogue",
"to",
"position",
"correctly"
] | c3d403262ce44d020438cb1e768556e459a7fd5e | https://github.com/mwyatt/dialogue/blob/c3d403262ce44d020438cb1e768556e459a7fd5e/js/dialogue.js#L213-L281 |
56,489 | mwyatt/dialogue | js/dialogue.js | closeInstance | function closeInstance(dialogue) {
// none may be open yet, or one may be open but may be closing another which is not open
if (typeof dialogue === 'undefined' || typeof dialogue.options === 'undefined' || !dialoguesOpen.length) {
return;
}
dialoguesOpen.forEach(function(dialogueSingle, index) {
if (d... | javascript | function closeInstance(dialogue) {
// none may be open yet, or one may be open but may be closing another which is not open
if (typeof dialogue === 'undefined' || typeof dialogue.options === 'undefined' || !dialoguesOpen.length) {
return;
}
dialoguesOpen.forEach(function(dialogueSingle, index) {
if (d... | [
"function",
"closeInstance",
"(",
"dialogue",
")",
"{",
"// none may be open yet, or one may be open but may be closing another which is not open",
"if",
"(",
"typeof",
"dialogue",
"===",
"'undefined'",
"||",
"typeof",
"dialogue",
".",
"options",
"===",
"'undefined'",
"||",
... | call onclose and remove
@param {object} data
@return {null} | [
"call",
"onclose",
"and",
"remove"
] | c3d403262ce44d020438cb1e768556e459a7fd5e | https://github.com/mwyatt/dialogue/blob/c3d403262ce44d020438cb1e768556e459a7fd5e/js/dialogue.js#L288-L311 |
56,490 | UXFoundry/hashdo | lib/template.js | function (file) {
return Path.join(Path.dirname(Path.relative(hbTemplatePath, file)), Path.basename(file, Path.extname(file)));
} | javascript | function (file) {
return Path.join(Path.dirname(Path.relative(hbTemplatePath, file)), Path.basename(file, Path.extname(file)));
} | [
"function",
"(",
"file",
")",
"{",
"return",
"Path",
".",
"join",
"(",
"Path",
".",
"dirname",
"(",
"Path",
".",
"relative",
"(",
"hbTemplatePath",
",",
"file",
")",
")",
",",
"Path",
".",
"basename",
"(",
"file",
",",
"Path",
".",
"extname",
"(",
... | Consolidate needs partial paths relative to the main tempalte being rendered and without the extension. | [
"Consolidate",
"needs",
"partial",
"paths",
"relative",
"to",
"the",
"main",
"tempalte",
"being",
"rendered",
"and",
"without",
"the",
"extension",
"."
] | c2a0adcba0cca26d6ebe56bba17017b177609057 | https://github.com/UXFoundry/hashdo/blob/c2a0adcba0cca26d6ebe56bba17017b177609057/lib/template.js#L50-L52 | |
56,491 | pinyin/outline | vendor/transformation-matrix/scale.js | scale | function scale(sx) {
var sy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
if ((0, _utils.isUndefined)(sy)) sy = sx;
return {
a: sx, c: 0, e: 0,
b: 0, d: sy, f: 0
};
} | javascript | function scale(sx) {
var sy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
if ((0, _utils.isUndefined)(sy)) sy = sx;
return {
a: sx, c: 0, e: 0,
b: 0, d: sy, f: 0
};
} | [
"function",
"scale",
"(",
"sx",
")",
"{",
"var",
"sy",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"undefined",
";",
"if",
"(",
"(",
"0",
",",
"_utils",
".... | Calculate a scaling matrix
@param sx Scaling on axis x
@param [sy = sx] Scaling on axis y (default sx)
@returns {{a: number, b: number, c: number, e: number, d: number, f: number}} Affine matrix | [
"Calculate",
"a",
"scaling",
"matrix"
] | e49f05d2f8ab384f5b1d71b2b10875cd48d41051 | https://github.com/pinyin/outline/blob/e49f05d2f8ab384f5b1d71b2b10875cd48d41051/vendor/transformation-matrix/scale.js#L16-L24 |
56,492 | switer/sutils | url.js | function (surl) {
var search = (surl || window.location.search).match(/\?.*(?=\b|#)/);
search && (search = search[0].replace(/^\?/, ''));
if (!search) return {};
var queries = {},
params = search.split('&');
util.each(params, function (item) {... | javascript | function (surl) {
var search = (surl || window.location.search).match(/\?.*(?=\b|#)/);
search && (search = search[0].replace(/^\?/, ''));
if (!search) return {};
var queries = {},
params = search.split('&');
util.each(params, function (item) {... | [
"function",
"(",
"surl",
")",
"{",
"var",
"search",
"=",
"(",
"surl",
"||",
"window",
".",
"location",
".",
"search",
")",
".",
"match",
"(",
"/",
"\\?.*(?=\\b|#)",
"/",
")",
";",
"search",
"&&",
"(",
"search",
"=",
"search",
"[",
"0",
"]",
".",
... | params in url of location.search | [
"params",
"in",
"url",
"of",
"location",
".",
"search"
] | 2573c2498e62837da132ada8a2109d42d9f9d0ca | https://github.com/switer/sutils/blob/2573c2498e62837da132ada8a2109d42d9f9d0ca/url.js#L44-L57 | |
56,493 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/skin.js | function( part, fn ) {
if ( CKEDITOR.skin.name != getName() ) {
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( getConfigPath() + 'skin.js' ), function() {
loadCss( part, fn );
} );
} else {
loadCss( part, fn );
}
} | javascript | function( part, fn ) {
if ( CKEDITOR.skin.name != getName() ) {
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( getConfigPath() + 'skin.js' ), function() {
loadCss( part, fn );
} );
} else {
loadCss( part, fn );
}
} | [
"function",
"(",
"part",
",",
"fn",
")",
"{",
"if",
"(",
"CKEDITOR",
".",
"skin",
".",
"name",
"!=",
"getName",
"(",
")",
")",
"{",
"CKEDITOR",
".",
"scriptLoader",
".",
"load",
"(",
"CKEDITOR",
".",
"getUrl",
"(",
"getConfigPath",
"(",
")",
"+",
"... | Loads a skin part into the page. Does nothing if the part has already been loaded.
**Note:** The "editor" part is always auto loaded upon instance creation,
thus this function is mainly used to **lazy load** other parts of the skin
that do not have to be displayed until requested.
// Load the dialog part.
editor.skin... | [
"Loads",
"a",
"skin",
"part",
"into",
"the",
"page",
".",
"Does",
"nothing",
"if",
"the",
"part",
"has",
"already",
"been",
"loaded",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/skin.js#L49-L57 | |
56,494 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/skin.js | function( name, path, offset, bgsize ) {
name = name.toLowerCase();
if ( !this.icons[ name ] ) {
this.icons[ name ] = {
path: path,
offset: offset || 0,
bgsize: bgsize || '16px'
};
}
} | javascript | function( name, path, offset, bgsize ) {
name = name.toLowerCase();
if ( !this.icons[ name ] ) {
this.icons[ name ] = {
path: path,
offset: offset || 0,
bgsize: bgsize || '16px'
};
}
} | [
"function",
"(",
"name",
",",
"path",
",",
"offset",
",",
"bgsize",
")",
"{",
"name",
"=",
"name",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"icons",
"[",
"name",
"]",
")",
"{",
"this",
".",
"icons",
"[",
"name",
"]",
"=",... | Registers an icon.
@param {String} name The icon name.
@param {String} path The path to the icon image file.
@param {Number} [offset] The vertical offset position of the icon, if
available inside a strip image.
@param {String} [bgsize] The value of the CSS "background-size" property to
use for this icon | [
"Registers",
"an",
"icon",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/skin.js#L83-L92 | |
56,495 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/skin.js | function( name, rtl, overridePath, overrideOffset, overrideBgsize ) {
var icon, path, offset, bgsize;
if ( name ) {
name = name.toLowerCase();
// If we're in RTL, try to get the RTL version of the icon.
if ( rtl )
icon = this.icons[ name + '-rtl' ];
// If not in LTR or no RTL version availa... | javascript | function( name, rtl, overridePath, overrideOffset, overrideBgsize ) {
var icon, path, offset, bgsize;
if ( name ) {
name = name.toLowerCase();
// If we're in RTL, try to get the RTL version of the icon.
if ( rtl )
icon = this.icons[ name + '-rtl' ];
// If not in LTR or no RTL version availa... | [
"function",
"(",
"name",
",",
"rtl",
",",
"overridePath",
",",
"overrideOffset",
",",
"overrideBgsize",
")",
"{",
"var",
"icon",
",",
"path",
",",
"offset",
",",
"bgsize",
";",
"if",
"(",
"name",
")",
"{",
"name",
"=",
"name",
".",
"toLowerCase",
"(",
... | Gets the CSS background styles to be used to render a specific icon.
@param {String} name The icon name, as registered with {@link #addIcon}.
@param {Boolean} [rtl] Indicates that the RTL version of the icon is
to be used, if available.
@param {String} [overridePath] The path to the icon image file. It
overrides the p... | [
"Gets",
"the",
"CSS",
"background",
"styles",
"to",
"be",
"used",
"to",
"render",
"a",
"specific",
"icon",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/skin.js#L110-L130 | |
56,496 | adiwidjaja/frontend-pagebuilder | js/tinymce/tinymce.jquery.js | function (LazyValue, Bounce) {
var nu = function (baseFn) {
var get = function(callback) {
baseFn(Bounce.bounce(callback));
};
/** map :: this Future a -> (a -> b) -> Future b */
var map = function (fab) {
return nu(function (callback) {
get(function (a) {
... | javascript | function (LazyValue, Bounce) {
var nu = function (baseFn) {
var get = function(callback) {
baseFn(Bounce.bounce(callback));
};
/** map :: this Future a -> (a -> b) -> Future b */
var map = function (fab) {
return nu(function (callback) {
get(function (a) {
... | [
"function",
"(",
"LazyValue",
",",
"Bounce",
")",
"{",
"var",
"nu",
"=",
"function",
"(",
"baseFn",
")",
"{",
"var",
"get",
"=",
"function",
"(",
"callback",
")",
"{",
"baseFn",
"(",
"Bounce",
".",
"bounce",
"(",
"callback",
")",
")",
";",
"}",
";"... | A future value that is evaluated on demand. The base function is re-evaluated each time 'get' is called. | [
"A",
"future",
"value",
"that",
"is",
"evaluated",
"on",
"demand",
".",
"The",
"base",
"function",
"is",
"re",
"-",
"evaluated",
"each",
"time",
"get",
"is",
"called",
"."
] | a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f | https://github.com/adiwidjaja/frontend-pagebuilder/blob/a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f/js/tinymce/tinymce.jquery.js#L7181-L7242 | |
56,497 | adiwidjaja/frontend-pagebuilder | js/tinymce/tinymce.jquery.js | function (elm, rootElm) {
var self = this, x = 0, y = 0, offsetParent, doc = self.doc, body = doc.body, pos;
elm = self.get(elm);
rootElm = rootElm || body;
if (elm) {
// Use getBoundingClientRect if it exists since it's faster than looping offset nodes
// Fallback ... | javascript | function (elm, rootElm) {
var self = this, x = 0, y = 0, offsetParent, doc = self.doc, body = doc.body, pos;
elm = self.get(elm);
rootElm = rootElm || body;
if (elm) {
// Use getBoundingClientRect if it exists since it's faster than looping offset nodes
// Fallback ... | [
"function",
"(",
"elm",
",",
"rootElm",
")",
"{",
"var",
"self",
"=",
"this",
",",
"x",
"=",
"0",
",",
"y",
"=",
"0",
",",
"offsetParent",
",",
"doc",
"=",
"self",
".",
"doc",
",",
"body",
"=",
"doc",
".",
"body",
",",
"pos",
";",
"elm",
"=",... | Returns the absolute x, y position of a node. The position will be returned in an object with x, y fields.
@method getPos
@param {Element/String} elm HTML element or element id to get x, y position from.
@param {Element} rootElm Optional root element to stop calculations at.
@return {object} Absolute position of the s... | [
"Returns",
"the",
"absolute",
"x",
"y",
"position",
"of",
"a",
"node",
".",
"The",
"position",
"will",
"be",
"returned",
"in",
"an",
"object",
"with",
"x",
"y",
"fields",
"."
] | a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f | https://github.com/adiwidjaja/frontend-pagebuilder/blob/a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f/js/tinymce/tinymce.jquery.js#L10391-L10428 | |
56,498 | adiwidjaja/frontend-pagebuilder | js/tinymce/tinymce.jquery.js | function (element) {
var el = element.dom();
var defaultView = el.ownerDocument.defaultView;
return Element.fromDom(defaultView);
} | javascript | function (element) {
var el = element.dom();
var defaultView = el.ownerDocument.defaultView;
return Element.fromDom(defaultView);
} | [
"function",
"(",
"element",
")",
"{",
"var",
"el",
"=",
"element",
".",
"dom",
"(",
")",
";",
"var",
"defaultView",
"=",
"el",
".",
"ownerDocument",
".",
"defaultView",
";",
"return",
"Element",
".",
"fromDom",
"(",
"defaultView",
")",
";",
"}"
] | The window element associated with the element | [
"The",
"window",
"element",
"associated",
"with",
"the",
"element"
] | a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f | https://github.com/adiwidjaja/frontend-pagebuilder/blob/a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f/js/tinymce/tinymce.jquery.js#L16094-L16098 | |
56,499 | adiwidjaja/frontend-pagebuilder | js/tinymce/tinymce.jquery.js | function (dom, selection) {
var caretContainer;
caretContainer = getParentCaretContainer(selection.getStart());
if (caretContainer && !dom.isEmpty(caretContainer)) {
Tools.walk(caretContainer, function (node) {
if (node.nodeType === 1 && node.id !== CARET_ID && !dom.isEmpty(node)) {... | javascript | function (dom, selection) {
var caretContainer;
caretContainer = getParentCaretContainer(selection.getStart());
if (caretContainer && !dom.isEmpty(caretContainer)) {
Tools.walk(caretContainer, function (node) {
if (node.nodeType === 1 && node.id !== CARET_ID && !dom.isEmpty(node)) {... | [
"function",
"(",
"dom",
",",
"selection",
")",
"{",
"var",
"caretContainer",
";",
"caretContainer",
"=",
"getParentCaretContainer",
"(",
"selection",
".",
"getStart",
"(",
")",
")",
";",
"if",
"(",
"caretContainer",
"&&",
"!",
"dom",
".",
"isEmpty",
"(",
"... | Checks if the parent caret container node isn't empty if that is the case it will remove the bogus state on all children that isn't empty | [
"Checks",
"if",
"the",
"parent",
"caret",
"container",
"node",
"isn",
"t",
"empty",
"if",
"that",
"is",
"the",
"case",
"it",
"will",
"remove",
"the",
"bogus",
"state",
"on",
"all",
"children",
"that",
"isn",
"t",
"empty"
] | a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f | https://github.com/adiwidjaja/frontend-pagebuilder/blob/a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f/js/tinymce/tinymce.jquery.js#L17568-L17579 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.