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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,400 | glennjones/elsewhere-profiles | lib/page.js | function(callback){
var options = this.options,
cache = this.options.cache,
logger = this.options.logger;
if(this.apiInterface){
logger.info('fetch data from api: ' + this.apiInterface.name);
var sgn = this.profile.identity.sgn || '',
self = this;
try
... | javascript | function(callback){
var options = this.options,
cache = this.options.cache,
logger = this.options.logger;
if(this.apiInterface){
logger.info('fetch data from api: ' + this.apiInterface.name);
var sgn = this.profile.identity.sgn || '',
self = this;
try
... | [
"function",
"(",
"callback",
")",
"{",
"var",
"options",
"=",
"this",
".",
"options",
",",
"cache",
"=",
"this",
".",
"options",
".",
"cache",
",",
"logger",
"=",
"this",
".",
"options",
".",
"logger",
";",
"if",
"(",
"this",
".",
"apiInterface",
")"... | uses plug-in interface to get profile from an api | [
"uses",
"plug",
"-",
"in",
"interface",
"to",
"get",
"profile",
"from",
"an",
"api"
] | f86a5d040d540d4f8ed4f86518b75a0e6c8855ba | https://github.com/glennjones/elsewhere-profiles/blob/f86a5d040d540d4f8ed4f86518b75a0e6c8855ba/lib/page.js#L188-L219 | |
35,401 | claudio-silva/grunt-angular-builder | tasks/middleware/includeRequiredScripts.js | IncludeRequiredScriptsMiddleware | function IncludeRequiredScriptsMiddleware (context)
{
var path = require ('path');
/**
* Paths of the required scripts.
* @type {string[]}
*/
var paths = [];
/**
* File content of the required scripts.
* @type {string[]}
*/
var sources = [];
/**
* Map of required script paths, as the... | javascript | function IncludeRequiredScriptsMiddleware (context)
{
var path = require ('path');
/**
* Paths of the required scripts.
* @type {string[]}
*/
var paths = [];
/**
* File content of the required scripts.
* @type {string[]}
*/
var sources = [];
/**
* Map of required script paths, as the... | [
"function",
"IncludeRequiredScriptsMiddleware",
"(",
"context",
")",
"{",
"var",
"path",
"=",
"require",
"(",
"'path'",
")",
";",
"/**\n * Paths of the required scripts.\n * @type {string[]}\n */",
"var",
"paths",
"=",
"[",
"]",
";",
"/**\n * File content of the req... | Exports to the context the paths of all extra scripts required explicitly by build-directives,
in the order defined by the modules' dependency graph.
@constructor
@implements {MiddlewareInterface}
@param {Context} context The execution context for the middleware stack. | [
"Exports",
"to",
"the",
"context",
"the",
"paths",
"of",
"all",
"extra",
"scripts",
"required",
"explicitly",
"by",
"build",
"-",
"directives",
"in",
"the",
"order",
"defined",
"by",
"the",
"modules",
"dependency",
"graph",
"."
] | 0aa4232257e4ae95d0aa9258ff0a91395383d8b7 | https://github.com/claudio-silva/grunt-angular-builder/blob/0aa4232257e4ae95d0aa9258ff0a91395383d8b7/tasks/middleware/includeRequiredScripts.js#L26-L131 |
35,402 | commenthol/markedpp | src/Parser.js | prep | function prep (id) {
id = id.replace(/(?:%20|\+)/g, ' ')
id = self.headingAutoId({ text: id })
return id
} | javascript | function prep (id) {
id = id.replace(/(?:%20|\+)/g, ' ')
id = self.headingAutoId({ text: id })
return id
} | [
"function",
"prep",
"(",
"id",
")",
"{",
"id",
"=",
"id",
".",
"replace",
"(",
"/",
"(?:%20|\\+)",
"/",
"g",
",",
"' '",
")",
"id",
"=",
"self",
".",
"headingAutoId",
"(",
"{",
"text",
":",
"id",
"}",
")",
"return",
"id",
"}"
] | sanitize the id before lookup | [
"sanitize",
"the",
"id",
"before",
"lookup"
] | f72db5aa2c1b858a9d5403c6103f24227d74c611 | https://github.com/commenthol/markedpp/blob/f72db5aa2c1b858a9d5403c6103f24227d74c611/src/Parser.js#L167-L171 |
35,403 | strapi/strapi-generate-upload | files/api/upload/controllers/Upload.js | function (fieldname, file, filename) {
const acceptedExtensions = strapi.api.upload.config.acceptedExtensions || [];
if (acceptedExtensions[0] !== '*' && !_.contains(acceptedExtensions, path.extname(filename))) {
this.status = 400;
this.body = {
message: 'Invali... | javascript | function (fieldname, file, filename) {
const acceptedExtensions = strapi.api.upload.config.acceptedExtensions || [];
if (acceptedExtensions[0] !== '*' && !_.contains(acceptedExtensions, path.extname(filename))) {
this.status = 400;
this.body = {
message: 'Invali... | [
"function",
"(",
"fieldname",
",",
"file",
",",
"filename",
")",
"{",
"const",
"acceptedExtensions",
"=",
"strapi",
".",
"api",
".",
"upload",
".",
"config",
".",
"acceptedExtensions",
"||",
"[",
"]",
";",
"if",
"(",
"acceptedExtensions",
"[",
"0",
"]",
... | Validation used by `co-busboy`. | [
"Validation",
"used",
"by",
"co",
"-",
"busboy",
"."
] | 52d2202743e3f1b6390b4db5dcb9484f44d2bb85 | https://github.com/strapi/strapi-generate-upload/blob/52d2202743e3f1b6390b4db5dcb9484f44d2bb85/files/api/upload/controllers/Upload.js#L32-L40 | |
35,404 | koa-modules/methodoverride | index.js | createHeaderGetter | function createHeaderGetter(str) {
var header = str.toLowerCase()
return headerGetter
function headerGetter(req, res) {
// set appropriate Vary header
res.vary(str)
// multiple headers get joined with comma by node.js core
return (req.headers[header] || '').split(/ *, */)
}
} | javascript | function createHeaderGetter(str) {
var header = str.toLowerCase()
return headerGetter
function headerGetter(req, res) {
// set appropriate Vary header
res.vary(str)
// multiple headers get joined with comma by node.js core
return (req.headers[header] || '').split(/ *, */)
}
} | [
"function",
"createHeaderGetter",
"(",
"str",
")",
"{",
"var",
"header",
"=",
"str",
".",
"toLowerCase",
"(",
")",
"return",
"headerGetter",
"function",
"headerGetter",
"(",
"req",
",",
"res",
")",
"{",
"// set appropriate Vary header",
"res",
".",
"vary",
"("... | Create a getter for the given header name. | [
"Create",
"a",
"getter",
"for",
"the",
"given",
"header",
"name",
"."
] | b1ca34955b6243655dd979c106544d15051d3093 | https://github.com/koa-modules/methodoverride/blob/b1ca34955b6243655dd979c106544d15051d3093/index.js#L114-L126 |
35,405 | danielstjules/pattern-emitter | lib/patternEmitter.js | PatternEmitter | function PatternEmitter() {
EventEmitter.call(this);
this.event = '';
this._regexesCount = 0;
this._events = this._events || {};
this._patternEvents = this._patternEvents || {};
this._regexes = this._regexes || {};
} | javascript | function PatternEmitter() {
EventEmitter.call(this);
this.event = '';
this._regexesCount = 0;
this._events = this._events || {};
this._patternEvents = this._patternEvents || {};
this._regexes = this._regexes || {};
} | [
"function",
"PatternEmitter",
"(",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"event",
"=",
"''",
";",
"this",
".",
"_regexesCount",
"=",
"0",
";",
"this",
".",
"_events",
"=",
"this",
".",
"_events",
"||",
"{",
"}",
... | Creates a new PatternEmitter, which extends EventEmitter. In addition to
EventEmitter's prototype, it allows listeners to register to events matching
a RegExp.
@constructor
@extends EventEmitter
@property {*} event The type of the last emitted event | [
"Creates",
"a",
"new",
"PatternEmitter",
"which",
"extends",
"EventEmitter",
".",
"In",
"addition",
"to",
"EventEmitter",
"s",
"prototype",
"it",
"allows",
"listeners",
"to",
"register",
"to",
"events",
"matching",
"a",
"RegExp",
"."
] | 93f76146b414a16864ce340e40ad9f18505ecebf | https://github.com/danielstjules/pattern-emitter/blob/93f76146b414a16864ce340e40ad9f18505ecebf/lib/patternEmitter.js#L16-L25 |
35,406 | bmeck/understudy | index.js | iterate | function iterate(self, interceptors, args, after) {
if (!interceptors || !interceptors.length) {
after.apply(self, args);
return;
}
var i = 0;
var len = interceptors.length;
if (!len) {
after.apply(self, args);
return;
}
function nextIntercepto... | javascript | function iterate(self, interceptors, args, after) {
if (!interceptors || !interceptors.length) {
after.apply(self, args);
return;
}
var i = 0;
var len = interceptors.length;
if (!len) {
after.apply(self, args);
return;
}
function nextIntercepto... | [
"function",
"iterate",
"(",
"self",
",",
"interceptors",
",",
"args",
",",
"after",
")",
"{",
"if",
"(",
"!",
"interceptors",
"||",
"!",
"interceptors",
".",
"length",
")",
"{",
"after",
".",
"apply",
"(",
"self",
",",
"args",
")",
";",
"return",
";"... | This is called in multiple temporal localities, put into a function instead of inline minor speed loss for more maintainability | [
"This",
"is",
"called",
"in",
"multiple",
"temporal",
"localities",
"put",
"into",
"a",
"function",
"instead",
"of",
"inline",
"minor",
"speed",
"loss",
"for",
"more",
"maintainability"
] | 1f77aca180f7ce9736d7c75cad5594df86f921d7 | https://github.com/bmeck/understudy/blob/1f77aca180f7ce9736d7c75cad5594df86f921d7/index.js#L71-L108 |
35,407 | flux-capacitor/flux-capacitor | packages/flux-capacitor-sequelize/lib/createTransaction.js | createTransaction | function createTransaction (database, sequelizeTransaction) {
const transaction = Object.assign(sequelizeTransaction, {
getImplementation () {
return sequelizeTransaction
},
perform (changeset) {
return database.applyChangeset(changeset, { transaction })
}
})
return transaction
} | javascript | function createTransaction (database, sequelizeTransaction) {
const transaction = Object.assign(sequelizeTransaction, {
getImplementation () {
return sequelizeTransaction
},
perform (changeset) {
return database.applyChangeset(changeset, { transaction })
}
})
return transaction
} | [
"function",
"createTransaction",
"(",
"database",
",",
"sequelizeTransaction",
")",
"{",
"const",
"transaction",
"=",
"Object",
".",
"assign",
"(",
"sequelizeTransaction",
",",
"{",
"getImplementation",
"(",
")",
"{",
"return",
"sequelizeTransaction",
"}",
",",
"p... | Extends sequelize transaction.
@param {Database} database
@param {Sequelize.Transaction} sequelizeTransaction
@return {Transaction} | [
"Extends",
"sequelize",
"transaction",
"."
] | 66393138ecdff9c1ba81d88b53144220e593584f | https://github.com/flux-capacitor/flux-capacitor/blob/66393138ecdff9c1ba81d88b53144220e593584f/packages/flux-capacitor-sequelize/lib/createTransaction.js#L10-L21 |
35,408 | NetEase/pomelo-loader | lib/loader.js | function(fn, suffix) {
if(suffix.charAt(0) !== '.') {
suffix = '.' + suffix;
}
if(fn.length <= suffix.length) {
return false;
}
var str = fn.substring(fn.length - suffix.length).toLowerCase();
suffix = suffix.toLowerCase();
return str === suffix;
} | javascript | function(fn, suffix) {
if(suffix.charAt(0) !== '.') {
suffix = '.' + suffix;
}
if(fn.length <= suffix.length) {
return false;
}
var str = fn.substring(fn.length - suffix.length).toLowerCase();
suffix = suffix.toLowerCase();
return str === suffix;
} | [
"function",
"(",
"fn",
",",
"suffix",
")",
"{",
"if",
"(",
"suffix",
".",
"charAt",
"(",
"0",
")",
"!==",
"'.'",
")",
"{",
"suffix",
"=",
"'.'",
"+",
"suffix",
";",
"}",
"if",
"(",
"fn",
".",
"length",
"<=",
"suffix",
".",
"length",
")",
"{",
... | Check file suffix
@param fn {String} file name
@param suffix {String} suffix string, such as .js, etc. | [
"Check",
"file",
"suffix"
] | 3036711de323f6a5350c2bf634b0a69b110de458 | https://github.com/NetEase/pomelo-loader/blob/3036711de323f6a5350c2bf634b0a69b110de458/lib/loader.js#L98-L110 | |
35,409 | flux-capacitor/flux-capacitor | packages/flux-capacitor/lib/combineReducers.js | combineReducers | function combineReducers (reducers) {
const databaseReducers = Object.keys(reducers)
.map((collectionName) => {
const reducer = reducers[ collectionName ]
return createDatabaseReducer(reducer, collectionName)
})
return (database, event) => {
const changesets = databaseReducers.map((reducer)... | javascript | function combineReducers (reducers) {
const databaseReducers = Object.keys(reducers)
.map((collectionName) => {
const reducer = reducers[ collectionName ]
return createDatabaseReducer(reducer, collectionName)
})
return (database, event) => {
const changesets = databaseReducers.map((reducer)... | [
"function",
"combineReducers",
"(",
"reducers",
")",
"{",
"const",
"databaseReducers",
"=",
"Object",
".",
"keys",
"(",
"reducers",
")",
".",
"map",
"(",
"(",
"collectionName",
")",
"=>",
"{",
"const",
"reducer",
"=",
"reducers",
"[",
"collectionName",
"]",
... | Will combine multiple collection reducers to one database reducer.
Takes an object whose keys are collection names and whose values are
reducer functions.
The input reducers have the signature `(Collection, Event) => Changeset`,
the resulting combined reducer is `(Database, Event) => Changeset`.
@param {object} reduc... | [
"Will",
"combine",
"multiple",
"collection",
"reducers",
"to",
"one",
"database",
"reducer",
".",
"Takes",
"an",
"object",
"whose",
"keys",
"are",
"collection",
"names",
"and",
"whose",
"values",
"are",
"reducer",
"functions",
"."
] | 66393138ecdff9c1ba81d88b53144220e593584f | https://github.com/flux-capacitor/flux-capacitor/blob/66393138ecdff9c1ba81d88b53144220e593584f/packages/flux-capacitor/lib/combineReducers.js#L18-L29 |
35,410 | flux-capacitor/flux-capacitor | packages/flux-capacitor/lib/combineReducers.js | createDatabaseReducer | function createDatabaseReducer (collectionReducer, collectionName) {
return (database, event) => {
const collection = database.collections[ collectionName ]
if (!collection) {
throw new Error(`Collection '${collectionName}' not known by database instance.`)
}
return collectionReducer(collectio... | javascript | function createDatabaseReducer (collectionReducer, collectionName) {
return (database, event) => {
const collection = database.collections[ collectionName ]
if (!collection) {
throw new Error(`Collection '${collectionName}' not known by database instance.`)
}
return collectionReducer(collectio... | [
"function",
"createDatabaseReducer",
"(",
"collectionReducer",
",",
"collectionName",
")",
"{",
"return",
"(",
"database",
",",
"event",
")",
"=>",
"{",
"const",
"collection",
"=",
"database",
".",
"collections",
"[",
"collectionName",
"]",
"if",
"(",
"!",
"co... | Takes a collection reducer and turns it into a database reducer by binding it
to one of the database's collections.
@param {Function} collectionReducer (Collection, Event) => Changeset
@param {string} collectionName
@return {Function} (Database, Event) => Changeset | [
"Takes",
"a",
"collection",
"reducer",
"and",
"turns",
"it",
"into",
"a",
"database",
"reducer",
"by",
"binding",
"it",
"to",
"one",
"of",
"the",
"database",
"s",
"collections",
"."
] | 66393138ecdff9c1ba81d88b53144220e593584f | https://github.com/flux-capacitor/flux-capacitor/blob/66393138ecdff9c1ba81d88b53144220e593584f/packages/flux-capacitor/lib/combineReducers.js#L39-L49 |
35,411 | igorski/zCanvas | dist/es5/Loader.js | isReady | function isReady(aImage) {
// first check : load status
if (typeof aImage.complete === "boolean" && !aImage.complete) return false;
// second check : validity of source (can be 0 until bitmap has been fully parsed by browser)
return !(typeof aImage.naturalWidth !== "undefined" && aImag... | javascript | function isReady(aImage) {
// first check : load status
if (typeof aImage.complete === "boolean" && !aImage.complete) return false;
// second check : validity of source (can be 0 until bitmap has been fully parsed by browser)
return !(typeof aImage.naturalWidth !== "undefined" && aImag... | [
"function",
"isReady",
"(",
"aImage",
")",
"{",
"// first check : load status",
"if",
"(",
"typeof",
"aImage",
".",
"complete",
"===",
"\"boolean\"",
"&&",
"!",
"aImage",
".",
"complete",
")",
"return",
"false",
";",
"// second check : validity of source (can be 0 unt... | a quick query to check whether the Image is ready for rendering
@public
@param {Image} aImage
@return {boolean} | [
"a",
"quick",
"query",
"to",
"check",
"whether",
"the",
"Image",
"is",
"ready",
"for",
"rendering"
] | 8b5cd8e195178a80a9bc4ace7ea0b94dfe6b3f82 | https://github.com/igorski/zCanvas/blob/8b5cd8e195178a80a9bc4ace7ea0b94dfe6b3f82/dist/es5/Loader.js#L123-L130 |
35,412 | igorski/zCanvas | dist/es5/Loader.js | onReady | function onReady(aImage, aCallback, aErrorCallback) {
// if this didn't resolve in a full second, we presume the Image is corrupt
var MAX_ITERATIONS = 60;
var iterations = 0;
function readyCheck() {
if (Loader.isReady(aImage)) {
aCallback();
} ... | javascript | function onReady(aImage, aCallback, aErrorCallback) {
// if this didn't resolve in a full second, we presume the Image is corrupt
var MAX_ITERATIONS = 60;
var iterations = 0;
function readyCheck() {
if (Loader.isReady(aImage)) {
aCallback();
} ... | [
"function",
"onReady",
"(",
"aImage",
",",
"aCallback",
",",
"aErrorCallback",
")",
"{",
"// if this didn't resolve in a full second, we presume the Image is corrupt",
"var",
"MAX_ITERATIONS",
"=",
"60",
";",
"var",
"iterations",
"=",
"0",
";",
"function",
"readyCheck",
... | Executes given callback when given Image is actually ready for rendering
If the image was ready when this function was called, execution is synchronous
if not it will be made asynchronous via RAF delegation
@public
@param {Image} aImage
@param {!Function} aCallback
@param {!Function=} aErrorCallback optional callback ... | [
"Executes",
"given",
"callback",
"when",
"given",
"Image",
"is",
"actually",
"ready",
"for",
"rendering",
"If",
"the",
"image",
"was",
"ready",
"when",
"this",
"function",
"was",
"called",
"execution",
"is",
"synchronous",
"if",
"not",
"it",
"will",
"be",
"m... | 8b5cd8e195178a80a9bc4ace7ea0b94dfe6b3f82 | https://github.com/igorski/zCanvas/blob/8b5cd8e195178a80a9bc4ace7ea0b94dfe6b3f82/dist/es5/Loader.js#L143-L166 |
35,413 | scienceai/crossref | source.js | listRequest | function listRequest (path, options = {}, cb) {
if (typeof options === 'function') {
cb = options;
options = {};
}
// serialise options
let opts = [];
for (let k in options) {
// The whole URL *minus* the scheme and "://" (for whatever benighted reason) has to be at most
// 4096 characters lon... | javascript | function listRequest (path, options = {}, cb) {
if (typeof options === 'function') {
cb = options;
options = {};
}
// serialise options
let opts = [];
for (let k in options) {
// The whole URL *minus* the scheme and "://" (for whatever benighted reason) has to be at most
// 4096 characters lon... | [
"function",
"listRequest",
"(",
"path",
",",
"options",
"=",
"{",
"}",
",",
"cb",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"cb",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"// serialise options",
"let",
"... | backend for list requests | [
"backend",
"for",
"list",
"requests"
] | cfda7f2a705663e9bc595a6599329e094f3e3725 | https://github.com/scienceai/crossref/blob/cfda7f2a705663e9bc595a6599329e094f3e3725/source.js#L41-L97 |
35,414 | crysalead-js/string-placeholder | index.js | template | function template(str, data, options) {
var data = data || {};
var options = options || {};
var keys = Array.isArray(data) ? Array.apply(null, { length: data.length }).map(Number.call, Number) : Object.keys(data);
var len = keys.length;
if (!len) {
return str;
}
var before = options.before !== unde... | javascript | function template(str, data, options) {
var data = data || {};
var options = options || {};
var keys = Array.isArray(data) ? Array.apply(null, { length: data.length }).map(Number.call, Number) : Object.keys(data);
var len = keys.length;
if (!len) {
return str;
}
var before = options.before !== unde... | [
"function",
"template",
"(",
"str",
",",
"data",
",",
"options",
")",
"{",
"var",
"data",
"=",
"data",
"||",
"{",
"}",
";",
"var",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"keys",
"=",
"Array",
".",
"isArray",
"(",
"data",
")",
"?",... | Replaces variable placeholders inside a string with any given data. Each key
in `data` corresponds to a variable placeholder name in `str`.
Usage:
{{{
template('My name is ${name} and I am ${age} years old.', { name: 'Bob', age: '65' });
}}}
@param String str A string containing variable place-holders.
@param O... | [
"Replaces",
"variable",
"placeholders",
"inside",
"a",
"string",
"with",
"any",
"given",
"data",
".",
"Each",
"key",
"in",
"data",
"corresponds",
"to",
"a",
"variable",
"placeholder",
"name",
"in",
"str",
"."
] | 73e399bd8ef35ac74118139aa606c00874682e1d | https://github.com/crysalead-js/string-placeholder/blob/73e399bd8ef35ac74118139aa606c00874682e1d/index.js#L28-L61 |
35,415 | flux-capacitor/flux-capacitor | packages/flux-capacitor-boot/src/express/bootstrap.js | bootstrap | function bootstrap (bootstrappers) {
const bootstrapPromise = bootstrappers.reduce(
(metaPromise, bootstrapper) => metaPromise.then((prevMeta) =>
Promise.resolve(bootstrapper(prevMeta)).then((newMeta) => Object.assign({}, prevMeta, newMeta))
),
Promise.resolve({})
).then((meta) => checkIfReadyToBo... | javascript | function bootstrap (bootstrappers) {
const bootstrapPromise = bootstrappers.reduce(
(metaPromise, bootstrapper) => metaPromise.then((prevMeta) =>
Promise.resolve(bootstrapper(prevMeta)).then((newMeta) => Object.assign({}, prevMeta, newMeta))
),
Promise.resolve({})
).then((meta) => checkIfReadyToBo... | [
"function",
"bootstrap",
"(",
"bootstrappers",
")",
"{",
"const",
"bootstrapPromise",
"=",
"bootstrappers",
".",
"reduce",
"(",
"(",
"metaPromise",
",",
"bootstrapper",
")",
"=>",
"metaPromise",
".",
"then",
"(",
"(",
"prevMeta",
")",
"=>",
"Promise",
".",
"... | Takes an array of bootstrapping functions and returns a Promise extended by a
`listen` method.
@param {Function[]} bootstrappers
@return {FluxCapAppPromise} { listen: ([port: int][, hostname: string]) => Promise<Http.Server>, catch: (Error) => Promise, then: (Function) => Promise } | [
"Takes",
"an",
"array",
"of",
"bootstrapping",
"functions",
"and",
"returns",
"a",
"Promise",
"extended",
"by",
"a",
"listen",
"method",
"."
] | 66393138ecdff9c1ba81d88b53144220e593584f | https://github.com/flux-capacitor/flux-capacitor/blob/66393138ecdff9c1ba81d88b53144220e593584f/packages/flux-capacitor-boot/src/express/bootstrap.js#L10-L29 |
35,416 | phulas/x-ray-nightmare | index.js | driver | function driver(options, fn) {
if ('function' == typeof options) fn = options, options = {};
options = options || {};
fn = fn || electron;
var nightmare = new Nightmare(options);
return function nightmare_driver(ctx, done) {
if (ctx !=null) {
debug('goingto %s', ctx.url);
... | javascript | function driver(options, fn) {
if ('function' == typeof options) fn = options, options = {};
options = options || {};
fn = fn || electron;
var nightmare = new Nightmare(options);
return function nightmare_driver(ctx, done) {
if (ctx !=null) {
debug('goingto %s', ctx.url);
... | [
"function",
"driver",
"(",
"options",
",",
"fn",
")",
"{",
"if",
"(",
"'function'",
"==",
"typeof",
"options",
")",
"fn",
"=",
"options",
",",
"options",
"=",
"{",
"}",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"fn",
"=",
"fn",
"||",
"... | Initialize the `driver`
with the following `options`
@param {Object} options
@param {Function} fn
@return {Function}
@api public | [
"Initialize",
"the",
"driver",
"with",
"the",
"following",
"options"
] | d92f39a46e5e126254cdda6de34d39476fa1f6f8 | https://github.com/phulas/x-ray-nightmare/blob/d92f39a46e5e126254cdda6de34d39476fa1f6f8/index.js#L26-L110 |
35,417 | flux-capacitor/flux-capacitor | packages/flux-capacitor/lib/database/combineChangesets.js | combineChangesets | function combineChangesets (changesets) {
const actions = changesets.map((changeset) => changeset.apply)
const combinedAction = function () {
const args = arguments
return actions.reduce((promise, action) => (
promise.then(() => action.apply(null, args))
), Promise.resolve())
}
return creat... | javascript | function combineChangesets (changesets) {
const actions = changesets.map((changeset) => changeset.apply)
const combinedAction = function () {
const args = arguments
return actions.reduce((promise, action) => (
promise.then(() => action.apply(null, args))
), Promise.resolve())
}
return creat... | [
"function",
"combineChangesets",
"(",
"changesets",
")",
"{",
"const",
"actions",
"=",
"changesets",
".",
"map",
"(",
"(",
"changeset",
")",
"=>",
"changeset",
".",
"apply",
")",
"const",
"combinedAction",
"=",
"function",
"(",
")",
"{",
"const",
"args",
"... | Takes an array of changesets and returns a single changeset that contains
all of the input changeset's DB operations.
@param {Changeset[]} changesets
@return {Changeset} | [
"Takes",
"an",
"array",
"of",
"changesets",
"and",
"returns",
"a",
"single",
"changeset",
"that",
"contains",
"all",
"of",
"the",
"input",
"changeset",
"s",
"DB",
"operations",
"."
] | 66393138ecdff9c1ba81d88b53144220e593584f | https://github.com/flux-capacitor/flux-capacitor/blob/66393138ecdff9c1ba81d88b53144220e593584f/packages/flux-capacitor/lib/database/combineChangesets.js#L12-L24 |
35,418 | igorski/zCanvas | src/Loader.js | isDataSource | function isDataSource( image ) {
const source = (typeof image === "string" ? image : image.src).substr(0, 5);
// base 64 string contains data-attribute, the MIME type and then the content, e.g. :
// e.g. "data:image/png;base64," for a typical PNG, Blob string contains no MIME, e.g.:
// blob:http://loc... | javascript | function isDataSource( image ) {
const source = (typeof image === "string" ? image : image.src).substr(0, 5);
// base 64 string contains data-attribute, the MIME type and then the content, e.g. :
// e.g. "data:image/png;base64," for a typical PNG, Blob string contains no MIME, e.g.:
// blob:http://loc... | [
"function",
"isDataSource",
"(",
"image",
")",
"{",
"const",
"source",
"=",
"(",
"typeof",
"image",
"===",
"\"string\"",
"?",
"image",
":",
"image",
".",
"src",
")",
".",
"substr",
"(",
"0",
",",
"5",
")",
";",
"// base 64 string contains data-attribute, the... | checks whether the contents of an Image are either a base64 encoded string
or a Blob
@private
@param {Image|string} image when string, it is the src attribute of an Image
@return {boolean} | [
"checks",
"whether",
"the",
"contents",
"of",
"an",
"Image",
"are",
"either",
"a",
"base64",
"encoded",
"string",
"or",
"a",
"Blob"
] | 8b5cd8e195178a80a9bc4ace7ea0b94dfe6b3f82 | https://github.com/igorski/zCanvas/blob/8b5cd8e195178a80a9bc4ace7ea0b94dfe6b3f82/src/Loader.js#L196-L204 |
35,419 | HarasimowiczKamil/any-base | index.js | anyBase | function anyBase(srcAlphabet, dstAlphabet) {
var converter = new Converter(srcAlphabet, dstAlphabet);
/**
* Convert function
*
* @param {string|Array} number
*
* @return {string|Array} number
*/
return function (number) {
return converter.convert(number);
}
} | javascript | function anyBase(srcAlphabet, dstAlphabet) {
var converter = new Converter(srcAlphabet, dstAlphabet);
/**
* Convert function
*
* @param {string|Array} number
*
* @return {string|Array} number
*/
return function (number) {
return converter.convert(number);
}
} | [
"function",
"anyBase",
"(",
"srcAlphabet",
",",
"dstAlphabet",
")",
"{",
"var",
"converter",
"=",
"new",
"Converter",
"(",
"srcAlphabet",
",",
"dstAlphabet",
")",
";",
"/**\n * Convert function\n *\n * @param {string|Array} number\n *\n * @return {string|Arr... | Function get source and destination alphabet and return convert function
@param {string|Array} srcAlphabet
@param {string|Array} dstAlphabet
@returns {function(number|Array)} | [
"Function",
"get",
"source",
"and",
"destination",
"alphabet",
"and",
"return",
"convert",
"function"
] | 7595a7398959618a93cb4edef0bae3e035eb3ce0 | https://github.com/HarasimowiczKamil/any-base/blob/7595a7398959618a93cb4edef0bae3e035eb3ce0/index.js#L11-L23 |
35,420 | Cloud9Trader/oanda-adapter | lib/utils.js | function (fn, context, rate, warningThreshold) {
var queue = [],
timeout;
function next () {
if (queue.length === 0) {
timeout = null;
return;
}
fn.apply(context, queue.shift());
timeout = setTimeout(next, ... | javascript | function (fn, context, rate, warningThreshold) {
var queue = [],
timeout;
function next () {
if (queue.length === 0) {
timeout = null;
return;
}
fn.apply(context, queue.shift());
timeout = setTimeout(next, ... | [
"function",
"(",
"fn",
",",
"context",
",",
"rate",
",",
"warningThreshold",
")",
"{",
"var",
"queue",
"=",
"[",
"]",
",",
"timeout",
";",
"function",
"next",
"(",
")",
"{",
"if",
"(",
"queue",
".",
"length",
"===",
"0",
")",
"{",
"timeout",
"=",
... | Function wrapper will limit fn invocations to one per rate. All will be queued for delayed execution where limit is exceeded, with warning logged where delay exceeds warningThreshold | [
"Function",
"wrapper",
"will",
"limit",
"fn",
"invocations",
"to",
"one",
"per",
"rate",
".",
"All",
"will",
"be",
"queued",
"for",
"delayed",
"execution",
"where",
"limit",
"is",
"exceeded",
"with",
"warning",
"logged",
"where",
"delay",
"exceeds",
"warningTh... | 33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1 | https://github.com/Cloud9Trader/oanda-adapter/blob/33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1/lib/utils.js#L5-L36 | |
35,421 | piecioshka/super-event-emitter | src/index.js | function (name, fn, ctx) {
assert(isString(name), 'EventEmitter#on: name is not a string');
assert(isFunction(fn), 'EventEmitter#on: fn is not a function');
// If the context is not passed, use `this`.
ctx = ctx || this;
// Push to private lists of listeners.
this._list... | javascript | function (name, fn, ctx) {
assert(isString(name), 'EventEmitter#on: name is not a string');
assert(isFunction(fn), 'EventEmitter#on: fn is not a function');
// If the context is not passed, use `this`.
ctx = ctx || this;
// Push to private lists of listeners.
this._list... | [
"function",
"(",
"name",
",",
"fn",
",",
"ctx",
")",
"{",
"assert",
"(",
"isString",
"(",
"name",
")",
",",
"'EventEmitter#on: name is not a string'",
")",
";",
"assert",
"(",
"isFunction",
"(",
"fn",
")",
",",
"'EventEmitter#on: fn is not a function'",
")",
"... | Register listener on concrete name with specified handler.
@param {string} name
@param {Function} fn
@param {Object} [ctx] | [
"Register",
"listener",
"on",
"concrete",
"name",
"with",
"specified",
"handler",
"."
] | 4115220f468721e0f8249fcbf37091557cbc6e09 | https://github.com/piecioshka/super-event-emitter/blob/4115220f468721e0f8249fcbf37091557cbc6e09/src/index.js#L76-L91 | |
35,422 | piecioshka/super-event-emitter | src/index.js | function (name, fn, ctx) {
// If the context is not passed, use `this`.
ctx = ctx || this;
var self = this;
function onHandler() {
fn.apply(ctx, arguments);
self.off(name, onHandler);
}
this.on(name, onHandler, ctx);
return this;
} | javascript | function (name, fn, ctx) {
// If the context is not passed, use `this`.
ctx = ctx || this;
var self = this;
function onHandler() {
fn.apply(ctx, arguments);
self.off(name, onHandler);
}
this.on(name, onHandler, ctx);
return this;
} | [
"function",
"(",
"name",
",",
"fn",
",",
"ctx",
")",
"{",
"// If the context is not passed, use `this`.",
"ctx",
"=",
"ctx",
"||",
"this",
";",
"var",
"self",
"=",
"this",
";",
"function",
"onHandler",
"(",
")",
"{",
"fn",
".",
"apply",
"(",
"ctx",
",",
... | Register listener.
Remove them after once event triggered.
@param {string} name
@param {Function} fn
@param {Object} [ctx] | [
"Register",
"listener",
".",
"Remove",
"them",
"after",
"once",
"event",
"triggered",
"."
] | 4115220f468721e0f8249fcbf37091557cbc6e09 | https://github.com/piecioshka/super-event-emitter/blob/4115220f468721e0f8249fcbf37091557cbc6e09/src/index.js#L101-L115 | |
35,423 | piecioshka/super-event-emitter | src/index.js | function (name, fn) {
this._listeners = !name
? []
: filter(this._listeners, function (listener) {
if (listener.name !== name) {
return true;
} else {
if (isFunction(fn)) {
return listener.fn ... | javascript | function (name, fn) {
this._listeners = !name
? []
: filter(this._listeners, function (listener) {
if (listener.name !== name) {
return true;
} else {
if (isFunction(fn)) {
return listener.fn ... | [
"function",
"(",
"name",
",",
"fn",
")",
"{",
"this",
".",
"_listeners",
"=",
"!",
"name",
"?",
"[",
"]",
":",
"filter",
"(",
"this",
".",
"_listeners",
",",
"function",
"(",
"listener",
")",
"{",
"if",
"(",
"listener",
".",
"name",
"!==",
"name",
... | Unregister listener.
Remove concrete listener by name and itself definition.
@param {string} [name]
@param {Function} [fn] | [
"Unregister",
"listener",
".",
"Remove",
"concrete",
"listener",
"by",
"name",
"and",
"itself",
"definition",
"."
] | 4115220f468721e0f8249fcbf37091557cbc6e09 | https://github.com/piecioshka/super-event-emitter/blob/4115220f468721e0f8249fcbf37091557cbc6e09/src/index.js#L124-L140 | |
35,424 | piecioshka/super-event-emitter | src/index.js | function (name, params) {
assert(isString(name), 'EventEmitter#emit: name is not a string');
forEach(this._listeners, function (event) {
if (event.name === name) {
event.fn.call(event.ctx, params);
}
// Special behaviour for wildcard - invoke each ev... | javascript | function (name, params) {
assert(isString(name), 'EventEmitter#emit: name is not a string');
forEach(this._listeners, function (event) {
if (event.name === name) {
event.fn.call(event.ctx, params);
}
// Special behaviour for wildcard - invoke each ev... | [
"function",
"(",
"name",
",",
"params",
")",
"{",
"assert",
"(",
"isString",
"(",
"name",
")",
",",
"'EventEmitter#emit: name is not a string'",
")",
";",
"forEach",
"(",
"this",
".",
"_listeners",
",",
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event... | Trigger event.
All of listeners waiting for emit event will be executed.
@param {string} name
@param {Object} [params] | [
"Trigger",
"event",
".",
"All",
"of",
"listeners",
"waiting",
"for",
"emit",
"event",
"will",
"be",
"executed",
"."
] | 4115220f468721e0f8249fcbf37091557cbc6e09 | https://github.com/piecioshka/super-event-emitter/blob/4115220f468721e0f8249fcbf37091557cbc6e09/src/index.js#L149-L166 | |
35,425 | stamoern/wdio-element-screenshot | src/index.js | getElementBoundingRect | function getElementBoundingRect(elementSelector) {
/**
* @param {Window} win
* @param {Object} [dims]
* @returns {Object}
*/
function computeFrameOffset(win, dims) {
// initialize our result variable
dims = dims || {
left: win.pageXOffset,
top: win.pag... | javascript | function getElementBoundingRect(elementSelector) {
/**
* @param {Window} win
* @param {Object} [dims]
* @returns {Object}
*/
function computeFrameOffset(win, dims) {
// initialize our result variable
dims = dims || {
left: win.pageXOffset,
top: win.pag... | [
"function",
"getElementBoundingRect",
"(",
"elementSelector",
")",
"{",
"/**\n * @param {Window} win\n * @param {Object} [dims]\n * @returns {Object}\n */",
"function",
"computeFrameOffset",
"(",
"win",
",",
"dims",
")",
"{",
"// initialize our result variable",
"dims... | Gets the position and size of an element.
This function is run in the browser so its scope must be contained.
@param {String} elementSelector
@returns {Object|undefined} | [
"Gets",
"the",
"position",
"and",
"size",
"of",
"an",
"element",
"."
] | afd26c3aff4c53f739b6381ad289544637aac7ce | https://github.com/stamoern/wdio-element-screenshot/blob/afd26c3aff4c53f739b6381ad289544637aac7ce/src/index.js#L96-L149 |
35,426 | flux-capacitor/flux-capacitor | packages/flux-capacitor-reduxify/src/index.js | reduxifyReducer | function reduxifyReducer (reducer, collectionName = null) {
return (state = [], action) => {
const collection = createReduxifyCollection(state, collectionName)
const changeset = reducer(collection, action)
// the changesets returned by the reduxify collections are just plain synchronous methods
retur... | javascript | function reduxifyReducer (reducer, collectionName = null) {
return (state = [], action) => {
const collection = createReduxifyCollection(state, collectionName)
const changeset = reducer(collection, action)
// the changesets returned by the reduxify collections are just plain synchronous methods
retur... | [
"function",
"reduxifyReducer",
"(",
"reducer",
",",
"collectionName",
"=",
"null",
")",
"{",
"return",
"(",
"state",
"=",
"[",
"]",
",",
"action",
")",
"=>",
"{",
"const",
"collection",
"=",
"createReduxifyCollection",
"(",
"state",
",",
"collectionName",
")... | Takes a rewinddb reducer and turns it into a redux-compatible reducer.
@param {Function} reducer (Collection, Event) => Changeset
@param {string} [collectionName]
@param {Function} (Array<Object>, Action) => Array<Object> | [
"Takes",
"a",
"rewinddb",
"reducer",
"and",
"turns",
"it",
"into",
"a",
"redux",
"-",
"compatible",
"reducer",
"."
] | 66393138ecdff9c1ba81d88b53144220e593584f | https://github.com/flux-capacitor/flux-capacitor/blob/66393138ecdff9c1ba81d88b53144220e593584f/packages/flux-capacitor-reduxify/src/index.js#L12-L31 |
35,427 | GitbookIO/slate-no-empty | src/index.js | NoEmpty | function NoEmpty(type) {
type = typeof type == 'string' ?
Block.create({
type,
nodes: [
Text.create()
]
}) : type;
const onBeforeChange = (state) => {
const { document } = state;
// If document is not empty, it continues
... | javascript | function NoEmpty(type) {
type = typeof type == 'string' ?
Block.create({
type,
nodes: [
Text.create()
]
}) : type;
const onBeforeChange = (state) => {
const { document } = state;
// If document is not empty, it continues
... | [
"function",
"NoEmpty",
"(",
"type",
")",
"{",
"type",
"=",
"typeof",
"type",
"==",
"'string'",
"?",
"Block",
".",
"create",
"(",
"{",
"type",
",",
"nodes",
":",
"[",
"Text",
".",
"create",
"(",
")",
"]",
"}",
")",
":",
"type",
";",
"const",
"onBe... | Plugin to prevent an empty document.
@param {String|Block} type | [
"Plugin",
"to",
"prevent",
"an",
"empty",
"document",
"."
] | 9a8f24e4bfe2fea5ab76d0f9e5955587550c3118 | https://github.com/GitbookIO/slate-no-empty/blob/9a8f24e4bfe2fea5ab76d0f9e5955587550c3118/src/index.js#L8-L36 |
35,428 | karma-runner/karma-dart | chrome-extension/background.js | onRequest | function onRequest (request, sender, sendResponse) {
// Show the page action for the tab that the sender (content script) was on.
chrome.pageAction.show(sender.tab.id)
var files = request.files
if (request.action === 'load') {
var rules = []
for (var file in files) {
var regex
var isKnownF... | javascript | function onRequest (request, sender, sendResponse) {
// Show the page action for the tab that the sender (content script) was on.
chrome.pageAction.show(sender.tab.id)
var files = request.files
if (request.action === 'load') {
var rules = []
for (var file in files) {
var regex
var isKnownF... | [
"function",
"onRequest",
"(",
"request",
",",
"sender",
",",
"sendResponse",
")",
"{",
"// Show the page action for the tab that the sender (content script) was on.",
"chrome",
".",
"pageAction",
".",
"show",
"(",
"sender",
".",
"tab",
".",
"id",
")",
"var",
"files",
... | Called when a message is passed. | [
"Called",
"when",
"a",
"message",
"is",
"passed",
"."
] | d5bd776928ff86978382c9522a618b468d2fba51 | https://github.com/karma-runner/karma-dart/blob/d5bd776928ff86978382c9522a618b468d2fba51/chrome-extension/background.js#L7-L58 |
35,429 | Cloud9Trader/oanda-adapter | lib/Events.js | waitFor | function waitFor (event, listener, context, wait) {
var timeout;
if (!wait) {
throw new Error("[FATAL] waitFor called without wait time");
}
var handler = function () {
clearTimeout(timeout);
listener.apply(context, arguments);
};
timeout = setTimeout(function () {
... | javascript | function waitFor (event, listener, context, wait) {
var timeout;
if (!wait) {
throw new Error("[FATAL] waitFor called without wait time");
}
var handler = function () {
clearTimeout(timeout);
listener.apply(context, arguments);
};
timeout = setTimeout(function () {
... | [
"function",
"waitFor",
"(",
"event",
",",
"listener",
",",
"context",
",",
"wait",
")",
"{",
"var",
"timeout",
";",
"if",
"(",
"!",
"wait",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"[FATAL] waitFor called without wait time\"",
")",
";",
"}",
"var",
"handl... | Waits for wait ms for event to fire or calls listener with error, removing listener | [
"Waits",
"for",
"wait",
"ms",
"for",
"event",
"to",
"fire",
"or",
"calls",
"listener",
"with",
"error",
"removing",
"listener"
] | 33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1 | https://github.com/Cloud9Trader/oanda-adapter/blob/33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1/lib/Events.js#L20-L34 |
35,430 | Cloud9Trader/oanda-adapter | lib/Events.js | listenFor | function listenFor (event, listener, context, duration) {
setTimeout(function () {
this.off(event, listener, context);
}.bind(this), duration);
this.on(event, listener, context);
} | javascript | function listenFor (event, listener, context, duration) {
setTimeout(function () {
this.off(event, listener, context);
}.bind(this), duration);
this.on(event, listener, context);
} | [
"function",
"listenFor",
"(",
"event",
",",
"listener",
",",
"context",
",",
"duration",
")",
"{",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"this",
".",
"off",
"(",
"event",
",",
"listener",
",",
"context",
")",
";",
"}",
".",
"bind",
"(",
"this... | Listens for duration ms for events to fire, then removes listener | [
"Listens",
"for",
"duration",
"ms",
"for",
"events",
"to",
"fire",
"then",
"removes",
"listener"
] | 33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1 | https://github.com/Cloud9Trader/oanda-adapter/blob/33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1/lib/Events.js#L37-L42 |
35,431 | flux-capacitor/flux-capacitor | packages/flux-capacitor-sequelize/lib/connectTo.js | connectTo | function connectTo (connectionSettings, createCollections) {
const sequelize = new Sequelize(connectionSettings)
const collections = createCollections(sequelize, createCollection)
const database = {
/** @property {Sequelize} connection */
connection: sequelize,
/** @property {Object} collections ... | javascript | function connectTo (connectionSettings, createCollections) {
const sequelize = new Sequelize(connectionSettings)
const collections = createCollections(sequelize, createCollection)
const database = {
/** @property {Sequelize} connection */
connection: sequelize,
/** @property {Object} collections ... | [
"function",
"connectTo",
"(",
"connectionSettings",
",",
"createCollections",
")",
"{",
"const",
"sequelize",
"=",
"new",
"Sequelize",
"(",
"connectionSettings",
")",
"const",
"collections",
"=",
"createCollections",
"(",
"sequelize",
",",
"createCollection",
")",
"... | Connect to a database using Sequelize ORM.
@param {string|object} connectionSettings Connection URL like `sqlite://path/to/db.sqlite` or object: `{ database: string, host: string, dialect: string, ... }`
@param {Function} createCollections (sequelize: Sequelize, createCollection: (name: string, model: Sequeliz... | [
"Connect",
"to",
"a",
"database",
"using",
"Sequelize",
"ORM",
"."
] | 66393138ecdff9c1ba81d88b53144220e593584f | https://github.com/flux-capacitor/flux-capacitor/blob/66393138ecdff9c1ba81d88b53144220e593584f/packages/flux-capacitor-sequelize/lib/connectTo.js#L17-L46 |
35,432 | googlearchive/net-chromeify | examples/client/bundle.js | stringifyObject | function stringifyObject(obj, prefix) {
var ret = []
, keys = objectKeys(obj)
, key;
for (var i = 0, len = keys.length; i < len; ++i) {
key = keys[i];
ret.push(stringify(obj[key], prefix
? prefix + '[' + encodeURIComponent(key) + ']'
: encodeURIComponent(key)));
}
return ret.join('&'... | javascript | function stringifyObject(obj, prefix) {
var ret = []
, keys = objectKeys(obj)
, key;
for (var i = 0, len = keys.length; i < len; ++i) {
key = keys[i];
ret.push(stringify(obj[key], prefix
? prefix + '[' + encodeURIComponent(key) + ']'
: encodeURIComponent(key)));
}
return ret.join('&'... | [
"function",
"stringifyObject",
"(",
"obj",
",",
"prefix",
")",
"{",
"var",
"ret",
"=",
"[",
"]",
",",
"keys",
"=",
"objectKeys",
"(",
"obj",
")",
",",
"key",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"keys",
".",
"length",
";",
"i... | Stringify the given `obj`.
@param {Object} obj
@param {String} prefix
@return {String}
@api private | [
"Stringify",
"the",
"given",
"obj",
"."
] | 566cd7a24e03a5947e8851f338a9eee054a42824 | https://github.com/googlearchive/net-chromeify/blob/566cd7a24e03a5947e8851f338a9eee054a42824/examples/client/bundle.js#L3905-L3916 |
35,433 | Esri/geotrigger-js | geotrigger.js | function(target, obj){
for (var attr in obj) {
if(obj.hasOwnProperty(attr)){
target[attr] = obj[attr];
}
}
return target;
} | javascript | function(target, obj){
for (var attr in obj) {
if(obj.hasOwnProperty(attr)){
target[attr] = obj[attr];
}
}
return target;
} | [
"function",
"(",
"target",
",",
"obj",
")",
"{",
"for",
"(",
"var",
"attr",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"hasOwnProperty",
"(",
"attr",
")",
")",
"{",
"target",
"[",
"attr",
"]",
"=",
"obj",
"[",
"attr",
"]",
";",
"}",
"}",
"... | Merge Object 1 and Object 2. Properties from Object 2 will override properties in Object 1. Returns Object 1 | [
"Merge",
"Object",
"1",
"and",
"Object",
"2",
".",
"Properties",
"from",
"Object",
"2",
"will",
"override",
"properties",
"in",
"Object",
"1",
".",
"Returns",
"Object",
"1"
] | 35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26 | https://github.com/Esri/geotrigger-js/blob/35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26/geotrigger.js#L355-L362 | |
35,434 | stefanjudis/credits | lib/analyzers/jspm/index.js | getCredits | function getCredits(projectPath, credits) {
credits = credits || [];
const jspmPath = path.join(projectPath, 'jspm_packages');
globby.sync([`${jspmPath}/npm/*/package.json`, `${jspmPath}/github/*/*/{package.json,bower.json}`])
.forEach(packagePath => {
if (path.basename(packagePath) === 'bower.json') {
re... | javascript | function getCredits(projectPath, credits) {
credits = credits || [];
const jspmPath = path.join(projectPath, 'jspm_packages');
globby.sync([`${jspmPath}/npm/*/package.json`, `${jspmPath}/github/*/*/{package.json,bower.json}`])
.forEach(packagePath => {
if (path.basename(packagePath) === 'bower.json') {
re... | [
"function",
"getCredits",
"(",
"projectPath",
",",
"credits",
")",
"{",
"credits",
"=",
"credits",
"||",
"[",
"]",
";",
"const",
"jspmPath",
"=",
"path",
".",
"join",
"(",
"projectPath",
",",
"'jspm_packages'",
")",
";",
"globby",
".",
"sync",
"(",
"[",
... | Read project root and evaluate dependency credits for jspm modules
@param {String} projectPath absolute path to project root
@param {Array} credits list of credits to append to
@return {Array} list of credits | [
"Read",
"project",
"root",
"and",
"evaluate",
"dependency",
"credits",
"for",
"jspm",
"modules"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers/jspm/index.js#L16-L30 |
35,435 | stefanjudis/credits | lib/credit.js | getCredit | function getCredit(credits, author) {
const credit = credits.filter(credit => {
// Fallback to name when no email
// is available
if (credit.email && author.email) {
return credit.email === author.email;
}
return credit.name === author.name;
});
return credit.length > 0 ?
credit[0] :
false;
} | javascript | function getCredit(credits, author) {
const credit = credits.filter(credit => {
// Fallback to name when no email
// is available
if (credit.email && author.email) {
return credit.email === author.email;
}
return credit.name === author.name;
});
return credit.length > 0 ?
credit[0] :
false;
} | [
"function",
"getCredit",
"(",
"credits",
",",
"author",
")",
"{",
"const",
"credit",
"=",
"credits",
".",
"filter",
"(",
"credit",
"=>",
"{",
"// Fallback to name when no email",
"// is available",
"if",
"(",
"credit",
".",
"email",
"&&",
"author",
".",
"email... | Get credit out of running credits list
@param {Array} credits list of credits
@param {Object} author author
@return {Object|false} existing credit or false
@tested | [
"Get",
"credit",
"out",
"of",
"running",
"credits",
"list"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/credit.js#L13-L27 |
35,436 | stefanjudis/credits | lib/credit.js | addCreditToCredits | function addCreditToCredits(credits, person, name) {
let credit = getCredit(credits, person);
if (!credit) {
credit = person;
credit.packages = [];
credits.push(credit);
}
if (credit.packages.indexOf(name) === -1) {
credit.packages.push(name);
}
return credits;
} | javascript | function addCreditToCredits(credits, person, name) {
let credit = getCredit(credits, person);
if (!credit) {
credit = person;
credit.packages = [];
credits.push(credit);
}
if (credit.packages.indexOf(name) === -1) {
credit.packages.push(name);
}
return credits;
} | [
"function",
"addCreditToCredits",
"(",
"credits",
",",
"person",
",",
"name",
")",
"{",
"let",
"credit",
"=",
"getCredit",
"(",
"credits",
",",
"person",
")",
";",
"if",
"(",
"!",
"credit",
")",
"{",
"credit",
"=",
"person",
";",
"credit",
".",
"packag... | Add a credit to running credits list
@param {Array} credits list of credits
@param {Object} person person to give credit
@param {String} name project name to attach to person
@return {Array} list of credits
@tested | [
"Add",
"a",
"credit",
"to",
"running",
"credits",
"list"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/credit.js#L40-L55 |
35,437 | florianheinemann/passwordless-redisstore | lib/redisstore.js | RedisStore | function RedisStore(port, host, options) {
port = port || 6379;
host = host || '127.0.0.1';
this._options = options || {};
this._options.redisstore = this._options.redisstore || {};
if(this._options.redisstore.database && !isNumber(this._options.redisstore.database)) {
throw new Error('database has to be a numbe... | javascript | function RedisStore(port, host, options) {
port = port || 6379;
host = host || '127.0.0.1';
this._options = options || {};
this._options.redisstore = this._options.redisstore || {};
if(this._options.redisstore.database && !isNumber(this._options.redisstore.database)) {
throw new Error('database has to be a numbe... | [
"function",
"RedisStore",
"(",
"port",
",",
"host",
",",
"options",
")",
"{",
"port",
"=",
"port",
"||",
"6379",
";",
"host",
"=",
"host",
"||",
"'127.0.0.1'",
";",
"this",
".",
"_options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"_options"... | Constructor of RedisStore
@param {Number} [port] Port of the Redis server (default: 6379)
@param {String} [host] Host, e.g. 127.0.0.1 (default: 127.0.0.1)
@param {Object} [options] Combines both the options for the Redis client as well
as the options for RedisStore. For the Redis options please refer back to
the docume... | [
"Constructor",
"of",
"RedisStore"
] | 021ffb1dca599884f35c2f7e3e4105799c9aba54 | https://github.com/florianheinemann/passwordless-redisstore/blob/021ffb1dca599884f35c2f7e3e4105799c9aba54/lib/redisstore.js#L21-L38 |
35,438 | 7digital/7digital-api | lib/oauth.js | createOAuthWrapper | function createOAuthWrapper(oauthkey,
oauthsecret, headers) {
return new OAuthClient(
'https://api.7digital.com/1.2/oauth/requesttoken',
accessTokenUrl,
oauthkey, oauthsecret, '1.0', null, 'HMAC-SHA1', 32, headers);
} | javascript | function createOAuthWrapper(oauthkey,
oauthsecret, headers) {
return new OAuthClient(
'https://api.7digital.com/1.2/oauth/requesttoken',
accessTokenUrl,
oauthkey, oauthsecret, '1.0', null, 'HMAC-SHA1', 32, headers);
} | [
"function",
"createOAuthWrapper",
"(",
"oauthkey",
",",
"oauthsecret",
",",
"headers",
")",
"{",
"return",
"new",
"OAuthClient",
"(",
"'https://api.7digital.com/1.2/oauth/requesttoken'",
",",
"accessTokenUrl",
",",
"oauthkey",
",",
"oauthsecret",
",",
"'1.0'",
",",
"n... | Creates an OAuth v1 wrapper configured with the supplied key and secret and the necessary options for authenticating with the 7digital API. - @param {String} oauthkey - @param {String} oauthsecret - @return {OAuth} | [
"Creates",
"an",
"OAuth",
"v1",
"wrapper",
"configured",
"with",
"the",
"supplied",
"key",
"and",
"secret",
"and",
"the",
"necessary",
"options",
"for",
"authenticating",
"with",
"the",
"7digital",
"API",
".",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/oauth.js#L17-L24 |
35,439 | brettz9/miller-columns | dist/index-es.js | breadcrumb | function breadcrumb() {
const $breadcrumb = $(`.${namespace}-breadcrumbs`).empty();
chain().each(function () {
const $crumb = $(this);
$(`<span class="${namespace}-breadcrumb">`).text($crumb.text().trim()).click(function () {
$crumb.click();
}).append... | javascript | function breadcrumb() {
const $breadcrumb = $(`.${namespace}-breadcrumbs`).empty();
chain().each(function () {
const $crumb = $(this);
$(`<span class="${namespace}-breadcrumb">`).text($crumb.text().trim()).click(function () {
$crumb.click();
}).append... | [
"function",
"breadcrumb",
"(",
")",
"{",
"const",
"$breadcrumb",
"=",
"$",
"(",
"`",
"${",
"namespace",
"}",
"`",
")",
".",
"empty",
"(",
")",
";",
"chain",
"(",
")",
".",
"each",
"(",
"function",
"(",
")",
"{",
"const",
"$crumb",
"=",
"$",
"(",
... | Add the breadcrumb path using the chain of selected items. | [
"Add",
"the",
"breadcrumb",
"path",
"using",
"the",
"chain",
"of",
"selected",
"items",
"."
] | 98f0711d6ccdc198265c47290159a481145517e8 | https://github.com/brettz9/miller-columns/blob/98f0711d6ccdc198265c47290159a481145517e8/dist/index-es.js#L120-L129 |
35,440 | brettz9/miller-columns | dist/index-es.js | animation | function animation($column, $columns) {
let width = 0;
chain().not($column).each(function () {
width += $(this).outerWidth(true);
});
$columns.stop().animate({
scrollLeft: width
}, settings.delay, function () {
const last = $columns.find(`.${na... | javascript | function animation($column, $columns) {
let width = 0;
chain().not($column).each(function () {
width += $(this).outerWidth(true);
});
$columns.stop().animate({
scrollLeft: width
}, settings.delay, function () {
const last = $columns.find(`.${na... | [
"function",
"animation",
"(",
"$column",
",",
"$columns",
")",
"{",
"let",
"width",
"=",
"0",
";",
"chain",
"(",
")",
".",
"not",
"(",
"$column",
")",
".",
"each",
"(",
"function",
"(",
")",
"{",
"width",
"+=",
"$",
"(",
"this",
")",
".",
"outerW... | Ensure the viewport shows the entire newly expanded item. | [
"Ensure",
"the",
"viewport",
"shows",
"the",
"entire",
"newly",
"expanded",
"item",
"."
] | 98f0711d6ccdc198265c47290159a481145517e8 | https://github.com/brettz9/miller-columns/blob/98f0711d6ccdc198265c47290159a481145517e8/dist/index-es.js#L132-L147 |
35,441 | brettz9/miller-columns | dist/index-es.js | unnest | function unnest($columns) {
const queue = [];
let $node;
// Push the root unordered list item into the queue.
queue.push($columns.children());
while (queue.length) {
$node = queue.shift();
$node.children(itemSelector).each(function (item, el) {
... | javascript | function unnest($columns) {
const queue = [];
let $node;
// Push the root unordered list item into the queue.
queue.push($columns.children());
while (queue.length) {
$node = queue.shift();
$node.children(itemSelector).each(function (item, el) {
... | [
"function",
"unnest",
"(",
"$columns",
")",
"{",
"const",
"queue",
"=",
"[",
"]",
";",
"let",
"$node",
";",
"// Push the root unordered list item into the queue.",
"queue",
".",
"push",
"(",
"$columns",
".",
"children",
"(",
")",
")",
";",
"while",
"(",
"que... | Convert nested lists into columns using breadth-first traversal. | [
"Convert",
"nested",
"lists",
"into",
"columns",
"using",
"breadth",
"-",
"first",
"traversal",
"."
] | 98f0711d6ccdc198265c47290159a481145517e8 | https://github.com/brettz9/miller-columns/blob/98f0711d6ccdc198265c47290159a481145517e8/dist/index-es.js#L150-L180 |
35,442 | stefanjudis/credits | lib/package.js | getAllStar | function getAllStar(person) {
// Override properties from all-stars if available
const allStar = allStars(person);
return allStar ? objectAssign(person, allStar.subset()) : person;
} | javascript | function getAllStar(person) {
// Override properties from all-stars if available
const allStar = allStars(person);
return allStar ? objectAssign(person, allStar.subset()) : person;
} | [
"function",
"getAllStar",
"(",
"person",
")",
"{",
"// Override properties from all-stars if available",
"const",
"allStar",
"=",
"allStars",
"(",
"person",
")",
";",
"return",
"allStar",
"?",
"objectAssign",
"(",
"person",
",",
"allStar",
".",
"subset",
"(",
")",... | Check all-stars db for given person and assign to person if found.
@param {Object} person object representing author or maintainer
@return {Object} same object given, possibly modified or augmented | [
"Check",
"all",
"-",
"stars",
"db",
"for",
"given",
"person",
"and",
"assign",
"to",
"person",
"if",
"found",
"."
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/package.js#L28-L32 |
35,443 | stefanjudis/credits | lib/package.js | getPersonObject | function getPersonObject(personString) {
const regex = personString.match(/^(.*?)\s?(<(.*)>)?\s?(\((.*)\))?\s?$/);
return getAllStar({
name: regex[1],
email: regex[3],
url: regex[5]
});
} | javascript | function getPersonObject(personString) {
const regex = personString.match(/^(.*?)\s?(<(.*)>)?\s?(\((.*)\))?\s?$/);
return getAllStar({
name: regex[1],
email: regex[3],
url: regex[5]
});
} | [
"function",
"getPersonObject",
"(",
"personString",
")",
"{",
"const",
"regex",
"=",
"personString",
".",
"match",
"(",
"/",
"^(.*?)\\s?(<(.*)>)?\\s?(\\((.*)\\))?\\s?$",
"/",
")",
";",
"return",
"getAllStar",
"(",
"{",
"name",
":",
"regex",
"[",
"1",
"]",
",",... | Parse npm string shorthand into object representation
@param {String} personString string shorthand for author or maintainer
@return {Object} object representing author or maintainer | [
"Parse",
"npm",
"string",
"shorthand",
"into",
"object",
"representation"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/package.js#L41-L49 |
35,444 | stefanjudis/credits | lib/package.js | getAuthor | function getAuthor(packageJson) {
if (Array.isArray(packageJson.authors)) {
packageJson.authors = packageJson.authors.map(author => {
if (typeof author === 'string') {
return getPersonObject(author);
}
return getAllStar(author);
});
return packageJson.authors ? packageJson.authors : false;
}
if... | javascript | function getAuthor(packageJson) {
if (Array.isArray(packageJson.authors)) {
packageJson.authors = packageJson.authors.map(author => {
if (typeof author === 'string') {
return getPersonObject(author);
}
return getAllStar(author);
});
return packageJson.authors ? packageJson.authors : false;
}
if... | [
"function",
"getAuthor",
"(",
"packageJson",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"packageJson",
".",
"authors",
")",
")",
"{",
"packageJson",
".",
"authors",
"=",
"packageJson",
".",
"authors",
".",
"map",
"(",
"author",
"=>",
"{",
"if",
... | Extract author from package.json content
@param {Object} packageJson content of package.json
@return {Object|false} author if exists or false
@tested | [
"Extract",
"author",
"from",
"package",
".",
"json",
"content"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/package.js#L60-L80 |
35,445 | stefanjudis/credits | lib/package.js | getMaintainers | function getMaintainers(packageJson) {
if (Array.isArray(packageJson.maintainers)) {
packageJson.maintainers = packageJson.maintainers.map(maintainer => {
if (typeof maintainer === 'string') {
return getPersonObject(maintainer);
}
return getAllStar(maintainer);
});
}
// Safety fix for people doing... | javascript | function getMaintainers(packageJson) {
if (Array.isArray(packageJson.maintainers)) {
packageJson.maintainers = packageJson.maintainers.map(maintainer => {
if (typeof maintainer === 'string') {
return getPersonObject(maintainer);
}
return getAllStar(maintainer);
});
}
// Safety fix for people doing... | [
"function",
"getMaintainers",
"(",
"packageJson",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"packageJson",
".",
"maintainers",
")",
")",
"{",
"packageJson",
".",
"maintainers",
"=",
"packageJson",
".",
"maintainers",
".",
"map",
"(",
"maintainer",
"... | Extract maintainers from package.json content
@param {Object} packageJson content of package.json
@return {Array} maintainers if exists or false
@tested | [
"Extract",
"maintainers",
"from",
"package",
".",
"json",
"content"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/package.js#L91-L111 |
35,446 | stefanjudis/credits | lib/analyzers/npm/index.js | getNpmCredits | function getNpmCredits(packagePath, credits) {
const directoryPath = path.dirname(packagePath);
const name = path.basename(path.dirname(packagePath));
if (
name[0] !== '.' && (
fs.lstatSync(directoryPath).isDirectory() ||
fs.lstatSync(directoryPath).isSymbolicLink()
)
) {
const packageJson = packageUti... | javascript | function getNpmCredits(packagePath, credits) {
const directoryPath = path.dirname(packagePath);
const name = path.basename(path.dirname(packagePath));
if (
name[0] !== '.' && (
fs.lstatSync(directoryPath).isDirectory() ||
fs.lstatSync(directoryPath).isSymbolicLink()
)
) {
const packageJson = packageUti... | [
"function",
"getNpmCredits",
"(",
"packagePath",
",",
"credits",
")",
"{",
"const",
"directoryPath",
"=",
"path",
".",
"dirname",
"(",
"packagePath",
")",
";",
"const",
"name",
"=",
"path",
".",
"basename",
"(",
"path",
".",
"dirname",
"(",
"packagePath",
... | Read and evaluate dependency credits for npm module
@param {String} packagePath absolute path to package.json file
@param {Array} credits list of credits to append to
@return {Array} list of credits | [
"Read",
"and",
"evaluate",
"dependency",
"credits",
"for",
"npm",
"module"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers/npm/index.js#L17-L44 |
35,447 | stefanjudis/credits | lib/analyzers/npm/index.js | getCredits | function getCredits(projectPath, credits) {
credits = credits || [];
const depPath = path.join(projectPath, 'node_modules');
globby.sync(`${depPath}/**/package.json`)
.forEach(packagePath => {
getNpmCredits(packagePath, credits);
});
return credits;
} | javascript | function getCredits(projectPath, credits) {
credits = credits || [];
const depPath = path.join(projectPath, 'node_modules');
globby.sync(`${depPath}/**/package.json`)
.forEach(packagePath => {
getNpmCredits(packagePath, credits);
});
return credits;
} | [
"function",
"getCredits",
"(",
"projectPath",
",",
"credits",
")",
"{",
"credits",
"=",
"credits",
"||",
"[",
"]",
";",
"const",
"depPath",
"=",
"path",
".",
"join",
"(",
"projectPath",
",",
"'node_modules'",
")",
";",
"globby",
".",
"sync",
"(",
"`",
... | Read project root and evaluate dependency credits for node modules
@param {String} projectPath absolute path to project root
@param {Array|undefined} credits list of credits
@param {Array|undefined} seen list of already iterated packages
@return {Array} list of credits | [
"Read",
"project",
"root",
"and",
"evaluate",
"dependency",
"credits",
"for",
"node",
"modules"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers/npm/index.js#L55-L66 |
35,448 | knockout/tko.provider | src/provider.js | preProcessBindings | function preProcessBindings(bindingString) {
var results = [];
var bindingHandlers = this.bindingHandlers;
var preprocessed;
// Check for a Provider.preprocessNode property
if (typeof this.preprocessNode === 'function') {
preprocessed = this.preprocessNode(bindingString, this);
if (preprocessed) { bi... | javascript | function preProcessBindings(bindingString) {
var results = [];
var bindingHandlers = this.bindingHandlers;
var preprocessed;
// Check for a Provider.preprocessNode property
if (typeof this.preprocessNode === 'function') {
preprocessed = this.preprocessNode(bindingString, this);
if (preprocessed) { bi... | [
"function",
"preProcessBindings",
"(",
"bindingString",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"var",
"bindingHandlers",
"=",
"this",
".",
"bindingHandlers",
";",
"var",
"preprocessed",
";",
"// Check for a Provider.preprocessNode property",
"if",
"(",
"typ... | Call bindingHandler.preprocess on each respective binding string.
The `preprocess` property of bindingHandler must be a static
function (i.e. on the object or constructor). | [
"Call",
"bindingHandler",
".",
"preprocess",
"on",
"each",
"respective",
"binding",
"string",
"."
] | a157f31f5ab579b350eb6b64d92c92f9d6d4a385 | https://github.com/knockout/tko.provider/blob/a157f31f5ab579b350eb6b64d92c92f9d6d4a385/src/provider.js#L131-L170 |
35,449 | 7digital/7digital-api | lib/parameters.js | template | function template(url, params) {
var templated = url;
var keys = _.keys(params);
var loweredKeys = _.map(keys, function (key) {
return key.toLowerCase();
});
var keyLookup = _.zipObject(loweredKeys, keys);
_.each(templateParams(url), function replaceParam(param) {
var normalisedParam = param.toLowerCase().su... | javascript | function template(url, params) {
var templated = url;
var keys = _.keys(params);
var loweredKeys = _.map(keys, function (key) {
return key.toLowerCase();
});
var keyLookup = _.zipObject(loweredKeys, keys);
_.each(templateParams(url), function replaceParam(param) {
var normalisedParam = param.toLowerCase().su... | [
"function",
"template",
"(",
"url",
",",
"params",
")",
"{",
"var",
"templated",
"=",
"url",
";",
"var",
"keys",
"=",
"_",
".",
"keys",
"(",
"params",
")",
";",
"var",
"loweredKeys",
"=",
"_",
".",
"map",
"(",
"keys",
",",
"function",
"(",
"key",
... | Given a url and some parameters replaces all named parameters with those supplied. - @param {String} url - the url to be modified - @param {Object} params - a hash of parameters to be put in the URL - @return {String} The url with the parameters replaced | [
"Given",
"a",
"url",
"and",
"some",
"parameters",
"replaces",
"all",
"named",
"parameters",
"with",
"those",
"supplied",
".",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/parameters.js#L21-L42 |
35,450 | stefanjudis/credits | index.js | readDirectory | function readDirectory( projectPath, analyzers ) {
var credits = {};
for ( var analyzer in analyzers ) {
credits[ analyzer ] = analyzers[ analyzer ]( projectPath );
};
return credits;
} | javascript | function readDirectory( projectPath, analyzers ) {
var credits = {};
for ( var analyzer in analyzers ) {
credits[ analyzer ] = analyzers[ analyzer ]( projectPath );
};
return credits;
} | [
"function",
"readDirectory",
"(",
"projectPath",
",",
"analyzers",
")",
"{",
"var",
"credits",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"analyzer",
"in",
"analyzers",
")",
"{",
"credits",
"[",
"analyzer",
"]",
"=",
"analyzers",
"[",
"analyzer",
"]",
"(",
... | Read project root and evaluate dependency credits
for all supported package managers
@param {String} projectPath absolute path to project root
@param {Array} analyzers list of availalbe analyzers
@return {Array} list of credits
@tested | [
"Read",
"project",
"root",
"and",
"evaluate",
"dependency",
"credits",
"for",
"all",
"supported",
"package",
"managers"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/index.js#L22-L30 |
35,451 | stefanjudis/credits | lib/analyzers/bower/index.js | getBowerCredits | function getBowerCredits(bowerJsonPath, credits) {
const name = path.basename(path.dirname(bowerJsonPath));
const bowerJson = packageUtil.readJSONSync(bowerJsonPath);
const authors = packageUtil.getAuthor(bowerJson);
if (authors) {
authors.forEach(author => {
credits = creditUtil.addCreditToCredits(credits, ... | javascript | function getBowerCredits(bowerJsonPath, credits) {
const name = path.basename(path.dirname(bowerJsonPath));
const bowerJson = packageUtil.readJSONSync(bowerJsonPath);
const authors = packageUtil.getAuthor(bowerJson);
if (authors) {
authors.forEach(author => {
credits = creditUtil.addCreditToCredits(credits, ... | [
"function",
"getBowerCredits",
"(",
"bowerJsonPath",
",",
"credits",
")",
"{",
"const",
"name",
"=",
"path",
".",
"basename",
"(",
"path",
".",
"dirname",
"(",
"bowerJsonPath",
")",
")",
";",
"const",
"bowerJson",
"=",
"packageUtil",
".",
"readJSONSync",
"("... | Read and evaluate dependency credits for bower module
@param {String} bowerJsonPath absolute path to bower file
@param {Array} credits list of credits to append to
@return {Array} list of credits | [
"Read",
"and",
"evaluate",
"dependency",
"credits",
"for",
"bower",
"module"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers/bower/index.js#L16-L29 |
35,452 | stefanjudis/credits | lib/analyzers/bower/index.js | getCredits | function getCredits(projectPath, credits) {
credits = credits || [];
const depPath = path.join(projectPath, 'bower_components');
globby.sync([`${depPath}/*/bower.json`])
.forEach(bowerJsonPath => {
getBowerCredits(bowerJsonPath, credits);
});
return credits;
} | javascript | function getCredits(projectPath, credits) {
credits = credits || [];
const depPath = path.join(projectPath, 'bower_components');
globby.sync([`${depPath}/*/bower.json`])
.forEach(bowerJsonPath => {
getBowerCredits(bowerJsonPath, credits);
});
return credits;
} | [
"function",
"getCredits",
"(",
"projectPath",
",",
"credits",
")",
"{",
"credits",
"=",
"credits",
"||",
"[",
"]",
";",
"const",
"depPath",
"=",
"path",
".",
"join",
"(",
"projectPath",
",",
"'bower_components'",
")",
";",
"globby",
".",
"sync",
"(",
"["... | Read project root and evaluate dependency credits for bower modules
@param {String} projectPath absolute path to project root
@param {Array} credits list of credits to append to
@return {Array} list of credits | [
"Read",
"project",
"root",
"and",
"evaluate",
"dependency",
"credits",
"for",
"bower",
"modules"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers/bower/index.js#L38-L49 |
35,453 | Esri/geotrigger-js | spec/SpecHelpers.js | arrySignaturesMatch | function arrySignaturesMatch(array1, array2){
// setup variables
var ref, test;
// we want to use the shorter array if one is longer
if (array1.length >= array2.length) {
ref = array2;
test = array1;
} else {
ref = array1;
test = array2;
}
// loop over the shorter a... | javascript | function arrySignaturesMatch(array1, array2){
// setup variables
var ref, test;
// we want to use the shorter array if one is longer
if (array1.length >= array2.length) {
ref = array2;
test = array1;
} else {
ref = array1;
test = array2;
}
// loop over the shorter a... | [
"function",
"arrySignaturesMatch",
"(",
"array1",
",",
"array2",
")",
"{",
"// setup variables",
"var",
"ref",
",",
"test",
";",
"// we want to use the shorter array if one is longer",
"if",
"(",
"array1",
".",
"length",
">=",
"array2",
".",
"length",
")",
"{",
"r... | do the types of arguments in each array match? | [
"do",
"the",
"types",
"of",
"arguments",
"in",
"each",
"array",
"match?"
] | 35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26 | https://github.com/Esri/geotrigger-js/blob/35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26/spec/SpecHelpers.js#L4-L38 |
35,454 | Esri/geotrigger-js | spec/SpecHelpers.js | objectSignaturesMatch | function objectSignaturesMatch(object1, object2){
// because typeof null is object we need to check for it here before Object.keys
if(object1 === null && object2 === null){
return true;
}
// if the objects have different lengths of keys we should fail immediatly
if (Object.keys(object1).leng... | javascript | function objectSignaturesMatch(object1, object2){
// because typeof null is object we need to check for it here before Object.keys
if(object1 === null && object2 === null){
return true;
}
// if the objects have different lengths of keys we should fail immediatly
if (Object.keys(object1).leng... | [
"function",
"objectSignaturesMatch",
"(",
"object1",
",",
"object2",
")",
"{",
"// because typeof null is object we need to check for it here before Object.keys",
"if",
"(",
"object1",
"===",
"null",
"&&",
"object2",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
... | do the keys in object 1 match object 2? | [
"do",
"the",
"keys",
"in",
"object",
"1",
"match",
"object",
"2?"
] | 35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26 | https://github.com/Esri/geotrigger-js/blob/35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26/spec/SpecHelpers.js#L41-L80 |
35,455 | Esri/geotrigger-js | spec/SpecHelpers.js | function() {
var refArgs = Array.prototype.slice.call(arguments);
var calledArgs = this.actual.mostRecentCall.args;
var arg;
for(arg in refArgs){
var ref = refArgs[arg];
var test = calledArgs[arg];
// if the types of the objects dont match
if(typeof ref !== type... | javascript | function() {
var refArgs = Array.prototype.slice.call(arguments);
var calledArgs = this.actual.mostRecentCall.args;
var arg;
for(arg in refArgs){
var ref = refArgs[arg];
var test = calledArgs[arg];
// if the types of the objects dont match
if(typeof ref !== type... | [
"function",
"(",
")",
"{",
"var",
"refArgs",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"var",
"calledArgs",
"=",
"this",
".",
"actual",
".",
"mostRecentCall",
".",
"args",
";",
"var",
"arg",
";",
"for",
"(... | this is a lazy matcher for jasmine spies. it checks that the arguments for the last call made match all the arguments that are passed into the function, but does not care if the values match only that they are the same type. in short this only cares that all teh keys are the same and the types of values are the same, ... | [
"this",
"is",
"a",
"lazy",
"matcher",
"for",
"jasmine",
"spies",
".",
"it",
"checks",
"that",
"the",
"arguments",
"for",
"the",
"last",
"call",
"made",
"match",
"all",
"the",
"arguments",
"that",
"are",
"passed",
"into",
"the",
"function",
"but",
"does",
... | 35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26 | https://github.com/Esri/geotrigger-js/blob/35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26/spec/SpecHelpers.js#L91-L115 | |
35,456 | stefanjudis/credits | lib/analyzers.js | getAnalyzers | function getAnalyzers(config) {
const methods = {};
const basePath = config.filePaths.analyzers;
globby.sync(`${basePath}/*`)
.forEach(analyzer => {
const name = path.basename(analyzer);
methods[name] = require(analyzer);
});
return methods;
} | javascript | function getAnalyzers(config) {
const methods = {};
const basePath = config.filePaths.analyzers;
globby.sync(`${basePath}/*`)
.forEach(analyzer => {
const name = path.basename(analyzer);
methods[name] = require(analyzer);
});
return methods;
} | [
"function",
"getAnalyzers",
"(",
"config",
")",
"{",
"const",
"methods",
"=",
"{",
"}",
";",
"const",
"basePath",
"=",
"config",
".",
"filePaths",
".",
"analyzers",
";",
"globby",
".",
"sync",
"(",
"`",
"${",
"basePath",
"}",
"`",
")",
".",
"forEach",
... | Get all available analyzers
@param {Object} config project configuration
@return {Array} list of reporter methods | [
"Get",
"all",
"available",
"analyzers"
] | b5e75518ca62d819e7f2145eeea30de2ea6043ce | https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers.js#L13-L24 |
35,457 | 7digital/7digital-api | lib/request.js | prepare | function prepare(data, consumerkey) {
var prop;
data = data || {};
for (prop in data) {
if (data.hasOwnProperty(prop)) {
if (_.isDate(data[prop])) {
data[prop] = helpers.toYYYYMMDD(data[prop]);
}
}
}
data.oauth_consumer_key = consumerkey;
return data;
} | javascript | function prepare(data, consumerkey) {
var prop;
data = data || {};
for (prop in data) {
if (data.hasOwnProperty(prop)) {
if (_.isDate(data[prop])) {
data[prop] = helpers.toYYYYMMDD(data[prop]);
}
}
}
data.oauth_consumer_key = consumerkey;
return data;
} | [
"function",
"prepare",
"(",
"data",
",",
"consumerkey",
")",
"{",
"var",
"prop",
";",
"data",
"=",
"data",
"||",
"{",
"}",
";",
"for",
"(",
"prop",
"in",
"data",
")",
"{",
"if",
"(",
"data",
".",
"hasOwnProperty",
"(",
"prop",
")",
")",
"{",
"if"... | Formats request parameters as expected by the API. - @param {Object} data - hash of pararameters - @param {String} consumerkey - consumer key - @return {String} - Encoded parameter string | [
"Formats",
"request",
"parameters",
"as",
"expected",
"by",
"the",
"API",
".",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/request.js#L20-L35 |
35,458 | 7digital/7digital-api | lib/request.js | logHeaders | function logHeaders(logger, headers) {
return _.each(_.keys(headers), function (key) {
logger.info(key + ': ' + headers[key]);
});
} | javascript | function logHeaders(logger, headers) {
return _.each(_.keys(headers), function (key) {
logger.info(key + ': ' + headers[key]);
});
} | [
"function",
"logHeaders",
"(",
"logger",
",",
"headers",
")",
"{",
"return",
"_",
".",
"each",
"(",
"_",
".",
"keys",
"(",
"headers",
")",
",",
"function",
"(",
"key",
")",
"{",
"logger",
".",
"info",
"(",
"key",
"+",
"': '",
"+",
"headers",
"[",
... | Logs out a headers hash - @param {Object} logger - The logger to use - @param {Object} headers - The hash of headers to log | [
"Logs",
"out",
"a",
"headers",
"hash",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/request.js#L51-L55 |
35,459 | 7digital/7digital-api | lib/request.js | get | function get(endpointInfo, requestData, headers, credentials, logger,
callback) {
var normalisedData = prepare(requestData, credentials.consumerkey);
var fullUrl = endpointInfo.url + '?' + qs.stringify(normalisedData);
var hostInfo = {
host: endpointInfo.host,
port: endpointInfo.port
};
// Decide whether to... | javascript | function get(endpointInfo, requestData, headers, credentials, logger,
callback) {
var normalisedData = prepare(requestData, credentials.consumerkey);
var fullUrl = endpointInfo.url + '?' + qs.stringify(normalisedData);
var hostInfo = {
host: endpointInfo.host,
port: endpointInfo.port
};
// Decide whether to... | [
"function",
"get",
"(",
"endpointInfo",
",",
"requestData",
",",
"headers",
",",
"credentials",
",",
"logger",
",",
"callback",
")",
"{",
"var",
"normalisedData",
"=",
"prepare",
"(",
"requestData",
",",
"credentials",
".",
"consumerkey",
")",
";",
"var",
"f... | Makes a GET request to the API. - @param {Object} endpointInfo - Generic metadata about the endpoint to hit. - @param {Object} requestData - Parameters for this specific request. - @param {Object} headers - Custom headers for this request. - @param {Object} credentials - OAuth consumerkey and consumersecret. - @param ... | [
"Makes",
"a",
"GET",
"request",
"to",
"the",
"API",
".",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/request.js#L65-L85 |
35,460 | 7digital/7digital-api | lib/request.js | dispatchSecure | function dispatchSecure(path, httpMethod, requestData, headers, authtype,
hostInfo, credentials, logger, callback) {
var url;
var is2Legged = authtype === '2-legged';
var token = is2Legged ? null : requestData.accesstoken;
var secret = is2Legged ? null : requestData.accesssecret;
var mergedHeaders = createHeader... | javascript | function dispatchSecure(path, httpMethod, requestData, headers, authtype,
hostInfo, credentials, logger, callback) {
var url;
var is2Legged = authtype === '2-legged';
var token = is2Legged ? null : requestData.accesstoken;
var secret = is2Legged ? null : requestData.accesssecret;
var mergedHeaders = createHeader... | [
"function",
"dispatchSecure",
"(",
"path",
",",
"httpMethod",
",",
"requestData",
",",
"headers",
",",
"authtype",
",",
"hostInfo",
",",
"credentials",
",",
"logger",
",",
"callback",
")",
"{",
"var",
"url",
";",
"var",
"is2Legged",
"=",
"authtype",
"===",
... | Dispatches an oauth signed request to the API - @param {String} url - the path of the API url to request. - @param {String} httpMethod - @param {Object} requestData - hash of the parameters for the request. - @param {Object} headers - Headers for this request. - @param {String} authType - OAuth request type: '2-legged... | [
"Dispatches",
"an",
"oauth",
"signed",
"request",
"to",
"the",
"API",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/request.js#L131-L199 |
35,461 | 7digital/7digital-api | lib/request.js | dispatch | function dispatch(url, httpMethod, data, headers, hostInfo, credentials,
logger, callback) {
hostInfo.port = hostInfo.port || 80;
var apiRequest, prop, hasErrored;
var mergedHeaders = createHeaders(hostInfo.host, headers);
var apiPath = url;
data = prepare(data, credentials.consumerkey);
// Special case for... | javascript | function dispatch(url, httpMethod, data, headers, hostInfo, credentials,
logger, callback) {
hostInfo.port = hostInfo.port || 80;
var apiRequest, prop, hasErrored;
var mergedHeaders = createHeaders(hostInfo.host, headers);
var apiPath = url;
data = prepare(data, credentials.consumerkey);
// Special case for... | [
"function",
"dispatch",
"(",
"url",
",",
"httpMethod",
",",
"data",
",",
"headers",
",",
"hostInfo",
",",
"credentials",
",",
"logger",
",",
"callback",
")",
"{",
"hostInfo",
".",
"port",
"=",
"hostInfo",
".",
"port",
"||",
"80",
";",
"var",
"apiRequest"... | Dispatches requests to the API. Serializes the data in keeping with the API specification and applies approriate HTTP headers. - @param {String} url - the URL on the API to make the request to. - @param {String} httpMethod - @param {Object} data - hash of the parameters for the request. - @param {Object} headers - He... | [
"Dispatches",
"requests",
"to",
"the",
"API",
".",
"Serializes",
"the",
"data",
"in",
"keeping",
"with",
"the",
"API",
"specification",
"and",
"applies",
"approriate",
"HTTP",
"headers",
".",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/request.js#L212-L289 |
35,462 | 7digital/7digital-api | lib/logger.js | makeLogger | function makeLogger(level, method) {
// The logger function to return takes a variable number of arguments
// and formats like console.log
function logger() {
var args = [].slice.call(arguments);
var format = level.toUpperCase() + ': (api-client) ' + args.shift();
var logArgs = [format].concat(args);
return... | javascript | function makeLogger(level, method) {
// The logger function to return takes a variable number of arguments
// and formats like console.log
function logger() {
var args = [].slice.call(arguments);
var format = level.toUpperCase() + ': (api-client) ' + args.shift();
var logArgs = [format].concat(args);
return... | [
"function",
"makeLogger",
"(",
"level",
",",
"method",
")",
"{",
"// The logger function to return takes a variable number of arguments",
"// and formats like console.log",
"function",
"logger",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"... | Makes a logger function that formats messages sensibly and logs to either stdout or stderr. - @param {String} level - the log level. - @param {String} method - the method on the console object to call. - @return {Function} - the logging function. | [
"Makes",
"a",
"logger",
"function",
"that",
"formats",
"messages",
"sensibly",
"and",
"logs",
"to",
"either",
"stdout",
"or",
"stderr",
".",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/logger.js#L9-L23 |
35,463 | 7digital/7digital-api | lib/response-cleaners/ensure-collections.js | ensureCollections | function ensureCollections(collectionPaths, response) {
var basket;
_.each(collectionPaths, function checkLength(item) {
var parts = item.split('.');
var allPartsButLast = _.initial(parts);
var lastPart = _.last(parts);
var parents = _.reduce(allPartsButLast, function (chain, part) {
return chain.pluck(par... | javascript | function ensureCollections(collectionPaths, response) {
var basket;
_.each(collectionPaths, function checkLength(item) {
var parts = item.split('.');
var allPartsButLast = _.initial(parts);
var lastPart = _.last(parts);
var parents = _.reduce(allPartsButLast, function (chain, part) {
return chain.pluck(par... | [
"function",
"ensureCollections",
"(",
"collectionPaths",
",",
"response",
")",
"{",
"var",
"basket",
";",
"_",
".",
"each",
"(",
"collectionPaths",
",",
"function",
"checkLength",
"(",
"item",
")",
"{",
"var",
"parts",
"=",
"item",
".",
"split",
"(",
"'.'"... | The API returns resources as either a single object or an array. This makes responses fiddly to deal with for consumers as they manually check whether the resource has a length an access the property appropriately. This method checks the reponse for the existence of a property path and if it is an object wraps it in an... | [
"The",
"API",
"returns",
"resources",
"as",
"either",
"a",
"single",
"object",
"or",
"an",
"array",
".",
"This",
"makes",
"responses",
"fiddly",
"to",
"deal",
"with",
"for",
"consumers",
"as",
"they",
"manually",
"check",
"whether",
"the",
"resource",
"has",... | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/response-cleaners/ensure-collections.js#L18-L47 |
35,464 | 7digital/7digital-api | lib/api.js | Api | function Api(options, schema) {
var prop, resourceOptions, resourceConstructor;
var apiRoot = this;
// Set default options for any unsupplied overrides
_.defaults(options, config);
this.options = options;
this.schema = schema;
configureSchemaFromEnv(this.schema);
// Creates a constructor with the pre-built r... | javascript | function Api(options, schema) {
var prop, resourceOptions, resourceConstructor;
var apiRoot = this;
// Set default options for any unsupplied overrides
_.defaults(options, config);
this.options = options;
this.schema = schema;
configureSchemaFromEnv(this.schema);
// Creates a constructor with the pre-built r... | [
"function",
"Api",
"(",
"options",
",",
"schema",
")",
"{",
"var",
"prop",
",",
"resourceOptions",
",",
"resourceConstructor",
";",
"var",
"apiRoot",
"=",
"this",
";",
"// Set default options for any unsupplied overrides",
"_",
".",
"defaults",
"(",
"options",
","... | API Creates a new API wrapper from a schema definition - @param {Object} options - The API options, see below - @param {Object} schema - The definition of the api resources and actions see the assets/7digital-api-schema json file. - @constructor - @param {Object} options The options parameter should have the follow... | [
"API",
"Creates",
"a",
"new",
"API",
"wrapper",
"from",
"a",
"schema",
"definition",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/api.js#L56-L107 |
35,465 | 7digital/7digital-api | lib/api.js | createResourceConstructor | function createResourceConstructor(resourcePrototype) {
function APIResource(resourceOptions) {
// Allow creating resources without `new` keyword
if (!(this instanceof APIResource)) {
return new APIResource(resourceOptions);
}
resourceOptions = resourceOptions || {};
// Override any default option... | javascript | function createResourceConstructor(resourcePrototype) {
function APIResource(resourceOptions) {
// Allow creating resources without `new` keyword
if (!(this instanceof APIResource)) {
return new APIResource(resourceOptions);
}
resourceOptions = resourceOptions || {};
// Override any default option... | [
"function",
"createResourceConstructor",
"(",
"resourcePrototype",
")",
"{",
"function",
"APIResource",
"(",
"resourceOptions",
")",
"{",
"// Allow creating resources without `new` keyword",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"APIResource",
")",
")",
"{",
"retur... | Creates a constructor with the pre-built resource as its prototype this is syntactic sugar to allow callers to new up the resources. | [
"Creates",
"a",
"constructor",
"with",
"the",
"pre",
"-",
"built",
"resource",
"as",
"its",
"prototype",
"this",
"is",
"syntactic",
"sugar",
"to",
"allow",
"callers",
"to",
"new",
"up",
"the",
"resources",
"."
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/api.js#L69-L92 |
35,466 | danillouz/devrant | src/index.js | _getIdByUsername | function _getIdByUsername(username) {
const url = `${API}/get-user-id`;
const params = {
app: 3,
username
};
return http
.GET(url, params)
.then(data => data.user_id);
} | javascript | function _getIdByUsername(username) {
const url = `${API}/get-user-id`;
const params = {
app: 3,
username
};
return http
.GET(url, params)
.then(data => data.user_id);
} | [
"function",
"_getIdByUsername",
"(",
"username",
")",
"{",
"const",
"url",
"=",
"`",
"${",
"API",
"}",
"`",
";",
"const",
"params",
"=",
"{",
"app",
":",
"3",
",",
"username",
"}",
";",
"return",
"http",
".",
"GET",
"(",
"url",
",",
"params",
")",
... | Retrieve the user id associated with the devRant
username.
@private
@param {String} username - the devRant username
@return {Promise} Resolves with the user id | [
"Retrieve",
"the",
"user",
"id",
"associated",
"with",
"the",
"devRant",
"username",
"."
] | d9938d2d0cd94823c69e291a2229f6cd799feddc | https://github.com/danillouz/devrant/blob/d9938d2d0cd94823c69e291a2229f6cd799feddc/src/index.js#L47-L57 |
35,467 | danillouz/devrant | src/index.js | rant | function rant(id = _noRantIdError()) {
const url = `${API}/devrant/rants/${id}`;
const params = { app: 3 };
return http.GET(url, params);
} | javascript | function rant(id = _noRantIdError()) {
const url = `${API}/devrant/rants/${id}`;
const params = { app: 3 };
return http.GET(url, params);
} | [
"function",
"rant",
"(",
"id",
"=",
"_noRantIdError",
"(",
")",
")",
"{",
"const",
"url",
"=",
"`",
"${",
"API",
"}",
"${",
"id",
"}",
"`",
";",
"const",
"params",
"=",
"{",
"app",
":",
"3",
"}",
";",
"return",
"http",
".",
"GET",
"(",
"url",
... | Retrieve a single rant from devRant. Use this method to
retrieve a rant with its full text and comments.
@param {String} id - the rant id
@return {Promise} Resolves with the fetched rant | [
"Retrieve",
"a",
"single",
"rant",
"from",
"devRant",
".",
"Use",
"this",
"method",
"to",
"retrieve",
"a",
"rant",
"with",
"its",
"full",
"text",
"and",
"comments",
"."
] | d9938d2d0cd94823c69e291a2229f6cd799feddc | https://github.com/danillouz/devrant/blob/d9938d2d0cd94823c69e291a2229f6cd799feddc/src/index.js#L67-L72 |
35,468 | danillouz/devrant | src/index.js | rants | function rants({
sort = 'algo',
limit = 50,
skip = 0
} = {}) {
const url = `${API}/devrant/rants`;
const params = {
app: 3,
sort, limit, skip
};
return http
.GET(url, params)
.then(data => data.rants);
} | javascript | function rants({
sort = 'algo',
limit = 50,
skip = 0
} = {}) {
const url = `${API}/devrant/rants`;
const params = {
app: 3,
sort, limit, skip
};
return http
.GET(url, params)
.then(data => data.rants);
} | [
"function",
"rants",
"(",
"{",
"sort",
"=",
"'algo'",
",",
"limit",
"=",
"50",
",",
"skip",
"=",
"0",
"}",
"=",
"{",
"}",
")",
"{",
"const",
"url",
"=",
"`",
"${",
"API",
"}",
"`",
";",
"const",
"params",
"=",
"{",
"app",
":",
"3",
",",
"so... | Retrieve rants from devRant.
@param {Object} options - sort (by `algo`, `recent` or `top`), limit and skip
@return {Promise} Resolves with the fetched rants | [
"Retrieve",
"rants",
"from",
"devRant",
"."
] | d9938d2d0cd94823c69e291a2229f6cd799feddc | https://github.com/danillouz/devrant/blob/d9938d2d0cd94823c69e291a2229f6cd799feddc/src/index.js#L81-L95 |
35,469 | danillouz/devrant | src/index.js | search | function search(term = _noSearchTermError()) {
const url = `${API}/devrant/search`;
const params = {
app: 3,
term
};
return http
.GET(url, params)
.then(data => data.results);
} | javascript | function search(term = _noSearchTermError()) {
const url = `${API}/devrant/search`;
const params = {
app: 3,
term
};
return http
.GET(url, params)
.then(data => data.results);
} | [
"function",
"search",
"(",
"term",
"=",
"_noSearchTermError",
"(",
")",
")",
"{",
"const",
"url",
"=",
"`",
"${",
"API",
"}",
"`",
";",
"const",
"params",
"=",
"{",
"app",
":",
"3",
",",
"term",
"}",
";",
"return",
"http",
".",
"GET",
"(",
"url",... | Retrieve rants from devRant that match a specific search
term.
@param {String} term - the search term
@return {Promise} Resolves with the fetched rants | [
"Retrieve",
"rants",
"from",
"devRant",
"that",
"match",
"a",
"specific",
"search",
"term",
"."
] | d9938d2d0cd94823c69e291a2229f6cd799feddc | https://github.com/danillouz/devrant/blob/d9938d2d0cd94823c69e291a2229f6cd799feddc/src/index.js#L105-L115 |
35,470 | danillouz/devrant | src/index.js | profile | function profile(username = _noUsernameError()) {
return co(function *resolveUsername() {
const userId = yield _getIdByUsername(username);
const url = `${API}/users/${userId}`;
const params = { app: 3 };
return http
.GET(url, params)
.then(data => data.profile);
});
} | javascript | function profile(username = _noUsernameError()) {
return co(function *resolveUsername() {
const userId = yield _getIdByUsername(username);
const url = `${API}/users/${userId}`;
const params = { app: 3 };
return http
.GET(url, params)
.then(data => data.profile);
});
} | [
"function",
"profile",
"(",
"username",
"=",
"_noUsernameError",
"(",
")",
")",
"{",
"return",
"co",
"(",
"function",
"*",
"resolveUsername",
"(",
")",
"{",
"const",
"userId",
"=",
"yield",
"_getIdByUsername",
"(",
"username",
")",
";",
"const",
"url",
"="... | Retrieve the profile of a devRant user by username.
@param {String} username - the devRant username
@return {Promise} Resolves with the fetched user profile | [
"Retrieve",
"the",
"profile",
"of",
"a",
"devRant",
"user",
"by",
"username",
"."
] | d9938d2d0cd94823c69e291a2229f6cd799feddc | https://github.com/danillouz/devrant/blob/d9938d2d0cd94823c69e291a2229f6cd799feddc/src/index.js#L124-L134 |
35,471 | moimikey/iso3166-1 | src/index.js | to2 | function to2 (alpha3) {
if (alpha3 && alpha3.length > 1) state = alpha3
if (state.length !== 3) return state
return ISOCodes.filter(function (row) {
return row.alpha3 === state
})[0].alpha2
} | javascript | function to2 (alpha3) {
if (alpha3 && alpha3.length > 1) state = alpha3
if (state.length !== 3) return state
return ISOCodes.filter(function (row) {
return row.alpha3 === state
})[0].alpha2
} | [
"function",
"to2",
"(",
"alpha3",
")",
"{",
"if",
"(",
"alpha3",
"&&",
"alpha3",
".",
"length",
">",
"1",
")",
"state",
"=",
"alpha3",
"if",
"(",
"state",
".",
"length",
"!==",
"3",
")",
"return",
"state",
"return",
"ISOCodes",
".",
"filter",
"(",
... | Convert an ISO 3166-1 alpha-3 code to alpha-2
@param {String} alpha3 USA
@return {String} | [
"Convert",
"an",
"ISO",
"3166",
"-",
"1",
"alpha",
"-",
"3",
"code",
"to",
"alpha",
"-",
"2"
] | f3596c1957e5c35d2a33f71567265f0a3bf571b7 | https://github.com/moimikey/iso3166-1/blob/f3596c1957e5c35d2a33f71567265f0a3bf571b7/src/index.js#L14-L20 |
35,472 | moimikey/iso3166-1 | src/index.js | to3 | function to3 (alpha2) {
if (alpha2 && alpha2.length > 1) state = alpha2
if (state.length !== 2) return state
return ISOCodes.filter(function (row) {
return row.alpha2 === state
})[0].alpha3
} | javascript | function to3 (alpha2) {
if (alpha2 && alpha2.length > 1) state = alpha2
if (state.length !== 2) return state
return ISOCodes.filter(function (row) {
return row.alpha2 === state
})[0].alpha3
} | [
"function",
"to3",
"(",
"alpha2",
")",
"{",
"if",
"(",
"alpha2",
"&&",
"alpha2",
".",
"length",
">",
"1",
")",
"state",
"=",
"alpha2",
"if",
"(",
"state",
".",
"length",
"!==",
"2",
")",
"return",
"state",
"return",
"ISOCodes",
".",
"filter",
"(",
... | Convert an ISO 3166-1 alpha-2 code to alpha-3
@param {String} alpha2 US
@return {String} | [
"Convert",
"an",
"ISO",
"3166",
"-",
"1",
"alpha",
"-",
"2",
"code",
"to",
"alpha",
"-",
"3"
] | f3596c1957e5c35d2a33f71567265f0a3bf571b7 | https://github.com/moimikey/iso3166-1/blob/f3596c1957e5c35d2a33f71567265f0a3bf571b7/src/index.js#L28-L34 |
35,473 | 7digital/7digital-api | lib/resource.js | Resource | function Resource(options, schema) {
this.logger = options.logger;
this.resourceName = options.resourceDefinition.resource;
this.host = options.resourceDefinition.host || schema.host;
this.sslHost = options.resourceDefinition.sslHost || schema.sslHost;
this.port = options.resourceDefinition.port || schema.port;
t... | javascript | function Resource(options, schema) {
this.logger = options.logger;
this.resourceName = options.resourceDefinition.resource;
this.host = options.resourceDefinition.host || schema.host;
this.sslHost = options.resourceDefinition.sslHost || schema.sslHost;
this.port = options.resourceDefinition.port || schema.port;
t... | [
"function",
"Resource",
"(",
"options",
",",
"schema",
")",
"{",
"this",
".",
"logger",
"=",
"options",
".",
"logger",
";",
"this",
".",
"resourceName",
"=",
"options",
".",
"resourceDefinition",
".",
"resource",
";",
"this",
".",
"host",
"=",
"options",
... | A resource on the API, instances of this are used as the prototype of instances of each API resource. This constructor will build up a method for each action that can be performed on the resource. - @param {Object} options - @param {Object} schema The `options` argument should have the following properties: - `reso... | [
"A",
"resource",
"on",
"the",
"API",
"instances",
"of",
"this",
"are",
"used",
"as",
"the",
"prototype",
"of",
"instances",
"of",
"each",
"API",
"resource",
".",
"This",
"constructor",
"will",
"build",
"up",
"a",
"method",
"for",
"each",
"action",
"that",
... | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/resource.js#L24-L42 |
35,474 | MarkHerhold/palin | palin.js | truncFilename | function truncFilename(path, rootFolderName) {
// bail if a string wasn't provided
if (typeof path !== 'string') {
return path;
}
var index = path.indexOf(rootFolderName);
if (index > 0) {
return path.substring(index + rootFolderName.length + 1);
} else {
return path;
... | javascript | function truncFilename(path, rootFolderName) {
// bail if a string wasn't provided
if (typeof path !== 'string') {
return path;
}
var index = path.indexOf(rootFolderName);
if (index > 0) {
return path.substring(index + rootFolderName.length + 1);
} else {
return path;
... | [
"function",
"truncFilename",
"(",
"path",
",",
"rootFolderName",
")",
"{",
"// bail if a string wasn't provided",
"if",
"(",
"typeof",
"path",
"!==",
"'string'",
")",
"{",
"return",
"path",
";",
"}",
"var",
"index",
"=",
"path",
".",
"indexOf",
"(",
"rootFolde... | shortens the file name to exclude any path before the project folder name @param path: file path string. e.g. /home/mark/myproj/run.js @param rootFolderName: root folder for the project. e.g. "myproj" @return the shortened file path string | [
"shortens",
"the",
"file",
"name",
"to",
"exclude",
"any",
"path",
"before",
"the",
"project",
"folder",
"name"
] | 857ccd222bc649ab9be1411a049f76d779251fd8 | https://github.com/MarkHerhold/palin/blob/857ccd222bc649ab9be1411a049f76d779251fd8/palin.js#L11-L23 |
35,475 | MarkHerhold/palin | palin.js | getTimestampString | function getTimestampString(date) {
// all this nasty code is faster (~30k ops/sec) than doing "moment(date).format('HH:mm:ss:SSS')" and means 0 dependencies
var hour = '0' + date.getHours();
hour = hour.slice(hour.length - 2);
var minute = '0' + date.getMinutes();
minute = minute.slice(minute.lengt... | javascript | function getTimestampString(date) {
// all this nasty code is faster (~30k ops/sec) than doing "moment(date).format('HH:mm:ss:SSS')" and means 0 dependencies
var hour = '0' + date.getHours();
hour = hour.slice(hour.length - 2);
var minute = '0' + date.getMinutes();
minute = minute.slice(minute.lengt... | [
"function",
"getTimestampString",
"(",
"date",
")",
"{",
"// all this nasty code is faster (~30k ops/sec) than doing \"moment(date).format('HH:mm:ss:SSS')\" and means 0 dependencies",
"var",
"hour",
"=",
"'0'",
"+",
"date",
".",
"getHours",
"(",
")",
";",
"hour",
"=",
"hour",... | retruns the colorized timestamp string | [
"retruns",
"the",
"colorized",
"timestamp",
"string"
] | 857ccd222bc649ab9be1411a049f76d779251fd8 | https://github.com/MarkHerhold/palin/blob/857ccd222bc649ab9be1411a049f76d779251fd8/palin.js#L26-L45 |
35,476 | MarkHerhold/palin | palin.js | getColorSeverity | function getColorSeverity(severity) {
// get the color associated with the severity level
const color = severityMap[severity] || 'white';
return chalk[color].bold(severity.toUpperCase());
} | javascript | function getColorSeverity(severity) {
// get the color associated with the severity level
const color = severityMap[severity] || 'white';
return chalk[color].bold(severity.toUpperCase());
} | [
"function",
"getColorSeverity",
"(",
"severity",
")",
"{",
"// get the color associated with the severity level",
"const",
"color",
"=",
"severityMap",
"[",
"severity",
"]",
"||",
"'white'",
";",
"return",
"chalk",
"[",
"color",
"]",
".",
"bold",
"(",
"severity",
... | returns the colorized text for the given severity level | [
"returns",
"the",
"colorized",
"text",
"for",
"the",
"given",
"severity",
"level"
] | 857ccd222bc649ab9be1411a049f76d779251fd8 | https://github.com/MarkHerhold/palin/blob/857ccd222bc649ab9be1411a049f76d779251fd8/palin.js#L56-L60 |
35,477 | MarkHerhold/palin | palin.js | formatter | function formatter(options, severity, date, elems) {
/*
OPTIONS
*/
const indent = options.indent || defaultIndent;
const objectDepth = options.objectDepth;
const timestamp = (function () {
if (check.function(options.timestamp)) {
return options.timestamp; // user-provided ti... | javascript | function formatter(options, severity, date, elems) {
/*
OPTIONS
*/
const indent = options.indent || defaultIndent;
const objectDepth = options.objectDepth;
const timestamp = (function () {
if (check.function(options.timestamp)) {
return options.timestamp; // user-provided ti... | [
"function",
"formatter",
"(",
"options",
",",
"severity",
",",
"date",
",",
"elems",
")",
"{",
"/*\n OPTIONS\n */",
"const",
"indent",
"=",
"options",
".",
"indent",
"||",
"defaultIndent",
";",
"const",
"objectDepth",
"=",
"options",
".",
"objectDepth",
... | the formatter to export | [
"the",
"formatter",
"to",
"export"
] | 857ccd222bc649ab9be1411a049f76d779251fd8 | https://github.com/MarkHerhold/palin/blob/857ccd222bc649ab9be1411a049f76d779251fd8/palin.js#L83-L189 |
35,478 | 7digital/7digital-api | lib/responseparser.js | parse | function parse(response, opts, callback) {
var parser, jsonParseError, result;
if (opts.format.toUpperCase() === 'XML') {
callback(null, response);
return;
}
if (opts.contentType && opts.contentType.indexOf('json') >= 0) {
try {
result = JSON.parse(response);
} catch (e) {
jsonParseError = e;
}
... | javascript | function parse(response, opts, callback) {
var parser, jsonParseError, result;
if (opts.format.toUpperCase() === 'XML') {
callback(null, response);
return;
}
if (opts.contentType && opts.contentType.indexOf('json') >= 0) {
try {
result = JSON.parse(response);
} catch (e) {
jsonParseError = e;
}
... | [
"function",
"parse",
"(",
"response",
",",
"opts",
",",
"callback",
")",
"{",
"var",
"parser",
",",
"jsonParseError",
",",
"result",
";",
"if",
"(",
"opts",
".",
"format",
".",
"toUpperCase",
"(",
")",
"===",
"'XML'",
")",
"{",
"callback",
"(",
"null",... | Callback for parsing the XML response return from the API and converting it to JSON and handing control back to the caller. - @param {Function} callback - the caller's callback - @param {String} response - the XML response from the API - @parma {Object} opts - an options hash with the desired format and logger | [
"Callback",
"for",
"parsing",
"the",
"XML",
"response",
"return",
"from",
"the",
"API",
"and",
"converting",
"it",
"to",
"JSON",
"and",
"handing",
"control",
"back",
"to",
"the",
"caller",
".",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/responseparser.js#L17-L86 |
35,479 | 7digital/7digital-api | lib/errors.js | ApiHttpError | function ApiHttpError(statusCode, response, message) {
this.name = "ApiHttpError";
this.statusCode = statusCode;
this.response = response;
this.message = message || response
|| util.format('Unexpected %s status code', statusCode);
if (Error.captureStackTrace
&& typeof Error.captureStackTrace === 'function') {... | javascript | function ApiHttpError(statusCode, response, message) {
this.name = "ApiHttpError";
this.statusCode = statusCode;
this.response = response;
this.message = message || response
|| util.format('Unexpected %s status code', statusCode);
if (Error.captureStackTrace
&& typeof Error.captureStackTrace === 'function') {... | [
"function",
"ApiHttpError",
"(",
"statusCode",
",",
"response",
",",
"message",
")",
"{",
"this",
".",
"name",
"=",
"\"ApiHttpError\"",
";",
"this",
".",
"statusCode",
"=",
"statusCode",
";",
"this",
".",
"response",
"=",
"response",
";",
"this",
".",
"mes... | ApiHttpError Creates a new ApiHttpError supplied to callbacks when an error response is received at transport level. - @constructor - @param {Number} statusCode - The HTTP status code of the request. - @param {String} response - (Optional) The response body. - @param {String} message - (Optional) The message | [
"ApiHttpError",
"Creates",
"a",
"new",
"ApiHttpError",
"supplied",
"to",
"callbacks",
"when",
"an",
"error",
"response",
"is",
"received",
"at",
"transport",
"level",
".",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/errors.js#L25-L36 |
35,480 | 7digital/7digital-api | lib/errors.js | ApiParseError | function ApiParseError(parseErrorMessage, response) {
this.name = "ApiParseError";
this.response = response;
this.message = parseErrorMessage;
if (Error.captureStackTrace
&& typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, ApiParseError);
}
} | javascript | function ApiParseError(parseErrorMessage, response) {
this.name = "ApiParseError";
this.response = response;
this.message = parseErrorMessage;
if (Error.captureStackTrace
&& typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, ApiParseError);
}
} | [
"function",
"ApiParseError",
"(",
"parseErrorMessage",
",",
"response",
")",
"{",
"this",
".",
"name",
"=",
"\"ApiParseError\"",
";",
"this",
".",
"response",
"=",
"response",
";",
"this",
".",
"message",
"=",
"parseErrorMessage",
";",
"if",
"(",
"Error",
".... | ApiParseError Creates a new ApiParseError supplied to callbacks when an invalid or unexpected response is received. - @constructor - @param {String} parseErrorMessage - Custom error message describing the nature of the parse error. - @param {String} response - The response body string. | [
"ApiParseError",
"Creates",
"a",
"new",
"ApiParseError",
"supplied",
"to",
"callbacks",
"when",
"an",
"invalid",
"or",
"unexpected",
"response",
"is",
"received",
".",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/errors.js#L49-L58 |
35,481 | 7digital/7digital-api | lib/errors.js | RequestError | function RequestError(err, url) {
VError.call(this, err, 'for url %s', url);
this.name = RequestError.name;
} | javascript | function RequestError(err, url) {
VError.call(this, err, 'for url %s', url);
this.name = RequestError.name;
} | [
"function",
"RequestError",
"(",
"err",
",",
"url",
")",
"{",
"VError",
".",
"call",
"(",
"this",
",",
"err",
",",
"'for url %s'",
",",
"url",
")",
";",
"this",
".",
"name",
"=",
"RequestError",
".",
"name",
";",
"}"
] | RequestError Creates a new RequestError supplied to callbacks when the request to the api fails. | [
"RequestError",
"Creates",
"a",
"new",
"RequestError",
"supplied",
"to",
"callbacks",
"when",
"the",
"request",
"to",
"the",
"api",
"fails",
"."
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/errors.js#L67-L70 |
35,482 | 7digital/7digital-api | lib/errors.js | OAuthError | function OAuthError(errorResponse, message) {
this.name = "OAuthError";
this.message = message || errorResponse.errorMessage;
this.code = errorResponse.code;
this.response = errorResponse;
if (Error.captureStackTrace
&& typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, OAuthError)... | javascript | function OAuthError(errorResponse, message) {
this.name = "OAuthError";
this.message = message || errorResponse.errorMessage;
this.code = errorResponse.code;
this.response = errorResponse;
if (Error.captureStackTrace
&& typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, OAuthError)... | [
"function",
"OAuthError",
"(",
"errorResponse",
",",
"message",
")",
"{",
"this",
".",
"name",
"=",
"\"OAuthError\"",
";",
"this",
".",
"message",
"=",
"message",
"||",
"errorResponse",
".",
"errorMessage",
";",
"this",
".",
"code",
"=",
"errorResponse",
"."... | OAuthError Creates a new ApiError supplied to callbacks when a valid error response is received. - @constructor - @param {Object} errorResponse - The parsed API error response - @param {Object} message - The message | [
"OAuthError",
"Creates",
"a",
"new",
"ApiError",
"supplied",
"to",
"callbacks",
"when",
"a",
"valid",
"error",
"response",
"is",
"received",
".",
"-"
] | 3ca5db83d95a0361d997e2de72a215fb725b279d | https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/errors.js#L82-L92 |
35,483 | haroldiedema/joii | src/PrototypeBuilder.js | function(args, data, msg) {
if (typeof (args) !== 'object') {
args = [args];
}
for (var i in args) {
if (args.hasOwnProperty(i) === false) continue;
if (JOII.Compat.indexOf(data, args[i]) !== -1) {
throw msg;
}
}
} | javascript | function(args, data, msg) {
if (typeof (args) !== 'object') {
args = [args];
}
for (var i in args) {
if (args.hasOwnProperty(i) === false) continue;
if (JOII.Compat.indexOf(data, args[i]) !== -1) {
throw msg;
}
}
} | [
"function",
"(",
"args",
",",
"data",
",",
"msg",
")",
"{",
"if",
"(",
"typeof",
"(",
"args",
")",
"!==",
"'object'",
")",
"{",
"args",
"=",
"[",
"args",
"]",
";",
"}",
"for",
"(",
"var",
"i",
"in",
"args",
")",
"{",
"if",
"(",
"args",
".",
... | Shorthand for validating other flags within the same declaration. If args exists in data, msg is thrown. | [
"Shorthand",
"for",
"validating",
"other",
"flags",
"within",
"the",
"same",
"declaration",
".",
"If",
"args",
"exists",
"in",
"data",
"msg",
"is",
"thrown",
"."
] | 08f9b795109f01c584b769959d573ef9a799f6ba | https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/PrototypeBuilder.js#L604-L615 | |
35,484 | SamyPesse/octocat.js | src/page.js | parseLinkHeader | function parseLinkHeader(header) {
if (!header) {
return {};
}
// Split parts by comma
const parts = header.split(',');
const links = {};
// Parse each part into a named link
parts.forEach((p) => {
const section = p.split(';');
if (section.length != 2) {
... | javascript | function parseLinkHeader(header) {
if (!header) {
return {};
}
// Split parts by comma
const parts = header.split(',');
const links = {};
// Parse each part into a named link
parts.forEach((p) => {
const section = p.split(';');
if (section.length != 2) {
... | [
"function",
"parseLinkHeader",
"(",
"header",
")",
"{",
"if",
"(",
"!",
"header",
")",
"{",
"return",
"{",
"}",
";",
"}",
"// Split parts by comma",
"const",
"parts",
"=",
"header",
".",
"split",
"(",
"','",
")",
";",
"const",
"links",
"=",
"{",
"}",
... | Extract next and prev from link header
@param {String} header
@return {Object} | [
"Extract",
"next",
"and",
"prev",
"from",
"link",
"header"
] | 1cbc1c499d0f8595db34c4c0df498deba8e4099f | https://github.com/SamyPesse/octocat.js/blob/1cbc1c499d0f8595db34c4c0df498deba8e4099f/src/page.js#L113-L134 |
35,485 | haroldiedema/joii | src/Config.js | function (name) {
if (JOII.Config.constructors.indexOf(name) !== -1) {
return;
}
JOII.Config.constructors.push(name);
} | javascript | function (name) {
if (JOII.Config.constructors.indexOf(name) !== -1) {
return;
}
JOII.Config.constructors.push(name);
} | [
"function",
"(",
"name",
")",
"{",
"if",
"(",
"JOII",
".",
"Config",
".",
"constructors",
".",
"indexOf",
"(",
"name",
")",
"!==",
"-",
"1",
")",
"{",
"return",
";",
"}",
"JOII",
".",
"Config",
".",
"constructors",
".",
"push",
"(",
"name",
")",
... | Adds a constructor method name. The first occurance of a function
named like one of these is executed. The rest is ignored to prevent
ambiguous behavior.
@param {string} name | [
"Adds",
"a",
"constructor",
"method",
"name",
".",
"The",
"first",
"occurance",
"of",
"a",
"function",
"named",
"like",
"one",
"of",
"these",
"is",
"executed",
".",
"The",
"rest",
"is",
"ignored",
"to",
"prevent",
"ambiguous",
"behavior",
"."
] | 08f9b795109f01c584b769959d573ef9a799f6ba | https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Config.js#L25-L31 | |
35,486 | haroldiedema/joii | src/Config.js | function(name) {
if (JOII.Config.constructors.indexOf(name) === -1) {
return;
}
JOII.Config.constructors.splice(JOII.Config.constructors.indexOf(name), 1);
} | javascript | function(name) {
if (JOII.Config.constructors.indexOf(name) === -1) {
return;
}
JOII.Config.constructors.splice(JOII.Config.constructors.indexOf(name), 1);
} | [
"function",
"(",
"name",
")",
"{",
"if",
"(",
"JOII",
".",
"Config",
".",
"constructors",
".",
"indexOf",
"(",
"name",
")",
"===",
"-",
"1",
")",
"{",
"return",
";",
"}",
"JOII",
".",
"Config",
".",
"constructors",
".",
"splice",
"(",
"JOII",
".",
... | Removes a constructor method name. The first occurance of a function
named like one of these is executed. The rest is ignored to prevent
ambiguous behavior.
@param {string} name | [
"Removes",
"a",
"constructor",
"method",
"name",
".",
"The",
"first",
"occurance",
"of",
"a",
"function",
"named",
"like",
"one",
"of",
"these",
"is",
"executed",
".",
"The",
"rest",
"is",
"ignored",
"to",
"prevent",
"ambiguous",
"behavior",
"."
] | 08f9b795109f01c584b769959d573ef9a799f6ba | https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Config.js#L40-L46 | |
35,487 | dannymidnight/node-weather | yahoo.js | function(msg) {
if (yahoo.logging) {
console.log('ERROR: ' + msg);
}
if (module.exports.error) {
module.exports.error(msg);
}
} | javascript | function(msg) {
if (yahoo.logging) {
console.log('ERROR: ' + msg);
}
if (module.exports.error) {
module.exports.error(msg);
}
} | [
"function",
"(",
"msg",
")",
"{",
"if",
"(",
"yahoo",
".",
"logging",
")",
"{",
"console",
".",
"log",
"(",
"'ERROR: '",
"+",
"msg",
")",
";",
"}",
"if",
"(",
"module",
".",
"exports",
".",
"error",
")",
"{",
"module",
".",
"exports",
".",
"error... | Report error. | [
"Report",
"error",
"."
] | 6658662f8641ed272a93c280b327429f23c6d3d8 | https://github.com/dannymidnight/node-weather/blob/6658662f8641ed272a93c280b327429f23c6d3d8/yahoo.js#L15-L23 | |
35,488 | telligro/opal-nodes | packages/opal-node-email/emailprocess.js | processNewMessage | function processNewMessage(msg, mailMessage) {
// msg = JSON.parse(JSON.stringify(msg)); // Clone the message
// Populate the msg fields from the content of the email message
// that we have just parsed.
msg.payload = mailMessage.text;
msg.... | javascript | function processNewMessage(msg, mailMessage) {
// msg = JSON.parse(JSON.stringify(msg)); // Clone the message
// Populate the msg fields from the content of the email message
// that we have just parsed.
msg.payload = mailMessage.text;
msg.... | [
"function",
"processNewMessage",
"(",
"msg",
",",
"mailMessage",
")",
"{",
"// msg = JSON.parse(JSON.stringify(msg)); // Clone the message",
"// Populate the msg fields from the content of the email message",
"// that we have just parsed.",
"msg",
".",
"payload",
"=",
"mailMessage",
... | Process a new email message by building a Node-RED message to be passed onwards in the message flow. The parameter called `msg` is the template message we start with while `mailMessage` is an object returned from `mailparser` that will be used to populate the email.
Process a new email message by building a Node-RED ... | [
"Process",
"a",
"new",
"email",
"message",
"by",
"building",
"a",
"Node",
"-",
"RED",
"message",
"to",
"be",
"passed",
"onwards",
"in",
"the",
"message",
"flow",
".",
"The",
"parameter",
"called",
"msg",
"is",
"the",
"template",
"message",
"we",
"start",
... | 028e02b8ef9709ba548e153db446931c6d7a385d | https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-email/emailprocess.js#L352-L381 |
35,489 | telligro/opal-nodes | packages/opal-node-email/emailprocess.js | checkPOP3 | function checkPOP3(msg) {
let currentMessage;
let maxMessage;
// Form a new connection to our email server using POP3.
let pop3Client = new POP3Client(
node.port, node.server,
{enabletls: node.useSSL} // Should we u... | javascript | function checkPOP3(msg) {
let currentMessage;
let maxMessage;
// Form a new connection to our email server using POP3.
let pop3Client = new POP3Client(
node.port, node.server,
{enabletls: node.useSSL} // Should we u... | [
"function",
"checkPOP3",
"(",
"msg",
")",
"{",
"let",
"currentMessage",
";",
"let",
"maxMessage",
";",
"// Form a new connection to our email server using POP3.",
"let",
"pop3Client",
"=",
"new",
"POP3Client",
"(",
"node",
".",
"port",
",",
"node",
".",
"server",
... | Check the POP3 email mailbox for any new messages. For any that are found, retrieve each message, call processNewMessage to process it and then delete
Check the POP3 email mailbox for any new messages. For any that are found,
retrieve each message, call processNewMessage to process it and then delete
@param {any} m... | [
"Check",
"the",
"POP3",
"email",
"mailbox",
"for",
"any",
"new",
"messages",
".",
"For",
"any",
"that",
"are",
"found",
"retrieve",
"each",
"message",
"call",
"processNewMessage",
"to",
"process",
"it",
"and",
"then",
"delete",
"Check",
"the",
"POP3",
"email... | 028e02b8ef9709ba548e153db446931c6d7a385d | https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-email/emailprocess.js#L391-L480 |
35,490 | telligro/opal-nodes | packages/opal-node-email/emailprocess.js | processValuesFromContext | function processValuesFromContext(node, params, msg, varList) {
let pMsg = {};
Object.assign(pMsg, params);
varList.forEach((varItem) => {
if (varItem.type === undefined || params[varItem.type] === undefined) {
pMsg[varItem.name... | javascript | function processValuesFromContext(node, params, msg, varList) {
let pMsg = {};
Object.assign(pMsg, params);
varList.forEach((varItem) => {
if (varItem.type === undefined || params[varItem.type] === undefined) {
pMsg[varItem.name... | [
"function",
"processValuesFromContext",
"(",
"node",
",",
"params",
",",
"msg",
",",
"varList",
")",
"{",
"let",
"pMsg",
"=",
"{",
"}",
";",
"Object",
".",
"assign",
"(",
"pMsg",
",",
"params",
")",
";",
"varList",
".",
"forEach",
"(",
"(",
"varItem",
... | End of checkEmail
proccess values from context
@param {any} node __DOCSPLACEHOLDER__
@param {any} params __DOCSPLACEHOLDER__
@param {any} msg __DOCSPLACEHOLDER__
@param {any} varList __DOCSPLACEHOLDER__
@return {object} pMsg | [
"End",
"of",
"checkEmail",
"proccess",
"values",
"from",
"context"
] | 028e02b8ef9709ba548e153db446931c6d7a385d | https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-email/emailprocess.js#L650-L667 |
35,491 | nodebox/g.js | src/g.js | splitRow | function splitRow(s, delimiter) {
var row = [], c, col = '', i, inString = false;
s = s.trim();
for (i = 0; i < s.length; i += 1) {
c = s[i];
if (c === '"') {
if (s[i+1] === '"') {
col += '"';
i += 1;
} else {
inString =... | javascript | function splitRow(s, delimiter) {
var row = [], c, col = '', i, inString = false;
s = s.trim();
for (i = 0; i < s.length; i += 1) {
c = s[i];
if (c === '"') {
if (s[i+1] === '"') {
col += '"';
i += 1;
} else {
inString =... | [
"function",
"splitRow",
"(",
"s",
",",
"delimiter",
")",
"{",
"var",
"row",
"=",
"[",
"]",
",",
"c",
",",
"col",
"=",
"''",
",",
"i",
",",
"inString",
"=",
"false",
";",
"s",
"=",
"s",
".",
"trim",
"(",
")",
";",
"for",
"(",
"i",
"=",
"0",
... | Split the row, taking quotes into account. | [
"Split",
"the",
"row",
"taking",
"quotes",
"into",
"account",
"."
] | 4ef0c579a607a38337fbf9f36f176b35eb7092d2 | https://github.com/nodebox/g.js/blob/4ef0c579a607a38337fbf9f36f176b35eb7092d2/src/g.js#L49-L74 |
35,492 | haroldiedema/joii | src/Reflection.js | function(name) {
var list = this.getProperties();
for (var i in list) {
if (list[i].getName() === name) {
return true;
}
}
return false;
} | javascript | function(name) {
var list = this.getProperties();
for (var i in list) {
if (list[i].getName() === name) {
return true;
}
}
return false;
} | [
"function",
"(",
"name",
")",
"{",
"var",
"list",
"=",
"this",
".",
"getProperties",
"(",
")",
";",
"for",
"(",
"var",
"i",
"in",
"list",
")",
"{",
"if",
"(",
"list",
"[",
"i",
"]",
".",
"getName",
"(",
")",
"===",
"name",
")",
"{",
"return",
... | Returns true if a property by the given name exists.
@return bool | [
"Returns",
"true",
"if",
"a",
"property",
"by",
"the",
"given",
"name",
"exists",
"."
] | 08f9b795109f01c584b769959d573ef9a799f6ba | https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L106-L114 | |
35,493 | haroldiedema/joii | src/Reflection.js | function(filter) {
var result = [];
for (var i in this.proto) {
if (typeof (this.proto[i]) === 'function' && JOII.Compat.indexOf(JOII.InternalPropertyNames, i) === -1) {
result.push(new JOII.Reflection.Method(this, i));
}
}
return result;
} | javascript | function(filter) {
var result = [];
for (var i in this.proto) {
if (typeof (this.proto[i]) === 'function' && JOII.Compat.indexOf(JOII.InternalPropertyNames, i) === -1) {
result.push(new JOII.Reflection.Method(this, i));
}
}
return result;
} | [
"function",
"(",
"filter",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"in",
"this",
".",
"proto",
")",
"{",
"if",
"(",
"typeof",
"(",
"this",
".",
"proto",
"[",
"i",
"]",
")",
"===",
"'function'",
"&&",
"JOII",
".",
... | Returns an array of JOII.Reflection.Method based on the methods
defined in this class.
@param string filter Optional filter for 'private' or 'public'.
@return JOII.Reflection.Method[] | [
"Returns",
"an",
"array",
"of",
"JOII",
".",
"Reflection",
".",
"Method",
"based",
"on",
"the",
"methods",
"defined",
"in",
"this",
"class",
"."
] | 08f9b795109f01c584b769959d573ef9a799f6ba | https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L141-L149 | |
35,494 | haroldiedema/joii | src/Reflection.js | function(name) {
var list = this.getMethods();
for (var i in list) {
if (list[i].getName() === name) {
return true;
}
}
return false;
} | javascript | function(name) {
var list = this.getMethods();
for (var i in list) {
if (list[i].getName() === name) {
return true;
}
}
return false;
} | [
"function",
"(",
"name",
")",
"{",
"var",
"list",
"=",
"this",
".",
"getMethods",
"(",
")",
";",
"for",
"(",
"var",
"i",
"in",
"list",
")",
"{",
"if",
"(",
"list",
"[",
"i",
"]",
".",
"getName",
"(",
")",
"===",
"name",
")",
"{",
"return",
"t... | Returns true if a method by the given name exists.
@return bool | [
"Returns",
"true",
"if",
"a",
"method",
"by",
"the",
"given",
"name",
"exists",
"."
] | 08f9b795109f01c584b769959d573ef9a799f6ba | https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L156-L164 | |
35,495 | haroldiedema/joii | src/Reflection.js | function(name) {
var list = this.getMethods();
for (var i in list) {
if (list[i].getName() === name) {
return list[i];
}
}
throw 'Method "' + name + '" does not exist.';
} | javascript | function(name) {
var list = this.getMethods();
for (var i in list) {
if (list[i].getName() === name) {
return list[i];
}
}
throw 'Method "' + name + '" does not exist.';
} | [
"function",
"(",
"name",
")",
"{",
"var",
"list",
"=",
"this",
".",
"getMethods",
"(",
")",
";",
"for",
"(",
"var",
"i",
"in",
"list",
")",
"{",
"if",
"(",
"list",
"[",
"i",
"]",
".",
"getName",
"(",
")",
"===",
"name",
")",
"{",
"return",
"l... | Returns an instance of JOII.Reflection.Method of a method by the
given name.
@param string name
@return JOII.Reflection.Method | [
"Returns",
"an",
"instance",
"of",
"JOII",
".",
"Reflection",
".",
"Method",
"of",
"a",
"method",
"by",
"the",
"given",
"name",
"."
] | 08f9b795109f01c584b769959d573ef9a799f6ba | https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L173-L181 | |
35,496 | haroldiedema/joii | src/Reflection.js | function(name) {
var list = this.getProperties();
for (var i in list) {
if (list[i].getName() === name) {
return list[i];
}
}
throw 'Property "' + name + '" does not exist.';
} | javascript | function(name) {
var list = this.getProperties();
for (var i in list) {
if (list[i].getName() === name) {
return list[i];
}
}
throw 'Property "' + name + '" does not exist.';
} | [
"function",
"(",
"name",
")",
"{",
"var",
"list",
"=",
"this",
".",
"getProperties",
"(",
")",
";",
"for",
"(",
"var",
"i",
"in",
"list",
")",
"{",
"if",
"(",
"list",
"[",
"i",
"]",
".",
"getName",
"(",
")",
"===",
"name",
")",
"{",
"return",
... | Returns an instance of JOII.Reflection.Property of a property by the
given name.
@param string name
@return JOII.Reflection.Property | [
"Returns",
"an",
"instance",
"of",
"JOII",
".",
"Reflection",
".",
"Property",
"of",
"a",
"property",
"by",
"the",
"given",
"name",
"."
] | 08f9b795109f01c584b769959d573ef9a799f6ba | https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L207-L215 | |
35,497 | haroldiedema/joii | src/Reflection.js | function() {
var name_parts = [],
proto_ref = this.reflector.getProto()[this.name],
name = '',
body = '';
if (this.meta.is_abstract) { name_parts.push('abstract'); }
if (this.meta.is_final) { name_parts.push('final'); }
name_parts.push(t... | javascript | function() {
var name_parts = [],
proto_ref = this.reflector.getProto()[this.name],
name = '',
body = '';
if (this.meta.is_abstract) { name_parts.push('abstract'); }
if (this.meta.is_final) { name_parts.push('final'); }
name_parts.push(t... | [
"function",
"(",
")",
"{",
"var",
"name_parts",
"=",
"[",
"]",
",",
"proto_ref",
"=",
"this",
".",
"reflector",
".",
"getProto",
"(",
")",
"[",
"this",
".",
"name",
"]",
",",
"name",
"=",
"''",
",",
"body",
"=",
"''",
";",
"if",
"(",
"this",
".... | Returns a string representation of this object.
@return string | [
"Returns",
"a",
"string",
"representation",
"of",
"this",
"object",
"."
] | 08f9b795109f01c584b769959d573ef9a799f6ba | https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L392-L432 | |
35,498 | haroldiedema/joii | src/Reflection.js | function() {
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m,
FN_ARG_SPLIT = /,/,
FN_ARG = /^\s*(_?)(\S+?)\1\s*$/,
STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,
getParams = function(fn) {
var fnText, argDecl;
... | javascript | function() {
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m,
FN_ARG_SPLIT = /,/,
FN_ARG = /^\s*(_?)(\S+?)\1\s*$/,
STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,
getParams = function(fn) {
var fnText, argDecl;
... | [
"function",
"(",
")",
"{",
"var",
"FN_ARGS",
"=",
"/",
"^function\\s*[^\\(]*\\(\\s*([^\\)]*)\\)",
"/",
"m",
",",
"FN_ARG_SPLIT",
"=",
"/",
",",
"/",
",",
"FN_ARG",
"=",
"/",
"^\\s*(_?)(\\S+?)\\1\\s*$",
"/",
",",
"STRIP_COMMENTS",
"=",
"/",
"((\\/\\/.*$)|(\\/\\*[... | Returns an array of strings based on the parameters defined in
the declared function.
@return string[] | [
"Returns",
"an",
"array",
"of",
"strings",
"based",
"on",
"the",
"parameters",
"defined",
"in",
"the",
"declared",
"function",
"."
] | 08f9b795109f01c584b769959d573ef9a799f6ba | https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L443-L493 | |
35,499 | haroldiedema/joii | src/Reflection.js | function(f) {
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,
fn_text = this.reflector.getProto()[this.name].toString().replace(STRIP_COMMENTS, '');
return fn_text.substr(fn_text.indexOf('{') + 1, fn_text.lastIndexOf('}') - 4).replace(/}([^}]*)$/, '$1');
} | javascript | function(f) {
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,
fn_text = this.reflector.getProto()[this.name].toString().replace(STRIP_COMMENTS, '');
return fn_text.substr(fn_text.indexOf('{') + 1, fn_text.lastIndexOf('}') - 4).replace(/}([^}]*)$/, '$1');
} | [
"function",
"(",
"f",
")",
"{",
"var",
"STRIP_COMMENTS",
"=",
"/",
"((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))",
"/",
"mg",
",",
"fn_text",
"=",
"this",
".",
"reflector",
".",
"getProto",
"(",
")",
"[",
"this",
".",
"name",
"]",
".",
"toString",
"(",
")",
".... | Returns the body of this method as a string.
@return string | [
"Returns",
"the",
"body",
"of",
"this",
"method",
"as",
"a",
"string",
"."
] | 08f9b795109f01c584b769959d573ef9a799f6ba | https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L500-L505 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.