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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,900 | wavesoft/jbb | encoder.js | getDownscaleType | function getDownscaleType( n_type, analysis ) {
switch (n_type) {
// Not possible to downscale from 1-byte
case NUMTYPE.UINT8:
case NUMTYPE.INT8:
return NUMTYPE.UNKNOWN;
case NUMTYPE.UINT16:
switch (analysis.type) {
// UINT16 -> (U)INT8 = UINT8
case NUMTYPE.INT8: // Unsigned, so always positiv... | javascript | function getDownscaleType( n_type, analysis ) {
switch (n_type) {
// Not possible to downscale from 1-byte
case NUMTYPE.UINT8:
case NUMTYPE.INT8:
return NUMTYPE.UNKNOWN;
case NUMTYPE.UINT16:
switch (analysis.type) {
// UINT16 -> (U)INT8 = UINT8
case NUMTYPE.INT8: // Unsigned, so always positiv... | [
"function",
"getDownscaleType",
"(",
"n_type",
",",
"analysis",
")",
"{",
"switch",
"(",
"n_type",
")",
"{",
"// Not possible to downscale from 1-byte",
"case",
"NUMTYPE",
".",
"UINT8",
":",
"case",
"NUMTYPE",
".",
"INT8",
":",
"return",
"NUMTYPE",
".",
"UNKNOWN... | Get the possible downscale type based on the specified analysis | [
"Get",
"the",
"possible",
"downscale",
"type",
"based",
"on",
"the",
"specified",
"analysis"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L985-L1119 |
33,901 | wavesoft/jbb | encoder.js | getBestBinFit | function getBestBinFit( start, len, blocks ) {
var b, s, e, end = start + len, found = false,
c, last_c = 0, last_s = 0, last_i = -1, last_bin = null;
// Find the biggest chunk that can fit on these data
for (var bi=0, bl=blocks.length; bi<bl; ++bi) {
b = blocks[bi]; found = false;
for (var i=0, il=b.length; ... | javascript | function getBestBinFit( start, len, blocks ) {
var b, s, e, end = start + len, found = false,
c, last_c = 0, last_s = 0, last_i = -1, last_bin = null;
// Find the biggest chunk that can fit on these data
for (var bi=0, bl=blocks.length; bi<bl; ++bi) {
b = blocks[bi]; found = false;
for (var i=0, il=b.length; ... | [
"function",
"getBestBinFit",
"(",
"start",
",",
"len",
",",
"blocks",
")",
"{",
"var",
"b",
",",
"s",
",",
"e",
",",
"end",
"=",
"start",
"+",
"len",
",",
"found",
"=",
"false",
",",
"c",
",",
"last_c",
"=",
"0",
",",
"last_s",
"=",
"0",
",",
... | Pack the specified number of bins to the specified bounds | [
"Pack",
"the",
"specified",
"number",
"of",
"bins",
"to",
"the",
"specified",
"bounds"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L1299-L1350 |
33,902 | wavesoft/jbb | encoder.js | downscaleType | function downscaleType( fromType, toType ) {
// Lookup conversion on the downscale table
for (var i=0; i<NUMTYPE_DOWNSCALE.FROM.length; ++i) {
if ( (NUMTYPE_DOWNSCALE.FROM[i] === fromType) &&
(NUMTYPE_DOWNSCALE.TO[i] === toType) )
return i;
}
// Nothing found
return undefined;
} | javascript | function downscaleType( fromType, toType ) {
// Lookup conversion on the downscale table
for (var i=0; i<NUMTYPE_DOWNSCALE.FROM.length; ++i) {
if ( (NUMTYPE_DOWNSCALE.FROM[i] === fromType) &&
(NUMTYPE_DOWNSCALE.TO[i] === toType) )
return i;
}
// Nothing found
return undefined;
} | [
"function",
"downscaleType",
"(",
"fromType",
",",
"toType",
")",
"{",
"// Lookup conversion on the downscale table",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"NUMTYPE_DOWNSCALE",
".",
"FROM",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"("... | Pick a matching downscaling type | [
"Pick",
"a",
"matching",
"downscaling",
"type"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L1811-L1820 |
33,903 | wavesoft/jbb | encoder.js | deltaEncTypeInt | function deltaEncTypeInt( fromType, toType ) {
// Lookup conversion on the downscale table
for (var i=0; i<NUMTYPE_DELTA_INT.FROM.length; ++i) {
if ( (NUMTYPE_DELTA_INT.FROM[i] === fromType) &&
(NUMTYPE_DELTA_INT.TO[i] === toType) )
return i;
}
// Nothing found
return undefined;
} | javascript | function deltaEncTypeInt( fromType, toType ) {
// Lookup conversion on the downscale table
for (var i=0; i<NUMTYPE_DELTA_INT.FROM.length; ++i) {
if ( (NUMTYPE_DELTA_INT.FROM[i] === fromType) &&
(NUMTYPE_DELTA_INT.TO[i] === toType) )
return i;
}
// Nothing found
return undefined;
} | [
"function",
"deltaEncTypeInt",
"(",
"fromType",
",",
"toType",
")",
"{",
"// Lookup conversion on the downscale table",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"NUMTYPE_DELTA_INT",
".",
"FROM",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"... | Pick a matching delta encoding delta for integers | [
"Pick",
"a",
"matching",
"delta",
"encoding",
"delta",
"for",
"integers"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L1825-L1834 |
33,904 | wavesoft/jbb | encoder.js | deltaEncTypeFloat | function deltaEncTypeFloat( fromType, toType ) {
// Lookup conversion on the downscale table
for (var i=0; i<NUMTYPE_DELTA_FLOAT.FROM.length; ++i) {
if ( (NUMTYPE_DELTA_FLOAT.FROM[i] === fromType) &&
(NUMTYPE_DELTA_FLOAT.TO[i] === toType) )
return i;
}
// Nothing found
return undefined;
} | javascript | function deltaEncTypeFloat( fromType, toType ) {
// Lookup conversion on the downscale table
for (var i=0; i<NUMTYPE_DELTA_FLOAT.FROM.length; ++i) {
if ( (NUMTYPE_DELTA_FLOAT.FROM[i] === fromType) &&
(NUMTYPE_DELTA_FLOAT.TO[i] === toType) )
return i;
}
// Nothing found
return undefined;
} | [
"function",
"deltaEncTypeFloat",
"(",
"fromType",
",",
"toType",
")",
"{",
"// Lookup conversion on the downscale table",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"NUMTYPE_DELTA_FLOAT",
".",
"FROM",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",... | Pick a matching delta encoding delta for floats | [
"Pick",
"a",
"matching",
"delta",
"encoding",
"delta",
"for",
"floats"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L1839-L1848 |
33,905 | wavesoft/jbb | encoder.js | deltaEncodeIntegers | function deltaEncodeIntegers( array, numType ) {
var delta = new NUMTYPE_CLASS[numType]( array.length - 1 ), l = array[0];
for (var i=1; i<array.length; ++i) {
var v = array[i]; delta[i-1] = v - l; l = v;
}
return delta;
} | javascript | function deltaEncodeIntegers( array, numType ) {
var delta = new NUMTYPE_CLASS[numType]( array.length - 1 ), l = array[0];
for (var i=1; i<array.length; ++i) {
var v = array[i]; delta[i-1] = v - l; l = v;
}
return delta;
} | [
"function",
"deltaEncodeIntegers",
"(",
"array",
",",
"numType",
")",
"{",
"var",
"delta",
"=",
"new",
"NUMTYPE_CLASS",
"[",
"numType",
"]",
"(",
"array",
".",
"length",
"-",
"1",
")",
",",
"l",
"=",
"array",
"[",
"0",
"]",
";",
"for",
"(",
"var",
... | Encode an integer array with delta encoding
@param {array} - Source Array
@param {Class} - The class of the underlaying numeric array (ex. Uint8Array)
@return {array} - An array with the initial value and the delta-encoded payload | [
"Encode",
"an",
"integer",
"array",
"with",
"delta",
"encoding"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L1858-L1864 |
33,906 | wavesoft/jbb | encoder.js | convertArray | function convertArray( array, numType ) {
// Skip matching cases
if ( ((array instanceof Uint8Array) && (numType === NUMTYPE.UINT8)) ||
((array instanceof Int8Array) && (numType === NUMTYPE.INT8)) ||
((array instanceof Uint16Array) && (numType === NUMTYPE.UINT16)) ||
((array instanceof Int16Array) && (numTy... | javascript | function convertArray( array, numType ) {
// Skip matching cases
if ( ((array instanceof Uint8Array) && (numType === NUMTYPE.UINT8)) ||
((array instanceof Int8Array) && (numType === NUMTYPE.INT8)) ||
((array instanceof Uint16Array) && (numType === NUMTYPE.UINT16)) ||
((array instanceof Int16Array) && (numTy... | [
"function",
"convertArray",
"(",
"array",
",",
"numType",
")",
"{",
"// Skip matching cases",
"if",
"(",
"(",
"(",
"array",
"instanceof",
"Uint8Array",
")",
"&&",
"(",
"numType",
"===",
"NUMTYPE",
".",
"UINT8",
")",
")",
"||",
"(",
"(",
"array",
"instanceo... | Convert input array to the type specified
@param {array} array - The source array
@param {int} downscale_type - The downscaling conversion | [
"Convert",
"input",
"array",
"to",
"the",
"type",
"specified"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L1872-L1890 |
33,907 | wavesoft/jbb | encoder.js | mimeTypeFromFilename | function mimeTypeFromFilename( filename ) {
var ext = filename.split(".").pop().toLowerCase();
return mime.lookup(filename) || "application/octet-stream";
} | javascript | function mimeTypeFromFilename( filename ) {
var ext = filename.split(".").pop().toLowerCase();
return mime.lookup(filename) || "application/octet-stream";
} | [
"function",
"mimeTypeFromFilename",
"(",
"filename",
")",
"{",
"var",
"ext",
"=",
"filename",
".",
"split",
"(",
"\".\"",
")",
".",
"pop",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"return",
"mime",
".",
"lookup",
"(",
"filename",
")",
"||",
"\"appl... | Pick MIME type according to filename and known MIME Types | [
"Pick",
"MIME",
"type",
"according",
"to",
"filename",
"and",
"known",
"MIME",
"Types"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L1895-L1898 |
33,908 | wavesoft/jbb | encoder.js | bufferFromFile | function bufferFromFile( filename ) {
console.info( ("Loading "+filename).grey );
var buf = fs.readFileSync( filename ), // Load Buffer
ab = new ArrayBuffer( buf.length ), // Create an ArrayBuffer to fit the data
view = new Uint8Array(ab); // Create an Uint8Array view
// Copy buffer into view
for... | javascript | function bufferFromFile( filename ) {
console.info( ("Loading "+filename).grey );
var buf = fs.readFileSync( filename ), // Load Buffer
ab = new ArrayBuffer( buf.length ), // Create an ArrayBuffer to fit the data
view = new Uint8Array(ab); // Create an Uint8Array view
// Copy buffer into view
for... | [
"function",
"bufferFromFile",
"(",
"filename",
")",
"{",
"console",
".",
"info",
"(",
"(",
"\"Loading \"",
"+",
"filename",
")",
".",
"grey",
")",
";",
"var",
"buf",
"=",
"fs",
".",
"readFileSync",
"(",
"filename",
")",
",",
"// Load Buffer",
"ab",
"=",
... | Load a Uint8Array buffer from file | [
"Load",
"a",
"Uint8Array",
"buffer",
"from",
"file"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L1903-L1915 |
33,909 | wavesoft/jbb | encoder.js | pickStream | function pickStream(encoder, t) {
// Handle type
switch (t) {
case NUMTYPE.UINT8:
case NUMTYPE.INT8:
return encoder.stream8;
case NUMTYPE.UINT16:
case NUMTYPE.INT16:
return encoder.stream16;
case NUMTYPE.UINT32:
case NUMTYPE.INT32:
case NUMTYPE.FLOAT32:
return encoder.stream32;
case NUMTYPE.... | javascript | function pickStream(encoder, t) {
// Handle type
switch (t) {
case NUMTYPE.UINT8:
case NUMTYPE.INT8:
return encoder.stream8;
case NUMTYPE.UINT16:
case NUMTYPE.INT16:
return encoder.stream16;
case NUMTYPE.UINT32:
case NUMTYPE.INT32:
case NUMTYPE.FLOAT32:
return encoder.stream32;
case NUMTYPE.... | [
"function",
"pickStream",
"(",
"encoder",
",",
"t",
")",
"{",
"// Handle type",
"switch",
"(",
"t",
")",
"{",
"case",
"NUMTYPE",
".",
"UINT8",
":",
"case",
"NUMTYPE",
".",
"INT8",
":",
"return",
"encoder",
".",
"stream8",
";",
"case",
"NUMTYPE",
".",
"... | Select an encoder according to bit size | [
"Select",
"an",
"encoder",
"according",
"to",
"bit",
"size"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L1929-L1947 |
33,910 | wavesoft/jbb | encoder.js | encodeArray_NUM_DWS | function encodeArray_NUM_DWS( encoder, data, n_from, n_to ) {
//
// Downscaled Numeric Array (NUM_DWS)
//
// ... .... . + Data Length
// 000 [DWS_TYPE] [LN] [16bit/32bit]
//
// Get downscale type
var n_dws_type = downscaleType( n_from, n_to );
// console.log(">>>",data.constructor,":",_NUMTYPE[... | javascript | function encodeArray_NUM_DWS( encoder, data, n_from, n_to ) {
//
// Downscaled Numeric Array (NUM_DWS)
//
// ... .... . + Data Length
// 000 [DWS_TYPE] [LN] [16bit/32bit]
//
// Get downscale type
var n_dws_type = downscaleType( n_from, n_to );
// console.log(">>>",data.constructor,":",_NUMTYPE[... | [
"function",
"encodeArray_NUM_DWS",
"(",
"encoder",
",",
"data",
",",
"n_from",
",",
"n_to",
")",
"{",
"//",
"// Downscaled Numeric Array (NUM_DWS)",
"//",
"// ... .... . + Data Length",
"// 000 [DWS_TYPE] [LN] [16bit/32bit]",
"//",
"// Get downscale type",
"var",
... | Encode array data as downscaled | [
"Encode",
"array",
"data",
"as",
"downscaled"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L1952-L1984 |
33,911 | wavesoft/jbb | encoder.js | encodeArray_NUM_DELTA_FLOAT | function encodeArray_NUM_DELTA_FLOAT( encoder, data, n_from, n_to, pivot, f_scale ) {
//
// Pivot Float Numeric Array (NUM_DELTA_FLOAT)
//
// ... .... . + Data Length + Mean Value + Scale
// 001 [DWS_TYPE] [LN] [16bit/32bit] [F32/F64] [F32]
//
// Get downscale type
var n_delta_type... | javascript | function encodeArray_NUM_DELTA_FLOAT( encoder, data, n_from, n_to, pivot, f_scale ) {
//
// Pivot Float Numeric Array (NUM_DELTA_FLOAT)
//
// ... .... . + Data Length + Mean Value + Scale
// 001 [DWS_TYPE] [LN] [16bit/32bit] [F32/F64] [F32]
//
// Get downscale type
var n_delta_type... | [
"function",
"encodeArray_NUM_DELTA_FLOAT",
"(",
"encoder",
",",
"data",
",",
"n_from",
",",
"n_to",
",",
"pivot",
",",
"f_scale",
")",
"{",
"//",
"// Pivot Float Numeric Array (NUM_DELTA_FLOAT)",
"//",
"// ... .... . + Data Length + Mean Value + Scale",
"// 00... | Pivot-encode float array | [
"Pivot",
"-",
"encode",
"float",
"array"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L1989-L2038 |
33,912 | wavesoft/jbb | encoder.js | encodeArray_NUM_DELTA_INT | function encodeArray_NUM_DELTA_INT( encoder, data, n_from, n_to ) {
//
// Delta Numeric Array (NUM_DELTA_INT)
//
// ... .... . + Data Length + Initial Value
// 001 [DWS_TYPE] [LN] [16bit/32bit] [8bit/16bit/32bit]
//
// Get downscale type
var n_delta_type = deltaEncTypeInt( n_from, n_to );... | javascript | function encodeArray_NUM_DELTA_INT( encoder, data, n_from, n_to ) {
//
// Delta Numeric Array (NUM_DELTA_INT)
//
// ... .... . + Data Length + Initial Value
// 001 [DWS_TYPE] [LN] [16bit/32bit] [8bit/16bit/32bit]
//
// Get downscale type
var n_delta_type = deltaEncTypeInt( n_from, n_to );... | [
"function",
"encodeArray_NUM_DELTA_INT",
"(",
"encoder",
",",
"data",
",",
"n_from",
",",
"n_to",
")",
"{",
"//",
"// Delta Numeric Array (NUM_DELTA_INT)",
"//",
"// ... .... . + Data Length + Initial Value",
"// 001 [DWS_TYPE] [LN] [16bit/32bit] [8bit/16bit/32bi... | Encode array data as delta | [
"Encode",
"array",
"data",
"as",
"delta"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2043-L2082 |
33,913 | wavesoft/jbb | encoder.js | encodeArray_NUM_REPEATED | function encodeArray_NUM_REPEATED( encoder, data, n_type ) {
//
// Repeated Numeric Array (NUM_REPEATED)
//
// .... ... . + Data Length
// 0100 [TYPE] [LN] [16bit/32bit]
//
encoder.counters.arr_num_repeated+=1;
encoder.log(LOG.ARR, "array.numeric.repeated, len="+data.length+
", type="+_NUMTYPE[... | javascript | function encodeArray_NUM_REPEATED( encoder, data, n_type ) {
//
// Repeated Numeric Array (NUM_REPEATED)
//
// .... ... . + Data Length
// 0100 [TYPE] [LN] [16bit/32bit]
//
encoder.counters.arr_num_repeated+=1;
encoder.log(LOG.ARR, "array.numeric.repeated, len="+data.length+
", type="+_NUMTYPE[... | [
"function",
"encodeArray_NUM_REPEATED",
"(",
"encoder",
",",
"data",
",",
"n_type",
")",
"{",
"//",
"// Repeated Numeric Array (NUM_REPEATED)",
"//",
"// .... ... . + Data Length",
"// 0100 [TYPE] [LN] [16bit/32bit]",
"//",
"encoder",
".",
"counters",
".",
"arr_num... | Encode array data as repeated | [
"Encode",
"array",
"data",
"as",
"repeated"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2087-L2114 |
33,914 | wavesoft/jbb | encoder.js | encodeArray_NUM_RAW | function encodeArray_NUM_RAW( encoder, data, n_type ) {
//
// RAW Numeric Array (NUM_RAW)
//
// .... ... . + Data Length
// 0101 [TYPE] [LN] [16bit/32bit]
//
encoder.counters.arr_num_raw+=1;
encoder.log(LOG.ARR, "array.numeric.raw, len="+data.length+
", type="+_NUMTYPE[n_type]+" ("+n_type+")");
... | javascript | function encodeArray_NUM_RAW( encoder, data, n_type ) {
//
// RAW Numeric Array (NUM_RAW)
//
// .... ... . + Data Length
// 0101 [TYPE] [LN] [16bit/32bit]
//
encoder.counters.arr_num_raw+=1;
encoder.log(LOG.ARR, "array.numeric.raw, len="+data.length+
", type="+_NUMTYPE[n_type]+" ("+n_type+")");
... | [
"function",
"encodeArray_NUM_RAW",
"(",
"encoder",
",",
"data",
",",
"n_type",
")",
"{",
"//",
"// RAW Numeric Array (NUM_RAW)",
"//",
"// .... ... . + Data Length",
"// 0101 [TYPE] [LN] [16bit/32bit]",
"//",
"encoder",
".",
"counters",
".",
"arr_num_raw",
"+=",
... | Encode array data as raw | [
"Encode",
"array",
"data",
"as",
"raw"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2119-L2146 |
33,915 | wavesoft/jbb | encoder.js | encodeArray_NUM_SHORT | function encodeArray_NUM_SHORT( encoder, data, n_type ) {
//
// Short Numeric Array (NUM_SHORT)
//
// ..... ...
// 01110 [TYPE]
//
encoder.counters.arr_num_short+=1;
encoder.log(LOG.ARR, "array.numeric.short, len="+data.length+
", type="+_NUMTYPE[n_type]+" ("+n_type+")");
// Encode primitives one after t... | javascript | function encodeArray_NUM_SHORT( encoder, data, n_type ) {
//
// Short Numeric Array (NUM_SHORT)
//
// ..... ...
// 01110 [TYPE]
//
encoder.counters.arr_num_short+=1;
encoder.log(LOG.ARR, "array.numeric.short, len="+data.length+
", type="+_NUMTYPE[n_type]+" ("+n_type+")");
// Encode primitives one after t... | [
"function",
"encodeArray_NUM_SHORT",
"(",
"encoder",
",",
"data",
",",
"n_type",
")",
"{",
"//",
"// Short Numeric Array (NUM_SHORT)",
"//",
"// ..... ...",
"// 01110 [TYPE]",
"//",
"encoder",
".",
"counters",
".",
"arr_num_short",
"+=",
"1",
";",
"encoder",
".",
... | Encode array data as short typed | [
"Encode",
"array",
"data",
"as",
"short",
"typed"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2151-L2173 |
33,916 | wavesoft/jbb | encoder.js | encodeArray_PRIM_BULK_PLAIN | function encodeArray_PRIM_BULK_PLAIN( encoder, data, properties ) {
//
// Bulk Array of Primitives (PRIM_BULK_PLAIN)
//
// ........ + Signature ID
// 01111000 [16-bit]
//
// Lookup signature
var eid = encoder.getSignatureID( properties ), weave = [];
encoder.counters.arr_prim_bulk_plain+=1;
encoder.log(... | javascript | function encodeArray_PRIM_BULK_PLAIN( encoder, data, properties ) {
//
// Bulk Array of Primitives (PRIM_BULK_PLAIN)
//
// ........ + Signature ID
// 01111000 [16-bit]
//
// Lookup signature
var eid = encoder.getSignatureID( properties ), weave = [];
encoder.counters.arr_prim_bulk_plain+=1;
encoder.log(... | [
"function",
"encodeArray_PRIM_BULK_PLAIN",
"(",
"encoder",
",",
"data",
",",
"properties",
")",
"{",
"//",
"// Bulk Array of Primitives (PRIM_BULK_PLAIN)",
"//",
"// ........ + Signature ID",
"// 01111000 [16-bit]",
"//",
"// Lookup signature",
"var",
"eid",
"=",
"encoder... | Encode array data as bulk of plain objects | [
"Encode",
"array",
"data",
"as",
"bulk",
"of",
"plain",
"objects"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2178-L2219 |
33,917 | wavesoft/jbb | encoder.js | encodeLIREF | function encodeLIREF(encoder, op8, op16, local_ids, xrid) {
var DEBUG_THIS = false;
// Check if the given object is part of the array
var id=-1, i=0, l=local_ids.length;
for (;i<l;++i) {
if (i > 65535) break;
if (local_ids[i] === xrid) {
id = i;
break;
}
}
if (id === -1) { // IREF
op8.push( pack1b... | javascript | function encodeLIREF(encoder, op8, op16, local_ids, xrid) {
var DEBUG_THIS = false;
// Check if the given object is part of the array
var id=-1, i=0, l=local_ids.length;
for (;i<l;++i) {
if (i > 65535) break;
if (local_ids[i] === xrid) {
id = i;
break;
}
}
if (id === -1) { // IREF
op8.push( pack1b... | [
"function",
"encodeLIREF",
"(",
"encoder",
",",
"op8",
",",
"op16",
",",
"local_ids",
",",
"xrid",
")",
"{",
"var",
"DEBUG_THIS",
"=",
"false",
";",
"// Check if the given object is part of the array",
"var",
"id",
"=",
"-",
"1",
",",
"i",
"=",
"0",
",",
"... | Helper function to encode local-lookup internal references | [
"Helper",
"function",
"to",
"encode",
"local",
"-",
"lookup",
"internal",
"references"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2225-L2260 |
33,918 | wavesoft/jbb | encoder.js | encodeArray_PRIM_SHORT | function encodeArray_PRIM_SHORT( encoder, data ) {
//
// Short Primitive Array (PRIM_SHORT)
//
// ........
// 01111100
//
// Open log group
encoder.counters.arr_prim_short+=1;
encoder.log(LOG.ARR, "array.prim.short, len="+data.length+
", peek="+data[0]+" [");
encoder.logIndent(1);
// Encode primitives o... | javascript | function encodeArray_PRIM_SHORT( encoder, data ) {
//
// Short Primitive Array (PRIM_SHORT)
//
// ........
// 01111100
//
// Open log group
encoder.counters.arr_prim_short+=1;
encoder.log(LOG.ARR, "array.prim.short, len="+data.length+
", peek="+data[0]+" [");
encoder.logIndent(1);
// Encode primitives o... | [
"function",
"encodeArray_PRIM_SHORT",
"(",
"encoder",
",",
"data",
")",
"{",
"//",
"// Short Primitive Array (PRIM_SHORT)",
"//",
"// ........",
"// 01111100",
"//",
"// Open log group",
"encoder",
".",
"counters",
".",
"arr_prim_short",
"+=",
"1",
";",
"encoder",
"."... | Encode array data as a short array of primitives | [
"Encode",
"array",
"data",
"as",
"a",
"short",
"array",
"of",
"primitives"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2488-L2517 |
33,919 | wavesoft/jbb | encoder.js | encodeArray_PRIM_REPEATED | function encodeArray_PRIM_REPEATED( encoder, data ) {
//
// Repeated Primitive Array (PRIM_REPEATED)
//
// ....... . + Signature ID
// 0111100 [LN] [16-bit]
//
encoder.counters.arr_prim_repeated+=1;
encoder.log(LOG.ARR, "array.prim.repeated, len="+data.length+
", peek="+data[0]);
if (data.length < ... | javascript | function encodeArray_PRIM_REPEATED( encoder, data ) {
//
// Repeated Primitive Array (PRIM_REPEATED)
//
// ....... . + Signature ID
// 0111100 [LN] [16-bit]
//
encoder.counters.arr_prim_repeated+=1;
encoder.log(LOG.ARR, "array.prim.repeated, len="+data.length+
", peek="+data[0]);
if (data.length < ... | [
"function",
"encodeArray_PRIM_REPEATED",
"(",
"encoder",
",",
"data",
")",
"{",
"//",
"// Repeated Primitive Array (PRIM_REPEATED)",
"//",
"// ....... . + Signature ID",
"// 0111100 [LN] [16-bit]",
"//",
"encoder",
".",
"counters",
".",
"arr_prim_repeated",
"+=",
"1",
... | Encode array data as one repeated chunk | [
"Encode",
"array",
"data",
"as",
"one",
"repeated",
"chunk"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2522-L2548 |
33,920 | wavesoft/jbb | encoder.js | encodeArray_PRIM_RAW | function encodeArray_PRIM_RAW( encoder, data ) {
//
// Raw Primitive Array (PRIM_RAW)
//
// ....... . + Signature ID
// 0110101 [LN] [16-bit]
//
// Write chunk header
encoder.counters.arr_prim_raw+=1;
encoder.log(LOG.ARR, "array.prim.raw, len="+data.length+
", peek="+data[0]+" [");
encoder.logInden... | javascript | function encodeArray_PRIM_RAW( encoder, data ) {
//
// Raw Primitive Array (PRIM_RAW)
//
// ....... . + Signature ID
// 0110101 [LN] [16-bit]
//
// Write chunk header
encoder.counters.arr_prim_raw+=1;
encoder.log(LOG.ARR, "array.prim.raw, len="+data.length+
", peek="+data[0]+" [");
encoder.logInden... | [
"function",
"encodeArray_PRIM_RAW",
"(",
"encoder",
",",
"data",
")",
"{",
"//",
"// Raw Primitive Array (PRIM_RAW)",
"//",
"// ....... . + Signature ID",
"// 0110101 [LN] [16-bit]",
"//",
"// Write chunk header",
"encoder",
".",
"counters",
".",
"arr_prim_raw",
"+=",
... | Encode a number of consecutive primitives | [
"Encode",
"a",
"number",
"of",
"consecutive",
"primitives"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2553-L2586 |
33,921 | wavesoft/jbb | encoder.js | encodeArray_PRIM_CHUNK | function encodeArray_PRIM_CHUNK( encoder, data, chunks ) {
//
// Chunked Primitive Array (PRIM_CHUNK)
//
// ........
// 01111101
//
var chunk, chunkType, chunkSize, chunkSubType, part, num_flag = 0x2;
// Check if all chunks are numeric
if (!chunks.is_numeric) num_flag = 0;
// Write chunk header
if (data.... | javascript | function encodeArray_PRIM_CHUNK( encoder, data, chunks ) {
//
// Chunked Primitive Array (PRIM_CHUNK)
//
// ........
// 01111101
//
var chunk, chunkType, chunkSize, chunkSubType, part, num_flag = 0x2;
// Check if all chunks are numeric
if (!chunks.is_numeric) num_flag = 0;
// Write chunk header
if (data.... | [
"function",
"encodeArray_PRIM_CHUNK",
"(",
"encoder",
",",
"data",
",",
"chunks",
")",
"{",
"//",
"// Chunked Primitive Array (PRIM_CHUNK)",
"//",
"// ........",
"// 01111101",
"//",
"var",
"chunk",
",",
"chunkType",
",",
"chunkSize",
",",
"chunkSubType",
",",
"part... | Encode array data as one or more chunks of other types | [
"Encode",
"array",
"data",
"as",
"one",
"or",
"more",
"chunks",
"of",
"other",
"types"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2591-L2635 |
33,922 | wavesoft/jbb | encoder.js | encodeArray_EMPTY | function encodeArray_EMPTY( encoder ) {
//
// Empty Array (EMPTY)
//
// ........
// 01111110
//
encoder.counters.arr_empty+=1;
encoder.log(LOG.ARR, "array.empty");
encoder.stream8.write( pack1b( ARR_OP.EMPTY ) );
encoder.counters.op_prm+=1;
} | javascript | function encodeArray_EMPTY( encoder ) {
//
// Empty Array (EMPTY)
//
// ........
// 01111110
//
encoder.counters.arr_empty+=1;
encoder.log(LOG.ARR, "array.empty");
encoder.stream8.write( pack1b( ARR_OP.EMPTY ) );
encoder.counters.op_prm+=1;
} | [
"function",
"encodeArray_EMPTY",
"(",
"encoder",
")",
"{",
"//",
"// Empty Array (EMPTY)",
"//",
"// ........",
"// 01111110",
"//",
"encoder",
".",
"counters",
".",
"arr_empty",
"+=",
"1",
";",
"encoder",
".",
"log",
"(",
"LOG",
".",
"ARR",
",",
"\"array.empt... | Encode array data as an empty array | [
"Encode",
"array",
"data",
"as",
"an",
"empty",
"array"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2640-L2654 |
33,923 | wavesoft/jbb | encoder.js | encodeArray_Chunk | function encodeArray_Chunk( encoder, data, chunk ) {
var n_type, na;
// console.log(">>> CFWA Chunk="+_ARR_CHUNK[chunk[2]],", from=" + chunk[0] + ", len=" + chunk[1] + ", arr=" + data.length);
// console.log(">>> =",data);
// Encode array component according to chunk type
switch (chunk[2]) {
// Encode as an a... | javascript | function encodeArray_Chunk( encoder, data, chunk ) {
var n_type, na;
// console.log(">>> CFWA Chunk="+_ARR_CHUNK[chunk[2]],", from=" + chunk[0] + ", len=" + chunk[1] + ", arr=" + data.length);
// console.log(">>> =",data);
// Encode array component according to chunk type
switch (chunk[2]) {
// Encode as an a... | [
"function",
"encodeArray_Chunk",
"(",
"encoder",
",",
"data",
",",
"chunk",
")",
"{",
"var",
"n_type",
",",
"na",
";",
"// console.log(\">>> CFWA Chunk=\"+_ARR_CHUNK[chunk[2]],\", from=\" + chunk[0] + \", len=\" + chunk[1] + \", arr=\" + data.length);",
"// console.log(\">>> =\",data... | Encode an array chunk, previously constructed
by chunkForwardanalysis | [
"Encode",
"an",
"array",
"chunk",
"previously",
"constructed",
"by",
"chunkForwardanalysis"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2660-L2724 |
33,924 | wavesoft/jbb | encoder.js | encodeArray_Numeric | function encodeArray_Numeric( encoder, data, n_type ) {
var na, keep = true, v, lv, same = true;
// Separate small array case
if (data.length < 256) {
// If the numeric type is unknown, try to find actual type
if (n_type === NUMTYPE.NUMERIC) {
// Perform fast numeric analysis (skip delta)
na = analyzeNu... | javascript | function encodeArray_Numeric( encoder, data, n_type ) {
var na, keep = true, v, lv, same = true;
// Separate small array case
if (data.length < 256) {
// If the numeric type is unknown, try to find actual type
if (n_type === NUMTYPE.NUMERIC) {
// Perform fast numeric analysis (skip delta)
na = analyzeNu... | [
"function",
"encodeArray_Numeric",
"(",
"encoder",
",",
"data",
",",
"n_type",
")",
"{",
"var",
"na",
",",
"keep",
"=",
"true",
",",
"v",
",",
"lv",
",",
"same",
"=",
"true",
";",
"// Separate small array case",
"if",
"(",
"data",
".",
"length",
"<",
"... | Encode an array that is already classified as numeric | [
"Encode",
"an",
"array",
"that",
"is",
"already",
"classified",
"as",
"numeric"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2729-L2856 |
33,925 | wavesoft/jbb | encoder.js | encodeArray_Primitive | function encodeArray_Primitive( encoder, data ) {
// Analyze primitive array and return clusters of values
// that can be efficiently merged (such as numbers, repeated values,
// primitives etc.)
var chunks = analyzePrimitiveArray( encoder, data );
if (chunks.length === 1) {
// Just check
if (chunks[0][1] !=... | javascript | function encodeArray_Primitive( encoder, data ) {
// Analyze primitive array and return clusters of values
// that can be efficiently merged (such as numbers, repeated values,
// primitives etc.)
var chunks = analyzePrimitiveArray( encoder, data );
if (chunks.length === 1) {
// Just check
if (chunks[0][1] !=... | [
"function",
"encodeArray_Primitive",
"(",
"encoder",
",",
"data",
")",
"{",
"// Analyze primitive array and return clusters of values",
"// that can be efficiently merged (such as numbers, repeated values,",
"// primitives etc.)",
"var",
"chunks",
"=",
"analyzePrimitiveArray",
"(",
"... | Encode an array that is already classified as primitive | [
"Encode",
"an",
"array",
"that",
"is",
"already",
"classified",
"as",
"primitive"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2861-L2884 |
33,926 | wavesoft/jbb | encoder.js | encodeArray | function encodeArray( encoder, data ) {
encoder.log(LOG.PRM, "array, len="+data.length+", peek="+data[0]);
// Check for empty array
if (data.length === 0) {
encodeArray_EMPTY( encoder );
return;
}
// Get typed array typed
var tt = getTypedArrayType(data);
// Check for numerical array
if ( tt <= NUMTYPE.... | javascript | function encodeArray( encoder, data ) {
encoder.log(LOG.PRM, "array, len="+data.length+", peek="+data[0]);
// Check for empty array
if (data.length === 0) {
encodeArray_EMPTY( encoder );
return;
}
// Get typed array typed
var tt = getTypedArrayType(data);
// Check for numerical array
if ( tt <= NUMTYPE.... | [
"function",
"encodeArray",
"(",
"encoder",
",",
"data",
")",
"{",
"encoder",
".",
"log",
"(",
"LOG",
".",
"PRM",
",",
"\"array, len=\"",
"+",
"data",
".",
"length",
"+",
"\", peek=\"",
"+",
"data",
"[",
"0",
"]",
")",
";",
"// Check for empty array",
"if... | Encode the specified array | [
"Encode",
"the",
"specified",
"array"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2889-L2908 |
33,927 | wavesoft/jbb | encoder.js | encodeBuffer | function encodeBuffer( encoder, buffer_type, mime_type, buffer ) {
// Write buffer header according to buffer length
if (buffer.length < UINT8_MAX) {
encoder.stream8.write( pack1b( PRIM_OP.BUFFER | buffer_type | 0x00 ) );
encoder.stream8.write( pack1b( buffer.length ) );
encoder.counters.dat_hdr+=2;
} else if... | javascript | function encodeBuffer( encoder, buffer_type, mime_type, buffer ) {
// Write buffer header according to buffer length
if (buffer.length < UINT8_MAX) {
encoder.stream8.write( pack1b( PRIM_OP.BUFFER | buffer_type | 0x00 ) );
encoder.stream8.write( pack1b( buffer.length ) );
encoder.counters.dat_hdr+=2;
} else if... | [
"function",
"encodeBuffer",
"(",
"encoder",
",",
"buffer_type",
",",
"mime_type",
",",
"buffer",
")",
"{",
"// Write buffer header according to buffer length",
"if",
"(",
"buffer",
".",
"length",
"<",
"UINT8_MAX",
")",
"{",
"encoder",
".",
"stream8",
".",
"write",... | Encode buffer in the array | [
"Encode",
"buffer",
"in",
"the",
"array"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2913-L2952 |
33,928 | wavesoft/jbb | encoder.js | encodeEmbeddedFileBuffer | function encodeEmbeddedFileBuffer( encoder, buffer_type, filename, mime_type ) {
// Get MIME And payload
var mime = mime_type || mimeTypeFromFilename( filename ),
mime_id = encoder.stringID( mime ),
buffer = bufferFromFile( filename );
// Write buffer header
encoder.log(LOG.EMB,"file='"+filename+"', mime="+mim... | javascript | function encodeEmbeddedFileBuffer( encoder, buffer_type, filename, mime_type ) {
// Get MIME And payload
var mime = mime_type || mimeTypeFromFilename( filename ),
mime_id = encoder.stringID( mime ),
buffer = bufferFromFile( filename );
// Write buffer header
encoder.log(LOG.EMB,"file='"+filename+"', mime="+mim... | [
"function",
"encodeEmbeddedFileBuffer",
"(",
"encoder",
",",
"buffer_type",
",",
"filename",
",",
"mime_type",
")",
"{",
"// Get MIME And payload",
"var",
"mime",
"=",
"mime_type",
"||",
"mimeTypeFromFilename",
"(",
"filename",
")",
",",
"mime_id",
"=",
"encoder",
... | Enbode a file as an embedded buffer | [
"Enbode",
"a",
"file",
"as",
"an",
"embedded",
"buffer"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2957-L2967 |
33,929 | wavesoft/jbb | encoder.js | encodeEmbeddedBlobBuffer | function encodeEmbeddedBlobBuffer( encoder, buffer_type, buffer, mime_type ) {
// Get MIME And payload
var mime_id = encoder.stringID( mime_type );
// Write buffer header
encoder.log(LOG.EMB,"file=[blob]', mime="+mime+", len="+buffer.length);
encodeBuffer( encoder, buffer_type, mime_id, buffer );
} | javascript | function encodeEmbeddedBlobBuffer( encoder, buffer_type, buffer, mime_type ) {
// Get MIME And payload
var mime_id = encoder.stringID( mime_type );
// Write buffer header
encoder.log(LOG.EMB,"file=[blob]', mime="+mime+", len="+buffer.length);
encodeBuffer( encoder, buffer_type, mime_id, buffer );
} | [
"function",
"encodeEmbeddedBlobBuffer",
"(",
"encoder",
",",
"buffer_type",
",",
"buffer",
",",
"mime_type",
")",
"{",
"// Get MIME And payload",
"var",
"mime_id",
"=",
"encoder",
".",
"stringID",
"(",
"mime_type",
")",
";",
"// Write buffer header",
"encoder",
".",... | Enbod a blob as an embedded buffer | [
"Enbod",
"a",
"blob",
"as",
"an",
"embedded",
"buffer"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2972-L2980 |
33,930 | wavesoft/jbb | encoder.js | encodeStringBuffer | function encodeStringBuffer( encoder, str, utf8 ) {
// If we do not have an explicit utf8 or not decision, pick one now
if (utf8 === undefined) {
utf8 = false; // Assume false
for (var i=0, strLen=str.length; i<strLen; ++i) {
if (str.charCodeAt(i) > 255) {
utf8 = true; break;
}
}
}
// Allocate buf... | javascript | function encodeStringBuffer( encoder, str, utf8 ) {
// If we do not have an explicit utf8 or not decision, pick one now
if (utf8 === undefined) {
utf8 = false; // Assume false
for (var i=0, strLen=str.length; i<strLen; ++i) {
if (str.charCodeAt(i) > 255) {
utf8 = true; break;
}
}
}
// Allocate buf... | [
"function",
"encodeStringBuffer",
"(",
"encoder",
",",
"str",
",",
"utf8",
")",
"{",
"// If we do not have an explicit utf8 or not decision, pick one now",
"if",
"(",
"utf8",
"===",
"undefined",
")",
"{",
"utf8",
"=",
"false",
";",
"// Assume false",
"for",
"(",
"va... | Encode a string as buffer | [
"Encode",
"a",
"string",
"as",
"buffer"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L2985-L3019 |
33,931 | wavesoft/jbb | encoder.js | encodeIREF | function encodeIREF( encoder, id ) {
var hi = (id & 0xF0000) >> 16,
lo = (id & 0xFFFF)
// Write opcode splitted inti 8-bit and 16-bit
encoder.log(LOG.IREF, "iref="+id);
encoder.stream8.write( pack1b( PRIM_OP.REF | hi, false ) );
encoder.stream16.write( pack2b( lo, false ) );
encoder.counters.op_iref+=3;
} | javascript | function encodeIREF( encoder, id ) {
var hi = (id & 0xF0000) >> 16,
lo = (id & 0xFFFF)
// Write opcode splitted inti 8-bit and 16-bit
encoder.log(LOG.IREF, "iref="+id);
encoder.stream8.write( pack1b( PRIM_OP.REF | hi, false ) );
encoder.stream16.write( pack2b( lo, false ) );
encoder.counters.op_iref+=3;
} | [
"function",
"encodeIREF",
"(",
"encoder",
",",
"id",
")",
"{",
"var",
"hi",
"=",
"(",
"id",
"&",
"0xF0000",
")",
">>",
"16",
",",
"lo",
"=",
"(",
"id",
"&",
"0xFFFF",
")",
"// Write opcode splitted inti 8-bit and 16-bit ",
"encoder",
".",
"log",
"(",
"LO... | Encode an 20-bit I-REF opcode | [
"Encode",
"an",
"20",
"-",
"bit",
"I",
"-",
"REF",
"opcode"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3024-L3034 |
33,932 | wavesoft/jbb | encoder.js | encodeXREF | function encodeXREF( encoder, id ) {
// Write opcode for 16-bit lookup
encoder.log(LOG.XREF, "xref="+id+" [" + encoder.stringLookup[id] + "]")
encoder.stream8.write( pack1b( PRIM_OP.IMPORT, false ) );
encoder.stream16.write( pack2b( id, false ) );
encoder.counters.op_xref+=3;
} | javascript | function encodeXREF( encoder, id ) {
// Write opcode for 16-bit lookup
encoder.log(LOG.XREF, "xref="+id+" [" + encoder.stringLookup[id] + "]")
encoder.stream8.write( pack1b( PRIM_OP.IMPORT, false ) );
encoder.stream16.write( pack2b( id, false ) );
encoder.counters.op_xref+=3;
} | [
"function",
"encodeXREF",
"(",
"encoder",
",",
"id",
")",
"{",
"// Write opcode for 16-bit lookup ",
"encoder",
".",
"log",
"(",
"LOG",
".",
"XREF",
",",
"\"xref=\"",
"+",
"id",
"+",
"\" [\"",
"+",
"encoder",
".",
"stringLookup",
"[",
"id",
"]",
"+",
"\"]\... | Encode an 16-bit X-REF opcode | [
"Encode",
"an",
"16",
"-",
"bit",
"X",
"-",
"REF",
"opcode"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3039-L3047 |
33,933 | wavesoft/jbb | encoder.js | encodeObject | function encodeObject( encoder, object ) {
// Check ByRef internally
var id = encoder.lookupIRef( object );
if (id > -1) { encodeIREF( encoder, id ); return; }
// Check ByRef externally
id = encoder.lookupXRef( object );
if (id > -1) { encodeXREF( encoder, id); return }
// Lookup object type
var enc = encode... | javascript | function encodeObject( encoder, object ) {
// Check ByRef internally
var id = encoder.lookupIRef( object );
if (id > -1) { encodeIREF( encoder, id ); return; }
// Check ByRef externally
id = encoder.lookupXRef( object );
if (id > -1) { encodeXREF( encoder, id); return }
// Lookup object type
var enc = encode... | [
"function",
"encodeObject",
"(",
"encoder",
",",
"object",
")",
"{",
"// Check ByRef internally",
"var",
"id",
"=",
"encoder",
".",
"lookupIRef",
"(",
"object",
")",
";",
"if",
"(",
"id",
">",
"-",
"1",
")",
"{",
"encodeIREF",
"(",
"encoder",
",",
"id",
... | Encode a javascript object | [
"Encode",
"a",
"javascript",
"object"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3052-L3103 |
33,934 | wavesoft/jbb | encoder.js | encodePrimitiveDate | function encodePrimitiveDate( encoder, object ) {
// We have a date primitive
encoder.stream8.write( pack1b( PRIM_OP.OBJECT | OBJ_OP.PRIMITIVE | OBJ_PRIM.DATE ) );
// Save date and timezone
encoder.stream64.write( pack8f( Number(object) ) );
encoder.stream16.write( pack1b( object.getTimezoneOffset() / 10, true )... | javascript | function encodePrimitiveDate( encoder, object ) {
// We have a date primitive
encoder.stream8.write( pack1b( PRIM_OP.OBJECT | OBJ_OP.PRIMITIVE | OBJ_PRIM.DATE ) );
// Save date and timezone
encoder.stream64.write( pack8f( Number(object) ) );
encoder.stream16.write( pack1b( object.getTimezoneOffset() / 10, true )... | [
"function",
"encodePrimitiveDate",
"(",
"encoder",
",",
"object",
")",
"{",
"// We have a date primitive",
"encoder",
".",
"stream8",
".",
"write",
"(",
"pack1b",
"(",
"PRIM_OP",
".",
"OBJECT",
"|",
"OBJ_OP",
".",
"PRIMITIVE",
"|",
"OBJ_PRIM",
".",
"DATE",
")"... | Encode primitive date | [
"Encode",
"primitive",
"date"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3108-L3117 |
33,935 | wavesoft/jbb | encoder.js | encodePlainObject | function encodePlainObject( encoder, object ) {
// Extract plain object signature
var o_keys =Object.keys(object);
// signature = o_keys.join("+"),
var sid = encoder.getSignatureID( o_keys );
// Collect values of all properties
var values = [];
for (var i=0, len=o_keys.length; i<len; ++i)
values.push( objec... | javascript | function encodePlainObject( encoder, object ) {
// Extract plain object signature
var o_keys =Object.keys(object);
// signature = o_keys.join("+"),
var sid = encoder.getSignatureID( o_keys );
// Collect values of all properties
var values = [];
for (var i=0, len=o_keys.length; i<len; ++i)
values.push( objec... | [
"function",
"encodePlainObject",
"(",
"encoder",
",",
"object",
")",
"{",
"// Extract plain object signature",
"var",
"o_keys",
"=",
"Object",
".",
"keys",
"(",
"object",
")",
";",
"// signature = o_keys.join(\"+\"),",
"var",
"sid",
"=",
"encoder",
".",
"getSignatur... | Encode plain object | [
"Encode",
"plain",
"object"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3122-L3148 |
33,936 | wavesoft/jbb | encoder.js | encodePrimitive_NUMBER | function encodePrimitive_NUMBER(encoder, data, type) {
// Write header
encoder.log(LOG.PRM, "primitive.number, type="+_NUMTYPE[numType]+", n="+data);
encoder.stream8.write( pack1b( PRIM_OP.NUMBER | numType ) );
encoder.counters.op_prm+=1;
// Write data
pickStream( encoder, numType )
.write( packByNumType[numT... | javascript | function encodePrimitive_NUMBER(encoder, data, type) {
// Write header
encoder.log(LOG.PRM, "primitive.number, type="+_NUMTYPE[numType]+", n="+data);
encoder.stream8.write( pack1b( PRIM_OP.NUMBER | numType ) );
encoder.counters.op_prm+=1;
// Write data
pickStream( encoder, numType )
.write( packByNumType[numT... | [
"function",
"encodePrimitive_NUMBER",
"(",
"encoder",
",",
"data",
",",
"type",
")",
"{",
"// Write header",
"encoder",
".",
"log",
"(",
"LOG",
".",
"PRM",
",",
"\"primitive.number, type=\"",
"+",
"_NUMTYPE",
"[",
"numType",
"]",
"+",
"\", n=\"",
"+",
"data",
... | Encode a primitive number | [
"Encode",
"a",
"primitive",
"number"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3153-L3164 |
33,937 | wavesoft/jbb | encoder.js | function(string) {
var index = this.stringLookupQuick[string];
// If missing, allocate now
if (index === undefined) {
index = this.stringLookup.length;
this.stringLookup.push( string );
this.stringLookupQuick[string]= index;
}
return index;
} | javascript | function(string) {
var index = this.stringLookupQuick[string];
// If missing, allocate now
if (index === undefined) {
index = this.stringLookup.length;
this.stringLookup.push( string );
this.stringLookupQuick[string]= index;
}
return index;
} | [
"function",
"(",
"string",
")",
"{",
"var",
"index",
"=",
"this",
".",
"stringLookupQuick",
"[",
"string",
"]",
";",
"// If missing, allocate now",
"if",
"(",
"index",
"===",
"undefined",
")",
"{",
"index",
"=",
"this",
".",
"stringLookup",
".",
"length",
... | Allocate new ID to return the ID of an existring
string from file string lookup table. | [
"Allocate",
"new",
"ID",
"to",
"return",
"the",
"ID",
"of",
"an",
"existring",
"string",
"from",
"file",
"string",
"lookup",
"table",
"."
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3685-L3694 | |
33,938 | wavesoft/jbb | encoder.js | function( propertyTable, eid ) {
// Check if we have a BST for this type
if (this.indexVal[eid] !== undefined) {
var id = this.indexVal[eid].search( propertyTable );
if (id.length > 0) return id[0];
}
// We don't have the item or the BST
return -1;
} | javascript | function( propertyTable, eid ) {
// Check if we have a BST for this type
if (this.indexVal[eid] !== undefined) {
var id = this.indexVal[eid].search( propertyTable );
if (id.length > 0) return id[0];
}
// We don't have the item or the BST
return -1;
} | [
"function",
"(",
"propertyTable",
",",
"eid",
")",
"{",
"// Check if we have a BST for this type",
"if",
"(",
"this",
".",
"indexVal",
"[",
"eid",
"]",
"!==",
"undefined",
")",
"{",
"var",
"id",
"=",
"this",
".",
"indexVal",
"[",
"eid",
"]",
".",
"search",... | Lookup if that object already exits in the i-ref table
and return it's ID, using it's values and not it's contents. | [
"Lookup",
"if",
"that",
"object",
"already",
"exits",
"in",
"the",
"i",
"-",
"ref",
"table",
"and",
"return",
"it",
"s",
"ID",
"using",
"it",
"s",
"values",
"and",
"not",
"it",
"s",
"contents",
"."
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3713-L3721 | |
33,939 | wavesoft/jbb | encoder.js | function( object, propertyTable, eid ) {
// Create a new BST for this entity for by-value matching
if (this.indexVal[eid] === undefined)
this.indexVal[eid] = new BinarySearchTree({
compareKeys: objectBstComparison,
checkValueEquality: objectBstEquals,
unique: true,
});
// Keep object reference... | javascript | function( object, propertyTable, eid ) {
// Create a new BST for this entity for by-value matching
if (this.indexVal[eid] === undefined)
this.indexVal[eid] = new BinarySearchTree({
compareKeys: objectBstComparison,
checkValueEquality: objectBstEquals,
unique: true,
});
// Keep object reference... | [
"function",
"(",
"object",
",",
"propertyTable",
",",
"eid",
")",
"{",
"// Create a new BST for this entity for by-value matching",
"if",
"(",
"this",
".",
"indexVal",
"[",
"eid",
"]",
"===",
"undefined",
")",
"this",
".",
"indexVal",
"[",
"eid",
"]",
"=",
"ne... | Keep the specified object in the lookup tables | [
"Keep",
"the",
"specified",
"object",
"in",
"the",
"lookup",
"tables"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3735-L3759 | |
33,940 | wavesoft/jbb | encoder.js | function( object ) {
var keys = Object.keys(object), k, v,
lVals = [], lArrays = [], lObjects = [];
// Sort to values, arrays and objects
var lookupString = "";
for (var i=0; i<keys.length; ++i) {
k = keys[i]; v = object[k];
if ((v instanceof Uint8Array) || (v instanceof Int8Array) ||
(v instanceo... | javascript | function( object ) {
var keys = Object.keys(object), k, v,
lVals = [], lArrays = [], lObjects = [];
// Sort to values, arrays and objects
var lookupString = "";
for (var i=0; i<keys.length; ++i) {
k = keys[i]; v = object[k];
if ((v instanceof Uint8Array) || (v instanceof Int8Array) ||
(v instanceo... | [
"function",
"(",
"object",
")",
"{",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"object",
")",
",",
"k",
",",
"v",
",",
"lVals",
"=",
"[",
"]",
",",
"lArrays",
"=",
"[",
"]",
",",
"lObjects",
"=",
"[",
"]",
";",
"// Sort to values, arrays and ... | Calculate object signature without registering it | [
"Calculate",
"object",
"signature",
"without",
"registering",
"it"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3764-L3787 | |
33,941 | wavesoft/jbb | encoder.js | function( object ) {
var keys = Object.keys(object), k, v, lookupString,
lVals = [], lArrays = [], lObjects = [];
// Sort to values, arrays and objects
lookupString = "";
for (var i=0; i<keys.length; ++i) {
k = keys[i]; v = object[k];
if ((v instanceof Uint8Array) || (v instanceof Int8Array) ||
(v... | javascript | function( object ) {
var keys = Object.keys(object), k, v, lookupString,
lVals = [], lArrays = [], lObjects = [];
// Sort to values, arrays and objects
lookupString = "";
for (var i=0; i<keys.length; ++i) {
k = keys[i]; v = object[k];
if ((v instanceof Uint8Array) || (v instanceof Int8Array) ||
(v... | [
"function",
"(",
"object",
")",
"{",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"object",
")",
",",
"k",
",",
"v",
",",
"lookupString",
",",
"lVals",
"=",
"[",
"]",
",",
"lArrays",
"=",
"[",
"]",
",",
"lObjects",
"=",
"[",
"]",
";",
"// So... | Get object signature | [
"Get",
"object",
"signature"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3792-L3843 | |
33,942 | wavesoft/jbb | encoder.js | function( db, prefix ) {
if (!prefix) prefix="";
// Import into an easy-to-process format
var keys = Object.keys(db), k, v;
for (var i=0; i<keys.length; ++i) {
k = keys[i]; v = db[k];
if (!db.hasOwnProperty(k)) continue;
this.dbTags.push( prefix+k );
this.dbObjects.push( db[k] );
// Define the ... | javascript | function( db, prefix ) {
if (!prefix) prefix="";
// Import into an easy-to-process format
var keys = Object.keys(db), k, v;
for (var i=0; i<keys.length; ++i) {
k = keys[i]; v = db[k];
if (!db.hasOwnProperty(k)) continue;
this.dbTags.push( prefix+k );
this.dbObjects.push( db[k] );
// Define the ... | [
"function",
"(",
"db",
",",
"prefix",
")",
"{",
"if",
"(",
"!",
"prefix",
")",
"prefix",
"=",
"\"\"",
";",
"// Import into an easy-to-process format",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"db",
")",
",",
"k",
",",
"v",
";",
"for",
"(",
"va... | Define an external database of tagged objects to use
for cross-referencing external entities. | [
"Define",
"an",
"external",
"database",
"of",
"tagged",
"objects",
"to",
"use",
"for",
"cross",
"-",
"referencing",
"external",
"entities",
"."
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3884-L3906 | |
33,943 | wavesoft/jbb | encoder.js | function( filename, mime_type ) {
// Calculate relative path
var relPath = filename;
if (relPath.substr(0,this.baseDir.length) === this.baseDir)
relPath = relPath.substr( this.baseDir.lengh );
// Write control operation
this.stream8.write( pack1b( CTRL_OP.EMBED ) );
this.counters.op_ctr++;
// Write s... | javascript | function( filename, mime_type ) {
// Calculate relative path
var relPath = filename;
if (relPath.substr(0,this.baseDir.length) === this.baseDir)
relPath = relPath.substr( this.baseDir.lengh );
// Write control operation
this.stream8.write( pack1b( CTRL_OP.EMBED ) );
this.counters.op_ctr++;
// Write s... | [
"function",
"(",
"filename",
",",
"mime_type",
")",
"{",
"// Calculate relative path",
"var",
"relPath",
"=",
"filename",
";",
"if",
"(",
"relPath",
".",
"substr",
"(",
"0",
",",
"this",
".",
"baseDir",
".",
"length",
")",
"===",
"this",
".",
"baseDir",
... | Embed specified resource | [
"Embed",
"specified",
"resource"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3937-L3953 | |
33,944 | wavesoft/jbb | encoder.js | function( buffer, name, mime_type ) {
// Write control operation
this.stream8.write( pack1b( CTRL_OP.EMBED ) );
this.counters.op_ctr++;
// Write string ID from the string lookup table
this.stream16.write( pack2b( this.stringID(this.bundleName + "/" + name) ) );
this.counters.ref_str+=2;
// Encode primiti... | javascript | function( buffer, name, mime_type ) {
// Write control operation
this.stream8.write( pack1b( CTRL_OP.EMBED ) );
this.counters.op_ctr++;
// Write string ID from the string lookup table
this.stream16.write( pack2b( this.stringID(this.bundleName + "/" + name) ) );
this.counters.ref_str+=2;
// Encode primiti... | [
"function",
"(",
"buffer",
",",
"name",
",",
"mime_type",
")",
"{",
"// Write control operation",
"this",
".",
"stream8",
".",
"write",
"(",
"pack1b",
"(",
"CTRL_OP",
".",
"EMBED",
")",
")",
";",
"this",
".",
"counters",
".",
"op_ctr",
"++",
";",
"// Wri... | Embed specified blob | [
"Embed",
"specified",
"blob"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3958-L3969 | |
33,945 | wavesoft/jbb | encoder.js | function(flags) {
// Set log flags
this.logFlags = flags;
// Update flags on streams
this.stream64.logWrites = ((this.logFlags & LOG.WRT) != 0);
this.stream32.logWrites = ((this.logFlags & LOG.WRT) != 0);
this.stream16.logWrites = ((this.logFlags & LOG.WRT) != 0);
this.stream8.logWrites = ((this.logFla... | javascript | function(flags) {
// Set log flags
this.logFlags = flags;
// Update flags on streams
this.stream64.logWrites = ((this.logFlags & LOG.WRT) != 0);
this.stream32.logWrites = ((this.logFlags & LOG.WRT) != 0);
this.stream16.logWrites = ((this.logFlags & LOG.WRT) != 0);
this.stream8.logWrites = ((this.logFla... | [
"function",
"(",
"flags",
")",
"{",
"// Set log flags",
"this",
".",
"logFlags",
"=",
"flags",
";",
"// Update flags on streams",
"this",
".",
"stream64",
".",
"logWrites",
"=",
"(",
"(",
"this",
".",
"logFlags",
"&",
"LOG",
".",
"WRT",
")",
"!=",
"0",
"... | Set log flags | [
"Set",
"log",
"flags"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L3974-L3985 | |
33,946 | wavesoft/jbb | encoder.js | function(indent, c) {
var iChar = c || ">";
if (indent > 0) {
for (var i=0; i<indent; ++i) this.logPrefix+=iChar;
} else {
this.logPrefix = this.logPrefix.substr(0,this.logPrefix.length+indent*iChar.length);
}
} | javascript | function(indent, c) {
var iChar = c || ">";
if (indent > 0) {
for (var i=0; i<indent; ++i) this.logPrefix+=iChar;
} else {
this.logPrefix = this.logPrefix.substr(0,this.logPrefix.length+indent*iChar.length);
}
} | [
"function",
"(",
"indent",
",",
"c",
")",
"{",
"var",
"iChar",
"=",
"c",
"||",
"\">\"",
";",
"if",
"(",
"indent",
">",
"0",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"indent",
";",
"++",
"i",
")",
"this",
".",
"logPrefix",
... | Log identation modification | [
"Log",
"identation",
"modification"
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/encoder.js#L4006-L4013 | |
33,947 | wavesoft/jbb | loader.js | function( parent, name ) {
/**
* State of the bundle item in queue
*
* 0 - Requested
* 1 - Specs loaded
* 2 - Imports satisfied
* 3 - Loaded
*/
this.state = STATE_REQUESTED;
/**
* Reference to the Bundles instance
*/
this.bundles = parent;
/**
* The bundle name
*/
this.name = name;
/**... | javascript | function( parent, name ) {
/**
* State of the bundle item in queue
*
* 0 - Requested
* 1 - Specs loaded
* 2 - Imports satisfied
* 3 - Loaded
*/
this.state = STATE_REQUESTED;
/**
* Reference to the Bundles instance
*/
this.bundles = parent;
/**
* The bundle name
*/
this.name = name;
/**... | [
"function",
"(",
"parent",
",",
"name",
")",
"{",
"/**\n\t * State of the bundle item in queue\n\t *\n\t * 0 - Requested\n\t * 1 - Specs loaded\n\t * 2 - Imports satisfied\n\t * 3 - Loaded\n\t */",
"this",
".",
"state",
"=",
"STATE_REQUESTED",
";",
"/**\n\t * Reference to the Bundles ins... | A bundle description pending in the loading queue,
waiting to be processed at loading time. | [
"A",
"bundle",
"description",
"pending",
"in",
"the",
"loading",
"queue",
"waiting",
"to",
"be",
"processed",
"at",
"loading",
"time",
"."
] | 46c40e0bca02d74201fb99925843cde49e9fe68a | https://github.com/wavesoft/jbb/blob/46c40e0bca02d74201fb99925843cde49e9fe68a/loader.js#L91-L149 | |
33,948 | godaddy/slay | lib/app.js | App | function App(root, options) {
options = options || {};
if (!root || typeof root !== 'string') {
throw new Error('Application root is not provided or not a string.');
}
if (typeof options !== 'object') {
throw new Error('Application options is not provided or not an object.');
}
Broadway.call(this, ... | javascript | function App(root, options) {
options = options || {};
if (!root || typeof root !== 'string') {
throw new Error('Application root is not provided or not a string.');
}
if (typeof options !== 'object') {
throw new Error('Application options is not provided or not an object.');
}
Broadway.call(this, ... | [
"function",
"App",
"(",
"root",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"root",
"||",
"typeof",
"root",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Application root is not provided or not a... | Constructor function for the Slay app object.
@param {string} root Root directory of the application
@param {object} options Options for this app instance.
@constructor | [
"Constructor",
"function",
"for",
"the",
"Slay",
"app",
"object",
"."
] | d96b2d103b21605c62705eeb29e4faac9d41972e | https://github.com/godaddy/slay/blob/d96b2d103b21605c62705eeb29e4faac9d41972e/lib/app.js#L19-L30 |
33,949 | inikulin/ineed | lib/api_host.js | validatePluginName | function validatePluginName(plugin, pluginList) {
if (!plugin.name)
throw new Error(ApiHost.ERR_PLUGIN_MISSING_NAME_PROPERTY);
pluginList.forEach(function (collectorPlugin) {
if (plugin.name === collectorPlugin.name) {
var msg = util.format(ApiHost.ERR_DUPLICATE_PLUGIN_NAME, plugin.... | javascript | function validatePluginName(plugin, pluginList) {
if (!plugin.name)
throw new Error(ApiHost.ERR_PLUGIN_MISSING_NAME_PROPERTY);
pluginList.forEach(function (collectorPlugin) {
if (plugin.name === collectorPlugin.name) {
var msg = util.format(ApiHost.ERR_DUPLICATE_PLUGIN_NAME, plugin.... | [
"function",
"validatePluginName",
"(",
"plugin",
",",
"pluginList",
")",
"{",
"if",
"(",
"!",
"plugin",
".",
"name",
")",
"throw",
"new",
"Error",
"(",
"ApiHost",
".",
"ERR_PLUGIN_MISSING_NAME_PROPERTY",
")",
";",
"pluginList",
".",
"forEach",
"(",
"function",... | Plugin name validation | [
"Plugin",
"name",
"validation"
] | ca83abe7d65805ece349ced944f1be8ee787e1c0 | https://github.com/inikulin/ineed/blob/ca83abe7d65805ece349ced944f1be8ee787e1c0/lib/api_host.js#L7-L17 |
33,950 | swift-nav/gpstime | lib/index.js | gpsTimestampToUtcTimestamp | function gpsTimestampToUtcTimestamp(gpsTimestamp) {
// Get lastIndex for which our gpsTimestamp is greater
var lastIndex = void 0;
for (lastIndex = 0; lastIndex < gpsLeapSeconds.length; ++lastIndex) {
if (gpsTimestamp - gpsLeapSeconds[lastIndex] > 0) {
break;
}
}
var leapSecondsOffset = gpsLeap... | javascript | function gpsTimestampToUtcTimestamp(gpsTimestamp) {
// Get lastIndex for which our gpsTimestamp is greater
var lastIndex = void 0;
for (lastIndex = 0; lastIndex < gpsLeapSeconds.length; ++lastIndex) {
if (gpsTimestamp - gpsLeapSeconds[lastIndex] > 0) {
break;
}
}
var leapSecondsOffset = gpsLeap... | [
"function",
"gpsTimestampToUtcTimestamp",
"(",
"gpsTimestamp",
")",
"{",
"// Get lastIndex for which our gpsTimestamp is greater",
"var",
"lastIndex",
"=",
"void",
"0",
";",
"for",
"(",
"lastIndex",
"=",
"0",
";",
"lastIndex",
"<",
"gpsLeapSeconds",
".",
"length",
";"... | Convert GPS timestamp without leap seconds to a UTC timestamps with leap seconds.
@param {Date} timestamp - A `moment` object representing a GPS timestamp, w/o leap-seconds.
@returns {Date} - A `moment` object representing a UTC timestamp, with leap-seconds. | [
"Convert",
"GPS",
"timestamp",
"without",
"leap",
"seconds",
"to",
"a",
"UTC",
"timestamps",
"with",
"leap",
"seconds",
"."
] | 8af11e96aa7b1d4dc439e0565491693bfdc04a7a | https://github.com/swift-nav/gpstime/blob/8af11e96aa7b1d4dc439e0565491693bfdc04a7a/lib/index.js#L90-L102 |
33,951 | swift-nav/gpstime | lib/index.js | utcTimestampToGpsTimestamp | function utcTimestampToGpsTimestamp(utcTimestamp) {
// Get lastIndex for which our gpsTimestamp is greater
var lastIndex = void 0;
for (lastIndex = 0; lastIndex < gpsLeapSeconds.length; ++lastIndex) {
if (utcTimestamp - gpsLeapSeconds[lastIndex] > 0) {
break;
}
}
var leapSecondsOffset = gpsLeap... | javascript | function utcTimestampToGpsTimestamp(utcTimestamp) {
// Get lastIndex for which our gpsTimestamp is greater
var lastIndex = void 0;
for (lastIndex = 0; lastIndex < gpsLeapSeconds.length; ++lastIndex) {
if (utcTimestamp - gpsLeapSeconds[lastIndex] > 0) {
break;
}
}
var leapSecondsOffset = gpsLeap... | [
"function",
"utcTimestampToGpsTimestamp",
"(",
"utcTimestamp",
")",
"{",
"// Get lastIndex for which our gpsTimestamp is greater",
"var",
"lastIndex",
"=",
"void",
"0",
";",
"for",
"(",
"lastIndex",
"=",
"0",
";",
"lastIndex",
"<",
"gpsLeapSeconds",
".",
"length",
";"... | Convert UTC timestamp with leap seconds to a GPS timestamps without leap seconds.
@param {Date} timestamp - A `moment` object representing a GPS timestamp, w/o leap-seconds.
@returns {Date} - A `moment` object representing a UTC timestamp, with leap-seconds. | [
"Convert",
"UTC",
"timestamp",
"with",
"leap",
"seconds",
"to",
"a",
"GPS",
"timestamps",
"without",
"leap",
"seconds",
"."
] | 8af11e96aa7b1d4dc439e0565491693bfdc04a7a | https://github.com/swift-nav/gpstime/blob/8af11e96aa7b1d4dc439e0565491693bfdc04a7a/lib/index.js#L110-L122 |
33,952 | oncletom/grunt-crx | lib/crx.js | getTaskConfiguration | function getTaskConfiguration(profile){
var config;
profile = profile || 'default';
config = require(__dirname + '/../data/config-'+ profile +'.json');
return config;
} | javascript | function getTaskConfiguration(profile){
var config;
profile = profile || 'default';
config = require(__dirname + '/../data/config-'+ profile +'.json');
return config;
} | [
"function",
"getTaskConfiguration",
"(",
"profile",
")",
"{",
"var",
"config",
";",
"profile",
"=",
"profile",
"||",
"'default'",
";",
"config",
"=",
"require",
"(",
"__dirname",
"+",
"'/../data/config-'",
"+",
"profile",
"+",
"'.json'",
")",
";",
"return",
... | Returns a task configuration profile
@param {String=} profile
@return {Object} | [
"Returns",
"a",
"task",
"configuration",
"profile"
] | f28cfb02294f85af903257850225817e15c95a48 | https://github.com/oncletom/grunt-crx/blob/f28cfb02294f85af903257850225817e15c95a48/lib/crx.js#L31-L39 |
33,953 | oncletom/grunt-crx | lib/crx.js | build | function build(TaskConfig, crx) {
return new Promise(function(resolve, reject){
mkdir(path.dirname(TaskConfig.dest), function(err){
if (err) {
return reject(err);
}
resolve();
});
})
.then(function(){
return crx.load(TaskConfig.src);
})
.then(function(){
return crx.loadCon... | javascript | function build(TaskConfig, crx) {
return new Promise(function(resolve, reject){
mkdir(path.dirname(TaskConfig.dest), function(err){
if (err) {
return reject(err);
}
resolve();
});
})
.then(function(){
return crx.load(TaskConfig.src);
})
.then(function(){
return crx.loadCon... | [
"function",
"build",
"(",
"TaskConfig",
",",
"crx",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"mkdir",
"(",
"path",
".",
"dirname",
"(",
"TaskConfig",
".",
"dest",
")",
",",
"function",
"(",
"err",
... | Builds a pre-configured chrome extension in 3 steps
@api
@param {crx} WebExtension
@return null | [
"Builds",
"a",
"pre",
"-",
"configured",
"chrome",
"extension",
"in",
"3",
"steps"
] | f28cfb02294f85af903257850225817e15c95a48 | https://github.com/oncletom/grunt-crx/blob/f28cfb02294f85af903257850225817e15c95a48/lib/crx.js#L55-L87 |
33,954 | FungusHumungus/pongular | lib/loader.js | loadUses | function loadUses() {
var globs = Array.prototype.slice.call(arguments, 0);
var path = require('path');
utils.forEach(globs, function(patt) {
var files = glob.sync(patt, {});
utils.forEach(files, function(file) {
require(path.join(process.cwd(), file))... | javascript | function loadUses() {
var globs = Array.prototype.slice.call(arguments, 0);
var path = require('path');
utils.forEach(globs, function(patt) {
var files = glob.sync(patt, {});
utils.forEach(files, function(file) {
require(path.join(process.cwd(), file))... | [
"function",
"loadUses",
"(",
")",
"{",
"var",
"globs",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
";",
"var",
"path",
"=",
"require",
"(",
"'path'",
")",
";",
"utils",
".",
"forEach",
"(",
"globs",
"... | Requires any modules that match the given glob patterns | [
"Requires",
"any",
"modules",
"that",
"match",
"the",
"given",
"glob",
"patterns"
] | fe1552889e485e5c36d8ab8b19b1a6879e01cb77 | https://github.com/FungusHumungus/pongular/blob/fe1552889e485e5c36d8ab8b19b1a6879e01cb77/lib/loader.js#L258-L269 |
33,955 | firmata/firmata-builder | lib/builder.js | setEnabledFeatures | function setEnabledFeatures(selectedFeature) {
switch (selectedFeature) {
case "AnalogInputFirmata":
analogInputEnabled = true;
break;
case "AnalogOutputFirmata":
analogOutputEnabled = true;
break;
case "DigitalInputFirmata":
digitalInputEnabled = true;
break;
case "DigitalOutputFirmat... | javascript | function setEnabledFeatures(selectedFeature) {
switch (selectedFeature) {
case "AnalogInputFirmata":
analogInputEnabled = true;
break;
case "AnalogOutputFirmata":
analogOutputEnabled = true;
break;
case "DigitalInputFirmata":
digitalInputEnabled = true;
break;
case "DigitalOutputFirmat... | [
"function",
"setEnabledFeatures",
"(",
"selectedFeature",
")",
"{",
"switch",
"(",
"selectedFeature",
")",
"{",
"case",
"\"AnalogInputFirmata\"",
":",
"analogInputEnabled",
"=",
"true",
";",
"break",
";",
"case",
"\"AnalogOutputFirmata\"",
":",
"analogOutputEnabled",
... | Additional features should not be added to this function.
Ideally these comparisons will be eliminated at some point.
@private | [
"Additional",
"features",
"should",
"not",
"be",
"added",
"to",
"this",
"function",
".",
"Ideally",
"these",
"comparisons",
"will",
"be",
"eliminated",
"at",
"some",
"point",
"."
] | 77be548e38fe3f7872ce8b4bf428a870f9612b04 | https://github.com/firmata/firmata-builder/blob/77be548e38fe3f7872ce8b4bf428a870f9612b04/lib/builder.js#L28-L49 |
33,956 | firmata/firmata-builder | lib/builder.js | function(config) {
var transport;
if (config.wifi) {
transport = new WiFiTransport({
configuration: config.wifi
});
} else if (config.ethernet) {
transport = new EthernetTransport({
configuration: config.ethernet
});
} else if (config.ble) {
transport = new ... | javascript | function(config) {
var transport;
if (config.wifi) {
transport = new WiFiTransport({
configuration: config.wifi
});
} else if (config.ethernet) {
transport = new EthernetTransport({
configuration: config.ethernet
});
} else if (config.ble) {
transport = new ... | [
"function",
"(",
"config",
")",
"{",
"var",
"transport",
";",
"if",
"(",
"config",
".",
"wifi",
")",
"{",
"transport",
"=",
"new",
"WiFiTransport",
"(",
"{",
"configuration",
":",
"config",
".",
"wifi",
"}",
")",
";",
"}",
"else",
"if",
"(",
"config"... | Create a transport object for the specified connection type.
Throws an error if no valid connection type was specified.
@param {Object} config The connection type object
@return {Object} | [
"Create",
"a",
"transport",
"object",
"for",
"the",
"specified",
"connection",
"type",
".",
"Throws",
"an",
"error",
"if",
"no",
"valid",
"connection",
"type",
"was",
"specified",
"."
] | 77be548e38fe3f7872ce8b4bf428a870f9612b04 | https://github.com/firmata/firmata-builder/blob/77be548e38fe3f7872ce8b4bf428a870f9612b04/lib/builder.js#L127-L149 | |
33,957 | firmata/firmata-builder | lib/builder.js | function() {
var len = this.selectedFeatures.length;
clearEnabledFeatures();
for (var i = 0; i < len; i++) {
setEnabledFeatures(this.selectedFeatures[i]);
var feature = this.allFeatures[this.selectedFeatures[i]];
if (feature.reporting) {
this.featuresWithReporting.push(feature);
... | javascript | function() {
var len = this.selectedFeatures.length;
clearEnabledFeatures();
for (var i = 0; i < len; i++) {
setEnabledFeatures(this.selectedFeatures[i]);
var feature = this.allFeatures[this.selectedFeatures[i]];
if (feature.reporting) {
this.featuresWithReporting.push(feature);
... | [
"function",
"(",
")",
"{",
"var",
"len",
"=",
"this",
".",
"selectedFeatures",
".",
"length",
";",
"clearEnabledFeatures",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"setEnabledFeatures",
"(",
"... | Determine which features use reporting and which are updated on each iteration
of the main loop.
@private | [
"Determine",
"which",
"features",
"use",
"reporting",
"and",
"which",
"are",
"updated",
"on",
"each",
"iteration",
"of",
"the",
"main",
"loop",
"."
] | 77be548e38fe3f7872ce8b4bf428a870f9612b04 | https://github.com/firmata/firmata-builder/blob/77be548e38fe3f7872ce8b4bf428a870f9612b04/lib/builder.js#L156-L179 | |
33,958 | firmata/firmata-builder | lib/builder.js | function() {
var includes = "#include <ConfigurableFirmata.h>\n\n";
includes += this.transport.createConfigBlock();
for (var i = 0, len = this.selectedFeatures.length; i < len; i++) {
var feature = this.allFeatures[this.selectedFeatures[i]];
if (feature.dependencies) {
for (var j = 0;... | javascript | function() {
var includes = "#include <ConfigurableFirmata.h>\n\n";
includes += this.transport.createConfigBlock();
for (var i = 0, len = this.selectedFeatures.length; i < len; i++) {
var feature = this.allFeatures[this.selectedFeatures[i]];
if (feature.dependencies) {
for (var j = 0;... | [
"function",
"(",
")",
"{",
"var",
"includes",
"=",
"\"#include <ConfigurableFirmata.h>\\n\\n\"",
";",
"includes",
"+=",
"this",
".",
"transport",
".",
"createConfigBlock",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"this",
".",
"sele... | Creates the block of includes, macros and global variables at the top of the file.
@private | [
"Creates",
"the",
"block",
"of",
"includes",
"macros",
"and",
"global",
"variables",
"at",
"the",
"top",
"of",
"the",
"file",
"."
] | 77be548e38fe3f7872ce8b4bf428a870f9612b04 | https://github.com/firmata/firmata-builder/blob/77be548e38fe3f7872ce8b4bf428a870f9612b04/lib/builder.js#L195-L229 | |
33,959 | firmata/firmata-builder | lib/transports/ble.js | BLETransport | function BLETransport(opts) {
if (!(this instanceof BLETransport)) {
return new BLETransport(opts);
}
this.configuration = opts.configuration;
this.controller = Controllers[this.configuration.controller];
if (!this.controller) {
throw new Error("No valid BLE controller defined");
}
} | javascript | function BLETransport(opts) {
if (!(this instanceof BLETransport)) {
return new BLETransport(opts);
}
this.configuration = opts.configuration;
this.controller = Controllers[this.configuration.controller];
if (!this.controller) {
throw new Error("No valid BLE controller defined");
}
} | [
"function",
"BLETransport",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"BLETransport",
")",
")",
"{",
"return",
"new",
"BLETransport",
"(",
"opts",
")",
";",
"}",
"this",
".",
"configuration",
"=",
"opts",
".",
"configuration",
";"... | BLE transport.
@constructor
@param {Object} opts | [
"BLE",
"transport",
"."
] | 77be548e38fe3f7872ce8b4bf428a870f9612b04 | https://github.com/firmata/firmata-builder/blob/77be548e38fe3f7872ce8b4bf428a870f9612b04/lib/transports/ble.js#L17-L27 |
33,960 | jaredhanson/xmlb | lib/index.js | parse | function parse(str, options) {
var doc = options.document || 'xml'
, pretty = options.pretty || false
, js = str;
return ''
+ 'var ' + doc + ' = factory();\n'
+ (options.self
? 'var self = locals || {};\n' + js
: 'with (locals || {}) {\n' + js + '\n}\n')
+ 'return ' + doc + '.toSt... | javascript | function parse(str, options) {
var doc = options.document || 'xml'
, pretty = options.pretty || false
, js = str;
return ''
+ 'var ' + doc + ' = factory();\n'
+ (options.self
? 'var self = locals || {};\n' + js
: 'with (locals || {}) {\n' + js + '\n}\n')
+ 'return ' + doc + '.toSt... | [
"function",
"parse",
"(",
"str",
",",
"options",
")",
"{",
"var",
"doc",
"=",
"options",
".",
"document",
"||",
"'xml'",
",",
"pretty",
"=",
"options",
".",
"pretty",
"||",
"false",
",",
"js",
"=",
"str",
";",
"return",
"''",
"+",
"'var '",
"+",
"d... | Parse the given `str` of XML builder and return a function body.
@param {String} str
@param {Object} options
@return {String}
@api private | [
"Parse",
"the",
"given",
"str",
"of",
"XML",
"builder",
"and",
"return",
"a",
"function",
"body",
"."
] | 4ad94523a44e1ca3a2528ead1defdc3844aa59a7 | https://github.com/jaredhanson/xmlb/blob/4ad94523a44e1ca3a2528ead1defdc3844aa59a7/lib/index.js#L66-L77 |
33,961 | firmata/firmata-builder | lib/transports/wifi.js | WiFiTransport | function WiFiTransport(opts) {
if (!(this instanceof WiFiTransport)) {
return new WiFiTransport(opts);
}
this.configuration = opts.configuration;
this.controller = Controllers[this.configuration.controller];
if (!this.controller) {
throw new Error("No valid Wi-Fi controller defined");
}
} | javascript | function WiFiTransport(opts) {
if (!(this instanceof WiFiTransport)) {
return new WiFiTransport(opts);
}
this.configuration = opts.configuration;
this.controller = Controllers[this.configuration.controller];
if (!this.controller) {
throw new Error("No valid Wi-Fi controller defined");
}
} | [
"function",
"WiFiTransport",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"WiFiTransport",
")",
")",
"{",
"return",
"new",
"WiFiTransport",
"(",
"opts",
")",
";",
"}",
"this",
".",
"configuration",
"=",
"opts",
".",
"configuration",
... | Wi-Fi transport. Currently configurable as server only on Arduino.
@constructor
@param {Object} opts | [
"Wi",
"-",
"Fi",
"transport",
".",
"Currently",
"configurable",
"as",
"server",
"only",
"on",
"Arduino",
"."
] | 77be548e38fe3f7872ce8b4bf428a870f9612b04 | https://github.com/firmata/firmata-builder/blob/77be548e38fe3f7872ce8b4bf428a870f9612b04/lib/transports/wifi.js#L27-L37 |
33,962 | webmodules/dom-serialize | index.js | serialize | function serialize (node, context, fn, eventTarget) {
if (!node) return '';
if ('function' === typeof context) {
fn = context;
context = null;
}
if (!context) context = null;
var rtn;
var nodeType = node.nodeType;
if (!nodeType && 'number' === typeof node.length) {
// assume it's a NodeList ... | javascript | function serialize (node, context, fn, eventTarget) {
if (!node) return '';
if ('function' === typeof context) {
fn = context;
context = null;
}
if (!context) context = null;
var rtn;
var nodeType = node.nodeType;
if (!nodeType && 'number' === typeof node.length) {
// assume it's a NodeList ... | [
"function",
"serialize",
"(",
"node",
",",
"context",
",",
"fn",
",",
"eventTarget",
")",
"{",
"if",
"(",
"!",
"node",
")",
"return",
"''",
";",
"if",
"(",
"'function'",
"===",
"typeof",
"context",
")",
"{",
"fn",
"=",
"context",
";",
"context",
"=",... | Serializes any DOM node. Returns a string.
@param {Node} node - DOM Node to serialize
@param {String} [context] - optional arbitrary "context" string to use (useful for event listeners)
@param {Function} [fn] - optional callback function to use in the "serialize" event for this call
@param {EventTarget} [eventTarget] ... | [
"Serializes",
"any",
"DOM",
"node",
".",
"Returns",
"a",
"string",
"."
] | 205ac26068649f57b70c1625ea7ff311e44886ae | https://github.com/webmodules/dom-serialize/blob/205ac26068649f57b70c1625ea7ff311e44886ae/index.js#L36-L120 |
33,963 | webmodules/dom-serialize | index.js | serializeAttribute | function serializeAttribute (node, opts) {
return node.name + '="' + encode(node.value, extend({
named: true
}, opts)) + '"';
} | javascript | function serializeAttribute (node, opts) {
return node.name + '="' + encode(node.value, extend({
named: true
}, opts)) + '"';
} | [
"function",
"serializeAttribute",
"(",
"node",
",",
"opts",
")",
"{",
"return",
"node",
".",
"name",
"+",
"'=\"'",
"+",
"encode",
"(",
"node",
".",
"value",
",",
"extend",
"(",
"{",
"named",
":",
"true",
"}",
",",
"opts",
")",
")",
"+",
"'\"'",
";"... | Serialize an Attribute node. | [
"Serialize",
"an",
"Attribute",
"node",
"."
] | 205ac26068649f57b70c1625ea7ff311e44886ae | https://github.com/webmodules/dom-serialize/blob/205ac26068649f57b70c1625ea7ff311e44886ae/index.js#L126-L130 |
33,964 | webmodules/dom-serialize | index.js | serializeElement | function serializeElement (node, context, eventTarget) {
var c, i, l;
var name = node.nodeName.toLowerCase();
// opening tag
var r = '<' + name;
// attributes
for (i = 0, c = node.attributes, l = c.length; i < l; i++) {
r += ' ' + exports.serializeAttribute(c[i]);
}
r += '>';
// child nodes
... | javascript | function serializeElement (node, context, eventTarget) {
var c, i, l;
var name = node.nodeName.toLowerCase();
// opening tag
var r = '<' + name;
// attributes
for (i = 0, c = node.attributes, l = c.length; i < l; i++) {
r += ' ' + exports.serializeAttribute(c[i]);
}
r += '>';
// child nodes
... | [
"function",
"serializeElement",
"(",
"node",
",",
"context",
",",
"eventTarget",
")",
"{",
"var",
"c",
",",
"i",
",",
"l",
";",
"var",
"name",
"=",
"node",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
";",
"// opening tag",
"var",
"r",
"=",
"'<'",
... | Serialize a DOM element. | [
"Serialize",
"a",
"DOM",
"element",
"."
] | 205ac26068649f57b70c1625ea7ff311e44886ae | https://github.com/webmodules/dom-serialize/blob/205ac26068649f57b70c1625ea7ff311e44886ae/index.js#L136-L159 |
33,965 | webmodules/dom-serialize | index.js | serializeText | function serializeText (node, opts) {
return encode(node.nodeValue, extend({
named: true,
special: { '<': true, '>': true, '&': true }
}, opts));
} | javascript | function serializeText (node, opts) {
return encode(node.nodeValue, extend({
named: true,
special: { '<': true, '>': true, '&': true }
}, opts));
} | [
"function",
"serializeText",
"(",
"node",
",",
"opts",
")",
"{",
"return",
"encode",
"(",
"node",
".",
"nodeValue",
",",
"extend",
"(",
"{",
"named",
":",
"true",
",",
"special",
":",
"{",
"'<'",
":",
"true",
",",
"'>'",
":",
"true",
",",
"'&'",
":... | Serialize a text node. | [
"Serialize",
"a",
"text",
"node",
"."
] | 205ac26068649f57b70c1625ea7ff311e44886ae | https://github.com/webmodules/dom-serialize/blob/205ac26068649f57b70c1625ea7ff311e44886ae/index.js#L165-L170 |
33,966 | webmodules/dom-serialize | index.js | serializeDocument | function serializeDocument (node, context, eventTarget) {
return exports.serializeNodeList(node.childNodes, context, null, eventTarget);
} | javascript | function serializeDocument (node, context, eventTarget) {
return exports.serializeNodeList(node.childNodes, context, null, eventTarget);
} | [
"function",
"serializeDocument",
"(",
"node",
",",
"context",
",",
"eventTarget",
")",
"{",
"return",
"exports",
".",
"serializeNodeList",
"(",
"node",
".",
"childNodes",
",",
"context",
",",
"null",
",",
"eventTarget",
")",
";",
"}"
] | Serialize a Document node. | [
"Serialize",
"a",
"Document",
"node",
"."
] | 205ac26068649f57b70c1625ea7ff311e44886ae | https://github.com/webmodules/dom-serialize/blob/205ac26068649f57b70c1625ea7ff311e44886ae/index.js#L184-L186 |
33,967 | webmodules/dom-serialize | index.js | serializeDocumentFragment | function serializeDocumentFragment (node, context, eventTarget) {
return exports.serializeNodeList(node.childNodes, context, null, eventTarget);
} | javascript | function serializeDocumentFragment (node, context, eventTarget) {
return exports.serializeNodeList(node.childNodes, context, null, eventTarget);
} | [
"function",
"serializeDocumentFragment",
"(",
"node",
",",
"context",
",",
"eventTarget",
")",
"{",
"return",
"exports",
".",
"serializeNodeList",
"(",
"node",
".",
"childNodes",
",",
"context",
",",
"null",
",",
"eventTarget",
")",
";",
"}"
] | Serialize a DocumentFragment instance. | [
"Serialize",
"a",
"DocumentFragment",
"instance",
"."
] | 205ac26068649f57b70c1625ea7ff311e44886ae | https://github.com/webmodules/dom-serialize/blob/205ac26068649f57b70c1625ea7ff311e44886ae/index.js#L216-L218 |
33,968 | firmata/firmata-builder | lib/transports/ethernet.js | EthernetTransport | function EthernetTransport(opts) {
if (!(this instanceof EthernetTransport)) {
return new EthernetTransport(opts);
}
this.configuration = opts.configuration;
this.controller = "";
switch (Controllers[this.configuration.controller].driver) {
case Controllers.WIZ5100.driver:
this.controller = Contro... | javascript | function EthernetTransport(opts) {
if (!(this instanceof EthernetTransport)) {
return new EthernetTransport(opts);
}
this.configuration = opts.configuration;
this.controller = "";
switch (Controllers[this.configuration.controller].driver) {
case Controllers.WIZ5100.driver:
this.controller = Contro... | [
"function",
"EthernetTransport",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"EthernetTransport",
")",
")",
"{",
"return",
"new",
"EthernetTransport",
"(",
"opts",
")",
";",
"}",
"this",
".",
"configuration",
"=",
"opts",
".",
"config... | Ethernet transport. Currently configurable as client only on Arduino.
@constructor
@param {Objedt} opts | [
"Ethernet",
"transport",
".",
"Currently",
"configurable",
"as",
"client",
"only",
"on",
"Arduino",
"."
] | 77be548e38fe3f7872ce8b4bf428a870f9612b04 | https://github.com/firmata/firmata-builder/blob/77be548e38fe3f7872ce8b4bf428a870f9612b04/lib/transports/ethernet.js#L39-L60 |
33,969 | artdecocode/reloquent | build/lib/ask-questions.js | askQuestions | async function askQuestions(questions, timeout) {
if (typeof questions != 'object')
throw new Error('Please give an object with questions')
const keys = Object.keys(/** @type {!Object} */ (questions))
const res = await keys.reduce(async (acc, key) => {
const accRes = await acc
const value = question... | javascript | async function askQuestions(questions, timeout) {
if (typeof questions != 'object')
throw new Error('Please give an object with questions')
const keys = Object.keys(/** @type {!Object} */ (questions))
const res = await keys.reduce(async (acc, key) => {
const accRes = await acc
const value = question... | [
"async",
"function",
"askQuestions",
"(",
"questions",
",",
"timeout",
")",
"{",
"if",
"(",
"typeof",
"questions",
"!=",
"'object'",
")",
"throw",
"new",
"Error",
"(",
"'Please give an object with questions'",
")",
"const",
"keys",
"=",
"Object",
".",
"keys",
... | Ask a set of questions.
@param {_reloquent.Questions} questions An object with questions as values
@param {number} [timeout] How long to wait before answer
@returns {!Promise<!Object<string, string>>} A promise where keys from the questions object are validated, assigned default values if required, and populated with a... | [
"Ask",
"a",
"set",
"of",
"questions",
"."
] | 438131dca204ff7a5912f1c09e1d0df04b7dfee1 | https://github.com/artdecocode/reloquent/blob/438131dca204ff7a5912f1c09e1d0df04b7dfee1/build/lib/ask-questions.js#L17-L79 |
33,970 | ringa-js/ringa | src/ModelWatcher.js | objPath | function objPath(obj, path) {
if (!path) {
return obj;
}
path = path.split('.');
let i = 0;
while (obj && i < path.length) {
obj = obj[path[i++]];
}
return obj;
} | javascript | function objPath(obj, path) {
if (!path) {
return obj;
}
path = path.split('.');
let i = 0;
while (obj && i < path.length) {
obj = obj[path[i++]];
}
return obj;
} | [
"function",
"objPath",
"(",
"obj",
",",
"path",
")",
"{",
"if",
"(",
"!",
"path",
")",
"{",
"return",
"obj",
";",
"}",
"path",
"=",
"path",
".",
"split",
"(",
"'.'",
")",
";",
"let",
"i",
"=",
"0",
";",
"while",
"(",
"obj",
"&&",
"i",
"<",
... | Retrieves a property by a dot-delimited path on a provided object.
@param obj The object to search.
@param path A dot-delimited path like 'prop1.prop2.prop3'
@returns {*} | [
"Retrieves",
"a",
"property",
"by",
"a",
"dot",
"-",
"delimited",
"path",
"on",
"a",
"provided",
"object",
"."
] | 8773c00a21c05ffc942868a65fe2bd6f0f04d19e | https://github.com/ringa-js/ringa/blob/8773c00a21c05ffc942868a65fe2bd6f0f04d19e/src/ModelWatcher.js#L11-L21 |
33,971 | artdecocode/reloquent | build/index.js | reloquent | async function reloquent(questions, timeout) {
const res = await askQuestions(questions, timeout)
return res
} | javascript | async function reloquent(questions, timeout) {
const res = await askQuestions(questions, timeout)
return res
} | [
"async",
"function",
"reloquent",
"(",
"questions",
",",
"timeout",
")",
"{",
"const",
"res",
"=",
"await",
"askQuestions",
"(",
"questions",
",",
"timeout",
")",
"return",
"res",
"}"
] | Ask user questions via the CLI. Returns an object with keys as questions' texts and values as answers.
@param {_reloquent.Questions} questions A set of questions.
@param {number} [timeout] How long to wait before rejecting the promise. Waits forever by default. | [
"Ask",
"user",
"questions",
"via",
"the",
"CLI",
".",
"Returns",
"an",
"object",
"with",
"keys",
"as",
"questions",
"texts",
"and",
"values",
"as",
"answers",
"."
] | 438131dca204ff7a5912f1c09e1d0df04b7dfee1 | https://github.com/artdecocode/reloquent/blob/438131dca204ff7a5912f1c09e1d0df04b7dfee1/build/index.js#L8-L11 |
33,972 | artdecocode/reloquent | build/index.js | askSingle | async function askSingle(question, timeout) {
const { question: answer } = await askQuestions({ question }, timeout)
return answer
} | javascript | async function askSingle(question, timeout) {
const { question: answer } = await askQuestions({ question }, timeout)
return answer
} | [
"async",
"function",
"askSingle",
"(",
"question",
",",
"timeout",
")",
"{",
"const",
"{",
"question",
":",
"answer",
"}",
"=",
"await",
"askQuestions",
"(",
"{",
"question",
"}",
",",
"timeout",
")",
"return",
"answer",
"}"
] | Ask user a question via the CLI. Returns the answer to the question.
@param {string|!_reloquent.Question} question A question to present to the user.
@param {number} [timeout] How long to wait before rejecting the promise. Waits forever by default. | [
"Ask",
"user",
"a",
"question",
"via",
"the",
"CLI",
".",
"Returns",
"the",
"answer",
"to",
"the",
"question",
"."
] | 438131dca204ff7a5912f1c09e1d0df04b7dfee1 | https://github.com/artdecocode/reloquent/blob/438131dca204ff7a5912f1c09e1d0df04b7dfee1/build/index.js#L18-L21 |
33,973 | ringa-js/ringa | src/Model.js | function (model, pojo, options) {
pojo = pojo || {};
let props = model.serializeProperties || model.properties;
props = props.filter(prop => (!model.propertyOptions[prop] || model.propertyOptions[prop].serialize !== false));
props.forEach(key => {
let obj;
let o = model.propertyOptions[key];
if... | javascript | function (model, pojo, options) {
pojo = pojo || {};
let props = model.serializeProperties || model.properties;
props = props.filter(prop => (!model.propertyOptions[prop] || model.propertyOptions[prop].serialize !== false));
props.forEach(key => {
let obj;
let o = model.propertyOptions[key];
if... | [
"function",
"(",
"model",
",",
"pojo",
",",
"options",
")",
"{",
"pojo",
"=",
"pojo",
"||",
"{",
"}",
";",
"let",
"props",
"=",
"model",
".",
"serializeProperties",
"||",
"model",
".",
"properties",
";",
"props",
"=",
"props",
".",
"filter",
"(",
"pr... | Serialize a Ringa Model object to a POJO by iterating over properties recursively on any
descendent Model instances.
@param model
@param pojo
@returns {*|{}}
@private | [
"Serialize",
"a",
"Ringa",
"Model",
"object",
"to",
"a",
"POJO",
"by",
"iterating",
"over",
"properties",
"recursively",
"on",
"any",
"descendent",
"Model",
"instances",
"."
] | 8773c00a21c05ffc942868a65fe2bd6f0f04d19e | https://github.com/ringa-js/ringa/blob/8773c00a21c05ffc942868a65fe2bd6f0f04d19e/src/Model.js#L22-L64 | |
33,974 | deskpro/apps-sdk-core | src/main/javascript/WebAPI/index.js | registerEventHandlers | function registerEventHandlers(windowBridge, app)
{
"use strict";
handleOutgoingEvent(windowBridge, app, WebAPIEvents.EVENT_WEBAPI_REQUEST_DESKPRO, WebAPIEvents.props.EVENT_WEBAPI_REQUEST_DESKPRO);
handleOutgoingEvent(windowBridge, app, WebAPIEvents.EVENT_WEBAPI_REQUEST_FETCH, WebAPIEvents.props.EVENT_WEBAPI_REQU... | javascript | function registerEventHandlers(windowBridge, app)
{
"use strict";
handleOutgoingEvent(windowBridge, app, WebAPIEvents.EVENT_WEBAPI_REQUEST_DESKPRO, WebAPIEvents.props.EVENT_WEBAPI_REQUEST_DESKPRO);
handleOutgoingEvent(windowBridge, app, WebAPIEvents.EVENT_WEBAPI_REQUEST_FETCH, WebAPIEvents.props.EVENT_WEBAPI_REQU... | [
"function",
"registerEventHandlers",
"(",
"windowBridge",
",",
"app",
")",
"{",
"\"use strict\"",
";",
"handleOutgoingEvent",
"(",
"windowBridge",
",",
"app",
",",
"WebAPIEvents",
".",
"EVENT_WEBAPI_REQUEST_DESKPRO",
",",
"WebAPIEvents",
".",
"props",
".",
"EVENT_WEBA... | Registers the WebAPI events with the event dispatching system
@param {WidgetWindowBridge} windowBridge
@param {AppClient} app | [
"Registers",
"the",
"WebAPI",
"events",
"with",
"the",
"event",
"dispatching",
"system"
] | 27f41bdf9b25dc7f007836ca96e156f6e8ec47a5 | https://github.com/deskpro/apps-sdk-core/blob/27f41bdf9b25dc7f007836ca96e156f6e8ec47a5/src/main/javascript/WebAPI/index.js#L16-L21 |
33,975 | artdecocode/reloquent | build/lib/ask.js | ask | function ask(question, options = {}) {
const {
timeout,
password = false,
output = process.stdout,
input = process.stdin,
...rest
} = options
const rl = createInterface(/** @type {!readline.ReadLineOptions} */ ({
input,
output,
...rest,
}))
if (password) {
/**
* Undocu... | javascript | function ask(question, options = {}) {
const {
timeout,
password = false,
output = process.stdout,
input = process.stdin,
...rest
} = options
const rl = createInterface(/** @type {!readline.ReadLineOptions} */ ({
input,
output,
...rest,
}))
if (password) {
/**
* Undocu... | [
"function",
"ask",
"(",
"question",
",",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"{",
"timeout",
",",
"password",
"=",
"false",
",",
"output",
"=",
"process",
".",
"stdout",
",",
"input",
"=",
"process",
".",
"stdin",
",",
"...",
"rest",
"}",
... | Ask user a question and wait for an answer.
@param {string} question Question to present to the user.
@param {{ password: (boolean| undefined), timeout: (number|undefined), input: (stream.Readable|NodeJS.ReadStream|undefined), output: (stream.Writable|NodeJS.WriteStream|undefined) }} options The options. | [
"Ask",
"user",
"a",
"question",
"and",
"wait",
"for",
"an",
"answer",
"."
] | 438131dca204ff7a5912f1c09e1d0df04b7dfee1 | https://github.com/artdecocode/reloquent/blob/438131dca204ff7a5912f1c09e1d0df04b7dfee1/build/lib/ask.js#L9-L56 |
33,976 | rigtorp/statkit | statkit.js | hm | function hm(n, v, incv, offv, tau, b, offb) {
// Apply householder transformation b = b - tau v v' b
// LAPACK: DLARF
if (tau === 0.0) {
return;
}
// compute v' b
var d = b[offb + 0];
for (var i = 1; i < n; ++i) {
d += b[offb + i] * v[offv + incv*i];
}
// compute b = b... | javascript | function hm(n, v, incv, offv, tau, b, offb) {
// Apply householder transformation b = b - tau v v' b
// LAPACK: DLARF
if (tau === 0.0) {
return;
}
// compute v' b
var d = b[offb + 0];
for (var i = 1; i < n; ++i) {
d += b[offb + i] * v[offv + incv*i];
}
// compute b = b... | [
"function",
"hm",
"(",
"n",
",",
"v",
",",
"incv",
",",
"offv",
",",
"tau",
",",
"b",
",",
"offb",
")",
"{",
"// Apply householder transformation b = b - tau v v' b",
"// LAPACK: DLARF",
"if",
"(",
"tau",
"===",
"0.0",
")",
"{",
"return",
";",
"}",
"// com... | Solve the least squares problem min ||Ax=b|| | [
"Solve",
"the",
"least",
"squares",
"problem",
"min",
"||Ax",
"=",
"b||"
] | 9946254429aa592195c606ac3e93740b58206065 | https://github.com/rigtorp/statkit/blob/9946254429aa592195c606ac3e93740b58206065/statkit.js#L594-L613 |
33,977 | erossignon/node-STEP | stepIndexer.js | check_STEP_file | function check_STEP_file(filename, callback) {
"use strict";
// "ISO-10303-21;"
// "HEADER;"
var stream = fs.createReadStream(filename, {flags:"r"});
var fileData = "";
stream.on('data', function (data) {
fileData += data;
// The next lines should be improved
var line... | javascript | function check_STEP_file(filename, callback) {
"use strict";
// "ISO-10303-21;"
// "HEADER;"
var stream = fs.createReadStream(filename, {flags:"r"});
var fileData = "";
stream.on('data', function (data) {
fileData += data;
// The next lines should be improved
var line... | [
"function",
"check_STEP_file",
"(",
"filename",
",",
"callback",
")",
"{",
"\"use strict\"",
";",
"// \"ISO-10303-21;\"",
"// \"HEADER;\"",
"var",
"stream",
"=",
"fs",
".",
"createReadStream",
"(",
"filename",
",",
"{",
"flags",
":",
"\"r\"",
"}",
")",
";",
"v... | return true if the file is a correct STEP file
a correct STEP file starts with
ISO-10303-21;
HEADER;
@param filename
@param callback | [
"return",
"true",
"if",
"the",
"file",
"is",
"a",
"correct",
"STEP",
"file",
"a",
"correct",
"STEP",
"file",
"starts",
"with",
"ISO",
"-",
"10303",
"-",
"21",
";",
"HEADER",
";"
] | 8814e5b95633f1fb314a6f10e482c14a878dee52 | https://github.com/erossignon/node-STEP/blob/8814e5b95633f1fb314a6f10e482c14a878dee52/stepIndexer.js#L276-L317 |
33,978 | rstacruz/ionicons-inline | support/convert.js | process | function process (svg, { prefix }) {
// Inject a <style> in the SVG document to allow changing colors
svg = svg.replace(/<(path|circle) /gi, (_, tag) => `<${tag} fill="__COLOR__" `)
// Since this is a data: URI, we want to encode it with %23 and such
svg = encodeURIComponent(svg)
// We want the #{...} inter... | javascript | function process (svg, { prefix }) {
// Inject a <style> in the SVG document to allow changing colors
svg = svg.replace(/<(path|circle) /gi, (_, tag) => `<${tag} fill="__COLOR__" `)
// Since this is a data: URI, we want to encode it with %23 and such
svg = encodeURIComponent(svg)
// We want the #{...} inter... | [
"function",
"process",
"(",
"svg",
",",
"{",
"prefix",
"}",
")",
"{",
"// Inject a <style> in the SVG document to allow changing colors",
"svg",
"=",
"svg",
".",
"replace",
"(",
"/",
"<(path|circle) ",
"/",
"gi",
",",
"(",
"_",
",",
"tag",
")",
"=>",
"`",
"$... | Converts the SVG into a data URI.
@private | [
"Converts",
"the",
"SVG",
"into",
"a",
"data",
"URI",
"."
] | 3ee918cc07d93b853daeaff361bdd634594a3763 | https://github.com/rstacruz/ionicons-inline/blob/3ee918cc07d93b853daeaff361bdd634594a3763/support/convert.js#L60-L73 |
33,979 | DarkXaHTeP/vk-auth | lib/scrapper/index.js | function (login, pass) {
try {
document.getElementsByName("email")[0].value = login;
document.getElementsByName("pass")[0].value = pass;
document.getElementById("login_submit").submit();
} catch (e) {
}
} | javascript | function (login, pass) {
try {
document.getElementsByName("email")[0].value = login;
document.getElementsByName("pass")[0].value = pass;
document.getElementById("login_submit").submit();
} catch (e) {
}
} | [
"function",
"(",
"login",
",",
"pass",
")",
"{",
"try",
"{",
"document",
".",
"getElementsByName",
"(",
"\"email\"",
")",
"[",
"0",
"]",
".",
"value",
"=",
"login",
";",
"document",
".",
"getElementsByName",
"(",
"\"pass\"",
")",
"[",
"0",
"]",
".",
... | that enters user's credentials on VK login page | [
"that",
"enters",
"user",
"s",
"credentials",
"on",
"VK",
"login",
"page"
] | ff4cf2675b4f450eee59c620634eea6d94143985 | https://github.com/DarkXaHTeP/vk-auth/blob/ff4cf2675b4f450eee59c620634eea6d94143985/lib/scrapper/index.js#L41-L48 | |
33,980 | xixilive/weapp-next | es6/weapp/enhancements.js | shortcutRequest | function shortcutRequest(req){
req.get = shortcut(req, 'GET')
req.post = shortcut(req, 'POST')
req.put = shortcut(req, 'PUT')
req.patch = shortcut(req, 'PATCH')
req['delete'] = shortcut(req, 'DELETE')
req.options = shortcut(req, 'OPTIONS')
req.head = shortcut(req, 'HEAD')
req.trace = shortcut(req, 'TRAC... | javascript | function shortcutRequest(req){
req.get = shortcut(req, 'GET')
req.post = shortcut(req, 'POST')
req.put = shortcut(req, 'PUT')
req.patch = shortcut(req, 'PATCH')
req['delete'] = shortcut(req, 'DELETE')
req.options = shortcut(req, 'OPTIONS')
req.head = shortcut(req, 'HEAD')
req.trace = shortcut(req, 'TRAC... | [
"function",
"shortcutRequest",
"(",
"req",
")",
"{",
"req",
".",
"get",
"=",
"shortcut",
"(",
"req",
",",
"'GET'",
")",
"req",
".",
"post",
"=",
"shortcut",
"(",
"req",
",",
"'POST'",
")",
"req",
".",
"put",
"=",
"shortcut",
"(",
"req",
",",
"'PUT'... | to decorate promisified request function | [
"to",
"decorate",
"promisified",
"request",
"function"
] | 4390d7dbabc73206d3b82fb909a13375b7eaa945 | https://github.com/xixilive/weapp-next/blob/4390d7dbabc73206d3b82fb909a13375b7eaa945/es6/weapp/enhancements.js#L27-L38 |
33,981 | rigtorp/statkit | examples/mcmc.js | lnprior | function lnprior(theta) {
var m = theta[0], b = theta[1], t = theta[2];
if (0.0 < m && m < 1.0 && 0.0 < b && b < 10.0 && 0.0 < t && t < 100.0) {
return 0.0;
}
return -Infinity;
} | javascript | function lnprior(theta) {
var m = theta[0], b = theta[1], t = theta[2];
if (0.0 < m && m < 1.0 && 0.0 < b && b < 10.0 && 0.0 < t && t < 100.0) {
return 0.0;
}
return -Infinity;
} | [
"function",
"lnprior",
"(",
"theta",
")",
"{",
"var",
"m",
"=",
"theta",
"[",
"0",
"]",
",",
"b",
"=",
"theta",
"[",
"1",
"]",
",",
"t",
"=",
"theta",
"[",
"2",
"]",
";",
"if",
"(",
"0.0",
"<",
"m",
"&&",
"m",
"<",
"1.0",
"&&",
"0.0",
"<"... | uniform log-prior for m, b, t | [
"uniform",
"log",
"-",
"prior",
"for",
"m",
"b",
"t"
] | 9946254429aa592195c606ac3e93740b58206065 | https://github.com/rigtorp/statkit/blob/9946254429aa592195c606ac3e93740b58206065/examples/mcmc.js#L15-L21 |
33,982 | rigtorp/statkit | examples/mcmc.js | lnpost | function lnpost(theta, x, y) {
var lp = lnprior(theta);
if (!isFinite(lp)) {
return -Infinity;
}
return lp + lnlike(theta, x, y);
} | javascript | function lnpost(theta, x, y) {
var lp = lnprior(theta);
if (!isFinite(lp)) {
return -Infinity;
}
return lp + lnlike(theta, x, y);
} | [
"function",
"lnpost",
"(",
"theta",
",",
"x",
",",
"y",
")",
"{",
"var",
"lp",
"=",
"lnprior",
"(",
"theta",
")",
";",
"if",
"(",
"!",
"isFinite",
"(",
"lp",
")",
")",
"{",
"return",
"-",
"Infinity",
";",
"}",
"return",
"lp",
"+",
"lnlike",
"("... | posterior log-probability function | [
"posterior",
"log",
"-",
"probability",
"function"
] | 9946254429aa592195c606ac3e93740b58206065 | https://github.com/rigtorp/statkit/blob/9946254429aa592195c606ac3e93740b58206065/examples/mcmc.js#L24-L30 |
33,983 | ctxhou/postcss-hash-classname | index.js | renameSelector | function renameSelector(selector, sourcePath, opts, mappings) {
return selector.map(function(selector){
return parser(function(sels) {
sels.map(function(sel) {
renameNodes(sel.nodes, sourcePath, opts, mappings);
})
}).process(selector).result
});
} | javascript | function renameSelector(selector, sourcePath, opts, mappings) {
return selector.map(function(selector){
return parser(function(sels) {
sels.map(function(sel) {
renameNodes(sel.nodes, sourcePath, opts, mappings);
})
}).process(selector).result
});
} | [
"function",
"renameSelector",
"(",
"selector",
",",
"sourcePath",
",",
"opts",
",",
"mappings",
")",
"{",
"return",
"selector",
".",
"map",
"(",
"function",
"(",
"selector",
")",
"{",
"return",
"parser",
"(",
"function",
"(",
"sels",
")",
"{",
"sels",
".... | Renames all classnames in a css rule selector
@param selector css selector
@param sourcePath Source file's path
@param opts Options object
@param mappings Classname to renamed classname mappings repository
@return {*} Renamed css rule selector | [
"Renames",
"all",
"classnames",
"in",
"a",
"css",
"rule",
"selector"
] | 325d824acc0a1e2ba21832eadeb06106f8d1b8f1 | https://github.com/ctxhou/postcss-hash-classname/blob/325d824acc0a1e2ba21832eadeb06106f8d1b8f1/index.js#L15-L23 |
33,984 | ctxhou/postcss-hash-classname | index.js | renameNodes | function renameNodes(nodes, sourcePath, opts, mappings) {
return nodes.map(function(node) {
// Process CSS node
if (node.type === 'class') {
// Process "class" node
var orgValue = node.value,
newValue = renameClassNode(node.value, sourcePath, opts);
// Edit node and store mapping o... | javascript | function renameNodes(nodes, sourcePath, opts, mappings) {
return nodes.map(function(node) {
// Process CSS node
if (node.type === 'class') {
// Process "class" node
var orgValue = node.value,
newValue = renameClassNode(node.value, sourcePath, opts);
// Edit node and store mapping o... | [
"function",
"renameNodes",
"(",
"nodes",
",",
"sourcePath",
",",
"opts",
",",
"mappings",
")",
"{",
"return",
"nodes",
".",
"map",
"(",
"function",
"(",
"node",
")",
"{",
"// Process CSS node",
"if",
"(",
"node",
".",
"type",
"===",
"'class'",
")",
"{",
... | Renames all classnames in css nodes
@param nodes css nodes
@param sourcePath Source file's path
@param opts Options object
@param mappings Classname to renamed classname mappings repository
@return {*} Renamed css nodes | [
"Renames",
"all",
"classnames",
"in",
"css",
"nodes"
] | 325d824acc0a1e2ba21832eadeb06106f8d1b8f1 | https://github.com/ctxhou/postcss-hash-classname/blob/325d824acc0a1e2ba21832eadeb06106f8d1b8f1/index.js#L33-L50 |
33,985 | ctxhou/postcss-hash-classname | index.js | renameClassNode | function renameClassNode(value, sourcePath, opts) {
// Generate hashes
var className = value,
compositeHash = loaderUtils.getHashDigest( (sourcePath ? sourcePath + className : className), opts.hashType, opts.digestType, opts.maxLength),
classHash = loaderUtils.getHashDigest( className, opts.hashType, op... | javascript | function renameClassNode(value, sourcePath, opts) {
// Generate hashes
var className = value,
compositeHash = loaderUtils.getHashDigest( (sourcePath ? sourcePath + className : className), opts.hashType, opts.digestType, opts.maxLength),
classHash = loaderUtils.getHashDigest( className, opts.hashType, op... | [
"function",
"renameClassNode",
"(",
"value",
",",
"sourcePath",
",",
"opts",
")",
"{",
"// Generate hashes",
"var",
"className",
"=",
"value",
",",
"compositeHash",
"=",
"loaderUtils",
".",
"getHashDigest",
"(",
"(",
"sourcePath",
"?",
"sourcePath",
"+",
"classN... | Generates a replacement css classname
@param value Original classname
@param sourcePath Source file's path
@param opts Options object | [
"Generates",
"a",
"replacement",
"css",
"classname"
] | 325d824acc0a1e2ba21832eadeb06106f8d1b8f1 | https://github.com/ctxhou/postcss-hash-classname/blob/325d824acc0a1e2ba21832eadeb06106f8d1b8f1/index.js#L58-L82 |
33,986 | ctxhou/postcss-hash-classname | index.js | verifyOptionType | function verifyOptionType(sourcePath, name, value) {
if (typeof value === 'object') {
var msg = 'POSTCSS-HASH-CLASSNAME ERROR: Object value not supported for option "' + name + '"!';
console.error(msg);
throw new Error(msg);
} else if (!sourcePath && typeof value === 'function') {
var msg = 'POSTCSS... | javascript | function verifyOptionType(sourcePath, name, value) {
if (typeof value === 'object') {
var msg = 'POSTCSS-HASH-CLASSNAME ERROR: Object value not supported for option "' + name + '"!';
console.error(msg);
throw new Error(msg);
} else if (!sourcePath && typeof value === 'function') {
var msg = 'POSTCSS... | [
"function",
"verifyOptionType",
"(",
"sourcePath",
",",
"name",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"===",
"'object'",
")",
"{",
"var",
"msg",
"=",
"'POSTCSS-HASH-CLASSNAME ERROR: Object value not supported for option \"'",
"+",
"name",
"+",
"'\"!'... | Makes sure option is a string and outputs a warning to console if it seems like option is using templating
@param sourcePath Source file's path
@param name Validating option's name
@param value Validating option's value | [
"Makes",
"sure",
"option",
"is",
"a",
"string",
"and",
"outputs",
"a",
"warning",
"to",
"console",
"if",
"it",
"seems",
"like",
"option",
"is",
"using",
"templating"
] | 325d824acc0a1e2ba21832eadeb06106f8d1b8f1 | https://github.com/ctxhou/postcss-hash-classname/blob/325d824acc0a1e2ba21832eadeb06106f8d1b8f1/index.js#L90-L103 |
33,987 | ctxhou/postcss-hash-classname | index.js | formatFileOutput | function formatFileOutput(mappings, type) {
var string = JSON.stringify(mappings, null, 2);
if (type === '.js') {
return 'module.exports=' + string;
} else if (type === '.json') {
return string;
}
} | javascript | function formatFileOutput(mappings, type) {
var string = JSON.stringify(mappings, null, 2);
if (type === '.js') {
return 'module.exports=' + string;
} else if (type === '.json') {
return string;
}
} | [
"function",
"formatFileOutput",
"(",
"mappings",
",",
"type",
")",
"{",
"var",
"string",
"=",
"JSON",
".",
"stringify",
"(",
"mappings",
",",
"null",
",",
"2",
")",
";",
"if",
"(",
"type",
"===",
"'.js'",
")",
"{",
"return",
"'module.exports='",
"+",
"... | Formats class mapping output for writing to a file of specified type
@param mappings Classname to renamed classname mappings repository
@param type Output file type
@return {string} Formatted output file contents | [
"Formats",
"class",
"mapping",
"output",
"for",
"writing",
"to",
"a",
"file",
"of",
"specified",
"type"
] | 325d824acc0a1e2ba21832eadeb06106f8d1b8f1 | https://github.com/ctxhou/postcss-hash-classname/blob/325d824acc0a1e2ba21832eadeb06106f8d1b8f1/index.js#L111-L118 |
33,988 | therebelbeta/json-mock | src/utils.js | createId | function createId(coll) {
if (_.isEmpty(coll)) {
return 1
} else {
var id = _.max(coll, function(doc) {
return doc.id
}).id
if (_.isFinite(id)) {
// Increment integer id
return ++id
} else {
// Generate string id
return uuid()
}
}
} | javascript | function createId(coll) {
if (_.isEmpty(coll)) {
return 1
} else {
var id = _.max(coll, function(doc) {
return doc.id
}).id
if (_.isFinite(id)) {
// Increment integer id
return ++id
} else {
// Generate string id
return uuid()
}
}
} | [
"function",
"createId",
"(",
"coll",
")",
"{",
"if",
"(",
"_",
".",
"isEmpty",
"(",
"coll",
")",
")",
"{",
"return",
"1",
"}",
"else",
"{",
"var",
"id",
"=",
"_",
".",
"max",
"(",
"coll",
",",
"function",
"(",
"doc",
")",
"{",
"return",
"doc",
... | Return incremented id or uuid | [
"Return",
"incremented",
"id",
"or",
"uuid"
] | a138d20d943733ce85556d8b6cd45c23d4d5676d | https://github.com/therebelbeta/json-mock/blob/a138d20d943733ce85556d8b6cd45c23d4d5676d/src/utils.js#L24-L40 |
33,989 | blakeembrey/simulate-event | simulate-event.js | getOverrides | function getOverrides (eventType, options) {
if (eventType === 'KeyboardEvent' && options) {
return {
keyCode: options.keyCode || 0,
key: options.key || 0,
which: options.which || options.keyCode || 0
}
}
} | javascript | function getOverrides (eventType, options) {
if (eventType === 'KeyboardEvent' && options) {
return {
keyCode: options.keyCode || 0,
key: options.key || 0,
which: options.which || options.keyCode || 0
}
}
} | [
"function",
"getOverrides",
"(",
"eventType",
",",
"options",
")",
"{",
"if",
"(",
"eventType",
"===",
"'KeyboardEvent'",
"&&",
"options",
")",
"{",
"return",
"{",
"keyCode",
":",
"options",
".",
"keyCode",
"||",
"0",
",",
"key",
":",
"options",
".",
"ke... | Get attributes which must be overriden manually.
@param {String} eventType
@param {Object} options. | [
"Get",
"attributes",
"which",
"must",
"be",
"overriden",
"manually",
"."
] | 56196882e66d0f7d033de4c71e99cef724b2adb1 | https://github.com/blakeembrey/simulate-event/blob/56196882e66d0f7d033de4c71e99cef724b2adb1/simulate-event.js#L282-L290 |
33,990 | samuelneff/topsort | lib/topsort.js | topsort | function topsort(edges, options) {
var nodes = {};
options = options || { continueOnCircularDependency: false };
var sorted = [];
// hash: id of already visited node => true
var visited = {};
// 1. build data structures
edges.forEach(function (edge) {
var fromEdge = edg... | javascript | function topsort(edges, options) {
var nodes = {};
options = options || { continueOnCircularDependency: false };
var sorted = [];
// hash: id of already visited node => true
var visited = {};
// 1. build data structures
edges.forEach(function (edge) {
var fromEdge = edg... | [
"function",
"topsort",
"(",
"edges",
",",
"options",
")",
"{",
"var",
"nodes",
"=",
"{",
"}",
";",
"options",
"=",
"options",
"||",
"{",
"continueOnCircularDependency",
":",
"false",
"}",
";",
"var",
"sorted",
"=",
"[",
"]",
";",
"// hash: id of already vi... | general topological sort
@param edges : list of edges. each edge forms Array<ID,ID> e.g. [12 , 3]
@param options When provided with 'continueOnCircularDependency' set to true, sorting will continue even if a
circular dependency is found. The precise sort is not guaranteed.
@returns Array : topological sorted list of ID... | [
"general",
"topological",
"sort"
] | 1b5f4ea075d3f6a6fac9898ba94642dec222c928 | https://github.com/samuelneff/topsort/blob/1b5f4ea075d3f6a6fac9898ba94642dec222c928/lib/topsort.js#L36-L107 |
33,991 | DeviaVir/node-vultr | vultr.js | Vultr | function Vultr(apiKey) {
this.version = 'v1';
this.endpoint = 'https://api.vultr.com/' + this.version + '/';
this.apiKey = (apiKey ? apiKey : config.vultr.apiKey);
this.account = new account(this);
this.dns = new dns(this);
this.os = new os(this);
this.iso = new iso(this);
this.backup = new backup(this... | javascript | function Vultr(apiKey) {
this.version = 'v1';
this.endpoint = 'https://api.vultr.com/' + this.version + '/';
this.apiKey = (apiKey ? apiKey : config.vultr.apiKey);
this.account = new account(this);
this.dns = new dns(this);
this.os = new os(this);
this.iso = new iso(this);
this.backup = new backup(this... | [
"function",
"Vultr",
"(",
"apiKey",
")",
"{",
"this",
".",
"version",
"=",
"'v1'",
";",
"this",
".",
"endpoint",
"=",
"'https://api.vultr.com/'",
"+",
"this",
".",
"version",
"+",
"'/'",
";",
"this",
".",
"apiKey",
"=",
"(",
"apiKey",
"?",
"apiKey",
":... | Vultr instance constructor
@prototype
@class Vultr | [
"Vultr",
"instance",
"constructor"
] | 2f13708d3ce0716b4c4adc4772173cf1cf7e7150 | https://github.com/DeviaVir/node-vultr/blob/2f13708d3ce0716b4c4adc4772173cf1cf7e7150/vultr.js#L25-L41 |
33,992 | therebelbeta/json-mock | bin/index.js | start | function start(object, filename) {
var port = process.env.PORT || argv.port
var hostname = argv.host === '0.0.0.0' ? 'localhost' : argv.host
for (var prop in object) {
console.log(chalk.gray(' http://' + hostname + ':' + port + '/') + chalk.cyan(prop))
}
console.log(
'\nYou can now go to ' + chalk... | javascript | function start(object, filename) {
var port = process.env.PORT || argv.port
var hostname = argv.host === '0.0.0.0' ? 'localhost' : argv.host
for (var prop in object) {
console.log(chalk.gray(' http://' + hostname + ':' + port + '/') + chalk.cyan(prop))
}
console.log(
'\nYou can now go to ' + chalk... | [
"function",
"start",
"(",
"object",
",",
"filename",
")",
"{",
"var",
"port",
"=",
"process",
".",
"env",
".",
"PORT",
"||",
"argv",
".",
"port",
"var",
"hostname",
"=",
"argv",
".",
"host",
"===",
"'0.0.0.0'",
"?",
"'localhost'",
":",
"argv",
".",
"... | Start server function | [
"Start",
"server",
"function"
] | a138d20d943733ce85556d8b6cd45c23d4d5676d | https://github.com/therebelbeta/json-mock/blob/a138d20d943733ce85556d8b6cd45c23d4d5676d/bin/index.js#L36-L72 |
33,993 | dynmeth/mongo-statsd-backend | lib/index.js | function(metric_type, metric) {
var ary = metric.split('.');
if (options.prefix) ary.shift();
ary.unshift(metric_type);
return ary.join('.')+'_'+options.rate;
} | javascript | function(metric_type, metric) {
var ary = metric.split('.');
if (options.prefix) ary.shift();
ary.unshift(metric_type);
return ary.join('.')+'_'+options.rate;
} | [
"function",
"(",
"metric_type",
",",
"metric",
")",
"{",
"var",
"ary",
"=",
"metric",
".",
"split",
"(",
"'.'",
")",
";",
"if",
"(",
"options",
".",
"prefix",
")",
"ary",
".",
"shift",
"(",
")",
";",
"ary",
".",
"unshift",
"(",
"metric_type",
")",
... | Prefix a collection name | [
"Prefix",
"a",
"collection",
"name"
] | d51b32bcd5df4d4053a50c9bbca6d16cb859097b | https://github.com/dynmeth/mongo-statsd-backend/blob/d51b32bcd5df4d4053a50c9bbca6d16cb859097b/lib/index.js#L52-L57 | |
33,994 | dynmeth/mongo-statsd-backend | lib/index.js | function(time, key, val) {
return {
db: dbPrefix(key),
col: colPrefix('gauges', key),
data: {
time: time,
gauge: val
},
};
} | javascript | function(time, key, val) {
return {
db: dbPrefix(key),
col: colPrefix('gauges', key),
data: {
time: time,
gauge: val
},
};
} | [
"function",
"(",
"time",
",",
"key",
",",
"val",
")",
"{",
"return",
"{",
"db",
":",
"dbPrefix",
"(",
"key",
")",
",",
"col",
":",
"colPrefix",
"(",
"'gauges'",
",",
"key",
")",
",",
"data",
":",
"{",
"time",
":",
"time",
",",
"gauge",
":",
"va... | Aggregate some metrics bro
@param {Number} time
@param {Stirng} key
@param {String} val | [
"Aggregate",
"some",
"metrics",
"bro"
] | d51b32bcd5df4d4053a50c9bbca6d16cb859097b | https://github.com/dynmeth/mongo-statsd-backend/blob/d51b32bcd5df4d4053a50c9bbca6d16cb859097b/lib/index.js#L69-L78 | |
33,995 | dynmeth/mongo-statsd-backend | lib/index.js | function(dbName, collection, metric, callback) {
var colInfo = {capped:true, size:options.size*options.max, max:options.max};
database(dbName, function(err, db) {
if (err) {
db.close();
return callback(err);
};
db.createCollection(collection, colInfo, function(err, collClient) {
collClient.inse... | javascript | function(dbName, collection, metric, callback) {
var colInfo = {capped:true, size:options.size*options.max, max:options.max};
database(dbName, function(err, db) {
if (err) {
db.close();
return callback(err);
};
db.createCollection(collection, colInfo, function(err, collClient) {
collClient.inse... | [
"function",
"(",
"dbName",
",",
"collection",
",",
"metric",
",",
"callback",
")",
"{",
"var",
"colInfo",
"=",
"{",
"capped",
":",
"true",
",",
"size",
":",
"options",
".",
"size",
"*",
"options",
".",
"max",
",",
"max",
":",
"options",
".",
"max",
... | Insert the data to the database
@method insert
@param {String} database
@param {String} collection
@param {Object} metric
@param {Function} callback | [
"Insert",
"the",
"data",
"to",
"the",
"database"
] | d51b32bcd5df4d4053a50c9bbca6d16cb859097b | https://github.com/dynmeth/mongo-statsd-backend/blob/d51b32bcd5df4d4053a50c9bbca6d16cb859097b/lib/index.js#L151-L167 | |
33,996 | dynmeth/mongo-statsd-backend | lib/index.js | function(time, metrics) {
var metricTypes = ['gauges', 'timer_data', 'timers', 'counters', 'sets'];
metricTypes.forEach(function(type, i){
var obj;
for (var key in metrics[type]) {
obj = aggregate[type](time, key, metrics[type][key]);
insert(obj.db, obj.col, obj.data, function(err){
if (err) console.... | javascript | function(time, metrics) {
var metricTypes = ['gauges', 'timer_data', 'timers', 'counters', 'sets'];
metricTypes.forEach(function(type, i){
var obj;
for (var key in metrics[type]) {
obj = aggregate[type](time, key, metrics[type][key]);
insert(obj.db, obj.col, obj.data, function(err){
if (err) console.... | [
"function",
"(",
"time",
",",
"metrics",
")",
"{",
"var",
"metricTypes",
"=",
"[",
"'gauges'",
",",
"'timer_data'",
",",
"'timers'",
",",
"'counters'",
",",
"'sets'",
"]",
";",
"metricTypes",
".",
"forEach",
"(",
"function",
"(",
"type",
",",
"i",
")",
... | our `flush` event handler | [
"our",
"flush",
"event",
"handler"
] | d51b32bcd5df4d4053a50c9bbca6d16cb859097b | https://github.com/dynmeth/mongo-statsd-backend/blob/d51b32bcd5df4d4053a50c9bbca6d16cb859097b/lib/index.js#L172-L186 | |
33,997 | ohjames/angular-promise-extras | angular-promise-extras.js | function(obj, callback) {
if (angular.isArray(obj))
return obj.map(callback)
var ret = {}
Object.keys(obj).forEach(function(key, val) {
ret[key] = callback(obj[key], key)
})
return ret
} | javascript | function(obj, callback) {
if (angular.isArray(obj))
return obj.map(callback)
var ret = {}
Object.keys(obj).forEach(function(key, val) {
ret[key] = callback(obj[key], key)
})
return ret
} | [
"function",
"(",
"obj",
",",
"callback",
")",
"{",
"if",
"(",
"angular",
".",
"isArray",
"(",
"obj",
")",
")",
"return",
"obj",
".",
"map",
"(",
"callback",
")",
"var",
"ret",
"=",
"{",
"}",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"forEach",... | Called with an array this acts like map, otherwise it acts like _.mapValues
in lodash.
@return {Array|Object} The same type as the input argument. | [
"Called",
"with",
"an",
"array",
"this",
"acts",
"like",
"map",
"otherwise",
"it",
"acts",
"like",
"_",
".",
"mapValues",
"in",
"lodash",
"."
] | df4cf5ca35cc6080bfd7e71ed3d4f3d0c0c51540 | https://github.com/ohjames/angular-promise-extras/blob/df4cf5ca35cc6080bfd7e71ed3d4f3d0c0c51540/angular-promise-extras.js#L9-L18 | |
33,998 | bfanger/angular-keyboard | src/directives/KbContainerController.js | function (model) {
if (!this.ngModel) {
return; // A kb-item can't be selected without a ng-model on the container element.
}
if (this.multiple) {
if (this.isSelected(model) === false) {
this.selected.push(model);
... | javascript | function (model) {
if (!this.ngModel) {
return; // A kb-item can't be selected without a ng-model on the container element.
}
if (this.multiple) {
if (this.isSelected(model) === false) {
this.selected.push(model);
... | [
"function",
"(",
"model",
")",
"{",
"if",
"(",
"!",
"this",
".",
"ngModel",
")",
"{",
"return",
";",
"// A kb-item can't be selected without a ng-model on the container element.",
"}",
"if",
"(",
"this",
".",
"multiple",
")",
"{",
"if",
"(",
"this",
".",
"isSe... | Select the given model.
Or in multiselect mode, add the given model to the selection.
@param {*} model | [
"Select",
"the",
"given",
"model",
".",
"Or",
"in",
"multiselect",
"mode",
"add",
"the",
"given",
"model",
"to",
"the",
"selection",
"."
] | 543741a68ceb06f023bc4474297ba0c835ea6f0a | https://github.com/bfanger/angular-keyboard/blob/543741a68ceb06f023bc4474297ba0c835ea6f0a/src/directives/KbContainerController.js#L59-L72 | |
33,999 | bfanger/angular-keyboard | src/directives/KbContainerController.js | function (model) {
if (!this.ngModel) {
return;
}
var index = this.selected.indexOf(model);
if (index !== -1) {
this.selected.splice(index, 1);
if (this.multiple) {
this.ngModel.$setViewValue(this.selecte... | javascript | function (model) {
if (!this.ngModel) {
return;
}
var index = this.selected.indexOf(model);
if (index !== -1) {
this.selected.splice(index, 1);
if (this.multiple) {
this.ngModel.$setViewValue(this.selecte... | [
"function",
"(",
"model",
")",
"{",
"if",
"(",
"!",
"this",
".",
"ngModel",
")",
"{",
"return",
";",
"}",
"var",
"index",
"=",
"this",
".",
"selected",
".",
"indexOf",
"(",
"model",
")",
";",
"if",
"(",
"index",
"!==",
"-",
"1",
")",
"{",
"this... | Deselect the given model.
Does nothing if the given model isn't selected.
@param {*} model | [
"Deselect",
"the",
"given",
"model",
".",
"Does",
"nothing",
"if",
"the",
"given",
"model",
"isn",
"t",
"selected",
"."
] | 543741a68ceb06f023bc4474297ba0c835ea6f0a | https://github.com/bfanger/angular-keyboard/blob/543741a68ceb06f023bc4474297ba0c835ea6f0a/src/directives/KbContainerController.js#L79-L93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.