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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
48,500 | desmondmorris/node-mta | lib/utils.js | function (obj) {
var ret = {};
if( Object.prototype.toString.call(obj) === '[object Object]' ) {
for (var key in obj) {
ret[key] = arrayClean(obj[key]);
}
}
else if( Object.prototype.toString.call(obj) === '[object Array]' ) {
if (obj.length === 1) {
ret = arrayClean(obj[0]);
}
... | javascript | function (obj) {
var ret = {};
if( Object.prototype.toString.call(obj) === '[object Object]' ) {
for (var key in obj) {
ret[key] = arrayClean(obj[key]);
}
}
else if( Object.prototype.toString.call(obj) === '[object Array]' ) {
if (obj.length === 1) {
ret = arrayClean(obj[0]);
}
... | [
"function",
"(",
"obj",
")",
"{",
"var",
"ret",
"=",
"{",
"}",
";",
"if",
"(",
"Object",
".",
"prototype",
".",
"toString",
".",
"call",
"(",
"obj",
")",
"===",
"'[object Object]'",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"{",
"ret"... | Recursively removes extraneous nested arrays from objects
@param {Object|Array|String|Integer} obj
@return {Object} | [
"Recursively",
"removes",
"extraneous",
"nested",
"arrays",
"from",
"objects"
] | e87b57b4518b603a5f17ff4aecf0694d37c45b71 | https://github.com/desmondmorris/node-mta/blob/e87b57b4518b603a5f17ff4aecf0694d37c45b71/lib/utils.js#L29-L52 | |
48,501 | areslabs/babel-plugin-import-css | src/util.js | queryImport | function queryImport(styles) {
if (styles.indexOf('@import') < 0) return []
const arr = []
const ast = csstree.parse(styles);
csstree.walk(ast, {
enter: function (node) {
if (node.type === 'Atrule' && node.name === 'import') {
const pat = node.prelude.children.head.da... | javascript | function queryImport(styles) {
if (styles.indexOf('@import') < 0) return []
const arr = []
const ast = csstree.parse(styles);
csstree.walk(ast, {
enter: function (node) {
if (node.type === 'Atrule' && node.name === 'import') {
const pat = node.prelude.children.head.da... | [
"function",
"queryImport",
"(",
"styles",
")",
"{",
"if",
"(",
"styles",
".",
"indexOf",
"(",
"'@import'",
")",
"<",
"0",
")",
"return",
"[",
"]",
"const",
"arr",
"=",
"[",
"]",
"const",
"ast",
"=",
"csstree",
".",
"parse",
"(",
"styles",
")",
";",... | get import content in css file,may import multi times
@param styles css file content
@returns {Array} result | [
"get",
"import",
"content",
"in",
"css",
"file",
"may",
"import",
"multi",
"times"
] | b90d3a4ec3a644edcaa1c803314e2c39de1d29c9 | https://github.com/areslabs/babel-plugin-import-css/blob/b90d3a4ec3a644edcaa1c803314e2c39de1d29c9/src/util.js#L11-L24 |
48,502 | areslabs/babel-plugin-import-css | src/util.js | handleImportStyle | function handleImportStyle(styles, initPath, mayRM) {
if (!!mayRM) {
styles = styles.replace(mayRM, '')
}
if (styles.indexOf('@import') < 0) return styles
const ast = csstree.parse(styles);
csstree.walk(ast, {
enter: function (node) {
if (node.type === 'Atrule') {
... | javascript | function handleImportStyle(styles, initPath, mayRM) {
if (!!mayRM) {
styles = styles.replace(mayRM, '')
}
if (styles.indexOf('@import') < 0) return styles
const ast = csstree.parse(styles);
csstree.walk(ast, {
enter: function (node) {
if (node.type === 'Atrule') {
... | [
"function",
"handleImportStyle",
"(",
"styles",
",",
"initPath",
",",
"mayRM",
")",
"{",
"if",
"(",
"!",
"!",
"mayRM",
")",
"{",
"styles",
"=",
"styles",
".",
"replace",
"(",
"mayRM",
",",
"''",
")",
"}",
"if",
"(",
"styles",
".",
"indexOf",
"(",
"... | handle with import procedure,may search involved file in project
@param styles styles css file content
@param initPath project path, used for searching target file
@param mayRM this param avoid loop importing
@returns handled styles content | [
"handle",
"with",
"import",
"procedure",
"may",
"search",
"involved",
"file",
"in",
"project"
] | b90d3a4ec3a644edcaa1c803314e2c39de1d29c9 | https://github.com/areslabs/babel-plugin-import-css/blob/b90d3a4ec3a644edcaa1c803314e2c39de1d29c9/src/util.js#L33-L58 |
48,503 | areslabs/babel-plugin-import-css | src/util.js | createStylefromCode | function createStylefromCode(styles, abspath) {
//may import other file
const arr = queryImport(styles)
const baseRes = handleImportStyle(styles, abspath)
const obj = {}
const ast = csstree.parse(baseRes);
csstree.walk(ast, {
enter: function (node) {
if (node.type === 'Rule' ... | javascript | function createStylefromCode(styles, abspath) {
//may import other file
const arr = queryImport(styles)
const baseRes = handleImportStyle(styles, abspath)
const obj = {}
const ast = csstree.parse(baseRes);
csstree.walk(ast, {
enter: function (node) {
if (node.type === 'Rule' ... | [
"function",
"createStylefromCode",
"(",
"styles",
",",
"abspath",
")",
"{",
"//may import other file",
"const",
"arr",
"=",
"queryImport",
"(",
"styles",
")",
"const",
"baseRes",
"=",
"handleImportStyle",
"(",
"styles",
",",
"abspath",
")",
"const",
"obj",
"=",
... | create style object from css file content,which is raw string.
@param styles styles styles css file content
@param abspath project file path
@returns {{styles, imports: Array}} | [
"create",
"style",
"object",
"from",
"css",
"file",
"content",
"which",
"is",
"raw",
"string",
"."
] | b90d3a4ec3a644edcaa1c803314e2c39de1d29c9 | https://github.com/areslabs/babel-plugin-import-css/blob/b90d3a4ec3a644edcaa1c803314e2c39de1d29c9/src/util.js#L66-L109 |
48,504 | areslabs/babel-plugin-import-css | src/util.js | createStyleDictionary | function createStyleDictionary(styles) {
let total = {}
for (let k in styles) {
const val = styles[k]
//sort clz name to judge arbitrary order in multi-className
k = sortSeq(k)
//merge style chain from last condition
const lastEle = getLastEle(k)
//no sharing data... | javascript | function createStyleDictionary(styles) {
let total = {}
for (let k in styles) {
const val = styles[k]
//sort clz name to judge arbitrary order in multi-className
k = sortSeq(k)
//merge style chain from last condition
const lastEle = getLastEle(k)
//no sharing data... | [
"function",
"createStyleDictionary",
"(",
"styles",
")",
"{",
"let",
"total",
"=",
"{",
"}",
"for",
"(",
"let",
"k",
"in",
"styles",
")",
"{",
"const",
"val",
"=",
"styles",
"[",
"k",
"]",
"//sort clz name to judge arbitrary order in multi-className",
"k",
"="... | create special style dict structure for high performance query
@param styles style object | [
"create",
"special",
"style",
"dict",
"structure",
"for",
"high",
"performance",
"query"
] | b90d3a4ec3a644edcaa1c803314e2c39de1d29c9 | https://github.com/areslabs/babel-plugin-import-css/blob/b90d3a4ec3a644edcaa1c803314e2c39de1d29c9/src/util.js#L115-L132 |
48,505 | areslabs/babel-plugin-import-css | src/util.js | selectorBlockHandler | function selectorBlockHandler(element) {
if (element.type === 'Selector') {
const name = []
let discard = false
element.children.forEach(e => {
switch (e.type) {
case "ClassSelector":
name.push("." + e.name);
break;
... | javascript | function selectorBlockHandler(element) {
if (element.type === 'Selector') {
const name = []
let discard = false
element.children.forEach(e => {
switch (e.type) {
case "ClassSelector":
name.push("." + e.name);
break;
... | [
"function",
"selectorBlockHandler",
"(",
"element",
")",
"{",
"if",
"(",
"element",
".",
"type",
"===",
"'Selector'",
")",
"{",
"const",
"name",
"=",
"[",
"]",
"let",
"discard",
"=",
"false",
"element",
".",
"children",
".",
"forEach",
"(",
"e",
"=>",
... | handle with selector part in node's structure
@param element node to be searched
@return {*} | [
"handle",
"with",
"selector",
"part",
"in",
"node",
"s",
"structure"
] | b90d3a4ec3a644edcaa1c803314e2c39de1d29c9 | https://github.com/areslabs/babel-plugin-import-css/blob/b90d3a4ec3a644edcaa1c803314e2c39de1d29c9/src/util.js#L240-L276 |
48,506 | areslabs/babel-plugin-import-css | src/util.js | paddingElementForTransform | function paddingElementForTransform(proper, arr) {
//RN not support multi font-family keywords
if (proper === 'font-family') {
return [proper, arr.pop()]
}
//not support such shorthand
if (proper === 'background') {
return ['background-color', arr.join(" ")]
}
//not support s... | javascript | function paddingElementForTransform(proper, arr) {
//RN not support multi font-family keywords
if (proper === 'font-family') {
return [proper, arr.pop()]
}
//not support such shorthand
if (proper === 'background') {
return ['background-color', arr.join(" ")]
}
//not support s... | [
"function",
"paddingElementForTransform",
"(",
"proper",
",",
"arr",
")",
"{",
"//RN not support multi font-family keywords",
"if",
"(",
"proper",
"===",
"'font-family'",
")",
"{",
"return",
"[",
"proper",
",",
"arr",
".",
"pop",
"(",
")",
"]",
"}",
"//not suppo... | do some padding modification,to produce more stable run-time environment
@param proper
@param arr
@return {*} | [
"do",
"some",
"padding",
"modification",
"to",
"produce",
"more",
"stable",
"run",
"-",
"time",
"environment"
] | b90d3a4ec3a644edcaa1c803314e2c39de1d29c9 | https://github.com/areslabs/babel-plugin-import-css/blob/b90d3a4ec3a644edcaa1c803314e2c39de1d29c9/src/util.js#L284-L302 |
48,507 | areslabs/babel-plugin-import-css | src/util.js | styleBlockHandler | function styleBlockHandler(element) {
const {property, value} = element
let result = []
const styleContent = value && value.children ? value.children : []
const defaultUnit = "px"
styleContent.forEach(e => {
switch (e.type) {
case "Identifier":
result.push(e.name)... | javascript | function styleBlockHandler(element) {
const {property, value} = element
let result = []
const styleContent = value && value.children ? value.children : []
const defaultUnit = "px"
styleContent.forEach(e => {
switch (e.type) {
case "Identifier":
result.push(e.name)... | [
"function",
"styleBlockHandler",
"(",
"element",
")",
"{",
"const",
"{",
"property",
",",
"value",
"}",
"=",
"element",
"let",
"result",
"=",
"[",
"]",
"const",
"styleContent",
"=",
"value",
"&&",
"value",
".",
"children",
"?",
"value",
".",
"children",
... | handle with different node structure in ast
@param element
@return {*} | [
"handle",
"with",
"different",
"node",
"structure",
"in",
"ast"
] | b90d3a4ec3a644edcaa1c803314e2c39de1d29c9 | https://github.com/areslabs/babel-plugin-import-css/blob/b90d3a4ec3a644edcaa1c803314e2c39de1d29c9/src/util.js#L318-L373 |
48,508 | poynt/traildb-node | lib/traildb.js | function (uuid) {
uuid = ref.reinterpret(uuid, 16).toString('hex');
return [
uuid.slice(0, 8),
uuid.slice(8, 12),
uuid.slice(12, 16),
uuid.slice(16, 20),
uuid.slice(20, 32)
].join('-');
} | javascript | function (uuid) {
uuid = ref.reinterpret(uuid, 16).toString('hex');
return [
uuid.slice(0, 8),
uuid.slice(8, 12),
uuid.slice(12, 16),
uuid.slice(16, 20),
uuid.slice(20, 32)
].join('-');
} | [
"function",
"(",
"uuid",
")",
"{",
"uuid",
"=",
"ref",
".",
"reinterpret",
"(",
"uuid",
",",
"16",
")",
".",
"toString",
"(",
"'hex'",
")",
";",
"return",
"[",
"uuid",
".",
"slice",
"(",
"0",
",",
"8",
")",
",",
"uuid",
".",
"slice",
"(",
"8",
... | Returns a UUID hex string.
@param {Array[Byte]} uuid - UUID buffer.
@return {String} uuid - UUID string. | [
"Returns",
"a",
"UUID",
"hex",
"string",
"."
] | c174ae3e417877eeeae6e0e1af013a7182f6c65a | https://github.com/poynt/traildb-node/blob/c174ae3e417877eeeae6e0e1af013a7182f6c65a/lib/traildb.js#L169-L178 | |
48,509 | poynt/traildb-node | lib/traildb.js | function (trail, options) {
this.trail = trail;
this.options = options || {};
this.cursor = lib.tdb_cursor_new(this.trail.tdb._db);
/*\
|*| Filter logic
\*/
if (typeof this.options.filter != 'undefined') {
const err = lib.tdb_cursor_set_event_filter(this.cursor, this.options.filter);
if (err) {
... | javascript | function (trail, options) {
this.trail = trail;
this.options = options || {};
this.cursor = lib.tdb_cursor_new(this.trail.tdb._db);
/*\
|*| Filter logic
\*/
if (typeof this.options.filter != 'undefined') {
const err = lib.tdb_cursor_set_event_filter(this.cursor, this.options.filter);
if (err) {
... | [
"function",
"(",
"trail",
",",
"options",
")",
"{",
"this",
".",
"trail",
"=",
"trail",
";",
"this",
".",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"cursor",
"=",
"lib",
".",
"tdb_cursor_new",
"(",
"this",
".",
"trail",
".",
"tdb... | Initialize a new EventsIterator. Iterate over all events in a trail..
@param {TrailDB} tdb - TrailDB object.
@param {Boolean,Object}
options.toMap - Whether the iterator should return a map for each event,
grabbing the appropriate key names. Defaults to a list with
just values.
options.filter - T_TDB_FILTER event filte... | [
"Initialize",
"a",
"new",
"EventsIterator",
".",
"Iterate",
"over",
"all",
"events",
"in",
"a",
"trail",
".."
] | c174ae3e417877eeeae6e0e1af013a7182f6c65a | https://github.com/poynt/traildb-node/blob/c174ae3e417877eeeae6e0e1af013a7182f6c65a/lib/traildb.js#L244-L263 | |
48,510 | poynt/traildb-node | lib/traildb.js | function (options) {
if (!options.path) {
throw new TrailDBError('Path is required');
}
if (!options.fieldNames || !options.fieldNames.length) {
throw new TrailDBError('Field names are required');
}
if (options.path.slice(-4) === '.tdb') {
options.path = options.path.slice(0, -4);
}
this._co... | javascript | function (options) {
if (!options.path) {
throw new TrailDBError('Path is required');
}
if (!options.fieldNames || !options.fieldNames.length) {
throw new TrailDBError('Field names are required');
}
if (options.path.slice(-4) === '.tdb') {
options.path = options.path.slice(0, -4);
}
this._co... | [
"function",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"path",
")",
"{",
"throw",
"new",
"TrailDBError",
"(",
"'Path is required'",
")",
";",
"}",
"if",
"(",
"!",
"options",
".",
"fieldNames",
"||",
"!",
"options",
".",
"fieldNames",
"."... | TrailDBConstructor class Construct a new TrailDB.
Initialize a new TrailDBConstructor.
@param {String} options.path - TrailDB output path (without .tdb).
@param {Array[String]} options.fieldNames - Array of field names in this TrailDB.
@return {Object} cons - TrailDB constructor object. | [
"TrailDBConstructor",
"class",
"Construct",
"a",
"new",
"TrailDB",
".",
"Initialize",
"a",
"new",
"TrailDBConstructor",
"."
] | c174ae3e417877eeeae6e0e1af013a7182f6c65a | https://github.com/poynt/traildb-node/blob/c174ae3e417877eeeae6e0e1af013a7182f6c65a/lib/traildb.js#L324-L359 | |
48,511 | poynt/traildb-node | lib/traildb.js | function (options) {
this._db = lib.tdb_init();
const r = lib.tdb_open(this._db, ref.allocCString(options.path));
if (r !== 0) {
throw new TrailDBError('Could not open TrailDB: ' + r);
}
this.numTrails = lib.tdb_num_trails(this._db);
this.numEvents = lib.tdb_num_events(this._db);
this.numFields = li... | javascript | function (options) {
this._db = lib.tdb_init();
const r = lib.tdb_open(this._db, ref.allocCString(options.path));
if (r !== 0) {
throw new TrailDBError('Could not open TrailDB: ' + r);
}
this.numTrails = lib.tdb_num_trails(this._db);
this.numEvents = lib.tdb_num_events(this._db);
this.numFields = li... | [
"function",
"(",
"options",
")",
"{",
"this",
".",
"_db",
"=",
"lib",
".",
"tdb_init",
"(",
")",
";",
"const",
"r",
"=",
"lib",
".",
"tdb_open",
"(",
"this",
".",
"_db",
",",
"ref",
".",
"allocCString",
"(",
"options",
".",
"path",
")",
")",
";",... | TrailDB class Query a TrailDB.
Opens a TrailDB at path.
@param {String} options.path - TrailDB output path (without .tdb).
@return {Object} tdb - TrailDB object. | [
"TrailDB",
"class",
"Query",
"a",
"TrailDB",
".",
"Opens",
"a",
"TrailDB",
"at",
"path",
"."
] | c174ae3e417877eeeae6e0e1af013a7182f6c65a | https://github.com/poynt/traildb-node/blob/c174ae3e417877eeeae6e0e1af013a7182f6c65a/lib/traildb.js#L470-L490 | |
48,512 | deanlandolt/bytewise-core | util.js | encodeBound | function encodeBound(data, base) {
var prefix = data.prefix
var buffer = prefix ? base.encode(prefix, null) : new Buffer([ data.byte ])
if (data.upper)
buffer = Buffer.concat([ buffer, new Buffer([ 0xff ]) ])
return util.encodedBound(data, buffer)
} | javascript | function encodeBound(data, base) {
var prefix = data.prefix
var buffer = prefix ? base.encode(prefix, null) : new Buffer([ data.byte ])
if (data.upper)
buffer = Buffer.concat([ buffer, new Buffer([ 0xff ]) ])
return util.encodedBound(data, buffer)
} | [
"function",
"encodeBound",
"(",
"data",
",",
"base",
")",
"{",
"var",
"prefix",
"=",
"data",
".",
"prefix",
"var",
"buffer",
"=",
"prefix",
"?",
"base",
".",
"encode",
"(",
"prefix",
",",
"null",
")",
":",
"new",
"Buffer",
"(",
"[",
"data",
".",
"b... | helpers for encoding boundary types | [
"helpers",
"for",
"encoding",
"boundary",
"types"
] | 293f2eb2623903baf0fc02fd81a770f06d62c8de | https://github.com/deanlandolt/bytewise-core/blob/293f2eb2623903baf0fc02fd81a770f06d62c8de/util.js#L286-L294 |
48,513 | zackurben/event-chain | lib/index.js | function(required, cb) {
var chain = new Chain(config);
chain.on(required, cb);
return chain;
} | javascript | function(required, cb) {
var chain = new Chain(config);
chain.on(required, cb);
return chain;
} | [
"function",
"(",
"required",
",",
"cb",
")",
"{",
"var",
"chain",
"=",
"new",
"Chain",
"(",
"config",
")",
";",
"chain",
".",
"on",
"(",
"required",
",",
"cb",
")",
";",
"return",
"chain",
";",
"}"
] | EventChain factory.
@param required
The list of events that are required before invoking the callback function.
@param cb
The callback to invoke after all required events have been fired.
@returns {Chain|exports|module.exports} | [
"EventChain",
"factory",
"."
] | d6b12f569afb58cb6b01e85dbb7dbf320583ed7b | https://github.com/zackurben/event-chain/blob/d6b12f569afb58cb6b01e85dbb7dbf320583ed7b/lib/index.js#L23-L27 | |
48,514 | alexindigo/batcher | lib/command_factory.js | commandFactory | function commandFactory(combos, cmd)
{
var command;
// if no combos provided
// consider it as a single command run
if (!cmd)
{
cmd = combos;
combos = [{}];
}
command = partial(iterate, combos, cmd);
command.commandDescription = partial(commandDescription, cmd);
return command;
} | javascript | function commandFactory(combos, cmd)
{
var command;
// if no combos provided
// consider it as a single command run
if (!cmd)
{
cmd = combos;
combos = [{}];
}
command = partial(iterate, combos, cmd);
command.commandDescription = partial(commandDescription, cmd);
return command;
} | [
"function",
"commandFactory",
"(",
"combos",
",",
"cmd",
")",
"{",
"var",
"command",
";",
"// if no combos provided",
"// consider it as a single command run",
"if",
"(",
"!",
"cmd",
")",
"{",
"cmd",
"=",
"combos",
";",
"combos",
"=",
"[",
"{",
"}",
"]",
";"... | Creates command executor from state property
@param {array|string} [combos] – list of combinations
@param {string} cmd - state property to get command from
@returns {function} function that executes the command | [
"Creates",
"command",
"executor",
"from",
"state",
"property"
] | 73d9c8c994f915688db0627ea3b4854ead771138 | https://github.com/alexindigo/batcher/blob/73d9c8c994f915688db0627ea3b4854ead771138/lib/command_factory.js#L23-L38 |
48,515 | alexindigo/batcher | lib/command_factory.js | forEachFactory | function forEachFactory(properties)
{
// expand object's combinations into an array of objects
if (typeOf(properties) == 'object')
{
properties = cartesian(clone(properties));
}
return {command: partial(commandFactory, properties)};
} | javascript | function forEachFactory(properties)
{
// expand object's combinations into an array of objects
if (typeOf(properties) == 'object')
{
properties = cartesian(clone(properties));
}
return {command: partial(commandFactory, properties)};
} | [
"function",
"forEachFactory",
"(",
"properties",
")",
"{",
"// expand object's combinations into an array of objects",
"if",
"(",
"typeOf",
"(",
"properties",
")",
"==",
"'object'",
")",
"{",
"properties",
"=",
"cartesian",
"(",
"clone",
"(",
"properties",
")",
")",... | Constructs set of commands for each property of the passed object
with loops over passed arrays
@param {object|array|string} properties - list of properties to run a command with
@returns {object} run command factory | [
"Constructs",
"set",
"of",
"commands",
"for",
"each",
"property",
"of",
"the",
"passed",
"object",
"with",
"loops",
"over",
"passed",
"arrays"
] | 73d9c8c994f915688db0627ea3b4854ead771138 | https://github.com/alexindigo/batcher/blob/73d9c8c994f915688db0627ea3b4854ead771138/lib/command_factory.js#L47-L56 |
48,516 | alexindigo/batcher | lib/command_factory.js | valueFactory | function valueFactory(value)
{
function command(cb)
{
cb(null, value);
}
command.commandDescription = partial(commandDescription, 'VALUE SETTER');
return command;
} | javascript | function valueFactory(value)
{
function command(cb)
{
cb(null, value);
}
command.commandDescription = partial(commandDescription, 'VALUE SETTER');
return command;
} | [
"function",
"valueFactory",
"(",
"value",
")",
"{",
"function",
"command",
"(",
"cb",
")",
"{",
"cb",
"(",
"null",
",",
"value",
")",
";",
"}",
"command",
".",
"commandDescription",
"=",
"partial",
"(",
"commandDescription",
",",
"'VALUE SETTER'",
")",
";"... | Creates function that returns provided value
@param {mixed} value - value to return during execution time
@returns {function} function that executes the command | [
"Creates",
"function",
"that",
"returns",
"provided",
"value"
] | 73d9c8c994f915688db0627ea3b4854ead771138 | https://github.com/alexindigo/batcher/blob/73d9c8c994f915688db0627ea3b4854ead771138/lib/command_factory.js#L64-L72 |
48,517 | alexindigo/batcher | lib/command_factory.js | commandDescription | function commandDescription(desc, state)
{
desc = state[desc] || desc;
return desc.join ? '[' + desc.join(', ') + ']' : desc.toString();
} | javascript | function commandDescription(desc, state)
{
desc = state[desc] || desc;
return desc.join ? '[' + desc.join(', ') + ']' : desc.toString();
} | [
"function",
"commandDescription",
"(",
"desc",
",",
"state",
")",
"{",
"desc",
"=",
"state",
"[",
"desc",
"]",
"||",
"desc",
";",
"return",
"desc",
".",
"join",
"?",
"'['",
"+",
"desc",
".",
"join",
"(",
"', '",
")",
"+",
"']'",
":",
"desc",
".",
... | Provides command description, finds matching within state object
or uses provided one as is
@private
@param {string} desc - command's description or property
to fetch command from current state
@param {object} state - current state
@returns {string} - command's description | [
"Provides",
"command",
"description",
"finds",
"matching",
"within",
"state",
"object",
"or",
"uses",
"provided",
"one",
"as",
"is"
] | 73d9c8c994f915688db0627ea3b4854ead771138 | https://github.com/alexindigo/batcher/blob/73d9c8c994f915688db0627ea3b4854ead771138/lib/command_factory.js#L84-L88 |
48,518 | alexindigo/batcher | lib/command_factory.js | iterate | function iterate(accumulator, combos, cmd, callback)
{
var params;
// initial call might not have accumulator
if (arguments.length == 3)
{
callback = cmd;
cmd = combos;
combos = accumulator;
accumulator = [];
}
// resolve params from combo reference
if (typeof combos == '... | javascript | function iterate(accumulator, combos, cmd, callback)
{
var params;
// initial call might not have accumulator
if (arguments.length == 3)
{
callback = cmd;
cmd = combos;
combos = accumulator;
accumulator = [];
}
// resolve params from combo reference
if (typeof combos == '... | [
"function",
"iterate",
"(",
"accumulator",
",",
"combos",
",",
"cmd",
",",
"callback",
")",
"{",
"var",
"params",
";",
"// initial call might not have accumulator",
"if",
"(",
"arguments",
".",
"length",
"==",
"3",
")",
"{",
"callback",
"=",
"cmd",
";",
"cmd... | Runs provided command with each of the combinations
@private
@param {array} [accumulator] – accumulates commands output
@param {array|string} combos – list of combinations
@param {string|array} cmd - command to run
@param {function} callback - invoked after commands finished executing
@returns {void} | [
"Runs",
"provided",
"command",
"with",
"each",
"of",
"the",
"combinations"
] | 73d9c8c994f915688db0627ea3b4854ead771138 | https://github.com/alexindigo/batcher/blob/73d9c8c994f915688db0627ea3b4854ead771138/lib/command_factory.js#L100-L167 |
48,519 | rtm/upward | src/Ass.js | keepAssigned | function keepAssigned(...objs) {
var ka = create(keepAssignedPrototype);
defineProperty(ka, 'objs', { value: [] }); // first-come first-served
[...objs].forEach(o => _keepAssigned(ka, o));
return ka;
} | javascript | function keepAssigned(...objs) {
var ka = create(keepAssignedPrototype);
defineProperty(ka, 'objs', { value: [] }); // first-come first-served
[...objs].forEach(o => _keepAssigned(ka, o));
return ka;
} | [
"function",
"keepAssigned",
"(",
"...",
"objs",
")",
"{",
"var",
"ka",
"=",
"create",
"(",
"keepAssignedPrototype",
")",
";",
"defineProperty",
"(",
"ka",
",",
"'objs'",
",",
"{",
"value",
":",
"[",
"]",
"}",
")",
";",
"// first-come first-served",
"[",
... | Create the `keepAssigned` object. | [
"Create",
"the",
"keepAssigned",
"object",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ass.js#L20-L25 |
48,520 | rtm/upward | src/Ass.js | findFirstProp | function findFirstProp(objs, p) {
for (let obj of objs) {
if (obj && obj.hasOwnProperty(p)) { return valueize(obj[p]); }
}
} | javascript | function findFirstProp(objs, p) {
for (let obj of objs) {
if (obj && obj.hasOwnProperty(p)) { return valueize(obj[p]); }
}
} | [
"function",
"findFirstProp",
"(",
"objs",
",",
"p",
")",
"{",
"for",
"(",
"let",
"obj",
"of",
"objs",
")",
"{",
"if",
"(",
"obj",
"&&",
"obj",
".",
"hasOwnProperty",
"(",
"p",
")",
")",
"{",
"return",
"valueize",
"(",
"obj",
"[",
"p",
"]",
")",
... | Return property's value from the first object in which it appears. | [
"Return",
"property",
"s",
"value",
"from",
"the",
"first",
"object",
"in",
"which",
"it",
"appears",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ass.js#L28-L32 |
48,521 | rtm/upward | src/Ass.js | calcProp | function calcProp(ka, p) {
var val = ka[p];
if (isKeepAssigned(val)) {
recalc(val);
} else {
val.val = findFirstProp(ka.objs, p);
}
} | javascript | function calcProp(ka, p) {
var val = ka[p];
if (isKeepAssigned(val)) {
recalc(val);
} else {
val.val = findFirstProp(ka.objs, p);
}
} | [
"function",
"calcProp",
"(",
"ka",
",",
"p",
")",
"{",
"var",
"val",
"=",
"ka",
"[",
"p",
"]",
";",
"if",
"(",
"isKeepAssigned",
"(",
"val",
")",
")",
"{",
"recalc",
"(",
"val",
")",
";",
"}",
"else",
"{",
"val",
".",
"val",
"=",
"findFirstProp... | Calculate value for a property, recursively. | [
"Calculate",
"value",
"for",
"a",
"property",
"recursively",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ass.js#L35-L42 |
48,522 | rtm/upward | src/Ass.js | placeKey | function placeKey(ka, v, k, pusher) {
if (isObject(v)) {
if (k in ka) {
_keepAssigned(ka[k], v, pusher);
} else {
ka[k] = subKeepAssigned(ka.objs, k, pusher);
}
} else {
if (k in ka) {
ka[k].val = calcProp(ka, k);
} else {
defineProperty(ka, k, {
get() { return U(... | javascript | function placeKey(ka, v, k, pusher) {
if (isObject(v)) {
if (k in ka) {
_keepAssigned(ka[k], v, pusher);
} else {
ka[k] = subKeepAssigned(ka.objs, k, pusher);
}
} else {
if (k in ka) {
ka[k].val = calcProp(ka, k);
} else {
defineProperty(ka, k, {
get() { return U(... | [
"function",
"placeKey",
"(",
"ka",
",",
"v",
",",
"k",
",",
"pusher",
")",
"{",
"if",
"(",
"isObject",
"(",
"v",
")",
")",
"{",
"if",
"(",
"k",
"in",
"ka",
")",
"{",
"_keepAssigned",
"(",
"ka",
"[",
"k",
"]",
",",
"v",
",",
"pusher",
")",
"... | Place a key in the kept object. | [
"Place",
"a",
"key",
"in",
"the",
"kept",
"object",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ass.js#L45-L63 |
48,523 | rtm/upward | src/Ass.js | recalc | function recalc(ka) {
for (let [key, val] of objectPairs(ka)) {
if (isKeepAssigned(val)) { recalc(val); }
else { val.val = getter(key); }
}
} | javascript | function recalc(ka) {
for (let [key, val] of objectPairs(ka)) {
if (isKeepAssigned(val)) { recalc(val); }
else { val.val = getter(key); }
}
} | [
"function",
"recalc",
"(",
"ka",
")",
"{",
"for",
"(",
"let",
"[",
"key",
",",
"val",
"]",
"of",
"objectPairs",
"(",
"ka",
")",
")",
"{",
"if",
"(",
"isKeepAssigned",
"(",
"val",
")",
")",
"{",
"recalc",
"(",
"val",
")",
";",
"}",
"else",
"{",
... | Recalculate values for all keys, as when an object changes. | [
"Recalculate",
"values",
"for",
"all",
"keys",
"as",
"when",
"an",
"object",
"changes",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ass.js#L66-L71 |
48,524 | rtm/upward | src/Ass.js | subKeepAssigned | function subKeepAssigned(objs, k, pusher) {
var ka = keepAssigned();
objs
.map(propGetter(k))
.filter(Boolean)
.forEach(o => _keepAssigned(ka, o, pusher));
return ka;
} | javascript | function subKeepAssigned(objs, k, pusher) {
var ka = keepAssigned();
objs
.map(propGetter(k))
.filter(Boolean)
.forEach(o => _keepAssigned(ka, o, pusher));
return ka;
} | [
"function",
"subKeepAssigned",
"(",
"objs",
",",
"k",
",",
"pusher",
")",
"{",
"var",
"ka",
"=",
"keepAssigned",
"(",
")",
";",
"objs",
".",
"map",
"(",
"propGetter",
"(",
"k",
")",
")",
".",
"filter",
"(",
"Boolean",
")",
".",
"forEach",
"(",
"o",... | Make a keepAssigned object for subobjects with some key. | [
"Make",
"a",
"keepAssigned",
"object",
"for",
"subobjects",
"with",
"some",
"key",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ass.js#L74-L81 |
48,525 | rtm/upward | src/Ass.js | _keepAssigned | function _keepAssigned(ka, o, pusher = unshift) {
// Handle an upwardable object changing, in case of `O(model.obj)`.
function objectChanged(_o) {
replace(ka.objs, o, _o);
recalc(ka);
}
// @TODO: figure out how to handle this.
// upward(o, objectChanged);
function key(v, k) {
placeKey(ka, v,... | javascript | function _keepAssigned(ka, o, pusher = unshift) {
// Handle an upwardable object changing, in case of `O(model.obj)`.
function objectChanged(_o) {
replace(ka.objs, o, _o);
recalc(ka);
}
// @TODO: figure out how to handle this.
// upward(o, objectChanged);
function key(v, k) {
placeKey(ka, v,... | [
"function",
"_keepAssigned",
"(",
"ka",
",",
"o",
",",
"pusher",
"=",
"unshift",
")",
"{",
"// Handle an upwardable object changing, in case of `O(model.obj)`.",
"function",
"objectChanged",
"(",
"_o",
")",
"{",
"replace",
"(",
"ka",
".",
"objs",
",",
"o",
",",
... | Push one object onto a keepAssigned object, either at the front or back. | [
"Push",
"one",
"object",
"onto",
"a",
"keepAssigned",
"object",
"either",
"at",
"the",
"front",
"or",
"back",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Ass.js#L84-L117 |
48,526 | iLambda/sparse-binary-matrix | lib/sbm.js | function(source, dimension) {
// create the matrix
var mat = {}
// if dimension is an integer, the matrix is square
if (_.isFunction(source)
&& _.isInteger(dimension) && dimension >= 0) {
dimension = { x:dimension, y:dimension }
}
// source can be a 2-var predicate function or... | javascript | function(source, dimension) {
// create the matrix
var mat = {}
// if dimension is an integer, the matrix is square
if (_.isFunction(source)
&& _.isInteger(dimension) && dimension >= 0) {
dimension = { x:dimension, y:dimension }
}
// source can be a 2-var predicate function or... | [
"function",
"(",
"source",
",",
"dimension",
")",
"{",
"// create the matrix",
"var",
"mat",
"=",
"{",
"}",
"// if dimension is an integer, the matrix is square",
"if",
"(",
"_",
".",
"isFunction",
"(",
"source",
")",
"&&",
"_",
".",
"isInteger",
"(",
"dimension... | creates a sparse binary matrix | [
"creates",
"a",
"sparse",
"binary",
"matrix"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L5-L49 | |
48,527 | iLambda/sparse-binary-matrix | lib/sbm.js | function(sbm) {
// creating matrix
var mat = []
// populate
for (var i = 0; i < sbm.x; i++) {
mat.push([])
for (var j = 0; j < sbm.y; j++) {
mat[i][j] = _.includes(sbm.data[i], j) ? 1 : 0
}
}
// return the matrix
return mat
} | javascript | function(sbm) {
// creating matrix
var mat = []
// populate
for (var i = 0; i < sbm.x; i++) {
mat.push([])
for (var j = 0; j < sbm.y; j++) {
mat[i][j] = _.includes(sbm.data[i], j) ? 1 : 0
}
}
// return the matrix
return mat
} | [
"function",
"(",
"sbm",
")",
"{",
"// creating matrix",
"var",
"mat",
"=",
"[",
"]",
"// populate",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"sbm",
".",
"x",
";",
"i",
"++",
")",
"{",
"mat",
".",
"push",
"(",
"[",
"]",
")",
"for",
"("... | returns the sbm in line-based matrix form | [
"returns",
"the",
"sbm",
"in",
"line",
"-",
"based",
"matrix",
"form"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L51-L63 | |
48,528 | iLambda/sparse-binary-matrix | lib/sbm.js | function(n) {
n = _.isInteger(n) ? n : 0
return {
x: n,
y: n,
data: _.map(_.range(n), function (num) {
return [num]
})
}
} | javascript | function(n) {
n = _.isInteger(n) ? n : 0
return {
x: n,
y: n,
data: _.map(_.range(n), function (num) {
return [num]
})
}
} | [
"function",
"(",
"n",
")",
"{",
"n",
"=",
"_",
".",
"isInteger",
"(",
"n",
")",
"?",
"n",
":",
"0",
"return",
"{",
"x",
":",
"n",
",",
"y",
":",
"n",
",",
"data",
":",
"_",
".",
"map",
"(",
"_",
".",
"range",
"(",
"n",
")",
",",
"functi... | returns the identity matrix for a given dimension | [
"returns",
"the",
"identity",
"matrix",
"for",
"a",
"given",
"dimension"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L71-L81 | |
48,529 | iLambda/sparse-binary-matrix | lib/sbm.js | function(matrix) {
// if not square
if (matrix.x != matrix.y) {
return
}
// return trace
return _.filter(matrix.data, function (line, number) {
return _.includes(line, number)
}).length
} | javascript | function(matrix) {
// if not square
if (matrix.x != matrix.y) {
return
}
// return trace
return _.filter(matrix.data, function (line, number) {
return _.includes(line, number)
}).length
} | [
"function",
"(",
"matrix",
")",
"{",
"// if not square",
"if",
"(",
"matrix",
".",
"x",
"!=",
"matrix",
".",
"y",
")",
"{",
"return",
"}",
"// return trace",
"return",
"_",
".",
"filter",
"(",
"matrix",
".",
"data",
",",
"function",
"(",
"line",
",",
... | computes the trace of the matrix | [
"computes",
"the",
"trace",
"of",
"the",
"matrix"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L110-L119 | |
48,530 | iLambda/sparse-binary-matrix | lib/sbm.js | function(sbm) {
// create the matrix
var mat = {}
mat.x = sbm.y
mat.y = sbm.x
mat.data = []
// populate
for (var i = 0; i < mat.x; i++) {
mat.data.push([])
for (var j = 0; j < mat.y; j++) {
if (_.includes(sbm.data[j], i)) {
mat.data[i].push(j)
}
... | javascript | function(sbm) {
// create the matrix
var mat = {}
mat.x = sbm.y
mat.y = sbm.x
mat.data = []
// populate
for (var i = 0; i < mat.x; i++) {
mat.data.push([])
for (var j = 0; j < mat.y; j++) {
if (_.includes(sbm.data[j], i)) {
mat.data[i].push(j)
}
... | [
"function",
"(",
"sbm",
")",
"{",
"// create the matrix",
"var",
"mat",
"=",
"{",
"}",
"mat",
".",
"x",
"=",
"sbm",
".",
"y",
"mat",
".",
"y",
"=",
"sbm",
".",
"x",
"mat",
".",
"data",
"=",
"[",
"]",
"// populate",
"for",
"(",
"var",
"i",
"=",
... | transposes the matrix | [
"transposes",
"the",
"matrix"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L122-L138 | |
48,531 | iLambda/sparse-binary-matrix | lib/sbm.js | function(sbmA, sbmB) {
// check size
if (sbmA.x !== sbmB.x || sbmA.y !== sbmB.y) {
return false
}
// check
return _.every(sbmA.data, function (line, idx) {
return _.isEqual(line.sort(), sbmB.data[idx].sort())
})
} | javascript | function(sbmA, sbmB) {
// check size
if (sbmA.x !== sbmB.x || sbmA.y !== sbmB.y) {
return false
}
// check
return _.every(sbmA.data, function (line, idx) {
return _.isEqual(line.sort(), sbmB.data[idx].sort())
})
} | [
"function",
"(",
"sbmA",
",",
"sbmB",
")",
"{",
"// check size",
"if",
"(",
"sbmA",
".",
"x",
"!==",
"sbmB",
".",
"x",
"||",
"sbmA",
".",
"y",
"!==",
"sbmB",
".",
"y",
")",
"{",
"return",
"false",
"}",
"// check",
"return",
"_",
".",
"every",
"("... | are both matrices equal ? | [
"are",
"both",
"matrices",
"equal",
"?"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L142-L152 | |
48,532 | iLambda/sparse-binary-matrix | lib/sbm.js | function(sbm) {
// create the matrix
var mat = {}
mat.x = sbm.x
mat.y = sbm.y
mat.data = []
// populate
for (var i = 0; i < mat.x; i++) {
mat.data[i] = _.difference(_.range(mat.y), sbm.data[i])
}
// return matrix
return mat
} | javascript | function(sbm) {
// create the matrix
var mat = {}
mat.x = sbm.x
mat.y = sbm.y
mat.data = []
// populate
for (var i = 0; i < mat.x; i++) {
mat.data[i] = _.difference(_.range(mat.y), sbm.data[i])
}
// return matrix
return mat
} | [
"function",
"(",
"sbm",
")",
"{",
"// create the matrix",
"var",
"mat",
"=",
"{",
"}",
"mat",
".",
"x",
"=",
"sbm",
".",
"x",
"mat",
".",
"y",
"=",
"sbm",
".",
"y",
"mat",
".",
"data",
"=",
"[",
"]",
"// populate",
"for",
"(",
"var",
"i",
"=",
... | NOT the matrix | [
"NOT",
"the",
"matrix"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L155-L167 | |
48,533 | iLambda/sparse-binary-matrix | lib/sbm.js | function(sbmA, sbmB) {
// if not the same sizes
if (sbmA.x != sbmB.x || sbmA.y != sbmB.y) {
return
}
// create the matrix
var mat = {}
mat.x = sbmA.x
mat.y = sbmA.y
mat.data = []
// populate
for (var i = 0; i < mat.x; i++) {
mat.data[i] = _.intersection(sbmA.data[i], ... | javascript | function(sbmA, sbmB) {
// if not the same sizes
if (sbmA.x != sbmB.x || sbmA.y != sbmB.y) {
return
}
// create the matrix
var mat = {}
mat.x = sbmA.x
mat.y = sbmA.y
mat.data = []
// populate
for (var i = 0; i < mat.x; i++) {
mat.data[i] = _.intersection(sbmA.data[i], ... | [
"function",
"(",
"sbmA",
",",
"sbmB",
")",
"{",
"// if not the same sizes",
"if",
"(",
"sbmA",
".",
"x",
"!=",
"sbmB",
".",
"x",
"||",
"sbmA",
".",
"y",
"!=",
"sbmB",
".",
"y",
")",
"{",
"return",
"}",
"// create the matrix",
"var",
"mat",
"=",
"{",
... | AND the two matrices | [
"AND",
"the",
"two",
"matrices"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L169-L185 | |
48,534 | iLambda/sparse-binary-matrix | lib/sbm.js | function(sbmA, sbmB) {
// if not the same sizes
if (sbmA.x != sbmB.x || sbmA.y != sbmB.y) {
return
}
// create the matrix
var mat = {}
mat.x = sbmA.x
mat.y = sbmA.y
mat.data = []
// populate
for (var i = 0; i < mat.x; i++) {
mat.data[i] = _.union(sbmA.data[i], sbmB.da... | javascript | function(sbmA, sbmB) {
// if not the same sizes
if (sbmA.x != sbmB.x || sbmA.y != sbmB.y) {
return
}
// create the matrix
var mat = {}
mat.x = sbmA.x
mat.y = sbmA.y
mat.data = []
// populate
for (var i = 0; i < mat.x; i++) {
mat.data[i] = _.union(sbmA.data[i], sbmB.da... | [
"function",
"(",
"sbmA",
",",
"sbmB",
")",
"{",
"// if not the same sizes",
"if",
"(",
"sbmA",
".",
"x",
"!=",
"sbmB",
".",
"x",
"||",
"sbmA",
".",
"y",
"!=",
"sbmB",
".",
"y",
")",
"{",
"return",
"}",
"// create the matrix",
"var",
"mat",
"=",
"{",
... | OR the two matrices | [
"OR",
"the",
"two",
"matrices"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L187-L203 | |
48,535 | iLambda/sparse-binary-matrix | lib/sbm.js | function(sbmA, sbmB) {
// check if size compatible
if (sbmA.y !== sbmB.x) {
return
}
// create a new matrix
return this.make((function (i, j) {
return _.reduce(_.map(_.range(sbmA.y), (function(id) {
return this.check(sbmA, i, id) && this.check(sbmB, id, j)
}).bind(this)), f... | javascript | function(sbmA, sbmB) {
// check if size compatible
if (sbmA.y !== sbmB.x) {
return
}
// create a new matrix
return this.make((function (i, j) {
return _.reduce(_.map(_.range(sbmA.y), (function(id) {
return this.check(sbmA, i, id) && this.check(sbmB, id, j)
}).bind(this)), f... | [
"function",
"(",
"sbmA",
",",
"sbmB",
")",
"{",
"// check if size compatible",
"if",
"(",
"sbmA",
".",
"y",
"!==",
"sbmB",
".",
"x",
")",
"{",
"return",
"}",
"// create a new matrix",
"return",
"this",
".",
"make",
"(",
"(",
"function",
"(",
"i",
",",
... | multiply two matrices | [
"multiply",
"two",
"matrices"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L226-L239 | |
48,536 | iLambda/sparse-binary-matrix | lib/sbm.js | function(sbm, n) {
if (n == 0) {
return this.identity(n)
} else if (n == 1) {
return sbm
} else if (n % 2 == 0) {
return this.pow(this.multiply(sbm, sbm), n/2)
} else {
return this.multiply(sbm, this.pow(this.multiply(sbm, sbm), (n-1)/2))
}
} | javascript | function(sbm, n) {
if (n == 0) {
return this.identity(n)
} else if (n == 1) {
return sbm
} else if (n % 2 == 0) {
return this.pow(this.multiply(sbm, sbm), n/2)
} else {
return this.multiply(sbm, this.pow(this.multiply(sbm, sbm), (n-1)/2))
}
} | [
"function",
"(",
"sbm",
",",
"n",
")",
"{",
"if",
"(",
"n",
"==",
"0",
")",
"{",
"return",
"this",
".",
"identity",
"(",
"n",
")",
"}",
"else",
"if",
"(",
"n",
"==",
"1",
")",
"{",
"return",
"sbm",
"}",
"else",
"if",
"(",
"n",
"%",
"2",
"... | power of the matrix | [
"power",
"of",
"the",
"matrix"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L241-L251 | |
48,537 | iLambda/sparse-binary-matrix | lib/sbm.js | function(sbm) {
// if the matrix ain't square, symmetry is off
if (sbm.x !== sbm.y) {
return false
}
// symmetry status
var symmetry = true
// iterate
for (var i = 0; i < sbm.x; i++) {
for (var j = 0; j <= i; j++) {
symmetry = symmetry && ((_.includes(sbm.data[i], j) ^ _... | javascript | function(sbm) {
// if the matrix ain't square, symmetry is off
if (sbm.x !== sbm.y) {
return false
}
// symmetry status
var symmetry = true
// iterate
for (var i = 0; i < sbm.x; i++) {
for (var j = 0; j <= i; j++) {
symmetry = symmetry && ((_.includes(sbm.data[i], j) ^ _... | [
"function",
"(",
"sbm",
")",
"{",
"// if the matrix ain't square, symmetry is off",
"if",
"(",
"sbm",
".",
"x",
"!==",
"sbm",
".",
"y",
")",
"{",
"return",
"false",
"}",
"// symmetry status",
"var",
"symmetry",
"=",
"true",
"// iterate",
"for",
"(",
"var",
"... | returns true if the matrix is symmetric | [
"returns",
"true",
"if",
"the",
"matrix",
"is",
"symmetric"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L254-L270 | |
48,538 | iLambda/sparse-binary-matrix | lib/sbm.js | function(sbm) {
return _.sum(_.map(sbm.data, function (ar) { return ar.length }))
} | javascript | function(sbm) {
return _.sum(_.map(sbm.data, function (ar) { return ar.length }))
} | [
"function",
"(",
"sbm",
")",
"{",
"return",
"_",
".",
"sum",
"(",
"_",
".",
"map",
"(",
"sbm",
".",
"data",
",",
"function",
"(",
"ar",
")",
"{",
"return",
"ar",
".",
"length",
"}",
")",
")",
"}"
] | returns the number of 1 in the matrix | [
"returns",
"the",
"number",
"of",
"1",
"in",
"the",
"matrix"
] | cface7e5679f7e7c71fa37a4967413589e02eb42 | https://github.com/iLambda/sparse-binary-matrix/blob/cface7e5679f7e7c71fa37a4967413589e02eb42/lib/sbm.js#L272-L274 | |
48,539 | Aigeec/mandrill-webhook-event-parser | src/mandrill-webhook-event-parser.js | function() {
if (!(this instanceof EventParser)) {
return new EventParser();
}
/**
* Parses Mandrill Events request. Sets mandrillEvents property on req. Expects body to contain decoded post body mandrill_events parameter. Please see Madrills article {@link https://mandrill.zendesk.com/hc/en-us/... | javascript | function() {
if (!(this instanceof EventParser)) {
return new EventParser();
}
/**
* Parses Mandrill Events request. Sets mandrillEvents property on req. Expects body to contain decoded post body mandrill_events parameter. Please see Madrills article {@link https://mandrill.zendesk.com/hc/en-us/... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"EventParser",
")",
")",
"{",
"return",
"new",
"EventParser",
"(",
")",
";",
"}",
"/**\n * Parses Mandrill Events request. Sets mandrillEvents property on req. Expects body to contain decoded post body... | Simple express middleware for parsing Inbound Mandrill Webhook events
@Module MandrillWebhookEventParser | [
"Simple",
"express",
"middleware",
"for",
"parsing",
"Inbound",
"Mandrill",
"Webhook",
"events"
] | 94cffaa6e3258950d43e67aae0a5d6d04e3b948f | https://github.com/Aigeec/mandrill-webhook-event-parser/blob/94cffaa6e3258950d43e67aae0a5d6d04e3b948f/src/mandrill-webhook-event-parser.js#L12-L38 | |
48,540 | reelyactive/chickadee | lib/routes/associations.js | retrieveAssociations | function retrieveAssociations(req, res) {
switch(req.accepts(['json', 'html'])) {
// TODO: support HTML in future
//case 'html':
// res.sendFile(path.resolve(__dirname + '/../../web/association.html'));
// break;
default:
var rootUrl = req.protocol + '://' + req.get('host');
var quer... | javascript | function retrieveAssociations(req, res) {
switch(req.accepts(['json', 'html'])) {
// TODO: support HTML in future
//case 'html':
// res.sendFile(path.resolve(__dirname + '/../../web/association.html'));
// break;
default:
var rootUrl = req.protocol + '://' + req.get('host');
var quer... | [
"function",
"retrieveAssociations",
"(",
"req",
",",
"res",
")",
"{",
"switch",
"(",
"req",
".",
"accepts",
"(",
"[",
"'json'",
",",
"'html'",
"]",
")",
")",
"{",
"// TODO: support HTML in future",
"//case 'html':",
"// res.sendFile(path.resolve(__dirname + '/../../w... | Retrieve all available associations.
@param {Object} req The HTTP request.
@param {Object} res The HTTP result. | [
"Retrieve",
"all",
"available",
"associations",
"."
] | 1f65c2d369694d93796aae63318fa76326275120 | https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/routes/associations.js#L83-L98 |
48,541 | reelyactive/chickadee | lib/routes/associations.js | retrieveAssociation | function retrieveAssociation(req, res) {
if(redirect(req.params.id, '', '', res)) {
return;
}
switch(req.accepts(['json', 'html'])) {
// TODO: support HTML in future
//case 'html':
// res.sendFile(path.resolve(__dirname + '/../../web/association.html'));
// break;
default:
var id ... | javascript | function retrieveAssociation(req, res) {
if(redirect(req.params.id, '', '', res)) {
return;
}
switch(req.accepts(['json', 'html'])) {
// TODO: support HTML in future
//case 'html':
// res.sendFile(path.resolve(__dirname + '/../../web/association.html'));
// break;
default:
var id ... | [
"function",
"retrieveAssociation",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"redirect",
"(",
"req",
".",
"params",
".",
"id",
",",
"''",
",",
"''",
",",
"res",
")",
")",
"{",
"return",
";",
"}",
"switch",
"(",
"req",
".",
"accepts",
"(",
"[",... | Retrieve the given association.
@param {Object} req The HTTP request.
@param {Object} res The HTTP result. | [
"Retrieve",
"the",
"given",
"association",
"."
] | 1f65c2d369694d93796aae63318fa76326275120 | https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/routes/associations.js#L106-L126 |
48,542 | reelyactive/chickadee | lib/routes/associations.js | replaceAssociation | function replaceAssociation(req, res) {
if(redirect(req.params.id, '', '', res)) {
return;
}
var id = req.params.id;
var url = req.body.url;
var directory = req.body.directory;
var tags = req.body.tags;
var position = req.body.position;
var rootUrl = req.protocol + '://' + req.get('host');
var qu... | javascript | function replaceAssociation(req, res) {
if(redirect(req.params.id, '', '', res)) {
return;
}
var id = req.params.id;
var url = req.body.url;
var directory = req.body.directory;
var tags = req.body.tags;
var position = req.body.position;
var rootUrl = req.protocol + '://' + req.get('host');
var qu... | [
"function",
"replaceAssociation",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"redirect",
"(",
"req",
".",
"params",
".",
"id",
",",
"''",
",",
"''",
",",
"res",
")",
")",
"{",
"return",
";",
"}",
"var",
"id",
"=",
"req",
".",
"params",
".",
"... | Replace the specified association.
@param {Object} req The HTTP request.
@param {Object} res The HTTP result. | [
"Replace",
"the",
"specified",
"association",
"."
] | 1f65c2d369694d93796aae63318fa76326275120 | https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/routes/associations.js#L134-L150 |
48,543 | reelyactive/chickadee | lib/routes/associations.js | replaceAssociationPosition | function replaceAssociationPosition(req, res) {
if(redirect(req.params.id, '../', '/tags', res)) {
return;
}
var id = req.params.id;
var position = req.body.position;
var rootUrl = req.protocol + '://' + req.get('host');
var queryPath = req.originalUrl;
req.chickadee.setAssociation(req, id, null, nul... | javascript | function replaceAssociationPosition(req, res) {
if(redirect(req.params.id, '../', '/tags', res)) {
return;
}
var id = req.params.id;
var position = req.body.position;
var rootUrl = req.protocol + '://' + req.get('host');
var queryPath = req.originalUrl;
req.chickadee.setAssociation(req, id, null, nul... | [
"function",
"replaceAssociationPosition",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"redirect",
"(",
"req",
".",
"params",
".",
"id",
",",
"'../'",
",",
"'/tags'",
",",
"res",
")",
")",
"{",
"return",
";",
"}",
"var",
"id",
"=",
"req",
".",
"par... | Replace the specified association position.
@param {Object} req The HTTP request.
@param {Object} res The HTTP result. | [
"Replace",
"the",
"specified",
"association",
"position",
"."
] | 1f65c2d369694d93796aae63318fa76326275120 | https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/routes/associations.js#L413-L426 |
48,544 | reelyactive/chickadee | lib/routes/associations.js | deleteAssociationPosition | function deleteAssociationPosition(req, res) {
if(redirect(req.params.id, '../', '/tags', res)) {
return;
}
var id = req.params.id;
var rootUrl = req.protocol + '://' + req.get('host');
var queryPath = req.originalUrl;
req.chickadee.removeAssociation(req, id, 'position', rootUrl, queryPath,
... | javascript | function deleteAssociationPosition(req, res) {
if(redirect(req.params.id, '../', '/tags', res)) {
return;
}
var id = req.params.id;
var rootUrl = req.protocol + '://' + req.get('host');
var queryPath = req.originalUrl;
req.chickadee.removeAssociation(req, id, 'position', rootUrl, queryPath,
... | [
"function",
"deleteAssociationPosition",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"redirect",
"(",
"req",
".",
"params",
".",
"id",
",",
"'../'",
",",
"'/tags'",
",",
"res",
")",
")",
"{",
"return",
";",
"}",
"var",
"id",
"=",
"req",
".",
"para... | Delete the specified association position.
@param {Object} req The HTTP request.
@param {Object} res The HTTP result. | [
"Delete",
"the",
"specified",
"association",
"position",
"."
] | 1f65c2d369694d93796aae63318fa76326275120 | https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/routes/associations.js#L434-L446 |
48,545 | rhardin/node-statistics2 | lib/statistics2.js | p_nor | function p_nor(z) {
var e, z2, prev = 0.0, t, p, i = 3;
if (z < -12) { return 0.0; }
if (z > 12) { return 1.0; }
if (z === 0.0) { return 0.5; }
if (z > 0) {
e = true;
} else {
e = false;
z = -z;
}
z2 = z * z;
p... | javascript | function p_nor(z) {
var e, z2, prev = 0.0, t, p, i = 3;
if (z < -12) { return 0.0; }
if (z > 12) { return 1.0; }
if (z === 0.0) { return 0.5; }
if (z > 0) {
e = true;
} else {
e = false;
z = -z;
}
z2 = z * z;
p... | [
"function",
"p_nor",
"(",
"z",
")",
"{",
"var",
"e",
",",
"z2",
",",
"prev",
"=",
"0.0",
",",
"t",
",",
"p",
",",
"i",
"=",
"3",
";",
"if",
"(",
"z",
"<",
"-",
"12",
")",
"{",
"return",
"0.0",
";",
"}",
"if",
"(",
"z",
">",
"12",
")",
... | normal-distribution (-\infty, z] | [
"normal",
"-",
"distribution",
"(",
"-",
"\\",
"infty",
"z",
"]"
] | b00400adc7c3a0df43dee8d94b20affbb62be1ba | https://github.com/rhardin/node-statistics2/blob/b00400adc7c3a0df43dee8d94b20affbb62be1ba/lib/statistics2.js#L292-L317 |
48,546 | rhardin/node-statistics2 | lib/statistics2.js | pf | function pf(q, n1, n2) {
var eps, fw, s, qe, w1, w2, w3, w4, u, u2, a, b, c, d;
if (q < 0.0 || q > 1.0 || n1 < 1 || n2 < 1) {
console.error('Error : Illegal parameter in pf()!');
return 0.0;
}
if (n1 <= 240 || n2 <= 240) { eps = 1.0e-5; }
if (n2 === 1) {... | javascript | function pf(q, n1, n2) {
var eps, fw, s, qe, w1, w2, w3, w4, u, u2, a, b, c, d;
if (q < 0.0 || q > 1.0 || n1 < 1 || n2 < 1) {
console.error('Error : Illegal parameter in pf()!');
return 0.0;
}
if (n1 <= 240 || n2 <= 240) { eps = 1.0e-5; }
if (n2 === 1) {... | [
"function",
"pf",
"(",
"q",
",",
"n1",
",",
"n2",
")",
"{",
"var",
"eps",
",",
"fw",
",",
"s",
",",
"qe",
",",
"w1",
",",
"w2",
",",
"w3",
",",
"w4",
",",
"u",
",",
"u2",
",",
"a",
",",
"b",
",",
"c",
",",
"d",
";",
"if",
"(",
"q",
... | [x, \infty) | [
"[",
"x",
"\\",
"infty",
")"
] | b00400adc7c3a0df43dee8d94b20affbb62be1ba | https://github.com/rhardin/node-statistics2/blob/b00400adc7c3a0df43dee8d94b20affbb62be1ba/lib/statistics2.js#L551-L602 |
48,547 | Jmlevick/node-exec | lib/main.js | puts | function puts(error, stdout, stderr) {
if (error || stderr) {
let err = null;
if (error) {
err = `${error}`;
} else if (stderr) {
err = `${stderr}`;
}
returnObj.code = 1;
returnObj.error = err;
}
else if (stdout) {
returnObj.code = 0;
returnObj... | javascript | function puts(error, stdout, stderr) {
if (error || stderr) {
let err = null;
if (error) {
err = `${error}`;
} else if (stderr) {
err = `${stderr}`;
}
returnObj.code = 1;
returnObj.error = err;
}
else if (stdout) {
returnObj.code = 0;
returnObj... | [
"function",
"puts",
"(",
"error",
",",
"stdout",
",",
"stderr",
")",
"{",
"if",
"(",
"error",
"||",
"stderr",
")",
"{",
"let",
"err",
"=",
"null",
";",
"if",
"(",
"error",
")",
"{",
"err",
"=",
"`",
"${",
"error",
"}",
"`",
";",
"}",
"else",
... | Helpers
Callback for exec
@param {any} error
@param {any} stdout
@param {any} stderr | [
"Helpers",
"Callback",
"for",
"exec"
] | afb2d31eda9cbb0911820dc2f78ef23f87d40187 | https://github.com/Jmlevick/node-exec/blob/afb2d31eda9cbb0911820dc2f78ef23f87d40187/lib/main.js#L20-L39 |
48,548 | jurca/namespace-proxy | es2015/createNamespaceProxy.js | createProxy | function createProxy(instance, symbols, enumerable) {
return new Proxy(instance, {
set: (target, propertyName, value) => {
let { symbol, isNew } = getSymbol(symbols, propertyName)
instance[symbol] = value
if (!enumerable && isNew) {
Object.defineProperty(instance, symbol, {
enu... | javascript | function createProxy(instance, symbols, enumerable) {
return new Proxy(instance, {
set: (target, propertyName, value) => {
let { symbol, isNew } = getSymbol(symbols, propertyName)
instance[symbol] = value
if (!enumerable && isNew) {
Object.defineProperty(instance, symbol, {
enu... | [
"function",
"createProxy",
"(",
"instance",
",",
"symbols",
",",
"enumerable",
")",
"{",
"return",
"new",
"Proxy",
"(",
"instance",
",",
"{",
"set",
":",
"(",
"target",
",",
"propertyName",
",",
"value",
")",
"=>",
"{",
"let",
"{",
"symbol",
",",
"isNe... | Creates a proxy for retrieving and setting the values of the private
properties of the provided instance.
@param {Object} instance The instance for which the proxy should be created.
@param {Map<string, symbol>} symbols Cache of private property symbols.
@param {boolean} enumerable The flag specifying whether or not t... | [
"Creates",
"a",
"proxy",
"for",
"retrieving",
"and",
"setting",
"the",
"values",
"of",
"the",
"private",
"properties",
"of",
"the",
"provided",
"instance",
"."
] | b3526c8788930362694920d94a10848352436492 | https://github.com/jurca/namespace-proxy/blob/b3526c8788930362694920d94a10848352436492/es2015/createNamespaceProxy.js#L57-L79 |
48,549 | jurca/namespace-proxy | es2015/createNamespaceProxy.js | getSymbol | function getSymbol(symbols, propertyName) {
if (symbols.has(propertyName)) {
return {
symbol: symbols.get(propertyName),
isNew: false
}
}
let symbol = Symbol(propertyName)
symbols.set(propertyName, symbol)
return {
symbol,
isNew: true
}
} | javascript | function getSymbol(symbols, propertyName) {
if (symbols.has(propertyName)) {
return {
symbol: symbols.get(propertyName),
isNew: false
}
}
let symbol = Symbol(propertyName)
symbols.set(propertyName, symbol)
return {
symbol,
isNew: true
}
} | [
"function",
"getSymbol",
"(",
"symbols",
",",
"propertyName",
")",
"{",
"if",
"(",
"symbols",
".",
"has",
"(",
"propertyName",
")",
")",
"{",
"return",
"{",
"symbol",
":",
"symbols",
".",
"get",
"(",
"propertyName",
")",
",",
"isNew",
":",
"false",
"}"... | Retrieves or generates and caches the private field symbol for the private
property of the specified name.
@param {Map<string, symbol>} symbols Cache of private property symbols.
@param {string} propertyName The name of the private property.
@return {{symbol: symbol, isNew: boolean}} An object wrapping the symbol to
u... | [
"Retrieves",
"or",
"generates",
"and",
"caches",
"the",
"private",
"field",
"symbol",
"for",
"the",
"private",
"property",
"of",
"the",
"specified",
"name",
"."
] | b3526c8788930362694920d94a10848352436492 | https://github.com/jurca/namespace-proxy/blob/b3526c8788930362694920d94a10848352436492/es2015/createNamespaceProxy.js#L92-L106 |
48,550 | neoziro/image-size-parser | index.js | parse | function parse(size) {
var matches = size.match(regexp);
if (!matches)
return null;
var multiplicator = matches[3] ? +matches[3].replace(/x$/, '') : 1;
return {
width: +matches[1] * multiplicator,
height: +matches[2] * multiplicator
};
} | javascript | function parse(size) {
var matches = size.match(regexp);
if (!matches)
return null;
var multiplicator = matches[3] ? +matches[3].replace(/x$/, '') : 1;
return {
width: +matches[1] * multiplicator,
height: +matches[2] * multiplicator
};
} | [
"function",
"parse",
"(",
"size",
")",
"{",
"var",
"matches",
"=",
"size",
".",
"match",
"(",
"regexp",
")",
";",
"if",
"(",
"!",
"matches",
")",
"return",
"null",
";",
"var",
"multiplicator",
"=",
"matches",
"[",
"3",
"]",
"?",
"+",
"matches",
"["... | Parse image size.
@param {string} size Size string
@returns {object} size Size object
@returns {number} size.width Width
@returns {number} size.height Height | [
"Parse",
"image",
"size",
"."
] | 4b6594ae71a01900e9ace09a7a589c8976e5715e | https://github.com/neoziro/image-size-parser/blob/4b6594ae71a01900e9ace09a7a589c8976e5715e/index.js#L15-L27 |
48,551 | AutocratJS/autocrat | lib/law.js | function() {
var streams = this.sourceStreams = toArray(arguments);
if(streams.length > 1) {
this.resultStream = Bacon.mergeAll(streams);
} else {
this.resultStream = streams[0];
}
this.streamsHash = this._computeStreamsHash('any', streams);
// invalidate 'all'
return this;
... | javascript | function() {
var streams = this.sourceStreams = toArray(arguments);
if(streams.length > 1) {
this.resultStream = Bacon.mergeAll(streams);
} else {
this.resultStream = streams[0];
}
this.streamsHash = this._computeStreamsHash('any', streams);
// invalidate 'all'
return this;
... | [
"function",
"(",
")",
"{",
"var",
"streams",
"=",
"this",
".",
"sourceStreams",
"=",
"toArray",
"(",
"arguments",
")",
";",
"if",
"(",
"streams",
".",
"length",
">",
"1",
")",
"{",
"this",
".",
"resultStream",
"=",
"Bacon",
".",
"mergeAll",
"(",
"str... | Produce a side effect when any of the Law events occur
@function
@name whenAny
@instance
@memberof Law | [
"Produce",
"a",
"side",
"effect",
"when",
"any",
"of",
"the",
"Law",
"events",
"occur"
] | ca1466f851c4dbc5237fbbb2ee7caa1cff964f51 | https://github.com/AutocratJS/autocrat/blob/ca1466f851c4dbc5237fbbb2ee7caa1cff964f51/lib/law.js#L155-L168 | |
48,552 | AutocratJS/autocrat | lib/law.js | function() {
var streams = this.sourceStreams = toArray(arguments);
if(streams.length === 1) {
this.any.apply(this, streams);
return this;
}
this.resultStream = Bacon.zipAsArray(streams);
this.streamsHash = this._computeStreamsHash('all', streams);
// invalidate 'any'
return ... | javascript | function() {
var streams = this.sourceStreams = toArray(arguments);
if(streams.length === 1) {
this.any.apply(this, streams);
return this;
}
this.resultStream = Bacon.zipAsArray(streams);
this.streamsHash = this._computeStreamsHash('all', streams);
// invalidate 'any'
return ... | [
"function",
"(",
")",
"{",
"var",
"streams",
"=",
"this",
".",
"sourceStreams",
"=",
"toArray",
"(",
"arguments",
")",
";",
"if",
"(",
"streams",
".",
"length",
"===",
"1",
")",
"{",
"this",
".",
"any",
".",
"apply",
"(",
"this",
",",
"streams",
")... | Produce a side effect only after all of the Law events occur
@function whenAll
@name whenAll
@instance
@memberof Law | [
"Produce",
"a",
"side",
"effect",
"only",
"after",
"all",
"of",
"the",
"Law",
"events",
"occur"
] | ca1466f851c4dbc5237fbbb2ee7caa1cff964f51 | https://github.com/AutocratJS/autocrat/blob/ca1466f851c4dbc5237fbbb2ee7caa1cff964f51/lib/law.js#L178-L192 | |
48,553 | AutocratJS/autocrat | lib/law.js | function(autocrat, governor, origHandler, context) {
var streamsHash = this.streamsHash,
handlerSequence, isFirstHandler, deferred, handler;
context || (context = this.governor);
if(isFunction(origHandler)) {
origHandler = bind(origHandler, context);
} else if(isString(origHandler)){
... | javascript | function(autocrat, governor, origHandler, context) {
var streamsHash = this.streamsHash,
handlerSequence, isFirstHandler, deferred, handler;
context || (context = this.governor);
if(isFunction(origHandler)) {
origHandler = bind(origHandler, context);
} else if(isString(origHandler)){
... | [
"function",
"(",
"autocrat",
",",
"governor",
",",
"origHandler",
",",
"context",
")",
"{",
"var",
"streamsHash",
"=",
"this",
".",
"streamsHash",
",",
"handlerSequence",
",",
"isFirstHandler",
",",
"deferred",
",",
"handler",
";",
"context",
"||",
"(",
"con... | Explicitly specify a side effect function
@function then
@name then
@instance
@memberof Law | [
"Explicitly",
"specify",
"a",
"side",
"effect",
"function"
] | ca1466f851c4dbc5237fbbb2ee7caa1cff964f51 | https://github.com/AutocratJS/autocrat/blob/ca1466f851c4dbc5237fbbb2ee7caa1cff964f51/lib/law.js#L202-L235 | |
48,554 | AutocratJS/autocrat | lib/law.js | function(propName, updater) {
var updaterName, handler;
if(!isFunction(updater)) {
updaterName = 'update' + propName[0].toUpperCase() + propName.slice(1);
updater = this.governor[updaterName];
}
if(updater) {
this.then(function(advisorEvent, deferred, consequenceActions, streamEvent)... | javascript | function(propName, updater) {
var updaterName, handler;
if(!isFunction(updater)) {
updaterName = 'update' + propName[0].toUpperCase() + propName.slice(1);
updater = this.governor[updaterName];
}
if(updater) {
this.then(function(advisorEvent, deferred, consequenceActions, streamEvent)... | [
"function",
"(",
"propName",
",",
"updater",
")",
"{",
"var",
"updaterName",
",",
"handler",
";",
"if",
"(",
"!",
"isFunction",
"(",
"updater",
")",
")",
"{",
"updaterName",
"=",
"'update'",
"+",
"propName",
"[",
"0",
"]",
".",
"toUpperCase",
"(",
")",... | Indicate which property update function should be called in response to
Advisor events.
@function updateProp
@name updateProp
@instance
@memberof Law | [
"Indicate",
"which",
"property",
"update",
"function",
"should",
"be",
"called",
"in",
"response",
"to",
"Advisor",
"events",
"."
] | ca1466f851c4dbc5237fbbb2ee7caa1cff964f51 | https://github.com/AutocratJS/autocrat/blob/ca1466f851c4dbc5237fbbb2ee7caa1cff964f51/lib/law.js#L246-L271 | |
48,555 | AutocratJS/autocrat | lib/law.js | function() {
var props = arguments.length ? toArray(arguments) : keys(this.governor.props);
forEach(props, this.updateProp, this);
return this;
} | javascript | function() {
var props = arguments.length ? toArray(arguments) : keys(this.governor.props);
forEach(props, this.updateProp, this);
return this;
} | [
"function",
"(",
")",
"{",
"var",
"props",
"=",
"arguments",
".",
"length",
"?",
"toArray",
"(",
"arguments",
")",
":",
"keys",
"(",
"this",
".",
"governor",
".",
"props",
")",
";",
"forEach",
"(",
"props",
",",
"this",
".",
"updateProp",
",",
"this"... | Indicate that all prop update functions should be called in resonse to a
Law's Advisor events.
@function updateProps
@name updateProps
@instance
@memberof Law | [
"Indicate",
"that",
"all",
"prop",
"update",
"functions",
"should",
"be",
"called",
"in",
"resonse",
"to",
"a",
"Law",
"s",
"Advisor",
"events",
"."
] | ca1466f851c4dbc5237fbbb2ee7caa1cff964f51 | https://github.com/AutocratJS/autocrat/blob/ca1466f851c4dbc5237fbbb2ee7caa1cff964f51/lib/law.js#L282-L286 | |
48,556 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | removeElements | function removeElements(collection, newCollection, index) {
if (index === void 0) { index = 'id'; }
var oldLength = collection.length;
_.remove(collection, function (item) { return !_.some(newCollection, function (c) { return c[index] === item[index]; }); });
return collection.length !==... | javascript | function removeElements(collection, newCollection, index) {
if (index === void 0) { index = 'id'; }
var oldLength = collection.length;
_.remove(collection, function (item) { return !_.some(newCollection, function (c) { return c[index] === item[index]; }); });
return collection.length !==... | [
"function",
"removeElements",
"(",
"collection",
",",
"newCollection",
",",
"index",
")",
"{",
"if",
"(",
"index",
"===",
"void",
"0",
")",
"{",
"index",
"=",
"'id'",
";",
"}",
"var",
"oldLength",
"=",
"collection",
".",
"length",
";",
"_",
".",
"remov... | Removes elements in the target array based on the new collection, returns true if
any changes were made | [
"Removes",
"elements",
"in",
"the",
"target",
"array",
"based",
"on",
"the",
"new",
"collection",
"returns",
"true",
"if",
"any",
"changes",
"were",
"made"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L17-L22 |
48,557 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | sync | function sync(collection, newCollection, index) {
if (index === void 0) { index = 'id'; }
var answer = removeElements(collection, newCollection, index);
if (newCollection) {
newCollection.forEach(function (item) {
var oldItem = _.find(collection, function (c) { return... | javascript | function sync(collection, newCollection, index) {
if (index === void 0) { index = 'id'; }
var answer = removeElements(collection, newCollection, index);
if (newCollection) {
newCollection.forEach(function (item) {
var oldItem = _.find(collection, function (c) { return... | [
"function",
"sync",
"(",
"collection",
",",
"newCollection",
",",
"index",
")",
"{",
"if",
"(",
"index",
"===",
"void",
"0",
")",
"{",
"index",
"=",
"'id'",
";",
"}",
"var",
"answer",
"=",
"removeElements",
"(",
"collection",
",",
"newCollection",
",",
... | Changes the existing collection to match the new collection to avoid re-assigning
the array pointer, returns true if the array size has changed | [
"Changes",
"the",
"existing",
"collection",
"to",
"match",
"the",
"new",
"collection",
"to",
"avoid",
"re",
"-",
"assigning",
"the",
"array",
"pointer",
"returns",
"true",
"if",
"the",
"array",
"size",
"has",
"changed"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L28-L47 |
48,558 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | escapeColons | function escapeColons(url) {
var answer = url;
if (_.startsWith(url, 'proxy')) {
answer = url.replace(/:/g, '\\:');
}
else {
answer = url.replace(/:([^\/])/, '\\:$1');
}
return answer;
} | javascript | function escapeColons(url) {
var answer = url;
if (_.startsWith(url, 'proxy')) {
answer = url.replace(/:/g, '\\:');
}
else {
answer = url.replace(/:([^\/])/, '\\:$1');
}
return answer;
} | [
"function",
"escapeColons",
"(",
"url",
")",
"{",
"var",
"answer",
"=",
"url",
";",
"if",
"(",
"_",
".",
"startsWith",
"(",
"url",
",",
"'proxy'",
")",
")",
"{",
"answer",
"=",
"url",
".",
"replace",
"(",
"/",
":",
"/",
"g",
",",
"'\\\\:'",
")",
... | Escape any colons in the URL for ng-resource, mostly useful for handling proxified URLs
@param url
@returns {*} | [
"Escape",
"any",
"colons",
"in",
"the",
"URL",
"for",
"ng",
"-",
"resource",
"mostly",
"useful",
"for",
"handling",
"proxified",
"URLs"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L207-L216 |
48,559 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | url | function url(path) {
if (path) {
if (_.startsWith(path, "/")) {
if (!_urlPrefix) {
// lets discover the base url via the base html element
_urlPrefix = $('base').attr('href') || "";
if (_.endsWith(_urlPrefix, '/')) {
... | javascript | function url(path) {
if (path) {
if (_.startsWith(path, "/")) {
if (!_urlPrefix) {
// lets discover the base url via the base html element
_urlPrefix = $('base').attr('href') || "";
if (_.endsWith(_urlPrefix, '/')) {
... | [
"function",
"url",
"(",
"path",
")",
"{",
"if",
"(",
"path",
")",
"{",
"if",
"(",
"_",
".",
"startsWith",
"(",
"path",
",",
"\"/\"",
")",
")",
"{",
"if",
"(",
"!",
"_urlPrefix",
")",
"{",
"// lets discover the base url via the base html element",
"_urlPref... | Prefixes absolute URLs with current window.location.pathname
@param path
@returns {string} | [
"Prefixes",
"absolute",
"URLs",
"with",
"current",
"window",
".",
"location",
".",
"pathname"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L239-L255 |
48,560 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | trimLeading | function trimLeading(text, prefix) {
if (text && prefix) {
if (_.startsWith(text, prefix) || text.indexOf(prefix) === 0) {
return text.substring(prefix.length);
}
}
return text;
} | javascript | function trimLeading(text, prefix) {
if (text && prefix) {
if (_.startsWith(text, prefix) || text.indexOf(prefix) === 0) {
return text.substring(prefix.length);
}
}
return text;
} | [
"function",
"trimLeading",
"(",
"text",
",",
"prefix",
")",
"{",
"if",
"(",
"text",
"&&",
"prefix",
")",
"{",
"if",
"(",
"_",
".",
"startsWith",
"(",
"text",
",",
"prefix",
")",
"||",
"text",
".",
"indexOf",
"(",
"prefix",
")",
"===",
"0",
")",
"... | Trims the leading prefix from a string if its present
@method trimLeading
@for Core
@static
@param {String} text
@param {String} prefix
@return {String} | [
"Trims",
"the",
"leading",
"prefix",
"from",
"a",
"string",
"if",
"its",
"present"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L296-L303 |
48,561 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | trimTrailing | function trimTrailing(text, postfix) {
if (text && postfix) {
if (_.endsWith(text, postfix)) {
return text.substring(0, text.length - postfix.length);
}
}
return text;
} | javascript | function trimTrailing(text, postfix) {
if (text && postfix) {
if (_.endsWith(text, postfix)) {
return text.substring(0, text.length - postfix.length);
}
}
return text;
} | [
"function",
"trimTrailing",
"(",
"text",
",",
"postfix",
")",
"{",
"if",
"(",
"text",
"&&",
"postfix",
")",
"{",
"if",
"(",
"_",
".",
"endsWith",
"(",
"text",
",",
"postfix",
")",
")",
"{",
"return",
"text",
".",
"substring",
"(",
"0",
",",
"text",... | Trims the trailing postfix from a string if its present
@method trimTrailing
@for Core
@static
@param {String} trim
@param {String} postfix
@return {String} | [
"Trims",
"the",
"trailing",
"postfix",
"from",
"a",
"string",
"if",
"its",
"present"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L314-L321 |
48,562 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | adjustHeight | function adjustHeight() {
var windowHeight = $(window).height();
var headerHeight = $("#main-nav").height();
var containerHeight = windowHeight - headerHeight;
$("#main").css("min-height", "" + containerHeight + "px");
} | javascript | function adjustHeight() {
var windowHeight = $(window).height();
var headerHeight = $("#main-nav").height();
var containerHeight = windowHeight - headerHeight;
$("#main").css("min-height", "" + containerHeight + "px");
} | [
"function",
"adjustHeight",
"(",
")",
"{",
"var",
"windowHeight",
"=",
"$",
"(",
"window",
")",
".",
"height",
"(",
")",
";",
"var",
"headerHeight",
"=",
"$",
"(",
"\"#main-nav\"",
")",
".",
"height",
"(",
")",
";",
"var",
"containerHeight",
"=",
"wind... | Ensure our main app container takes up at least the viewport
height | [
"Ensure",
"our",
"main",
"app",
"container",
"takes",
"up",
"at",
"least",
"the",
"viewport",
"height"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L327-L332 |
48,563 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | addCSS | function addCSS(path) {
if ('createStyleSheet' in document) {
// IE9
document.createStyleSheet(path);
}
else {
// Everyone else
var link = $("<link>");
$("head").append(link);
link.attr({
rel: 'stylesheet',
... | javascript | function addCSS(path) {
if ('createStyleSheet' in document) {
// IE9
document.createStyleSheet(path);
}
else {
// Everyone else
var link = $("<link>");
$("head").append(link);
link.attr({
rel: 'stylesheet',
... | [
"function",
"addCSS",
"(",
"path",
")",
"{",
"if",
"(",
"'createStyleSheet'",
"in",
"document",
")",
"{",
"// IE9",
"document",
".",
"createStyleSheet",
"(",
"path",
")",
";",
"}",
"else",
"{",
"// Everyone else",
"var",
"link",
"=",
"$",
"(",
"\"<link>\""... | Adds the specified CSS file to the document's head, handy
for external plugins that might bring along their own CSS
@param path | [
"Adds",
"the",
"specified",
"CSS",
"file",
"to",
"the",
"document",
"s",
"head",
"handy",
"for",
"external",
"plugins",
"that",
"might",
"bring",
"along",
"their",
"own",
"CSS"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L352-L367 |
48,564 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | parseBooleanValue | function parseBooleanValue(value, defaultValue) {
if (defaultValue === void 0) { defaultValue = false; }
if (!angular.isDefined(value) || !value) {
return defaultValue;
}
if (value.constructor === Boolean) {
return value;
}
if (angular.isString(val... | javascript | function parseBooleanValue(value, defaultValue) {
if (defaultValue === void 0) { defaultValue = false; }
if (!angular.isDefined(value) || !value) {
return defaultValue;
}
if (value.constructor === Boolean) {
return value;
}
if (angular.isString(val... | [
"function",
"parseBooleanValue",
"(",
"value",
",",
"defaultValue",
")",
"{",
"if",
"(",
"defaultValue",
"===",
"void",
"0",
")",
"{",
"defaultValue",
"=",
"false",
";",
"}",
"if",
"(",
"!",
"angular",
".",
"isDefined",
"(",
"value",
")",
"||",
"!",
"v... | Ensure whatever value is passed in is converted to a boolean
In the branding module for now as it's needed before bootstrap
@method parseBooleanValue
@for Core
@param {any} value
@param {Boolean} defaultValue default value to use if value is not defined
@return {Boolean} | [
"Ensure",
"whatever",
"value",
"is",
"passed",
"in",
"is",
"converted",
"to",
"a",
"boolean"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L407-L429 |
48,565 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | pathGet | function pathGet(object, paths) {
var pathArray = (angular.isArray(paths)) ? paths : (paths || "").split(".");
var value = object;
angular.forEach(pathArray, function (name) {
if (value) {
try {
value = value[name];
}
... | javascript | function pathGet(object, paths) {
var pathArray = (angular.isArray(paths)) ? paths : (paths || "").split(".");
var value = object;
angular.forEach(pathArray, function (name) {
if (value) {
try {
value = value[name];
}
... | [
"function",
"pathGet",
"(",
"object",
",",
"paths",
")",
"{",
"var",
"pathArray",
"=",
"(",
"angular",
".",
"isArray",
"(",
"paths",
")",
")",
"?",
"paths",
":",
"(",
"paths",
"||",
"\"\"",
")",
".",
"split",
"(",
"\".\"",
")",
";",
"var",
"value",... | Navigates the given set of paths in turn on the source object
and returns the last most value of the path or null if it could not be found.
@method pathGet
@for Core
@static
@param {Object} object the start object to start navigating from
@param {Array} paths an array of path names to navigate or a string of dot separ... | [
"Navigates",
"the",
"given",
"set",
"of",
"paths",
"in",
"turn",
"on",
"the",
"source",
"object",
"and",
"returns",
"the",
"last",
"most",
"value",
"of",
"the",
"path",
"or",
"null",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L517-L535 |
48,566 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | pathSet | function pathSet(object, paths, newValue) {
var pathArray = (angular.isArray(paths)) ? paths : (paths || "").split(".");
var value = object;
var lastIndex = pathArray.length - 1;
angular.forEach(pathArray, function (name, idx) {
var next = value[name];
if (idx >= ... | javascript | function pathSet(object, paths, newValue) {
var pathArray = (angular.isArray(paths)) ? paths : (paths || "").split(".");
var value = object;
var lastIndex = pathArray.length - 1;
angular.forEach(pathArray, function (name, idx) {
var next = value[name];
if (idx >= ... | [
"function",
"pathSet",
"(",
"object",
",",
"paths",
",",
"newValue",
")",
"{",
"var",
"pathArray",
"=",
"(",
"angular",
".",
"isArray",
"(",
"paths",
")",
")",
"?",
"paths",
":",
"(",
"paths",
"||",
"\"\"",
")",
".",
"split",
"(",
"\".\"",
")",
";"... | Navigates the given set of paths in turn on the source object
and updates the last path value to the given newValue
@method pathSet
@for Core
@static
@param {Object} object the start object to start navigating from
@param {Array} paths an array of path names to navigate or a string of dot separated paths to navigate
@... | [
"Navigates",
"the",
"given",
"set",
"of",
"paths",
"in",
"turn",
"on",
"the",
"source",
"object",
"and",
"updates",
"the",
"last",
"path",
"value",
"to",
"the",
"given",
"newValue"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L549-L562 |
48,567 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | getOrCreateElements | function getOrCreateElements(domElement, arrayOfElementNames) {
var element = domElement;
angular.forEach(arrayOfElementNames, function (name) {
if (element) {
var children = $(element).children(name);
if (!children || !children.length) {
$... | javascript | function getOrCreateElements(domElement, arrayOfElementNames) {
var element = domElement;
angular.forEach(arrayOfElementNames, function (name) {
if (element) {
var children = $(element).children(name);
if (!children || !children.length) {
$... | [
"function",
"getOrCreateElements",
"(",
"domElement",
",",
"arrayOfElementNames",
")",
"{",
"var",
"element",
"=",
"domElement",
";",
"angular",
".",
"forEach",
"(",
"arrayOfElementNames",
",",
"function",
"(",
"name",
")",
"{",
"if",
"(",
"element",
")",
"{",... | Look up a list of child element names or lazily create them.
Useful for example to get the <tbody> <tr> element from a <table> lazily creating one
if not present.
Usage: var trElement = getOrCreateElements(tableElement, ["tbody", "tr"])
@method getOrCreateElements
@for Core
@static
@param {Object} domElement
@param {... | [
"Look",
"up",
"a",
"list",
"of",
"child",
"element",
"names",
"or",
"lazily",
"create",
"them",
"."
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L654-L667 |
48,568 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | escapeHtml | function escapeHtml(str) {
if (angular.isString(str)) {
var newStr = "";
for (var i = 0; i < str.length; i++) {
var ch = str.charAt(i);
ch = _escapeHtmlChars[ch] || ch;
newStr += ch;
}
return newStr;
}
... | javascript | function escapeHtml(str) {
if (angular.isString(str)) {
var newStr = "";
for (var i = 0; i < str.length; i++) {
var ch = str.charAt(i);
ch = _escapeHtmlChars[ch] || ch;
newStr += ch;
}
return newStr;
}
... | [
"function",
"escapeHtml",
"(",
"str",
")",
"{",
"if",
"(",
"angular",
".",
"isString",
"(",
"str",
")",
")",
"{",
"var",
"newStr",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
";",
"i",
"++",
")",
"... | static escapeHtml method
@param str
@returns {*} | [
"static",
"escapeHtml",
"method"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L697-L710 |
48,569 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | isBlank | function isBlank(str) {
if (str === undefined || str === null) {
return true;
}
if (angular.isString(str)) {
return str.trim().length === 0;
}
else {
// TODO - not undefined but also not a string...
return false;
}
} | javascript | function isBlank(str) {
if (str === undefined || str === null) {
return true;
}
if (angular.isString(str)) {
return str.trim().length === 0;
}
else {
// TODO - not undefined but also not a string...
return false;
}
} | [
"function",
"isBlank",
"(",
"str",
")",
"{",
"if",
"(",
"str",
"===",
"undefined",
"||",
"str",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"angular",
".",
"isString",
"(",
"str",
")",
")",
"{",
"return",
"str",
".",
"trim",
"... | Returns true if the string is either null or empty
@method isBlank
@for Core
@static
@param {String} str
@return {Boolean} | [
"Returns",
"true",
"if",
"the",
"string",
"is",
"either",
"null",
"or",
"empty"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L721-L732 |
48,570 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | humanizeValue | function humanizeValue(value) {
if (value) {
var text = value + '';
if (Core.isBlank(text)) {
return text;
}
try {
text = _.snakeCase(text);
text = _.capitalize(text.split('_').join(' '));
}
c... | javascript | function humanizeValue(value) {
if (value) {
var text = value + '';
if (Core.isBlank(text)) {
return text;
}
try {
text = _.snakeCase(text);
text = _.capitalize(text.split('_').join(' '));
}
c... | [
"function",
"humanizeValue",
"(",
"value",
")",
"{",
"if",
"(",
"value",
")",
"{",
"var",
"text",
"=",
"value",
"+",
"''",
";",
"if",
"(",
"Core",
".",
"isBlank",
"(",
"text",
")",
")",
"{",
"return",
"text",
";",
"}",
"try",
"{",
"text",
"=",
... | Converts camel-case and dash-separated strings into Human readable forms
@param value
@returns {*} | [
"Converts",
"camel",
"-",
"case",
"and",
"dash",
"-",
"separated",
"strings",
"into",
"Human",
"readable",
"forms"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L750-L766 |
48,571 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | lineCount | function lineCount(value) {
var rows = 0;
if (value) {
rows = 1;
value.toString().each(/\n/, function () { return rows++; });
}
return rows;
} | javascript | function lineCount(value) {
var rows = 0;
if (value) {
rows = 1;
value.toString().each(/\n/, function () { return rows++; });
}
return rows;
} | [
"function",
"lineCount",
"(",
"value",
")",
"{",
"var",
"rows",
"=",
"0",
";",
"if",
"(",
"value",
")",
"{",
"rows",
"=",
"1",
";",
"value",
".",
"toString",
"(",
")",
".",
"each",
"(",
"/",
"\\n",
"/",
",",
"function",
"(",
")",
"{",
"return",... | Returns the number of lines in the given text
@method lineCount
@static
@param {String} value
@return {Number} | [
"Returns",
"the",
"number",
"of",
"lines",
"in",
"the",
"given",
"text"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L914-L921 |
48,572 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | toSearchArgumentArray | function toSearchArgumentArray(value) {
if (value) {
if (angular.isArray(value))
return value;
if (angular.isString(value))
return value.split(',');
}
return [];
} | javascript | function toSearchArgumentArray(value) {
if (value) {
if (angular.isArray(value))
return value;
if (angular.isString(value))
return value.split(',');
}
return [];
} | [
"function",
"toSearchArgumentArray",
"(",
"value",
")",
"{",
"if",
"(",
"value",
")",
"{",
"if",
"(",
"angular",
".",
"isArray",
"(",
"value",
")",
")",
"return",
"value",
";",
"if",
"(",
"angular",
".",
"isString",
"(",
"value",
")",
")",
"return",
... | Converts the given value to an array of query arguments.
If the value is null an empty array is returned.
If the value is a non empty string then the string is split by commas
@method toSearchArgumentArray
@static
@param {*} value
@return {String[]} | [
"Converts",
"the",
"given",
"value",
"to",
"an",
"array",
"of",
"query",
"arguments",
"."
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L998-L1006 |
48,573 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | onSuccess | function onSuccess(fn, options) {
if (options === void 0) { options = {}; }
options['mimeType'] = 'application/json';
if (!_.isUndefined(fn)) {
options['success'] = fn;
}
if (!options['method']) {
options['method'] = "POST";
}
// the defaul... | javascript | function onSuccess(fn, options) {
if (options === void 0) { options = {}; }
options['mimeType'] = 'application/json';
if (!_.isUndefined(fn)) {
options['success'] = fn;
}
if (!options['method']) {
options['method'] = "POST";
}
// the defaul... | [
"function",
"onSuccess",
"(",
"fn",
",",
"options",
")",
"{",
"if",
"(",
"options",
"===",
"void",
"0",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"options",
"[",
"'mimeType'",
"]",
"=",
"'application/json'",
";",
"if",
"(",
"!",
"_",
".",
"isUn... | Pass in null for the success function to switch to sync mode
@method onSuccess
@static
@param {Function} Success callback function
@param {Object} Options object to pass on to Jolokia request
@return {Object} initialized options object | [
"Pass",
"in",
"null",
"for",
"the",
"success",
"function",
"to",
"switch",
"to",
"sync",
"mode"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1058-L1074 |
48,574 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | defaultJolokiaErrorHandler | function defaultJolokiaErrorHandler(response, options) {
if (options === void 0) { options = {}; }
var operation = Core.pathGet(response, ['request', 'operation']) || "unknown";
var silent = options['silent'];
var stacktrace = response.stacktrace;
if (silent || isIgnorableExcepti... | javascript | function defaultJolokiaErrorHandler(response, options) {
if (options === void 0) { options = {}; }
var operation = Core.pathGet(response, ['request', 'operation']) || "unknown";
var silent = options['silent'];
var stacktrace = response.stacktrace;
if (silent || isIgnorableExcepti... | [
"function",
"defaultJolokiaErrorHandler",
"(",
"response",
",",
"options",
")",
"{",
"if",
"(",
"options",
"===",
"void",
"0",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"var",
"operation",
"=",
"Core",
".",
"pathGet",
"(",
"response",
",",
"[",
"'r... | The default error handler which logs errors either using debug or log level logging based on the silent setting
@param response the response from a jolokia request | [
"The",
"default",
"error",
"handler",
"which",
"logs",
"errors",
"either",
"using",
"debug",
"or",
"log",
"level",
"logging",
"based",
"on",
"the",
"silent",
"setting"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1080-L1091 |
48,575 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | isIgnorableException | function isIgnorableException(response) {
var isNotFound = function (target) {
return target.indexOf("InstanceNotFoundException") >= 0
|| target.indexOf("AttributeNotFoundException") >= 0
|| target.indexOf("IllegalArgumentException: No operation") >= 0;
};
... | javascript | function isIgnorableException(response) {
var isNotFound = function (target) {
return target.indexOf("InstanceNotFoundException") >= 0
|| target.indexOf("AttributeNotFoundException") >= 0
|| target.indexOf("IllegalArgumentException: No operation") >= 0;
};
... | [
"function",
"isIgnorableException",
"(",
"response",
")",
"{",
"var",
"isNotFound",
"=",
"function",
"(",
"target",
")",
"{",
"return",
"target",
".",
"indexOf",
"(",
"\"InstanceNotFoundException\"",
")",
">=",
"0",
"||",
"target",
".",
"indexOf",
"(",
"\"Attr... | Checks if it's an error that can happen on timing issues such as its been removed or if we run against older containers
@param {Object} response the error response from a jolokia request | [
"Checks",
"if",
"it",
"s",
"an",
"error",
"that",
"can",
"happen",
"on",
"timing",
"issues",
"such",
"as",
"its",
"been",
"removed",
"or",
"if",
"we",
"run",
"against",
"older",
"containers"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1097-L1104 |
48,576 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | logJolokiaStackTrace | function logJolokiaStackTrace(response) {
var stacktrace = response.stacktrace;
if (stacktrace) {
var operation = Core.pathGet(response, ['request', 'operation']) || "unknown";
log.info("Operation", operation, "failed due to:", response['error']);
}
} | javascript | function logJolokiaStackTrace(response) {
var stacktrace = response.stacktrace;
if (stacktrace) {
var operation = Core.pathGet(response, ['request', 'operation']) || "unknown";
log.info("Operation", operation, "failed due to:", response['error']);
}
} | [
"function",
"logJolokiaStackTrace",
"(",
"response",
")",
"{",
"var",
"stacktrace",
"=",
"response",
".",
"stacktrace",
";",
"if",
"(",
"stacktrace",
")",
"{",
"var",
"operation",
"=",
"Core",
".",
"pathGet",
"(",
"response",
",",
"[",
"'request'",
",",
"'... | Logs any failed operation and stack traces | [
"Logs",
"any",
"failed",
"operation",
"and",
"stack",
"traces"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1108-L1114 |
48,577 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | logLevelClass | function logLevelClass(level) {
if (level) {
var first = level[0];
if (first === 'w' || first === "W") {
return "warning";
}
else if (first === 'e' || first === "E") {
return "error";
}
else if (first === 'i'... | javascript | function logLevelClass(level) {
if (level) {
var first = level[0];
if (first === 'w' || first === "W") {
return "warning";
}
else if (first === 'e' || first === "E") {
return "error";
}
else if (first === 'i'... | [
"function",
"logLevelClass",
"(",
"level",
")",
"{",
"if",
"(",
"level",
")",
"{",
"var",
"first",
"=",
"level",
"[",
"0",
"]",
";",
"if",
"(",
"first",
"===",
"'w'",
"||",
"first",
"===",
"\"W\"",
")",
"{",
"return",
"\"warning\"",
";",
"}",
"else... | Returns the CSS class for a log level based on if its info, warn, error etc.
@method logLevelClass
@static
@param {String} level
@return {String} | [
"Returns",
"the",
"CSS",
"class",
"for",
"a",
"log",
"level",
"based",
"on",
"if",
"its",
"info",
"warn",
"error",
"etc",
"."
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1190-L1208 |
48,578 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | hashToString | function hashToString(hash) {
var keyValuePairs = [];
angular.forEach(hash, function (value, key) {
keyValuePairs.push(key + "=" + value);
});
var params = keyValuePairs.join("&");
return encodeURI(params);
} | javascript | function hashToString(hash) {
var keyValuePairs = [];
angular.forEach(hash, function (value, key) {
keyValuePairs.push(key + "=" + value);
});
var params = keyValuePairs.join("&");
return encodeURI(params);
} | [
"function",
"hashToString",
"(",
"hash",
")",
"{",
"var",
"keyValuePairs",
"=",
"[",
"]",
";",
"angular",
".",
"forEach",
"(",
"hash",
",",
"function",
"(",
"value",
",",
"key",
")",
"{",
"keyValuePairs",
".",
"push",
"(",
"key",
"+",
"\"=\"",
"+",
"... | Turns the given search hash into a URI style query string
@method hashToString
@for Core
@static
@param {Object} hash
@return {String} | [
"Turns",
"the",
"given",
"search",
"hash",
"into",
"a",
"URI",
"style",
"query",
"string"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1275-L1282 |
48,579 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | stringToHash | function stringToHash(hashAsString) {
var entries = {};
if (hashAsString) {
var text = decodeURI(hashAsString);
var items = text.split('&');
angular.forEach(items, function (item) {
var kv = item.split('=');
var key = kv[0];
... | javascript | function stringToHash(hashAsString) {
var entries = {};
if (hashAsString) {
var text = decodeURI(hashAsString);
var items = text.split('&');
angular.forEach(items, function (item) {
var kv = item.split('=');
var key = kv[0];
... | [
"function",
"stringToHash",
"(",
"hashAsString",
")",
"{",
"var",
"entries",
"=",
"{",
"}",
";",
"if",
"(",
"hashAsString",
")",
"{",
"var",
"text",
"=",
"decodeURI",
"(",
"hashAsString",
")",
";",
"var",
"items",
"=",
"text",
".",
"split",
"(",
"'&'",... | Parses the given string of x=y&bar=foo into a hash
@method stringToHash
@for Core
@static
@param {String} hashAsString
@return {Object} | [
"Parses",
"the",
"given",
"string",
"of",
"x",
"=",
"y&bar",
"=",
"foo",
"into",
"a",
"hash"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1292-L1305 |
48,580 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | registerForChanges | function registerForChanges(jolokia, $scope, arguments, callback, options) {
var decorated = {
responseJson: '',
success: function (response) {
var json = angular.toJson(response.value);
if (decorated.responseJson !== json) {
decorated.... | javascript | function registerForChanges(jolokia, $scope, arguments, callback, options) {
var decorated = {
responseJson: '',
success: function (response) {
var json = angular.toJson(response.value);
if (decorated.responseJson !== json) {
decorated.... | [
"function",
"registerForChanges",
"(",
"jolokia",
",",
"$scope",
",",
"arguments",
",",
"callback",
",",
"options",
")",
"{",
"var",
"decorated",
"=",
"{",
"responseJson",
":",
"''",
",",
"success",
":",
"function",
"(",
"response",
")",
"{",
"var",
"json"... | Register a JMX operation to poll for changes, only
calls back when a change occurs
@param jolokia
@param scope
@param arguments
@param callback
@param options
@returns Object | [
"Register",
"a",
"JMX",
"operation",
"to",
"poll",
"for",
"changes",
"only",
"calls",
"back",
"when",
"a",
"change",
"occurs"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1318-L1331 |
48,581 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | register | function register(jolokia, scope, arguments, callback) {
if (scope.$$destroyed) {
// fail fast to prevent registration leaks
return;
}
/*
if (scope && !Core.isBlank(scope.name)) {
Core.log.debug("Calling register from scope: ", scope.name);
} els... | javascript | function register(jolokia, scope, arguments, callback) {
if (scope.$$destroyed) {
// fail fast to prevent registration leaks
return;
}
/*
if (scope && !Core.isBlank(scope.name)) {
Core.log.debug("Calling register from scope: ", scope.name);
} els... | [
"function",
"register",
"(",
"jolokia",
",",
"scope",
",",
"arguments",
",",
"callback",
")",
"{",
"if",
"(",
"scope",
".",
"$$destroyed",
")",
"{",
"// fail fast to prevent registration leaks",
"return",
";",
"}",
"/*\n if (scope && !Core.isBlank(scope.name)) {\... | end jolokia caching stuff
Register a JMX operation to poll for changes
@method register
@for Core
@static
@return {Function} a zero argument function for unregistering this registration
@param {*} jolokia
@param {*} scope
@param {Object} arguments
@param {Function} callback | [
"end",
"jolokia",
"caching",
"stuff",
"Register",
"a",
"JMX",
"operation",
"to",
"poll",
"for",
"changes"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1465-L1523 |
48,582 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | unregister | function unregister(jolokia, scope) {
if (angular.isDefined(scope.$jhandle)) {
scope.$jhandle.forEach(function (handle) {
jolokia.unregister(handle);
});
delete scope.$jhandle;
}
} | javascript | function unregister(jolokia, scope) {
if (angular.isDefined(scope.$jhandle)) {
scope.$jhandle.forEach(function (handle) {
jolokia.unregister(handle);
});
delete scope.$jhandle;
}
} | [
"function",
"unregister",
"(",
"jolokia",
",",
"scope",
")",
"{",
"if",
"(",
"angular",
".",
"isDefined",
"(",
"scope",
".",
"$jhandle",
")",
")",
"{",
"scope",
".",
"$jhandle",
".",
"forEach",
"(",
"function",
"(",
"handle",
")",
"{",
"jolokia",
".",
... | Register a JMX operation to poll for changes using a jolokia search using the given mbean pattern
@method registerSearch
@for Core
@static
@paran {*} jolokia
@param {*} scope
@param {String} mbeanPattern
@param {Function} callback
/*
TODO - won't compile, and where is 'arguments' coming from?
export function registerS... | [
"Register",
"a",
"JMX",
"operation",
"to",
"poll",
"for",
"changes",
"using",
"a",
"jolokia",
"search",
"using",
"the",
"given",
"mbean",
"pattern"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1566-L1573 |
48,583 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | xmlNodeToString | function xmlNodeToString(xmlNode) {
try {
// Gecko- and Webkit-based browsers (Firefox, Chrome), Opera.
return (new XMLSerializer()).serializeToString(xmlNode);
}
catch (e) {
try {
// Internet Explorer.
return xmlNode.xml;
... | javascript | function xmlNodeToString(xmlNode) {
try {
// Gecko- and Webkit-based browsers (Firefox, Chrome), Opera.
return (new XMLSerializer()).serializeToString(xmlNode);
}
catch (e) {
try {
// Internet Explorer.
return xmlNode.xml;
... | [
"function",
"xmlNodeToString",
"(",
"xmlNode",
")",
"{",
"try",
"{",
"// Gecko- and Webkit-based browsers (Firefox, Chrome), Opera.",
"return",
"(",
"new",
"XMLSerializer",
"(",
")",
")",
".",
"serializeToString",
"(",
"xmlNode",
")",
";",
"}",
"catch",
"(",
"e",
... | Converts the given XML node to a string representation of the XML
@method xmlNodeToString
@for Core
@static
@param {Object} xmlNode
@return {Object} | [
"Converts",
"the",
"given",
"XML",
"node",
"to",
"a",
"string",
"representation",
"of",
"the",
"XML"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1583-L1599 |
48,584 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | fileExtension | function fileExtension(name, defaultValue) {
if (defaultValue === void 0) { defaultValue = ""; }
var extension = defaultValue;
if (name) {
var idx = name.lastIndexOf(".");
if (idx > 0) {
extension = name.substring(idx + 1, name.length).toLowerCase();
... | javascript | function fileExtension(name, defaultValue) {
if (defaultValue === void 0) { defaultValue = ""; }
var extension = defaultValue;
if (name) {
var idx = name.lastIndexOf(".");
if (idx > 0) {
extension = name.substring(idx + 1, name.length).toLowerCase();
... | [
"function",
"fileExtension",
"(",
"name",
",",
"defaultValue",
")",
"{",
"if",
"(",
"defaultValue",
"===",
"void",
"0",
")",
"{",
"defaultValue",
"=",
"\"\"",
";",
"}",
"var",
"extension",
"=",
"defaultValue",
";",
"if",
"(",
"name",
")",
"{",
"var",
"... | Returns the lowercase file extension of the given file name or returns the empty
string if the file does not have an extension
@method fileExtension
@for Core
@static
@param {String} name
@param {String} defaultValue
@return {String} | [
"Returns",
"the",
"lowercase",
"file",
"extension",
"of",
"the",
"given",
"file",
"name",
"or",
"returns",
"the",
"empty",
"string",
"if",
"the",
"file",
"does",
"not",
"have",
"an",
"extension"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1623-L1633 |
48,585 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | parseVersionNumbers | function parseVersionNumbers(text) {
if (text) {
var m = text.match(_versionRegex);
if (m && m.length > 4) {
var m1 = m[1];
var m2 = m[2];
var m4 = m[4];
if (angular.isDefined(m4)) {
return [parseInt(m1),... | javascript | function parseVersionNumbers(text) {
if (text) {
var m = text.match(_versionRegex);
if (m && m.length > 4) {
var m1 = m[1];
var m2 = m[2];
var m4 = m[4];
if (angular.isDefined(m4)) {
return [parseInt(m1),... | [
"function",
"parseVersionNumbers",
"(",
"text",
")",
"{",
"if",
"(",
"text",
")",
"{",
"var",
"m",
"=",
"text",
".",
"match",
"(",
"_versionRegex",
")",
";",
"if",
"(",
"m",
"&&",
"m",
".",
"length",
">",
"4",
")",
"{",
"var",
"m1",
"=",
"m",
"... | Parses some text of the form "xxxx2.3.4xxxx"
to extract the version numbers as an array of numbers then returns an array of 2 or 3 numbers.
Characters before the first digit are ignored as are characters after the last digit.
@method parseVersionNumbers
@for Core
@static
@param {String} text a maven like string contai... | [
"Parses",
"some",
"text",
"of",
"the",
"form",
"xxxx2",
".",
"3",
".",
"4xxxx",
"to",
"extract",
"the",
"version",
"numbers",
"as",
"an",
"array",
"of",
"numbers",
"then",
"returns",
"an",
"array",
"of",
"2",
"or",
"3",
"numbers",
"."
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1654-L1673 |
48,586 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | versionToSortableString | function versionToSortableString(version, maxDigitsBetweenDots) {
if (maxDigitsBetweenDots === void 0) { maxDigitsBetweenDots = 4; }
return (version || "").split(".").map(function (x) {
var length = x.length;
return (length >= maxDigitsBetweenDots)
? x : _.padStar... | javascript | function versionToSortableString(version, maxDigitsBetweenDots) {
if (maxDigitsBetweenDots === void 0) { maxDigitsBetweenDots = 4; }
return (version || "").split(".").map(function (x) {
var length = x.length;
return (length >= maxDigitsBetweenDots)
? x : _.padStar... | [
"function",
"versionToSortableString",
"(",
"version",
",",
"maxDigitsBetweenDots",
")",
"{",
"if",
"(",
"maxDigitsBetweenDots",
"===",
"void",
"0",
")",
"{",
"maxDigitsBetweenDots",
"=",
"4",
";",
"}",
"return",
"(",
"version",
"||",
"\"\"",
")",
".",
"split"... | Converts a version string with numbers and dots of the form "123.456.790" into a string
which is sortable as a string, by left padding each string between the dots to at least 4 characters
so things just sort as a string.
@param text
@return {string} the sortable version string | [
"Converts",
"a",
"version",
"string",
"with",
"numbers",
"and",
"dots",
"of",
"the",
"form",
"123",
".",
"456",
".",
"790",
"into",
"a",
"string",
"which",
"is",
"sortable",
"as",
"a",
"string",
"by",
"left",
"padding",
"each",
"string",
"between",
"the"... | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1683-L1690 |
48,587 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | compareVersionNumberArrays | function compareVersionNumberArrays(v1, v2) {
if (v1 && !v2) {
return 1;
}
if (!v1 && v2) {
return -1;
}
if (v1 === v2) {
return 0;
}
for (var i = 0; i < v1.length; i++) {
var n1 = v1[i];
if (i >= v2.leng... | javascript | function compareVersionNumberArrays(v1, v2) {
if (v1 && !v2) {
return 1;
}
if (!v1 && v2) {
return -1;
}
if (v1 === v2) {
return 0;
}
for (var i = 0; i < v1.length; i++) {
var n1 = v1[i];
if (i >= v2.leng... | [
"function",
"compareVersionNumberArrays",
"(",
"v1",
",",
"v2",
")",
"{",
"if",
"(",
"v1",
"&&",
"!",
"v2",
")",
"{",
"return",
"1",
";",
"}",
"if",
"(",
"!",
"v1",
"&&",
"v2",
")",
"{",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"v1",
"===",
"... | Compares the 2 version arrays and returns -1 if v1 is less than v2 or 0 if they are equal or 1 if v1 is greater than v2
@method compareVersionNumberArrays
@for Core
@static
@param {Array} v1 an array of version numbers with the most significant version first (major, minor, patch).
@param {Array} v2
@return {Number} | [
"Compares",
"the",
"2",
"version",
"arrays",
"and",
"returns",
"-",
"1",
"if",
"v1",
"is",
"less",
"than",
"v2",
"or",
"0",
"if",
"they",
"are",
"equal",
"or",
"1",
"if",
"v1",
"is",
"greater",
"than",
"v2"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1709-L1739 |
48,588 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | forEachLeafFolder | function forEachLeafFolder(folders, fn) {
angular.forEach(folders, function (folder) {
var children = folder["children"];
if (angular.isArray(children) && children.length > 0) {
forEachLeafFolder(children, fn);
}
else {
fn(folder);
... | javascript | function forEachLeafFolder(folders, fn) {
angular.forEach(folders, function (folder) {
var children = folder["children"];
if (angular.isArray(children) && children.length > 0) {
forEachLeafFolder(children, fn);
}
else {
fn(folder);
... | [
"function",
"forEachLeafFolder",
"(",
"folders",
",",
"fn",
")",
"{",
"angular",
".",
"forEach",
"(",
"folders",
",",
"function",
"(",
"folder",
")",
"{",
"var",
"children",
"=",
"folder",
"[",
"\"children\"",
"]",
";",
"if",
"(",
"angular",
".",
"isArra... | Invokes the given function on each leaf node in the array of folders
@method forEachLeafFolder
@for Core
@static
@param {Array[Folder]} folders
@param {Function} fn | [
"Invokes",
"the",
"given",
"function",
"on",
"each",
"leaf",
"node",
"in",
"the",
"array",
"of",
"folders"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1888-L1898 |
48,589 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | parseUrl | function parseUrl(url) {
if (Core.isBlank(url)) {
return null;
}
var matches = url.match(httpRegex);
if (matches === null) {
return null;
}
//log.debug("matches: ", matches);
var scheme = matches[1];
var host = matches[3];
v... | javascript | function parseUrl(url) {
if (Core.isBlank(url)) {
return null;
}
var matches = url.match(httpRegex);
if (matches === null) {
return null;
}
//log.debug("matches: ", matches);
var scheme = matches[1];
var host = matches[3];
v... | [
"function",
"parseUrl",
"(",
"url",
")",
"{",
"if",
"(",
"Core",
".",
"isBlank",
"(",
"url",
")",
")",
"{",
"return",
"null",
";",
"}",
"var",
"matches",
"=",
"url",
".",
"match",
"(",
"httpRegex",
")",
";",
"if",
"(",
"matches",
"===",
"null",
"... | Breaks a URL up into a nice object
@method parseUrl
@for Core
@static
@param url
@returns object | [
"Breaks",
"a",
"URL",
"up",
"into",
"a",
"nice",
"object"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1924-L1956 |
48,590 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | useProxyIfExternal | function useProxyIfExternal(connectUrl) {
if (Core.isChromeApp()) {
return connectUrl;
}
var host = window.location.host;
if (!_.startsWith(connectUrl, "http://" + host + "/") && !_.startsWith(connectUrl, "https://" + host + "/")) {
// lets remove the http stuff
... | javascript | function useProxyIfExternal(connectUrl) {
if (Core.isChromeApp()) {
return connectUrl;
}
var host = window.location.host;
if (!_.startsWith(connectUrl, "http://" + host + "/") && !_.startsWith(connectUrl, "https://" + host + "/")) {
// lets remove the http stuff
... | [
"function",
"useProxyIfExternal",
"(",
"connectUrl",
")",
"{",
"if",
"(",
"Core",
".",
"isChromeApp",
"(",
")",
")",
"{",
"return",
"connectUrl",
";",
"}",
"var",
"host",
"=",
"window",
".",
"location",
".",
"host",
";",
"if",
"(",
"!",
"_",
".",
"st... | If a URL is external to the current web application, then
replace the URL with the proxy servlet URL
@method useProxyIfExternal
@for Core
@static
@param {String} connectUrl
@return {String} | [
"If",
"a",
"URL",
"is",
"external",
"to",
"the",
"current",
"web",
"application",
"then",
"replace",
"the",
"URL",
"with",
"the",
"proxy",
"servlet",
"URL"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1972-L1990 |
48,591 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | throttled | function throttled(fn, millis) {
var nextInvokeTime = 0;
var lastAnswer = null;
return function () {
var now = Date.now();
if (nextInvokeTime < now) {
nextInvokeTime = now + millis;
lastAnswer = fn();
}
else {
... | javascript | function throttled(fn, millis) {
var nextInvokeTime = 0;
var lastAnswer = null;
return function () {
var now = Date.now();
if (nextInvokeTime < now) {
nextInvokeTime = now + millis;
lastAnswer = fn();
}
else {
... | [
"function",
"throttled",
"(",
"fn",
",",
"millis",
")",
"{",
"var",
"nextInvokeTime",
"=",
"0",
";",
"var",
"lastAnswer",
"=",
"null",
";",
"return",
"function",
"(",
")",
"{",
"var",
"now",
"=",
"Date",
".",
"now",
"(",
")",
";",
"if",
"(",
"nextI... | Returns a new function which ensures that the delegate function is only invoked at most once
within the given number of millseconds
@method throttled
@for Core
@static
@param {Function} fn the function to be invoked at most once within the given number of millis
@param {Number} millis the time window during which this ... | [
"Returns",
"a",
"new",
"function",
"which",
"ensures",
"that",
"the",
"delegate",
"function",
"is",
"only",
"invoked",
"at",
"most",
"once",
"within",
"the",
"given",
"number",
"of",
"millseconds"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2081-L2095 |
48,592 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | parseJsonText | function parseJsonText(text, message) {
if (message === void 0) { message = "JSON"; }
var answer = null;
try {
answer = angular.fromJson(text);
}
catch (e) {
log.info("Failed to parse " + message + " from: " + text + ". " + e);
}
return ans... | javascript | function parseJsonText(text, message) {
if (message === void 0) { message = "JSON"; }
var answer = null;
try {
answer = angular.fromJson(text);
}
catch (e) {
log.info("Failed to parse " + message + " from: " + text + ". " + e);
}
return ans... | [
"function",
"parseJsonText",
"(",
"text",
",",
"message",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"\"JSON\"",
";",
"}",
"var",
"answer",
"=",
"null",
";",
"try",
"{",
"answer",
"=",
"angular",
".",
"fromJson",
"(... | Attempts to parse the given JSON text and returns the JSON object structure or null.
Bad JSON is logged at info level.
@param text a JSON formatted string
@param message description of the thing being parsed logged if its invalid | [
"Attempts",
"to",
"parse",
"the",
"given",
"JSON",
"text",
"and",
"returns",
"the",
"JSON",
"object",
"structure",
"or",
"null",
".",
"Bad",
"JSON",
"is",
"logged",
"at",
"info",
"level",
"."
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2104-L2114 |
48,593 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | humanizeValueHtml | function humanizeValueHtml(value) {
var formattedValue = "";
if (value === true) {
formattedValue = '<i class="icon-check"></i>';
}
else if (value === false) {
formattedValue = '<i class="icon-check-empty"></i>';
}
else {
formattedValue... | javascript | function humanizeValueHtml(value) {
var formattedValue = "";
if (value === true) {
formattedValue = '<i class="icon-check"></i>';
}
else if (value === false) {
formattedValue = '<i class="icon-check-empty"></i>';
}
else {
formattedValue... | [
"function",
"humanizeValueHtml",
"(",
"value",
")",
"{",
"var",
"formattedValue",
"=",
"\"\"",
";",
"if",
"(",
"value",
"===",
"true",
")",
"{",
"formattedValue",
"=",
"'<i class=\"icon-check\"></i>'",
";",
"}",
"else",
"if",
"(",
"value",
"===",
"false",
")... | Returns the humanized markup of the given value | [
"Returns",
"the",
"humanized",
"markup",
"of",
"the",
"given",
"value"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2119-L2131 |
48,594 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | getQueryParameterValue | function getQueryParameterValue(url, parameterName) {
var parts;
var query = (url || '').split('?');
if (query && query.length > 0) {
parts = query[1];
}
else {
parts = '';
}
var vars = parts.split('&');
for (var i = 0; i < vars.len... | javascript | function getQueryParameterValue(url, parameterName) {
var parts;
var query = (url || '').split('?');
if (query && query.length > 0) {
parts = query[1];
}
else {
parts = '';
}
var vars = parts.split('&');
for (var i = 0; i < vars.len... | [
"function",
"getQueryParameterValue",
"(",
"url",
",",
"parameterName",
")",
"{",
"var",
"parts",
";",
"var",
"query",
"=",
"(",
"url",
"||",
"''",
")",
".",
"split",
"(",
"'?'",
")",
";",
"if",
"(",
"query",
"&&",
"query",
".",
"length",
">",
"0",
... | Gets a query value from the given url
@param url url
@param parameterName the uri parameter value to get
@returns {*} | [
"Gets",
"a",
"query",
"value",
"from",
"the",
"given",
"url"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2140-L2158 |
48,595 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | humanizeMilliseconds | function humanizeMilliseconds(value) {
if (!angular.isNumber(value)) {
return "XXX";
}
var seconds = value / 1000;
var years = Math.floor(seconds / 31536000);
if (years) {
return maybePlural(years, "year");
}
var days = Math.floor((seconds ... | javascript | function humanizeMilliseconds(value) {
if (!angular.isNumber(value)) {
return "XXX";
}
var seconds = value / 1000;
var years = Math.floor(seconds / 31536000);
if (years) {
return maybePlural(years, "year");
}
var days = Math.floor((seconds ... | [
"function",
"humanizeMilliseconds",
"(",
"value",
")",
"{",
"if",
"(",
"!",
"angular",
".",
"isNumber",
"(",
"value",
")",
")",
"{",
"return",
"\"XXX\"",
";",
"}",
"var",
"seconds",
"=",
"value",
"/",
"1000",
";",
"var",
"years",
"=",
"Math",
".",
"f... | Takes a value in ms and returns a human readable
duration
@param value | [
"Takes",
"a",
"value",
"in",
"ms",
"and",
"returns",
"a",
"human",
"readable",
"duration"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2165-L2191 |
48,596 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | createControllerFunction | function createControllerFunction(_module, pluginName) {
return function (name, inlineAnnotatedConstructor) {
return _module.controller(pluginName + '.' + name, inlineAnnotatedConstructor);
};
} | javascript | function createControllerFunction(_module, pluginName) {
return function (name, inlineAnnotatedConstructor) {
return _module.controller(pluginName + '.' + name, inlineAnnotatedConstructor);
};
} | [
"function",
"createControllerFunction",
"(",
"_module",
",",
"pluginName",
")",
"{",
"return",
"function",
"(",
"name",
",",
"inlineAnnotatedConstructor",
")",
"{",
"return",
"_module",
".",
"controller",
"(",
"pluginName",
"+",
"'.'",
"+",
"name",
",",
"inlineA... | creates a nice little shortcut function that plugins can use to easily prefix controllers with the plugin name, helps avoid redundancy and typos | [
"creates",
"a",
"nice",
"little",
"shortcut",
"function",
"that",
"plugins",
"can",
"use",
"to",
"easily",
"prefix",
"controllers",
"with",
"the",
"plugin",
"name",
"helps",
"avoid",
"redundancy",
"and",
"typos"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2744-L2748 |
48,597 | hawtio/hawtio-utilities | dist/hawtio-utilities.js | parsePreferencesJson | function parsePreferencesJson(value, key) {
var answer = null;
if (angular.isDefined(value)) {
answer = Core.parseJsonText(value, "localStorage for " + key);
}
return answer;
} | javascript | function parsePreferencesJson(value, key) {
var answer = null;
if (angular.isDefined(value)) {
answer = Core.parseJsonText(value, "localStorage for " + key);
}
return answer;
} | [
"function",
"parsePreferencesJson",
"(",
"value",
",",
"key",
")",
"{",
"var",
"answer",
"=",
"null",
";",
"if",
"(",
"angular",
".",
"isDefined",
"(",
"value",
")",
")",
"{",
"answer",
"=",
"Core",
".",
"parseJsonText",
"(",
"value",
",",
"\"localStorag... | Parsers the given value as JSON if it is define | [
"Parsers",
"the",
"given",
"value",
"as",
"JSON",
"if",
"it",
"is",
"define"
] | c938a8936a0e547d61b0dfdfdc94145c280d2eeb | https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2826-L2832 |
48,598 | emreavsar/unjar-from-url | index.js | function () {
// looking for keys passed as cli arguments with urls and download-dirs
const urlsKey = "urls";
const downloadDirsKey = "download-dirs";
const destinationDir = "destination-dirs";
// keys used in the array (same as in configuration via package.json) for each item (so urls => url)
const confUrlsKey ... | javascript | function () {
// looking for keys passed as cli arguments with urls and download-dirs
const urlsKey = "urls";
const downloadDirsKey = "download-dirs";
const destinationDir = "destination-dirs";
// keys used in the array (same as in configuration via package.json) for each item (so urls => url)
const confUrlsKey ... | [
"function",
"(",
")",
"{",
"// looking for keys passed as cli arguments with urls and download-dirs",
"const",
"urlsKey",
"=",
"\"urls\"",
";",
"const",
"downloadDirsKey",
"=",
"\"download-dirs\"",
";",
"const",
"destinationDir",
"=",
"\"destination-dirs\"",
";",
"// keys use... | Finds the configuration passed by command line arguments.
CLI args are limited, thus one have to pass the following CLI arguments:
--urls = list of urls to download the jars from
--download-dirs = names of the directories to put the jars into (uncompress jar into this directory)
--destination-dirs = names of the direc... | [
"Finds",
"the",
"configuration",
"passed",
"by",
"command",
"line",
"arguments",
"."
] | 998b45d0c67a6f21a552ac6780900549d6fb0026 | https://github.com/emreavsar/unjar-from-url/blob/998b45d0c67a6f21a552ac6780900549d6fb0026/index.js#L48-L84 | |
48,599 | emreavsar/unjar-from-url | index.js | function (module) {
const configKey = 'unjar-from-url-config';
if (module == null) {
return [];
}
var highestParent;
if (module.parent != null) {
highestParent = module.parent;
} else {
highestParent = module;
}
var parentFound = false;
// iterate up to all parents, until parent is undefined => root... | javascript | function (module) {
const configKey = 'unjar-from-url-config';
if (module == null) {
return [];
}
var highestParent;
if (module.parent != null) {
highestParent = module.parent;
} else {
highestParent = module;
}
var parentFound = false;
// iterate up to all parents, until parent is undefined => root... | [
"function",
"(",
"module",
")",
"{",
"const",
"configKey",
"=",
"'unjar-from-url-config'",
";",
"if",
"(",
"module",
"==",
"null",
")",
"{",
"return",
"[",
"]",
";",
"}",
"var",
"highestParent",
";",
"if",
"(",
"module",
".",
"parent",
"!=",
"null",
")... | Searches the unjar configuration inside the highest parent's package.json. This is typically used when this module is used inside another project
which has the configuration inside the package.json of the project itself.
Returns unjar configuration as a js object.
Example for configuration:
<pre><code>
// package.jso... | [
"Searches",
"the",
"unjar",
"configuration",
"inside",
"the",
"highest",
"parent",
"s",
"package",
".",
"json",
".",
"This",
"is",
"typically",
"used",
"when",
"this",
"module",
"is",
"used",
"inside",
"another",
"project",
"which",
"has",
"the",
"configuratio... | 998b45d0c67a6f21a552ac6780900549d6fb0026 | https://github.com/emreavsar/unjar-from-url/blob/998b45d0c67a6f21a552ac6780900549d6fb0026/index.js#L109-L158 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.