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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
36,200 | sven-piller/eslint-formatter-markdown | markdown.js | renderTemplate | function renderTemplate(type) {
var lcType = lodash.lowerCase(type);
if (lodash.size(stats[lcType])) {
return statsTemplate({
title: '### ' + type,
items: output(lcType)
});
} else {
return '';
}
} | javascript | function renderTemplate(type) {
var lcType = lodash.lowerCase(type);
if (lodash.size(stats[lcType])) {
return statsTemplate({
title: '### ' + type,
items: output(lcType)
});
} else {
return '';
}
} | [
"function",
"renderTemplate",
"(",
"type",
")",
"{",
"var",
"lcType",
"=",
"lodash",
".",
"lowerCase",
"(",
"type",
")",
";",
"if",
"(",
"lodash",
".",
"size",
"(",
"stats",
"[",
"lcType",
"]",
")",
")",
"{",
"return",
"statsTemplate",
"(",
"{",
"tit... | render template for severity
@param {string} type severity
@returns {string} template | [
"render",
"template",
"for",
"severity"
] | 46fc4cb074b1f599f02df67d814a6a83b37de060 | https://github.com/sven-piller/eslint-formatter-markdown/blob/46fc4cb074b1f599f02df67d814a6a83b37de060/markdown.js#L96-L106 |
36,201 | ILLGrenoble/guacamole-common-js | src/ArrayBufferWriter.js | __send_blob | function __send_blob(bytes) {
var binary = "";
// Produce binary string from bytes in buffer
for (var i=0; i<bytes.byteLength; i++)
binary += String.fromCharCode(bytes[i]);
// Send as base64
stream.sendBlob(window.btoa(binary));
} | javascript | function __send_blob(bytes) {
var binary = "";
// Produce binary string from bytes in buffer
for (var i=0; i<bytes.byteLength; i++)
binary += String.fromCharCode(bytes[i]);
// Send as base64
stream.sendBlob(window.btoa(binary));
} | [
"function",
"__send_blob",
"(",
"bytes",
")",
"{",
"var",
"binary",
"=",
"\"\"",
";",
"// Produce binary string from bytes in buffer",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"bytes",
".",
"byteLength",
";",
"i",
"++",
")",
"binary",
"+=",
"String... | Encodes the given data as base64, sending it as a blob. The data must
be small enough to fit into a single blob instruction.
@private
@param {Uint8Array} bytes The data to send. | [
"Encodes",
"the",
"given",
"data",
"as",
"base64",
"sending",
"it",
"as",
"a",
"blob",
".",
"The",
"data",
"must",
"be",
"small",
"enough",
"to",
"fit",
"into",
"a",
"single",
"blob",
"instruction",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/ArrayBufferWriter.js#L51-L62 |
36,202 | jorisvervuurt/JVSDisplayOTron | examples/dot3k/bar_graph.js | setBrightnessOfLed | function setBrightnessOfLed(callback) {
var ledIndex = 8;
var setBrightnessOfLedInterval = setInterval(function() {
if (ledIndex >= 0) {
dot3k.barGraph.setBrightnessOfLed(ledIndex, 0);
ledIndex--;
} else {
clearInterval(setBrightnessOfLedInte... | javascript | function setBrightnessOfLed(callback) {
var ledIndex = 8;
var setBrightnessOfLedInterval = setInterval(function() {
if (ledIndex >= 0) {
dot3k.barGraph.setBrightnessOfLed(ledIndex, 0);
ledIndex--;
} else {
clearInterval(setBrightnessOfLedInte... | [
"function",
"setBrightnessOfLed",
"(",
"callback",
")",
"{",
"var",
"ledIndex",
"=",
"8",
";",
"var",
"setBrightnessOfLedInterval",
"=",
"setInterval",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"ledIndex",
">=",
"0",
")",
"{",
"dot3k",
".",
"barGraph",
".... | Sets the brightness of each individual LED.
@param {Function} callback A function to call when the operation has finished. | [
"Sets",
"the",
"brightness",
"of",
"each",
"individual",
"LED",
"."
] | c8f9bfdbf4e2658bb12fc83bbf49853c938e7dcc | https://github.com/jorisvervuurt/JVSDisplayOTron/blob/c8f9bfdbf4e2658bb12fc83bbf49853c938e7dcc/examples/dot3k/bar_graph.js#L33-L49 |
36,203 | ascartabelli/lamb | src/privates/_getPadding.js | _getPadding | function _getPadding (source, char, len) {
if (!isNil(source) && type(source) !== "String") {
source = String(source);
}
return _repeat(String(char)[0] || "", Math.ceil(len - source.length));
} | javascript | function _getPadding (source, char, len) {
if (!isNil(source) && type(source) !== "String") {
source = String(source);
}
return _repeat(String(char)[0] || "", Math.ceil(len - source.length));
} | [
"function",
"_getPadding",
"(",
"source",
",",
"char",
",",
"len",
")",
"{",
"if",
"(",
"!",
"isNil",
"(",
"source",
")",
"&&",
"type",
"(",
"source",
")",
"!==",
"\"String\"",
")",
"{",
"source",
"=",
"String",
"(",
"source",
")",
";",
"}",
"retur... | Builds the prefix or suffix to be used when padding a string.
@private
@param {String} source
@param {String} char
@param {Number} len
@returns {String} | [
"Builds",
"the",
"prefix",
"or",
"suffix",
"to",
"be",
"used",
"when",
"padding",
"a",
"string",
"."
] | d36e45945c4789e4f1a2d8805936514b53f32362 | https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_getPadding.js#L13-L19 |
36,204 | paritytech/js-shared | src/redux/providers/tokensActions.js | fetchTokensData | function fetchTokensData (tokenRegContract, tokenIndexes) {
return (dispatch, getState) => {
const { api, tokens } = getState();
const allTokens = Object.values(tokens);
const tokensIndexesMap = allTokens
.reduce((map, token) => {
map[token.index] = token;
return map;
}, {});
... | javascript | function fetchTokensData (tokenRegContract, tokenIndexes) {
return (dispatch, getState) => {
const { api, tokens } = getState();
const allTokens = Object.values(tokens);
const tokensIndexesMap = allTokens
.reduce((map, token) => {
map[token.index] = token;
return map;
}, {});
... | [
"function",
"fetchTokensData",
"(",
"tokenRegContract",
",",
"tokenIndexes",
")",
"{",
"return",
"(",
"dispatch",
",",
"getState",
")",
"=>",
"{",
"const",
"{",
"api",
",",
"tokens",
"}",
"=",
"getState",
"(",
")",
";",
"const",
"allTokens",
"=",
"Object",... | Split the given token indexes between those for whom
we already have some info, and thus just need to fetch
the image, and those for whom we don't have anything and
need to fetch all the info. | [
"Split",
"the",
"given",
"token",
"indexes",
"between",
"those",
"for",
"whom",
"we",
"already",
"have",
"some",
"info",
"and",
"thus",
"just",
"need",
"to",
"fetch",
"the",
"image",
"and",
"those",
"for",
"whom",
"we",
"don",
"t",
"have",
"anything",
"a... | bb9593e4eb369ae8629f5056860f669692396f94 | https://github.com/paritytech/js-shared/blob/bb9593e4eb369ae8629f5056860f669692396f94/src/redux/providers/tokensActions.js#L188-L246 |
36,205 | ILLGrenoble/guacamole-common-js | src/Layer.js | resize | function resize(newWidth, newHeight) {
// Default size to zero
newWidth = newWidth || 0;
newHeight = newHeight || 0;
// Calculate new dimensions of internal canvas
var canvasWidth = Math.ceil(newWidth / CANVAS_SIZE_FACTOR) * CANVAS_SIZE_FACTOR;
var canvasHeight = Math... | javascript | function resize(newWidth, newHeight) {
// Default size to zero
newWidth = newWidth || 0;
newHeight = newHeight || 0;
// Calculate new dimensions of internal canvas
var canvasWidth = Math.ceil(newWidth / CANVAS_SIZE_FACTOR) * CANVAS_SIZE_FACTOR;
var canvasHeight = Math... | [
"function",
"resize",
"(",
"newWidth",
",",
"newHeight",
")",
"{",
"// Default size to zero",
"newWidth",
"=",
"newWidth",
"||",
"0",
";",
"newHeight",
"=",
"newHeight",
"||",
"0",
";",
"// Calculate new dimensions of internal canvas",
"var",
"canvasWidth",
"=",
"Ma... | Resizes the canvas element backing this Layer. This function should only
be used internally.
@private
@param {Number} [newWidth=0]
The new width to assign to this Layer.
@param {Number} [newHeight=0]
The new height to assign to this Layer. | [
"Resizes",
"the",
"canvas",
"element",
"backing",
"this",
"Layer",
".",
"This",
"function",
"should",
"only",
"be",
"used",
"internally",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Layer.js#L132-L193 |
36,206 | ILLGrenoble/guacamole-common-js | src/Layer.js | fitRect | function fitRect(x, y, w, h) {
// Calculate bounds
var opBoundX = w + x;
var opBoundY = h + y;
// Determine max width
var resizeWidth;
if (opBoundX > layer.width)
resizeWidth = opBoundX;
else
resizeWidth = layer.width;
... | javascript | function fitRect(x, y, w, h) {
// Calculate bounds
var opBoundX = w + x;
var opBoundY = h + y;
// Determine max width
var resizeWidth;
if (opBoundX > layer.width)
resizeWidth = opBoundX;
else
resizeWidth = layer.width;
... | [
"function",
"fitRect",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
"{",
"// Calculate bounds",
"var",
"opBoundX",
"=",
"w",
"+",
"x",
";",
"var",
"opBoundY",
"=",
"h",
"+",
"y",
";",
"// Determine max width",
"var",
"resizeWidth",
";",
"if",
"(",
"o... | Given the X and Y coordinates of the upper-left corner of a rectangle
and the rectangle's width and height, resize the backing canvas element
as necessary to ensure that the rectangle fits within the canvas
element's coordinate space. This function will only make the canvas
larger. If the rectangle already fits within ... | [
"Given",
"the",
"X",
"and",
"Y",
"coordinates",
"of",
"the",
"upper",
"-",
"left",
"corner",
"of",
"a",
"rectangle",
"and",
"the",
"rectangle",
"s",
"width",
"and",
"height",
"resize",
"the",
"backing",
"canvas",
"element",
"as",
"necessary",
"to",
"ensure... | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Layer.js#L211-L234 |
36,207 | aMarCruz/jspreproc | spec/uglify/riot.js | _mkdom | function _mkdom(templ, html) {
var match = templ && templ.match(/^\s*<([-\w]+)/),
tagName = match && match[1].toLowerCase(),
rootTag = rootEls[tagName] || GENERIC,
el = mkEl(rootTag)
el.stub = true
// replace all the yield tags with the tag inner html
if (html) templ = replaceYield(... | javascript | function _mkdom(templ, html) {
var match = templ && templ.match(/^\s*<([-\w]+)/),
tagName = match && match[1].toLowerCase(),
rootTag = rootEls[tagName] || GENERIC,
el = mkEl(rootTag)
el.stub = true
// replace all the yield tags with the tag inner html
if (html) templ = replaceYield(... | [
"function",
"_mkdom",
"(",
"templ",
",",
"html",
")",
"{",
"var",
"match",
"=",
"templ",
"&&",
"templ",
".",
"match",
"(",
"/",
"^\\s*<([-\\w]+)",
"/",
")",
",",
"tagName",
"=",
"match",
"&&",
"match",
"[",
"1",
"]",
".",
"toLowerCase",
"(",
")",
"... | creates any dom element in a div, table, or colgroup container | [
"creates",
"any",
"dom",
"element",
"in",
"a",
"div",
"table",
"or",
"colgroup",
"container"
] | 5f31820d702a329e8aa25f0f3983f13097610250 | https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/riot.js#L913-L932 |
36,208 | aMarCruz/jspreproc | spec/uglify/riot.js | update | function update(expressions, tag) {
each(expressions, function(expr, i) {
var dom = expr.dom,
attrName = expr.attr,
value = tmpl(expr.expr, tag),
parent = expr.dom.parentNode
if (expr.bool)
value = value ? attrName : false
else if (value == null)
value = ''
// leave o... | javascript | function update(expressions, tag) {
each(expressions, function(expr, i) {
var dom = expr.dom,
attrName = expr.attr,
value = tmpl(expr.expr, tag),
parent = expr.dom.parentNode
if (expr.bool)
value = value ? attrName : false
else if (value == null)
value = ''
// leave o... | [
"function",
"update",
"(",
"expressions",
",",
"tag",
")",
"{",
"each",
"(",
"expressions",
",",
"function",
"(",
"expr",
",",
"i",
")",
"{",
"var",
"dom",
"=",
"expr",
".",
"dom",
",",
"attrName",
"=",
"expr",
".",
"attr",
",",
"value",
"=",
"tmpl... | Update the expressions in a Tag instance
@param { Array } expressions - expression that must be re evaluated
@param { Tag } tag - tag instance | [
"Update",
"the",
"expressions",
"in",
"a",
"Tag",
"instance"
] | 5f31820d702a329e8aa25f0f3983f13097610250 | https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/riot.js#L1666-L1762 |
36,209 | aMarCruz/jspreproc | spec/uglify/riot.js | each | function each(els, fn) {
for (var i = 0, len = (els || []).length, el; i < len; i++) {
el = els[i]
// return false -> remove current item during loop
if (el != null && fn(el, i) === false) i--
}
return els
} | javascript | function each(els, fn) {
for (var i = 0, len = (els || []).length, el; i < len; i++) {
el = els[i]
// return false -> remove current item during loop
if (el != null && fn(el, i) === false) i--
}
return els
} | [
"function",
"each",
"(",
"els",
",",
"fn",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"(",
"els",
"||",
"[",
"]",
")",
".",
"length",
",",
"el",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"el",
"=",
"els",
"[",
"i... | Loops an array
@param { Array } els - collection of items
@param {Function} fn - callback function
@returns { Array } the array looped | [
"Loops",
"an",
"array"
] | 5f31820d702a329e8aa25f0f3983f13097610250 | https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/riot.js#L1769-L1776 |
36,210 | aMarCruz/jspreproc | spec/uglify/riot.js | addChildTag | function addChildTag(tag, tagName, parent) {
var cachedTag = parent.tags[tagName]
// if there are multiple children tags having the same name
if (cachedTag) {
// if the parent tags property is not yet an array
// create it adding the first cached tag
if (!isArray(cachedTag))
// don't add the sa... | javascript | function addChildTag(tag, tagName, parent) {
var cachedTag = parent.tags[tagName]
// if there are multiple children tags having the same name
if (cachedTag) {
// if the parent tags property is not yet an array
// create it adding the first cached tag
if (!isArray(cachedTag))
// don't add the sa... | [
"function",
"addChildTag",
"(",
"tag",
",",
"tagName",
",",
"parent",
")",
"{",
"var",
"cachedTag",
"=",
"parent",
".",
"tags",
"[",
"tagName",
"]",
"// if there are multiple children tags having the same name",
"if",
"(",
"cachedTag",
")",
"{",
"// if the parent ta... | Add a child tag to its parent into the `tags` object
@param { Object } tag - child tag instance
@param { String } tagName - key where the new tag will be stored
@param { Object } parent - tag instance where the new child tag will be included | [
"Add",
"a",
"child",
"tag",
"to",
"its",
"parent",
"into",
"the",
"tags",
"object"
] | 5f31820d702a329e8aa25f0f3983f13097610250 | https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/riot.js#L1841-L1858 |
36,211 | aMarCruz/jspreproc | spec/uglify/riot.js | isWritable | function isWritable(obj, key) {
var props = Object.getOwnPropertyDescriptor(obj, key)
return typeof obj[key] === T_UNDEF || props && props.writable
} | javascript | function isWritable(obj, key) {
var props = Object.getOwnPropertyDescriptor(obj, key)
return typeof obj[key] === T_UNDEF || props && props.writable
} | [
"function",
"isWritable",
"(",
"obj",
",",
"key",
")",
"{",
"var",
"props",
"=",
"Object",
".",
"getOwnPropertyDescriptor",
"(",
"obj",
",",
"key",
")",
"return",
"typeof",
"obj",
"[",
"key",
"]",
"===",
"T_UNDEF",
"||",
"props",
"&&",
"props",
".",
"w... | Detect whether a property of an object could be overridden
@param { Object } obj - source object
@param { String } key - object property
@returns { Boolean } is this property writable? | [
"Detect",
"whether",
"a",
"property",
"of",
"an",
"object",
"could",
"be",
"overridden"
] | 5f31820d702a329e8aa25f0f3983f13097610250 | https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/riot.js#L2004-L2007 |
36,212 | aMarCruz/jspreproc | spec/uglify/riot.js | isInStub | function isInStub(dom) {
while (dom) {
if (dom.inStub) return true
dom = dom.parentNode
}
return false
} | javascript | function isInStub(dom) {
while (dom) {
if (dom.inStub) return true
dom = dom.parentNode
}
return false
} | [
"function",
"isInStub",
"(",
"dom",
")",
"{",
"while",
"(",
"dom",
")",
"{",
"if",
"(",
"dom",
".",
"inStub",
")",
"return",
"true",
"dom",
"=",
"dom",
".",
"parentNode",
"}",
"return",
"false",
"}"
] | Check whether a DOM node is in stub mode, useful for the riot 'if' directive
@param { Object } dom - DOM node we want to parse
@returns { Boolean } - | [
"Check",
"whether",
"a",
"DOM",
"node",
"is",
"in",
"stub",
"mode",
"useful",
"for",
"the",
"riot",
"if",
"directive"
] | 5f31820d702a329e8aa25f0f3983f13097610250 | https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/riot.js#L2066-L2072 |
36,213 | aMarCruz/jspreproc | spec/uglify/riot.js | setNamed | function setNamed(dom, parent, keys) {
// get the key value we want to add to the tag instance
var key = getNamedKey(dom),
isArr,
// add the node detected to a tag instance using the named property
add = function(value) {
// avoid to override the tag properties already set
if (contains(keys,... | javascript | function setNamed(dom, parent, keys) {
// get the key value we want to add to the tag instance
var key = getNamedKey(dom),
isArr,
// add the node detected to a tag instance using the named property
add = function(value) {
// avoid to override the tag properties already set
if (contains(keys,... | [
"function",
"setNamed",
"(",
"dom",
",",
"parent",
",",
"keys",
")",
"{",
"// get the key value we want to add to the tag instance",
"var",
"key",
"=",
"getNamedKey",
"(",
"dom",
")",
",",
"isArr",
",",
"// add the node detected to a tag instance using the named property",
... | Set the named properties of a tag element
@param { Object } dom - DOM node we need to parse
@param { Object } parent - tag instance where the named dom element will be eventually added
@param { Array } keys - list of all the tag instance properties | [
"Set",
"the",
"named",
"properties",
"of",
"a",
"tag",
"element"
] | 5f31820d702a329e8aa25f0f3983f13097610250 | https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/riot.js#L2129-L2166 |
36,214 | aMarCruz/jspreproc | spec/uglify/riot.js | function(value) {
// avoid to override the tag properties already set
if (contains(keys, key)) return
// check whether this value is an array
isArr = isArray(value)
// if the key was never set
if (!value)
// set it once on the tag instance
parent[key] = dom
// i... | javascript | function(value) {
// avoid to override the tag properties already set
if (contains(keys, key)) return
// check whether this value is an array
isArr = isArray(value)
// if the key was never set
if (!value)
// set it once on the tag instance
parent[key] = dom
// i... | [
"function",
"(",
"value",
")",
"{",
"// avoid to override the tag properties already set",
"if",
"(",
"contains",
"(",
"keys",
",",
"key",
")",
")",
"return",
"// check whether this value is an array",
"isArr",
"=",
"isArray",
"(",
"value",
")",
"// if the key was never... | get the key value we want to add to the tag instance | [
"get",
"the",
"key",
"value",
"we",
"want",
"to",
"add",
"to",
"the",
"tag",
"instance"
] | 5f31820d702a329e8aa25f0f3983f13097610250 | https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/riot.js#L2134-L2151 | |
36,215 | fin-hypergrid/grouped-header-plugin | index.js | isColumnReorderable | function isColumnReorderable() {
var originalMethodFromPrototype = Object.getPrototypeOf(this).isColumnReorderable,
isReorderable = originalMethodFromPrototype.call(this),
groupedHeaderCellRenderer = this.grid.cellRenderers.get(CLASS_NAME),
delimiter = groupedHeaderCellRenderer.delimiter;
... | javascript | function isColumnReorderable() {
var originalMethodFromPrototype = Object.getPrototypeOf(this).isColumnReorderable,
isReorderable = originalMethodFromPrototype.call(this),
groupedHeaderCellRenderer = this.grid.cellRenderers.get(CLASS_NAME),
delimiter = groupedHeaderCellRenderer.delimiter;
... | [
"function",
"isColumnReorderable",
"(",
")",
"{",
"var",
"originalMethodFromPrototype",
"=",
"Object",
".",
"getPrototypeOf",
"(",
"this",
")",
".",
"isColumnReorderable",
",",
"isReorderable",
"=",
"originalMethodFromPrototype",
".",
"call",
"(",
"this",
")",
",",
... | Prevent column moving when there are any grouped headers.
@returns {boolean}
@memberOf groupedHeader
@inner | [
"Prevent",
"column",
"moving",
"when",
"there",
"are",
"any",
"grouped",
"headers",
"."
] | c73214e72242e2d0a2687f9dffa359a68e323be0 | https://github.com/fin-hypergrid/grouped-header-plugin/blob/c73214e72242e2d0a2687f9dffa359a68e323be0/index.js#L299-L312 |
36,216 | athombv/node-linux-device | lib/Compat.js | utilCallbackAfterPromise | function utilCallbackAfterPromise(self, func, args, cb) {
args = Array.prototype.slice.apply(args);
let lastarg = args.pop();
if(!cb) cb = lastarg;
func.apply(self, args).then(res => {
try {
cb(null, res);
} catch(e) {
process.nextTick(() => { throw e });
}
}).catch((err) => {
try {
cb(err);
} c... | javascript | function utilCallbackAfterPromise(self, func, args, cb) {
args = Array.prototype.slice.apply(args);
let lastarg = args.pop();
if(!cb) cb = lastarg;
func.apply(self, args).then(res => {
try {
cb(null, res);
} catch(e) {
process.nextTick(() => { throw e });
}
}).catch((err) => {
try {
cb(err);
} c... | [
"function",
"utilCallbackAfterPromise",
"(",
"self",
",",
"func",
",",
"args",
",",
"cb",
")",
"{",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
"args",
")",
";",
"let",
"lastarg",
"=",
"args",
".",
"pop",
"(",
")",
";",
... | Strips the callback argument, and calls the function without, then invokes the callback when the promise returns | [
"Strips",
"the",
"callback",
"argument",
"and",
"calls",
"the",
"function",
"without",
"then",
"invokes",
"the",
"callback",
"when",
"the",
"promise",
"returns"
] | 43ce13c5718d5ee0d0f0424f5541c28fd4882b3c | https://github.com/athombv/node-linux-device/blob/43ce13c5718d5ee0d0f0424f5541c28fd4882b3c/lib/Compat.js#L7-L24 |
36,217 | ILLGrenoble/guacamole-common-js | src/OnScreenKeyboard.js | removeClass | function removeClass(element, classname) {
// If classList supported, use that
if (element.classList)
element.classList.remove(classname);
// Otherwise, manually filter out classes with given name
else {
element.className = element.className.replace(/([^ ]+)[ ]*... | javascript | function removeClass(element, classname) {
// If classList supported, use that
if (element.classList)
element.classList.remove(classname);
// Otherwise, manually filter out classes with given name
else {
element.className = element.className.replace(/([^ ]+)[ ]*... | [
"function",
"removeClass",
"(",
"element",
",",
"classname",
")",
"{",
"// If classList supported, use that",
"if",
"(",
"element",
".",
"classList",
")",
"element",
".",
"classList",
".",
"remove",
"(",
"classname",
")",
";",
"// Otherwise, manually filter out classe... | Removes a CSS class from an element.
@private
@function
@param {Element} element
The element to remove a class from.
@param {String} classname
The name of the class to remove. | [
"Removes",
"a",
"CSS",
"class",
"from",
"an",
"element",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L106-L128 |
36,218 | ILLGrenoble/guacamole-common-js | src/OnScreenKeyboard.js | modifiersPressed | function modifiersPressed(names) {
// If any required modifiers are not pressed, return false
for (var i=0; i < names.length; i++) {
// Test whether current modifier is pressed
var name = names[i];
if (!(name in modifierKeysyms))
return false;
... | javascript | function modifiersPressed(names) {
// If any required modifiers are not pressed, return false
for (var i=0; i < names.length; i++) {
// Test whether current modifier is pressed
var name = names[i];
if (!(name in modifierKeysyms))
return false;
... | [
"function",
"modifiersPressed",
"(",
"names",
")",
"{",
"// If any required modifiers are not pressed, return false",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"names",
".",
"length",
";",
"i",
"++",
")",
"{",
"// Test whether current modifier is pressed",
"v... | Returns whether all modifiers having the given names are currently
active.
@private
@param {String[]} names
The names of all modifiers to test.
@returns {Boolean}
true if all specified modifiers are pressed, false otherwise. | [
"Returns",
"whether",
"all",
"modifiers",
"having",
"the",
"given",
"names",
"are",
"currently",
"active",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L223-L238 |
36,219 | ILLGrenoble/guacamole-common-js | src/OnScreenKeyboard.js | press | function press(keyName, keyElement) {
// Press key if not yet pressed
if (!pressed[keyName]) {
addClass(keyElement, "guac-keyboard-pressed");
// Get current key based on modifier state
var key = getActiveKey(keyName);
// Update modifier state
... | javascript | function press(keyName, keyElement) {
// Press key if not yet pressed
if (!pressed[keyName]) {
addClass(keyElement, "guac-keyboard-pressed");
// Get current key based on modifier state
var key = getActiveKey(keyName);
// Update modifier state
... | [
"function",
"press",
"(",
"keyName",
",",
"keyElement",
")",
"{",
"// Press key if not yet pressed",
"if",
"(",
"!",
"pressed",
"[",
"keyName",
"]",
")",
"{",
"addClass",
"(",
"keyElement",
",",
"\"guac-keyboard-pressed\"",
")",
";",
"// Get current key based on mod... | Presses the key having the given name, updating the associated key
element with the "guac-keyboard-pressed" CSS class. If the key is
already pressed, this function has no effect.
@private
@param {String} keyName
The name of the key to press.
@param {String} keyElement
The element associated with the given key. | [
"Presses",
"the",
"key",
"having",
"the",
"given",
"name",
"updating",
"the",
"associated",
"key",
"element",
"with",
"the",
"guac",
"-",
"keyboard",
"-",
"pressed",
"CSS",
"class",
".",
"If",
"the",
"key",
"is",
"already",
"pressed",
"this",
"function",
"... | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L290-L344 |
36,220 | ILLGrenoble/guacamole-common-js | src/OnScreenKeyboard.js | release | function release(keyName, keyElement) {
// Release key if currently pressed
if (pressed[keyName]) {
removeClass(keyElement, "guac-keyboard-pressed");
// Get current key based on modifier state
var key = getActiveKey(keyName);
// Send key event if not a... | javascript | function release(keyName, keyElement) {
// Release key if currently pressed
if (pressed[keyName]) {
removeClass(keyElement, "guac-keyboard-pressed");
// Get current key based on modifier state
var key = getActiveKey(keyName);
// Send key event if not a... | [
"function",
"release",
"(",
"keyName",
",",
"keyElement",
")",
"{",
"// Release key if currently pressed",
"if",
"(",
"pressed",
"[",
"keyName",
"]",
")",
"{",
"removeClass",
"(",
"keyElement",
",",
"\"guac-keyboard-pressed\"",
")",
";",
"// Get current key based on m... | Releases the key having the given name, removing the
"guac-keyboard-pressed" CSS class from the associated element. If the
key is already released, this function has no effect.
@private
@param {String} keyName
The name of the key to release.
@param {String} keyElement
The element associated with the given key. | [
"Releases",
"the",
"key",
"having",
"the",
"given",
"name",
"removing",
"the",
"guac",
"-",
"keyboard",
"-",
"pressed",
"CSS",
"class",
"from",
"the",
"associated",
"element",
".",
"If",
"the",
"key",
"is",
"already",
"released",
"this",
"function",
"has",
... | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L358-L377 |
36,221 | ILLGrenoble/guacamole-common-js | src/OnScreenKeyboard.js | getKeys | function getKeys(keys) {
var keyArrays = {};
// Coerce all keys into individual key arrays
for (var name in layout.keys) {
keyArrays[name] = asKeyArray(name, keys[name]);
}
return keyArrays;
} | javascript | function getKeys(keys) {
var keyArrays = {};
// Coerce all keys into individual key arrays
for (var name in layout.keys) {
keyArrays[name] = asKeyArray(name, keys[name]);
}
return keyArrays;
} | [
"function",
"getKeys",
"(",
"keys",
")",
"{",
"var",
"keyArrays",
"=",
"{",
"}",
";",
"// Coerce all keys into individual key arrays",
"for",
"(",
"var",
"name",
"in",
"layout",
".",
"keys",
")",
"{",
"keyArrays",
"[",
"name",
"]",
"=",
"asKeyArray",
"(",
... | Converts the rather forgiving key mapping allowed by
Guacamole.OnScreenKeyboard.Layout into a rigorous mapping of key name
to key definition, where the key definition is always an array of Key
objects.
@private
@param {Object.<String, Number|String|Guacamole.OnScreenKeyboard.Key|Guacamole.OnScreenKeyboard.Key[]>} keys... | [
"Converts",
"the",
"rather",
"forgiving",
"key",
"mapping",
"allowed",
"by",
"Guacamole",
".",
"OnScreenKeyboard",
".",
"Layout",
"into",
"a",
"rigorous",
"mapping",
"of",
"key",
"name",
"to",
"key",
"definition",
"where",
"the",
"key",
"definition",
"is",
"al... | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L535-L546 |
36,222 | ILLGrenoble/guacamole-common-js | src/OnScreenKeyboard.js | getCSSName | function getCSSName(name) {
// Convert name from possibly-CamelCase to hyphenated lowercase
var cssName = name
.replace(/([a-z])([A-Z])/g, '$1-$2')
.replace(/[^A-Za-z0-9]+/g, '-')
.toLowerCase();
return cssName;
} | javascript | function getCSSName(name) {
// Convert name from possibly-CamelCase to hyphenated lowercase
var cssName = name
.replace(/([a-z])([A-Z])/g, '$1-$2')
.replace(/[^A-Za-z0-9]+/g, '-')
.toLowerCase();
return cssName;
} | [
"function",
"getCSSName",
"(",
"name",
")",
"{",
"// Convert name from possibly-CamelCase to hyphenated lowercase",
"var",
"cssName",
"=",
"name",
".",
"replace",
"(",
"/",
"([a-z])([A-Z])",
"/",
"g",
",",
"'$1-$2'",
")",
".",
"replace",
"(",
"/",
"[^A-Za-z0-9]+",
... | Given an arbitrary string representing the name of some component of the
on-screen keyboard, returns a string formatted for use as a CSS class
name. The result will be lowercase. Word boundaries previously denoted
by CamelCase will be replaced by individual hyphens, as will all
contiguous non-alphanumeric characters.
... | [
"Given",
"an",
"arbitrary",
"string",
"representing",
"the",
"name",
"of",
"some",
"component",
"of",
"the",
"on",
"-",
"screen",
"keyboard",
"returns",
"a",
"string",
"formatted",
"for",
"use",
"as",
"a",
"CSS",
"class",
"name",
".",
"The",
"result",
"wil... | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L571-L581 |
36,223 | ILLGrenoble/guacamole-common-js | src/OnScreenKeyboard.js | touchPress | function touchPress(e) {
e.preventDefault();
ignoreMouse = osk.touchMouseThreshold;
press(object, keyElement);
} | javascript | function touchPress(e) {
e.preventDefault();
ignoreMouse = osk.touchMouseThreshold;
press(object, keyElement);
} | [
"function",
"touchPress",
"(",
"e",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"ignoreMouse",
"=",
"osk",
".",
"touchMouseThreshold",
";",
"press",
"(",
"object",
",",
"keyElement",
")",
";",
"}"
] | Handles a touch event which results in the pressing of an OSK
key. Touch events will result in mouse events being ignored for
touchMouseThreshold events.
@private
@param {TouchEvent} e
The touch event being handled. | [
"Handles",
"a",
"touch",
"event",
"which",
"results",
"in",
"the",
"pressing",
"of",
"an",
"OSK",
"key",
".",
"Touch",
"events",
"will",
"result",
"in",
"mouse",
"events",
"being",
"ignored",
"for",
"touchMouseThreshold",
"events",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L726-L730 |
36,224 | ILLGrenoble/guacamole-common-js | src/OnScreenKeyboard.js | touchRelease | function touchRelease(e) {
e.preventDefault();
ignoreMouse = osk.touchMouseThreshold;
release(object, keyElement);
} | javascript | function touchRelease(e) {
e.preventDefault();
ignoreMouse = osk.touchMouseThreshold;
release(object, keyElement);
} | [
"function",
"touchRelease",
"(",
"e",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"ignoreMouse",
"=",
"osk",
".",
"touchMouseThreshold",
";",
"release",
"(",
"object",
",",
"keyElement",
")",
";",
"}"
] | Handles a touch event which results in the release of an OSK
key. Touch events will result in mouse events being ignored for
touchMouseThreshold events.
@private
@param {TouchEvent} e
The touch event being handled. | [
"Handles",
"a",
"touch",
"event",
"which",
"results",
"in",
"the",
"release",
"of",
"an",
"OSK",
"key",
".",
"Touch",
"events",
"will",
"result",
"in",
"mouse",
"events",
"being",
"ignored",
"for",
"touchMouseThreshold",
"events",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L741-L745 |
36,225 | Twipped/QueryizeJS | lib/mutators.js | _makeJoiner | function _makeJoiner (type) {
return function (clause, options) {
if (isQueryizeObject(clause)) {
if (typeof options !== 'object') throw new Error('You must define join options when joining against a queryize subquery.');
options = Object.create(options);
options.table = clause;
clause = options;
} el... | javascript | function _makeJoiner (type) {
return function (clause, options) {
if (isQueryizeObject(clause)) {
if (typeof options !== 'object') throw new Error('You must define join options when joining against a queryize subquery.');
options = Object.create(options);
options.table = clause;
clause = options;
} el... | [
"function",
"_makeJoiner",
"(",
"type",
")",
"{",
"return",
"function",
"(",
"clause",
",",
"options",
")",
"{",
"if",
"(",
"isQueryizeObject",
"(",
"clause",
")",
")",
"{",
"if",
"(",
"typeof",
"options",
"!==",
"'object'",
")",
"throw",
"new",
"Error",... | Generates the closures for innerJoin, leftJoin and rightJoin
@private
@param {string} type Join type
@return {function} | [
"Generates",
"the",
"closures",
"for",
"innerJoin",
"leftJoin",
"and",
"rightJoin"
] | fdee3e8900f6a95419b88056916577f9b0067c93 | https://github.com/Twipped/QueryizeJS/blob/fdee3e8900f6a95419b88056916577f9b0067c93/lib/mutators.js#L1189-L1216 |
36,226 | Twipped/QueryizeJS | lib/mutators.js | flatten | function flatten (input, includingObjects) {
var result = [];
function descend (level) {
if (isArray(level)) {
level.forEach(descend);
} else if (typeof level === 'object' && includingObjects) {
Object.keys(level).forEach(function (key) {
descend(level[key]);
});
} else {
result.push(level);
... | javascript | function flatten (input, includingObjects) {
var result = [];
function descend (level) {
if (isArray(level)) {
level.forEach(descend);
} else if (typeof level === 'object' && includingObjects) {
Object.keys(level).forEach(function (key) {
descend(level[key]);
});
} else {
result.push(level);
... | [
"function",
"flatten",
"(",
"input",
",",
"includingObjects",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"function",
"descend",
"(",
"level",
")",
"{",
"if",
"(",
"isArray",
"(",
"level",
")",
")",
"{",
"level",
".",
"forEach",
"(",
"descend",
")... | Flattens a nested array into a single level array
@private
@param {Array} input The top level array to flatten
@param {boolean} [includingObjects=false] If an object is encountered and this argument is truthy, the object will also be flattened by its property values.
@return {Array} | [
"Flattens",
"a",
"nested",
"array",
"into",
"a",
"single",
"level",
"array"
] | fdee3e8900f6a95419b88056916577f9b0067c93 | https://github.com/Twipped/QueryizeJS/blob/fdee3e8900f6a95419b88056916577f9b0067c93/lib/mutators.js#L1922-L1940 |
36,227 | Twipped/QueryizeJS | lib/mutators.js | mysqlDate | function mysqlDate (input) {
var date = new Date(input.getTime());
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());
var y = date.getFullYear();
var m = ('0' + (date.getMonth() + 1)).substr(-2);
var d = ('0' + date.getDate()).substr(-2);
var h = ('0' + date.getHours()).substr(-2);
var i = ('0' + da... | javascript | function mysqlDate (input) {
var date = new Date(input.getTime());
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());
var y = date.getFullYear();
var m = ('0' + (date.getMonth() + 1)).substr(-2);
var d = ('0' + date.getDate()).substr(-2);
var h = ('0' + date.getHours()).substr(-2);
var i = ('0' + da... | [
"function",
"mysqlDate",
"(",
"input",
")",
"{",
"var",
"date",
"=",
"new",
"Date",
"(",
"input",
".",
"getTime",
"(",
")",
")",
";",
"date",
".",
"setMinutes",
"(",
"date",
".",
"getMinutes",
"(",
")",
"+",
"date",
".",
"getTimezoneOffset",
"(",
")"... | Formats a Date object into a MySQL DATETIME
@param {Date} date [description]
@private
@return {string} [description] | [
"Formats",
"a",
"Date",
"object",
"into",
"a",
"MySQL",
"DATETIME"
] | fdee3e8900f6a95419b88056916577f9b0067c93 | https://github.com/Twipped/QueryizeJS/blob/fdee3e8900f6a95419b88056916577f9b0067c93/lib/mutators.js#L1948-L1960 |
36,228 | Twipped/QueryizeJS | lib/mutators.js | arrayFromArguments | function arrayFromArguments () {
var len = arguments.length;
var args = new Array(len);
for (var i = 0; i < len; ++i) {
args[i] = arguments[i];
}
return args;
} | javascript | function arrayFromArguments () {
var len = arguments.length;
var args = new Array(len);
for (var i = 0; i < len; ++i) {
args[i] = arguments[i];
}
return args;
} | [
"function",
"arrayFromArguments",
"(",
")",
"{",
"var",
"len",
"=",
"arguments",
".",
"length",
";",
"var",
"args",
"=",
"new",
"Array",
"(",
"len",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"ar... | Helper function to convert arguments to an array without triggering de-optimization in V8
MUST be called via .apply
@private
@return {Array<mixed>} | [
"Helper",
"function",
"to",
"convert",
"arguments",
"to",
"an",
"array",
"without",
"triggering",
"de",
"-",
"optimization",
"in",
"V8",
"MUST",
"be",
"called",
"via",
".",
"apply"
] | fdee3e8900f6a95419b88056916577f9b0067c93 | https://github.com/Twipped/QueryizeJS/blob/fdee3e8900f6a95419b88056916577f9b0067c93/lib/mutators.js#L1968-L1975 |
36,229 | latentflip/base32-crockford-browser | dist/base32.js | function() {
var table = {}
// Invert 'alphabet'
for (var i = 0; i < alphabet.length; i++) {
table[alphabet[i]] = i
}
// Splice in 'alias'
for (var key in alias) {
if (!alias.hasOwnProperty(key)) continue
table[key] = table['' + alias[key]]
}
lookup = function() {... | javascript | function() {
var table = {}
// Invert 'alphabet'
for (var i = 0; i < alphabet.length; i++) {
table[alphabet[i]] = i
}
// Splice in 'alias'
for (var key in alias) {
if (!alias.hasOwnProperty(key)) continue
table[key] = table['' + alias[key]]
}
lookup = function() {... | [
"function",
"(",
")",
"{",
"var",
"table",
"=",
"{",
"}",
"// Invert 'alphabet'",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"alphabet",
".",
"length",
";",
"i",
"++",
")",
"{",
"table",
"[",
"alphabet",
"[",
"i",
"]",
"]",
"=",
"i",
"}",... | Build a lookup table and memoize it
Return an object that maps a character to its
byte value. | [
"Build",
"a",
"lookup",
"table",
"and",
"memoize",
"it"
] | 6ae0826cc89838fc935160e8547edf77f6690858 | https://github.com/latentflip/base32-crockford-browser/blob/6ae0826cc89838fc935160e8547edf77f6690858/dist/base32.js#L16-L29 | |
36,230 | latentflip/base32-crockford-browser | dist/base32.js | Encoder | function Encoder() {
var skip = 0 // how many bits we will skip from the first byte
var bits = 0 // 5 high bits, carry from one byte to the next
this.output = ''
// Read one byte of input
// Should not really be used except by "update"
this.readByte = function(byte) {
// coerce the byt... | javascript | function Encoder() {
var skip = 0 // how many bits we will skip from the first byte
var bits = 0 // 5 high bits, carry from one byte to the next
this.output = ''
// Read one byte of input
// Should not really be used except by "update"
this.readByte = function(byte) {
// coerce the byt... | [
"function",
"Encoder",
"(",
")",
"{",
"var",
"skip",
"=",
"0",
"// how many bits we will skip from the first byte",
"var",
"bits",
"=",
"0",
"// 5 high bits, carry from one byte to the next",
"this",
".",
"output",
"=",
"''",
"// Read one byte of input",
"// Should not real... | A streaming encoder
var encoder = new base32.Encoder()
var output1 = encoder.update(input1)
var output2 = encoder.update(input2)
var lastoutput = encode.update(lastinput, true) | [
"A",
"streaming",
"encoder"
] | 6ae0826cc89838fc935160e8547edf77f6690858 | https://github.com/latentflip/base32-crockford-browser/blob/6ae0826cc89838fc935160e8547edf77f6690858/dist/base32.js#L40-L79 |
36,231 | latentflip/base32-crockford-browser | dist/base32.js | Decoder | function Decoder() {
var skip = 0 // how many bits we have from the previous character
var byte = 0 // current byte we're producing
this.output = ''
// Consume a character from the stream, store
// the output in this.output. As before, better
// to use update().
this.readChar = function(ch... | javascript | function Decoder() {
var skip = 0 // how many bits we have from the previous character
var byte = 0 // current byte we're producing
this.output = ''
// Consume a character from the stream, store
// the output in this.output. As before, better
// to use update().
this.readChar = function(ch... | [
"function",
"Decoder",
"(",
")",
"{",
"var",
"skip",
"=",
"0",
"// how many bits we have from the previous character",
"var",
"byte",
"=",
"0",
"// current byte we're producing",
"this",
".",
"output",
"=",
"''",
"// Consume a character from the stream, store",
"// the outp... | Functions analogously to Encoder | [
"Functions",
"analogously",
"to",
"Encoder"
] | 6ae0826cc89838fc935160e8547edf77f6690858 | https://github.com/latentflip/base32-crockford-browser/blob/6ae0826cc89838fc935160e8547edf77f6690858/dist/base32.js#L105-L145 |
36,232 | latentflip/base32-crockford-browser | dist/base32.js | decode | function decode(input) {
var decoder = new Decoder()
var output = decoder.update(input, true)
return output
} | javascript | function decode(input) {
var decoder = new Decoder()
var output = decoder.update(input, true)
return output
} | [
"function",
"decode",
"(",
"input",
")",
"{",
"var",
"decoder",
"=",
"new",
"Decoder",
"(",
")",
"var",
"output",
"=",
"decoder",
".",
"update",
"(",
"input",
",",
"true",
")",
"return",
"output",
"}"
] | Base32-encoded string goes in, decoded data comes out. | [
"Base32",
"-",
"encoded",
"string",
"goes",
"in",
"decoded",
"data",
"comes",
"out",
"."
] | 6ae0826cc89838fc935160e8547edf77f6690858 | https://github.com/latentflip/base32-crockford-browser/blob/6ae0826cc89838fc935160e8547edf77f6690858/dist/base32.js#L173-L177 |
36,233 | delian/node-amfutils | amfUtils.js | amf3decUI29 | function amf3decUI29(buf) {
var val = 0;
var len = 1;
var b;
do {
b = buf.readUInt8(len++);
val = (val << 7) + (b & 0x7F);
} while (len < 5 || b > 0x7F);
if (len == 5) val = val | b; // Preserve the major bit of the last byte
return { len: len, value: val }
} | javascript | function amf3decUI29(buf) {
var val = 0;
var len = 1;
var b;
do {
b = buf.readUInt8(len++);
val = (val << 7) + (b & 0x7F);
} while (len < 5 || b > 0x7F);
if (len == 5) val = val | b; // Preserve the major bit of the last byte
return { len: len, value: val }
} | [
"function",
"amf3decUI29",
"(",
"buf",
")",
"{",
"var",
"val",
"=",
"0",
";",
"var",
"len",
"=",
"1",
";",
"var",
"b",
";",
"do",
"{",
"b",
"=",
"buf",
".",
"readUInt8",
"(",
"len",
"++",
")",
";",
"val",
"=",
"(",
"val",
"<<",
"7",
")",
"+... | Generic decode of AMF3 UInt29 values
@param buf
@returns {{len: number, value: number}} | [
"Generic",
"decode",
"of",
"AMF3",
"UInt29",
"values"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L178-L191 |
36,234 | delian/node-amfutils | amfUtils.js | amf3encUI29 | function amf3encUI29(num) {
var len = 0;
if (num < 0x80) len = 1;
if (num < 0x4000) len = 2;
if (num < 0x200000) len = 3;
if (num >= 0x200000) len = 4;
var buf = new Buffer(len);
switch (len) {
case 1:
buf.writeUInt8(num, 0);
break;
case 2:
... | javascript | function amf3encUI29(num) {
var len = 0;
if (num < 0x80) len = 1;
if (num < 0x4000) len = 2;
if (num < 0x200000) len = 3;
if (num >= 0x200000) len = 4;
var buf = new Buffer(len);
switch (len) {
case 1:
buf.writeUInt8(num, 0);
break;
case 2:
... | [
"function",
"amf3encUI29",
"(",
"num",
")",
"{",
"var",
"len",
"=",
"0",
";",
"if",
"(",
"num",
"<",
"0x80",
")",
"len",
"=",
"1",
";",
"if",
"(",
"num",
"<",
"0x4000",
")",
"len",
"=",
"2",
";",
"if",
"(",
"num",
"<",
"0x200000",
")",
"len",... | Generic encode of AMF3 UInt29 value
@param num
@returns {Buffer} | [
"Generic",
"encode",
"of",
"AMF3",
"UInt29",
"value"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L198-L226 |
36,235 | delian/node-amfutils | amfUtils.js | amf3decInteger | function amf3decInteger(buf) { // Invert the integer
var resp = amf3decUI29(buf);
if (resp.value > 0x0FFFFFFF) resp.value = (resp.value & 0x0FFFFFFF) - 0x10000000;
return resp;
} | javascript | function amf3decInteger(buf) { // Invert the integer
var resp = amf3decUI29(buf);
if (resp.value > 0x0FFFFFFF) resp.value = (resp.value & 0x0FFFFFFF) - 0x10000000;
return resp;
} | [
"function",
"amf3decInteger",
"(",
"buf",
")",
"{",
"// Invert the integer",
"var",
"resp",
"=",
"amf3decUI29",
"(",
"buf",
")",
";",
"if",
"(",
"resp",
".",
"value",
">",
"0x0FFFFFFF",
")",
"resp",
".",
"value",
"=",
"(",
"resp",
".",
"value",
"&",
"0... | AMF3 Decode an integer
@param buf
@returns {{len: number, value: number}} | [
"AMF3",
"Decode",
"an",
"integer"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L233-L237 |
36,236 | delian/node-amfutils | amfUtils.js | amf3encInteger | function amf3encInteger(num) {
var buf = new Buffer(1);
buf.writeUInt8(0x4, 0);
return Buffer.concat([buf, amf3encUI29(num & 0x3FFFFFFF)]); // This AND will auto convert the sign bit!
} | javascript | function amf3encInteger(num) {
var buf = new Buffer(1);
buf.writeUInt8(0x4, 0);
return Buffer.concat([buf, amf3encUI29(num & 0x3FFFFFFF)]); // This AND will auto convert the sign bit!
} | [
"function",
"amf3encInteger",
"(",
"num",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"1",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x4",
",",
"0",
")",
";",
"return",
"Buffer",
".",
"concat",
"(",
"[",
"buf",
",",
"amf3encUI29",
"(",
"num"... | AMF3 Encode an integer
@param num
@returns {Buffer} | [
"AMF3",
"Encode",
"an",
"integer"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L244-L248 |
36,237 | delian/node-amfutils | amfUtils.js | amf3decXmlDoc | function amf3decXmlDoc(buf) {
var sLen = amf3decUI29(buf);
var s = sLen & 1;
sLen = sLen >> 1; // The real length without the lowest bit
if (s) return { len: sLen.value + 5, value: buf.slice(5, sLen.value + 5).toString('utf8') };
throw new Error("Error, we have a need to decode a String that is a Re... | javascript | function amf3decXmlDoc(buf) {
var sLen = amf3decUI29(buf);
var s = sLen & 1;
sLen = sLen >> 1; // The real length without the lowest bit
if (s) return { len: sLen.value + 5, value: buf.slice(5, sLen.value + 5).toString('utf8') };
throw new Error("Error, we have a need to decode a String that is a Re... | [
"function",
"amf3decXmlDoc",
"(",
"buf",
")",
"{",
"var",
"sLen",
"=",
"amf3decUI29",
"(",
"buf",
")",
";",
"var",
"s",
"=",
"sLen",
"&",
"1",
";",
"sLen",
"=",
"sLen",
">>",
"1",
";",
"// The real length without the lowest bit",
"if",
"(",
"s",
")",
"... | AMF3 Decode XMLDoc
@param buf
@returns {{len: *, value: (*|String)}} | [
"AMF3",
"Decode",
"XMLDoc"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L280-L286 |
36,238 | delian/node-amfutils | amfUtils.js | amf3encXmlDoc | function amf3encXmlDoc(str) {
var sLen = amf3encUI29(str.length << 1);
var buf = new Buffer(1);
buf.writeUInt8(0x7, 0);
return Buffer.concat([buf, sLen, new Buffer(str, 'utf8')]);
} | javascript | function amf3encXmlDoc(str) {
var sLen = amf3encUI29(str.length << 1);
var buf = new Buffer(1);
buf.writeUInt8(0x7, 0);
return Buffer.concat([buf, sLen, new Buffer(str, 'utf8')]);
} | [
"function",
"amf3encXmlDoc",
"(",
"str",
")",
"{",
"var",
"sLen",
"=",
"amf3encUI29",
"(",
"str",
".",
"length",
"<<",
"1",
")",
";",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"1",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x7",
",",
"0",
")",
";"... | AMF3 Encode XMLDoc
@param str
@returns {Buffer} | [
"AMF3",
"Encode",
"XMLDoc"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L293-L298 |
36,239 | delian/node-amfutils | amfUtils.js | amf3decByteArray | function amf3decByteArray(buf) {
var sLen = amf3decUI29(buf);
var s = sLen & 1; // TODO: Check if we follow the same rule!
sLen = sLen >> 1; // The real length without the lowest bit
if (s) return { len: sLen.value + 5, value: buf.slice(5, sLen.value + 5) };
throw new Error("Error, we have a need to... | javascript | function amf3decByteArray(buf) {
var sLen = amf3decUI29(buf);
var s = sLen & 1; // TODO: Check if we follow the same rule!
sLen = sLen >> 1; // The real length without the lowest bit
if (s) return { len: sLen.value + 5, value: buf.slice(5, sLen.value + 5) };
throw new Error("Error, we have a need to... | [
"function",
"amf3decByteArray",
"(",
"buf",
")",
"{",
"var",
"sLen",
"=",
"amf3decUI29",
"(",
"buf",
")",
";",
"var",
"s",
"=",
"sLen",
"&",
"1",
";",
"// TODO: Check if we follow the same rule!",
"sLen",
"=",
"sLen",
">>",
"1",
";",
"// The real length withou... | AMF3 Decide Byte Array
@param buf
@returns {{len: *, value: (Array|string|*|Buffer|Blob)}} | [
"AMF3",
"Decide",
"Byte",
"Array"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L330-L336 |
36,240 | delian/node-amfutils | amfUtils.js | amf3encDouble | function amf3encDouble(num) {
var buf = new Buffer(9);
buf.writeUInt8(0x05, 0);
buf.writeDoubleBE(num, 1);
return buf;
} | javascript | function amf3encDouble(num) {
var buf = new Buffer(9);
buf.writeUInt8(0x05, 0);
buf.writeDoubleBE(num, 1);
return buf;
} | [
"function",
"amf3encDouble",
"(",
"num",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"9",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x05",
",",
"0",
")",
";",
"buf",
".",
"writeDoubleBE",
"(",
"num",
",",
"1",
")",
";",
"return",
"buf",
";... | AMF3 Encode Double
@param num
@returns {Buffer} | [
"AMF3",
"Encode",
"Double"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L364-L369 |
36,241 | delian/node-amfutils | amfUtils.js | amf3decDate | function amf3decDate(buf) { // The UI29 should be 1
var uTz = amf3decUI29(buf);
var ts = buf.readDoubleBE(uTz.len);
return { len: uTz.len + 8, value: ts }
} | javascript | function amf3decDate(buf) { // The UI29 should be 1
var uTz = amf3decUI29(buf);
var ts = buf.readDoubleBE(uTz.len);
return { len: uTz.len + 8, value: ts }
} | [
"function",
"amf3decDate",
"(",
"buf",
")",
"{",
"// The UI29 should be 1",
"var",
"uTz",
"=",
"amf3decUI29",
"(",
"buf",
")",
";",
"var",
"ts",
"=",
"buf",
".",
"readDoubleBE",
"(",
"uTz",
".",
"len",
")",
";",
"return",
"{",
"len",
":",
"uTz",
".",
... | AMF3 Decode Date
@param buf
@returns {{len: *, value: (*|Number)}} | [
"AMF3",
"Decode",
"Date"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L376-L380 |
36,242 | delian/node-amfutils | amfUtils.js | amf3encDate | function amf3encDate(ts) {
var buf = new Buffer(1);
buf.writeUInt8(0x8, 0);
var tsBuf = new Buffer(8);
tsBuf.writeDoubleBE(ts, 0);
return Buffer.concat([buf, amf3encUI29(1), tsBuf]); // We always do 1
} | javascript | function amf3encDate(ts) {
var buf = new Buffer(1);
buf.writeUInt8(0x8, 0);
var tsBuf = new Buffer(8);
tsBuf.writeDoubleBE(ts, 0);
return Buffer.concat([buf, amf3encUI29(1), tsBuf]); // We always do 1
} | [
"function",
"amf3encDate",
"(",
"ts",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"1",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x8",
",",
"0",
")",
";",
"var",
"tsBuf",
"=",
"new",
"Buffer",
"(",
"8",
")",
";",
"tsBuf",
".",
"writeDouble... | AMF3 Encode Date
@param ts
@returns {Buffer} | [
"AMF3",
"Encode",
"Date"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L387-L393 |
36,243 | delian/node-amfutils | amfUtils.js | amf3decArray | function amf3decArray(buf) {
var count = amf3decUI29(buf.slice(1));
var obj = amf3decObject(buf.slice(count.len));
if (count.value % 2 == 1) throw new Error("This is a reference to another array, which currently we don't support!");
return { len: count.len + obj.len, value: obj.value }
} | javascript | function amf3decArray(buf) {
var count = amf3decUI29(buf.slice(1));
var obj = amf3decObject(buf.slice(count.len));
if (count.value % 2 == 1) throw new Error("This is a reference to another array, which currently we don't support!");
return { len: count.len + obj.len, value: obj.value }
} | [
"function",
"amf3decArray",
"(",
"buf",
")",
"{",
"var",
"count",
"=",
"amf3decUI29",
"(",
"buf",
".",
"slice",
"(",
"1",
")",
")",
";",
"var",
"obj",
"=",
"amf3decObject",
"(",
"buf",
".",
"slice",
"(",
"count",
".",
"len",
")",
")",
";",
"if",
... | AMF3 Decode Array
@param buf
@returns {{len: *, value: *}} | [
"AMF3",
"Decode",
"Array"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L400-L405 |
36,244 | delian/node-amfutils | amfUtils.js | amf0encNumber | function amf0encNumber(num) {
var buf = new Buffer(9);
buf.writeUInt8(0x00, 0);
buf.writeDoubleBE(num, 1);
return buf;
} | javascript | function amf0encNumber(num) {
var buf = new Buffer(9);
buf.writeUInt8(0x00, 0);
buf.writeDoubleBE(num, 1);
return buf;
} | [
"function",
"amf0encNumber",
"(",
"num",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"9",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x00",
",",
"0",
")",
";",
"buf",
".",
"writeDoubleBE",
"(",
"num",
",",
"1",
")",
";",
"return",
"buf",
";... | AMF0 Encode Number
@param num
@returns {Buffer} | [
"AMF0",
"Encode",
"Number"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L446-L451 |
36,245 | delian/node-amfutils | amfUtils.js | amf0encBool | function amf0encBool(num) {
var buf = new Buffer(2);
buf.writeUInt8(0x01, 0);
buf.writeUInt8((num ? 1 : 0), 1);
return buf;
} | javascript | function amf0encBool(num) {
var buf = new Buffer(2);
buf.writeUInt8(0x01, 0);
buf.writeUInt8((num ? 1 : 0), 1);
return buf;
} | [
"function",
"amf0encBool",
"(",
"num",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"2",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x01",
",",
"0",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"(",
"num",
"?",
"1",
":",
"0",
")",
",",
"1",
... | AMF0 Encode Boolean
@param num
@returns {Buffer} | [
"AMF0",
"Encode",
"Boolean"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L467-L472 |
36,246 | delian/node-amfutils | amfUtils.js | amf0encDate | function amf0encDate(ts) {
var buf = new Buffer(11);
buf.writeUInt8(0x0B, 0);
buf.writeInt16BE(0, 1);
buf.writeDoubleBE(ts, 3);
return buf;
} | javascript | function amf0encDate(ts) {
var buf = new Buffer(11);
buf.writeUInt8(0x0B, 0);
buf.writeInt16BE(0, 1);
buf.writeDoubleBE(ts, 3);
return buf;
} | [
"function",
"amf0encDate",
"(",
"ts",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"11",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x0B",
",",
"0",
")",
";",
"buf",
".",
"writeInt16BE",
"(",
"0",
",",
"1",
")",
";",
"buf",
".",
"writeDouble... | AMF0 Encode Date
@param ts
@returns {Buffer} | [
"AMF0",
"Encode",
"Date"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L526-L532 |
36,247 | delian/node-amfutils | amfUtils.js | amf0decObject | function amf0decObject(buf) { // TODO: Implement references!
var obj = {};
var iBuf = buf.slice(1);
var len = 1;
// console.log('ODec',iBuf.readUInt8(0));
while (iBuf.readUInt8(0) != 0x09) {
// console.log('Field', iBuf.readUInt8(0), iBuf);
var prop = amf0decUString(iBuf);
// ... | javascript | function amf0decObject(buf) { // TODO: Implement references!
var obj = {};
var iBuf = buf.slice(1);
var len = 1;
// console.log('ODec',iBuf.readUInt8(0));
while (iBuf.readUInt8(0) != 0x09) {
// console.log('Field', iBuf.readUInt8(0), iBuf);
var prop = amf0decUString(iBuf);
// ... | [
"function",
"amf0decObject",
"(",
"buf",
")",
"{",
"// TODO: Implement references!",
"var",
"obj",
"=",
"{",
"}",
";",
"var",
"iBuf",
"=",
"buf",
".",
"slice",
"(",
"1",
")",
";",
"var",
"len",
"=",
"1",
";",
"// console.log('ODec',iBuf.readUInt8(0));",
"... | AMF0 Decode Object
@param buf
@returns {{len: number, value: {}}} | [
"AMF0",
"Decode",
"Object"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L539-L562 |
36,248 | delian/node-amfutils | amfUtils.js | amf0encObject | function amf0encObject(o) {
if (typeof o !== 'object') return;
var data = new Buffer(1);
data.writeUInt8(0x03,0); // Type object
var k;
for (k in o) {
data = Buffer.concat([data,amf0encUString(k),amf0EncodeOne(o[k])]);
}
var termCode = new Buffer(1);
termCode.writeUInt8(0x09,0);... | javascript | function amf0encObject(o) {
if (typeof o !== 'object') return;
var data = new Buffer(1);
data.writeUInt8(0x03,0); // Type object
var k;
for (k in o) {
data = Buffer.concat([data,amf0encUString(k),amf0EncodeOne(o[k])]);
}
var termCode = new Buffer(1);
termCode.writeUInt8(0x09,0);... | [
"function",
"amf0encObject",
"(",
"o",
")",
"{",
"if",
"(",
"typeof",
"o",
"!==",
"'object'",
")",
"return",
";",
"var",
"data",
"=",
"new",
"Buffer",
"(",
"1",
")",
";",
"data",
".",
"writeUInt8",
"(",
"0x03",
",",
"0",
")",
";",
"// Type object",
... | AMF0 Encode Object | [
"AMF0",
"Encode",
"Object"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L567-L579 |
36,249 | delian/node-amfutils | amfUtils.js | amf0encRef | function amf0encRef(index) {
var buf = new Buffer(3);
buf.writeUInt8(0x07, 0);
buf.writeUInt16BE(index, 1);
return buf;
} | javascript | function amf0encRef(index) {
var buf = new Buffer(3);
buf.writeUInt8(0x07, 0);
buf.writeUInt16BE(index, 1);
return buf;
} | [
"function",
"amf0encRef",
"(",
"index",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"3",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x07",
",",
"0",
")",
";",
"buf",
".",
"writeUInt16BE",
"(",
"index",
",",
"1",
")",
";",
"return",
"buf",
"... | AMF0 Encode Reference
@param index
@returns {Buffer} | [
"AMF0",
"Encode",
"Reference"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L596-L601 |
36,250 | delian/node-amfutils | amfUtils.js | amf0decString | function amf0decString(buf) {
var sLen = buf.readUInt16BE(1);
return { len: 3 + sLen, value: buf.toString('utf8', 3, 3 + sLen) }
} | javascript | function amf0decString(buf) {
var sLen = buf.readUInt16BE(1);
return { len: 3 + sLen, value: buf.toString('utf8', 3, 3 + sLen) }
} | [
"function",
"amf0decString",
"(",
"buf",
")",
"{",
"var",
"sLen",
"=",
"buf",
".",
"readUInt16BE",
"(",
"1",
")",
";",
"return",
"{",
"len",
":",
"3",
"+",
"sLen",
",",
"value",
":",
"buf",
".",
"toString",
"(",
"'utf8'",
",",
"3",
",",
"3",
"+",... | AMF0 Decode String
@param buf
@returns {{len: *, value: (*|string|String)}} | [
"AMF0",
"Decode",
"String"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L608-L611 |
36,251 | delian/node-amfutils | amfUtils.js | amf0encUString | function amf0encUString(s) {
var data = new Buffer(s,'utf8');
var sLen = new Buffer(2);
sLen.writeUInt16BE(data.length,0);
return Buffer.concat([sLen,data]);
} | javascript | function amf0encUString(s) {
var data = new Buffer(s,'utf8');
var sLen = new Buffer(2);
sLen.writeUInt16BE(data.length,0);
return Buffer.concat([sLen,data]);
} | [
"function",
"amf0encUString",
"(",
"s",
")",
"{",
"var",
"data",
"=",
"new",
"Buffer",
"(",
"s",
",",
"'utf8'",
")",
";",
"var",
"sLen",
"=",
"new",
"Buffer",
"(",
"2",
")",
";",
"sLen",
".",
"writeUInt16BE",
"(",
"data",
".",
"length",
",",
"0",
... | Do AMD0 Encode of Untyped String
@param s
@returns {Buffer} | [
"Do",
"AMD0",
"Encode",
"of",
"Untyped",
"String"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L628-L633 |
36,252 | delian/node-amfutils | amfUtils.js | amf0encString | function amf0encString(str) {
var buf = new Buffer(3);
buf.writeUInt8(0x02, 0);
buf.writeUInt16BE(str.length, 1);
return Buffer.concat([buf, new Buffer(str, 'utf8')]);
} | javascript | function amf0encString(str) {
var buf = new Buffer(3);
buf.writeUInt8(0x02, 0);
buf.writeUInt16BE(str.length, 1);
return Buffer.concat([buf, new Buffer(str, 'utf8')]);
} | [
"function",
"amf0encString",
"(",
"str",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"3",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x02",
",",
"0",
")",
";",
"buf",
".",
"writeUInt16BE",
"(",
"str",
".",
"length",
",",
"1",
")",
";",
"ret... | AMF0 Encode String
@param str
@returns {Buffer} | [
"AMF0",
"Encode",
"String"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L640-L645 |
36,253 | delian/node-amfutils | amfUtils.js | amf0decLongString | function amf0decLongString(buf) {
var sLen = buf.readUInt32BE(1);
return { len: 5 + sLen, value: buf.toString('utf8', 5, 5 + sLen) }
} | javascript | function amf0decLongString(buf) {
var sLen = buf.readUInt32BE(1);
return { len: 5 + sLen, value: buf.toString('utf8', 5, 5 + sLen) }
} | [
"function",
"amf0decLongString",
"(",
"buf",
")",
"{",
"var",
"sLen",
"=",
"buf",
".",
"readUInt32BE",
"(",
"1",
")",
";",
"return",
"{",
"len",
":",
"5",
"+",
"sLen",
",",
"value",
":",
"buf",
".",
"toString",
"(",
"'utf8'",
",",
"5",
",",
"5",
... | AMF0 Decode Long String
@param buf
@returns {{len: *, value: (*|string|String)}} | [
"AMF0",
"Decode",
"Long",
"String"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L652-L655 |
36,254 | delian/node-amfutils | amfUtils.js | amf0encLongString | function amf0encLongString(str) {
var buf = new Buffer(5);
buf.writeUInt8(0x0C, 0);
buf.writeUInt32BE(str.length, 1);
return Buffer.concat([buf, new Buffer(str, 'utf8')]);
} | javascript | function amf0encLongString(str) {
var buf = new Buffer(5);
buf.writeUInt8(0x0C, 0);
buf.writeUInt32BE(str.length, 1);
return Buffer.concat([buf, new Buffer(str, 'utf8')]);
} | [
"function",
"amf0encLongString",
"(",
"str",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"5",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x0C",
",",
"0",
")",
";",
"buf",
".",
"writeUInt32BE",
"(",
"str",
".",
"length",
",",
"1",
")",
";",
... | AMF0 Encode Long String
@param str
@returns {Buffer} | [
"AMF0",
"Encode",
"Long",
"String"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L662-L667 |
36,255 | delian/node-amfutils | amfUtils.js | amf0decArray | function amf0decArray(buf) {
// var count = buf.readUInt32BE(1);
var obj = amf0decObject(buf.slice(4));
return { len: 5 + obj.len, value: obj.value }
} | javascript | function amf0decArray(buf) {
// var count = buf.readUInt32BE(1);
var obj = amf0decObject(buf.slice(4));
return { len: 5 + obj.len, value: obj.value }
} | [
"function",
"amf0decArray",
"(",
"buf",
")",
"{",
"// var count = buf.readUInt32BE(1);",
"var",
"obj",
"=",
"amf0decObject",
"(",
"buf",
".",
"slice",
"(",
"4",
")",
")",
";",
"return",
"{",
"len",
":",
"5",
"+",
"obj",
".",
"len",
",",
"value",
":",
... | AMF0 Decode Array
@param buf
@returns {{len: *, value: ({}|*)}} | [
"AMF0",
"Decode",
"Array"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L674-L678 |
36,256 | delian/node-amfutils | amfUtils.js | amf0encArray | function amf0encArray(a) {
var l = 0;
if (a instanceof Array) l = a.length; else l = Object.keys(a).length;
console.log('Array encode', l, a);
var buf = new Buffer(5);
buf.writeUInt8(8,0);
buf.writeUInt32BE(l,1);
var data = amf0encObject(a);
return Buffer.concat([buf,data.slice(1)]);
} | javascript | function amf0encArray(a) {
var l = 0;
if (a instanceof Array) l = a.length; else l = Object.keys(a).length;
console.log('Array encode', l, a);
var buf = new Buffer(5);
buf.writeUInt8(8,0);
buf.writeUInt32BE(l,1);
var data = amf0encObject(a);
return Buffer.concat([buf,data.slice(1)]);
} | [
"function",
"amf0encArray",
"(",
"a",
")",
"{",
"var",
"l",
"=",
"0",
";",
"if",
"(",
"a",
"instanceof",
"Array",
")",
"l",
"=",
"a",
".",
"length",
";",
"else",
"l",
"=",
"Object",
".",
"keys",
"(",
"a",
")",
".",
"length",
";",
"console",
"."... | AMF0 Encode Array | [
"AMF0",
"Encode",
"Array"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L683-L692 |
36,257 | delian/node-amfutils | amfUtils.js | amf0cnvArray2Object | function amf0cnvArray2Object(aData) {
var buf = new Buffer(1);
buf.writeUInt8(0x3,0); // Object id
return Buffer.concat([buf,aData.slice(5)]);
} | javascript | function amf0cnvArray2Object(aData) {
var buf = new Buffer(1);
buf.writeUInt8(0x3,0); // Object id
return Buffer.concat([buf,aData.slice(5)]);
} | [
"function",
"amf0cnvArray2Object",
"(",
"aData",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"1",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x3",
",",
"0",
")",
";",
"// Object id",
"return",
"Buffer",
".",
"concat",
"(",
"[",
"buf",
",",
"aDa... | AMF0 Encode Binary Array into binary Object
@param aData
@returns {Buffer} | [
"AMF0",
"Encode",
"Binary",
"Array",
"into",
"binary",
"Object"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L699-L703 |
36,258 | delian/node-amfutils | amfUtils.js | amf0cnvObject2Array | function amf0cnvObject2Array(oData) {
var buf = new Buffer(5);
var o = amf0decObject(oData);
var l = Object.keys(o).length;
buf.writeUInt32BE(l,1);
return Buffer.concat([buf,oData.slice(1)]);
} | javascript | function amf0cnvObject2Array(oData) {
var buf = new Buffer(5);
var o = amf0decObject(oData);
var l = Object.keys(o).length;
buf.writeUInt32BE(l,1);
return Buffer.concat([buf,oData.slice(1)]);
} | [
"function",
"amf0cnvObject2Array",
"(",
"oData",
")",
"{",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"5",
")",
";",
"var",
"o",
"=",
"amf0decObject",
"(",
"oData",
")",
";",
"var",
"l",
"=",
"Object",
".",
"keys",
"(",
"o",
")",
".",
"length",
";",
... | AMF0 Encode Binary Object into binary Array
@param oData
@returns {Buffer} | [
"AMF0",
"Encode",
"Binary",
"Object",
"into",
"binary",
"Array"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L710-L716 |
36,259 | delian/node-amfutils | amfUtils.js | amf0decXmlDoc | function amf0decXmlDoc(buf) {
var sLen = buf.readUInt16BE(1);
return { len: 3 + sLen, value: buf.toString('utf8', 3, 3 + sLen) }
} | javascript | function amf0decXmlDoc(buf) {
var sLen = buf.readUInt16BE(1);
return { len: 3 + sLen, value: buf.toString('utf8', 3, 3 + sLen) }
} | [
"function",
"amf0decXmlDoc",
"(",
"buf",
")",
"{",
"var",
"sLen",
"=",
"buf",
".",
"readUInt16BE",
"(",
"1",
")",
";",
"return",
"{",
"len",
":",
"3",
"+",
"sLen",
",",
"value",
":",
"buf",
".",
"toString",
"(",
"'utf8'",
",",
"3",
",",
"3",
"+",... | AMF0 Decode XMLDoc
@param buf
@returns {{len: *, value: (*|string|String)}} | [
"AMF0",
"Decode",
"XMLDoc"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L723-L726 |
36,260 | delian/node-amfutils | amfUtils.js | amf0encXmlDoc | function amf0encXmlDoc(str) { // Essentially it is the same as string
var buf = new Buffer(3);
buf.writeUInt8(0x0F, 0);
buf.writeUInt16BE(str.length, 1);
return Buffer.concat([buf, new Buffer(str, 'utf8')]);
} | javascript | function amf0encXmlDoc(str) { // Essentially it is the same as string
var buf = new Buffer(3);
buf.writeUInt8(0x0F, 0);
buf.writeUInt16BE(str.length, 1);
return Buffer.concat([buf, new Buffer(str, 'utf8')]);
} | [
"function",
"amf0encXmlDoc",
"(",
"str",
")",
"{",
"// Essentially it is the same as string",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"3",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x0F",
",",
"0",
")",
";",
"buf",
".",
"writeUInt16BE",
"(",
"str",
".",
... | AMF0 Encode XMLDoc
@param str
@returns {Buffer} | [
"AMF0",
"Encode",
"XMLDoc"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L733-L738 |
36,261 | delian/node-amfutils | amfUtils.js | amf0decSArray | function amf0decSArray(buf) {
var a = [];
var len = 5;
var ret;
for (var count = buf.readUInt32BE(1); count; count--) {
ret = amf0DecodeOne(buf.slice(len));
a.push(ret.value);
len += ret.len;
}
return { len: len, value: amf0markSArray(a) }
} | javascript | function amf0decSArray(buf) {
var a = [];
var len = 5;
var ret;
for (var count = buf.readUInt32BE(1); count; count--) {
ret = amf0DecodeOne(buf.slice(len));
a.push(ret.value);
len += ret.len;
}
return { len: len, value: amf0markSArray(a) }
} | [
"function",
"amf0decSArray",
"(",
"buf",
")",
"{",
"var",
"a",
"=",
"[",
"]",
";",
"var",
"len",
"=",
"5",
";",
"var",
"ret",
";",
"for",
"(",
"var",
"count",
"=",
"buf",
".",
"readUInt32BE",
"(",
"1",
")",
";",
"count",
";",
"count",
"--",
")"... | AMF0 Decode Strict Array
@param buf
@returns {{len: number, value: Array}} | [
"AMF0",
"Decode",
"Strict",
"Array"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L745-L755 |
36,262 | delian/node-amfutils | amfUtils.js | amf0encSArray | function amf0encSArray(a) {
console.log('Do strict array!');
var buf = new Buffer(5);
buf.writeUInt8(0x0A,0);
buf.writeUInt32BE(a.length,1);
var i;
for (i=0;i< a.length;i++) {
buf = Buffer.concat([buf,amf0EncodeOne(a[i])]);
}
return buf;
} | javascript | function amf0encSArray(a) {
console.log('Do strict array!');
var buf = new Buffer(5);
buf.writeUInt8(0x0A,0);
buf.writeUInt32BE(a.length,1);
var i;
for (i=0;i< a.length;i++) {
buf = Buffer.concat([buf,amf0EncodeOne(a[i])]);
}
return buf;
} | [
"function",
"amf0encSArray",
"(",
"a",
")",
"{",
"console",
".",
"log",
"(",
"'Do strict array!'",
")",
";",
"var",
"buf",
"=",
"new",
"Buffer",
"(",
"5",
")",
";",
"buf",
".",
"writeUInt8",
"(",
"0x0A",
",",
"0",
")",
";",
"buf",
".",
"writeUInt32BE... | AMF0 Encode Strict Array
@param a Array | [
"AMF0",
"Encode",
"Strict",
"Array"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L761-L771 |
36,263 | delian/node-amfutils | amfUtils.js | amf0decTypedObj | function amf0decTypedObj(buf) {
var className = amf0decString(buf);
var obj = amf0decObject(buf.slice(className.len - 1));
obj.value.__className__ = className.value;
return { len: className.len + obj.len - 1, value: obj.value }
} | javascript | function amf0decTypedObj(buf) {
var className = amf0decString(buf);
var obj = amf0decObject(buf.slice(className.len - 1));
obj.value.__className__ = className.value;
return { len: className.len + obj.len - 1, value: obj.value }
} | [
"function",
"amf0decTypedObj",
"(",
"buf",
")",
"{",
"var",
"className",
"=",
"amf0decString",
"(",
"buf",
")",
";",
"var",
"obj",
"=",
"amf0decObject",
"(",
"buf",
".",
"slice",
"(",
"className",
".",
"len",
"-",
"1",
")",
")",
";",
"obj",
".",
"val... | AMF0 Decode Typed Object
@param buf
@returns {{len: number, value: ({}|*)}} | [
"AMF0",
"Decode",
"Typed",
"Object"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L783-L788 |
36,264 | delian/node-amfutils | amfUtils.js | amfXDecodeOne | function amfXDecodeOne(rules, buffer) {
if (!rules[buffer.readUInt8(0)]) {
console.log('Unknown field', buffer.readUInt8(0));
throw new Error("Error: Unknown field");
}
return rules[buffer.readUInt8(0)](buffer);
} | javascript | function amfXDecodeOne(rules, buffer) {
if (!rules[buffer.readUInt8(0)]) {
console.log('Unknown field', buffer.readUInt8(0));
throw new Error("Error: Unknown field");
}
return rules[buffer.readUInt8(0)](buffer);
} | [
"function",
"amfXDecodeOne",
"(",
"rules",
",",
"buffer",
")",
"{",
"if",
"(",
"!",
"rules",
"[",
"buffer",
".",
"readUInt8",
"(",
"0",
")",
"]",
")",
"{",
"console",
".",
"log",
"(",
"'Unknown field'",
",",
"buffer",
".",
"readUInt8",
"(",
"0",
")",... | Decode one value from the Buffer according to the applied rules
@param rules
@param buffer
@returns {*} | [
"Decode",
"one",
"value",
"from",
"the",
"Buffer",
"according",
"to",
"the",
"applied",
"rules"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L803-L809 |
36,265 | delian/node-amfutils | amfUtils.js | amfXDecode | function amfXDecode(rules, buffer) {
// We shall receive clean buffer and will respond with an array of values
var resp = [];
var res;
for (var i = 0; i < buffer.length;) {
res = amfXDecodeOne(rules, buffer.slice(i));
i += res.len;
resp.push(res.value); // Add the response
}
... | javascript | function amfXDecode(rules, buffer) {
// We shall receive clean buffer and will respond with an array of values
var resp = [];
var res;
for (var i = 0; i < buffer.length;) {
res = amfXDecodeOne(rules, buffer.slice(i));
i += res.len;
resp.push(res.value); // Add the response
}
... | [
"function",
"amfXDecode",
"(",
"rules",
",",
"buffer",
")",
"{",
"// We shall receive clean buffer and will respond with an array of values",
"var",
"resp",
"=",
"[",
"]",
";",
"var",
"res",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"buffer",
".",
... | Decode a whole buffer of AMF values according to rules and return in array
@param rules
@param buffer
@returns {Array} | [
"Decode",
"a",
"whole",
"buffer",
"of",
"AMF",
"values",
"according",
"to",
"rules",
"and",
"return",
"in",
"array"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L835-L845 |
36,266 | delian/node-amfutils | amfUtils.js | amfXEncodeOne | function amfXEncodeOne(rules, o) {
// console.log('amfXEncodeOne type',o,amfType(o),rules[amfType(o)]);
var f = rules[amfType(o)];
if (f) return f(o);
throw new Error('Unsupported type for encoding!');
} | javascript | function amfXEncodeOne(rules, o) {
// console.log('amfXEncodeOne type',o,amfType(o),rules[amfType(o)]);
var f = rules[amfType(o)];
if (f) return f(o);
throw new Error('Unsupported type for encoding!');
} | [
"function",
"amfXEncodeOne",
"(",
"rules",
",",
"o",
")",
"{",
"// console.log('amfXEncodeOne type',o,amfType(o),rules[amfType(o)]);",
"var",
"f",
"=",
"rules",
"[",
"amfType",
"(",
"o",
")",
"]",
";",
"if",
"(",
"f",
")",
"return",
"f",
"(",
"o",
")",
";... | Encode one AMF value according to rules
@param rules
@param o
@returns {*} | [
"Encode",
"one",
"AMF",
"value",
"according",
"to",
"rules"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L871-L876 |
36,267 | delian/node-amfutils | amfUtils.js | decodeAMF0Cmd | function decodeAMF0Cmd(dbuf) {
var buffer = dbuf;
var resp = {};
var cmd = amf0DecodeOne(buffer);
resp.cmd = cmd.value;
buffer = buffer.slice(cmd.len);
if (rtmpCmdDecode[cmd.value]) {
rtmpCmdDecode[cmd.value].forEach(function (n) {
if (buffer.length > 0) {
v... | javascript | function decodeAMF0Cmd(dbuf) {
var buffer = dbuf;
var resp = {};
var cmd = amf0DecodeOne(buffer);
resp.cmd = cmd.value;
buffer = buffer.slice(cmd.len);
if (rtmpCmdDecode[cmd.value]) {
rtmpCmdDecode[cmd.value].forEach(function (n) {
if (buffer.length > 0) {
v... | [
"function",
"decodeAMF0Cmd",
"(",
"dbuf",
")",
"{",
"var",
"buffer",
"=",
"dbuf",
";",
"var",
"resp",
"=",
"{",
"}",
";",
"var",
"cmd",
"=",
"amf0DecodeOne",
"(",
"buffer",
")",
";",
"resp",
".",
"cmd",
"=",
"cmd",
".",
"value",
";",
"buffer",
"=",... | Decode a command!
@param dbuf
@returns {{cmd: (*|string|String|*), value: *}} | [
"Decode",
"a",
"command!"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L951-L971 |
36,268 | delian/node-amfutils | amfUtils.js | encodeAMF3Cmd | function encodeAMF3Cmd(opt) {
var data = amf0EncodeOne(opt.cmd);
if (rtmpCmdDecode[opt.cmd]) {
rtmpCmdDecode[opt.cmd].forEach(function (n) {
if (opt.hasOwnProperty(n))
data = Buffer.concat([data, amf3EncodeOne(opt[n])]);
});
} else {
console.log('Unknown ... | javascript | function encodeAMF3Cmd(opt) {
var data = amf0EncodeOne(opt.cmd);
if (rtmpCmdDecode[opt.cmd]) {
rtmpCmdDecode[opt.cmd].forEach(function (n) {
if (opt.hasOwnProperty(n))
data = Buffer.concat([data, amf3EncodeOne(opt[n])]);
});
} else {
console.log('Unknown ... | [
"function",
"encodeAMF3Cmd",
"(",
"opt",
")",
"{",
"var",
"data",
"=",
"amf0EncodeOne",
"(",
"opt",
".",
"cmd",
")",
";",
"if",
"(",
"rtmpCmdDecode",
"[",
"opt",
".",
"cmd",
"]",
")",
"{",
"rtmpCmdDecode",
"[",
"opt",
".",
"cmd",
"]",
".",
"forEach",... | Encode AMF3 Command
@param opt
@returns {*} | [
"Encode",
"AMF3",
"Command"
] | f9ef2d0df385f371c2f83a52200933f59eaebcce | https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L1025-L1037 |
36,269 | ascartabelli/lamb | src/privates/_isArrayIndex.js | _isArrayIndex | function _isArrayIndex (target, key) {
var n = +key;
return Array.isArray(target) && n % 1 === 0 && !(n < 0 && _isEnumerable(target, key));
} | javascript | function _isArrayIndex (target, key) {
var n = +key;
return Array.isArray(target) && n % 1 === 0 && !(n < 0 && _isEnumerable(target, key));
} | [
"function",
"_isArrayIndex",
"(",
"target",
",",
"key",
")",
"{",
"var",
"n",
"=",
"+",
"key",
";",
"return",
"Array",
".",
"isArray",
"(",
"target",
")",
"&&",
"n",
"%",
"1",
"===",
"0",
"&&",
"!",
"(",
"n",
"<",
"0",
"&&",
"_isEnumerable",
"(",... | Accepts a target object and a key name and verifies that the target is an array and that
the key is an existing index.
@private
@param {Object} target
@param {String|Number} key
@returns {Boolean} | [
"Accepts",
"a",
"target",
"object",
"and",
"a",
"key",
"name",
"and",
"verifies",
"that",
"the",
"target",
"is",
"an",
"array",
"and",
"that",
"the",
"key",
"is",
"an",
"existing",
"index",
"."
] | d36e45945c4789e4f1a2d8805936514b53f32362 | https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_isArrayIndex.js#L11-L15 |
36,270 | marionebl/eslint-plugin-flow-check | source/flow.js | flow | function flow(options) {
const result = spawnSync(bin, [
'check-contents',
'--json',
`--root=${options.root}`,
options.fileName
], {
input: options.source,
encoding: 'utf-8'
});
if (result.status !== 0) {
return [{
message: result.stderr,
loc: {
start: {
line: 1
},
end: {
... | javascript | function flow(options) {
const result = spawnSync(bin, [
'check-contents',
'--json',
`--root=${options.root}`,
options.fileName
], {
input: options.source,
encoding: 'utf-8'
});
if (result.status !== 0) {
return [{
message: result.stderr,
loc: {
start: {
line: 1
},
end: {
... | [
"function",
"flow",
"(",
"options",
")",
"{",
"const",
"result",
"=",
"spawnSync",
"(",
"bin",
",",
"[",
"'check-contents'",
",",
"'--json'",
",",
"`",
"${",
"options",
".",
"root",
"}",
"`",
",",
"options",
".",
"fileName",
"]",
",",
"{",
"input",
"... | start a flow server | [
"start",
"a",
"flow",
"server"
] | bd2332d114afe8a3fff03adbc4253cbd43bd926f | https://github.com/marionebl/eslint-plugin-flow-check/blob/bd2332d114afe8a3fff03adbc4253cbd43bd926f/source/flow.js#L9-L50 |
36,271 | ascartabelli/lamb | src/privates/_getPathInfo.js | _getPathInfo | function _getPathInfo (obj, parts, walkNonEnumerables) {
if (isNil(obj)) {
throw _makeTypeErrorFor(obj, "object");
}
var target = obj;
var i = -1;
var len = parts.length;
var key;
while (++i < len) {
key = _getPathKey(target, parts[i], walkNonEnumerables);
if (isUn... | javascript | function _getPathInfo (obj, parts, walkNonEnumerables) {
if (isNil(obj)) {
throw _makeTypeErrorFor(obj, "object");
}
var target = obj;
var i = -1;
var len = parts.length;
var key;
while (++i < len) {
key = _getPathKey(target, parts[i], walkNonEnumerables);
if (isUn... | [
"function",
"_getPathInfo",
"(",
"obj",
",",
"parts",
",",
"walkNonEnumerables",
")",
"{",
"if",
"(",
"isNil",
"(",
"obj",
")",
")",
"{",
"throw",
"_makeTypeErrorFor",
"(",
"obj",
",",
"\"object\"",
")",
";",
"}",
"var",
"target",
"=",
"obj",
";",
"var... | Checks if a path is valid in the given object and retrieves the path target.
@private
@param {Object} obj
@param {String[]} parts
@param {Boolean} walkNonEnumerables
@returns {Object} | [
"Checks",
"if",
"a",
"path",
"is",
"valid",
"in",
"the",
"given",
"object",
"and",
"retrieves",
"the",
"path",
"target",
"."
] | d36e45945c4789e4f1a2d8805936514b53f32362 | https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_getPathInfo.js#L14-L35 |
36,272 | ascartabelli/lamb | src/privates/_flatten.js | _flatten | function _flatten (array, isDeep, output, idx) {
for (var i = 0, len = array.length, value, j, vLen; i < len; i++) {
value = array[i];
if (!Array.isArray(value)) {
output[idx++] = value;
} else if (isDeep) {
_flatten(value, true, output, idx);
idx = outpu... | javascript | function _flatten (array, isDeep, output, idx) {
for (var i = 0, len = array.length, value, j, vLen; i < len; i++) {
value = array[i];
if (!Array.isArray(value)) {
output[idx++] = value;
} else if (isDeep) {
_flatten(value, true, output, idx);
idx = outpu... | [
"function",
"_flatten",
"(",
"array",
",",
"isDeep",
",",
"output",
",",
"idx",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"array",
".",
"length",
",",
"value",
",",
"j",
",",
"vLen",
";",
"i",
"<",
"len",
";",
"i",
"++",
")... | Flattens an array.
@private
@param {Array} array - The source array
@param {Boolean} isDeep - Whether to perform a deep flattening or not
@param {Array} output - An array to collect the result
@param {Number} idx - The next index to be filled in the output
@returns {Array} The output array filled with the results | [
"Flattens",
"an",
"array",
"."
] | d36e45945c4789e4f1a2d8805936514b53f32362 | https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_flatten.js#L10-L30 |
36,273 | fortunejs/fortune-mongodb | lib/helpers.js | mapValues | function mapValues (object, map) {
return Object.keys(object).reduce((clone, key) =>
Object.assign(clone, { [key]: map(object[key], key) }), {})
} | javascript | function mapValues (object, map) {
return Object.keys(object).reduce((clone, key) =>
Object.assign(clone, { [key]: map(object[key], key) }), {})
} | [
"function",
"mapValues",
"(",
"object",
",",
"map",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"object",
")",
".",
"reduce",
"(",
"(",
"clone",
",",
"key",
")",
"=>",
"Object",
".",
"assign",
"(",
"clone",
",",
"{",
"[",
"key",
"]",
":",
"ma... | Create a new object with different key values.
@param {Object} object
@param {Function} map should return the first argument, which is the value
@return {Object} | [
"Create",
"a",
"new",
"object",
"with",
"different",
"key",
"values",
"."
] | e1e5e4d830e37fdee92388ab194ba35a71dae27f | https://github.com/fortunejs/fortune-mongodb/blob/e1e5e4d830e37fdee92388ab194ba35a71dae27f/lib/helpers.js#L106-L109 |
36,274 | fortunejs/fortune-mongodb | lib/helpers.js | toBuffer | function toBuffer (object) {
if (Buffer.isBuffer(object)) return object
if (object.buffer) return object.buffer
throw new TypeError('Could not output buffer type.')
} | javascript | function toBuffer (object) {
if (Buffer.isBuffer(object)) return object
if (object.buffer) return object.buffer
throw new TypeError('Could not output buffer type.')
} | [
"function",
"toBuffer",
"(",
"object",
")",
"{",
"if",
"(",
"Buffer",
".",
"isBuffer",
"(",
"object",
")",
")",
"return",
"object",
"if",
"(",
"object",
".",
"buffer",
")",
"return",
"object",
".",
"buffer",
"throw",
"new",
"TypeError",
"(",
"'Could not ... | There is an inconsistency when accessing a record depending on the method, it may be either a native `Buffer` or BSON object wrapper. We only want native buffers. | [
"There",
"is",
"an",
"inconsistency",
"when",
"accessing",
"a",
"record",
"depending",
"on",
"the",
"method",
"it",
"may",
"be",
"either",
"a",
"native",
"Buffer",
"or",
"BSON",
"object",
"wrapper",
".",
"We",
"only",
"want",
"native",
"buffers",
"."
] | e1e5e4d830e37fdee92388ab194ba35a71dae27f | https://github.com/fortunejs/fortune-mongodb/blob/e1e5e4d830e37fdee92388ab194ba35a71dae27f/lib/helpers.js#L115-L119 |
36,275 | fortunejs/fortune-mongodb | lib/helpers.js | generateQuery | function generateQuery (fields, options, not) {
let $and = []
const $or = []
const result = {}
for (const key in options)
switch (key) {
case 'and':
case 'or':
const query = {}
query[`$${key}`] = mapValues(options[key], value => {
return generateQuery(fields, value)
})
... | javascript | function generateQuery (fields, options, not) {
let $and = []
const $or = []
const result = {}
for (const key in options)
switch (key) {
case 'and':
case 'or':
const query = {}
query[`$${key}`] = mapValues(options[key], value => {
return generateQuery(fields, value)
})
... | [
"function",
"generateQuery",
"(",
"fields",
",",
"options",
",",
"not",
")",
"{",
"let",
"$and",
"=",
"[",
"]",
"const",
"$or",
"=",
"[",
"]",
"const",
"result",
"=",
"{",
"}",
"for",
"(",
"const",
"key",
"in",
"options",
")",
"switch",
"(",
"key",... | Generate a mongoDB query from a fortune query object | [
"Generate",
"a",
"mongoDB",
"query",
"from",
"a",
"fortune",
"query",
"object"
] | e1e5e4d830e37fdee92388ab194ba35a71dae27f | https://github.com/fortunejs/fortune-mongodb/blob/e1e5e4d830e37fdee92388ab194ba35a71dae27f/lib/helpers.js#L152-L201 |
36,276 | takashiki/cos-webpack | index.js | function(fileName) {
let file = assets[fileName] || {};
fileName = basePath + "/" + fileName.replace(/\\/g, '/');
let key = path.posix.join(uploadPath, fileName);
return new Promise((resolve, reject) => {
let begin = Date.now();
... | javascript | function(fileName) {
let file = assets[fileName] || {};
fileName = basePath + "/" + fileName.replace(/\\/g, '/');
let key = path.posix.join(uploadPath, fileName);
return new Promise((resolve, reject) => {
let begin = Date.now();
... | [
"function",
"(",
"fileName",
")",
"{",
"let",
"file",
"=",
"assets",
"[",
"fileName",
"]",
"||",
"{",
"}",
";",
"fileName",
"=",
"basePath",
"+",
"\"/\"",
"+",
"fileName",
".",
"replace",
"(",
"/",
"\\\\",
"/",
"g",
",",
"'/'",
")",
";",
"let",
"... | Perform upload to cos | [
"Perform",
"upload",
"to",
"cos"
] | 2a8d09a14b977930c00c87a8c63e11897e929ed6 | https://github.com/takashiki/cos-webpack/blob/2a8d09a14b977930c00c87a8c63e11897e929ed6/index.js#L104-L129 | |
36,277 | takashiki/cos-webpack | index.js | function(err) {
if (err) {
// eslint-disable-next-line no-console
console.log("\n");
return Promise.reject(err);
}
// Get 20 files
let _files = filesNames.splice(0, batch);
if (_... | javascript | function(err) {
if (err) {
// eslint-disable-next-line no-console
console.log("\n");
return Promise.reject(err);
}
// Get 20 files
let _files = filesNames.splice(0, batch);
if (_... | [
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"// eslint-disable-next-line no-console",
"console",
".",
"log",
"(",
"\"\\n\"",
")",
";",
"return",
"Promise",
".",
"reject",
"(",
"err",
")",
";",
"}",
"// Get 20 files",
"let",
"_files",
"=",... | Execute stack according to `batch` option | [
"Execute",
"stack",
"according",
"to",
"batch",
"option"
] | 2a8d09a14b977930c00c87a8c63e11897e929ed6 | https://github.com/takashiki/cos-webpack/blob/2a8d09a14b977930c00c87a8c63e11897e929ed6/index.js#L132-L147 | |
36,278 | aMarCruz/jspreproc | lib/compactor.js | indent | function indent(level) {
var val = options.indent
_indent = ''
if (_lastch === null)
_lastch = _to // as-is, this is the first file
else if (_lastch !== _to) {
_lastch = _to
// istanbul ignore else
if (output)
output.emit('data', _to) // force eol afte... | javascript | function indent(level) {
var val = options.indent
_indent = ''
if (_lastch === null)
_lastch = _to // as-is, this is the first file
else if (_lastch !== _to) {
_lastch = _to
// istanbul ignore else
if (output)
output.emit('data', _to) // force eol afte... | [
"function",
"indent",
"(",
"level",
")",
"{",
"var",
"val",
"=",
"options",
".",
"indent",
"_indent",
"=",
"''",
"if",
"(",
"_lastch",
"===",
"null",
")",
"_lastch",
"=",
"_to",
"// as-is, this is the first file",
"else",
"if",
"(",
"_lastch",
"!==",
"_to"... | On file change, reset indentation | [
"On",
"file",
"change",
"reset",
"indentation"
] | 5f31820d702a329e8aa25f0f3983f13097610250 | https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/lib/compactor.js#L32-L51 |
36,279 | aMarCruz/jspreproc | lib/compactor.js | write | function write(buffer) {
// first, trim trailing whitespace for fast searching
buffer = buffer.replace(/[ \t]+$/gm, '')
// compact lines if emptyLines != -1
if (_elines >= 0)
buffer = trimBuffer(buffer)
if (!buffer) return
// finished the surrounding lines, now the inners
if (!_eli... | javascript | function write(buffer) {
// first, trim trailing whitespace for fast searching
buffer = buffer.replace(/[ \t]+$/gm, '')
// compact lines if emptyLines != -1
if (_elines >= 0)
buffer = trimBuffer(buffer)
if (!buffer) return
// finished the surrounding lines, now the inners
if (!_eli... | [
"function",
"write",
"(",
"buffer",
")",
"{",
"// first, trim trailing whitespace for fast searching",
"buffer",
"=",
"buffer",
".",
"replace",
"(",
"/",
"[ \\t]+$",
"/",
"gm",
",",
"''",
")",
"// compact lines if emptyLines != -1",
"if",
"(",
"_elines",
">=",
"0",
... | On new data, trim trailing whitespace and normalize eols | [
"On",
"new",
"data",
"trim",
"trailing",
"whitespace",
"and",
"normalize",
"eols"
] | 5f31820d702a329e8aa25f0f3983f13097610250 | https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/lib/compactor.js#L55-L88 |
36,280 | jgkim/mocha-gherkin | src/spec.js | GherkinSpec | function GherkinSpec(runner) {
Base.call(this, runner);
let indents = 0;
let n = 0;
if (!Base.useColors) {
colors.enabled = false;
}
function indent() {
return Array(indents).join(' ');
}
runner.on('start', () => {
console.log();
});
runner.on('suite', (suite) => {
indent... | javascript | function GherkinSpec(runner) {
Base.call(this, runner);
let indents = 0;
let n = 0;
if (!Base.useColors) {
colors.enabled = false;
}
function indent() {
return Array(indents).join(' ');
}
runner.on('start', () => {
console.log();
});
runner.on('suite', (suite) => {
indent... | [
"function",
"GherkinSpec",
"(",
"runner",
")",
"{",
"Base",
".",
"call",
"(",
"this",
",",
"runner",
")",
";",
"let",
"indents",
"=",
"0",
";",
"let",
"n",
"=",
"0",
";",
"if",
"(",
"!",
"Base",
".",
"useColors",
")",
"{",
"colors",
".",
"enabled... | Initialize a new `GherkinSpec` test reporter.
@api public
@param {Runner} runner | [
"Initialize",
"a",
"new",
"GherkinSpec",
"test",
"reporter",
"."
] | 9542725a3c5b557b153bc51ce6d61d1b11dfd3a5 | https://github.com/jgkim/mocha-gherkin/blob/9542725a3c5b557b153bc51ce6d61d1b11dfd3a5/src/spec.js#L14-L82 |
36,281 | LaxarJS/webpack-jasmine-html-runner-plugin | index.js | entry | function entry() {
const patterns = Array.from( arguments );
const entry = {};
patterns.forEach( globPattern => {
// backwards compatibility:
const pattern = globPattern.replace( '[name]', '**' );
return glob.sync( pattern ).forEach( path => {
const baseName = path.replace( /\.[^.]+$... | javascript | function entry() {
const patterns = Array.from( arguments );
const entry = {};
patterns.forEach( globPattern => {
// backwards compatibility:
const pattern = globPattern.replace( '[name]', '**' );
return glob.sync( pattern ).forEach( path => {
const baseName = path.replace( /\.[^.]+$... | [
"function",
"entry",
"(",
")",
"{",
"const",
"patterns",
"=",
"Array",
".",
"from",
"(",
"arguments",
")",
";",
"const",
"entry",
"=",
"{",
"}",
";",
"patterns",
".",
"forEach",
"(",
"globPattern",
"=>",
"{",
"// backwards compatibility:",
"const",
"patter... | Generates webpack entry points suitable for use with the WebpackJasmineHtmlRunnerPlugin plugin.
Basically, each file matching one of the provided glob-patterns becomes an entry point which is named
like that file, but without the extension.
@param {...String} patterns
File patterns in glob-syntax (may contain * and **... | [
"Generates",
"webpack",
"entry",
"points",
"suitable",
"for",
"use",
"with",
"the",
"WebpackJasmineHtmlRunnerPlugin",
"plugin",
".",
"Basically",
"each",
"file",
"matching",
"one",
"of",
"the",
"provided",
"glob",
"-",
"patterns",
"becomes",
"an",
"entry",
"point"... | 6a6671385dc54db67f44446fb52308d7513e66f7 | https://github.com/LaxarJS/webpack-jasmine-html-runner-plugin/blob/6a6671385dc54db67f44446fb52308d7513e66f7/index.js#L34-L46 |
36,282 | Inspired-by-Boredom/generator-vintage-frontend | generators/app/templates/gulp/tasks/templates.js | compileHtml | function compileHtml(src, dest) {
return gulp.src([src])
.pipe(plumber(config.plumberOptions))
.pipe(pug(pugOptions))
.pipe(prettify())
.pipe(gulp.dest(dest));
} | javascript | function compileHtml(src, dest) {
return gulp.src([src])
.pipe(plumber(config.plumberOptions))
.pipe(pug(pugOptions))
.pipe(prettify())
.pipe(gulp.dest(dest));
} | [
"function",
"compileHtml",
"(",
"src",
",",
"dest",
")",
"{",
"return",
"gulp",
".",
"src",
"(",
"[",
"src",
"]",
")",
".",
"pipe",
"(",
"plumber",
"(",
"config",
".",
"plumberOptions",
")",
")",
".",
"pipe",
"(",
"pug",
"(",
"pugOptions",
")",
")"... | Default HTML compilation function.
@param {String} src
@param {String} dest | [
"Default",
"HTML",
"compilation",
"function",
"."
] | 316ebc981961a39d3c47ba830f377350d529452b | https://github.com/Inspired-by-Boredom/generator-vintage-frontend/blob/316ebc981961a39d3c47ba830f377350d529452b/generators/app/templates/gulp/tasks/templates.js#L46-L52 |
36,283 | ILLGrenoble/guacamole-common-js | src/Tunnel.js | addExtraHeaders | function addExtraHeaders(request, headers) {
for (var name in headers) {
request.setRequestHeader(name, headers[name]);
}
} | javascript | function addExtraHeaders(request, headers) {
for (var name in headers) {
request.setRequestHeader(name, headers[name]);
}
} | [
"function",
"addExtraHeaders",
"(",
"request",
",",
"headers",
")",
"{",
"for",
"(",
"var",
"name",
"in",
"headers",
")",
"{",
"request",
".",
"setRequestHeader",
"(",
"name",
",",
"headers",
"[",
"name",
"]",
")",
";",
"}",
"}"
] | Adds the configured additional headers to the given request.
@param {XMLHttpRequest} request
The request where the configured extra headers will be added.
@param {Object} headers
The headers to be added to the request.
@private | [
"Adds",
"the",
"configured",
"additional",
"headers",
"to",
"the",
"given",
"request",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L242-L246 |
36,284 | ILLGrenoble/guacamole-common-js | src/Tunnel.js | reset_timeout | function reset_timeout() {
// Get rid of old timeout (if any)
window.clearTimeout(receive_timeout);
// Set new timeout
receive_timeout = window.setTimeout(function () {
close_tunnel(new Guacamole.Status(Guacamole.Status.Code.UPSTREAM_TIMEOUT, "Server timeout."));
},... | javascript | function reset_timeout() {
// Get rid of old timeout (if any)
window.clearTimeout(receive_timeout);
// Set new timeout
receive_timeout = window.setTimeout(function () {
close_tunnel(new Guacamole.Status(Guacamole.Status.Code.UPSTREAM_TIMEOUT, "Server timeout."));
},... | [
"function",
"reset_timeout",
"(",
")",
"{",
"// Get rid of old timeout (if any)",
"window",
".",
"clearTimeout",
"(",
"receive_timeout",
")",
";",
"// Set new timeout",
"receive_timeout",
"=",
"window",
".",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"close_tunnel"... | Initiates a timeout which, if data is not received, causes the tunnel
to close with an error.
@private | [
"Initiates",
"a",
"timeout",
"which",
"if",
"data",
"is",
"not",
"received",
"causes",
"the",
"tunnel",
"to",
"close",
"with",
"an",
"error",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L254-L264 |
36,285 | ILLGrenoble/guacamole-common-js | src/Tunnel.js | attach | function attach(tunnel) {
// Set own functions to tunnel's functions
chained_tunnel.disconnect = tunnel.disconnect;
chained_tunnel.sendMessage = tunnel.sendMessage;
/**
* Fails the currently-attached tunnel, attaching a new tunnel if
* possible.
*
*... | javascript | function attach(tunnel) {
// Set own functions to tunnel's functions
chained_tunnel.disconnect = tunnel.disconnect;
chained_tunnel.sendMessage = tunnel.sendMessage;
/**
* Fails the currently-attached tunnel, attaching a new tunnel if
* possible.
*
*... | [
"function",
"attach",
"(",
"tunnel",
")",
"{",
"// Set own functions to tunnel's functions",
"chained_tunnel",
".",
"disconnect",
"=",
"tunnel",
".",
"disconnect",
";",
"chained_tunnel",
".",
"sendMessage",
"=",
"tunnel",
".",
"sendMessage",
";",
"/**\n * Fails ... | Sets the current tunnel.
@private
@param {Guacamole.Tunnel} tunnel The tunnel to set as the current tunnel. | [
"Sets",
"the",
"current",
"tunnel",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L954-L1056 |
36,286 | ILLGrenoble/guacamole-common-js | src/Tunnel.js | failTunnel | function failTunnel(status) {
// Do not attempt to continue using next tunnel on server timeout
if (status && status.code === Guacamole.Status.Code.UPSTREAM_TIMEOUT) {
tunnels = [];
return null;
}
// Get next tunnel
var next_t... | javascript | function failTunnel(status) {
// Do not attempt to continue using next tunnel on server timeout
if (status && status.code === Guacamole.Status.Code.UPSTREAM_TIMEOUT) {
tunnels = [];
return null;
}
// Get next tunnel
var next_t... | [
"function",
"failTunnel",
"(",
"status",
")",
"{",
"// Do not attempt to continue using next tunnel on server timeout",
"if",
"(",
"status",
"&&",
"status",
".",
"code",
"===",
"Guacamole",
".",
"Status",
".",
"Code",
".",
"UPSTREAM_TIMEOUT",
")",
"{",
"tunnels",
"=... | Fails the currently-attached tunnel, attaching a new tunnel if
possible.
@private
@param {Guacamole.Status} [status]
An object representing the failure that occured in the
currently-attached tunnel, if known.
@return {Guacamole.Tunnel}
The next tunnel, or null if there are no more tunnels to try or
if no more tunnels... | [
"Fails",
"the",
"currently",
"-",
"attached",
"tunnel",
"attaching",
"a",
"new",
"tunnel",
"if",
"possible",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L973-L994 |
36,287 | ILLGrenoble/guacamole-common-js | src/Tunnel.js | commit_tunnel | function commit_tunnel() {
tunnel.onstatechange = chained_tunnel.onstatechange;
tunnel.oninstruction = chained_tunnel.oninstruction;
tunnel.onerror = chained_tunnel.onerror;
chained_tunnel.uuid = tunnel.uuid;
committedTunnel = tunnel;
} | javascript | function commit_tunnel() {
tunnel.onstatechange = chained_tunnel.onstatechange;
tunnel.oninstruction = chained_tunnel.oninstruction;
tunnel.onerror = chained_tunnel.onerror;
chained_tunnel.uuid = tunnel.uuid;
committedTunnel = tunnel;
} | [
"function",
"commit_tunnel",
"(",
")",
"{",
"tunnel",
".",
"onstatechange",
"=",
"chained_tunnel",
".",
"onstatechange",
";",
"tunnel",
".",
"oninstruction",
"=",
"chained_tunnel",
".",
"oninstruction",
";",
"tunnel",
".",
"onerror",
"=",
"chained_tunnel",
".",
... | Use the current tunnel from this point forward. Do not try any more
tunnels, even if the current tunnel fails.
@private | [
"Use",
"the",
"current",
"tunnel",
"from",
"this",
"point",
"forward",
".",
"Do",
"not",
"try",
"any",
"more",
"tunnels",
"even",
"if",
"the",
"current",
"tunnel",
"fails",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L1002-L1008 |
36,288 | ILLGrenoble/guacamole-common-js | src/Tunnel.js | getGuacamoleStatusCode | function getGuacamoleStatusCode(httpStatus) {
// Translate status codes with known equivalents
switch (httpStatus) {
// HTTP 400 - Bad request
case 400:
return Guacamole.Status.Code.CLIENT_BAD_REQUEST;
// HTTP 403 - Forbidden
case 403:
... | javascript | function getGuacamoleStatusCode(httpStatus) {
// Translate status codes with known equivalents
switch (httpStatus) {
// HTTP 400 - Bad request
case 400:
return Guacamole.Status.Code.CLIENT_BAD_REQUEST;
// HTTP 403 - Forbidden
case 403:
... | [
"function",
"getGuacamoleStatusCode",
"(",
"httpStatus",
")",
"{",
"// Translate status codes with known equivalents",
"switch",
"(",
"httpStatus",
")",
"{",
"// HTTP 400 - Bad request",
"case",
"400",
":",
"return",
"Guacamole",
".",
"Status",
".",
"Code",
".",
"CLIENT... | Returns the Guacamole protocol status code which most closely
represents the given HTTP status code.
@private
@param {Number} httpStatus
The HTTP status code to translate into a Guacamole protocol status
code.
@returns {Number}
The Guacamole protocol status code which most closely represents the
given HTTP status cod... | [
"Returns",
"the",
"Guacamole",
"protocol",
"status",
"code",
"which",
"most",
"closely",
"represents",
"the",
"given",
"HTTP",
"status",
"code",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L1157-L1187 |
36,289 | smshuja/parse-server-accountkit-auth | index.js | validateAuthData | function validateAuthData(authData, config) {
var appSecretProof = crypto.createHmac('sha256', config.appSecret).update(authData.access_token).digest('hex');
return graphRequest('me/?access_token=' + authData.access_token + '&appsecret_proof=' + appSecretProof)
.then((data) => {
if (data && data.id == aut... | javascript | function validateAuthData(authData, config) {
var appSecretProof = crypto.createHmac('sha256', config.appSecret).update(authData.access_token).digest('hex');
return graphRequest('me/?access_token=' + authData.access_token + '&appsecret_proof=' + appSecretProof)
.then((data) => {
if (data && data.id == aut... | [
"function",
"validateAuthData",
"(",
"authData",
",",
"config",
")",
"{",
"var",
"appSecretProof",
"=",
"crypto",
".",
"createHmac",
"(",
"'sha256'",
",",
"config",
".",
"appSecret",
")",
".",
"update",
"(",
"authData",
".",
"access_token",
")",
".",
"digest... | Returns a promise that fulfills iff this user id is valid. | [
"Returns",
"a",
"promise",
"that",
"fulfills",
"iff",
"this",
"user",
"id",
"is",
"valid",
"."
] | 6a47523ce08f0bc8f39c372e1a99d15d4d9e4aca | https://github.com/smshuja/parse-server-accountkit-auth/blob/6a47523ce08f0bc8f39c372e1a99d15d4d9e4aca/index.js#L7-L18 |
36,290 | GiladShoham/seven-boom | lib/wrappedBoomFunction.js | getWrappedFunc | function getWrappedFunc(funcName, func, ...args) {
const funcDefaultArgs = defaultArgs[funcName] || defaultArgs['default'];
const allArgs = funcDefaultArgs.concat(args);
return function(...allArgs) {
const boomArgs = _.take(allArgs, funcDefaultArgs.length);
let result = func.call(null, ...boomArgs);
... | javascript | function getWrappedFunc(funcName, func, ...args) {
const funcDefaultArgs = defaultArgs[funcName] || defaultArgs['default'];
const allArgs = funcDefaultArgs.concat(args);
return function(...allArgs) {
const boomArgs = _.take(allArgs, funcDefaultArgs.length);
let result = func.call(null, ...boomArgs);
... | [
"function",
"getWrappedFunc",
"(",
"funcName",
",",
"func",
",",
"...",
"args",
")",
"{",
"const",
"funcDefaultArgs",
"=",
"defaultArgs",
"[",
"funcName",
"]",
"||",
"defaultArgs",
"[",
"'default'",
"]",
";",
"const",
"allArgs",
"=",
"funcDefaultArgs",
".",
... | This function gets a boom function and arguments in new format and return
a wrapped boom function | [
"This",
"function",
"gets",
"a",
"boom",
"function",
"and",
"arguments",
"in",
"new",
"format",
"and",
"return",
"a",
"wrapped",
"boom",
"function"
] | 38b1469260743b5b083f8ca185786ef74a693844 | https://github.com/GiladShoham/seven-boom/blob/38b1469260743b5b083f8ca185786ef74a693844/lib/wrappedBoomFunction.js#L15-L41 |
36,291 | ILLGrenoble/guacamole-common-js | src/Display.js | __flush_frames | function __flush_frames() {
var rendered_frames = 0;
// Draw all pending frames, if ready
while (rendered_frames < frames.length) {
var frame = frames[rendered_frames];
if (!frame.isReady())
break;
frame.flush();
rendered_frames... | javascript | function __flush_frames() {
var rendered_frames = 0;
// Draw all pending frames, if ready
while (rendered_frames < frames.length) {
var frame = frames[rendered_frames];
if (!frame.isReady())
break;
frame.flush();
rendered_frames... | [
"function",
"__flush_frames",
"(",
")",
"{",
"var",
"rendered_frames",
"=",
"0",
";",
"// Draw all pending frames, if ready",
"while",
"(",
"rendered_frames",
"<",
"frames",
".",
"length",
")",
"{",
"var",
"frame",
"=",
"frames",
"[",
"rendered_frames",
"]",
";"... | Flushes all pending frames.
@private | [
"Flushes",
"all",
"pending",
"frames",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Display.js#L159-L178 |
36,292 | ILLGrenoble/guacamole-common-js | src/Display.js | Task | function Task(taskHandler, blocked) {
var task = this;
/**
* Whether this Task is blocked.
*
* @type {boolean}
*/
this.blocked = blocked;
/**
* Unblocks this Task, allowing it to run.
*/
this.unblock = functi... | javascript | function Task(taskHandler, blocked) {
var task = this;
/**
* Whether this Task is blocked.
*
* @type {boolean}
*/
this.blocked = blocked;
/**
* Unblocks this Task, allowing it to run.
*/
this.unblock = functi... | [
"function",
"Task",
"(",
"taskHandler",
",",
"blocked",
")",
"{",
"var",
"task",
"=",
"this",
";",
"/**\n * Whether this Task is blocked.\n * \n * @type {boolean}\n */",
"this",
".",
"blocked",
"=",
"blocked",
";",
"/**\n * Unblocks thi... | A container for an task handler. Each operation which must be ordered
is associated with a Task that goes into a task queue. Tasks in this
queue are executed in order once their handlers are set, while Tasks
without handlers block themselves and any following Tasks from running.
@constructor
@private
@param {function}... | [
"A",
"container",
"for",
"an",
"task",
"handler",
".",
"Each",
"operation",
"which",
"must",
"be",
"ordered",
"is",
"associated",
"with",
"a",
"Task",
"that",
"goes",
"into",
"a",
"task",
"queue",
".",
"Tasks",
"in",
"this",
"queue",
"are",
"executed",
"... | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Display.js#L244-L274 |
36,293 | ILLGrenoble/guacamole-common-js | src/Display.js | get_children | function get_children(layer) {
// Build array of children
var children = [];
for (var index in layer.children)
children.push(layer.children[index]);
// Sort
children.sort(function children_comparator(a, b) {
// Compare based ... | javascript | function get_children(layer) {
// Build array of children
var children = [];
for (var index in layer.children)
children.push(layer.children[index]);
// Sort
children.sort(function children_comparator(a, b) {
// Compare based ... | [
"function",
"get_children",
"(",
"layer",
")",
"{",
"// Build array of children",
"var",
"children",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"index",
"in",
"layer",
".",
"children",
")",
"children",
".",
"push",
"(",
"layer",
".",
"children",
"[",
"index",
... | Returns sorted array of children | [
"Returns",
"sorted",
"array",
"of",
"children"
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Display.js#L1141-L1172 |
36,294 | ILLGrenoble/guacamole-common-js | src/Display.js | draw_layer | function draw_layer(layer, x, y) {
// Draw layer
if (layer.width > 0 && layer.height > 0) {
// Save and update alpha
var initial_alpha = context.globalAlpha;
context.globalAlpha *= layer.alpha / 255.0;
// Copy data
... | javascript | function draw_layer(layer, x, y) {
// Draw layer
if (layer.width > 0 && layer.height > 0) {
// Save and update alpha
var initial_alpha = context.globalAlpha;
context.globalAlpha *= layer.alpha / 255.0;
// Copy data
... | [
"function",
"draw_layer",
"(",
"layer",
",",
"x",
",",
"y",
")",
"{",
"// Draw layer",
"if",
"(",
"layer",
".",
"width",
">",
"0",
"&&",
"layer",
".",
"height",
">",
"0",
")",
"{",
"// Save and update alpha",
"var",
"initial_alpha",
"=",
"context",
".",
... | Draws the contents of the given layer at the given coordinates | [
"Draws",
"the",
"contents",
"of",
"the",
"given",
"layer",
"at",
"the",
"given",
"coordinates"
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Display.js#L1175-L1199 |
36,295 | ILLGrenoble/guacamole-common-js | src/AudioPlayer.js | joinAudioPackets | function joinAudioPackets(packets) {
// Do not bother joining if one or fewer packets are in the queue
if (packets.length <= 1)
return packets[0];
// Determine total sample length of the entire queue
var totalLength = 0;
packets.forEach(function addPacketLengths(pac... | javascript | function joinAudioPackets(packets) {
// Do not bother joining if one or fewer packets are in the queue
if (packets.length <= 1)
return packets[0];
// Determine total sample length of the entire queue
var totalLength = 0;
packets.forEach(function addPacketLengths(pac... | [
"function",
"joinAudioPackets",
"(",
"packets",
")",
"{",
"// Do not bother joining if one or fewer packets are in the queue",
"if",
"(",
"packets",
".",
"length",
"<=",
"1",
")",
"return",
"packets",
"[",
"0",
"]",
";",
"// Determine total sample length of the entire queue... | Given an array of audio packets, returns a single audio packet
containing the concatenation of those packets.
@private
@param {SampleArray[]} packets
The array of audio packets to concatenate.
@returns {SampleArray}
A single audio packet containing the concatenation of all given
audio packets. If no packets are provi... | [
"Given",
"an",
"array",
"of",
"audio",
"packets",
"returns",
"a",
"single",
"audio",
"packet",
"containing",
"the",
"concatenation",
"of",
"those",
"packets",
"."
] | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/AudioPlayer.js#L228-L250 |
36,296 | ILLGrenoble/guacamole-common-js | src/AudioPlayer.js | splitAudioPacket | function splitAudioPacket(data) {
var minValue = Number.MAX_VALUE;
var optimalSplitLength = data.length;
// Calculate number of whole samples in the provided audio packet AND
// in the minimum possible split packet
var samples = Math.floor(data.length / format.channels);
... | javascript | function splitAudioPacket(data) {
var minValue = Number.MAX_VALUE;
var optimalSplitLength = data.length;
// Calculate number of whole samples in the provided audio packet AND
// in the minimum possible split packet
var samples = Math.floor(data.length / format.channels);
... | [
"function",
"splitAudioPacket",
"(",
"data",
")",
"{",
"var",
"minValue",
"=",
"Number",
".",
"MAX_VALUE",
";",
"var",
"optimalSplitLength",
"=",
"data",
".",
"length",
";",
"// Calculate number of whole samples in the provided audio packet AND",
"// in the minimum possible... | Given a single packet of audio data, splits off an arbitrary length of
audio data from the beginning of that packet, returning the split result
as an array of two packets. The split location is determined through an
algorithm intended to minimize the liklihood of audible clicking between
packets. If no such split locat... | [
"Given",
"a",
"single",
"packet",
"of",
"audio",
"data",
"splits",
"off",
"an",
"arbitrary",
"length",
"of",
"audio",
"data",
"from",
"the",
"beginning",
"of",
"that",
"packet",
"returning",
"the",
"split",
"result",
"as",
"an",
"array",
"of",
"two",
"pack... | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/AudioPlayer.js#L270-L318 |
36,297 | ILLGrenoble/guacamole-common-js | src/AudioPlayer.js | toAudioBuffer | function toAudioBuffer(data) {
// Calculate total number of samples
var samples = data.length / format.channels;
// Determine exactly when packet CAN play
var packetTime = context.currentTime;
if (nextPacketTime < packetTime)
nextPacketTime = packetTime;
//... | javascript | function toAudioBuffer(data) {
// Calculate total number of samples
var samples = data.length / format.channels;
// Determine exactly when packet CAN play
var packetTime = context.currentTime;
if (nextPacketTime < packetTime)
nextPacketTime = packetTime;
//... | [
"function",
"toAudioBuffer",
"(",
"data",
")",
"{",
"// Calculate total number of samples",
"var",
"samples",
"=",
"data",
".",
"length",
"/",
"format",
".",
"channels",
";",
"// Determine exactly when packet CAN play",
"var",
"packetTime",
"=",
"context",
".",
"curre... | Converts the given audio packet into an AudioBuffer, ready for playback
by the Web Audio API. Unlike the raw audio packets received by this
audio player, AudioBuffers require floating point samples and are split
into isolated planes of channel-specific data.
@private
@param {SampleArray} data
The raw audio packet that... | [
"Converts",
"the",
"given",
"audio",
"packet",
"into",
"an",
"AudioBuffer",
"ready",
"for",
"playback",
"by",
"the",
"Web",
"Audio",
"API",
".",
"Unlike",
"the",
"raw",
"audio",
"packets",
"received",
"by",
"this",
"audio",
"player",
"AudioBuffers",
"require",... | 71925794155ea3fc37d2a125adbca6f8be532887 | https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/AudioPlayer.js#L378-L407 |
36,298 | kibertoad/objection-swagger | lib/enrichers/schema.relationships.enricher.js | enrichSchemaWithRelationships | function enrichSchemaWithRelationships(
schema,
relationships,
isIncludeParentRelationships,
fromModelClass
) {
const processedSchema = _.cloneDeep(schema);
_.forOwn(relationships, (value, key) => {
let relationshipValue;
if (value.relation.name === constants.HasOneRelation) {
//protect from ... | javascript | function enrichSchemaWithRelationships(
schema,
relationships,
isIncludeParentRelationships,
fromModelClass
) {
const processedSchema = _.cloneDeep(schema);
_.forOwn(relationships, (value, key) => {
let relationshipValue;
if (value.relation.name === constants.HasOneRelation) {
//protect from ... | [
"function",
"enrichSchemaWithRelationships",
"(",
"schema",
",",
"relationships",
",",
"isIncludeParentRelationships",
",",
"fromModelClass",
")",
"{",
"const",
"processedSchema",
"=",
"_",
".",
"cloneDeep",
"(",
"schema",
")",
";",
"_",
".",
"forOwn",
"(",
"relat... | Creates copy of provided schema and enriches it with attributes that are derived from relationships
@param {Object} schema - JSON Schema
@param {Object} relationships - Objection.js relationMappings
@param {boolean} isIncludeParentRelationships - whether ManyToManyRelation and BelongsToOneRelation relationships should ... | [
"Creates",
"copy",
"of",
"provided",
"schema",
"and",
"enriches",
"it",
"with",
"attributes",
"that",
"are",
"derived",
"from",
"relationships"
] | 2109b58ce323e78252729a46bcc94e617035b541 | https://github.com/kibertoad/objection-swagger/blob/2109b58ce323e78252729a46bcc94e617035b541/lib/enrichers/schema.relationships.enricher.js#L12-L93 |
36,299 | aMarCruz/jspreproc | spec/uglify/core.js | mktag | function mktag(name, html, css, attrs, js, pcex) {
var
c = ', ',
s = '}' + (pcex.length ? ', ' + q(pcex._bp[8]) : '') + ');'
// give more consistency to the output
if (js && js.slice(-1) !== '\n') s = '\n' + s
return 'riot.tag2(\'' + name + "'" + c + q(html) + c + q(css) + c + q(attrs) +
', f... | javascript | function mktag(name, html, css, attrs, js, pcex) {
var
c = ', ',
s = '}' + (pcex.length ? ', ' + q(pcex._bp[8]) : '') + ');'
// give more consistency to the output
if (js && js.slice(-1) !== '\n') s = '\n' + s
return 'riot.tag2(\'' + name + "'" + c + q(html) + c + q(css) + c + q(attrs) +
', f... | [
"function",
"mktag",
"(",
"name",
",",
"html",
",",
"css",
",",
"attrs",
",",
"js",
",",
"pcex",
")",
"{",
"var",
"c",
"=",
"', '",
",",
"s",
"=",
"'}'",
"+",
"(",
"pcex",
".",
"length",
"?",
"', '",
"+",
"q",
"(",
"pcex",
".",
"_bp",
"[",
... | Generates the `riot.tag2` call with the processed parts. | [
"Generates",
"the",
"riot",
".",
"tag2",
"call",
"with",
"the",
"processed",
"parts",
"."
] | 5f31820d702a329e8aa25f0f3983f13097610250 | https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/core.js#L57-L67 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.