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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
38,300 | crysalead-js/dom-layer | src/node/tag.js | broadcastRemove | function broadcastRemove(node) {
if (node.children) {
for (var i = 0, len = node.children.length; i < len; i++) {
if (node.children[i]) {
broadcastRemove(node.children[i]);
}
}
}
if (node.hooks && node.hooks.remove) {
node.hooks.remove(node, node.element);
}
} | javascript | function broadcastRemove(node) {
if (node.children) {
for (var i = 0, len = node.children.length; i < len; i++) {
if (node.children[i]) {
broadcastRemove(node.children[i]);
}
}
}
if (node.hooks && node.hooks.remove) {
node.hooks.remove(node, node.element);
}
} | [
"function",
"broadcastRemove",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"children",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"node",
".",
"children",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",... | Broadcasts the remove 'event'. | [
"Broadcasts",
"the",
"remove",
"event",
"."
] | 0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2 | https://github.com/crysalead-js/dom-layer/blob/0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2/src/node/tag.js#L248-L259 |
38,301 | seancheung/kuconfig | lib/string.js | $split | function $split(params) {
if (typeof params === 'string') {
return params.split(/\s+/);
}
if (
Array.isArray(params) &&
(params.length === 2 || params.length === 3) &&
typeof params[0] === 'string' &&
typeof params[1] === 'string' &&
(params[3] == null || type... | javascript | function $split(params) {
if (typeof params === 'string') {
return params.split(/\s+/);
}
if (
Array.isArray(params) &&
(params.length === 2 || params.length === 3) &&
typeof params[0] === 'string' &&
typeof params[1] === 'string' &&
(params[3] == null || type... | [
"function",
"$split",
"(",
"params",
")",
"{",
"if",
"(",
"typeof",
"params",
"===",
"'string'",
")",
"{",
"return",
"params",
".",
"split",
"(",
"/",
"\\s+",
"/",
")",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"params",
")",
"&&",
"(",
... | Split input string into an array
@param {string|[string, string]|[string, string, number]} params
@returns {number[]} | [
"Split",
"input",
"string",
"into",
"an",
"array"
] | eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead | https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/string.js#L39-L55 |
38,302 | davidfig/rendersheet | docs/code.js | triangleDraw | function triangleDraw(c, params)
{
const size = params.size
const half = params.size / 2
c.beginPath()
c.fillStyle = '#' + params.color.toString(16)
c.moveTo(half, 0)
c.lineTo(0, size)
c.lineTo(size, size)
c.closePath()
c.fill()
c.fillStyle = 'white'
c.font = '40px Arial'
... | javascript | function triangleDraw(c, params)
{
const size = params.size
const half = params.size / 2
c.beginPath()
c.fillStyle = '#' + params.color.toString(16)
c.moveTo(half, 0)
c.lineTo(0, size)
c.lineTo(size, size)
c.closePath()
c.fill()
c.fillStyle = 'white'
c.font = '40px Arial'
... | [
"function",
"triangleDraw",
"(",
"c",
",",
"params",
")",
"{",
"const",
"size",
"=",
"params",
".",
"size",
"const",
"half",
"=",
"params",
".",
"size",
"/",
"2",
"c",
".",
"beginPath",
"(",
")",
"c",
".",
"fillStyle",
"=",
"'#'",
"+",
"params",
".... | draw a triangle to the render sheet using canvas | [
"draw",
"a",
"triangle",
"to",
"the",
"render",
"sheet",
"using",
"canvas"
] | a5b42d1dfece524d36186b308b8aefbd31921bb3 | https://github.com/davidfig/rendersheet/blob/a5b42d1dfece524d36186b308b8aefbd31921bb3/docs/code.js#L85-L100 |
38,303 | vfile/vfile-find-down | index.js | visit | function visit(state, filePath, one, done) {
var file
// Don’t walk into places multiple times.
if (own.call(state.checked, filePath)) {
done([])
return
}
state.checked[filePath] = true
file = vfile(filePath)
stat(resolve(filePath), onstat)
function onstat(error, stats) {
var real = Boo... | javascript | function visit(state, filePath, one, done) {
var file
// Don’t walk into places multiple times.
if (own.call(state.checked, filePath)) {
done([])
return
}
state.checked[filePath] = true
file = vfile(filePath)
stat(resolve(filePath), onstat)
function onstat(error, stats) {
var real = Boo... | [
"function",
"visit",
"(",
"state",
",",
"filePath",
",",
"one",
",",
"done",
")",
"{",
"var",
"file",
"// Don’t walk into places multiple times.",
"if",
"(",
"own",
".",
"call",
"(",
"state",
".",
"checked",
",",
"filePath",
")",
")",
"{",
"done",
"(",
"... | Find files in `filePath`. | [
"Find",
"files",
"in",
"filePath",
"."
] | 0c589eebc1d52d40fcf833c8a3f5fae55c068c84 | https://github.com/vfile/vfile-find-down/blob/0c589eebc1d52d40fcf833c8a3f5fae55c068c84/index.js#L58-L111 |
38,304 | vfile/vfile-find-down | index.js | visitAll | function visitAll(state, paths, cwd, one, done) {
var expected = paths.length
var actual = -1
var result = []
paths.forEach(each)
next()
function each(filePath) {
visit(state, join(cwd || '', filePath), one, onvisit)
}
function onvisit(files) {
result = result.concat(files)
next()
}
... | javascript | function visitAll(state, paths, cwd, one, done) {
var expected = paths.length
var actual = -1
var result = []
paths.forEach(each)
next()
function each(filePath) {
visit(state, join(cwd || '', filePath), one, onvisit)
}
function onvisit(files) {
result = result.concat(files)
next()
}
... | [
"function",
"visitAll",
"(",
"state",
",",
"paths",
",",
"cwd",
",",
"one",
",",
"done",
")",
"{",
"var",
"expected",
"=",
"paths",
".",
"length",
"var",
"actual",
"=",
"-",
"1",
"var",
"result",
"=",
"[",
"]",
"paths",
".",
"forEach",
"(",
"each",... | Find files in `paths`. Returns a list of applicable files. | [
"Find",
"files",
"in",
"paths",
".",
"Returns",
"a",
"list",
"of",
"applicable",
"files",
"."
] | 0c589eebc1d52d40fcf833c8a3f5fae55c068c84 | https://github.com/vfile/vfile-find-down/blob/0c589eebc1d52d40fcf833c8a3f5fae55c068c84/index.js#L114-L139 |
38,305 | littlstar/stardux | src/index.js | isArrayLike | function isArrayLike (a) {
if ('object' != typeof a)
return false
else if (null == a)
return false
else
return Boolean( Array.isArray(a)
|| null != a.length
|| a[0] )
} | javascript | function isArrayLike (a) {
if ('object' != typeof a)
return false
else if (null == a)
return false
else
return Boolean( Array.isArray(a)
|| null != a.length
|| a[0] )
} | [
"function",
"isArrayLike",
"(",
"a",
")",
"{",
"if",
"(",
"'object'",
"!=",
"typeof",
"a",
")",
"return",
"false",
"else",
"if",
"(",
"null",
"==",
"a",
")",
"return",
"false",
"else",
"return",
"Boolean",
"(",
"Array",
".",
"isArray",
"(",
"a",
")",... | Detects if input is "like" an array.
@private
@param {Mixed} a
@return {Boolean} | [
"Detects",
"if",
"input",
"is",
"like",
"an",
"array",
"."
] | 88c4bd05e2c2755636590927e102e1303acb0038 | https://github.com/littlstar/stardux/blob/88c4bd05e2c2755636590927e102e1303acb0038/src/index.js#L79-L88 |
38,306 | littlstar/stardux | src/index.js | mkdux | function mkdux (node, data = {}) {
if (node instanceof Container)
node = node.domElement
node[STARDUX_PRIVATE_ATTR] = ( node[STARDUX_PRIVATE_ATTR] || data )
return node[STARDUX_PRIVATE_ATTR]
} | javascript | function mkdux (node, data = {}) {
if (node instanceof Container)
node = node.domElement
node[STARDUX_PRIVATE_ATTR] = ( node[STARDUX_PRIVATE_ATTR] || data )
return node[STARDUX_PRIVATE_ATTR]
} | [
"function",
"mkdux",
"(",
"node",
",",
"data",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"node",
"instanceof",
"Container",
")",
"node",
"=",
"node",
".",
"domElement",
"node",
"[",
"STARDUX_PRIVATE_ATTR",
"]",
"=",
"(",
"node",
"[",
"STARDUX_PRIVATE_ATTR",
"]... | Make stardux data object on a
node if not already there.
@private
@param {Object} node
@param {Object} [data = {}]
@return {Object} | [
"Make",
"stardux",
"data",
"object",
"on",
"a",
"node",
"if",
"not",
"already",
"there",
"."
] | 88c4bd05e2c2755636590927e102e1303acb0038 | https://github.com/littlstar/stardux/blob/88c4bd05e2c2755636590927e102e1303acb0038/src/index.js#L100-L105 |
38,307 | littlstar/stardux | src/index.js | rmdux | function rmdux (node) {
if (null == node) return
if (node instanceof Container)
node = node.domElement
delete node[STARDUX_PRIVATE_ATTR]
} | javascript | function rmdux (node) {
if (null == node) return
if (node instanceof Container)
node = node.domElement
delete node[STARDUX_PRIVATE_ATTR]
} | [
"function",
"rmdux",
"(",
"node",
")",
"{",
"if",
"(",
"null",
"==",
"node",
")",
"return",
"if",
"(",
"node",
"instanceof",
"Container",
")",
"node",
"=",
"node",
".",
"domElement",
"delete",
"node",
"[",
"STARDUX_PRIVATE_ATTR",
"]",
"}"
] | Remove stardux data object.
@private
@param {Object} node | [
"Remove",
"stardux",
"data",
"object",
"."
] | 88c4bd05e2c2755636590927e102e1303acb0038 | https://github.com/littlstar/stardux/blob/88c4bd05e2c2755636590927e102e1303acb0038/src/index.js#L114-L119 |
38,308 | littlstar/stardux | src/index.js | getTokens | function getTokens (string) {
let tokens = null
try { tokens = esprima.tokenize('`'+ string +'`') }
catch (e) { tokens = [] }
return tokens
} | javascript | function getTokens (string) {
let tokens = null
try { tokens = esprima.tokenize('`'+ string +'`') }
catch (e) { tokens = [] }
return tokens
} | [
"function",
"getTokens",
"(",
"string",
")",
"{",
"let",
"tokens",
"=",
"null",
"try",
"{",
"tokens",
"=",
"esprima",
".",
"tokenize",
"(",
"'`'",
"+",
"string",
"+",
"'`'",
")",
"}",
"catch",
"(",
"e",
")",
"{",
"tokens",
"=",
"[",
"]",
"}",
"re... | Returns an array of known tokens
in a javascript string.
@private
@param {String} string
@return {Array} | [
"Returns",
"an",
"array",
"of",
"known",
"tokens",
"in",
"a",
"javascript",
"string",
"."
] | 88c4bd05e2c2755636590927e102e1303acb0038 | https://github.com/littlstar/stardux/blob/88c4bd05e2c2755636590927e102e1303acb0038/src/index.js#L130-L135 |
38,309 | littlstar/stardux | src/index.js | getIdentifiersFromTokens | function getIdentifiersFromTokens (tokens) {
const identifiers = {}
/**
* Predicate to determine if token is an identifier.
*
* @private
* @param {Object} token
* @return {Boolean}
*/
const isIdentifier = token => 'Identifier' == token.type
/**
* Mark token as a function identifier.
*... | javascript | function getIdentifiersFromTokens (tokens) {
const identifiers = {}
/**
* Predicate to determine if token is an identifier.
*
* @private
* @param {Object} token
* @return {Boolean}
*/
const isIdentifier = token => 'Identifier' == token.type
/**
* Mark token as a function identifier.
*... | [
"function",
"getIdentifiersFromTokens",
"(",
"tokens",
")",
"{",
"const",
"identifiers",
"=",
"{",
"}",
"/**\n * Predicate to determine if token is an identifier.\n *\n * @private\n * @param {Object} token\n * @return {Boolean}\n */",
"const",
"isIdentifier",
"=",
"token",
... | Returns an object of identifiers with
empty string or NO-OP function
values.
@private
@param {Array} tokens
@return {Object} | [
"Returns",
"an",
"object",
"of",
"identifiers",
"with",
"empty",
"string",
"or",
"NO",
"-",
"OP",
"function",
"values",
"."
] | 88c4bd05e2c2755636590927e102e1303acb0038 | https://github.com/littlstar/stardux/blob/88c4bd05e2c2755636590927e102e1303acb0038/src/index.js#L147-L224 |
38,310 | littlstar/stardux | src/index.js | ensureDOMElement | function ensureDOMElement (input) {
let domElement = null
let tmp = null
if (input instanceof Element) {
return input
} else if ('string' == typeof input) {
tmp = document.createElement('div')
tmp.innerHTML = input
domElement = tmp.innerHTML.length ? tmp.children[0] : new Template(input)
} els... | javascript | function ensureDOMElement (input) {
let domElement = null
let tmp = null
if (input instanceof Element) {
return input
} else if ('string' == typeof input) {
tmp = document.createElement('div')
tmp.innerHTML = input
domElement = tmp.innerHTML.length ? tmp.children[0] : new Template(input)
} els... | [
"function",
"ensureDOMElement",
"(",
"input",
")",
"{",
"let",
"domElement",
"=",
"null",
"let",
"tmp",
"=",
"null",
"if",
"(",
"input",
"instanceof",
"Element",
")",
"{",
"return",
"input",
"}",
"else",
"if",
"(",
"'string'",
"==",
"typeof",
"input",
")... | Ensure DOM element.
@private
@param {Mixed} input
@return {Element} | [
"Ensure",
"DOM",
"element",
"."
] | 88c4bd05e2c2755636590927e102e1303acb0038 | https://github.com/littlstar/stardux/blob/88c4bd05e2c2755636590927e102e1303acb0038/src/index.js#L247-L260 |
38,311 | littlstar/stardux | src/index.js | getTemplateFromDomElement | function getTemplateFromDomElement (domElement) {
let data = {}
let src = null
if (domElement && domElement[STARDUX_PRIVATE_ATTR])
data = mkdux(domElement)
if ('string' == typeof domElement)
src = domElement
else if (data.src)
src = data.src
else if (domElement.children && 0 == domElement.chil... | javascript | function getTemplateFromDomElement (domElement) {
let data = {}
let src = null
if (domElement && domElement[STARDUX_PRIVATE_ATTR])
data = mkdux(domElement)
if ('string' == typeof domElement)
src = domElement
else if (data.src)
src = data.src
else if (domElement.children && 0 == domElement.chil... | [
"function",
"getTemplateFromDomElement",
"(",
"domElement",
")",
"{",
"let",
"data",
"=",
"{",
"}",
"let",
"src",
"=",
"null",
"if",
"(",
"domElement",
"&&",
"domElement",
"[",
"STARDUX_PRIVATE_ATTR",
"]",
")",
"data",
"=",
"mkdux",
"(",
"domElement",
")",
... | Returns a template tring from a given
DOM Element. If the DOM Element given is a
string then it is simply returned.
@public
@param {Element|String} domElement
@return {String} | [
"Returns",
"a",
"template",
"tring",
"from",
"a",
"given",
"DOM",
"Element",
".",
"If",
"the",
"DOM",
"Element",
"given",
"is",
"a",
"string",
"then",
"it",
"is",
"simply",
"returned",
"."
] | 88c4bd05e2c2755636590927e102e1303acb0038 | https://github.com/littlstar/stardux/blob/88c4bd05e2c2755636590927e102e1303acb0038/src/index.js#L272-L293 |
38,312 | littlstar/stardux | src/index.js | createRootReducer | function createRootReducer (container, ...reducers) {
return (state = {}, action = {}) => {
const identifiers = ensureContainerStateIdentifiers(container)
const domElement = container[$domElement]
const template = getTemplateFromDomElement(domElement)
const middleware = container[$middleware].entries(... | javascript | function createRootReducer (container, ...reducers) {
return (state = {}, action = {}) => {
const identifiers = ensureContainerStateIdentifiers(container)
const domElement = container[$domElement]
const template = getTemplateFromDomElement(domElement)
const middleware = container[$middleware].entries(... | [
"function",
"createRootReducer",
"(",
"container",
",",
"...",
"reducers",
")",
"{",
"return",
"(",
"state",
"=",
"{",
"}",
",",
"action",
"=",
"{",
"}",
")",
"=>",
"{",
"const",
"identifiers",
"=",
"ensureContainerStateIdentifiers",
"(",
"container",
")",
... | Creates a root reducer for a Container
instance.
@private
@param {Container} container
@return {Function} | [
"Creates",
"a",
"root",
"reducer",
"for",
"a",
"Container",
"instance",
"."
] | 88c4bd05e2c2755636590927e102e1303acb0038 | https://github.com/littlstar/stardux/blob/88c4bd05e2c2755636590927e102e1303acb0038/src/index.js#L334-L401 |
38,313 | littlstar/stardux | src/index.js | createPipeReducer | function createPipeReducer (container) {
return (state, action = {data: {}}) => {
const pipes = container[$pipes].entries()
reduce()
return state
/**
* Loops over each pipe function
* providing state and action values
* given to use from redux.
*
* @private
*/
funct... | javascript | function createPipeReducer (container) {
return (state, action = {data: {}}) => {
const pipes = container[$pipes].entries()
reduce()
return state
/**
* Loops over each pipe function
* providing state and action values
* given to use from redux.
*
* @private
*/
funct... | [
"function",
"createPipeReducer",
"(",
"container",
")",
"{",
"return",
"(",
"state",
",",
"action",
"=",
"{",
"data",
":",
"{",
"}",
"}",
")",
"=>",
"{",
"const",
"pipes",
"=",
"container",
"[",
"$pipes",
"]",
".",
"entries",
"(",
")",
"reduce",
"(",... | Creates a pipe reducer for a Container
instance.
@private
@param {Container} container
@return {Function} | [
"Creates",
"a",
"pipe",
"reducer",
"for",
"a",
"Container",
"instance",
"."
] | 88c4bd05e2c2755636590927e102e1303acb0038 | https://github.com/littlstar/stardux/blob/88c4bd05e2c2755636590927e102e1303acb0038/src/index.js#L412-L435 |
38,314 | littlstar/stardux | src/index.js | reduce | function reduce () {
const step = pipes.next()
const done = step.done
const pipe = step.value ? step.value[1] : null
if (done) return
else if (false === pipe(state, action)) return
else return reduce()
} | javascript | function reduce () {
const step = pipes.next()
const done = step.done
const pipe = step.value ? step.value[1] : null
if (done) return
else if (false === pipe(state, action)) return
else return reduce()
} | [
"function",
"reduce",
"(",
")",
"{",
"const",
"step",
"=",
"pipes",
".",
"next",
"(",
")",
"const",
"done",
"=",
"step",
".",
"done",
"const",
"pipe",
"=",
"step",
".",
"value",
"?",
"step",
".",
"value",
"[",
"1",
"]",
":",
"null",
"if",
"(",
... | Loops over each pipe function
providing state and action values
given to use from redux.
@private | [
"Loops",
"over",
"each",
"pipe",
"function",
"providing",
"state",
"and",
"action",
"values",
"given",
"to",
"use",
"from",
"redux",
"."
] | 88c4bd05e2c2755636590927e102e1303acb0038 | https://github.com/littlstar/stardux/blob/88c4bd05e2c2755636590927e102e1303acb0038/src/index.js#L426-L433 |
38,315 | littlstar/stardux | src/index.js | orphanContainerChildren | function orphanContainerChildren (container, rouge = false) {
container = fetchContainer(container)
const children = container.children
if (null == container)
throw new TypeError( "orphanContainerChildren() Expecting a container " )
for (let child of children) {
container.removeChild(child)
if (t... | javascript | function orphanContainerChildren (container, rouge = false) {
container = fetchContainer(container)
const children = container.children
if (null == container)
throw new TypeError( "orphanContainerChildren() Expecting a container " )
for (let child of children) {
container.removeChild(child)
if (t... | [
"function",
"orphanContainerChildren",
"(",
"container",
",",
"rouge",
"=",
"false",
")",
"{",
"container",
"=",
"fetchContainer",
"(",
"container",
")",
"const",
"children",
"=",
"container",
".",
"children",
"if",
"(",
"null",
"==",
"container",
")",
"throw"... | Orphan container.
@private
@param {Container} container
@param {Boolean} [rouge] | [
"Orphan",
"container",
"."
] | 88c4bd05e2c2755636590927e102e1303acb0038 | https://github.com/littlstar/stardux/blob/88c4bd05e2c2755636590927e102e1303acb0038/src/index.js#L445-L460 |
38,316 | egoist/jue | packages/babel-plugin-transform-jue-jsx/src/index.js | buildOpeningElementAttributes | function buildOpeningElementAttributes(attribs, file) {
let _props = []
let objs = []
function pushProps() {
if (_props.length === 0) return
objs.push(t.objectExpression(_props))
_props = []
}
while (attribs.length) {
const prop = attribs.shift()
if (t.isJSXSpreadAttr... | javascript | function buildOpeningElementAttributes(attribs, file) {
let _props = []
let objs = []
function pushProps() {
if (_props.length === 0) return
objs.push(t.objectExpression(_props))
_props = []
}
while (attribs.length) {
const prop = attribs.shift()
if (t.isJSXSpreadAttr... | [
"function",
"buildOpeningElementAttributes",
"(",
"attribs",
",",
"file",
")",
"{",
"let",
"_props",
"=",
"[",
"]",
"let",
"objs",
"=",
"[",
"]",
"function",
"pushProps",
"(",
")",
"{",
"if",
"(",
"_props",
".",
"length",
"===",
"0",
")",
"return",
"ob... | The logic for this is quite terse. It's because we need to
support spread elements. We loop over all attributes,
breaking on spreads, we then push a new object containing
all prior attributes to an array for later processing. | [
"The",
"logic",
"for",
"this",
"is",
"quite",
"terse",
".",
"It",
"s",
"because",
"we",
"need",
"to",
"support",
"spread",
"elements",
".",
"We",
"loop",
"over",
"all",
"attributes",
"breaking",
"on",
"spreads",
"we",
"then",
"push",
"a",
"new",
"object"... | 6ff8ccd3e3d27fcb0dba00411cd03a737be5bf13 | https://github.com/egoist/jue/blob/6ff8ccd3e3d27fcb0dba00411cd03a737be5bf13/packages/babel-plugin-transform-jue-jsx/src/index.js#L145-L185 |
38,317 | node-modules/antpb | lib/decoder.js | decoder | function decoder(mtype) {
const gen = util.codegen([ 'r', 'l' ], mtype.name + '$decode')('if(!(r instanceof Reader))')('r=Reader.create(r)')('var c=l===undefined?r.len:r.pos+l,m=new this.ctor' + (mtype.fieldsArray.filter(field => field.map).length ? ',k' : ''))('while(r.pos<c){')('var t=r.uint32()');
if (mtype.gro... | javascript | function decoder(mtype) {
const gen = util.codegen([ 'r', 'l' ], mtype.name + '$decode')('if(!(r instanceof Reader))')('r=Reader.create(r)')('var c=l===undefined?r.len:r.pos+l,m=new this.ctor' + (mtype.fieldsArray.filter(field => field.map).length ? ',k' : ''))('while(r.pos<c){')('var t=r.uint32()');
if (mtype.gro... | [
"function",
"decoder",
"(",
"mtype",
")",
"{",
"const",
"gen",
"=",
"util",
".",
"codegen",
"(",
"[",
"'r'",
",",
"'l'",
"]",
",",
"mtype",
".",
"name",
"+",
"'$decode'",
")",
"(",
"'if(!(r instanceof Reader))'",
")",
"(",
"'r=Reader.create(r)'",
")",
"(... | Generates a decoder specific to the specified message type.
@param {Type} mtype Message type
@return {Codegen} Codegen instance | [
"Generates",
"a",
"decoder",
"specific",
"to",
"the",
"specified",
"message",
"type",
"."
] | e6d74d4c372151fcb3880eb44a4e85907d99405c | https://github.com/node-modules/antpb/blob/e6d74d4c372151fcb3880eb44a4e85907d99405c/lib/decoder.js#L16-L82 |
38,318 | crysalead-js/dom-layer | src/node/patcher/select-value.js | populateOptions | function populateOptions(node, values) {
if (node.tagName !== 'option') {
for (var i = 0, len = node.children.length; i < len ; i++) {
populateOptions(node.children[i], values);
}
return;
}
var value = node.attrs && node.attrs.value;
value = value || node.props && node.props.value;
if (!val... | javascript | function populateOptions(node, values) {
if (node.tagName !== 'option') {
for (var i = 0, len = node.children.length; i < len ; i++) {
populateOptions(node.children[i], values);
}
return;
}
var value = node.attrs && node.attrs.value;
value = value || node.props && node.props.value;
if (!val... | [
"function",
"populateOptions",
"(",
"node",
",",
"values",
")",
"{",
"if",
"(",
"node",
".",
"tagName",
"!==",
"'option'",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"node",
".",
"children",
".",
"length",
";",
"i",
"<",
"len",
... | Populates values to options node.
@param Object node A starting node (generaly a select node).
@param Object values The selected values to populate. | [
"Populates",
"values",
"to",
"options",
"node",
"."
] | 0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2 | https://github.com/crysalead-js/dom-layer/blob/0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2/src/node/patcher/select-value.js#L43-L60 |
38,319 | MarcDiethelm/xtc | lib/utils.js | function(sInput, levels, indentString) {
var indentedLineBreak;
indentString = indentString || '\t';
indentedLineBreak = '\n'+ ( new Array( levels + 1 ).join( indentString ) );
return indentedLineBreak + sInput.split('\n').join(indentedLineBreak);
} | javascript | function(sInput, levels, indentString) {
var indentedLineBreak;
indentString = indentString || '\t';
indentedLineBreak = '\n'+ ( new Array( levels + 1 ).join( indentString ) );
return indentedLineBreak + sInput.split('\n').join(indentedLineBreak);
} | [
"function",
"(",
"sInput",
",",
"levels",
",",
"indentString",
")",
"{",
"var",
"indentedLineBreak",
";",
"indentString",
"=",
"indentString",
"||",
"'\\t'",
";",
"indentedLineBreak",
"=",
"'\\n'",
"+",
"(",
"new",
"Array",
"(",
"levels",
"+",
"1",
")",
".... | Add indentation to a multi-line string
@param {string} sInput
@param {number} levels – How many levels of indentation to apply
@param {string} [indentString] – Character to use for indentation, defaults to tab char.
@returns {string} | [
"Add",
"indentation",
"to",
"a",
"multi",
"-",
"line",
"string"
] | dd422136b27ca52b17255d4e8778ca30a70e987b | https://github.com/MarcDiethelm/xtc/blob/dd422136b27ca52b17255d4e8778ca30a70e987b/lib/utils.js#L41-L48 | |
38,320 | MarcDiethelm/xtc | lib/utils.js | function(baseUri, branch, filePath, fileName) {
var varPath = fileName ? 'blob/' : 'tree/'
,branch = branch ? branch + '/' : 'develop'
,filePath = path.relative(process.cwd(), filePath) + '/'
;
fileName = fileName || '';
return baseUri ? baseUri + varPath + branch + filePath + fileName : null;
} | javascript | function(baseUri, branch, filePath, fileName) {
var varPath = fileName ? 'blob/' : 'tree/'
,branch = branch ? branch + '/' : 'develop'
,filePath = path.relative(process.cwd(), filePath) + '/'
;
fileName = fileName || '';
return baseUri ? baseUri + varPath + branch + filePath + fileName : null;
} | [
"function",
"(",
"baseUri",
",",
"branch",
",",
"filePath",
",",
"fileName",
")",
"{",
"var",
"varPath",
"=",
"fileName",
"?",
"'blob/'",
":",
"'tree/'",
",",
"branch",
"=",
"branch",
"?",
"branch",
"+",
"'/'",
":",
"'develop'",
",",
"filePath",
"=",
"... | Construct an URI to the web view of the file or directory in a repository
@param {string} baseUri – e.g. 'https://github.com/MarcDiethelm/xtc'
@param {string} branch
@param {string} filePath
@param {string} [fileName]
@returns {string} – URI to the web view of the file or directory in the repository | [
"Construct",
"an",
"URI",
"to",
"the",
"web",
"view",
"of",
"the",
"file",
"or",
"directory",
"in",
"a",
"repository"
] | dd422136b27ca52b17255d4e8778ca30a70e987b | https://github.com/MarcDiethelm/xtc/blob/dd422136b27ca52b17255d4e8778ca30a70e987b/lib/utils.js#L58-L67 | |
38,321 | bryanjhv/express-readme | lib/convert.js | register | function register(types, converter) {
types.split(' ').forEach(function (type) {
converters[type] = converter;
});
} | javascript | function register(types, converter) {
types.split(' ').forEach(function (type) {
converters[type] = converter;
});
} | [
"function",
"register",
"(",
"types",
",",
"converter",
")",
"{",
"types",
".",
"split",
"(",
"' '",
")",
".",
"forEach",
"(",
"function",
"(",
"type",
")",
"{",
"converters",
"[",
"type",
"]",
"=",
"converter",
";",
"}",
")",
";",
"}"
] | Register a converter.
Takes a string, splits by spaces (in case a given markup can
have multiple extensions), and maps the method in the available
converters list.
@param {string} types - The markup types (extensions).
@param {function(string, object)} converter - Markup converter. | [
"Register",
"a",
"converter",
"."
] | 5c3755b8f642a8550ac259e9c74cc2cb89d946c8 | https://github.com/bryanjhv/express-readme/blob/5c3755b8f642a8550ac259e9c74cc2cb89d946c8/lib/convert.js#L45-L49 |
38,322 | sirap-group/connect-sequence | lib/ConnectSequence.js | run | function run () {
var midSequence = this.middlewares.reverse()
var initialNext = this.next.bind()
var req = this.req
var res = this.res
var nestedCallSequence
// create the call sequence
nestedCallSequence = midSequence.reduce(middlewareReducer, initialNext)
// call it
nestedCallSequence.call()
/*... | javascript | function run () {
var midSequence = this.middlewares.reverse()
var initialNext = this.next.bind()
var req = this.req
var res = this.res
var nestedCallSequence
// create the call sequence
nestedCallSequence = midSequence.reduce(middlewareReducer, initialNext)
// call it
nestedCallSequence.call()
/*... | [
"function",
"run",
"(",
")",
"{",
"var",
"midSequence",
"=",
"this",
".",
"middlewares",
".",
"reverse",
"(",
")",
"var",
"initialNext",
"=",
"this",
".",
"next",
".",
"bind",
"(",
")",
"var",
"req",
"=",
"this",
".",
"req",
"var",
"res",
"=",
"thi... | Run sequencially each appended middleware, using the next argument as the final callback.
@method
@memberof ConnectSequence.prototype
@returns {undefined} | [
"Run",
"sequencially",
"each",
"appended",
"middleware",
"using",
"the",
"next",
"argument",
"as",
"the",
"final",
"callback",
"."
] | 8b0490d75596107b7c37e2c2cfa4d0486f3eda1a | https://github.com/sirap-group/connect-sequence/blob/8b0490d75596107b7c37e2c2cfa4d0486f3eda1a/lib/ConnectSequence.js#L57-L101 |
38,323 | sirap-group/connect-sequence | lib/ConnectSequence.js | middlewareReducer | function middlewareReducer (callSequence, middleware) {
return function nextHandler (err) {
// if the previous middleware passed an error argument
if (err !== undefined) {
if (isErrorHandler(middleware)) {
// call the current middleware if it is an error handler middleware
mi... | javascript | function middlewareReducer (callSequence, middleware) {
return function nextHandler (err) {
// if the previous middleware passed an error argument
if (err !== undefined) {
if (isErrorHandler(middleware)) {
// call the current middleware if it is an error handler middleware
mi... | [
"function",
"middlewareReducer",
"(",
"callSequence",
",",
"middleware",
")",
"{",
"return",
"function",
"nextHandler",
"(",
"err",
")",
"{",
"// if the previous middleware passed an error argument",
"if",
"(",
"err",
"!==",
"undefined",
")",
"{",
"if",
"(",
"isErro... | Reduce the middleware sequence to a nested middleware handler sequence
@function
@inner
@private
@param {Function} callSequence intermediate resulting call sequence
@param {Function} middleware the current middleware
@returns {Function} the new intermediate resulting call sequence | [
"Reduce",
"the",
"middleware",
"sequence",
"to",
"a",
"nested",
"middleware",
"handler",
"sequence"
] | 8b0490d75596107b7c37e2c2cfa4d0486f3eda1a | https://github.com/sirap-group/connect-sequence/blob/8b0490d75596107b7c37e2c2cfa4d0486f3eda1a/lib/ConnectSequence.js#L78-L100 |
38,324 | sirap-group/connect-sequence | lib/ConnectSequence.js | append | function append (/* mid_0, ..., mid_n */) {
var i
for (i = 0; i < arguments.length; i++) {
if (typeof arguments[i] !== 'function') {
var type = typeof arguments[i]
var errMsg = 'Given middlewares must be functions. "' + type + '" given.'
throw new TypeError(errMsg)
}
}
for (i = 0; i < ... | javascript | function append (/* mid_0, ..., mid_n */) {
var i
for (i = 0; i < arguments.length; i++) {
if (typeof arguments[i] !== 'function') {
var type = typeof arguments[i]
var errMsg = 'Given middlewares must be functions. "' + type + '" given.'
throw new TypeError(errMsg)
}
}
for (i = 0; i < ... | [
"function",
"append",
"(",
"/* mid_0, ..., mid_n */",
")",
"{",
"var",
"i",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"typeof",
"arguments",
"[",
"i",
"]",
"!==",
"'function'",
")",
"... | Append an arbitrary number of middlewares as an argument list
@method
@memberof ConnectSequence.prototype
@param {...Function} middlewares A list of middleware functions (or errorHandler middlewares)
@returns {ConnectSequence} a reference to the instance to be chainable
@throws TypeError if one of the given middlewares... | [
"Append",
"an",
"arbitrary",
"number",
"of",
"middlewares",
"as",
"an",
"argument",
"list"
] | 8b0490d75596107b7c37e2c2cfa4d0486f3eda1a | https://github.com/sirap-group/connect-sequence/blob/8b0490d75596107b7c37e2c2cfa4d0486f3eda1a/lib/ConnectSequence.js#L111-L124 |
38,325 | sirap-group/connect-sequence | lib/ConnectSequence.js | appendList | function appendList (middlewares) {
if (!Array.isArray(middlewares)) {
var errorMsg = 'First argument must be an array of middlewares. '
errorMsg += typeof middlewares + ' given.'
throw new TypeError(errorMsg)
}
return this.append.apply(this, middlewares)
} | javascript | function appendList (middlewares) {
if (!Array.isArray(middlewares)) {
var errorMsg = 'First argument must be an array of middlewares. '
errorMsg += typeof middlewares + ' given.'
throw new TypeError(errorMsg)
}
return this.append.apply(this, middlewares)
} | [
"function",
"appendList",
"(",
"middlewares",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"middlewares",
")",
")",
"{",
"var",
"errorMsg",
"=",
"'First argument must be an array of middlewares. '",
"errorMsg",
"+=",
"typeof",
"middlewares",
"+",
"' giv... | Append an arbitrary number of middlewares as an array
@method
@memberof ConnectSequence.prototype
@param {Array<Function>} middlewares An array of middleware functions (or errorHandler middlewares)
@returns {ConnectSequence} a reference to the instance to be chainable | [
"Append",
"an",
"arbitrary",
"number",
"of",
"middlewares",
"as",
"an",
"array"
] | 8b0490d75596107b7c37e2c2cfa4d0486f3eda1a | https://github.com/sirap-group/connect-sequence/blob/8b0490d75596107b7c37e2c2cfa4d0486f3eda1a/lib/ConnectSequence.js#L133-L140 |
38,326 | sirap-group/connect-sequence | lib/ConnectSequence.js | appendIf | function appendIf (filter /*, middlewares */) {
var errorMsg
var middlewares = []
if (arguments.length < 2) {
errorMsg = 'ConnectSequence#appendIf() takes 2 arguments. '
errorMsg += arguments.length + ' given.'
throw new MissingArgumentError(errorMsg)
}
if (typeof filter !== 'function') {
err... | javascript | function appendIf (filter /*, middlewares */) {
var errorMsg
var middlewares = []
if (arguments.length < 2) {
errorMsg = 'ConnectSequence#appendIf() takes 2 arguments. '
errorMsg += arguments.length + ' given.'
throw new MissingArgumentError(errorMsg)
}
if (typeof filter !== 'function') {
err... | [
"function",
"appendIf",
"(",
"filter",
"/*, middlewares */",
")",
"{",
"var",
"errorMsg",
"var",
"middlewares",
"=",
"[",
"]",
"if",
"(",
"arguments",
".",
"length",
"<",
"2",
")",
"{",
"errorMsg",
"=",
"'ConnectSequence#appendIf() takes 2 arguments. '",
"errorMsg... | Append an arbitrary number of middlewares as an argument list if the filter pass at runtime of the first middleware in the given list
@method
@memberof ConnectSequence.prototype
@param {Function} filter A filter function (returning a Boolean)
@param {...Function} middlewares A list of middleware functions (or errorHand... | [
"Append",
"an",
"arbitrary",
"number",
"of",
"middlewares",
"as",
"an",
"argument",
"list",
"if",
"the",
"filter",
"pass",
"at",
"runtime",
"of",
"the",
"first",
"middleware",
"in",
"the",
"given",
"list"
] | 8b0490d75596107b7c37e2c2cfa4d0486f3eda1a | https://github.com/sirap-group/connect-sequence/blob/8b0490d75596107b7c37e2c2cfa4d0486f3eda1a/lib/ConnectSequence.js#L150-L203 |
38,327 | sirap-group/connect-sequence | lib/ConnectSequence.js | appendListIf | function appendListIf (filter, middlewares) {
var args = [filter]
for (var i = 0; i < middlewares.length; i++) {
args.push(middlewares[i])
}
return this.appendIf.apply(this, args)
} | javascript | function appendListIf (filter, middlewares) {
var args = [filter]
for (var i = 0; i < middlewares.length; i++) {
args.push(middlewares[i])
}
return this.appendIf.apply(this, args)
} | [
"function",
"appendListIf",
"(",
"filter",
",",
"middlewares",
")",
"{",
"var",
"args",
"=",
"[",
"filter",
"]",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"middlewares",
".",
"length",
";",
"i",
"++",
")",
"{",
"args",
".",
"push",
"(",
"m... | A middleware filter function run at the middleware runtime, causing the middleware or middleware list should be ran or skiped
@callback middlewareFilter
@param {IncomingMessage} req The express request object
@returns {Boolean}
Append an arbitrary number of middlewares as an array if the filter pass at runtime of the... | [
"A",
"middleware",
"filter",
"function",
"run",
"at",
"the",
"middleware",
"runtime",
"causing",
"the",
"middleware",
"or",
"middleware",
"list",
"should",
"be",
"ran",
"or",
"skiped"
] | 8b0490d75596107b7c37e2c2cfa4d0486f3eda1a | https://github.com/sirap-group/connect-sequence/blob/8b0490d75596107b7c37e2c2cfa4d0486f3eda1a/lib/ConnectSequence.js#L220-L226 |
38,328 | sirap-group/connect-sequence | lib/ConnectSequence.js | isErrorHandler | function isErrorHandler (cb) {
var str = cb.toString()
var args = str.split('(')[1].split(')')[0].split(',')
return args.length === 4
} | javascript | function isErrorHandler (cb) {
var str = cb.toString()
var args = str.split('(')[1].split(')')[0].split(',')
return args.length === 4
} | [
"function",
"isErrorHandler",
"(",
"cb",
")",
"{",
"var",
"str",
"=",
"cb",
".",
"toString",
"(",
")",
"var",
"args",
"=",
"str",
".",
"split",
"(",
"'('",
")",
"[",
"1",
"]",
".",
"split",
"(",
"')'",
")",
"[",
"0",
"]",
".",
"split",
"(",
"... | Tells if a given middleware is a regular middleware or an error handler
@function
@inner
@private
@param {Function} middleware
@returns {Boolean} | [
"Tells",
"if",
"a",
"given",
"middleware",
"is",
"a",
"regular",
"middleware",
"or",
"an",
"error",
"handler"
] | 8b0490d75596107b7c37e2c2cfa4d0486f3eda1a | https://github.com/sirap-group/connect-sequence/blob/8b0490d75596107b7c37e2c2cfa4d0486f3eda1a/lib/ConnectSequence.js#L236-L240 |
38,329 | nknapp/thought | handlebars/helpers/dirTree.js | condense | function condense (node) {
if (node.nodes.length === 1 && node.nodes[0].nodes.length > 0) {
return condense({
label: (node.label || '') + node.nodes[0].label,
nodes: node.nodes[0].nodes
})
} else {
return {
label: node.label,
nodes: node.nodes.map(condense)
}
}
} | javascript | function condense (node) {
if (node.nodes.length === 1 && node.nodes[0].nodes.length > 0) {
return condense({
label: (node.label || '') + node.nodes[0].label,
nodes: node.nodes[0].nodes
})
} else {
return {
label: node.label,
nodes: node.nodes.map(condense)
}
}
} | [
"function",
"condense",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"nodes",
".",
"length",
"===",
"1",
"&&",
"node",
".",
"nodes",
"[",
"0",
"]",
".",
"nodes",
".",
"length",
">",
"0",
")",
"{",
"return",
"condense",
"(",
"{",
"label",
":",
... | Merge an archy-node with its single child, but not with a leaf node.
Keep nodes with zero, two or more childs.
@access private | [
"Merge",
"an",
"archy",
"-",
"node",
"with",
"its",
"single",
"child",
"but",
"not",
"with",
"a",
"leaf",
"node",
".",
"Keep",
"nodes",
"with",
"zero",
"two",
"or",
"more",
"childs",
"."
] | 2ae991f2d3065ff4eae4df544d20787b07be5116 | https://github.com/nknapp/thought/blob/2ae991f2d3065ff4eae4df544d20787b07be5116/handlebars/helpers/dirTree.js#L123-L135 |
38,330 | adrai/devicestack | lib/device.js | Device | function Device(Connection) {
var self = this;
// call super class
EventEmitter2.call(this, {
wildcard: true,
delimiter: ':',
maxListeners: 1000 // default would be 10!
});
if (this.log) {
this.log = _.wrap(this.log, function(func, msg) {
func(self.constructor.name + ': ' + msg);
}... | javascript | function Device(Connection) {
var self = this;
// call super class
EventEmitter2.call(this, {
wildcard: true,
delimiter: ':',
maxListeners: 1000 // default would be 10!
});
if (this.log) {
this.log = _.wrap(this.log, function(func, msg) {
func(self.constructor.name + ': ' + msg);
}... | [
"function",
"Device",
"(",
"Connection",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// call super class",
"EventEmitter2",
".",
"call",
"(",
"this",
",",
"{",
"wildcard",
":",
"true",
",",
"delimiter",
":",
"':'",
",",
"maxListeners",
":",
"1000",
"// def... | Device represents your physical device.
@param {Object} Connection The constructor function of the connection. | [
"Device",
"represents",
"your",
"physical",
"device",
"."
] | c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76 | https://github.com/adrai/devicestack/blob/c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76/lib/device.js#L10-L44 |
38,331 | adrai/devicestack | lib/ftdi/device.js | FtdiDevice | function FtdiDevice(deviceSettings, connectionSettings, Connection) {
// call super class
Device.call(this, Connection);
if (deviceSettings instanceof ftdi.FtdiDevice) {
this.ftdiDevice = deviceSettings;
this.set(this.ftdiDevice.deviceSettings);
} else {
this.set(deviceSettings);
}
this.set('... | javascript | function FtdiDevice(deviceSettings, connectionSettings, Connection) {
// call super class
Device.call(this, Connection);
if (deviceSettings instanceof ftdi.FtdiDevice) {
this.ftdiDevice = deviceSettings;
this.set(this.ftdiDevice.deviceSettings);
} else {
this.set(deviceSettings);
}
this.set('... | [
"function",
"FtdiDevice",
"(",
"deviceSettings",
",",
"connectionSettings",
",",
"Connection",
")",
"{",
"// call super class",
"Device",
".",
"call",
"(",
"this",
",",
"Connection",
")",
";",
"if",
"(",
"deviceSettings",
"instanceof",
"ftdi",
".",
"FtdiDevice",
... | FtdiDevice represents your physical device.
Extends Device.
@param {Object} deviceSettings The device settings (locationId, serial, index, description).
@param {Object} connectionSettings The connection settings (baudrate, databits, stopbits, parity).
@param {Object} Connection The constructor function of t... | [
"FtdiDevice",
"represents",
"your",
"physical",
"device",
".",
"Extends",
"Device",
"."
] | c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76 | https://github.com/adrai/devicestack/blob/c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76/lib/ftdi/device.js#L13-L28 |
38,332 | dfilatov/vow-queue | lib/queue.js | function(taskFn, taskParams) {
var task = this._buildTask(taskFn, taskParams);
if(task.params.weight > this._params.weightLimit) {
throw Error('task with weight of ' +
task.params.weight +
' can\'t be performed in queue with limit of ' +
this.... | javascript | function(taskFn, taskParams) {
var task = this._buildTask(taskFn, taskParams);
if(task.params.weight > this._params.weightLimit) {
throw Error('task with weight of ' +
task.params.weight +
' can\'t be performed in queue with limit of ' +
this.... | [
"function",
"(",
"taskFn",
",",
"taskParams",
")",
"{",
"var",
"task",
"=",
"this",
".",
"_buildTask",
"(",
"taskFn",
",",
"taskParams",
")",
";",
"if",
"(",
"task",
".",
"params",
".",
"weight",
">",
"this",
".",
"_params",
".",
"weightLimit",
")",
... | Adds task to queue
@param {Function} taskFn
@param {Object} [taskParams]
@param {Number} [taskParams.weight=1]
@param {Number} [taskParams.priority=1]
@returns {vow:promise} | [
"Adds",
"task",
"to",
"queue"
] | 32661fa71359a5fbcb2bd75e2e7b6c3cff048b6e | https://github.com/dfilatov/vow-queue/blob/32661fa71359a5fbcb2bd75e2e7b6c3cff048b6e/lib/queue.js#L72-L93 | |
38,333 | dfilatov/vow-queue | lib/queue.js | function() {
if(!this._isStopped) {
return;
}
this._isStopped = false;
var processedBuffer = this._processedBuffer;
if(processedBuffer.length) {
this._processedBuffer = [];
nextTick(function() {
while(processedBuffer.length) {
... | javascript | function() {
if(!this._isStopped) {
return;
}
this._isStopped = false;
var processedBuffer = this._processedBuffer;
if(processedBuffer.length) {
this._processedBuffer = [];
nextTick(function() {
while(processedBuffer.length) {
... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_isStopped",
")",
"{",
"return",
";",
"}",
"this",
".",
"_isStopped",
"=",
"false",
";",
"var",
"processedBuffer",
"=",
"this",
".",
"_processedBuffer",
";",
"if",
"(",
"processedBuffer",
".",
"l... | Starts processing of queue | [
"Starts",
"processing",
"of",
"queue"
] | 32661fa71359a5fbcb2bd75e2e7b6c3cff048b6e | https://github.com/dfilatov/vow-queue/blob/32661fa71359a5fbcb2bd75e2e7b6c3cff048b6e/lib/queue.js#L98-L115 | |
38,334 | scijs/cwise-compiler | lib/compile.js | countMatches | function countMatches(orders) {
var matched = 0, dimension = orders[0].length
while(matched < dimension) {
for(var j=1; j<orders.length; ++j) {
if(orders[j][matched] !== orders[0][matched]) {
return matched
}
}
++matched
}
return matched
} | javascript | function countMatches(orders) {
var matched = 0, dimension = orders[0].length
while(matched < dimension) {
for(var j=1; j<orders.length; ++j) {
if(orders[j][matched] !== orders[0][matched]) {
return matched
}
}
++matched
}
return matched
} | [
"function",
"countMatches",
"(",
"orders",
")",
"{",
"var",
"matched",
"=",
"0",
",",
"dimension",
"=",
"orders",
"[",
"0",
"]",
".",
"length",
"while",
"(",
"matched",
"<",
"dimension",
")",
"{",
"for",
"(",
"var",
"j",
"=",
"1",
";",
"j",
"<",
... | Count the number of compatible inner orders This is the length of the longest common prefix of the arrays in orders. Each array in orders lists the dimensions of the correspond ndarray in order of increasing stride. This is thus the maximum number of dimensions that can be efficiently traversed by simple nested loops f... | [
"Count",
"the",
"number",
"of",
"compatible",
"inner",
"orders",
"This",
"is",
"the",
"length",
"of",
"the",
"longest",
"common",
"prefix",
"of",
"the",
"arrays",
"in",
"orders",
".",
"Each",
"array",
"in",
"orders",
"lists",
"the",
"dimensions",
"of",
"th... | b65933f021302e15c6d4624353bb4b69168cd543 | https://github.com/scijs/cwise-compiler/blob/b65933f021302e15c6d4624353bb4b69168cd543/lib/compile.js#L101-L112 |
38,335 | adrai/devicestack | lib/ftdiserial/device.js | FtdiSerialDevice | function FtdiSerialDevice(deviceSettings, connectionSettings, Connection) {
if (_.isString(deviceSettings) && (deviceSettings.indexOf('COM') === 0 || deviceSettings.indexOf('/') === 0)) {
this.isSerialDevice = true;
// call super class
SerialDevice.call(this,
deviceSettings,
connectionSetting... | javascript | function FtdiSerialDevice(deviceSettings, connectionSettings, Connection) {
if (_.isString(deviceSettings) && (deviceSettings.indexOf('COM') === 0 || deviceSettings.indexOf('/') === 0)) {
this.isSerialDevice = true;
// call super class
SerialDevice.call(this,
deviceSettings,
connectionSetting... | [
"function",
"FtdiSerialDevice",
"(",
"deviceSettings",
",",
"connectionSettings",
",",
"Connection",
")",
"{",
"if",
"(",
"_",
".",
"isString",
"(",
"deviceSettings",
")",
"&&",
"(",
"deviceSettings",
".",
"indexOf",
"(",
"'COM'",
")",
"===",
"0",
"||",
"dev... | FtdiSerialDevice represents your physical device.
Extends Device.
@param {Object} deviceSettings The device settings (locationId, serial, index, description) or (portName).
@param {Object} connectionSettings The connection settings (baudrate, databits, stopbits, parity).
@param {Object} Connection The const... | [
"FtdiSerialDevice",
"represents",
"your",
"physical",
"device",
".",
"Extends",
"Device",
"."
] | c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76 | https://github.com/adrai/devicestack/blob/c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76/lib/ftdiserial/device.js#L14-L33 |
38,336 | wikimedia/banana-i18n | src/emitter.js | strongDirFromContent | function strongDirFromContent (text) {
var m = text.match(strongDirRegExp)
if (!m) {
return null
}
if (m[2] === undefined) {
return 'ltr'
}
return 'rtl'
} | javascript | function strongDirFromContent (text) {
var m = text.match(strongDirRegExp)
if (!m) {
return null
}
if (m[2] === undefined) {
return 'ltr'
}
return 'rtl'
} | [
"function",
"strongDirFromContent",
"(",
"text",
")",
"{",
"var",
"m",
"=",
"text",
".",
"match",
"(",
"strongDirRegExp",
")",
"if",
"(",
"!",
"m",
")",
"{",
"return",
"null",
"}",
"if",
"(",
"m",
"[",
"2",
"]",
"===",
"undefined",
")",
"{",
"retur... | Gets directionality of the first strongly directional codepoint
This is the rule the BIDI algorithm uses to determine the directionality of
paragraphs ( http://unicode.org/reports/tr9/#The_Paragraph_Level ) and
FSI isolates ( http://unicode.org/reports/tr9/#Explicit_Directional_Isolates ).
TODO: Does not handle BIDI ... | [
"Gets",
"directionality",
"of",
"the",
"first",
"strongly",
"directional",
"codepoint"
] | 17bff23a56d85db02ec0e2a4f908413bb56be03f | https://github.com/wikimedia/banana-i18n/blob/17bff23a56d85db02ec0e2a4f908413bb56be03f/src/emitter.js#L208-L217 |
38,337 | rootsdev/gedcomx-js | src/atom/AtomCategory.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof AtomCategory)){
return new AtomCategory(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(AtomCategory.isInstance(json)){
... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof AtomCategory)){
return new AtomCategory(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(AtomCategory.isInstance(json)){
... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"AtomCategory",
")",
")",
"{",
"return",
"new",
"AtomCategory",
"(",
"json",
")",
";",
"}",
"// If the given obj... | Information about a category associated with an atom entry or feed.
@see {@link https://github.com/FamilySearch/gedcomx-rs/blob/master/specifications/atom-model-specification.md#atom-json-media-type|GEDCOM X Atom JSON Spec}
@see {@link https://tools.ietf.org/html/rfc4287#section-4.2.2|RFC 4287}
@class AtomCategory
@e... | [
"Information",
"about",
"a",
"category",
"associated",
"with",
"an",
"atom",
"entry",
"or",
"feed",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/atom/AtomCategory.js#L16-L29 | |
38,338 | rootsdev/gedcomx-js | src/core/Agent.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Agent)){
return new Agent(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Agent.isInstance(json)){
return json;
}
this.init(json);
... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Agent)){
return new Agent(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Agent.isInstance(json)){
return json;
}
this.init(json);
... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Agent",
")",
")",
"{",
"return",
"new",
"Agent",
"(",
"json",
")",
";",
"}",
"// If the given object is already... | Someone or something that curates genealogical data, such as a genealogical
researcher, user of software, or organization.
@see {@link https://github.com/FamilySearch/gedcomx/blob/master/specifications/json-format-specification.md#agent|GEDCOM X JSON Spec}
@class
@extends ExtensibleData
@param {Object} [json] | [
"Someone",
"or",
"something",
"that",
"curates",
"genealogical",
"data",
"such",
"as",
"a",
"genealogical",
"researcher",
"user",
"of",
"software",
"or",
"organization",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/core/Agent.js#L14-L27 | |
38,339 | AppGeo/cartodb | lib/raw.js | toSQL | function toSQL() {
if (this._cached) {
return this._cached;
}
if (Array.isArray(this.bindings)) {
this._cached = replaceRawArrBindings(this);
} else if (this.bindings && typeof this.bindings === 'object') {
this._cached = replaceKeyBindings(this);
} else {
this._cached = {
... | javascript | function toSQL() {
if (this._cached) {
return this._cached;
}
if (Array.isArray(this.bindings)) {
this._cached = replaceRawArrBindings(this);
} else if (this.bindings && typeof this.bindings === 'object') {
this._cached = replaceKeyBindings(this);
} else {
this._cached = {
... | [
"function",
"toSQL",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_cached",
")",
"{",
"return",
"this",
".",
"_cached",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"this",
".",
"bindings",
")",
")",
"{",
"this",
".",
"_cached",
"=",
"replaceRawAr... | Returns the raw sql for the query. | [
"Returns",
"the",
"raw",
"sql",
"for",
"the",
"query",
"."
] | 4cc624975d359800961bf34cb74de97488d2efb5 | https://github.com/AppGeo/cartodb/blob/4cc624975d359800961bf34cb74de97488d2efb5/lib/raw.js#L63-L86 |
38,340 | AckerApple/ack-node | js/modules/reqres/res.js | reqres | function reqres(res, req) {
if (req && req._headers) {
throw new Error('Received response object where request object was expected');
}
this.res = res;
this.req = req;
if (res) {
if (res.$ && res.$.data) {
this.data = res.$.data;
}
else {
this.... | javascript | function reqres(res, req) {
if (req && req._headers) {
throw new Error('Received response object where request object was expected');
}
this.res = res;
this.req = req;
if (res) {
if (res.$ && res.$.data) {
this.data = res.$.data;
}
else {
this.... | [
"function",
"reqres",
"(",
"res",
",",
"req",
")",
"{",
"if",
"(",
"req",
"&&",
"req",
".",
"_headers",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Received response object where request object was expected'",
")",
";",
"}",
"this",
".",
"res",
"=",
"res",
"... | inbound request response processor returns function that appends output that also has a tun of helper methods | [
"inbound",
"request",
"response",
"processor",
"returns",
"function",
"that",
"appends",
"output",
"that",
"also",
"has",
"a",
"tun",
"of",
"helper",
"methods"
] | c123d3fcbdd0195630fece6dc9ddee8910c9e115 | https://github.com/AckerApple/ack-node/blob/c123d3fcbdd0195630fece6dc9ddee8910c9e115/js/modules/reqres/res.js#L6-L23 |
38,341 | AckerApple/ack-node | js/modules/reqres/res.js | xreqhan | function xreqhan(res, req, output) {
if (isResHeaderSent(res)) {
return console.error('request already closed', new Error().stack);
}
output = output || '';
var isBinary = output && Buffer.isBuffer(output);
if (isBinary) {
res.end(output, 'binary');
}
else if (res.send) { //E... | javascript | function xreqhan(res, req, output) {
if (isResHeaderSent(res)) {
return console.error('request already closed', new Error().stack);
}
output = output || '';
var isBinary = output && Buffer.isBuffer(output);
if (isBinary) {
res.end(output, 'binary');
}
else if (res.send) { //E... | [
"function",
"xreqhan",
"(",
"res",
",",
"req",
",",
"output",
")",
"{",
"if",
"(",
"isResHeaderSent",
"(",
"res",
")",
")",
"{",
"return",
"console",
".",
"error",
"(",
"'request already closed'",
",",
"new",
"Error",
"(",
")",
".",
"stack",
")",
";",
... | close request handler | [
"close",
"request",
"handler"
] | c123d3fcbdd0195630fece6dc9ddee8910c9e115 | https://github.com/AckerApple/ack-node/blob/c123d3fcbdd0195630fece6dc9ddee8910c9e115/js/modules/reqres/res.js#L251-L268 |
38,342 | rootsdev/gedcomx-js | src/records/CollectionContent.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof CollectionContent)){
return new CollectionContent(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(CollectionContent.isInstance... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof CollectionContent)){
return new CollectionContent(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(CollectionContent.isInstance... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"CollectionContent",
")",
")",
"{",
"return",
"new",
"CollectionContent",
"(",
"json",
")",
";",
"}",
"// If the... | Information about the contents of a collection.
@see {@link https://github.com/FamilySearch/gedcomx-record/blob/master/specifications/record-specification.md#collection-content|GEDCOM X Records Spec}
@class CollectionContent
@extends ExtensibleData
@param {Object} [json] | [
"Information",
"about",
"the",
"contents",
"of",
"a",
"collection",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/records/CollectionContent.js#L14-L27 | |
38,343 | chromaway/blockchainjs | lib/blockchain/verified.js | isGoodHash | function isGoodHash (hash, target) {
hash = new Buffer(hash, 'hex')
target = new Buffer(target, 'hex')
return _.range(32).some(function (index) {
return hash[index] < target[index]
})
} | javascript | function isGoodHash (hash, target) {
hash = new Buffer(hash, 'hex')
target = new Buffer(target, 'hex')
return _.range(32).some(function (index) {
return hash[index] < target[index]
})
} | [
"function",
"isGoodHash",
"(",
"hash",
",",
"target",
")",
"{",
"hash",
"=",
"new",
"Buffer",
"(",
"hash",
",",
"'hex'",
")",
"target",
"=",
"new",
"Buffer",
"(",
"target",
",",
"'hex'",
")",
"return",
"_",
".",
"range",
"(",
"32",
")",
".",
"some"... | Check that given `hash` lower than `target`
@param {string} hash
@param {string} target
@return {Boolean} | [
"Check",
"that",
"given",
"hash",
"lower",
"than",
"target"
] | 82ae80147cc24cca42f1e1b6113ea41c45e6aae8 | https://github.com/chromaway/blockchainjs/blob/82ae80147cc24cca42f1e1b6113ea41c45e6aae8/lib/blockchain/verified.js#L89-L96 |
38,344 | chromaway/blockchainjs | lib/blockchain/verified.js | verifyHeader | function verifyHeader (currentHash, currentHeader, hashPrevBlock, prevHeader, target, isTestnet) {
try {
// check hashPrevBlock
assert.equal(hashPrevBlock, currentHeader.hashPrevBlock)
try {
// check difficulty
assert.equal(currentHeader.bits, target.bits)
// check hash and target
... | javascript | function verifyHeader (currentHash, currentHeader, hashPrevBlock, prevHeader, target, isTestnet) {
try {
// check hashPrevBlock
assert.equal(hashPrevBlock, currentHeader.hashPrevBlock)
try {
// check difficulty
assert.equal(currentHeader.bits, target.bits)
// check hash and target
... | [
"function",
"verifyHeader",
"(",
"currentHash",
",",
"currentHeader",
",",
"hashPrevBlock",
",",
"prevHeader",
",",
"target",
",",
"isTestnet",
")",
"{",
"try",
"{",
"// check hashPrevBlock",
"assert",
".",
"equal",
"(",
"hashPrevBlock",
",",
"currentHeader",
".",... | Verify current header
@param {string} currentHash
@param {BitcoinHeader} currentHeader
@param {string} hashPrevBlock
@param {BitcoinHeader} prevHeader
@param {{bits: number, target: string}} target
@param {Boolean} isTestnet
@throws {VerifyHeaderError} | [
"Verify",
"current",
"header"
] | 82ae80147cc24cca42f1e1b6113ea41c45e6aae8 | https://github.com/chromaway/blockchainjs/blob/82ae80147cc24cca42f1e1b6113ea41c45e6aae8/lib/blockchain/verified.js#L109-L141 |
38,345 | matthewtoast/runiq | parser/lex.js | clean | function clean(source) {
if (!source) return BLANK;
if (source.charCodeAt(0) === BOM_CODE) source = source.slice(1);
source = source.replace(CR_REGEXP, BLANK).replace(TRAILING_WHITESPACE_REGEXP, BLANK);
return source;
} | javascript | function clean(source) {
if (!source) return BLANK;
if (source.charCodeAt(0) === BOM_CODE) source = source.slice(1);
source = source.replace(CR_REGEXP, BLANK).replace(TRAILING_WHITESPACE_REGEXP, BLANK);
return source;
} | [
"function",
"clean",
"(",
"source",
")",
"{",
"if",
"(",
"!",
"source",
")",
"return",
"BLANK",
";",
"if",
"(",
"source",
".",
"charCodeAt",
"(",
"0",
")",
"===",
"BOM_CODE",
")",
"source",
"=",
"source",
".",
"slice",
"(",
"1",
")",
";",
"source",... | Remove any unwanted characters from the raw source code string | [
"Remove",
"any",
"unwanted",
"characters",
"from",
"the",
"raw",
"source",
"code",
"string"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/parser/lex.js#L32-L37 |
38,346 | matthewtoast/runiq | parser/lex.js | lex | function lex(source) {
var tokens = [];
var chunk = clean(source);
var total = chunk.length;
var iterations = 0;
while (chunk.length > 0) {
for (var regexpName in REGEXPS) {
var regexp = REGEXPS[regexpName];
var match = regexp.exec(chunk);
if (match) {
... | javascript | function lex(source) {
var tokens = [];
var chunk = clean(source);
var total = chunk.length;
var iterations = 0;
while (chunk.length > 0) {
for (var regexpName in REGEXPS) {
var regexp = REGEXPS[regexpName];
var match = regexp.exec(chunk);
if (match) {
... | [
"function",
"lex",
"(",
"source",
")",
"{",
"var",
"tokens",
"=",
"[",
"]",
";",
"var",
"chunk",
"=",
"clean",
"(",
"source",
")",
";",
"var",
"total",
"=",
"chunk",
".",
"length",
";",
"var",
"iterations",
"=",
"0",
";",
"while",
"(",
"chunk",
"... | Return an array of token objects for the clean source code string | [
"Return",
"an",
"array",
"of",
"token",
"objects",
"for",
"the",
"clean",
"source",
"code",
"string"
] | 897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d | https://github.com/matthewtoast/runiq/blob/897ce0c919a9eb6dd0ae1825f0ab1222c42f9d1d/parser/lex.js#L40-L73 |
38,347 | grunjol/nobin-debian-installer | index.js | Deb | function Deb () {
this.data = tar.pack()
this.control = tar.pack()
this.pkgSize = 0
this.controlFile = {}
this.filesMd5 = []
this.dirs = {}
} | javascript | function Deb () {
this.data = tar.pack()
this.control = tar.pack()
this.pkgSize = 0
this.controlFile = {}
this.filesMd5 = []
this.dirs = {}
} | [
"function",
"Deb",
"(",
")",
"{",
"this",
".",
"data",
"=",
"tar",
".",
"pack",
"(",
")",
"this",
".",
"control",
"=",
"tar",
".",
"pack",
"(",
")",
"this",
".",
"pkgSize",
"=",
"0",
"this",
".",
"controlFile",
"=",
"{",
"}",
"this",
".",
"file... | Class used for creating .deb packages | [
"Class",
"used",
"for",
"creating",
".",
"deb",
"packages"
] | e28e10a4249749301cb0afbb87343157e45691f8 | https://github.com/grunjol/nobin-debian-installer/blob/e28e10a4249749301cb0afbb87343157e45691f8/index.js#L13-L20 |
38,348 | grunjol/nobin-debian-installer | index.js | buildControlFile | function buildControlFile (tempPath, definition, callback) {
var self = this
var author = ''
if (definition.package.author) {
author = typeof definition.package.author === 'string'
? definition.package.author
: definition.package.author.name + ' <' + definition.package.author.email + '>'
}
s... | javascript | function buildControlFile (tempPath, definition, callback) {
var self = this
var author = ''
if (definition.package.author) {
author = typeof definition.package.author === 'string'
? definition.package.author
: definition.package.author.name + ' <' + definition.package.author.email + '>'
}
s... | [
"function",
"buildControlFile",
"(",
"tempPath",
",",
"definition",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
"var",
"author",
"=",
"''",
"if",
"(",
"definition",
".",
"package",
".",
"author",
")",
"{",
"author",
"=",
"typeof",
"definition",
... | Build the control part of the .deb package. | [
"Build",
"the",
"control",
"part",
"of",
"the",
".",
"deb",
"package",
"."
] | e28e10a4249749301cb0afbb87343157e45691f8 | https://github.com/grunjol/nobin-debian-installer/blob/e28e10a4249749301cb0afbb87343157e45691f8/index.js#L66-L161 |
38,349 | grunjol/nobin-debian-installer | index.js | packFiles | function packFiles (tempPath, files, callback) {
var self = this
async.eachSeries(files, function (crtFile, done) {
var filePath = path.resolve(crtFile.src[0])
debug('adding %s', filePath)
async.waterfall([
fs.stat.bind(fs, filePath),
function (stats, wtfDone) {
if (stats.isDirector... | javascript | function packFiles (tempPath, files, callback) {
var self = this
async.eachSeries(files, function (crtFile, done) {
var filePath = path.resolve(crtFile.src[0])
debug('adding %s', filePath)
async.waterfall([
fs.stat.bind(fs, filePath),
function (stats, wtfDone) {
if (stats.isDirector... | [
"function",
"packFiles",
"(",
"tempPath",
",",
"files",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
"async",
".",
"eachSeries",
"(",
"files",
",",
"function",
"(",
"crtFile",
",",
"done",
")",
"{",
"var",
"filePath",
"=",
"path",
".",
"resol... | Add files to the .deb package.
@param files - an object with the following format {'path/to/source/dir': 'path/to/target/dir'} (e.g. {'../../src/lib': '/srv/productName/lib'}) | [
"Add",
"files",
"to",
"the",
".",
"deb",
"package",
"."
] | e28e10a4249749301cb0afbb87343157e45691f8 | https://github.com/grunjol/nobin-debian-installer/blob/e28e10a4249749301cb0afbb87343157e45691f8/index.js#L168-L222 |
38,350 | pogosandbox/gpsoauth | index.js | generateSignature | function generateSignature(email, password) {
let googleDefaultPublicKey = 'AAAAgMom/1a/v0lblO2Ubrt60J2gcuXSljGFQXgcyZWveWLEwo6prwgi3iJIZdodyhKZQrNWp5nKJ3srRXcUW+F1BD3baEVGcmEgqaLZUNBjm057pKRI16kB0YppeGx5qIQ5QjKzsR8ETQbKLNWgRY0QRNVz34kMJR3P/LgHax/6rmf5AAAAAwEAAQ==';
let keyBuffer = Buffer.from(googleDefaultPub... | javascript | function generateSignature(email, password) {
let googleDefaultPublicKey = 'AAAAgMom/1a/v0lblO2Ubrt60J2gcuXSljGFQXgcyZWveWLEwo6prwgi3iJIZdodyhKZQrNWp5nKJ3srRXcUW+F1BD3baEVGcmEgqaLZUNBjm057pKRI16kB0YppeGx5qIQ5QjKzsR8ETQbKLNWgRY0QRNVz34kMJR3P/LgHax/6rmf5AAAAAwEAAQ==';
let keyBuffer = Buffer.from(googleDefaultPub... | [
"function",
"generateSignature",
"(",
"email",
",",
"password",
")",
"{",
"let",
"googleDefaultPublicKey",
"=",
"'AAAAgMom/1a/v0lblO2Ubrt60J2gcuXSljGFQXgcyZWveWLEwo6prwgi3iJIZdodyhKZQrNWp5nKJ3srRXcUW+F1BD3baEVGcmEgqaLZUNBjm057pKRI16kB0YppeGx5qIQ5QjKzsR8ETQbKLNWgRY0QRNVz34kMJR3P/LgHax/6rmf5AAAA... | Generates a signature to be passed into GPS | [
"Generates",
"a",
"signature",
"to",
"be",
"passed",
"into",
"GPS"
] | 9d435010622855704c392fd73f6ae12bcb80d56f | https://github.com/pogosandbox/gpsoauth/blob/9d435010622855704c392fd73f6ae12bcb80d56f/index.js#L27-L56 |
38,351 | devaos/grunt-port-pick | tasks/port-pick.js | function(selectedPort, callback) {
if(selectedPort === false)
grunt.fatal('No available port was found')
self.data.targets.forEach(function(prop) {
pp.injectPort(prop, selectedPort)
})
if(pp.options.name) {
pp.injectPort(pp.options.name, selectedPort)
... | javascript | function(selectedPort, callback) {
if(selectedPort === false)
grunt.fatal('No available port was found')
self.data.targets.forEach(function(prop) {
pp.injectPort(prop, selectedPort)
})
if(pp.options.name) {
pp.injectPort(pp.options.name, selectedPort)
... | [
"function",
"(",
"selectedPort",
",",
"callback",
")",
"{",
"if",
"(",
"selectedPort",
"===",
"false",
")",
"grunt",
".",
"fatal",
"(",
"'No available port was found'",
")",
"self",
".",
"data",
".",
"targets",
".",
"forEach",
"(",
"function",
"(",
"prop",
... | Override the configurations we were told to override | [
"Override",
"the",
"configurations",
"we",
"were",
"told",
"to",
"override"
] | f13ed4a8a8e36dfc48e2a10b98847563ca5541b6 | https://github.com/devaos/grunt-port-pick/blob/f13ed4a8a8e36dfc48e2a10b98847563ca5541b6/tasks/port-pick.js#L261-L275 | |
38,352 | devaos/grunt-port-pick | tasks/port-pick.js | function(callback) {
var step = 0
async.whilst(
function() {
return ++step <= pp.options.extra
},
function(callback) {
pp.tryPorts = []
var c = grunt.config.get('port-pick-' + step)
// With multiple tasks, do not find a port... | javascript | function(callback) {
var step = 0
async.whilst(
function() {
return ++step <= pp.options.extra
},
function(callback) {
pp.tryPorts = []
var c = grunt.config.get('port-pick-' + step)
// With multiple tasks, do not find a port... | [
"function",
"(",
"callback",
")",
"{",
"var",
"step",
"=",
"0",
"async",
".",
"whilst",
"(",
"function",
"(",
")",
"{",
"return",
"++",
"step",
"<=",
"pp",
".",
"options",
".",
"extra",
"}",
",",
"function",
"(",
"callback",
")",
"{",
"pp",
".",
... | Set some configurations for extra ports template interpolation | [
"Set",
"some",
"configurations",
"for",
"extra",
"ports",
"template",
"interpolation"
] | f13ed4a8a8e36dfc48e2a10b98847563ca5541b6 | https://github.com/devaos/grunt-port-pick/blob/f13ed4a8a8e36dfc48e2a10b98847563ca5541b6/tasks/port-pick.js#L278-L318 | |
38,353 | AppGeo/cartodb | lib/formatter.js | columnize | function columnize(target) {
var columns = typeof target === 'string' ? [target] : target;
var str = '',
i = -1;
while (++i < columns.length) {
if (i > 0) {
str += ', ';
}
str += this.wrap(columns[i]);
}
return str;
} | javascript | function columnize(target) {
var columns = typeof target === 'string' ? [target] : target;
var str = '',
i = -1;
while (++i < columns.length) {
if (i > 0) {
str += ', ';
}
str += this.wrap(columns[i]);
}
return str;
} | [
"function",
"columnize",
"(",
"target",
")",
"{",
"var",
"columns",
"=",
"typeof",
"target",
"===",
"'string'",
"?",
"[",
"target",
"]",
":",
"target",
";",
"var",
"str",
"=",
"''",
",",
"i",
"=",
"-",
"1",
";",
"while",
"(",
"++",
"i",
"<",
"col... | Accepts a string or array of columns to wrap as appropriate. | [
"Accepts",
"a",
"string",
"or",
"array",
"of",
"columns",
"to",
"wrap",
"as",
"appropriate",
"."
] | 4cc624975d359800961bf34cb74de97488d2efb5 | https://github.com/AppGeo/cartodb/blob/4cc624975d359800961bf34cb74de97488d2efb5/lib/formatter.js#L26-L37 |
38,354 | AppGeo/cartodb | lib/formatter.js | parameter | function parameter(value) {
if (typeof value === 'function') {
return this.outputQuery(this.compileCallback(value), true);
}
return this.unwrapRaw(value, true) || '?';
} | javascript | function parameter(value) {
if (typeof value === 'function') {
return this.outputQuery(this.compileCallback(value), true);
}
return this.unwrapRaw(value, true) || '?';
} | [
"function",
"parameter",
"(",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"===",
"'function'",
")",
"{",
"return",
"this",
".",
"outputQuery",
"(",
"this",
".",
"compileCallback",
"(",
"value",
")",
",",
"true",
")",
";",
"}",
"return",
"this",
".... | Checks whether a value is a function... if it is, we compile it otherwise we check whether it's a raw | [
"Checks",
"whether",
"a",
"value",
"is",
"a",
"function",
"...",
"if",
"it",
"is",
"we",
"compile",
"it",
"otherwise",
"we",
"check",
"whether",
"it",
"s",
"a",
"raw"
] | 4cc624975d359800961bf34cb74de97488d2efb5 | https://github.com/AppGeo/cartodb/blob/4cc624975d359800961bf34cb74de97488d2efb5/lib/formatter.js#L59-L64 |
38,355 | AppGeo/cartodb | lib/formatter.js | wrap | function wrap(value) {
var raw;
if (typeof value === 'function') {
return this.outputQuery(this.compileCallback(value), true);
}
raw = this.unwrapRaw(value);
if (raw) {
return raw;
}
if (typeof value === 'number') {
return value;
}
return this._wrapString(value + ''... | javascript | function wrap(value) {
var raw;
if (typeof value === 'function') {
return this.outputQuery(this.compileCallback(value), true);
}
raw = this.unwrapRaw(value);
if (raw) {
return raw;
}
if (typeof value === 'number') {
return value;
}
return this._wrapString(value + ''... | [
"function",
"wrap",
"(",
"value",
")",
"{",
"var",
"raw",
";",
"if",
"(",
"typeof",
"value",
"===",
"'function'",
")",
"{",
"return",
"this",
".",
"outputQuery",
"(",
"this",
".",
"compileCallback",
"(",
"value",
")",
",",
"true",
")",
";",
"}",
"raw... | Puts the appropriate wrapper around a value depending on the database engine, unless it's a knex.raw value, in which case it's left alone. | [
"Puts",
"the",
"appropriate",
"wrapper",
"around",
"a",
"value",
"depending",
"on",
"the",
"database",
"engine",
"unless",
"it",
"s",
"a",
"knex",
".",
"raw",
"value",
"in",
"which",
"case",
"it",
"s",
"left",
"alone",
"."
] | 4cc624975d359800961bf34cb74de97488d2efb5 | https://github.com/AppGeo/cartodb/blob/4cc624975d359800961bf34cb74de97488d2efb5/lib/formatter.js#L96-L109 |
38,356 | AppGeo/cartodb | lib/formatter.js | operator | function operator(value) {
var raw = this.unwrapRaw(value);
if (raw) {
return raw;
}
if (operators[(value || '').toLowerCase()] !== true) {
throw new TypeError('The operator "' + value + '" is not permitted');
}
return value;
} | javascript | function operator(value) {
var raw = this.unwrapRaw(value);
if (raw) {
return raw;
}
if (operators[(value || '').toLowerCase()] !== true) {
throw new TypeError('The operator "' + value + '" is not permitted');
}
return value;
} | [
"function",
"operator",
"(",
"value",
")",
"{",
"var",
"raw",
"=",
"this",
".",
"unwrapRaw",
"(",
"value",
")",
";",
"if",
"(",
"raw",
")",
"{",
"return",
"raw",
";",
"}",
"if",
"(",
"operators",
"[",
"(",
"value",
"||",
"''",
")",
".",
"toLowerC... | The operator method takes a value and returns something or other. | [
"The",
"operator",
"method",
"takes",
"a",
"value",
"and",
"returns",
"something",
"or",
"other",
"."
] | 4cc624975d359800961bf34cb74de97488d2efb5 | https://github.com/AppGeo/cartodb/blob/4cc624975d359800961bf34cb74de97488d2efb5/lib/formatter.js#L116-L125 |
38,357 | AppGeo/cartodb | lib/formatter.js | direction | function direction(value) {
var raw = this.unwrapRaw(value);
if (raw) {
return raw;
}
return orderBys.indexOf((value || '').toLowerCase()) !== -1 ? value : 'asc';
} | javascript | function direction(value) {
var raw = this.unwrapRaw(value);
if (raw) {
return raw;
}
return orderBys.indexOf((value || '').toLowerCase()) !== -1 ? value : 'asc';
} | [
"function",
"direction",
"(",
"value",
")",
"{",
"var",
"raw",
"=",
"this",
".",
"unwrapRaw",
"(",
"value",
")",
";",
"if",
"(",
"raw",
")",
"{",
"return",
"raw",
";",
"}",
"return",
"orderBys",
".",
"indexOf",
"(",
"(",
"value",
"||",
"''",
")",
... | Specify the direction of the ordering. | [
"Specify",
"the",
"direction",
"of",
"the",
"ordering",
"."
] | 4cc624975d359800961bf34cb74de97488d2efb5 | https://github.com/AppGeo/cartodb/blob/4cc624975d359800961bf34cb74de97488d2efb5/lib/formatter.js#L128-L134 |
38,358 | AppGeo/cartodb | lib/formatter.js | compileCallback | function compileCallback(callback, method) {
var client = this.client;
// Build the callback
var builder = client.queryBuilder();
callback.call(builder, builder);
// Compile the callback, using the current formatter (to track all bindings).
var compiler = client.queryCompiler(builder);
com... | javascript | function compileCallback(callback, method) {
var client = this.client;
// Build the callback
var builder = client.queryBuilder();
callback.call(builder, builder);
// Compile the callback, using the current formatter (to track all bindings).
var compiler = client.queryCompiler(builder);
com... | [
"function",
"compileCallback",
"(",
"callback",
",",
"method",
")",
"{",
"var",
"client",
"=",
"this",
".",
"client",
";",
"// Build the callback",
"var",
"builder",
"=",
"client",
".",
"queryBuilder",
"(",
")",
";",
"callback",
".",
"call",
"(",
"builder",
... | Compiles a callback using the query builder. | [
"Compiles",
"a",
"callback",
"using",
"the",
"query",
"builder",
"."
] | 4cc624975d359800961bf34cb74de97488d2efb5 | https://github.com/AppGeo/cartodb/blob/4cc624975d359800961bf34cb74de97488d2efb5/lib/formatter.js#L137-L150 |
38,359 | AppGeo/cartodb | lib/formatter.js | outputQuery | function outputQuery(compiled, isParameter) {
var sql = compiled.sql || '';
if (sql) {
if (compiled.method === 'select' && (isParameter || compiled.as)) {
sql = '(' + sql + ')';
if (compiled.as) {
return this.alias(sql, this.wrap(compiled.as));
}
}
}
return ... | javascript | function outputQuery(compiled, isParameter) {
var sql = compiled.sql || '';
if (sql) {
if (compiled.method === 'select' && (isParameter || compiled.as)) {
sql = '(' + sql + ')';
if (compiled.as) {
return this.alias(sql, this.wrap(compiled.as));
}
}
}
return ... | [
"function",
"outputQuery",
"(",
"compiled",
",",
"isParameter",
")",
"{",
"var",
"sql",
"=",
"compiled",
".",
"sql",
"||",
"''",
";",
"if",
"(",
"sql",
")",
"{",
"if",
"(",
"compiled",
".",
"method",
"===",
"'select'",
"&&",
"(",
"isParameter",
"||",
... | Ensures the query is aliased if necessary. | [
"Ensures",
"the",
"query",
"is",
"aliased",
"if",
"necessary",
"."
] | 4cc624975d359800961bf34cb74de97488d2efb5 | https://github.com/AppGeo/cartodb/blob/4cc624975d359800961bf34cb74de97488d2efb5/lib/formatter.js#L153-L164 |
38,360 | AppGeo/cartodb | lib/formatter.js | _wrapString | function _wrapString(value) {
var segments,
asIndex = value.toLowerCase().indexOf(' as ');
if (asIndex !== -1) {
var first = value.slice(0, asIndex);
var second = value.slice(asIndex + 4);
return this.alias(this.wrap(first), this.wrap(second));
}
var i = -1,
wrapped = [... | javascript | function _wrapString(value) {
var segments,
asIndex = value.toLowerCase().indexOf(' as ');
if (asIndex !== -1) {
var first = value.slice(0, asIndex);
var second = value.slice(asIndex + 4);
return this.alias(this.wrap(first), this.wrap(second));
}
var i = -1,
wrapped = [... | [
"function",
"_wrapString",
"(",
"value",
")",
"{",
"var",
"segments",
",",
"asIndex",
"=",
"value",
".",
"toLowerCase",
"(",
")",
".",
"indexOf",
"(",
"' as '",
")",
";",
"if",
"(",
"asIndex",
"!==",
"-",
"1",
")",
"{",
"var",
"first",
"=",
"value",
... | Coerce to string to prevent strange errors when it's not a string. | [
"Coerce",
"to",
"string",
"to",
"prevent",
"strange",
"errors",
"when",
"it",
"s",
"not",
"a",
"string",
"."
] | 4cc624975d359800961bf34cb74de97488d2efb5 | https://github.com/AppGeo/cartodb/blob/4cc624975d359800961bf34cb74de97488d2efb5/lib/formatter.js#L167-L187 |
38,361 | rootsdev/gedcomx-js | src/records/Collection.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Collection)){
return new Collection(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Collection.isInstance(json)){
return... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Collection)){
return new Collection(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Collection.isInstance(json)){
return... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Collection",
")",
")",
"{",
"return",
"new",
"Collection",
"(",
"json",
")",
";",
"}",
"// If the given object ... | A collection of genealogical data.
@see {@link https://github.com/FamilySearch/gedcomx-record/blob/master/specifications/record-specification.md#collection|GEDCOM X Records Spec}
@class Collection
@extends ExtensibleData
@param {Object} [json] | [
"A",
"collection",
"of",
"genealogical",
"data",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/records/Collection.js#L14-L27 | |
38,362 | imbo/imboclient-js | lib/browser/request.js | function(xhr) {
var response = {
headers: {},
statusCode: xhr.status
};
var headerPairs = xhr.getAllResponseHeaders().split('\u000d\u000a');
for (var i = 0; i < headerPairs.length; i++) {
var headerPair = headerPairs[i],
index = headerPair.indexOf('\u003a\u0020');
... | javascript | function(xhr) {
var response = {
headers: {},
statusCode: xhr.status
};
var headerPairs = xhr.getAllResponseHeaders().split('\u000d\u000a');
for (var i = 0; i < headerPairs.length; i++) {
var headerPair = headerPairs[i],
index = headerPair.indexOf('\u003a\u0020');
... | [
"function",
"(",
"xhr",
")",
"{",
"var",
"response",
"=",
"{",
"headers",
":",
"{",
"}",
",",
"statusCode",
":",
"xhr",
".",
"status",
"}",
";",
"var",
"headerPairs",
"=",
"xhr",
".",
"getAllResponseHeaders",
"(",
")",
".",
"split",
"(",
"'\\u000d\\u00... | Normalize a response into a common format for both environments
@param {XMLHttpRequest} xhr
@return {Object} | [
"Normalize",
"a",
"response",
"into",
"a",
"common",
"format",
"for",
"both",
"environments"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/browser/request.js#L25-L44 | |
38,363 | rootsdev/gedcomx-js | src/core/Fact.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Fact)){
return new Fact(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Fact.isInstance(json)){
return json;
}
this.init(json);
} | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Fact)){
return new Fact(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Fact.isInstance(json)){
return json;
}
this.init(json);
} | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Fact",
")",
")",
"{",
"return",
"new",
"Fact",
"(",
"json",
")",
";",
"}",
"// If the given object is already a... | A fact for a person or relationship.
@see {@link https://github.com/FamilySearch/gedcomx/blob/master/specifications/json-format-specification.md#fact-conclusion|GEDCOM X JSON Spec}
@class
@extends Conclusion
@param {Object} [json] | [
"A",
"fact",
"for",
"a",
"person",
"or",
"relationship",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/core/Fact.js#L13-L26 | |
38,364 | unshiftio/handshake | index.js | Handshake | function Handshake(context, options) {
if (!this) return new Handshake(context, options);
options = options || {};
this.stringify = options.stringify || qs.stringify;
this.configure = Object.create(null);
this.timers = new Tick(context);
this.id = options.id || v4;
this.context = context;
this.payload... | javascript | function Handshake(context, options) {
if (!this) return new Handshake(context, options);
options = options || {};
this.stringify = options.stringify || qs.stringify;
this.configure = Object.create(null);
this.timers = new Tick(context);
this.id = options.id || v4;
this.context = context;
this.payload... | [
"function",
"Handshake",
"(",
"context",
",",
"options",
")",
"{",
"if",
"(",
"!",
"this",
")",
"return",
"new",
"Handshake",
"(",
"context",
",",
"options",
")",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"stringify",
"=",
"op... | Handle handshakes.
Options:
- `handshake timeout`: Maximum time you're allowed to spend modifying the
handshake.
- `stringify`: Encoder for the complete handshake response.
- `id`: Unique id generator.
@constructor
@param {Mixed} context Context of the callbacks.
@param {Object} options Optional configuration.
@api ... | [
"Handle",
"handshakes",
"."
] | 01530f9435ab43b00657934a6a2530caeef712ef | https://github.com/unshiftio/handshake/blob/01530f9435ab43b00657934a6a2530caeef712ef/index.js#L25-L42 |
38,365 | jaredhanson/junction-disco | lib/junction-disco/route.js | Route | function Route(query, node, callbacks, options) {
options = options || {};
this.query = query;
this.node = node;
this.callbacks = callbacks;
this.regexp = normalize(node
, this.keys = []
, options.sensitive
, options.strict);
} | javascript | function Route(query, node, callbacks, options) {
options = options || {};
this.query = query;
this.node = node;
this.callbacks = callbacks;
this.regexp = normalize(node
, this.keys = []
, options.sensitive
, options.strict);
} | [
"function",
"Route",
"(",
"query",
",",
"node",
",",
"callbacks",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"query",
"=",
"query",
";",
"this",
".",
"node",
"=",
"node",
";",
"this",
".",
"callbacks",
"=... | Initialize a new `Route` with the given `query`, `node`, an array of
`callbacks` and `options`.
Options:
- `sensitive` enable case-sensitive routes
- `strict` enable strict matching for trailing slashes
@param {String} query
@param {String} node
@param {Array} callbacks
@param {Object} options
@api private | [
"Initialize",
"a",
"new",
"Route",
"with",
"the",
"given",
"query",
"node",
"an",
"array",
"of",
"callbacks",
"and",
"options",
"."
] | 89f2d222518b3b0f282d54b25d6405b5e35c1383 | https://github.com/jaredhanson/junction-disco/blob/89f2d222518b3b0f282d54b25d6405b5e35c1383/lib/junction-disco/route.js#L16-L25 |
38,366 | rootsdev/gedcomx-js | src/core/Root.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Root)){
return new Root(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Root.isInstance(json)){
return json;
}
this.init(json);
} | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof Root)){
return new Root(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(Root.isInstance(json)){
return json;
}
this.init(json);
} | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Root",
")",
")",
"{",
"return",
"new",
"Root",
"(",
"json",
")",
";",
"}",
"// If the given object is already a... | A GEDCOM X document.
@see {@link https://github.com/FamilySearch/gedcomx/blob/master/specifications/json-format-specification.md#gedcomx-type|GEDCOM X JSON Spec}
@class
@extends ExtensibleData
@param {Object} [json] | [
"A",
"GEDCOM",
"X",
"document",
"."
] | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/core/Root.js#L13-L26 | |
38,367 | BEMQuery/bemquery-core | src/factory.js | factory | function factory( query, context = document ) {
const converter = bsc();
const selectorEngine = new SelectorEngine();
const bemQuery = new BEMQuery( query, context, converter, selectorEngine );
return bemQuery;
} | javascript | function factory( query, context = document ) {
const converter = bsc();
const selectorEngine = new SelectorEngine();
const bemQuery = new BEMQuery( query, context, converter, selectorEngine );
return bemQuery;
} | [
"function",
"factory",
"(",
"query",
",",
"context",
"=",
"document",
")",
"{",
"const",
"converter",
"=",
"bsc",
"(",
")",
";",
"const",
"selectorEngine",
"=",
"new",
"SelectorEngine",
"(",
")",
";",
"const",
"bemQuery",
"=",
"new",
"BEMQuery",
"(",
"qu... | BEMQuery instance factory.
@param {String|Iterable|HTMLElement} query Selector or
existing elements collection upon which the new elements collection
should be created.
@param {Document|HTMLElement|BEMQuery} context Context from which
elements should be fetched.
@return {BEMQuery} New BEMQuery instance. | [
"BEMQuery",
"instance",
"factory",
"."
] | 7c0627d5e038147ee304056bc724490be742f96c | https://github.com/BEMQuery/bemquery-core/blob/7c0627d5e038147ee304056bc724490be742f96c/src/factory.js#L17-L23 |
38,368 | deztopia/treenode | dist/treenode.js | addChild | function addChild(data) {
var child = new TreeNode(data, this);
if (!this.children) {
this.children = [];
}
this.children.push(child);
return child;
} | javascript | function addChild(data) {
var child = new TreeNode(data, this);
if (!this.children) {
this.children = [];
}
this.children.push(child);
return child;
} | [
"function",
"addChild",
"(",
"data",
")",
"{",
"var",
"child",
"=",
"new",
"TreeNode",
"(",
"data",
",",
"this",
")",
";",
"if",
"(",
"!",
"this",
".",
"children",
")",
"{",
"this",
".",
"children",
"=",
"[",
"]",
";",
"}",
"this",
".",
"children... | Add child. Returns the newly created child.
@param data
@returns {TreeNode} | [
"Add",
"child",
".",
"Returns",
"the",
"newly",
"created",
"child",
"."
] | 257f05fa97239b283e0ce31fa00cd1f634116ebf | https://github.com/deztopia/treenode/blob/257f05fa97239b283e0ce31fa00cd1f634116ebf/dist/treenode.js#L54-L61 |
38,369 | deztopia/treenode | dist/treenode.js | find | function find(data) {
if (data === this.data) {
return this;
}
if (this.children) {
for (var i = 0, _length = this.children.length, target = null; i < _length; i++) {
target = this.children[i].find(data);
... | javascript | function find(data) {
if (data === this.data) {
return this;
}
if (this.children) {
for (var i = 0, _length = this.children.length, target = null; i < _length; i++) {
target = this.children[i].find(data);
... | [
"function",
"find",
"(",
"data",
")",
"{",
"if",
"(",
"data",
"===",
"this",
".",
"data",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"this",
".",
"children",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"_length",
"=",
"this",
".",
... | Given a data object, returns the tree node containing it, if any. If not found, returns null.
@param data
@returns {TreeNode} || null | [
"Given",
"a",
"data",
"object",
"returns",
"the",
"tree",
"node",
"containing",
"it",
"if",
"any",
".",
"If",
"not",
"found",
"returns",
"null",
"."
] | 257f05fa97239b283e0ce31fa00cd1f634116ebf | https://github.com/deztopia/treenode/blob/257f05fa97239b283e0ce31fa00cd1f634116ebf/dist/treenode.js#L70-L85 |
38,370 | deztopia/treenode | dist/treenode.js | leaves | function leaves() {
if (!this.children || this.children.length === 0) {
// this is a leaf
return [this];
}
// if not a leaf, return all children's leaves recursively
var leaves = [];
if (this.childre... | javascript | function leaves() {
if (!this.children || this.children.length === 0) {
// this is a leaf
return [this];
}
// if not a leaf, return all children's leaves recursively
var leaves = [];
if (this.childre... | [
"function",
"leaves",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"children",
"||",
"this",
".",
"children",
".",
"length",
"===",
"0",
")",
"{",
"// this is a leaf",
"return",
"[",
"this",
"]",
";",
"}",
"// if not a leaf, return all children's leaves recursi... | Returns an array of all leaf nodes below this one.
@returns {Array} | [
"Returns",
"an",
"array",
"of",
"all",
"leaf",
"nodes",
"below",
"this",
"one",
"."
] | 257f05fa97239b283e0ce31fa00cd1f634116ebf | https://github.com/deztopia/treenode/blob/257f05fa97239b283e0ce31fa00cd1f634116ebf/dist/treenode.js#L93-L107 |
38,371 | deztopia/treenode | dist/treenode.js | forEach | function forEach(callback) {
if (typeof callback !== 'function') {
throw new TypeError('forEach() callback must be a function');
}
// run this node through function
callback(this);
// do the same for all children
... | javascript | function forEach(callback) {
if (typeof callback !== 'function') {
throw new TypeError('forEach() callback must be a function');
}
// run this node through function
callback(this);
// do the same for all children
... | [
"function",
"forEach",
"(",
"callback",
")",
"{",
"if",
"(",
"typeof",
"callback",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'forEach() callback must be a function'",
")",
";",
"}",
"// run this node through function",
"callback",
"(",
"this"... | Pass this node as a parameter to the given callback function. Iteratively pass each child as well.
Returns the current node afterwards.
@param callback A function which will take each node as a parameter.
@returns {TreeNode} | [
"Pass",
"this",
"node",
"as",
"a",
"parameter",
"to",
"the",
"given",
"callback",
"function",
".",
"Iteratively",
"pass",
"each",
"child",
"as",
"well",
".",
"Returns",
"the",
"current",
"node",
"afterwards",
"."
] | 257f05fa97239b283e0ce31fa00cd1f634116ebf | https://github.com/deztopia/treenode/blob/257f05fa97239b283e0ce31fa00cd1f634116ebf/dist/treenode.js#L131-L147 |
38,372 | WRidder/backgrid-advanced-filter | src/filter-editor.js | function() {
var self = this;
if (self.filter.get("valid")) {
self.$el.removeClass("invalidvalid");
self.$el.addClass("valid");
}
else {
self.$el.removeClass("valid");
self.$el.addClass("invalid");
}
} | javascript | function() {
var self = this;
if (self.filter.get("valid")) {
self.$el.removeClass("invalidvalid");
self.$el.addClass("valid");
}
else {
self.$el.removeClass("valid");
self.$el.addClass("invalid");
}
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"filter",
".",
"get",
"(",
"\"valid\"",
")",
")",
"{",
"self",
".",
"$el",
".",
"removeClass",
"(",
"\"invalidvalid\"",
")",
";",
"self",
".",
"$el",
".",
"addClass... | Adds an 'active' class to the view element if the attribute filter is valid.
@method setValidClass | [
"Adds",
"an",
"active",
"class",
"to",
"the",
"view",
"element",
"if",
"the",
"attribute",
"filter",
"is",
"valid",
"."
] | 5b10216f091d0e4bad418398fb4ec4c4588f4475 | https://github.com/WRidder/backgrid-advanced-filter/blob/5b10216f091d0e4bad418398fb4ec4c4588f4475/src/filter-editor.js#L805-L816 | |
38,373 | rootsdev/gedcomx-js | src/atom/AtomFeed.js | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof AtomFeed)){
return new AtomFeed(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(AtomFeed.isInstance(json)){
return json;... | javascript | function(json){
// Protect against forgetting the new keyword when calling the constructor
if(!(this instanceof AtomFeed)){
return new AtomFeed(json);
}
// If the given object is already an instance then just return it. DON'T copy it.
if(AtomFeed.isInstance(json)){
return json;... | [
"function",
"(",
"json",
")",
"{",
"// Protect against forgetting the new keyword when calling the constructor",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"AtomFeed",
")",
")",
"{",
"return",
"new",
"AtomFeed",
"(",
"json",
")",
";",
"}",
"// If the given object is a... | The Atom data formats provide a format for web content and metadata syndication.
The JSON data format is specific to GEDCOM X and is a translation to JSON from the XML.
@see {@link https://github.com/FamilySearch/gedcomx-rs/blob/master/specifications/atom-model-specification.md#atom-json-media-type|GEDCOM X Atom JSON ... | [
"The",
"Atom",
"data",
"formats",
"provide",
"a",
"format",
"for",
"web",
"content",
"and",
"metadata",
"syndication",
".",
"The",
"JSON",
"data",
"format",
"is",
"specific",
"to",
"GEDCOM",
"X",
"and",
"is",
"a",
"translation",
"to",
"JSON",
"from",
"the"... | 08b2fcde96f1e301c78561bfb7a8b0cac606e26e | https://github.com/rootsdev/gedcomx-js/blob/08b2fcde96f1e301c78561bfb7a8b0cac606e26e/src/atom/AtomFeed.js#L16-L29 | |
38,374 | szanata/padleft | padleft.js | pad | function pad(side, num, ch) {
var
exp = `${side === 'left' ? '' : '^'}.{${num}}${side === 'right' ? '' : '$'}`,
re = new RegExp(exp), pad = '';
do {
pad += ch;
} while(pad.length < num);
return re.exec( (side === 'left') ? (pad + this) : (this + pad) )[0];
} | javascript | function pad(side, num, ch) {
var
exp = `${side === 'left' ? '' : '^'}.{${num}}${side === 'right' ? '' : '$'}`,
re = new RegExp(exp), pad = '';
do {
pad += ch;
} while(pad.length < num);
return re.exec( (side === 'left') ? (pad + this) : (this + pad) )[0];
} | [
"function",
"pad",
"(",
"side",
",",
"num",
",",
"ch",
")",
"{",
"var",
"exp",
"=",
"`",
"${",
"side",
"===",
"'left'",
"?",
"''",
":",
"'^'",
"}",
"${",
"num",
"}",
"${",
"side",
"===",
"'right'",
"?",
"''",
":",
"'$'",
"}",
"`",
",",
"re",
... | pads some side | [
"pads",
"some",
"side"
] | 6c5cec4eef0ac203c8143c36e72779e0b05678a2 | https://github.com/szanata/padleft/blob/6c5cec4eef0ac203c8143c36e72779e0b05678a2/padleft.js#L4-L13 |
38,375 | imbo/imboclient-js | lib/client.js | ImboClient | function ImboClient(options, publicKey, privateKey) {
// Run a feature check, ensuring all required features are present
features.checkFeatures();
// Initialize options
var opts = this.options = {
hosts: parseUrls(options.hosts || options),
publicKey: options.publicKey || publicKey,
... | javascript | function ImboClient(options, publicKey, privateKey) {
// Run a feature check, ensuring all required features are present
features.checkFeatures();
// Initialize options
var opts = this.options = {
hosts: parseUrls(options.hosts || options),
publicKey: options.publicKey || publicKey,
... | [
"function",
"ImboClient",
"(",
"options",
",",
"publicKey",
",",
"privateKey",
")",
"{",
"// Run a feature check, ensuring all required features are present",
"features",
".",
"checkFeatures",
"(",
")",
";",
"// Initialize options",
"var",
"opts",
"=",
"this",
".",
"opt... | Constructs a new Imbo client
@param {Object} options
@param {String} publicKey
@param {String} privateKey
@throws Will throw an error if there are unsupported features | [
"Constructs",
"a",
"new",
"Imbo",
"client"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L34-L52 |
38,376 | imbo/imboclient-js | lib/client.js | function(file, callback) {
if (isBrowser && file instanceof window.File) {
// Browser File instance
return this.addImageFromBuffer(file, callback);
}
// File on filesystem. Note: the reason why we need the size of the file
// is because of reverse proxies like Va... | javascript | function(file, callback) {
if (isBrowser && file instanceof window.File) {
// Browser File instance
return this.addImageFromBuffer(file, callback);
}
// File on filesystem. Note: the reason why we need the size of the file
// is because of reverse proxies like Va... | [
"function",
"(",
"file",
",",
"callback",
")",
"{",
"if",
"(",
"isBrowser",
"&&",
"file",
"instanceof",
"window",
".",
"File",
")",
"{",
"// Browser File instance",
"return",
"this",
".",
"addImageFromBuffer",
"(",
"file",
",",
"callback",
")",
";",
"}",
"... | Add a new image to the server from a local file
@param {String|File} file - Path to the local image, or an instance of File
@param {Function} callback - Function to call when image has been uploaded
@return {ImboClient} | [
"Add",
"a",
"new",
"image",
"to",
"the",
"server",
"from",
"a",
"local",
"file"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L73-L104 | |
38,377 | imbo/imboclient-js | lib/client.js | function(source, callback) {
var url = this.getSignedResourceUrl('POST', this.getImagesUrl()),
isFile = isBrowser && source instanceof window.File,
onComplete = callback.onComplete || callback,
onProgress = callback.onProgress || null;
request({
method: '... | javascript | function(source, callback) {
var url = this.getSignedResourceUrl('POST', this.getImagesUrl()),
isFile = isBrowser && source instanceof window.File,
onComplete = callback.onComplete || callback,
onProgress = callback.onProgress || null;
request({
method: '... | [
"function",
"(",
"source",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"this",
".",
"getSignedResourceUrl",
"(",
"'POST'",
",",
"this",
".",
"getImagesUrl",
"(",
")",
")",
",",
"isFile",
"=",
"isBrowser",
"&&",
"source",
"instanceof",
"window",
".",
"F... | Add an image from a Buffer, String or File instance
@param {Buffer|ArrayBuffer|String|File} source
@param {Function} callback
@return {ImboClient} | [
"Add",
"an",
"image",
"from",
"a",
"Buffer",
"String",
"or",
"File",
"instance"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L113-L136 | |
38,378 | imbo/imboclient-js | lib/client.js | function(url, callback) {
if (isBrowser) {
// Browser environments can't pipe, so download the file and add it
return this.getImageDataFromUrl(url, function(err, data) {
if (err) {
return callback(err);
}
this.addImageF... | javascript | function(url, callback) {
if (isBrowser) {
// Browser environments can't pipe, so download the file and add it
return this.getImageDataFromUrl(url, function(err, data) {
if (err) {
return callback(err);
}
this.addImageF... | [
"function",
"(",
"url",
",",
"callback",
")",
"{",
"if",
"(",
"isBrowser",
")",
"{",
"// Browser environments can't pipe, so download the file and add it",
"return",
"this",
".",
"getImageDataFromUrl",
"(",
"url",
",",
"function",
"(",
"err",
",",
"data",
")",
"{"... | Add an image from a remote URL
@param {String} url
@param {Function} callback
@return {ImboClient} | [
"Add",
"an",
"image",
"from",
"a",
"remote",
"URL"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L145-L172 | |
38,379 | imbo/imboclient-js | lib/client.js | function(callback) {
request.get(this.getStatsUrl(), function(err, res, body) {
callback(err, body, res);
});
return this;
} | javascript | function(callback) {
request.get(this.getStatsUrl(), function(err, res, body) {
callback(err, body, res);
});
return this;
} | [
"function",
"(",
"callback",
")",
"{",
"request",
".",
"get",
"(",
"this",
".",
"getStatsUrl",
"(",
")",
",",
"function",
"(",
"err",
",",
"res",
",",
"body",
")",
"{",
"callback",
"(",
"err",
",",
"body",
",",
"res",
")",
";",
"}",
")",
";",
"... | Get the server statistics
@param {Function} callback
@return {ImboClient} | [
"Get",
"the",
"server",
"statistics"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L180-L186 | |
38,380 | imbo/imboclient-js | lib/client.js | function(callback) {
request.get(this.getStatusUrl(), function(err, res, body) {
if (err) {
return callback(err);
}
body = body || {};
body.status = res.statusCode;
body.date = new Date(body.date);
callback(err, body, res)... | javascript | function(callback) {
request.get(this.getStatusUrl(), function(err, res, body) {
if (err) {
return callback(err);
}
body = body || {};
body.status = res.statusCode;
body.date = new Date(body.date);
callback(err, body, res)... | [
"function",
"(",
"callback",
")",
"{",
"request",
".",
"get",
"(",
"this",
".",
"getStatusUrl",
"(",
")",
",",
"function",
"(",
"err",
",",
"res",
",",
"body",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
"(",
"err",
")",
";",
"}",... | Get the server status
@param {Function} callback
@return {ImboClient} | [
"Get",
"the",
"server",
"status"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L194-L208 | |
38,381 | imbo/imboclient-js | lib/client.js | function(callback) {
request.get(this.getUserUrl(), function(err, res, body) {
if (body && body.lastModified) {
body.lastModified = new Date(body.lastModified);
}
if (body && !body.user && body.publicKey) {
body.user = body.publicKey;
... | javascript | function(callback) {
request.get(this.getUserUrl(), function(err, res, body) {
if (body && body.lastModified) {
body.lastModified = new Date(body.lastModified);
}
if (body && !body.user && body.publicKey) {
body.user = body.publicKey;
... | [
"function",
"(",
"callback",
")",
"{",
"request",
".",
"get",
"(",
"this",
".",
"getUserUrl",
"(",
")",
",",
"function",
"(",
"err",
",",
"res",
",",
"body",
")",
"{",
"if",
"(",
"body",
"&&",
"body",
".",
"lastModified",
")",
"{",
"body",
".",
"... | Fetch the user info of the current user
@param {Function} callback
@return {ImboClient} | [
"Fetch",
"the",
"user",
"info",
"of",
"the",
"current",
"user"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L216-L230 | |
38,382 | imbo/imboclient-js | lib/client.js | function(imageIdentifier, callback) {
var url = this.getImageUrl(imageIdentifier, { usePrimaryHost: true }),
signedUrl = this.getSignedResourceUrl('DELETE', url);
request.del(signedUrl, callback);
return this;
} | javascript | function(imageIdentifier, callback) {
var url = this.getImageUrl(imageIdentifier, { usePrimaryHost: true }),
signedUrl = this.getSignedResourceUrl('DELETE', url);
request.del(signedUrl, callback);
return this;
} | [
"function",
"(",
"imageIdentifier",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"this",
".",
"getImageUrl",
"(",
"imageIdentifier",
",",
"{",
"usePrimaryHost",
":",
"true",
"}",
")",
",",
"signedUrl",
"=",
"this",
".",
"getSignedResourceUrl",
"(",
"'DELETE... | Delete an image
@param {String} imageIdentifier
@param {Function} callback
@return {ImboClient} | [
"Delete",
"an",
"image"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L239-L245 | |
38,383 | imbo/imboclient-js | lib/client.js | function(imageIdentifier, callback) {
this.headImage(imageIdentifier, function(err, res) {
if (err) {
return callback(err);
}
var headers = res.headers,
prefix = 'x-imbo-original';
callback(err, {
width: parseInt(h... | javascript | function(imageIdentifier, callback) {
this.headImage(imageIdentifier, function(err, res) {
if (err) {
return callback(err);
}
var headers = res.headers,
prefix = 'x-imbo-original';
callback(err, {
width: parseInt(h... | [
"function",
"(",
"imageIdentifier",
",",
"callback",
")",
"{",
"this",
".",
"headImage",
"(",
"imageIdentifier",
",",
"function",
"(",
"err",
",",
"res",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
"(",
"err",
")",
";",
"}",
"var",
"h... | Get properties about an image stored in Imbo
@param {String} imageIdentifier
@param {Function} callback
@return {ImboClient} | [
"Get",
"properties",
"about",
"an",
"image",
"stored",
"in",
"Imbo"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L254-L273 | |
38,384 | imbo/imboclient-js | lib/client.js | function(imageIdentifier, data, callback, method) {
var url = this.getMetadataUrl(imageIdentifier);
request({
method: method || 'POST',
uri: this.getSignedResourceUrl(method || 'POST', url),
json: data,
onComplete: function(err, res, body) {
... | javascript | function(imageIdentifier, data, callback, method) {
var url = this.getMetadataUrl(imageIdentifier);
request({
method: method || 'POST',
uri: this.getSignedResourceUrl(method || 'POST', url),
json: data,
onComplete: function(err, res, body) {
... | [
"function",
"(",
"imageIdentifier",
",",
"data",
",",
"callback",
",",
"method",
")",
"{",
"var",
"url",
"=",
"this",
".",
"getMetadataUrl",
"(",
"imageIdentifier",
")",
";",
"request",
"(",
"{",
"method",
":",
"method",
"||",
"'POST'",
",",
"uri",
":",
... | Edit metadata of an image
@param {String} imageIdentifier
@param {Object} data
@param {Function} callback
@param {String} method HTTP method to use (POST/PUT)
@return {ImboClient} | [
"Edit",
"metadata",
"of",
"an",
"image"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L284-L297 | |
38,385 | imbo/imboclient-js | lib/client.js | function(imageIdentifier, callback) {
request.get(this.getMetadataUrl(imageIdentifier), function(err, res, body) {
callback(err, body, res);
});
return this;
} | javascript | function(imageIdentifier, callback) {
request.get(this.getMetadataUrl(imageIdentifier), function(err, res, body) {
callback(err, body, res);
});
return this;
} | [
"function",
"(",
"imageIdentifier",
",",
"callback",
")",
"{",
"request",
".",
"get",
"(",
"this",
".",
"getMetadataUrl",
"(",
"imageIdentifier",
")",
",",
"function",
"(",
"err",
",",
"res",
",",
"body",
")",
"{",
"callback",
"(",
"err",
",",
"body",
... | Get metadata attached to an image
@param {String} imageIdentifier
@param {Function} callback
@return {ImboClient} | [
"Get",
"metadata",
"attached",
"to",
"an",
"image"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L318-L324 | |
38,386 | imbo/imboclient-js | lib/client.js | function(imageIdentifier, callback) {
var url = this.getMetadataUrl(imageIdentifier);
request.del(this.getSignedResourceUrl('DELETE', url), callback);
return this;
} | javascript | function(imageIdentifier, callback) {
var url = this.getMetadataUrl(imageIdentifier);
request.del(this.getSignedResourceUrl('DELETE', url), callback);
return this;
} | [
"function",
"(",
"imageIdentifier",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"this",
".",
"getMetadataUrl",
"(",
"imageIdentifier",
")",
";",
"request",
".",
"del",
"(",
"this",
".",
"getSignedResourceUrl",
"(",
"'DELETE'",
",",
"url",
")",
",",
"call... | Delete all metadata associated with an image
@param {String} imageIdentifier
@param {Function} callback
@return {ImboClient} | [
"Delete",
"all",
"metadata",
"associated",
"with",
"an",
"image"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L333-L338 | |
38,387 | imbo/imboclient-js | lib/client.js | function(query, callback) {
if (typeof query === 'function' && !callback) {
callback = query;
query = null;
}
// Fetch the response
request.get(this.getImagesUrl(query), function(err, res, body) {
callback(
err,
body &&... | javascript | function(query, callback) {
if (typeof query === 'function' && !callback) {
callback = query;
query = null;
}
// Fetch the response
request.get(this.getImagesUrl(query), function(err, res, body) {
callback(
err,
body &&... | [
"function",
"(",
"query",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"query",
"===",
"'function'",
"&&",
"!",
"callback",
")",
"{",
"callback",
"=",
"query",
";",
"query",
"=",
"null",
";",
"}",
"// Fetch the response",
"request",
".",
"get",
"(",
... | Get a list of images currently stored on the server,
and optionally provide a query to filter the results
@param {Query|Function} query - A query to use for filtering. If a function
is passed, it will be used as the callback
and the query will use default settings
@param {Function} callback
@return {ImboClient} | [
"Get",
"a",
"list",
"of",
"images",
"currently",
"stored",
"on",
"the",
"server",
"and",
"optionally",
"provide",
"a",
"query",
"to",
"filter",
"the",
"results"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L350-L367 | |
38,388 | imbo/imboclient-js | lib/client.js | function(imageIdentifier, options) {
if (typeof imageIdentifier !== 'string' || imageIdentifier.length === 0) {
throw new Error(
'`imageIdentifier` must be a non-empty string, was "' + imageIdentifier + '"' +
' (' + typeof imageIdentifier + ')'
);
... | javascript | function(imageIdentifier, options) {
if (typeof imageIdentifier !== 'string' || imageIdentifier.length === 0) {
throw new Error(
'`imageIdentifier` must be a non-empty string, was "' + imageIdentifier + '"' +
' (' + typeof imageIdentifier + ')'
);
... | [
"function",
"(",
"imageIdentifier",
",",
"options",
")",
"{",
"if",
"(",
"typeof",
"imageIdentifier",
"!==",
"'string'",
"||",
"imageIdentifier",
".",
"length",
"===",
"0",
")",
"{",
"throw",
"new",
"Error",
"(",
"'`imageIdentifier` must be a non-empty string, was \... | Get URL for the image resource
@param {String} imageIdentifier
@param {Object} [options]
@return {Imbo.ImageUrl} | [
"Get",
"URL",
"for",
"the",
"image",
"resource"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L433-L454 | |
38,389 | imbo/imboclient-js | lib/client.js | function(options) {
return new ImboUrl({
baseUrl: this.options.hosts[0],
user: typeof options.user !== 'undefined' ? options.user : this.options.user,
publicKey: this.options.publicKey,
privateKey: this.options.privateKey,
queryString: options.query,
... | javascript | function(options) {
return new ImboUrl({
baseUrl: this.options.hosts[0],
user: typeof options.user !== 'undefined' ? options.user : this.options.user,
publicKey: this.options.publicKey,
privateKey: this.options.privateKey,
queryString: options.query,
... | [
"function",
"(",
"options",
")",
"{",
"return",
"new",
"ImboUrl",
"(",
"{",
"baseUrl",
":",
"this",
".",
"options",
".",
"hosts",
"[",
"0",
"]",
",",
"user",
":",
"typeof",
"options",
".",
"user",
"!==",
"'undefined'",
"?",
"options",
".",
"user",
":... | Get URL for a resource
@param {Object} options
@return {Imbo.Url} | [
"Get",
"URL",
"for",
"a",
"resource"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L486-L495 | |
38,390 | imbo/imboclient-js | lib/client.js | function(imageIdentifier, callback) {
var url = this.getImageUrl(imageIdentifier).setPath('/shorturls'),
signed = this.getSignedResourceUrl('DELETE', url);
request.del(signed, callback);
return this;
} | javascript | function(imageIdentifier, callback) {
var url = this.getImageUrl(imageIdentifier).setPath('/shorturls'),
signed = this.getSignedResourceUrl('DELETE', url);
request.del(signed, callback);
return this;
} | [
"function",
"(",
"imageIdentifier",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"this",
".",
"getImageUrl",
"(",
"imageIdentifier",
")",
".",
"setPath",
"(",
"'/shorturls'",
")",
",",
"signed",
"=",
"this",
".",
"getSignedResourceUrl",
"(",
"'DELETE'",
","... | Delete all ShortUrls for a given imageIdentifier
@param {String} imageIdentifier
@param {Function} callback
@return {ImboClient} | [
"Delete",
"all",
"ShortUrls",
"for",
"a",
"given",
"imageIdentifier"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L549-L555 | |
38,391 | imbo/imboclient-js | lib/client.js | function(imageIdentifier, shortUrl, callback) {
var id = shortUrl instanceof ShortUrl ? shortUrl.getId() : shortUrl,
url = this.getImageUrl(imageIdentifier).setPath('/shorturls/' + id),
signed = this.getSignedResourceUrl('DELETE', url);
request.del(signed, callback);
ret... | javascript | function(imageIdentifier, shortUrl, callback) {
var id = shortUrl instanceof ShortUrl ? shortUrl.getId() : shortUrl,
url = this.getImageUrl(imageIdentifier).setPath('/shorturls/' + id),
signed = this.getSignedResourceUrl('DELETE', url);
request.del(signed, callback);
ret... | [
"function",
"(",
"imageIdentifier",
",",
"shortUrl",
",",
"callback",
")",
"{",
"var",
"id",
"=",
"shortUrl",
"instanceof",
"ShortUrl",
"?",
"shortUrl",
".",
"getId",
"(",
")",
":",
"shortUrl",
",",
"url",
"=",
"this",
".",
"getImageUrl",
"(",
"imageIdenti... | Delete a ShortUrl for a given imageIdentifier
@param {String} imageIdentifier
@param {String|Imbo.ShortUrl} shortUrl
@param {Function} callback
@return {ImboClient} | [
"Delete",
"a",
"ShortUrl",
"for",
"a",
"given",
"imageIdentifier"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L565-L572 | |
38,392 | imbo/imboclient-js | lib/client.js | function(imgPath, callback) {
this.getImageChecksum(imgPath, function(err, checksum) {
if (err) {
return callback(err);
}
this.imageWithChecksumExists(checksum, callback);
}.bind(this));
return this;
} | javascript | function(imgPath, callback) {
this.getImageChecksum(imgPath, function(err, checksum) {
if (err) {
return callback(err);
}
this.imageWithChecksumExists(checksum, callback);
}.bind(this));
return this;
} | [
"function",
"(",
"imgPath",
",",
"callback",
")",
"{",
"this",
".",
"getImageChecksum",
"(",
"imgPath",
",",
"function",
"(",
"err",
",",
"checksum",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
"(",
"err",
")",
";",
"}",
"this",
".",
... | Checks if a given image exists on the server
@param {String} imgPath
@param {Function} callback
@return {ImboClient} | [
"Checks",
"if",
"a",
"given",
"image",
"exists",
"on",
"the",
"server"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L595-L605 | |
38,393 | imbo/imboclient-js | lib/client.js | function(checksum, callback) {
var query = (new ImboQuery()).originalChecksums([checksum]).limit(1);
this.getImages(query, function(err, images, search) {
if (err) {
return callback(err);
}
var exists = search.hits > 0;
callback(err, exist... | javascript | function(checksum, callback) {
var query = (new ImboQuery()).originalChecksums([checksum]).limit(1);
this.getImages(query, function(err, images, search) {
if (err) {
return callback(err);
}
var exists = search.hits > 0;
callback(err, exist... | [
"function",
"(",
"checksum",
",",
"callback",
")",
"{",
"var",
"query",
"=",
"(",
"new",
"ImboQuery",
"(",
")",
")",
".",
"originalChecksums",
"(",
"[",
"checksum",
"]",
")",
".",
"limit",
"(",
"1",
")",
";",
"this",
".",
"getImages",
"(",
"query",
... | Checks if an image with the given MD5-sum exists on the server
@param {String} checksum
@param {Function} callback
@return {ImboClient} | [
"Checks",
"if",
"an",
"image",
"with",
"the",
"given",
"MD5",
"-",
"sum",
"exists",
"on",
"the",
"server"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L627-L639 | |
38,394 | imbo/imboclient-js | lib/client.js | function(callback) {
request.get(
this.getResourceUrl({ path: '/groups', user: null }),
function onResourceGroupsResponse(err, res, body) {
callback(
err,
body && body.groups,
body && body.search,
... | javascript | function(callback) {
request.get(
this.getResourceUrl({ path: '/groups', user: null }),
function onResourceGroupsResponse(err, res, body) {
callback(
err,
body && body.groups,
body && body.search,
... | [
"function",
"(",
"callback",
")",
"{",
"request",
".",
"get",
"(",
"this",
".",
"getResourceUrl",
"(",
"{",
"path",
":",
"'/groups'",
",",
"user",
":",
"null",
"}",
")",
",",
"function",
"onResourceGroupsResponse",
"(",
"err",
",",
"res",
",",
"body",
... | Fetch the resource groups available
@param {Function} callback
@return {ImboClient} | [
"Fetch",
"the",
"resource",
"groups",
"available"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L647-L660 | |
38,395 | imbo/imboclient-js | lib/client.js | function(groupName, callback) {
request.get(
this.getResourceUrl({ path: '/groups/' + groupName, user: null }),
function onResourceGroupResponse(err, res, body) {
callback(err, body && body.resources, res);
}
);
return this;
} | javascript | function(groupName, callback) {
request.get(
this.getResourceUrl({ path: '/groups/' + groupName, user: null }),
function onResourceGroupResponse(err, res, body) {
callback(err, body && body.resources, res);
}
);
return this;
} | [
"function",
"(",
"groupName",
",",
"callback",
")",
"{",
"request",
".",
"get",
"(",
"this",
".",
"getResourceUrl",
"(",
"{",
"path",
":",
"'/groups/'",
"+",
"groupName",
",",
"user",
":",
"null",
"}",
")",
",",
"function",
"onResourceGroupResponse",
"(",
... | Fetch a specific resource group
@param {String} groupName
@param {Function} callback
@return {ImboClient} | [
"Fetch",
"a",
"specific",
"resource",
"group"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L669-L677 | |
38,396 | imbo/imboclient-js | lib/client.js | function(groupName, resources, callback) {
this.resourceGroupExists(groupName, function onGroupExistsResponse(err, exists) {
if (err) {
return callback(err);
}
if (exists) {
return callback(new Error(
'Resource group `' + g... | javascript | function(groupName, resources, callback) {
this.resourceGroupExists(groupName, function onGroupExistsResponse(err, exists) {
if (err) {
return callback(err);
}
if (exists) {
return callback(new Error(
'Resource group `' + g... | [
"function",
"(",
"groupName",
",",
"resources",
",",
"callback",
")",
"{",
"this",
".",
"resourceGroupExists",
"(",
"groupName",
",",
"function",
"onGroupExistsResponse",
"(",
"err",
",",
"exists",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
... | Create a resource group, defining the resources that sohuld be available to it
@param {String} groupName
@param {Array} resources
@param {Function} callback
@return {ImboCflient} | [
"Create",
"a",
"resource",
"group",
"defining",
"the",
"resources",
"that",
"sohuld",
"be",
"available",
"to",
"it"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L687-L703 | |
38,397 | imbo/imboclient-js | lib/client.js | function(groupName, callback) {
var url = this.getResourceUrl({ path: '/groups/' + groupName, user: null });
request.del(this.getSignedResourceUrl('DELETE', url), callback);
return this;
} | javascript | function(groupName, callback) {
var url = this.getResourceUrl({ path: '/groups/' + groupName, user: null });
request.del(this.getSignedResourceUrl('DELETE', url), callback);
return this;
} | [
"function",
"(",
"groupName",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"this",
".",
"getResourceUrl",
"(",
"{",
"path",
":",
"'/groups/'",
"+",
"groupName",
",",
"user",
":",
"null",
"}",
")",
";",
"request",
".",
"del",
"(",
"this",
".",
"getSi... | Delete the resource group with the given name
@param {String} groupName Name of the group you want to delete
@param {Function} callback
@return {ImboClient} | [
"Delete",
"the",
"resource",
"group",
"with",
"the",
"given",
"name"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L734-L739 | |
38,398 | imbo/imboclient-js | lib/client.js | function(groupName, callback) {
request.head(
this.getResourceUrl({ path: '/groups/' + groupName, user: null }),
get404Handler(callback)
);
return this;
} | javascript | function(groupName, callback) {
request.head(
this.getResourceUrl({ path: '/groups/' + groupName, user: null }),
get404Handler(callback)
);
return this;
} | [
"function",
"(",
"groupName",
",",
"callback",
")",
"{",
"request",
".",
"head",
"(",
"this",
".",
"getResourceUrl",
"(",
"{",
"path",
":",
"'/groups/'",
"+",
"groupName",
",",
"user",
":",
"null",
"}",
")",
",",
"get404Handler",
"(",
"callback",
")",
... | Check whether a resource group exists or not
@param {String} groupName Name of the group you want to check for the presence of
@param {Function} callback
@return {ImboClient} | [
"Check",
"whether",
"a",
"resource",
"group",
"exists",
"or",
"not"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L748-L754 | |
38,399 | imbo/imboclient-js | lib/client.js | function(publicKey, callback) {
request.head(
this.getResourceUrl({ path: '/keys/' + publicKey, user: null }),
get404Handler(callback)
);
return this;
} | javascript | function(publicKey, callback) {
request.head(
this.getResourceUrl({ path: '/keys/' + publicKey, user: null }),
get404Handler(callback)
);
return this;
} | [
"function",
"(",
"publicKey",
",",
"callback",
")",
"{",
"request",
".",
"head",
"(",
"this",
".",
"getResourceUrl",
"(",
"{",
"path",
":",
"'/keys/'",
"+",
"publicKey",
",",
"user",
":",
"null",
"}",
")",
",",
"get404Handler",
"(",
"callback",
")",
")... | Check whether a public key exists or not
@param {String} publicKey Public key you want to check for the presence of
@param {Function} callback
@return {ImboClient} | [
"Check",
"whether",
"a",
"public",
"key",
"exists",
"or",
"not"
] | 809dcc489528dca9d67f49b03b612a99704339d0 | https://github.com/imbo/imboclient-js/blob/809dcc489528dca9d67f49b03b612a99704339d0/lib/client.js#L827-L833 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.