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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
51,000 | sendanor/nor-nopg | src/nopg.js | wrap_casts | function wrap_casts(x) {
x = '' + x;
if(/^\(.+\)$/.test(x)) {
return '(' + x + ')';
}
if(/::[a-z]+$/.test(x)) {
if(/^[a-z]+ \->> /.test(x)) {
return '((' + x + '))';
}
return '(' + x + ')';
}
return x;
} | javascript | function wrap_casts(x) {
x = '' + x;
if(/^\(.+\)$/.test(x)) {
return '(' + x + ')';
}
if(/::[a-z]+$/.test(x)) {
if(/^[a-z]+ \->> /.test(x)) {
return '((' + x + '))';
}
return '(' + x + ')';
}
return x;
} | [
"function",
"wrap_casts",
"(",
"x",
")",
"{",
"x",
"=",
"''",
"+",
"x",
";",
"if",
"(",
"/",
"^\\(.+\\)$",
"/",
".",
"test",
"(",
"x",
")",
")",
"{",
"return",
"'('",
"+",
"x",
"+",
"')'",
";",
"}",
"if",
"(",
"/",
"::[a-z]+$",
"/",
".",
"t... | Wrap parenthesis around casts
@param x
@return {*} | [
"Wrap",
"parenthesis",
"around",
"casts"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/nopg.js#L1448-L1460 |
51,001 | sendanor/nor-nopg | src/nopg.js | pg_create_index_query_internal_v1 | function pg_create_index_query_internal_v1(self, ObjType, type, field, typefield, is_unique) {
var query;
var pgcast = parse_predicate_pgcast(ObjType, type, field);
var colname = _parse_predicate_key(ObjType, {'epoch':false}, field);
var name = pg_create_index_name(self, ObjType, type, field, typefield);
query = "... | javascript | function pg_create_index_query_internal_v1(self, ObjType, type, field, typefield, is_unique) {
var query;
var pgcast = parse_predicate_pgcast(ObjType, type, field);
var colname = _parse_predicate_key(ObjType, {'epoch':false}, field);
var name = pg_create_index_name(self, ObjType, type, field, typefield);
query = "... | [
"function",
"pg_create_index_query_internal_v1",
"(",
"self",
",",
"ObjType",
",",
"type",
",",
"field",
",",
"typefield",
",",
"is_unique",
")",
"{",
"var",
"query",
";",
"var",
"pgcast",
"=",
"parse_predicate_pgcast",
"(",
"ObjType",
",",
"type",
",",
"field... | Returns index query
@param self
@param ObjType
@param type
@param field
@param typefield
@param is_unique
@return {string | *} | [
"Returns",
"index",
"query"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/nopg.js#L1471-L1486 |
51,002 | sendanor/nor-nopg | src/nopg.js | pg_declare_index | function pg_declare_index(self, ObjType, type, field, typefield, is_unique) {
var colname = _parse_predicate_key(ObjType, {'epoch':false}, field);
var datakey = colname.getMeta('datakey');
var field_name = (datakey ? datakey + '.' : '' ) + colname.getMeta('key');
var name = pg_create_index_name(self, ObjType, type,... | javascript | function pg_declare_index(self, ObjType, type, field, typefield, is_unique) {
var colname = _parse_predicate_key(ObjType, {'epoch':false}, field);
var datakey = colname.getMeta('datakey');
var field_name = (datakey ? datakey + '.' : '' ) + colname.getMeta('key');
var name = pg_create_index_name(self, ObjType, type,... | [
"function",
"pg_declare_index",
"(",
"self",
",",
"ObjType",
",",
"type",
",",
"field",
",",
"typefield",
",",
"is_unique",
")",
"{",
"var",
"colname",
"=",
"_parse_predicate_key",
"(",
"ObjType",
",",
"{",
"'epoch'",
":",
"false",
"}",
",",
"field",
")",
... | Internal CREATE INDEX query that will create the index only if the relation does not exists already
@param self
@param ObjType
@param type
@param field
@param typefield
@param is_unique
@return {Promise.<TResult>} | [
"Internal",
"CREATE",
"INDEX",
"query",
"that",
"will",
"create",
"the",
"index",
"only",
"if",
"the",
"relation",
"does",
"not",
"exists",
"already"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/nopg.js#L1594-L1622 |
51,003 | sendanor/nor-nopg | src/nopg.js | pg_query | function pg_query(query, params) {
return function(db) {
var start_time = new Date();
return do_query(db, query, params).then(function() {
var end_time = new Date();
db._record_sample({
'event': 'query',
'start': start_time,
'end': end_time,
'query': query,
'params': params
});
r... | javascript | function pg_query(query, params) {
return function(db) {
var start_time = new Date();
return do_query(db, query, params).then(function() {
var end_time = new Date();
db._record_sample({
'event': 'query',
'start': start_time,
'end': end_time,
'query': query,
'params': params
});
r... | [
"function",
"pg_query",
"(",
"query",
",",
"params",
")",
"{",
"return",
"function",
"(",
"db",
")",
"{",
"var",
"start_time",
"=",
"new",
"Date",
"(",
")",
";",
"return",
"do_query",
"(",
"db",
",",
"query",
",",
"params",
")",
".",
"then",
"(",
"... | Run query on the PostgreSQL server
@param query
@param params
@return {Function} | [
"Run",
"query",
"on",
"the",
"PostgreSQL",
"server"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/nopg.js#L1731-L1749 |
51,004 | sendanor/nor-nopg | src/nopg.js | create_watchdog | function create_watchdog(db, opts) {
debug.assert(db).is('object');
opts = opts || {};
debug.assert(opts).is('object');
opts.timeout = opts.timeout || 30000;
debug.assert(opts.timeout).is('number');
var w = {};
w.db = db;
w.opts = opts;
/* Setup */
w.timeout = setTimeout(function() {
debug.warn('Got t... | javascript | function create_watchdog(db, opts) {
debug.assert(db).is('object');
opts = opts || {};
debug.assert(opts).is('object');
opts.timeout = opts.timeout || 30000;
debug.assert(opts.timeout).is('number');
var w = {};
w.db = db;
w.opts = opts;
/* Setup */
w.timeout = setTimeout(function() {
debug.warn('Got t... | [
"function",
"create_watchdog",
"(",
"db",
",",
"opts",
")",
"{",
"debug",
".",
"assert",
"(",
"db",
")",
".",
"is",
"(",
"'object'",
")",
";",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"debug",
".",
"assert",
"(",
"opts",
")",
".",
"is",
"(",
"... | Create watchdog timer
@param db
@param opts
@return {{}} | [
"Create",
"watchdog",
"timer"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/nopg.js#L1756-L1847 |
51,005 | sendanor/nor-nopg | src/nopg.js | create_tcn_listener | function create_tcn_listener(events, when) {
debug.assert(events).is('object');
debug.assert(when).is('object');
// Normalize event object back to event name
var when_str = NoPg.stringifyEventName(when);
return function tcn_listener(payload) {
payload = NoPg.parseTCNPayload(payload);
var event = tcn_event_m... | javascript | function create_tcn_listener(events, when) {
debug.assert(events).is('object');
debug.assert(when).is('object');
// Normalize event object back to event name
var when_str = NoPg.stringifyEventName(when);
return function tcn_listener(payload) {
payload = NoPg.parseTCNPayload(payload);
var event = tcn_event_m... | [
"function",
"create_tcn_listener",
"(",
"events",
",",
"when",
")",
"{",
"debug",
".",
"assert",
"(",
"events",
")",
".",
"is",
"(",
"'object'",
")",
";",
"debug",
".",
"assert",
"(",
"when",
")",
".",
"is",
"(",
"'object'",
")",
";",
"// Normalize eve... | Returns a listener for notifications from TCN extension
@param events {EventEmitter} The event emitter where we should trigger matching events.
@param when {object} We should only trigger events that match this specification. Object with optional properties
`type`, `id` and `name`. | [
"Returns",
"a",
"listener",
"for",
"notifications",
"from",
"TCN",
"extension"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/nopg.js#L2456-L2485 |
51,006 | sendanor/nor-nopg | src/nopg.js | new_listener | function new_listener(event/*, listener*/) {
// Ignore if not tcn event
if(NoPg.isLocalEventName(event)) {
return;
}
event = NoPg.parseEventName(event);
// Stringifying back the event normalizes the original event name
var event_name = NoPg.stringifyEventName(event);
var channel_name = NoPg... | javascript | function new_listener(event/*, listener*/) {
// Ignore if not tcn event
if(NoPg.isLocalEventName(event)) {
return;
}
event = NoPg.parseEventName(event);
// Stringifying back the event normalizes the original event name
var event_name = NoPg.stringifyEventName(event);
var channel_name = NoPg... | [
"function",
"new_listener",
"(",
"event",
"/*, listener*/",
")",
"{",
"// Ignore if not tcn event",
"if",
"(",
"NoPg",
".",
"isLocalEventName",
"(",
"event",
")",
")",
"{",
"return",
";",
"}",
"event",
"=",
"NoPg",
".",
"parseEventName",
"(",
"event",
")",
"... | Listener for new listeners | [
"Listener",
"for",
"new",
"listeners"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/nopg.js#L2508-L2540 |
51,007 | sendanor/nor-nopg | src/nopg.js | remove_listener | function remove_listener(event/*, listener*/) {
// Ignore if not tcn event
if(NoPg.isLocalEventName(event)) {
return;
}
event = NoPg.parseEventName(event);
// Stringifying back the event normalizes the original event name
var event_name = NoPg.stringifyEventName(event);
var channel_name = N... | javascript | function remove_listener(event/*, listener*/) {
// Ignore if not tcn event
if(NoPg.isLocalEventName(event)) {
return;
}
event = NoPg.parseEventName(event);
// Stringifying back the event normalizes the original event name
var event_name = NoPg.stringifyEventName(event);
var channel_name = N... | [
"function",
"remove_listener",
"(",
"event",
"/*, listener*/",
")",
"{",
"// Ignore if not tcn event",
"if",
"(",
"NoPg",
".",
"isLocalEventName",
"(",
"event",
")",
")",
"{",
"return",
";",
"}",
"event",
"=",
"NoPg",
".",
"parseEventName",
"(",
"event",
")",
... | Listener for removing listeners | [
"Listener",
"for",
"removing",
"listeners"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/nopg.js#L2543-L2564 |
51,008 | sendanor/nor-nopg | src/nopg.js | pad | function pad(num, size) {
var s = num+"";
while (s.length < size) {
s = "0" + s;
}
return s;
} | javascript | function pad(num, size) {
var s = num+"";
while (s.length < size) {
s = "0" + s;
}
return s;
} | [
"function",
"pad",
"(",
"num",
",",
"size",
")",
"{",
"var",
"s",
"=",
"num",
"+",
"\"\"",
";",
"while",
"(",
"s",
".",
"length",
"<",
"size",
")",
"{",
"s",
"=",
"\"0\"",
"+",
"s",
";",
"}",
"return",
"s",
";",
"}"
] | Returns a number padded to specific width
@param num
@param size
@return {string} | [
"Returns",
"a",
"number",
"padded",
"to",
"specific",
"width"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/nopg.js#L2655-L2661 |
51,009 | sendanor/nor-nopg | src/nopg.js | reset_methods | function reset_methods(doc) {
if(is.array(doc)) {
return ARRAY(doc).map(reset_methods).valueOf();
}
if(is.object(doc)) {
ARRAY(methods).forEach(function(method) {
delete doc[method.$name];
});
}
return doc;
} | javascript | function reset_methods(doc) {
if(is.array(doc)) {
return ARRAY(doc).map(reset_methods).valueOf();
}
if(is.object(doc)) {
ARRAY(methods).forEach(function(method) {
delete doc[method.$name];
});
}
return doc;
} | [
"function",
"reset_methods",
"(",
"doc",
")",
"{",
"if",
"(",
"is",
".",
"array",
"(",
"doc",
")",
")",
"{",
"return",
"ARRAY",
"(",
"doc",
")",
".",
"map",
"(",
"reset_methods",
")",
".",
"valueOf",
"(",
")",
";",
"}",
"if",
"(",
"is",
".",
"o... | Removes methods from doc | [
"Removes",
"methods",
"from",
"doc"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/nopg.js#L3175-L3188 |
51,010 | gyuwon/node-fwalker | fwalker.js | Walker | function Walker () {
var self = this;
var walkSync = function (dir, trace, callback) {
fs.readdirSync(dir).forEach(function (name) {
var file = path.join(dir, name)
, stat = fs.lstatSync(file)
, isDir = stat.isDirectory()
, _trace = trace;
try {
callback(name, file, ... | javascript | function Walker () {
var self = this;
var walkSync = function (dir, trace, callback) {
fs.readdirSync(dir).forEach(function (name) {
var file = path.join(dir, name)
, stat = fs.lstatSync(file)
, isDir = stat.isDirectory()
, _trace = trace;
try {
callback(name, file, ... | [
"function",
"Walker",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"walkSync",
"=",
"function",
"(",
"dir",
",",
"trace",
",",
"callback",
")",
"{",
"fs",
".",
"readdirSync",
"(",
"dir",
")",
".",
"forEach",
"(",
"function",
"(",
"name",
... | Initialize a new instance of the simple file traversal modules. | [
"Initialize",
"a",
"new",
"instance",
"of",
"the",
"simple",
"file",
"traversal",
"modules",
"."
] | 6e31a1f6da9b0be516ceab9035e87f2934d6aac6 | https://github.com/gyuwon/node-fwalker/blob/6e31a1f6da9b0be516ceab9035e87f2934d6aac6/fwalker.js#L33-L77 |
51,011 | MostlyJS/mostly-feathers-mongoose | src/mongoose.js | getModel | function getModel (app, name, Model) {
const mongooseClient = app.get('mongoose');
assert(mongooseClient, 'mongoose client not set by app');
const modelNames = mongooseClient.modelNames();
if (modelNames.includes(name)) {
return mongooseClient.model(name);
} else {
assert(Model && typeof Model === 'fu... | javascript | function getModel (app, name, Model) {
const mongooseClient = app.get('mongoose');
assert(mongooseClient, 'mongoose client not set by app');
const modelNames = mongooseClient.modelNames();
if (modelNames.includes(name)) {
return mongooseClient.model(name);
} else {
assert(Model && typeof Model === 'fu... | [
"function",
"getModel",
"(",
"app",
",",
"name",
",",
"Model",
")",
"{",
"const",
"mongooseClient",
"=",
"app",
".",
"get",
"(",
"'mongoose'",
")",
";",
"assert",
"(",
"mongooseClient",
",",
"'mongoose client not set by app'",
")",
";",
"const",
"modelNames",
... | Get or create the mongoose model if not exists | [
"Get",
"or",
"create",
"the",
"mongoose",
"model",
"if",
"not",
"exists"
] | d20e150e054c784cc7db7c2487399e4f4eb730de | https://github.com/MostlyJS/mostly-feathers-mongoose/blob/d20e150e054c784cc7db7c2487399e4f4eb730de/src/mongoose.js#L46-L56 |
51,012 | MostlyJS/mostly-feathers-mongoose | src/mongoose.js | createModel | function createModel (app, name, options) {
const mongooseClient = app.get('mongoose');
assert(mongooseClient, 'mongoose client not set by app');
const schema = new mongooseClient.Schema({ any: {} }, {strict: false});
return mongooseClient.model(name, schema);
} | javascript | function createModel (app, name, options) {
const mongooseClient = app.get('mongoose');
assert(mongooseClient, 'mongoose client not set by app');
const schema = new mongooseClient.Schema({ any: {} }, {strict: false});
return mongooseClient.model(name, schema);
} | [
"function",
"createModel",
"(",
"app",
",",
"name",
",",
"options",
")",
"{",
"const",
"mongooseClient",
"=",
"app",
".",
"get",
"(",
"'mongoose'",
")",
";",
"assert",
"(",
"mongooseClient",
",",
"'mongoose client not set by app'",
")",
";",
"const",
"schema",... | Create a mongoose model with free schema | [
"Create",
"a",
"mongoose",
"model",
"with",
"free",
"schema"
] | d20e150e054c784cc7db7c2487399e4f4eb730de | https://github.com/MostlyJS/mostly-feathers-mongoose/blob/d20e150e054c784cc7db7c2487399e4f4eb730de/src/mongoose.js#L61-L66 |
51,013 | MostlyJS/mostly-feathers-mongoose | src/mongoose.js | createService | function createService (app, Service, Model, options) {
Model = options.Model || Model;
if (typeof Model === 'function') {
assert(options.ModelName, 'createService but options.ModelName not provided');
options.Model = Model(app, options.ModelName);
} else {
options.Model = Model;
}
const service =... | javascript | function createService (app, Service, Model, options) {
Model = options.Model || Model;
if (typeof Model === 'function') {
assert(options.ModelName, 'createService but options.ModelName not provided');
options.Model = Model(app, options.ModelName);
} else {
options.Model = Model;
}
const service =... | [
"function",
"createService",
"(",
"app",
",",
"Service",
",",
"Model",
",",
"options",
")",
"{",
"Model",
"=",
"options",
".",
"Model",
"||",
"Model",
";",
"if",
"(",
"typeof",
"Model",
"===",
"'function'",
")",
"{",
"assert",
"(",
"options",
".",
"Mod... | Create a service with mogoose model | [
"Create",
"a",
"service",
"with",
"mogoose",
"model"
] | d20e150e054c784cc7db7c2487399e4f4eb730de | https://github.com/MostlyJS/mostly-feathers-mongoose/blob/d20e150e054c784cc7db7c2487399e4f4eb730de/src/mongoose.js#L71-L81 |
51,014 | gethuman/pancakes-angular | lib/ngapp/tpl.helper.js | setDefaults | function setDefaults(scope, defaults) {
if (!defaults) { return; }
// store defaults for use in generateRemodel
scope.defaults = defaults;
for (var name in defaults) {
if (defaults.hasOwnProperty(name) && scope[name] === undefined) {
scope[name] = defaults[n... | javascript | function setDefaults(scope, defaults) {
if (!defaults) { return; }
// store defaults for use in generateRemodel
scope.defaults = defaults;
for (var name in defaults) {
if (defaults.hasOwnProperty(name) && scope[name] === undefined) {
scope[name] = defaults[n... | [
"function",
"setDefaults",
"(",
"scope",
",",
"defaults",
")",
"{",
"if",
"(",
"!",
"defaults",
")",
"{",
"return",
";",
"}",
"// store defaults for use in generateRemodel",
"scope",
".",
"defaults",
"=",
"defaults",
";",
"for",
"(",
"var",
"name",
"in",
"de... | Given a set of default values, add them to the scope if
a value does not already exist.
@param scope
@param defaults | [
"Given",
"a",
"set",
"of",
"default",
"values",
"add",
"them",
"to",
"the",
"scope",
"if",
"a",
"value",
"does",
"not",
"already",
"exist",
"."
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/tpl.helper.js#L17-L28 |
51,015 | gethuman/pancakes-angular | lib/ngapp/tpl.helper.js | addValidations | function addValidations(scope, validations) {
for (var name in validations) {
if (validations.hasOwnProperty(name) && validations[name]) {
scope[name] = $injector.invoke(validations[name]);
}
}
} | javascript | function addValidations(scope, validations) {
for (var name in validations) {
if (validations.hasOwnProperty(name) && validations[name]) {
scope[name] = $injector.invoke(validations[name]);
}
}
} | [
"function",
"addValidations",
"(",
"scope",
",",
"validations",
")",
"{",
"for",
"(",
"var",
"name",
"in",
"validations",
")",
"{",
"if",
"(",
"validations",
".",
"hasOwnProperty",
"(",
"name",
")",
"&&",
"validations",
"[",
"name",
"]",
")",
"{",
"scope... | Add validations to the scope
@param scope
@param validations | [
"Add",
"validations",
"to",
"the",
"scope"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/tpl.helper.js#L173-L179 |
51,016 | gethuman/pancakes-angular | lib/ngapp/tpl.helper.js | attachToScope | function attachToScope(scope, itemsToAttach) {
if (!itemsToAttach || !itemsToAttach.length) { return; }
itemsToAttach.push(function () {
var i, val;
for (i = 0; i < arguments.length; i++) {
val = arguments[i];
scope[itemsToAttach[i]] = val;
... | javascript | function attachToScope(scope, itemsToAttach) {
if (!itemsToAttach || !itemsToAttach.length) { return; }
itemsToAttach.push(function () {
var i, val;
for (i = 0; i < arguments.length; i++) {
val = arguments[i];
scope[itemsToAttach[i]] = val;
... | [
"function",
"attachToScope",
"(",
"scope",
",",
"itemsToAttach",
")",
"{",
"if",
"(",
"!",
"itemsToAttach",
"||",
"!",
"itemsToAttach",
".",
"length",
")",
"{",
"return",
";",
"}",
"itemsToAttach",
".",
"push",
"(",
"function",
"(",
")",
"{",
"var",
"i",... | Given an array of items, instantiate them and attach them to the scope.
@param scope
@param itemsToAttach | [
"Given",
"an",
"array",
"of",
"items",
"instantiate",
"them",
"and",
"attach",
"them",
"to",
"the",
"scope",
"."
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/tpl.helper.js#L186-L198 |
51,017 | gethuman/pancakes-angular | lib/ngapp/tpl.helper.js | addInitModel | function addInitModel(scope, initialModel, pageName) {
angular.extend(scope, initialModel);
if (scope.pageHead && scope.pageHead.title) {
var title = scope.pageHead.title;
pageSettings.updateHead(title, scope.pageHead.description || title);
pageSettings.updatePageSt... | javascript | function addInitModel(scope, initialModel, pageName) {
angular.extend(scope, initialModel);
if (scope.pageHead && scope.pageHead.title) {
var title = scope.pageHead.title;
pageSettings.updateHead(title, scope.pageHead.description || title);
pageSettings.updatePageSt... | [
"function",
"addInitModel",
"(",
"scope",
",",
"initialModel",
",",
"pageName",
")",
"{",
"angular",
".",
"extend",
"(",
"scope",
",",
"initialModel",
")",
";",
"if",
"(",
"scope",
".",
"pageHead",
"&&",
"scope",
".",
"pageHead",
".",
"title",
")",
"{",
... | Add the initial model to the scope and set the page title, desc, etc.
@param scope
@param initialModel
@param pageName | [
"Add",
"the",
"initial",
"model",
"to",
"the",
"scope",
"and",
"set",
"the",
"page",
"title",
"desc",
"etc",
"."
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/tpl.helper.js#L338-L346 |
51,018 | gethuman/pancakes-angular | lib/ngapp/tpl.helper.js | registerListeners | function registerListeners(scope, listeners) {
var fns = [];
for (var name in listeners) {
if (listeners.hasOwnProperty(name) && listeners[name]) {
fns.push(eventBus.on(name, $injector.invoke(listeners[name])));
}
}
// make sure handlers are dest... | javascript | function registerListeners(scope, listeners) {
var fns = [];
for (var name in listeners) {
if (listeners.hasOwnProperty(name) && listeners[name]) {
fns.push(eventBus.on(name, $injector.invoke(listeners[name])));
}
}
// make sure handlers are dest... | [
"function",
"registerListeners",
"(",
"scope",
",",
"listeners",
")",
"{",
"var",
"fns",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"name",
"in",
"listeners",
")",
"{",
"if",
"(",
"listeners",
".",
"hasOwnProperty",
"(",
"name",
")",
"&&",
"listeners",
"["... | Register listeners and make sure they will be destoryed once the scope
is destroyed.
@param scope
@param listeners | [
"Register",
"listeners",
"and",
"make",
"sure",
"they",
"will",
"be",
"destoryed",
"once",
"the",
"scope",
"is",
"destroyed",
"."
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/tpl.helper.js#L355-L370 |
51,019 | gethuman/pancakes-angular | lib/ngapp/tpl.helper.js | addEventHandlers | function addEventHandlers(scope, ctrlName, handlers) {
if (!handlers) { return; }
for (var name in handlers) {
if (handlers.hasOwnProperty(name) && handlers[name]) {
scope[name] = $injector.invoke(handlers[name]);
// if it is not a function, throw error b/c ... | javascript | function addEventHandlers(scope, ctrlName, handlers) {
if (!handlers) { return; }
for (var name in handlers) {
if (handlers.hasOwnProperty(name) && handlers[name]) {
scope[name] = $injector.invoke(handlers[name]);
// if it is not a function, throw error b/c ... | [
"function",
"addEventHandlers",
"(",
"scope",
",",
"ctrlName",
",",
"handlers",
")",
"{",
"if",
"(",
"!",
"handlers",
")",
"{",
"return",
";",
"}",
"for",
"(",
"var",
"name",
"in",
"handlers",
")",
"{",
"if",
"(",
"handlers",
".",
"hasOwnProperty",
"("... | Add the UI event handlers to the scope
@param scope
@param ctrlName
@param handlers | [
"Add",
"the",
"UI",
"event",
"handlers",
"to",
"the",
"scope"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/tpl.helper.js#L378-L391 |
51,020 | cliffano/bagofcli | lib/bagofcli.js | exec | function exec(command, fallthrough, cb) {
execute(command, fallthrough, false, function(err, stdOutOuput, stdErrOuput, result) {
// drop stdOutOuput and stdErrOuput parameters to keep exec backwards compatible.
cb(err, result);
});
} | javascript | function exec(command, fallthrough, cb) {
execute(command, fallthrough, false, function(err, stdOutOuput, stdErrOuput, result) {
// drop stdOutOuput and stdErrOuput parameters to keep exec backwards compatible.
cb(err, result);
});
} | [
"function",
"exec",
"(",
"command",
",",
"fallthrough",
",",
"cb",
")",
"{",
"execute",
"(",
"command",
",",
"fallthrough",
",",
"false",
",",
"function",
"(",
"err",
",",
"stdOutOuput",
",",
"stdErrOuput",
",",
"result",
")",
"{",
"// drop stdOutOuput and s... | Execute a one-liner command.
The output emitted on stderr and stdout of the child process will be written to process.stdout
and process.stderr of this process.
Fallthrough is handy in situation where there are multiple execs running in sequence/parallel,
and they all have to be executed regardless of success/error on... | [
"Execute",
"a",
"one",
"-",
"liner",
"command",
"."
] | 0950716c5a670ca5c73b3d27494b58d5b78f2179 | https://github.com/cliffano/bagofcli/blob/0950716c5a670ca5c73b3d27494b58d5b78f2179/lib/bagofcli.js#L202-L207 |
51,021 | cliffano/bagofcli | lib/bagofcli.js | execute | function execute(command, fallthrough, collectOutput, cb) {
var collectedStdOut = '';
var collectedStdErr = '';
var _exec = child.exec(command, function (err) {
var result;
if (err && fallthrough) {
// camouflage error to allow other execs to keep running
result = err;
err = null;
}... | javascript | function execute(command, fallthrough, collectOutput, cb) {
var collectedStdOut = '';
var collectedStdErr = '';
var _exec = child.exec(command, function (err) {
var result;
if (err && fallthrough) {
// camouflage error to allow other execs to keep running
result = err;
err = null;
}... | [
"function",
"execute",
"(",
"command",
",",
"fallthrough",
",",
"collectOutput",
",",
"cb",
")",
"{",
"var",
"collectedStdOut",
"=",
"''",
";",
"var",
"collectedStdErr",
"=",
"''",
";",
"var",
"_exec",
"=",
"child",
".",
"exec",
"(",
"command",
",",
"fun... | not exported
Execute a one-liner command.
The output emitted on stderr and stdout of the child process will either be written to
process.stdout and process.stderr of this process or collected and passed on to the
given callback, depending on collectOutput.
Fallthrough is handy in situation where there are multiple e... | [
"not",
"exported",
"Execute",
"a",
"one",
"-",
"liner",
"command",
"."
] | 0950716c5a670ca5c73b3d27494b58d5b78f2179 | https://github.com/cliffano/bagofcli/blob/0950716c5a670ca5c73b3d27494b58d5b78f2179/lib/bagofcli.js#L244-L273 |
51,022 | cliffano/bagofcli | lib/bagofcli.js | exit | function exit(err, result) {
if (err) {
console.error(colors.red(err.message || JSON.stringify(err)));
process.exit(1);
} else {
process.exit(0);
}
} | javascript | function exit(err, result) {
if (err) {
console.error(colors.red(err.message || JSON.stringify(err)));
process.exit(1);
} else {
process.exit(0);
}
} | [
"function",
"exit",
"(",
"err",
",",
"result",
")",
"{",
"if",
"(",
"err",
")",
"{",
"console",
".",
"error",
"(",
"colors",
".",
"red",
"(",
"err",
".",
"message",
"||",
"JSON",
".",
"stringify",
"(",
"err",
")",
")",
")",
";",
"process",
".",
... | Handle process exit based on the existence of error.
This is handy for command-line tools to use as the final callback.
Exit status code 1 indicates an error, exit status code 0 indicates a success.
Error message will be logged to the console. Result object is only used for convenient debugging.
@param {Error} err: er... | [
"Handle",
"process",
"exit",
"based",
"on",
"the",
"existence",
"of",
"error",
".",
"This",
"is",
"handy",
"for",
"command",
"-",
"line",
"tools",
"to",
"use",
"as",
"the",
"final",
"callback",
".",
"Exit",
"status",
"code",
"1",
"indicates",
"an",
"erro... | 0950716c5a670ca5c73b3d27494b58d5b78f2179 | https://github.com/cliffano/bagofcli/blob/0950716c5a670ca5c73b3d27494b58d5b78f2179/lib/bagofcli.js#L284-L291 |
51,023 | cliffano/bagofcli | lib/bagofcli.js | files | function files(items, opts) {
opts = opts || {};
var data = [];
function addMatch(item) {
if (opts.match === undefined || (opts.match && item.match(new RegExp(opts.match)))) {
data.push(item);
}
}
items.forEach(function (item) {
var stat = fs.statSync(item);
if (stat.isFile()) {
... | javascript | function files(items, opts) {
opts = opts || {};
var data = [];
function addMatch(item) {
if (opts.match === undefined || (opts.match && item.match(new RegExp(opts.match)))) {
data.push(item);
}
}
items.forEach(function (item) {
var stat = fs.statSync(item);
if (stat.isFile()) {
... | [
"function",
"files",
"(",
"items",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"var",
"data",
"=",
"[",
"]",
";",
"function",
"addMatch",
"(",
"item",
")",
"{",
"if",
"(",
"opts",
".",
"match",
"===",
"undefined",
"||",
"(",
... | Get an array of files contained in specified items.
When a directory is specified, all files contained within that directory and its sub-directories will be included.
@param {Array} items: an array of files and/or directories
@param {Object} opts: optional
- match: regular expression to match against the file name
@re... | [
"Get",
"an",
"array",
"of",
"files",
"contained",
"in",
"specified",
"items",
".",
"When",
"a",
"directory",
"is",
"specified",
"all",
"files",
"contained",
"within",
"that",
"directory",
"and",
"its",
"sub",
"-",
"directories",
"will",
"be",
"included",
"."... | 0950716c5a670ca5c73b3d27494b58d5b78f2179 | https://github.com/cliffano/bagofcli/blob/0950716c5a670ca5c73b3d27494b58d5b78f2179/lib/bagofcli.js#L335-L362 |
51,024 | bcrespy/creenv-canvas | lib/index.js | Canvas | function Canvas (canvasElement, fullWindow, autoInit) {
if( !(this instanceof Canvas) ) {
return new Canvas.apply(null, arguments);
}
/**
* @type {HTMLCanvasElement}
* @public
*/
this.canvas = null;
/**
* @type {CanvasRenderingContext2D}
* @public
*/
this.context = null;
/**
* ... | javascript | function Canvas (canvasElement, fullWindow, autoInit) {
if( !(this instanceof Canvas) ) {
return new Canvas.apply(null, arguments);
}
/**
* @type {HTMLCanvasElement}
* @public
*/
this.canvas = null;
/**
* @type {CanvasRenderingContext2D}
* @public
*/
this.context = null;
/**
* ... | [
"function",
"Canvas",
"(",
"canvasElement",
",",
"fullWindow",
",",
"autoInit",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Canvas",
")",
")",
"{",
"return",
"new",
"Canvas",
".",
"apply",
"(",
"null",
",",
"arguments",
")",
";",
"}",
"/**\n ... | The canvas class provides an interface to work with the html canvas API.
Most of the drawing methods of this class directly call the built-in functions,
it is just faster to write and think code using this
@param {?HTMLCanvasElement} canvasElement the html canvas element, if none
is provided, one will be added to the ... | [
"The",
"canvas",
"class",
"provides",
"an",
"interface",
"to",
"work",
"with",
"the",
"html",
"canvas",
"API",
".",
"Most",
"of",
"the",
"drawing",
"methods",
"of",
"this",
"class",
"directly",
"call",
"the",
"built",
"-",
"in",
"functions",
"it",
"is",
... | 7890ca08a9fafebb2cff1ea830d0523ab697dffe | https://github.com/bcrespy/creenv-canvas/blob/7890ca08a9fafebb2cff1ea830d0523ab697dffe/lib/index.js#L25-L93 |
51,025 | bcrespy/creenv-canvas | lib/index.js | function (color) {
if (color === undefined) {
this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
} else {
let fillstyle = this.context.fillStyle;
this.fillStyle(color);
this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
this.fillStyle(fillstyle);
... | javascript | function (color) {
if (color === undefined) {
this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
} else {
let fillstyle = this.context.fillStyle;
this.fillStyle(color);
this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
this.fillStyle(fillstyle);
... | [
"function",
"(",
"color",
")",
"{",
"if",
"(",
"color",
"===",
"undefined",
")",
"{",
"this",
".",
"context",
".",
"fillRect",
"(",
"0",
",",
"0",
",",
"this",
".",
"canvas",
".",
"width",
",",
"this",
".",
"canvas",
".",
"height",
")",
";",
"}",... | "Rewriting" some of the most useful context functions so that
coding goes faster
Fills the canvas with the provided color, in no color is provided fills it
with the active color. Fillstyle is reset to its previous value after this function's
call
@param {Color|string} color either a @creenv/color object or a html co... | [
"Rewriting",
"some",
"of",
"the",
"most",
"useful",
"context",
"functions",
"so",
"that",
"coding",
"goes",
"faster",
"Fills",
"the",
"canvas",
"with",
"the",
"provided",
"color",
"in",
"no",
"color",
"is",
"provided",
"fills",
"it",
"with",
"the",
"active",... | 7890ca08a9fafebb2cff1ea830d0523ab697dffe | https://github.com/bcrespy/creenv-canvas/blob/7890ca08a9fafebb2cff1ea830d0523ab697dffe/lib/index.js#L128-L137 | |
51,026 | bcrespy/creenv-canvas | lib/index.js | function (x, y) {
if (!this.pathStarted) {
this.context.beginPath();
this.context.moveTo(x,y);
this.pathStarted = true;
} else {
this.context.lineTo(x,y);
}
} | javascript | function (x, y) {
if (!this.pathStarted) {
this.context.beginPath();
this.context.moveTo(x,y);
this.pathStarted = true;
} else {
this.context.lineTo(x,y);
}
} | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"if",
"(",
"!",
"this",
".",
"pathStarted",
")",
"{",
"this",
".",
"context",
".",
"beginPath",
"(",
")",
";",
"this",
".",
"context",
".",
"moveTo",
"(",
"x",
",",
"y",
")",
";",
"this",
".",
"pathStar... | Adds a point to the path. If a path has not been started, create one
@param {number} x the x coordinate of the point
@param {number} y the y coordinate of the point | [
"Adds",
"a",
"point",
"to",
"the",
"path",
".",
"If",
"a",
"path",
"has",
"not",
"been",
"started",
"create",
"one"
] | 7890ca08a9fafebb2cff1ea830d0523ab697dffe | https://github.com/bcrespy/creenv-canvas/blob/7890ca08a9fafebb2cff1ea830d0523ab697dffe/lib/index.js#L201-L209 | |
51,027 | inviqa/deck-task-registry | src/styles/buildStyles.js | buildStyles | function buildStyles(conf, undertaker) {
// Config that gets passed to node-sass.
const sassConfig = conf.themeConfig.sass.nodeSassConf || {};
// If we're in production mode, then compress the output CSS.
if (conf.productionMode) {
sassConfig.outputStyle = 'compressed';
}
// Any PostCSS... | javascript | function buildStyles(conf, undertaker) {
// Config that gets passed to node-sass.
const sassConfig = conf.themeConfig.sass.nodeSassConf || {};
// If we're in production mode, then compress the output CSS.
if (conf.productionMode) {
sassConfig.outputStyle = 'compressed';
}
// Any PostCSS... | [
"function",
"buildStyles",
"(",
"conf",
",",
"undertaker",
")",
"{",
"// Config that gets passed to node-sass.",
"const",
"sassConfig",
"=",
"conf",
".",
"themeConfig",
".",
"sass",
".",
"nodeSassConf",
"||",
"{",
"}",
";",
"// If we're in production mode, then compress... | Build project styles.
@param {ConfigParser} conf A configuration parser object.
@param {Undertaker} undertaker An Undertaker instance.
@returns {Stream} A stream of files. | [
"Build",
"project",
"styles",
"."
] | 4c31787b978e9d99a47052e090d4589a50cd3015 | https://github.com/inviqa/deck-task-registry/blob/4c31787b978e9d99a47052e090d4589a50cd3015/src/styles/buildStyles.js#L18-L46 |
51,028 | Psychopoulet/node-promfs | lib/extends/_copyFile.js | _copyFile | function _copyFile (origin, target, callback) {
if ("undefined" === typeof origin) {
throw new ReferenceError("Missing \"origin\" argument");
}
else if ("string" !== typeof origin) {
throw new TypeError("\"origin\" argument is not a string");
}
else if ("" === origin.trim()) {
throw new... | javascript | function _copyFile (origin, target, callback) {
if ("undefined" === typeof origin) {
throw new ReferenceError("Missing \"origin\" argument");
}
else if ("string" !== typeof origin) {
throw new TypeError("\"origin\" argument is not a string");
}
else if ("" === origin.trim()) {
throw new... | [
"function",
"_copyFile",
"(",
"origin",
",",
"target",
",",
"callback",
")",
"{",
"if",
"(",
"\"undefined\"",
"===",
"typeof",
"origin",
")",
"{",
"throw",
"new",
"ReferenceError",
"(",
"\"Missing \\\"origin\\\" argument\"",
")",
";",
"}",
"else",
"if",
"(",
... | methods
Async copyFile
@param {string} origin : file to copy
@param {string} target : file to copy in
@param {function|null} callback : operation's result
@returns {void} | [
"methods",
"Async",
"copyFile"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_copyFile.js#L22-L75 |
51,029 | aureooms/js-array | lib/reduce/reduce.js | reduce | function reduce(accumulator, iterable, initializer) {
var i, len;
i = 0;
len = iterable.length;
if (len === 0) {
return initializer;
}
for (; i < len; ++i) {
initializer = accumulator(initializer, iterable[i]);
}
return initializer;
} | javascript | function reduce(accumulator, iterable, initializer) {
var i, len;
i = 0;
len = iterable.length;
if (len === 0) {
return initializer;
}
for (; i < len; ++i) {
initializer = accumulator(initializer, iterable[i]);
}
return initializer;
} | [
"function",
"reduce",
"(",
"accumulator",
",",
"iterable",
",",
"initializer",
")",
"{",
"var",
"i",
",",
"len",
";",
"i",
"=",
"0",
";",
"len",
"=",
"iterable",
".",
"length",
";",
"if",
"(",
"len",
"===",
"0",
")",
"{",
"return",
"initializer",
"... | Applies the accumulator function iteratively on the
last return value of the accumulator and the next
value in the iterable. The initial value is the initializer
parameter.
/!\ currently only works with an
accumulator that is a function object
and an array iterable | [
"Applies",
"the",
"accumulator",
"function",
"iteratively",
"on",
"the",
"last",
"return",
"value",
"of",
"the",
"accumulator",
"and",
"the",
"next",
"value",
"in",
"the",
"iterable",
".",
"The",
"initial",
"value",
"is",
"the",
"initializer",
"parameter",
"."... | b062caceaf08f79cc5f36f6b265e50b984f5e85e | https://github.com/aureooms/js-array/blob/b062caceaf08f79cc5f36f6b265e50b984f5e85e/lib/reduce/reduce.js#L20-L37 |
51,030 | fnogatz/tconsole | lib/index.js | load | function load (location) {
var required = requireAll(location)
var config = {}
for (var key in required) {
config[key.replace(/^array\./, 'array:')] = required[key]
}
var konsole = createConsole(config)
return konsole
} | javascript | function load (location) {
var required = requireAll(location)
var config = {}
for (var key in required) {
config[key.replace(/^array\./, 'array:')] = required[key]
}
var konsole = createConsole(config)
return konsole
} | [
"function",
"load",
"(",
"location",
")",
"{",
"var",
"required",
"=",
"requireAll",
"(",
"location",
")",
"var",
"config",
"=",
"{",
"}",
"for",
"(",
"var",
"key",
"in",
"required",
")",
"{",
"config",
"[",
"key",
".",
"replace",
"(",
"/",
"^array\\... | Create a console by requiring all renderers in a given
location.
@param {String} location Filesystem path to use with require-all
@return {tconsole} | [
"Create",
"a",
"console",
"by",
"requiring",
"all",
"renderers",
"in",
"a",
"given",
"location",
"."
] | debcdaf916f7e8f43b35c4c907b585f5c1c69f0f | https://github.com/fnogatz/tconsole/blob/debcdaf916f7e8f43b35c4c907b585f5c1c69f0f/lib/index.js#L58-L66 |
51,031 | fnogatz/tconsole | lib/index.js | combine | function combine () {
var config = {}
Array.prototype.forEach.call(arguments, function (tconsoleInstance) {
mergeObject(config, tconsoleInstance._tconsoleConfig)
})
return createConsole(config)
} | javascript | function combine () {
var config = {}
Array.prototype.forEach.call(arguments, function (tconsoleInstance) {
mergeObject(config, tconsoleInstance._tconsoleConfig)
})
return createConsole(config)
} | [
"function",
"combine",
"(",
")",
"{",
"var",
"config",
"=",
"{",
"}",
"Array",
".",
"prototype",
".",
"forEach",
".",
"call",
"(",
"arguments",
",",
"function",
"(",
"tconsoleInstance",
")",
"{",
"mergeObject",
"(",
"config",
",",
"tconsoleInstance",
".",
... | Combine multiple tconsole instances.
@return {tconsole} | [
"Combine",
"multiple",
"tconsole",
"instances",
"."
] | debcdaf916f7e8f43b35c4c907b585f5c1c69f0f | https://github.com/fnogatz/tconsole/blob/debcdaf916f7e8f43b35c4c907b585f5c1c69f0f/lib/index.js#L72-L78 |
51,032 | redisjs/jsr-store | lib/type/hash.js | HashMap | function HashMap(source) {
this._rtype = TYPE_NAMES.HASH;
this.reset();
if(source) {
for(var k in source) {
this.setKey(k, source[k]);
}
}
} | javascript | function HashMap(source) {
this._rtype = TYPE_NAMES.HASH;
this.reset();
if(source) {
for(var k in source) {
this.setKey(k, source[k]);
}
}
} | [
"function",
"HashMap",
"(",
"source",
")",
"{",
"this",
".",
"_rtype",
"=",
"TYPE_NAMES",
".",
"HASH",
";",
"this",
".",
"reset",
"(",
")",
";",
"if",
"(",
"source",
")",
"{",
"for",
"(",
"var",
"k",
"in",
"source",
")",
"{",
"this",
".",
"setKey... | Represents the hash map type.
This is actually a linked list. Keys are stored in an array so
that calls to retrieve the keys do not need to call Object.keys().
Key list retrieval will be fast, sacrificing memory for less cpu
under the assumption that it is easier to supply more memory and harder
to supply more cpu cy... | [
"Represents",
"the",
"hash",
"map",
"type",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/type/hash.js#L21-L29 |
51,033 | redisjs/jsr-store | lib/type/hash.js | setExpiry | function setExpiry(key, ms, req) {
var rval = this.getRawKey(key);
if(rval === undefined) return 0;
// expiry is in the past or now, delete immediately
// but return 1 to indicate the expiry was set
if(ms <= Date.now()) {
this.delKey(key, req);
return 1;
}
if(!this._expires[key]) {
this._ekeys... | javascript | function setExpiry(key, ms, req) {
var rval = this.getRawKey(key);
if(rval === undefined) return 0;
// expiry is in the past or now, delete immediately
// but return 1 to indicate the expiry was set
if(ms <= Date.now()) {
this.delKey(key, req);
return 1;
}
if(!this._expires[key]) {
this._ekeys... | [
"function",
"setExpiry",
"(",
"key",
",",
"ms",
",",
"req",
")",
"{",
"var",
"rval",
"=",
"this",
".",
"getRawKey",
"(",
"key",
")",
";",
"if",
"(",
"rval",
"===",
"undefined",
")",
"return",
"0",
";",
"// expiry is in the past or now, delete immediately",
... | Set expiry on a key as a unix timestamp in ms. | [
"Set",
"expiry",
"on",
"a",
"key",
"as",
"a",
"unix",
"timestamp",
"in",
"ms",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/type/hash.js#L128-L143 |
51,034 | redisjs/jsr-store | lib/type/hash.js | delExpiry | function delExpiry(key, req) {
var rval = this.getRawKey(key);
if(rval === undefined || rval.e === undefined) return 0;
// the code flow ensures we have a valid
// index into the expiring keys array
this._ekeys.splice(ArrayIndex.indexOf(key, this._ekeys), 1);
delete this._expires[key];
delete rval.e;
re... | javascript | function delExpiry(key, req) {
var rval = this.getRawKey(key);
if(rval === undefined || rval.e === undefined) return 0;
// the code flow ensures we have a valid
// index into the expiring keys array
this._ekeys.splice(ArrayIndex.indexOf(key, this._ekeys), 1);
delete this._expires[key];
delete rval.e;
re... | [
"function",
"delExpiry",
"(",
"key",
",",
"req",
")",
"{",
"var",
"rval",
"=",
"this",
".",
"getRawKey",
"(",
"key",
")",
";",
"if",
"(",
"rval",
"===",
"undefined",
"||",
"rval",
".",
"e",
"===",
"undefined",
")",
"return",
"0",
";",
"// the code fl... | Delete expiry on a key. | [
"Delete",
"expiry",
"on",
"a",
"key",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/type/hash.js#L148-L157 |
51,035 | redisjs/jsr-store | lib/type/hash.js | delExpiredKeys | function delExpiredKeys(num, threshold) {
function removeExpiredKeys(count) {
if(!this._ekeys.length) return 0;
var num = num || 100
, threshold = threshold || 25
, count = count || 0
, i
, key
, ind;
for(i = 0;i < num;i++) {
ind = Math.floor(Math.random() * this._eke... | javascript | function delExpiredKeys(num, threshold) {
function removeExpiredKeys(count) {
if(!this._ekeys.length) return 0;
var num = num || 100
, threshold = threshold || 25
, count = count || 0
, i
, key
, ind;
for(i = 0;i < num;i++) {
ind = Math.floor(Math.random() * this._eke... | [
"function",
"delExpiredKeys",
"(",
"num",
",",
"threshold",
")",
"{",
"function",
"removeExpiredKeys",
"(",
"count",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_ekeys",
".",
"length",
")",
"return",
"0",
";",
"var",
"num",
"=",
"num",
"||",
"100",
",",
... | Passive expiry.
Picks 100 keys at random from the list of expired keys
and if the number of expired keys exceeds 25 continue to
delete expired keys. | [
"Passive",
"expiry",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/type/hash.js#L231-L261 |
51,036 | redisjs/jsr-store | lib/type/hash.js | getValueBuffer | function getValueBuffer(key, req, stringify) {
var val = this.getKey(key, req);
// should have buffer, string or number
if(val !== undefined) {
if(typeof val === 'number' && !stringify) val = new Buffer([val]);
val = (val instanceof Buffer) ? val : new Buffer('' + val);
}
return val;
} | javascript | function getValueBuffer(key, req, stringify) {
var val = this.getKey(key, req);
// should have buffer, string or number
if(val !== undefined) {
if(typeof val === 'number' && !stringify) val = new Buffer([val]);
val = (val instanceof Buffer) ? val : new Buffer('' + val);
}
return val;
} | [
"function",
"getValueBuffer",
"(",
"key",
",",
"req",
",",
"stringify",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"// should have buffer, string or number",
"if",
"(",
"val",
"!==",
"undefined",
")",
"{",
"if",
... | Get the value for a key as a buffer regardless of it being
a string, number or existing buffer.
@param key The key.
@param req The request object.
@param stringify Convert numbers to strings then buffer. | [
"Get",
"the",
"value",
"for",
"a",
"key",
"as",
"a",
"buffer",
"regardless",
"of",
"it",
"being",
"a",
"string",
"number",
"or",
"existing",
"buffer",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/type/hash.js#L288-L296 |
51,037 | bholloway/browserify-anonymous-labeler | lib/interleave.js | interleave | function interleave(additional) {
return function reduce(reduced, value, i) {
if (i === 0) {
reduced.push(value);
} else {
reduced.push(additional, value);
}
return reduced;
}
} | javascript | function interleave(additional) {
return function reduce(reduced, value, i) {
if (i === 0) {
reduced.push(value);
} else {
reduced.push(additional, value);
}
return reduced;
}
} | [
"function",
"interleave",
"(",
"additional",
")",
"{",
"return",
"function",
"reduce",
"(",
"reduced",
",",
"value",
",",
"i",
")",
"{",
"if",
"(",
"i",
"===",
"0",
")",
"{",
"reduced",
".",
"push",
"(",
"value",
")",
";",
"}",
"else",
"{",
"reduce... | Get a reduce method that interleaves the given additional value between each existing element in an array.
@param {*} additional The value to interleave
@returns {function} A method that reduces an array a returns an interleaved array | [
"Get",
"a",
"reduce",
"method",
"that",
"interleaves",
"the",
"given",
"additional",
"value",
"between",
"each",
"existing",
"element",
"in",
"an",
"array",
"."
] | 651b124eefe8d1a567b2a03a0b8a3dfea87c2703 | https://github.com/bholloway/browserify-anonymous-labeler/blob/651b124eefe8d1a567b2a03a0b8a3dfea87c2703/lib/interleave.js#L8-L17 |
51,038 | oconnore/harmony-enumerables | collections.js | Node | function Node(value, prev, next) {
this.value = value;
this.prev = prev;
this.next = next;
} | javascript | function Node(value, prev, next) {
this.value = value;
this.prev = prev;
this.next = next;
} | [
"function",
"Node",
"(",
"value",
",",
"prev",
",",
"next",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"prev",
"=",
"prev",
";",
"this",
".",
"next",
"=",
"next",
";",
"}"
] | A doubly linked node | [
"A",
"doubly",
"linked",
"node"
] | 77a0a6b6726bcbb877c494f6c14f175de7225699 | https://github.com/oconnore/harmony-enumerables/blob/77a0a6b6726bcbb877c494f6c14f175de7225699/collections.js#L68-L72 |
51,039 | oconnore/harmony-enumerables | collections.js | Sequence | function Sequence(iterable) {
this.sequence = null;
this._size = 0;
this.nodeMap = new rMap();
if (iterable) {
if (typeof iterable.length === 'number') {
for (var i = 0; i < iterable.length; i++) {
this.add.apply(this, iterable[i]);
}
} else if (typeof iterable.entr... | javascript | function Sequence(iterable) {
this.sequence = null;
this._size = 0;
this.nodeMap = new rMap();
if (iterable) {
if (typeof iterable.length === 'number') {
for (var i = 0; i < iterable.length; i++) {
this.add.apply(this, iterable[i]);
}
} else if (typeof iterable.entr... | [
"function",
"Sequence",
"(",
"iterable",
")",
"{",
"this",
".",
"sequence",
"=",
"null",
";",
"this",
".",
"_size",
"=",
"0",
";",
"this",
".",
"nodeMap",
"=",
"new",
"rMap",
"(",
")",
";",
"if",
"(",
"iterable",
")",
"{",
"if",
"(",
"typeof",
"i... | A Sequence is a doubly linked list where the conses are also stored in a Map and accessible by a key. | [
"A",
"Sequence",
"is",
"a",
"doubly",
"linked",
"list",
"where",
"the",
"conses",
"are",
"also",
"stored",
"in",
"a",
"Map",
"and",
"accessible",
"by",
"a",
"key",
"."
] | 77a0a6b6726bcbb877c494f6c14f175de7225699 | https://github.com/oconnore/harmony-enumerables/blob/77a0a6b6726bcbb877c494f6c14f175de7225699/collections.js#L99-L116 |
51,040 | oconnore/harmony-enumerables | collections.js | bindHelper | function bindHelper(fn) {
return function() {
var p = priv.get(this);
return fn.apply(p.sequence, Array.prototype.slice.call(arguments));
}
} | javascript | function bindHelper(fn) {
return function() {
var p = priv.get(this);
return fn.apply(p.sequence, Array.prototype.slice.call(arguments));
}
} | [
"function",
"bindHelper",
"(",
"fn",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"p",
"=",
"priv",
".",
"get",
"(",
"this",
")",
";",
"return",
"fn",
".",
"apply",
"(",
"p",
".",
"sequence",
",",
"Array",
".",
"prototype",
".",
"slice",
... | bindHelper calls a function on our private internal Sequence. It is used by EnumMap and EnumSet to delegate to the private sequence object. | [
"bindHelper",
"calls",
"a",
"function",
"on",
"our",
"private",
"internal",
"Sequence",
".",
"It",
"is",
"used",
"by",
"EnumMap",
"and",
"EnumSet",
"to",
"delegate",
"to",
"the",
"private",
"sequence",
"object",
"."
] | 77a0a6b6726bcbb877c494f6c14f175de7225699 | https://github.com/oconnore/harmony-enumerables/blob/77a0a6b6726bcbb877c494f6c14f175de7225699/collections.js#L189-L194 |
51,041 | oconnore/harmony-enumerables | collections.js | EnumMap | function EnumMap(iter) {
var p = {};
priv.set(this, p);
var newIter = iter;
if(iter && typeof iter.entries === 'function') {
if (iter instanceof EnumSet) {
newIter = {
entries: function() {
var pi = priv.get(iter);
return new Iterator(pi.sequence.sequence,... | javascript | function EnumMap(iter) {
var p = {};
priv.set(this, p);
var newIter = iter;
if(iter && typeof iter.entries === 'function') {
if (iter instanceof EnumSet) {
newIter = {
entries: function() {
var pi = priv.get(iter);
return new Iterator(pi.sequence.sequence,... | [
"function",
"EnumMap",
"(",
"iter",
")",
"{",
"var",
"p",
"=",
"{",
"}",
";",
"priv",
".",
"set",
"(",
"this",
",",
"p",
")",
";",
"var",
"newIter",
"=",
"iter",
";",
"if",
"(",
"iter",
"&&",
"typeof",
"iter",
".",
"entries",
"===",
"'function'",... | This is our poly-filled Map, which we can enumerate using Sequence | [
"This",
"is",
"our",
"poly",
"-",
"filled",
"Map",
"which",
"we",
"can",
"enumerate",
"using",
"Sequence"
] | 77a0a6b6726bcbb877c494f6c14f175de7225699 | https://github.com/oconnore/harmony-enumerables/blob/77a0a6b6726bcbb877c494f6c14f175de7225699/collections.js#L197-L212 |
51,042 | oconnore/harmony-enumerables | collections.js | EnumSet | function EnumSet(iter) {
var p = {};
priv.set(this, p);
var newIter = iter;
if (Array.isArray(iter)) {
newIter = Array.prototype.map.call(iter, function(x) {
return [x, x];
});
} else if(iter && typeof iter.entries === 'function') {
if (iter instanceof EnumMap) {
ne... | javascript | function EnumSet(iter) {
var p = {};
priv.set(this, p);
var newIter = iter;
if (Array.isArray(iter)) {
newIter = Array.prototype.map.call(iter, function(x) {
return [x, x];
});
} else if(iter && typeof iter.entries === 'function') {
if (iter instanceof EnumMap) {
ne... | [
"function",
"EnumSet",
"(",
"iter",
")",
"{",
"var",
"p",
"=",
"{",
"}",
";",
"priv",
".",
"set",
"(",
"this",
",",
"p",
")",
";",
"var",
"newIter",
"=",
"iter",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"iter",
")",
")",
"{",
"newIter",
... | This is our poly-filled Set, which we can enumerate using Sequence | [
"This",
"is",
"our",
"poly",
"-",
"filled",
"Set",
"which",
"we",
"can",
"enumerate",
"using",
"Sequence"
] | 77a0a6b6726bcbb877c494f6c14f175de7225699 | https://github.com/oconnore/harmony-enumerables/blob/77a0a6b6726bcbb877c494f6c14f175de7225699/collections.js#L235-L256 |
51,043 | freshtilledsoil/FTS-grunt | Gruntfile.js | loadConfig | function loadConfig(path) {
var glob = require('glob');
var object = {};
var key;
glob.sync('*', {cwd: path}).forEach(function(option) {
key = option.replace(/\.js$/,'');
object[key] = require(path + option);
});
return object;
} | javascript | function loadConfig(path) {
var glob = require('glob');
var object = {};
var key;
glob.sync('*', {cwd: path}).forEach(function(option) {
key = option.replace(/\.js$/,'');
object[key] = require(path + option);
});
return object;
} | [
"function",
"loadConfig",
"(",
"path",
")",
"{",
"var",
"glob",
"=",
"require",
"(",
"'glob'",
")",
";",
"var",
"object",
"=",
"{",
"}",
";",
"var",
"key",
";",
"glob",
".",
"sync",
"(",
"'*'",
",",
"{",
"cwd",
":",
"path",
"}",
")",
".",
"forE... | Utility to load the different option files based on their names | [
"Utility",
"to",
"load",
"the",
"different",
"option",
"files",
"based",
"on",
"their",
"names"
] | 955bafdffb57d7d2df08b6fdf67b56c75bb6c4ce | https://github.com/freshtilledsoil/FTS-grunt/blob/955bafdffb57d7d2df08b6fdf67b56c75bb6c4ce/Gruntfile.js#L5-L16 |
51,044 | gethuman/pancakes-recipe | batch/db.clear/db.clear.batch.js | clearDatabase | function clearDatabase() {
var promises = [];
_.each(resources, function (resource) {
var service = pancakes.getService(resource.name);
if (service.removePermanently) {
log.info('purging ' + resource.name);
promises.push(service.removePermanently(... | javascript | function clearDatabase() {
var promises = [];
_.each(resources, function (resource) {
var service = pancakes.getService(resource.name);
if (service.removePermanently) {
log.info('purging ' + resource.name);
promises.push(service.removePermanently(... | [
"function",
"clearDatabase",
"(",
")",
"{",
"var",
"promises",
"=",
"[",
"]",
";",
"_",
".",
"each",
"(",
"resources",
",",
"function",
"(",
"resource",
")",
"{",
"var",
"service",
"=",
"pancakes",
".",
"getService",
"(",
"resource",
".",
"name",
")",
... | Purge everything in the database | [
"Purge",
"everything",
"in",
"the",
"database"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/batch/db.clear/db.clear.batch.js#L27-L39 |
51,045 | gethuman/pancakes-recipe | batch/db.clear/db.clear.batch.js | confirmClear | function confirmClear() {
var promptSchema = {
properties: {
confirm: {
description: 'Delete everything in the ' + config.env.toUpperCase() + ' database? (y or n) ',
pattern: /^[yn]$/,
message: 'Please respond with y or n. '... | javascript | function confirmClear() {
var promptSchema = {
properties: {
confirm: {
description: 'Delete everything in the ' + config.env.toUpperCase() + ' database? (y or n) ',
pattern: /^[yn]$/,
message: 'Please respond with y or n. '... | [
"function",
"confirmClear",
"(",
")",
"{",
"var",
"promptSchema",
"=",
"{",
"properties",
":",
"{",
"confirm",
":",
"{",
"description",
":",
"'Delete everything in the '",
"+",
"config",
".",
"env",
".",
"toUpperCase",
"(",
")",
"+",
"' database? (y or n) '",
... | Confirm with the user that they definitately want to purge
@returns {*} | [
"Confirm",
"with",
"the",
"user",
"that",
"they",
"definitately",
"want",
"to",
"purge"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/batch/db.clear/db.clear.batch.js#L45-L80 |
51,046 | blixt/js-workerproxy | index.js | createWorkerProxy | function createWorkerProxy(workersOrFunctions, opt_options) {
var options = {
// Automatically call the callback after a call if the return value is not
// undefined.
autoCallback: false,
// Catch errors and automatically respond with an error callback. Off by
// default since it break... | javascript | function createWorkerProxy(workersOrFunctions, opt_options) {
var options = {
// Automatically call the callback after a call if the return value is not
// undefined.
autoCallback: false,
// Catch errors and automatically respond with an error callback. Off by
// default since it break... | [
"function",
"createWorkerProxy",
"(",
"workersOrFunctions",
",",
"opt_options",
")",
"{",
"var",
"options",
"=",
"{",
"// Automatically call the callback after a call if the return value is not",
"// undefined.",
"autoCallback",
":",
"false",
",",
"// Catch errors and automatical... | Call this function with either a Worker instance, a list of them, or a map
of functions that can be called inside the worker. | [
"Call",
"this",
"function",
"with",
"either",
"a",
"Worker",
"instance",
"a",
"list",
"of",
"them",
"or",
"a",
"map",
"of",
"functions",
"that",
"can",
"be",
"called",
"inside",
"the",
"worker",
"."
] | 8e7649e1392a1e0d42e0fabce6245916fdc8fb01 | https://github.com/blixt/js-workerproxy/blob/8e7649e1392a1e0d42e0fabce6245916fdc8fb01/index.js#L223-L258 |
51,047 | sogko/pecker | lib/manifest.js | Manifest | function Manifest(options) {
this.options = options;
this.destDir = options.destDir || process.cwd();
this.content = {};
this.filePath = path.join(this.destDir, MANIFEST_FILENAME);
// get or create manifest content
this.content = this.read();
} | javascript | function Manifest(options) {
this.options = options;
this.destDir = options.destDir || process.cwd();
this.content = {};
this.filePath = path.join(this.destDir, MANIFEST_FILENAME);
// get or create manifest content
this.content = this.read();
} | [
"function",
"Manifest",
"(",
"options",
")",
"{",
"this",
".",
"options",
"=",
"options",
";",
"this",
".",
"destDir",
"=",
"options",
".",
"destDir",
"||",
"process",
".",
"cwd",
"(",
")",
";",
"this",
".",
"content",
"=",
"{",
"}",
";",
"this",
"... | Pecker.Manifest class
@param options
@constructor | [
"Pecker",
".",
"Manifest",
"class"
] | fc84cbcd06176e74a15d4e49cc366dbd0a7041b0 | https://github.com/sogko/pecker/blob/fc84cbcd06176e74a15d4e49cc366dbd0a7041b0/lib/manifest.js#L22-L30 |
51,048 | Runnable/cluster-man | index.js | ClusterManager | function ClusterManager(opts) {
if (isFunction(opts)) {
opts = { worker: opts };
}
this.options = opts || {};
this.givenNumWorkers =
exists(this.options.numWorkers) ||
exists(process.env.CLUSTER_WORKERS);
defaults(this.options, {
debugScope: process.env.CLUSTER_DEBUG || 'cluster-man',
ma... | javascript | function ClusterManager(opts) {
if (isFunction(opts)) {
opts = { worker: opts };
}
this.options = opts || {};
this.givenNumWorkers =
exists(this.options.numWorkers) ||
exists(process.env.CLUSTER_WORKERS);
defaults(this.options, {
debugScope: process.env.CLUSTER_DEBUG || 'cluster-man',
ma... | [
"function",
"ClusterManager",
"(",
"opts",
")",
"{",
"if",
"(",
"isFunction",
"(",
"opts",
")",
")",
"{",
"opts",
"=",
"{",
"worker",
":",
"opts",
"}",
";",
"}",
"this",
".",
"options",
"=",
"opts",
"||",
"{",
"}",
";",
"this",
".",
"givenNumWorker... | Utility class for creating new server clusters.
@example
var ClusterManager = require('cluster-man');
var server = require('./lib/server');
// Basic usage (if you only need to handle workers)
new ClusterManager(server.start).start();
@example
var ClusterManager = require('cluster-man');
var server = require('./lib/s... | [
"Utility",
"class",
"for",
"creating",
"new",
"server",
"clusters",
"."
] | fa60bc78501c4261ad288b7e0d1fb661284cf640 | https://github.com/Runnable/cluster-man/blob/fa60bc78501c4261ad288b7e0d1fb661284cf640/index.js#L72-L110 |
51,049 | skpapam/i-encrypt | index.js | function(data){
return typeof data === 'object'
? JSON.stringify(data)
: (typeof data === 'string' || typeof data === 'number' ? String(data) : null);
} | javascript | function(data){
return typeof data === 'object'
? JSON.stringify(data)
: (typeof data === 'string' || typeof data === 'number' ? String(data) : null);
} | [
"function",
"(",
"data",
")",
"{",
"return",
"typeof",
"data",
"===",
"'object'",
"?",
"JSON",
".",
"stringify",
"(",
"data",
")",
":",
"(",
"typeof",
"data",
"===",
"'string'",
"||",
"typeof",
"data",
"===",
"'number'",
"?",
"String",
"(",
"data",
")"... | Private serialization method
@private
@param data {Object} || {String} || {Number}
@returns {String} or null on fail | [
"Private",
"serialization",
"method"
] | ebc93e25d7340817eaa8eccfde8b1b24aeb2f802 | https://github.com/skpapam/i-encrypt/blob/ebc93e25d7340817eaa8eccfde8b1b24aeb2f802/index.js#L150-L154 | |
51,050 | andrewscwei/requiem | src/dom/getElementRegistry.js | getElementRegistry | function getElementRegistry(identifier) {
if (!window.__private__) window.__private__ = {};
if (window.__private__.elementRegistry === undefined) window.__private__.elementRegistry = {};
if (typeof identifier === 'string') {
if (!~identifier.indexOf('-')) identifier = identifier + '-element';
return windo... | javascript | function getElementRegistry(identifier) {
if (!window.__private__) window.__private__ = {};
if (window.__private__.elementRegistry === undefined) window.__private__.elementRegistry = {};
if (typeof identifier === 'string') {
if (!~identifier.indexOf('-')) identifier = identifier + '-element';
return windo... | [
"function",
"getElementRegistry",
"(",
"identifier",
")",
"{",
"if",
"(",
"!",
"window",
".",
"__private__",
")",
"window",
".",
"__private__",
"=",
"{",
"}",
";",
"if",
"(",
"window",
".",
"__private__",
".",
"elementRegistry",
"===",
"undefined",
")",
"w... | Gets the element registry.
@param {string|Function} [identifier] - Either a tag or the element class to
look for. If unspecified the entire
registry will be returned.
@return {Object} The element registry.
@alias module:requiem~dom.getElementRegistry | [
"Gets",
"the",
"element",
"registry",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/getElementRegistry.js#L16-L31 |
51,051 | Encentivize/kwaai-crud | lib/crud.js | validated | function validated(invalid){
if (invalid) { return callback(invalid) }
if(options.coerce){crudUtils.coerceData(options,coerced())}
else{coerced(null,options.data)}
} | javascript | function validated(invalid){
if (invalid) { return callback(invalid) }
if(options.coerce){crudUtils.coerceData(options,coerced())}
else{coerced(null,options.data)}
} | [
"function",
"validated",
"(",
"invalid",
")",
"{",
"if",
"(",
"invalid",
")",
"{",
"return",
"callback",
"(",
"invalid",
")",
"}",
"if",
"(",
"options",
".",
"coerce",
")",
"{",
"crudUtils",
".",
"coerceData",
"(",
"options",
",",
"coerced",
"(",
")",
... | coerce to schema | [
"coerce",
"to",
"schema"
] | aefcfab619b4447f78c2e863e8bdb9035b021995 | https://github.com/Encentivize/kwaai-crud/blob/aefcfab619b4447f78c2e863e8bdb9035b021995/lib/crud.js#L661-L665 |
51,052 | gasolin/provecss | index.js | provecss | function provecss(string, options) {
options = options || {};
this.browsers = options.browsers;
if (options.path) {
this.import_path = path.basename(options.path);
this.import_base = options.base || path.dirname(options.path);
}
this.import_filter = options.import_filter;
this.v... | javascript | function provecss(string, options) {
options = options || {};
this.browsers = options.browsers;
if (options.path) {
this.import_path = path.basename(options.path);
this.import_base = options.base || path.dirname(options.path);
}
this.import_filter = options.import_filter;
this.v... | [
"function",
"provecss",
"(",
"string",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"browsers",
"=",
"options",
".",
"browsers",
";",
"if",
"(",
"options",
".",
"path",
")",
"{",
"this",
".",
"import_path",
"... | Rework a CSS `string`
@param {String} string (optional)
@param {Object} options (optional)
@return {String} | [
"Rework",
"a",
"CSS",
"string"
] | 7d92512c0bbd600be83055231c5644dbd0cc704a | https://github.com/gasolin/provecss/blob/7d92512c0bbd600be83055231c5644dbd0cc704a/index.js#L26-L78 |
51,053 | nodeGame/shelf.js | build/shelf.js | function (fileName, key, value) {
var file = fileName || store.filename;
if (!file) {
store.log('You must specify a valid file.', 'ERR');
return false;
}
if (!key) return;
var item = store.stringify(key) + ": " +
... | javascript | function (fileName, key, value) {
var file = fileName || store.filename;
if (!file) {
store.log('You must specify a valid file.', 'ERR');
return false;
}
if (!key) return;
var item = store.stringify(key) + ": " +
... | [
"function",
"(",
"fileName",
",",
"key",
",",
"value",
")",
"{",
"var",
"file",
"=",
"fileName",
"||",
"store",
".",
"filename",
";",
"if",
"(",
"!",
"file",
")",
"{",
"store",
".",
"log",
"(",
"'You must specify a valid file.'",
",",
"'ERR'",
")",
";"... | node 0.8 | [
"node",
"0",
".",
"8"
] | 49eabcf55337c2f70b7ba94a483952cc514c76e1 | https://github.com/nodeGame/shelf.js/blob/49eabcf55337c2f70b7ba94a483952cc514c76e1/build/shelf.js#L1609-L1621 | |
51,054 | nodeGame/shelf.js | build/shelf.js | function (fileName, key, value) {
var file = fileName || store.filename;
if (!file) {
store.log('You must specify a valid file.', 'ERR');
return false;
}
if (!key) return;
var item = store.stringify(key) + ": " +
... | javascript | function (fileName, key, value) {
var file = fileName || store.filename;
if (!file) {
store.log('You must specify a valid file.', 'ERR');
return false;
}
if (!key) return;
var item = store.stringify(key) + ": " +
... | [
"function",
"(",
"fileName",
",",
"key",
",",
"value",
")",
"{",
"var",
"file",
"=",
"fileName",
"||",
"store",
".",
"filename",
";",
"if",
"(",
"!",
"file",
")",
"{",
"store",
".",
"log",
"(",
"'You must specify a valid file.'",
",",
"'ERR'",
")",
";"... | node < 0.8 | [
"node",
"<",
"0",
".",
"8"
] | 49eabcf55337c2f70b7ba94a483952cc514c76e1 | https://github.com/nodeGame/shelf.js/blob/49eabcf55337c2f70b7ba94a483952cc514c76e1/build/shelf.js#L1625-L1642 | |
51,055 | inviqa/deck-task-registry | src/other/default.js | defaultTask | function defaultTask(conf, undertaker, done) {
return undertaker.series(
require('../build/build').bind(null, conf, undertaker),
require('../other/watch').bind(null, conf, undertaker)
)(done);
} | javascript | function defaultTask(conf, undertaker, done) {
return undertaker.series(
require('../build/build').bind(null, conf, undertaker),
require('../other/watch').bind(null, conf, undertaker)
)(done);
} | [
"function",
"defaultTask",
"(",
"conf",
",",
"undertaker",
",",
"done",
")",
"{",
"return",
"undertaker",
".",
"series",
"(",
"require",
"(",
"'../build/build'",
")",
".",
"bind",
"(",
"null",
",",
"conf",
",",
"undertaker",
")",
",",
"require",
"(",
"'.... | The default task to be run.
@param {ConfigParser} conf A configuration parser object.
@param {Undertaker} undertaker An Undertaker instance.
@returns {Stream} A stream of files. | [
"The",
"default",
"task",
"to",
"be",
"run",
"."
] | 4c31787b978e9d99a47052e090d4589a50cd3015 | https://github.com/inviqa/deck-task-registry/blob/4c31787b978e9d99a47052e090d4589a50cd3015/src/other/default.js#L11-L16 |
51,056 | ianusmagnus/passport-relayr | lib/strategy.js | RelayrStrategy | function RelayrStrategy(options, verifyCallback) {
if (!verifyCallback) { throw new TypeError('verify callback is required'); }
options = options || {};
options.authorizationURL = options.authorizationURL || 'https://api.relayr.io/oauth2/auth';
options.responseType = options.responseType || 'token';
... | javascript | function RelayrStrategy(options, verifyCallback) {
if (!verifyCallback) { throw new TypeError('verify callback is required'); }
options = options || {};
options.authorizationURL = options.authorizationURL || 'https://api.relayr.io/oauth2/auth';
options.responseType = options.responseType || 'token';
... | [
"function",
"RelayrStrategy",
"(",
"options",
",",
"verifyCallback",
")",
"{",
"if",
"(",
"!",
"verifyCallback",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'verify callback is required'",
")",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"opti... | `RelayrStrategy` constructor. | [
"RelayrStrategy",
"constructor",
"."
] | 9b5e7ec8f9e759f5b34a486d14399a6ea7694db0 | https://github.com/ianusmagnus/passport-relayr/blob/9b5e7ec8f9e759f5b34a486d14399a6ea7694db0/lib/strategy.js#L9-L26 |
51,057 | Degree53/takeown | index.js | attemptCallback | function attemptCallback(filePath, callback, attempts) {
try {
callback();
return;
} catch (error) {
if (attempts === 0) {
console.error('takeown: callback failed - exceeded attempts');
throw error;
}
switch (error.code) {
case 'EPERM':
case 'EACCES':
case 'EBUSY':
case 'ENOTEMPTY':
... | javascript | function attemptCallback(filePath, callback, attempts) {
try {
callback();
return;
} catch (error) {
if (attempts === 0) {
console.error('takeown: callback failed - exceeded attempts');
throw error;
}
switch (error.code) {
case 'EPERM':
case 'EACCES':
case 'EBUSY':
case 'ENOTEMPTY':
... | [
"function",
"attemptCallback",
"(",
"filePath",
",",
"callback",
",",
"attempts",
")",
"{",
"try",
"{",
"callback",
"(",
")",
";",
"return",
";",
"}",
"catch",
"(",
"error",
")",
"{",
"if",
"(",
"attempts",
"===",
"0",
")",
"{",
"console",
".",
"erro... | Intentionally locks up javascript thread for a fixed number of recursive calls to give Windows time to get its arse in gear. | [
"Intentionally",
"locks",
"up",
"javascript",
"thread",
"for",
"a",
"fixed",
"number",
"of",
"recursive",
"calls",
"to",
"give",
"Windows",
"time",
"to",
"get",
"its",
"arse",
"in",
"gear",
"."
] | 93040b0fadd1625a5dfa553e50cc16e10c8e361a | https://github.com/Degree53/takeown/blob/93040b0fadd1625a5dfa553e50cc16e10c8e361a/index.js#L14-L40 |
51,058 | Degree53/takeown | index.js | takeOwnership | function takeOwnership(filePath) {
try {
var stats = fs.lstatSync(filePath);
if (stats.isDirectory()) {
execSyncElevated('takeown /f "' + filePath + '" /r /d y');
} else {
execSyncElevated('takeown /f "' + filePath + '"');
}
return;
} catch (error) {
if (error.code === 'ENOENT') {
console.w... | javascript | function takeOwnership(filePath) {
try {
var stats = fs.lstatSync(filePath);
if (stats.isDirectory()) {
execSyncElevated('takeown /f "' + filePath + '" /r /d y');
} else {
execSyncElevated('takeown /f "' + filePath + '"');
}
return;
} catch (error) {
if (error.code === 'ENOENT') {
console.w... | [
"function",
"takeOwnership",
"(",
"filePath",
")",
"{",
"try",
"{",
"var",
"stats",
"=",
"fs",
".",
"lstatSync",
"(",
"filePath",
")",
";",
"if",
"(",
"stats",
".",
"isDirectory",
"(",
")",
")",
"{",
"execSyncElevated",
"(",
"'takeown /f \"'",
"+",
"file... | Calls fire and forget Windows specific command to seize control of a file or directory. Never seems to fail but we don't get any confirmation of success. | [
"Calls",
"fire",
"and",
"forget",
"Windows",
"specific",
"command",
"to",
"seize",
"control",
"of",
"a",
"file",
"or",
"directory",
".",
"Never",
"seems",
"to",
"fail",
"but",
"we",
"don",
"t",
"get",
"any",
"confirmation",
"of",
"success",
"."
] | 93040b0fadd1625a5dfa553e50cc16e10c8e361a | https://github.com/Degree53/takeown/blob/93040b0fadd1625a5dfa553e50cc16e10c8e361a/index.js#L45-L73 |
51,059 | RoboterHund/April1 | modules/spec.js | expand | function expand (node, args, i) {
var n = args.length;
var arg;
for (; i < n; i++) {
arg = args [i];
if (isNodeType (arg, types.MACRO)) {
expand (node, arg, 1);
} else {
node.push (arg);
}
}
return node;
} | javascript | function expand (node, args, i) {
var n = args.length;
var arg;
for (; i < n; i++) {
arg = args [i];
if (isNodeType (arg, types.MACRO)) {
expand (node, arg, 1);
} else {
node.push (arg);
}
}
return node;
} | [
"function",
"expand",
"(",
"node",
",",
"args",
",",
"i",
")",
"{",
"var",
"n",
"=",
"args",
".",
"length",
";",
"var",
"arg",
";",
"for",
"(",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"arg",
"=",
"args",
"[",
"i",
"]",
";",
"if",
"(... | push node items onto the spec node array
expand macros
@param {Array} node the spec node array to be generated
@param args node items
@param i
@returns {Array} the spec node array,
with the items appended | [
"push",
"node",
"items",
"onto",
"the",
"spec",
"node",
"array",
"expand",
"macros"
] | f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b | https://github.com/RoboterHund/April1/blob/f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b/modules/spec.js#L27-L40 |
51,060 | redisjs/jsr-server | lib/command/connection/ping.js | validate | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
if(args.length > 1) {
throw new CommandArgLength(cmd);
}
} | javascript | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
if(args.length > 1) {
throw new CommandArgLength(cmd);
}
} | [
"function",
"validate",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"AbstractCommand",
".",
"prototype",
".",
"validate",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"if",
"(",
"args",
".",
"length",
">",
"1",
")",
"{",
"throw",
"new",... | Validate the PING command. | [
"Validate",
"the",
"PING",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/connection/ping.js#L19-L24 |
51,061 | redisjs/jsr-server | lib/command/connection/ping.js | execute | function execute(req, res) {
if(req.args.length) return res.send(null, req.args[0]);
res.send(null, Constants.PONG);
} | javascript | function execute(req, res) {
if(req.args.length) return res.send(null, req.args[0]);
res.send(null, Constants.PONG);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"req",
".",
"args",
".",
"length",
")",
"return",
"res",
".",
"send",
"(",
"null",
",",
"req",
".",
"args",
"[",
"0",
"]",
")",
";",
"res",
".",
"send",
"(",
"null",
",",
"Co... | Respond to the PING command. | [
"Respond",
"to",
"the",
"PING",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/connection/ping.js#L29-L32 |
51,062 | olivoil/migrate-js | lib/migrate.js | defaultMigrationLoader | function defaultMigrationLoader(dir) {
let list = new List;
return new Promise((resolve, reject) => {
fs.readdir(dir, function(err, files) {
if (err) return reject(err);
const migrationFiles = files.filter((file) => file.match(/^\d+.*\.js$/)).sort();
... | javascript | function defaultMigrationLoader(dir) {
let list = new List;
return new Promise((resolve, reject) => {
fs.readdir(dir, function(err, files) {
if (err) return reject(err);
const migrationFiles = files.filter((file) => file.match(/^\d+.*\.js$/)).sort();
... | [
"function",
"defaultMigrationLoader",
"(",
"dir",
")",
"{",
"let",
"list",
"=",
"new",
"List",
";",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"fs",
".",
"readdir",
"(",
"dir",
",",
"function",
"(",
"err",
",",
"f... | default migration loader.
load files from disk. | [
"default",
"migration",
"loader",
".",
"load",
"files",
"from",
"disk",
"."
] | 130b1afe7715696df2a7841769a19dbfb4966b78 | https://github.com/olivoil/migrate-js/blob/130b1afe7715696df2a7841769a19dbfb4966b78/lib/migrate.js#L16-L40 |
51,063 | Tennu/tennu-admin | plugin.js | checkHostmask | function checkHostmask (hostmask, admin) {
return names.every(function (name) {
const result = admin[name].test(hostmask[name]);
client.debug("PluginAdmin", format("%s: %s, %s (%s)",
name, hostmask[name], admin[name], result));
return res... | javascript | function checkHostmask (hostmask, admin) {
return names.every(function (name) {
const result = admin[name].test(hostmask[name]);
client.debug("PluginAdmin", format("%s: %s, %s (%s)",
name, hostmask[name], admin[name], result));
return res... | [
"function",
"checkHostmask",
"(",
"hostmask",
",",
"admin",
")",
"{",
"return",
"names",
".",
"every",
"(",
"function",
"(",
"name",
")",
"{",
"const",
"result",
"=",
"admin",
"[",
"name",
"]",
".",
"test",
"(",
"hostmask",
"[",
"name",
"]",
")",
";"... | tennu.Client! -> Hostmask -> Admin -> boolean | [
"tennu",
".",
"Client!",
"-",
">",
"Hostmask",
"-",
">",
"Admin",
"-",
">",
"boolean"
] | 19d68570a0db845251877ee6f3b29f74678f7bbb | https://github.com/Tennu/tennu-admin/blob/19d68570a0db845251877ee6f3b29f74678f7bbb/plugin.js#L69-L78 |
51,064 | Tennu/tennu-admin | plugin.js | function (hostmask, opts) {
return Promise.try(function () {
if (opts && opts.allowAll === true) {
return true;
}
const customAdmins = opts && opts.customAdmins;
const memoizationKey = opts && opts.memoizeOver;
... | javascript | function (hostmask, opts) {
return Promise.try(function () {
if (opts && opts.allowAll === true) {
return true;
}
const customAdmins = opts && opts.customAdmins;
const memoizationKey = opts && opts.memoizeOver;
... | [
"function",
"(",
"hostmask",
",",
"opts",
")",
"{",
"return",
"Promise",
".",
"try",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"opts",
"&&",
"opts",
".",
"allowAll",
"===",
"true",
")",
"{",
"return",
"true",
";",
"}",
"const",
"customAdmins",
"=",
... | Hostmask -> Promise boolean | [
"Hostmask",
"-",
">",
"Promise",
"boolean"
] | 19d68570a0db845251877ee6f3b29f74678f7bbb | https://github.com/Tennu/tennu-admin/blob/19d68570a0db845251877ee6f3b29f74678f7bbb/plugin.js#L84-L126 | |
51,065 | vesln/obsessed | lib/obsessed-error.js | ObsessedError | function ObsessedError(message, errors) {
Error.captureStackTrace(this, ObsessedError);
this.message = this.combine(message, errors);
} | javascript | function ObsessedError(message, errors) {
Error.captureStackTrace(this, ObsessedError);
this.message = this.combine(message, errors);
} | [
"function",
"ObsessedError",
"(",
"message",
",",
"errors",
")",
"{",
"Error",
".",
"captureStackTrace",
"(",
"this",
",",
"ObsessedError",
")",
";",
"this",
".",
"message",
"=",
"this",
".",
"combine",
"(",
"message",
",",
"errors",
")",
";",
"}"
] | Custom error. Includes all error messages.
@param {String} message
@param {Array} errors
@constructor | [
"Custom",
"error",
".",
"Includes",
"all",
"error",
"messages",
"."
] | 4878dfafdea241bff9ad5c57acc2395a4f3487a6 | https://github.com/vesln/obsessed/blob/4878dfafdea241bff9ad5c57acc2395a4f3487a6/lib/obsessed-error.js#L10-L13 |
51,066 | vkiding/judpack-lib | src/cordova/prepare.js | preparePlatforms | function preparePlatforms (platformList, projectRoot, options) {
return Q.all(platformList.map(function(platform) {
// TODO: this need to be replaced by real projectInfo
// instance for current project.
var project = {
root: projectRoot,
projectConfig: new ConfigParse... | javascript | function preparePlatforms (platformList, projectRoot, options) {
return Q.all(platformList.map(function(platform) {
// TODO: this need to be replaced by real projectInfo
// instance for current project.
var project = {
root: projectRoot,
projectConfig: new ConfigParse... | [
"function",
"preparePlatforms",
"(",
"platformList",
",",
"projectRoot",
",",
"options",
")",
"{",
"return",
"Q",
".",
"all",
"(",
"platformList",
".",
"map",
"(",
"function",
"(",
"platform",
")",
"{",
"// TODO: this need to be replaced by real projectInfo",
"// in... | Calls `platformApi.prepare` for each platform in project
@param {string[]} platformList List of platforms, added to current project
@param {string} projectRoot Project root directory
@return {Promise} | [
"Calls",
"platformApi",
".",
"prepare",
"for",
"each",
"platform",
"in",
"project"
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/cordova/prepare.js#L80-L131 |
51,067 | rowanmanning/mocha-srv | lib/mocha-srv.js | defaultOpts | function defaultOpts (opts) {
opts = opts || {};
opts.title = opts.title || 'Test Suite';
opts.ui = (opts.ui && opts.ui.toLowerCase() === 'tdd' ? 'tdd' : 'bdd');
opts.path = path.resolve(opts.path || '.');
opts.host = opts.host || 'localhost';
opts.port = opts.port || 3000;
return opts;
} | javascript | function defaultOpts (opts) {
opts = opts || {};
opts.title = opts.title || 'Test Suite';
opts.ui = (opts.ui && opts.ui.toLowerCase() === 'tdd' ? 'tdd' : 'bdd');
opts.path = path.resolve(opts.path || '.');
opts.host = opts.host || 'localhost';
opts.port = opts.port || 3000;
return opts;
} | [
"function",
"defaultOpts",
"(",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"opts",
".",
"title",
"=",
"opts",
".",
"title",
"||",
"'Test Suite'",
";",
"opts",
".",
"ui",
"=",
"(",
"opts",
".",
"ui",
"&&",
"opts",
".",
"ui",
".",
... | Default server options | [
"Default",
"server",
"options"
] | 47af5e5bc91bb37ba5ccdb0ea7cf1771748fdff2 | https://github.com/rowanmanning/mocha-srv/blob/47af5e5bc91bb37ba5ccdb0ea7cf1771748fdff2/lib/mocha-srv.js#L7-L15 |
51,068 | AVVS/callback-queue | index.js | cleanup | function cleanup(key) {
callbackQueue[key] = null;
if (++nulls > nullThreshold) {
callbackQueue = omit(callbackQueue, function removeNulls(datum) {
return datum === null;
});
}
} | javascript | function cleanup(key) {
callbackQueue[key] = null;
if (++nulls > nullThreshold) {
callbackQueue = omit(callbackQueue, function removeNulls(datum) {
return datum === null;
});
}
} | [
"function",
"cleanup",
"(",
"key",
")",
"{",
"callbackQueue",
"[",
"key",
"]",
"=",
"null",
";",
"if",
"(",
"++",
"nulls",
">",
"nullThreshold",
")",
"{",
"callbackQueue",
"=",
"omit",
"(",
"callbackQueue",
",",
"function",
"removeNulls",
"(",
"datum",
"... | Performs cleanup on queue object
@param {String} key | [
"Performs",
"cleanup",
"on",
"queue",
"object"
] | 3edc65093812dd713f0a24c951dbfdd9e8ca6135 | https://github.com/AVVS/callback-queue/blob/3edc65093812dd713f0a24c951dbfdd9e8ca6135/index.js#L29-L36 |
51,069 | AVVS/callback-queue | index.js | iterateOverCallbacks | function iterateOverCallbacks(bucket, args) {
bucket.forEach(function iterator(callback) {
nextTick(function queuedCallback() {
callback.apply(null, args);
});
});
} | javascript | function iterateOverCallbacks(bucket, args) {
bucket.forEach(function iterator(callback) {
nextTick(function queuedCallback() {
callback.apply(null, args);
});
});
} | [
"function",
"iterateOverCallbacks",
"(",
"bucket",
",",
"args",
")",
"{",
"bucket",
".",
"forEach",
"(",
"function",
"iterator",
"(",
"callback",
")",
"{",
"nextTick",
"(",
"function",
"queuedCallback",
"(",
")",
"{",
"callback",
".",
"apply",
"(",
"null",
... | Iterates over callbacks and calls them with passed args
@param {Array} bucket
@param {Array} args | [
"Iterates",
"over",
"callbacks",
"and",
"calls",
"them",
"with",
"passed",
"args"
] | 3edc65093812dd713f0a24c951dbfdd9e8ca6135 | https://github.com/AVVS/callback-queue/blob/3edc65093812dd713f0a24c951dbfdd9e8ca6135/index.js#L43-L49 |
51,070 | vkiding/jud-vue-render | src/render/browser/render/gesture.js | touchstartHandler | function touchstartHandler(event) {
if (Object.keys(gestures).length === 0) {
docEl.addEventListener('touchmove', touchmoveHandler, false)
docEl.addEventListener('touchend', touchendHandler, false)
docEl.addEventListener('touchcancel', touchcancelHandler, false)
}
// record every touch
for (var i ... | javascript | function touchstartHandler(event) {
if (Object.keys(gestures).length === 0) {
docEl.addEventListener('touchmove', touchmoveHandler, false)
docEl.addEventListener('touchend', touchendHandler, false)
docEl.addEventListener('touchcancel', touchcancelHandler, false)
}
// record every touch
for (var i ... | [
"function",
"touchstartHandler",
"(",
"event",
")",
"{",
"if",
"(",
"Object",
".",
"keys",
"(",
"gestures",
")",
".",
"length",
"===",
"0",
")",
"{",
"docEl",
".",
"addEventListener",
"(",
"'touchmove'",
",",
"touchmoveHandler",
",",
"false",
")",
"docEl",... | take over the touchstart events. Add new touches to the gestures.
If there is no previous records, then bind touchmove, tochend
and touchcancel events.
new touches initialized with state 'tapping', and within 500 milliseconds
if the state is still tapping, then trigger gesture 'press'.
If there are two touche points, t... | [
"take",
"over",
"the",
"touchstart",
"events",
".",
"Add",
"new",
"touches",
"to",
"the",
"gestures",
".",
"If",
"there",
"is",
"no",
"previous",
"records",
"then",
"bind",
"touchmove",
"tochend",
"and",
"touchcancel",
"events",
".",
"new",
"touches",
"initi... | 07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47 | https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/render/gesture.js#L121-L177 |
51,071 | vkiding/jud-vue-render | src/render/browser/render/gesture.js | touchendHandler | function touchendHandler(event) {
if (Object.keys(gestures).length == 2) {
var elements = []
for (var p in gestures) {
elements.push(gestures[p].element)
}
fireEvent(getCommonAncestor(elements[0], elements[1]), 'dualtouchend', {
touches: slice.call(event.touches),
touchEvent: event
... | javascript | function touchendHandler(event) {
if (Object.keys(gestures).length == 2) {
var elements = []
for (var p in gestures) {
elements.push(gestures[p].element)
}
fireEvent(getCommonAncestor(elements[0], elements[1]), 'dualtouchend', {
touches: slice.call(event.touches),
touchEvent: event
... | [
"function",
"touchendHandler",
"(",
"event",
")",
"{",
"if",
"(",
"Object",
".",
"keys",
"(",
"gestures",
")",
".",
"length",
"==",
"2",
")",
"{",
"var",
"elements",
"=",
"[",
"]",
"for",
"(",
"var",
"p",
"in",
"gestures",
")",
"{",
"elements",
"."... | handle touchend event
1. if there are tow touch points, then trigger 'dualtouchend'如
2. traverse every touch piont:
> if tapping, then trigger 'tap'.
If there is a tap 300 milliseconds before, then it's a 'doubletap'.
> if padding, then decide to trigger 'panend' or 'swipe'
> if pressing, then trigger 'pressend'.
3.... | [
"handle",
"touchend",
"event"
] | 07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47 | https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/render/gesture.js#L333-L422 |
51,072 | fernandofranca/launchpod | lib/repl-utils.js | replWriter | function replWriter(output) {
if (output){
if (output.constructor && output.constructor.name !== "String"){
return util.inspect(output, {colors:true}) + '\n';
}
}
return output + '\n';
} | javascript | function replWriter(output) {
if (output){
if (output.constructor && output.constructor.name !== "String"){
return util.inspect(output, {colors:true}) + '\n';
}
}
return output + '\n';
} | [
"function",
"replWriter",
"(",
"output",
")",
"{",
"if",
"(",
"output",
")",
"{",
"if",
"(",
"output",
".",
"constructor",
"&&",
"output",
".",
"constructor",
".",
"name",
"!==",
"\"String\"",
")",
"{",
"return",
"util",
".",
"inspect",
"(",
"output",
... | Can I haz colorz?
Does objects pretty printing | [
"Can",
"I",
"haz",
"colorz?",
"Does",
"objects",
"pretty",
"printing"
] | 882d614a4271846e17b3ba0ca319340a607580bc | https://github.com/fernandofranca/launchpod/blob/882d614a4271846e17b3ba0ca319340a607580bc/lib/repl-utils.js#L9-L17 |
51,073 | hiproxy/conf-parser | src/input.js | function (msg, line, column) {
this._info(line || this.line, column || this.column, msg, true, true);
} | javascript | function (msg, line, column) {
this._info(line || this.line, column || this.column, msg, true, true);
} | [
"function",
"(",
"msg",
",",
"line",
",",
"column",
")",
"{",
"this",
".",
"_info",
"(",
"line",
"||",
"this",
".",
"line",
",",
"column",
"||",
"this",
".",
"column",
",",
"msg",
",",
"true",
",",
"true",
")",
";",
"}"
] | print error message | [
"print",
"error",
"message"
] | fcfdde3b933afdbb573eb5f9e01baec7e489e7dc | https://github.com/hiproxy/conf-parser/blob/fcfdde3b933afdbb573eb5f9e01baec7e489e7dc/src/input.js#L56-L58 | |
51,074 | tolokoban/ToloFrameWork | ker/mod/tfw.view.slider.js | xToValue | function xToValue(x) {
const
rect = this.$.getBoundingClientRect(),
percent = x / rect.width,
range = this.max - this.min,
value = Math.floor(percent * range + 0.5);
return this.min + this.step * Math.floor(value / this.step);
} | javascript | function xToValue(x) {
const
rect = this.$.getBoundingClientRect(),
percent = x / rect.width,
range = this.max - this.min,
value = Math.floor(percent * range + 0.5);
return this.min + this.step * Math.floor(value / this.step);
} | [
"function",
"xToValue",
"(",
"x",
")",
"{",
"const",
"rect",
"=",
"this",
".",
"$",
".",
"getBoundingClientRect",
"(",
")",
",",
"percent",
"=",
"x",
"/",
"rect",
".",
"width",
",",
"range",
"=",
"this",
".",
"max",
"-",
"this",
".",
"min",
",",
... | Convert a X position into the nearest value.
@this ViewXJS
@param {float} x - X position relative to the View.
@returns {integer} The nearest integer value. | [
"Convert",
"a",
"X",
"position",
"into",
"the",
"nearest",
"value",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.view.slider.js#L48-L55 |
51,075 | tolokoban/ToloFrameWork | ker/mod/tfw.view.slider.js | valueToX | function valueToX(value) {
const
rect = this.$.getBoundingClientRect(),
percent = (value - this.min) / (this.max - this.min);
return rect.width * percent;
} | javascript | function valueToX(value) {
const
rect = this.$.getBoundingClientRect(),
percent = (value - this.min) / (this.max - this.min);
return rect.width * percent;
} | [
"function",
"valueToX",
"(",
"value",
")",
"{",
"const",
"rect",
"=",
"this",
".",
"$",
".",
"getBoundingClientRect",
"(",
")",
",",
"percent",
"=",
"(",
"value",
"-",
"this",
".",
"min",
")",
"/",
"(",
"this",
".",
"max",
"-",
"this",
".",
"min",
... | Convert a value into X position relative to View.
@this ViewXJS
@param {integer} value - Current value.
@returns {float} X position. | [
"Convert",
"a",
"value",
"into",
"X",
"position",
"relative",
"to",
"View",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.view.slider.js#L64-L69 |
51,076 | tolokoban/ToloFrameWork | ker/mod/tfw.view.slider.js | onDrag | function onDrag(evt) {
const
rect = this._rect,
x = valueToX.call(this, this._value),
min = -x,
max = rect.width - x,
tx = clamp(evt.x - evt.x0, min, max),
value = xToValue.call(this, x + tx);
Dom.css(this.$elements.button, { transform: `translateX(${tx}px)` });
... | javascript | function onDrag(evt) {
const
rect = this._rect,
x = valueToX.call(this, this._value),
min = -x,
max = rect.width - x,
tx = clamp(evt.x - evt.x0, min, max),
value = xToValue.call(this, x + tx);
Dom.css(this.$elements.button, { transform: `translateX(${tx}px)` });
... | [
"function",
"onDrag",
"(",
"evt",
")",
"{",
"const",
"rect",
"=",
"this",
".",
"_rect",
",",
"x",
"=",
"valueToX",
".",
"call",
"(",
"this",
",",
"this",
".",
"_value",
")",
",",
"min",
"=",
"-",
"x",
",",
"max",
"=",
"rect",
".",
"width",
"-",... | Drag the button.
@this ViewXJS
@param {object} evt - `{ x, ... }`
@returns {undefined} | [
"Drag",
"the",
"button",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.view.slider.js#L90-L104 |
51,077 | tolokoban/ToloFrameWork | ker/mod/tfw.view.slider.js | onDragEnd | function onDragEnd(evt) {
this._dragging = false;
const
rect = this._rect,
x = valueToX.call(this, this._value),
min = -x,
max = rect.width - x,
tx = clamp(evt.x - evt.x0, min, max);
Dom.css(this.$elements.button, { transform: `translateX(0px)` });
this.value = x... | javascript | function onDragEnd(evt) {
this._dragging = false;
const
rect = this._rect,
x = valueToX.call(this, this._value),
min = -x,
max = rect.width - x,
tx = clamp(evt.x - evt.x0, min, max);
Dom.css(this.$elements.button, { transform: `translateX(0px)` });
this.value = x... | [
"function",
"onDragEnd",
"(",
"evt",
")",
"{",
"this",
".",
"_dragging",
"=",
"false",
";",
"const",
"rect",
"=",
"this",
".",
"_rect",
",",
"x",
"=",
"valueToX",
".",
"call",
"(",
"this",
",",
"this",
".",
"_value",
")",
",",
"min",
"=",
"-",
"x... | Enf of grag for the button. We can remove the temporaty translation.
@this ViewXJS
@param {object} evt - `{ x, ... }`
@returns {undefined} | [
"Enf",
"of",
"grag",
"for",
"the",
"button",
".",
"We",
"can",
"remove",
"the",
"temporaty",
"translation",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.view.slider.js#L113-L124 |
51,078 | tolokoban/ToloFrameWork | ker/mod/tfw.view.slider.js | moveToValue | function moveToValue(value) {
const left = 100 * (value - this.min) / (this.max - this.min);
Dom.css(this.$elements.button, { left: `${left}%` });
} | javascript | function moveToValue(value) {
const left = 100 * (value - this.min) / (this.max - this.min);
Dom.css(this.$elements.button, { left: `${left}%` });
} | [
"function",
"moveToValue",
"(",
"value",
")",
"{",
"const",
"left",
"=",
"100",
"*",
"(",
"value",
"-",
"this",
".",
"min",
")",
"/",
"(",
"this",
".",
"max",
"-",
"this",
".",
"min",
")",
";",
"Dom",
".",
"css",
"(",
"this",
".",
"$elements",
... | Move button to a position mapping the value.
@this ViewXJS
@param {integer} value - Value.
@returns {undefined} | [
"Move",
"button",
"to",
"a",
"position",
"mapping",
"the",
"value",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.view.slider.js#L144-L147 |
51,079 | pattern-library/pattern-library-utilities | lib/get-category-path.js | categoryPathPlain | function categoryPathPlain(patternObject) {
'use strict';
// check for subcategory
if (patternObject.subcategory) {
return path.join(patternObject.category, patternObject.subcategory);
}
else {
return patternObject.category;
}
} | javascript | function categoryPathPlain(patternObject) {
'use strict';
// check for subcategory
if (patternObject.subcategory) {
return path.join(patternObject.category, patternObject.subcategory);
}
else {
return patternObject.category;
}
} | [
"function",
"categoryPathPlain",
"(",
"patternObject",
")",
"{",
"'use strict'",
";",
"// check for subcategory",
"if",
"(",
"patternObject",
".",
"subcategory",
")",
"{",
"return",
"path",
".",
"join",
"(",
"patternObject",
".",
"category",
",",
"patternObject",
... | Determines the category directory structure without any conversion
@param {Object} patternObject individual pattern's data (from /pattern-name/pattern.yml)
@return {String} categoryPath internal path url to category | [
"Determines",
"the",
"category",
"directory",
"structure",
"without",
"any",
"conversion"
] | a0198f7bb698eb5b859576b11afa3d0ebd3e5911 | https://github.com/pattern-library/pattern-library-utilities/blob/a0198f7bb698eb5b859576b11afa3d0ebd3e5911/lib/get-category-path.js#L58-L68 |
51,080 | pattern-library/pattern-library-utilities | lib/get-category-path.js | categoryPathConverted | function categoryPathConverted(categoryObject, patternObject) {
'use strict';
// convert our category path using the categoryObject
var categoryPath = utility.categoryNameConverter(categoryObject.categories, patternObject.category);
// check for subcategory
if (patternObject.subcategory) {
var subcatego... | javascript | function categoryPathConverted(categoryObject, patternObject) {
'use strict';
// convert our category path using the categoryObject
var categoryPath = utility.categoryNameConverter(categoryObject.categories, patternObject.category);
// check for subcategory
if (patternObject.subcategory) {
var subcatego... | [
"function",
"categoryPathConverted",
"(",
"categoryObject",
",",
"patternObject",
")",
"{",
"'use strict'",
";",
"// convert our category path using the categoryObject",
"var",
"categoryPath",
"=",
"utility",
".",
"categoryNameConverter",
"(",
"categoryObject",
".",
"categori... | Determines the category directory structure by converting names according to a category object
@param {Object} categoryObject object of category names and their conversion titles
@param {Object} patternObject individual pattern's data (from /pattern-name/pattern.yml)
@return {String} categoryPath internal path url... | [
"Determines",
"the",
"category",
"directory",
"structure",
"by",
"converting",
"names",
"according",
"to",
"a",
"category",
"object"
] | a0198f7bb698eb5b859576b11afa3d0ebd3e5911 | https://github.com/pattern-library/pattern-library-utilities/blob/a0198f7bb698eb5b859576b11afa3d0ebd3e5911/lib/get-category-path.js#L79-L93 |
51,081 | humanise-ai/botmaster-humanise-ware | examples/watson-fb-messenger/botmaster/middleware/wrapped/humanise.js | getHandoffFromUpdate | async function getHandoffFromUpdate (update) {
if (!has(update, 'message.text')) {
return
}
// having to do own request as watson-developer-cloud package is broken for
// Tone analyzer
const toneAnalyzerUrl = 'https://gateway.watsonplatform.net/tone-analyzer/api'
const params = {
// Get the text f... | javascript | async function getHandoffFromUpdate (update) {
if (!has(update, 'message.text')) {
return
}
// having to do own request as watson-developer-cloud package is broken for
// Tone analyzer
const toneAnalyzerUrl = 'https://gateway.watsonplatform.net/tone-analyzer/api'
const params = {
// Get the text f... | [
"async",
"function",
"getHandoffFromUpdate",
"(",
"update",
")",
"{",
"if",
"(",
"!",
"has",
"(",
"update",
",",
"'message.text'",
")",
")",
"{",
"return",
"}",
"// having to do own request as watson-developer-cloud package is broken for",
"// Tone analyzer",
"const",
"... | This is an example implementation of the getHandoffFromUpdate optional
parameter. In this example, we determine wether an update should be handed off
to a human based on the tone of a certain message | [
"This",
"is",
"an",
"example",
"implementation",
"of",
"the",
"getHandoffFromUpdate",
"optional",
"parameter",
".",
"In",
"this",
"example",
"we",
"determine",
"wether",
"an",
"update",
"should",
"be",
"handed",
"off",
"to",
"a",
"human",
"based",
"on",
"the",... | a94af55ace6a4c90f7f795d84d08ac7f2a920f82 | https://github.com/humanise-ai/botmaster-humanise-ware/blob/a94af55ace6a4c90f7f795d84d08ac7f2a920f82/examples/watson-fb-messenger/botmaster/middleware/wrapped/humanise.js#L28-L71 |
51,082 | christkv/vitesse-jsonspec | lib/json_schema.js | function(path, obj) {
if(path == '#') return obj;
path = path.substr(1);
var parts = path.split('/');
parts.shift();
// Locate object
for(var i = 0; i < parts.length; i++) {
obj = obj[parts[i]];
}
return obj;
} | javascript | function(path, obj) {
if(path == '#') return obj;
path = path.substr(1);
var parts = path.split('/');
parts.shift();
// Locate object
for(var i = 0; i < parts.length; i++) {
obj = obj[parts[i]];
}
return obj;
} | [
"function",
"(",
"path",
",",
"obj",
")",
"{",
"if",
"(",
"path",
"==",
"'#'",
")",
"return",
"obj",
";",
"path",
"=",
"path",
".",
"substr",
"(",
"1",
")",
";",
"var",
"parts",
"=",
"path",
".",
"split",
"(",
"'/'",
")",
";",
"parts",
".",
"... | Let's resolve the path | [
"Let",
"s",
"resolve",
"the",
"path"
] | 7c95dfac43b258b1a7ad6afb5bfe90eb95ef90b1 | https://github.com/christkv/vitesse-jsonspec/blob/7c95dfac43b258b1a7ad6afb5bfe90eb95ef90b1/lib/json_schema.js#L512-L524 | |
51,083 | christkv/vitesse-jsonspec | lib/json_schema.js | function(reference, callback) {
var url = reference.url;
var uri = reference.uri;
var schema = reference.schema;
// Execute the request
request(url, function(error, response, body) {
// We have an error
if(error) return callback(error);
// Got the body, parse it
var obj = JS... | javascript | function(reference, callback) {
var url = reference.url;
var uri = reference.uri;
var schema = reference.schema;
// Execute the request
request(url, function(error, response, body) {
// We have an error
if(error) return callback(error);
// Got the body, parse it
var obj = JS... | [
"function",
"(",
"reference",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"reference",
".",
"url",
";",
"var",
"uri",
"=",
"reference",
".",
"uri",
";",
"var",
"schema",
"=",
"reference",
".",
"schema",
";",
"// Execute the request",
"request",
"(",
"u... | Grab the url | [
"Grab",
"the",
"url"
] | 7c95dfac43b258b1a7ad6afb5bfe90eb95ef90b1 | https://github.com/christkv/vitesse-jsonspec/blob/7c95dfac43b258b1a7ad6afb5bfe90eb95ef90b1/lib/json_schema.js#L527-L559 | |
51,084 | christkv/vitesse-jsonspec | lib/json_schema.js | function(schema, field, reference, seenObjects, path, options) {
// Don't resolve recursive relation
if(reference == '#') return {$ref: '#'}
// Get the path
var path = reference.substr(1).split('/').slice(1);
path = path.map(function(x) {
x = x.replace(/~1/g, '/').replace(/~0/g, '~');
return decodeUR... | javascript | function(schema, field, reference, seenObjects, path, options) {
// Don't resolve recursive relation
if(reference == '#') return {$ref: '#'}
// Get the path
var path = reference.substr(1).split('/').slice(1);
path = path.map(function(x) {
x = x.replace(/~1/g, '/').replace(/~0/g, '~');
return decodeUR... | [
"function",
"(",
"schema",
",",
"field",
",",
"reference",
",",
"seenObjects",
",",
"path",
",",
"options",
")",
"{",
"// Don't resolve recursive relation",
"if",
"(",
"reference",
"==",
"'#'",
")",
"return",
"{",
"$ref",
":",
"'#'",
"}",
"// Get the path",
... | De-reference | [
"De",
"-",
"reference"
] | 7c95dfac43b258b1a7ad6afb5bfe90eb95ef90b1 | https://github.com/christkv/vitesse-jsonspec/blob/7c95dfac43b258b1a7ad6afb5bfe90eb95ef90b1/lib/json_schema.js#L610-L648 | |
51,085 | csbun/grunt-cmd | lib/cmd.js | pathToId | function pathToId(file, base, rel) {
var id = rel ? path.resolve(rel, '..', file) : file;
id = path.relative(base, id);
// replace \ with / in windows' path and remove extname in path
id = id.replace(BACKLASH_RE, '/').replace(JS_EXT_RE, '');
return id;
} | javascript | function pathToId(file, base, rel) {
var id = rel ? path.resolve(rel, '..', file) : file;
id = path.relative(base, id);
// replace \ with / in windows' path and remove extname in path
id = id.replace(BACKLASH_RE, '/').replace(JS_EXT_RE, '');
return id;
} | [
"function",
"pathToId",
"(",
"file",
",",
"base",
",",
"rel",
")",
"{",
"var",
"id",
"=",
"rel",
"?",
"path",
".",
"resolve",
"(",
"rel",
",",
"'..'",
",",
"file",
")",
":",
"file",
";",
"id",
"=",
"path",
".",
"relative",
"(",
"base",
",",
"id... | Convert filepath to toplevel module id
@param {String} file - filepath to convert
@param {String} base - basepath of seajs
@param {String} [rel] - relative path of file
@returns {String} id | [
"Convert",
"filepath",
"to",
"toplevel",
"module",
"id"
] | a806eb8b890e4e6d218341fc4bd45fdd080375ca | https://github.com/csbun/grunt-cmd/blob/a806eb8b890e4e6d218341fc4bd45fdd080375ca/lib/cmd.js#L23-L29 |
51,086 | csbun/grunt-cmd | lib/cmd.js | idToPath | function idToPath(id, config) {
var alias = config.alias || {};
return alias.hasOwnProperty(id) ?
path.resolve(alias[id]) :
path.resolve(config.base, id) + '.js';
} | javascript | function idToPath(id, config) {
var alias = config.alias || {};
return alias.hasOwnProperty(id) ?
path.resolve(alias[id]) :
path.resolve(config.base, id) + '.js';
} | [
"function",
"idToPath",
"(",
"id",
",",
"config",
")",
"{",
"var",
"alias",
"=",
"config",
".",
"alias",
"||",
"{",
"}",
";",
"return",
"alias",
".",
"hasOwnProperty",
"(",
"id",
")",
"?",
"path",
".",
"resolve",
"(",
"alias",
"[",
"id",
"]",
")",
... | Convert toplevel module id to filepath
@private | [
"Convert",
"toplevel",
"module",
"id",
"to",
"filepath"
] | a806eb8b890e4e6d218341fc4bd45fdd080375ca | https://github.com/csbun/grunt-cmd/blob/a806eb8b890e4e6d218341fc4bd45fdd080375ca/lib/cmd.js#L35-L40 |
51,087 | writetome51/array-replace-adjacent-at | dist/index.js | replaceAdjacentAt | function replaceAdjacentAt(index, newValues, array) {
error_if_not_array_1.errorIfNotArray(newValues);
// The other parameters, index and array, are type-checked here:
array_replace_adjacent_items_1._replaceAdjacentItems(index, newValues.length, newValues, array);
} | javascript | function replaceAdjacentAt(index, newValues, array) {
error_if_not_array_1.errorIfNotArray(newValues);
// The other parameters, index and array, are type-checked here:
array_replace_adjacent_items_1._replaceAdjacentItems(index, newValues.length, newValues, array);
} | [
"function",
"replaceAdjacentAt",
"(",
"index",
",",
"newValues",
",",
"array",
")",
"{",
"error_if_not_array_1",
".",
"errorIfNotArray",
"(",
"newValues",
")",
";",
"// The other parameters, index and array, are type-checked here:",
"array_replace_adjacent_items_1",
".",
"_re... | Replaces adjacent items, beginning at `index`, with the same number of `newValues`, in `array`. `index` can be negative or positive. The number of adjacent items that get replaced equals `newValues.length`. | [
"Replaces",
"adjacent",
"items",
"beginning",
"at",
"index",
"with",
"the",
"same",
"number",
"of",
"newValues",
"in",
"array",
".",
"index",
"can",
"be",
"negative",
"or",
"positive",
".",
"The",
"number",
"of",
"adjacent",
"items",
"that",
"get",
"replaced... | 06d86d3b28adbd3ab2d82616beb7824f475c322e | https://github.com/writetome51/array-replace-adjacent-at/blob/06d86d3b28adbd3ab2d82616beb7824f475c322e/dist/index.js#L8-L12 |
51,088 | integreat-io/great-uri-template | lib/filters/append.js | append | function append (value, string) {
if (
value === null || value === undefined || value === '' ||
string === null || string === undefined
) {
return value
}
return value + string
} | javascript | function append (value, string) {
if (
value === null || value === undefined || value === '' ||
string === null || string === undefined
) {
return value
}
return value + string
} | [
"function",
"append",
"(",
"value",
",",
"string",
")",
"{",
"if",
"(",
"value",
"===",
"null",
"||",
"value",
"===",
"undefined",
"||",
"value",
"===",
"''",
"||",
"string",
"===",
"null",
"||",
"string",
"===",
"undefined",
")",
"{",
"return",
"value... | Append the given string to the value, unless the value is empty.
@param {string} value - The value to append to
@returns {string} The appended result | [
"Append",
"the",
"given",
"string",
"to",
"the",
"value",
"unless",
"the",
"value",
"is",
"empty",
"."
] | 0e896ead0567737cf31a4a8b76a26cfa6ce60759 | https://github.com/integreat-io/great-uri-template/blob/0e896ead0567737cf31a4a8b76a26cfa6ce60759/lib/filters/append.js#L6-L14 |
51,089 | WebArtWork/derer | lib/parser.js | TokenParser | function TokenParser(tokens, filters, autoescape, line, filename) {
this.out = [];
this.state = [];
this.filterApplyIdx = [];
this._parsers = {};
this.line = line;
this.filename = filename;
this.filters = filters;
this.escape = autoescape;
this.parse = function () {
var self = this;
if (self... | javascript | function TokenParser(tokens, filters, autoescape, line, filename) {
this.out = [];
this.state = [];
this.filterApplyIdx = [];
this._parsers = {};
this.line = line;
this.filename = filename;
this.filters = filters;
this.escape = autoescape;
this.parse = function () {
var self = this;
if (self... | [
"function",
"TokenParser",
"(",
"tokens",
",",
"filters",
",",
"autoescape",
",",
"line",
",",
"filename",
")",
"{",
"this",
".",
"out",
"=",
"[",
"]",
";",
"this",
".",
"state",
"=",
"[",
"]",
";",
"this",
".",
"filterApplyIdx",
"=",
"[",
"]",
";"... | Parse strings of variables and tags into tokens for future compilation.
@class
@param {array} tokens Pre-split tokens read by the Lexer.
@param {object} filters Keyed object of filters that may be applied to variables.
@param {boolean} autoescape Whether or not this should be autoescaped.
@param {number} lin... | [
"Parse",
"strings",
"of",
"variables",
"and",
"tags",
"into",
"tokens",
"for",
"future",
"compilation",
"."
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/parser.js#L60-L106 |
51,090 | WebArtWork/derer | lib/parser.js | function (token, match, lastState) {
var self = this;
match = match.split('.');
if (_reserved.indexOf(match[0]) !== -1) {
utils.throwError('Reserved keyword "' + match[0] + '" attempted to be used as a variable', self.line, self.filename);
}
self.filterApplyIdx.push(self.out.length);
if... | javascript | function (token, match, lastState) {
var self = this;
match = match.split('.');
if (_reserved.indexOf(match[0]) !== -1) {
utils.throwError('Reserved keyword "' + match[0] + '" attempted to be used as a variable', self.line, self.filename);
}
self.filterApplyIdx.push(self.out.length);
if... | [
"function",
"(",
"token",
",",
"match",
",",
"lastState",
")",
"{",
"var",
"self",
"=",
"this",
";",
"match",
"=",
"match",
".",
"split",
"(",
"'.'",
")",
";",
"if",
"(",
"_reserved",
".",
"indexOf",
"(",
"match",
"[",
"0",
"]",
")",
"!==",
"-",
... | Parse variable token
@param {{match: string, type: number, line: number}} token Lexer token object.
@param {string} match Shortcut for token.match
@param {number} lastState Lexer token type state.
@return {undefined}
@private | [
"Parse",
"variable",
"token"
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/parser.js#L368-L387 | |
51,091 | WebArtWork/derer | lib/parser.js | function (match) {
var temp = match[0], result;
function checkDot(ctx) {
var c = ctx + temp,
m = match,
build = '';
build = '(typeof ' + c + ' !== "undefined" && ' + c + ' !== null';
utils.each(m, function (v, i) {
if (i === 0) {
return;
}
bu... | javascript | function (match) {
var temp = match[0], result;
function checkDot(ctx) {
var c = ctx + temp,
m = match,
build = '';
build = '(typeof ' + c + ' !== "undefined" && ' + c + ' !== null';
utils.each(m, function (v, i) {
if (i === 0) {
return;
}
bu... | [
"function",
"(",
"match",
")",
"{",
"var",
"temp",
"=",
"match",
"[",
"0",
"]",
",",
"result",
";",
"function",
"checkDot",
"(",
"ctx",
")",
"{",
"var",
"c",
"=",
"ctx",
"+",
"temp",
",",
"m",
"=",
"match",
",",
"build",
"=",
"''",
";",
"build"... | Return contextual dot-check string for a match
@param {string} match Shortcut for token.match
@private | [
"Return",
"contextual",
"dot",
"-",
"check",
"string",
"for",
"a",
"match"
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/parser.js#L394-L420 | |
51,092 | WebArtWork/derer | lib/parser.js | parseVariable | function parseVariable(str, line) {
var tokens = lexer.read(utils.strip(str)),
parser,
out;
parser = new TokenParser(tokens, filters, escape, line, opts.filename);
out = parser.parse().join('');
if (parser.state.length) {
utils.throwError('Unable to parse "' + str + '"', line, opts.f... | javascript | function parseVariable(str, line) {
var tokens = lexer.read(utils.strip(str)),
parser,
out;
parser = new TokenParser(tokens, filters, escape, line, opts.filename);
out = parser.parse().join('');
if (parser.state.length) {
utils.throwError('Unable to parse "' + str + '"', line, opts.f... | [
"function",
"parseVariable",
"(",
"str",
",",
"line",
")",
"{",
"var",
"tokens",
"=",
"lexer",
".",
"read",
"(",
"utils",
".",
"strip",
"(",
"str",
")",
")",
",",
"parser",
",",
"out",
";",
"parser",
"=",
"new",
"TokenParser",
"(",
"tokens",
",",
"... | Parse a variable.
@param {string} str String contents of the variable, between <i>{{</i> and <i>}}</i>
@param {number} line The line number that this variable starts on.
@return {VarToken} Parsed variable token object.
@private | [
"Parse",
"a",
"variable",
"."
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/parser.js#L481-L503 |
51,093 | WebArtWork/derer | lib/parser.js | parseTag | function parseTag(str, line) {
var tokens, parser, chunks, tagName, tag, args, last;
if (utils.startsWith(str, 'end')) {
last = stack[stack.length - 1];
if (last && last.name === str.split(/\s+/)[0].replace(/^end/, '') && last.ends) {
switch (last.name) {
case 'autoescape':
... | javascript | function parseTag(str, line) {
var tokens, parser, chunks, tagName, tag, args, last;
if (utils.startsWith(str, 'end')) {
last = stack[stack.length - 1];
if (last && last.name === str.split(/\s+/)[0].replace(/^end/, '') && last.ends) {
switch (last.name) {
case 'autoescape':
... | [
"function",
"parseTag",
"(",
"str",
",",
"line",
")",
"{",
"var",
"tokens",
",",
"parser",
",",
"chunks",
",",
"tagName",
",",
"tag",
",",
"args",
",",
"last",
";",
"if",
"(",
"utils",
".",
"startsWith",
"(",
"str",
",",
"'end'",
")",
")",
"{",
"... | Parse a tag.
@param {string} str String contents of the tag, between <i>{%</i> and <i>%}</i>
@param {number} line The line number that this tag starts on.
@return {TagToken} Parsed token object.
@private | [
"Parse",
"a",
"tag",
"."
] | edf9f82c8042b543e6f291f605430fac84702b2d | https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/parser.js#L513-L606 |
51,094 | vkiding/judpack-lib | src/platforms/PlatformApiPoly.js | getBuildArgs | function getBuildArgs(options) {
// if no options passed, empty object will be returned
if (!options) return [];
var downstreamArgs = [];
var argNames =[
'debug',
'release',
'device',
'emulator',
'nobuild',
'list'
];
argNames.forEach(function(fla... | javascript | function getBuildArgs(options) {
// if no options passed, empty object will be returned
if (!options) return [];
var downstreamArgs = [];
var argNames =[
'debug',
'release',
'device',
'emulator',
'nobuild',
'list'
];
argNames.forEach(function(fla... | [
"function",
"getBuildArgs",
"(",
"options",
")",
"{",
"// if no options passed, empty object will be returned",
"if",
"(",
"!",
"options",
")",
"return",
"[",
"]",
";",
"var",
"downstreamArgs",
"=",
"[",
"]",
";",
"var",
"argNames",
"=",
"[",
"'debug'",
",",
"... | Reconstructs the buildOptions tat will be passed along to platform scripts.
This is an ugly temporary fix. The code spawning or otherwise calling into
platform code should be dealing with this based on the parsed args object.
@param {Object} options A build options set, passed to `build` method
@return {String[]... | [
"Reconstructs",
"the",
"buildOptions",
"tat",
"will",
"be",
"passed",
"along",
"to",
"platform",
"scripts",
".",
"This",
"is",
"an",
"ugly",
"temporary",
"fix",
".",
"The",
"code",
"spawning",
"or",
"otherwise",
"calling",
"into",
"platform",
"code",
"should",... | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/platforms/PlatformApiPoly.js#L519-L551 |
51,095 | vkiding/judpack-lib | src/platforms/PlatformApiPoly.js | getPlatformVersion | function getPlatformVersion (platformRoot) {
var versionFile = path.join(platformRoot, 'cordova/version');
if (!fs.existsSync(versionFile)) {
return null;
}
var version = shell.cat(versionFile).match(/VERSION\s=\s["'](.*)["'];/m);
return version && version[1];
} | javascript | function getPlatformVersion (platformRoot) {
var versionFile = path.join(platformRoot, 'cordova/version');
if (!fs.existsSync(versionFile)) {
return null;
}
var version = shell.cat(versionFile).match(/VERSION\s=\s["'](.*)["'];/m);
return version && version[1];
} | [
"function",
"getPlatformVersion",
"(",
"platformRoot",
")",
"{",
"var",
"versionFile",
"=",
"path",
".",
"join",
"(",
"platformRoot",
",",
"'cordova/version'",
")",
";",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"versionFile",
")",
")",
"{",
"return",
... | Gets platform version from 'version' file
@param {String} platformRoot Platform location
@return {String|null} Stringified version of platform or null
if it is not possible to retrieve version | [
"Gets",
"platform",
"version",
"from",
"version",
"file"
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/platforms/PlatformApiPoly.js#L732-L741 |
51,096 | robojones/functs | functs.js | functs | function functs(...f) {
/**
* execute all included functions
* @param {...*} [args] - arguments passed to all included functions
* @returns {*[]}
*/
function functs(...args) {
return functs.run(this, args);
}
if(Array.isArray(f[0])) {
f = f[0];
}
functs.... | javascript | function functs(...f) {
/**
* execute all included functions
* @param {...*} [args] - arguments passed to all included functions
* @returns {*[]}
*/
function functs(...args) {
return functs.run(this, args);
}
if(Array.isArray(f[0])) {
f = f[0];
}
functs.... | [
"function",
"functs",
"(",
"...",
"f",
")",
"{",
"/**\n * execute all included functions\n * @param {...*} [args] - arguments passed to all included functions\n * @returns {*[]}\n */",
"function",
"functs",
"(",
"...",
"args",
")",
"{",
"return",
"functs",
".",
"r... | merge multiple functions into one
@param {...function} [f] - functions to merge
@returns {function} | [
"merge",
"multiple",
"functions",
"into",
"one"
] | ecb2d92f79cc1352a1f5ab90eb78c1c958295fe6 | https://github.com/robojones/functs/blob/ecb2d92f79cc1352a1f5ab90eb78c1c958295fe6/functs.js#L9-L30 |
51,097 | robojones/functs | functs.js | add | function add(...f) {
if(Array.isArray(f[0])) {
f = f[0];
}
f = f.filter((f) => {
return typeof f === 'function';
});
this._f.push.apply(this._f, f);
return f;
} | javascript | function add(...f) {
if(Array.isArray(f[0])) {
f = f[0];
}
f = f.filter((f) => {
return typeof f === 'function';
});
this._f.push.apply(this._f, f);
return f;
} | [
"function",
"add",
"(",
"...",
"f",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"f",
"[",
"0",
"]",
")",
")",
"{",
"f",
"=",
"f",
"[",
"0",
"]",
";",
"}",
"f",
"=",
"f",
".",
"filter",
"(",
"(",
"f",
")",
"=>",
"{",
"return",
"ty... | add functions to the functs-object
@param {...function|function[]} f - functions to be added
@returns {function[]} | [
"add",
"functions",
"to",
"the",
"functs",
"-",
"object"
] | ecb2d92f79cc1352a1f5ab90eb78c1c958295fe6 | https://github.com/robojones/functs/blob/ecb2d92f79cc1352a1f5ab90eb78c1c958295fe6/functs.js#L38-L47 |
51,098 | robojones/functs | functs.js | remove | function remove(...key) {
const self = this;
if(Array.isArray(key[0])) {
key = key[0];
}
key.forEach(k => {
self._f = self._f.filter(f => {
return f !== k;
});
});
} | javascript | function remove(...key) {
const self = this;
if(Array.isArray(key[0])) {
key = key[0];
}
key.forEach(k => {
self._f = self._f.filter(f => {
return f !== k;
});
});
} | [
"function",
"remove",
"(",
"...",
"key",
")",
"{",
"const",
"self",
"=",
"this",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"key",
"[",
"0",
"]",
")",
")",
"{",
"key",
"=",
"key",
"[",
"0",
"]",
";",
"}",
"key",
".",
"forEach",
"(",
"k",
... | remove functions from the functs-object
@param {...function|function[]} f - functions to be removed | [
"remove",
"functions",
"from",
"the",
"functs",
"-",
"object"
] | ecb2d92f79cc1352a1f5ab90eb78c1c958295fe6 | https://github.com/robojones/functs/blob/ecb2d92f79cc1352a1f5ab90eb78c1c958295fe6/functs.js#L54-L65 |
51,099 | robojones/functs | functs.js | run | function run(thisArg, args) {
var end = -1;
const r = this._f.map((f, i) => {
if(end === -1) {
return f.apply(thisArg, args.concat(abort));
}
function abort() {
end = i;
}
});
if(end === -1) {
return r;
}
return r.slice(0, end);
} | javascript | function run(thisArg, args) {
var end = -1;
const r = this._f.map((f, i) => {
if(end === -1) {
return f.apply(thisArg, args.concat(abort));
}
function abort() {
end = i;
}
});
if(end === -1) {
return r;
}
return r.slice(0, end);
} | [
"function",
"run",
"(",
"thisArg",
",",
"args",
")",
"{",
"var",
"end",
"=",
"-",
"1",
";",
"const",
"r",
"=",
"this",
".",
"_f",
".",
"map",
"(",
"(",
"f",
",",
"i",
")",
"=>",
"{",
"if",
"(",
"end",
"===",
"-",
"1",
")",
"{",
"return",
... | execute all included functions
@param {*} thisArg - thisArg to be applied on all included functions
@param {*[]} args - array of arguments passed to all included functions | [
"execute",
"all",
"included",
"functions"
] | ecb2d92f79cc1352a1f5ab90eb78c1c958295fe6 | https://github.com/robojones/functs/blob/ecb2d92f79cc1352a1f5ab90eb78c1c958295fe6/functs.js#L73-L88 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.