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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
nakardo/node-gameboy | lib/cpu/opcodes.js | add | function add (cpu, n) {
const r = cpu.a + n;
cpu.f = 0;
if ((r & 0xff) == 0) cpu.f |= FLAG_Z;
if (((cpu.a ^ n ^ r) & 0x10) != 0) cpu.f |= FLAG_H;
if ((r & 0x100) != 0) cpu.f |= FLAG_C;
return r;
} | javascript | function add (cpu, n) {
const r = cpu.a + n;
cpu.f = 0;
if ((r & 0xff) == 0) cpu.f |= FLAG_Z;
if (((cpu.a ^ n ^ r) & 0x10) != 0) cpu.f |= FLAG_H;
if ((r & 0x100) != 0) cpu.f |= FLAG_C;
return r;
} | [
"function",
"add",
"(",
"cpu",
",",
"n",
")",
"{",
"const",
"r",
"=",
"cpu",
".",
"a",
"+",
"n",
";",
"cpu",
".",
"f",
"=",
"0",
";",
"if",
"(",
"(",
"r",
"&",
"0xff",
")",
"==",
"0",
")",
"cpu",
".",
"f",
"|=",
"FLAG_Z",
";",
"if",
"("... | 8-Bit ALU
ADD A,n
Description:
Add n to A.
Use with:
n = A, B, C, D, E, H, L, (HL), #
Flags affected:
Z - Set if result is zero.
N - Reset.
H - Set if carry from bit 3.
C - Set if carry from bit 7.
Opcodes:
Instruction Parameters Opcode Cycles
ADD A,A 87 4
ADD A,B ... | [
"8",
"-",
"Bit",
"ALU",
"ADD",
"A",
"n"
] | 93d112cddf7c9fd914f597be4d110b922d7cb59f | https://github.com/nakardo/node-gameboy/blob/93d112cddf7c9fd914f597be4d110b922d7cb59f/lib/cpu/opcodes.js#L731-L740 | train |
nakardo/node-gameboy | lib/cpu/opcodes.js | adc | function adc (cpu, n) {
const cy = cpu.f >> 4 & 1;
const r = cpu.a + n + cy;
cpu.f = 0;
if ((r & 0xff) == 0) cpu.f |= FLAG_Z;
if (((cpu.a ^ n ^ r) & 0x10) != 0) cpu.f |= FLAG_H;
if ((r & 0x100) != 0) cpu.f |= FLAG_C;
return r;
} | javascript | function adc (cpu, n) {
const cy = cpu.f >> 4 & 1;
const r = cpu.a + n + cy;
cpu.f = 0;
if ((r & 0xff) == 0) cpu.f |= FLAG_Z;
if (((cpu.a ^ n ^ r) & 0x10) != 0) cpu.f |= FLAG_H;
if ((r & 0x100) != 0) cpu.f |= FLAG_C;
return r;
} | [
"function",
"adc",
"(",
"cpu",
",",
"n",
")",
"{",
"const",
"cy",
"=",
"cpu",
".",
"f",
">>",
"4",
"&",
"1",
";",
"const",
"r",
"=",
"cpu",
".",
"a",
"+",
"n",
"+",
"cy",
";",
"cpu",
".",
"f",
"=",
"0",
";",
"if",
"(",
"(",
"r",
"&",
... | ADC A,n
Description:
Add n + Carry flag to A.
Use with:
n = A, B, C, D, E, H, L, (HL), #
Flags affected:
Z - Set if result is zero.
N - Reset.
H - Set if carry from bit 3.
C - Set if carry from bit 7.
Opcodes:
Instruction Parameters Opcode Cycles
ADC A,A 8F 4
ADC A,B ... | [
"ADC",
"A",
"n"
] | 93d112cddf7c9fd914f597be4d110b922d7cb59f | https://github.com/nakardo/node-gameboy/blob/93d112cddf7c9fd914f597be4d110b922d7cb59f/lib/cpu/opcodes.js#L801-L811 | train |
nakardo/node-gameboy | lib/cpu/opcodes.js | sbc | function sbc (cpu, n) {
const cy = cpu.f >> 4 & 1;
const r = cpu.a - n - cy;
cpu.f = FLAG_N;
if ((r & 0xff) == 0) cpu.f |= FLAG_Z;
if (((cpu.a ^ n ^ r) & 0x10) != 0) cpu.f |= FLAG_H;
if ((r & 0x100) != 0) cpu.f |= FLAG_C;
return r;
} | javascript | function sbc (cpu, n) {
const cy = cpu.f >> 4 & 1;
const r = cpu.a - n - cy;
cpu.f = FLAG_N;
if ((r & 0xff) == 0) cpu.f |= FLAG_Z;
if (((cpu.a ^ n ^ r) & 0x10) != 0) cpu.f |= FLAG_H;
if ((r & 0x100) != 0) cpu.f |= FLAG_C;
return r;
} | [
"function",
"sbc",
"(",
"cpu",
",",
"n",
")",
"{",
"const",
"cy",
"=",
"cpu",
".",
"f",
">>",
"4",
"&",
"1",
";",
"const",
"r",
"=",
"cpu",
".",
"a",
"-",
"n",
"-",
"cy",
";",
"cpu",
".",
"f",
"=",
"FLAG_N",
";",
"if",
"(",
"(",
"r",
"&... | SBC A,n
Description:
Subtract n + Carry flag from A.
Use with:
n = A, B, C, D, E, H, L, (HL), #
Flags affected:
Z - Set if result is zero.
N - Set.
H - Set if no borrow from bit 4.
C - Set if no borrow.
Opcodes:
Instruction Parameters Opcode Cycles
SBC A,A 9F 4
SBC A,... | [
"SBC",
"A",
"n"
] | 93d112cddf7c9fd914f597be4d110b922d7cb59f | https://github.com/nakardo/node-gameboy/blob/93d112cddf7c9fd914f597be4d110b922d7cb59f/lib/cpu/opcodes.js#L938-L948 | train |
nakardo/node-gameboy | lib/cpu/opcodes.js | swap | function swap (cpu, n) {
const r = n << 4 | n >> 4;
cpu.f = 0;
if ((r & 0xff) == 0) cpu.f |= FLAG_Z;
return r;
} | javascript | function swap (cpu, n) {
const r = n << 4 | n >> 4;
cpu.f = 0;
if ((r & 0xff) == 0) cpu.f |= FLAG_Z;
return r;
} | [
"function",
"swap",
"(",
"cpu",
",",
"n",
")",
"{",
"const",
"r",
"=",
"n",
"<<",
"4",
"|",
"n",
">>",
"4",
";",
"cpu",
".",
"f",
"=",
"0",
";",
"if",
"(",
"(",
"r",
"&",
"0xff",
")",
"==",
"0",
")",
"cpu",
".",
"f",
"|=",
"FLAG_Z",
";"... | Miscellaneous
SWAP n
Description:
Swap upper & lower nibles of n.
Use with:
n = A, B, C, D, E, H, L, (HL)
Flags affected:
Z - Set if result is zero.
N - Reset.
H - Reset.
C - Reset.
Opcodes:
Instruction Parameters Opcode Cycles
SWAP A CB 37 8
SWAP B CB 30 ... | [
"Miscellaneous",
"SWAP",
"n"
] | 93d112cddf7c9fd914f597be4d110b922d7cb59f | https://github.com/nakardo/node-gameboy/blob/93d112cddf7c9fd914f597be4d110b922d7cb59f/lib/cpu/opcodes.js#L1513-L1520 | train |
nakardo/node-gameboy | lib/cpu/opcodes.js | bit | function bit (cpu, b, n) {
const r = n & (1 << b);
cpu.f &= ~0xe0;
if (r == 0) cpu.f |= FLAG_Z;
cpu.f |= FLAG_H;
return r;
} | javascript | function bit (cpu, b, n) {
const r = n & (1 << b);
cpu.f &= ~0xe0;
if (r == 0) cpu.f |= FLAG_Z;
cpu.f |= FLAG_H;
return r;
} | [
"function",
"bit",
"(",
"cpu",
",",
"b",
",",
"n",
")",
"{",
"const",
"r",
"=",
"n",
"&",
"(",
"1",
"<<",
"b",
")",
";",
"cpu",
".",
"f",
"&=",
"~",
"0xe0",
";",
"if",
"(",
"r",
"==",
"0",
")",
"cpu",
".",
"f",
"|=",
"FLAG_Z",
";",
"cpu... | Bit Opcodes
BIT b,r
Description:
Test bit b in register r.
Use with:
b = 0 - 7, r = A, B, C, D, E, H, L, (HL)
Flags affected:
Z - Set if bit b of register r is 0.
N - Reset.
H - Set.
C - Not affected.
Opcodes:
Instruction Parameters Opcode Cycles
BIT b,A CB 47 8
BIT b,B... | [
"Bit",
"Opcodes",
"BIT",
"b",
"r"
] | 93d112cddf7c9fd914f597be4d110b922d7cb59f | https://github.com/nakardo/node-gameboy/blob/93d112cddf7c9fd914f597be4d110b922d7cb59f/lib/cpu/opcodes.js#L2329-L2337 | train |
nakardo/node-gameboy | lib/cpu/opcodes.js | function (cpu, mmu, cc) {
if (cc) {
cpu.pc += 2 + mmu.readByte(cpu.pc + 1).signed();
return 12;
}
cpu.pc += 2;
return 8;
} | javascript | function (cpu, mmu, cc) {
if (cc) {
cpu.pc += 2 + mmu.readByte(cpu.pc + 1).signed();
return 12;
}
cpu.pc += 2;
return 8;
} | [
"function",
"(",
"cpu",
",",
"mmu",
",",
"cc",
")",
"{",
"if",
"(",
"cc",
")",
"{",
"cpu",
".",
"pc",
"+=",
"2",
"+",
"mmu",
".",
"readByte",
"(",
"cpu",
".",
"pc",
"+",
"1",
")",
".",
"signed",
"(",
")",
";",
"return",
"12",
";",
"}",
"c... | JR cc,n
Description:
If following condition is true then add n address and jump to it:
Use with:
n = one byte signed immediate value
cc = NZ, Jump if Z flag is reset.
cc = Z, Jump if Z flag is set.
cc = NC, Jump if C flag is reset.
cc = C, Jump if C flag is set.
Opcodes:
Instruction Parameters Opcode Cycles... | [
"JR",
"cc",
"n"
] | 93d112cddf7c9fd914f597be4d110b922d7cb59f | https://github.com/nakardo/node-gameboy/blob/93d112cddf7c9fd914f597be4d110b922d7cb59f/lib/cpu/opcodes.js#L2759-L2767 | train | |
nakardo/node-gameboy | lib/cpu/opcodes.js | function (cpu, mmu, cc) {
if (cc) {
mmu.writeWord(cpu.sp -= 2, cpu.pc + 3);
cpu.pc = mmu.readWord(cpu.pc + 1);
return 24;
}
cpu.pc += 3;
return 12;
} | javascript | function (cpu, mmu, cc) {
if (cc) {
mmu.writeWord(cpu.sp -= 2, cpu.pc + 3);
cpu.pc = mmu.readWord(cpu.pc + 1);
return 24;
}
cpu.pc += 3;
return 12;
} | [
"function",
"(",
"cpu",
",",
"mmu",
",",
"cc",
")",
"{",
"if",
"(",
"cc",
")",
"{",
"mmu",
".",
"writeWord",
"(",
"cpu",
".",
"sp",
"-=",
"2",
",",
"cpu",
".",
"pc",
"+",
"3",
")",
";",
"cpu",
".",
"pc",
"=",
"mmu",
".",
"readWord",
"(",
... | CALL cc,nn
Description:
Call address n if following condition is true:
cc = NZ, Call if Z flag is reset.
cc = Z, Call if Z flag is set.
cc = NC, Call if C flag is reset.
cc = C, Call if C flag is set.
Use with:
nn = two byte immediate value. (LS byte first.)
Opcodes:
Instruction Parameters Opcode Cycles
CAL... | [
"CALL",
"cc",
"nn"
] | 93d112cddf7c9fd914f597be4d110b922d7cb59f | https://github.com/nakardo/node-gameboy/blob/93d112cddf7c9fd914f597be4d110b922d7cb59f/lib/cpu/opcodes.js#L2820-L2830 | train | |
bevacqua/indexeddb-mock | indexeddb.js | function (data) {
if (mockIndexedDBTestFlags.canSave === true) {
mockIndexedDBItems.push(data);
mockIndexedDB_storeAddTimer = setTimeout(function () {
mockIndexedDBTransaction.callCompleteHandler();
mockIndexedDB_saveSuccess = true;
}, 20);
}
else {
mockIndexedDB_storeAddTimer = setTimeout(fun... | javascript | function (data) {
if (mockIndexedDBTestFlags.canSave === true) {
mockIndexedDBItems.push(data);
mockIndexedDB_storeAddTimer = setTimeout(function () {
mockIndexedDBTransaction.callCompleteHandler();
mockIndexedDB_saveSuccess = true;
}, 20);
}
else {
mockIndexedDB_storeAddTimer = setTimeout(fun... | [
"function",
"(",
"data",
")",
"{",
"if",
"(",
"mockIndexedDBTestFlags",
".",
"canSave",
"===",
"true",
")",
"{",
"mockIndexedDBItems",
".",
"push",
"(",
"data",
")",
";",
"mockIndexedDB_storeAddTimer",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"mock... | add returns a different txn than delete does. in indexedDB, the listeners are attached to the txn that returned the store. | [
"add",
"returns",
"a",
"different",
"txn",
"than",
"delete",
"does",
".",
"in",
"indexedDB",
"the",
"listeners",
"are",
"attached",
"to",
"the",
"txn",
"that",
"returned",
"the",
"store",
"."
] | ad62dfa699d0fd6933f1d4d897f4c099c56d734d | https://github.com/bevacqua/indexeddb-mock/blob/ad62dfa699d0fd6933f1d4d897f4c099c56d734d/indexeddb.js#L239-L255 | train | |
bevacqua/indexeddb-mock | indexeddb.js | function (data_id) {
if (mockIndexedDBTestFlags.canDelete === true) {
mockIndexedDB_storeDeleteTimer = setTimeout(function () {
mockIndexedDBStoreTransaction.callSuccessHandler();
mockIndexedDB_deleteSuccess = true;
}, 20);
}
else {
mockIndexedDB_storeDeleteTimer = setTimeout(function () {
mo... | javascript | function (data_id) {
if (mockIndexedDBTestFlags.canDelete === true) {
mockIndexedDB_storeDeleteTimer = setTimeout(function () {
mockIndexedDBStoreTransaction.callSuccessHandler();
mockIndexedDB_deleteSuccess = true;
}, 20);
}
else {
mockIndexedDB_storeDeleteTimer = setTimeout(function () {
mo... | [
"function",
"(",
"data_id",
")",
"{",
"if",
"(",
"mockIndexedDBTestFlags",
".",
"canDelete",
"===",
"true",
")",
"{",
"mockIndexedDB_storeDeleteTimer",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"mockIndexedDBStoreTransaction",
".",
"callSuccessHandler",
"("... | for delete, the listeners are attached to a request returned from the store. | [
"for",
"delete",
"the",
"listeners",
"are",
"attached",
"to",
"a",
"request",
"returned",
"from",
"the",
"store",
"."
] | ad62dfa699d0fd6933f1d4d897f4c099c56d734d | https://github.com/bevacqua/indexeddb-mock/blob/ad62dfa699d0fd6933f1d4d897f4c099c56d734d/indexeddb.js#L278-L293 | train | |
bevacqua/indexeddb-mock | indexeddb.js | function (data_id) {
if (mockIndexedDBTestFlags.canClear === true) {
mockIndexedDB_storeClearTimer = setTimeout(function () {
mockIndexedDBStoreTransaction.callSuccessHandler();
mockIndexedDB_clearSuccess = true;
}, 20);
}
else {
mockIndexedDB_storeClearTimer = setTimeout(function () {
mockIn... | javascript | function (data_id) {
if (mockIndexedDBTestFlags.canClear === true) {
mockIndexedDB_storeClearTimer = setTimeout(function () {
mockIndexedDBStoreTransaction.callSuccessHandler();
mockIndexedDB_clearSuccess = true;
}, 20);
}
else {
mockIndexedDB_storeClearTimer = setTimeout(function () {
mockIn... | [
"function",
"(",
"data_id",
")",
"{",
"if",
"(",
"mockIndexedDBTestFlags",
".",
"canClear",
"===",
"true",
")",
"{",
"mockIndexedDB_storeClearTimer",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"mockIndexedDBStoreTransaction",
".",
"callSuccessHandler",
"(",
... | for clear, the listeners are attached to a request returned from the store. | [
"for",
"clear",
"the",
"listeners",
"are",
"attached",
"to",
"a",
"request",
"returned",
"from",
"the",
"store",
"."
] | ad62dfa699d0fd6933f1d4d897f4c099c56d734d | https://github.com/bevacqua/indexeddb-mock/blob/ad62dfa699d0fd6933f1d4d897f4c099c56d734d/indexeddb.js#L296-L311 | train | |
ForbesLindesay/redux-wait | example/middleware/api.js | getNextPageUrl | function getNextPageUrl(response) {
const link = response.headers.get('link');
if (!link) {
return null;
}
const nextLink = link.split(',').filter(s => s.indexOf('rel="next"') > -1)[0];
if (!nextLink) {
return null;
}
return nextLink.split(';')[0].slice(1, -1);
} | javascript | function getNextPageUrl(response) {
const link = response.headers.get('link');
if (!link) {
return null;
}
const nextLink = link.split(',').filter(s => s.indexOf('rel="next"') > -1)[0];
if (!nextLink) {
return null;
}
return nextLink.split(';')[0].slice(1, -1);
} | [
"function",
"getNextPageUrl",
"(",
"response",
")",
"{",
"const",
"link",
"=",
"response",
".",
"headers",
".",
"get",
"(",
"'link'",
")",
";",
"if",
"(",
"!",
"link",
")",
"{",
"return",
"null",
";",
"}",
"const",
"nextLink",
"=",
"link",
".",
"spli... | Extracts the next page URL from Github API response. | [
"Extracts",
"the",
"next",
"page",
"URL",
"from",
"Github",
"API",
"response",
"."
] | 94a6f3c5900604a3e241b7e76338f1af584647bb | https://github.com/ForbesLindesay/redux-wait/blob/94a6f3c5900604a3e241b7e76338f1af584647bb/example/middleware/api.js#L10-L22 | train |
hhromic/e131-node | lib/e131/packet.js | Packet | function Packet(arg) {
if (this instanceof Packet === false) {
return new Packet(arg);
}
if (arg === undefined) {
throw new TypeError('arg should be a Buffer object or a number of slots');
}
if (Buffer.isBuffer(arg)) { // initialize from a buffer
if (arg.length < 126) {
throw new RangeErro... | javascript | function Packet(arg) {
if (this instanceof Packet === false) {
return new Packet(arg);
}
if (arg === undefined) {
throw new TypeError('arg should be a Buffer object or a number of slots');
}
if (Buffer.isBuffer(arg)) { // initialize from a buffer
if (arg.length < 126) {
throw new RangeErro... | [
"function",
"Packet",
"(",
"arg",
")",
"{",
"if",
"(",
"this",
"instanceof",
"Packet",
"===",
"false",
")",
"{",
"return",
"new",
"Packet",
"(",
"arg",
")",
";",
"}",
"if",
"(",
"arg",
"===",
"undefined",
")",
"{",
"throw",
"new",
"TypeError",
"(",
... | packet object constructor | [
"packet",
"object",
"constructor"
] | 3a33b9219d917f46c52d1cb02bf36447f5fa6172 | https://github.com/hhromic/e131-node/blob/3a33b9219d917f46c52d1cb02bf36447f5fa6172/lib/e131/packet.js#L28-L57 | train |
popomore/social-share | share.js | getData | function getData(obj) {
var data = {};
each(supportParam, function(i, o) {
var a = obj.getAttribute('data-' + o);
if (a) data[o] = a;
});
return data;
} | javascript | function getData(obj) {
var data = {};
each(supportParam, function(i, o) {
var a = obj.getAttribute('data-' + o);
if (a) data[o] = a;
});
return data;
} | [
"function",
"getData",
"(",
"obj",
")",
"{",
"var",
"data",
"=",
"{",
"}",
";",
"each",
"(",
"supportParam",
",",
"function",
"(",
"i",
",",
"o",
")",
"{",
"var",
"a",
"=",
"obj",
".",
"getAttribute",
"(",
"'data-'",
"+",
"o",
")",
";",
"if",
"... | Get DATA-API | [
"Get",
"DATA",
"-",
"API"
] | 515fea3cce780ff78f8e9d052908d4705e0172fd | https://github.com/popomore/social-share/blob/515fea3cce780ff78f8e9d052908d4705e0172fd/share.js#L54-L61 | train |
hhromic/e131-node | lib/server.js | Server | function Server(universes, port) {
if (this instanceof Server === false) {
return new Server(port);
}
EventEmitter.call(this);
if (universes !== undefined && !Array.isArray(universes)) {
universes = [universes];
}
this.universes = universes || [0x01];
this.port = port || e131.DEFAULT_PORT;
this... | javascript | function Server(universes, port) {
if (this instanceof Server === false) {
return new Server(port);
}
EventEmitter.call(this);
if (universes !== undefined && !Array.isArray(universes)) {
universes = [universes];
}
this.universes = universes || [0x01];
this.port = port || e131.DEFAULT_PORT;
this... | [
"function",
"Server",
"(",
"universes",
",",
"port",
")",
"{",
"if",
"(",
"this",
"instanceof",
"Server",
"===",
"false",
")",
"{",
"return",
"new",
"Server",
"(",
"port",
")",
";",
"}",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"if",
"(",
... | E1.31 server object constructor | [
"E1",
".",
"31",
"server",
"object",
"constructor"
] | 3a33b9219d917f46c52d1cb02bf36447f5fa6172 | https://github.com/hhromic/e131-node/blob/3a33b9219d917f46c52d1cb02bf36447f5fa6172/lib/server.js#L29-L76 | train |
TooTallNate/array-index | index.js | ArrayIndex | function ArrayIndex (_length) {
Object.defineProperty(this, 'length', {
get: getLength,
set: setLength,
enumerable: false,
configurable: true
});
this[length] = 0;
if (arguments.length > 0) {
setLength.call(this, _length);
}
} | javascript | function ArrayIndex (_length) {
Object.defineProperty(this, 'length', {
get: getLength,
set: setLength,
enumerable: false,
configurable: true
});
this[length] = 0;
if (arguments.length > 0) {
setLength.call(this, _length);
}
} | [
"function",
"ArrayIndex",
"(",
"_length",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"this",
",",
"'length'",
",",
"{",
"get",
":",
"getLength",
",",
"set",
":",
"setLength",
",",
"enumerable",
":",
"false",
",",
"configurable",
":",
"true",
"}",
")... | Subclass this. | [
"Subclass",
"this",
"."
] | 4b3cc059c70eefd8ef2a0d4213d681b671eb3d11 | https://github.com/TooTallNate/array-index/blob/4b3cc059c70eefd8ef2a0d4213d681b671eb3d11/index.js#L32-L45 | train |
TooTallNate/array-index | index.js | setup | function setup (index) {
function get () {
return this[ArrayIndex.get](index);
}
function set (v) {
return this[ArrayIndex.set](index, v);
}
return {
enumerable: true,
configurable: true,
get: get,
set: set
};
} | javascript | function setup (index) {
function get () {
return this[ArrayIndex.get](index);
}
function set (v) {
return this[ArrayIndex.set](index, v);
}
return {
enumerable: true,
configurable: true,
get: get,
set: set
};
} | [
"function",
"setup",
"(",
"index",
")",
"{",
"function",
"get",
"(",
")",
"{",
"return",
"this",
"[",
"ArrayIndex",
".",
"get",
"]",
"(",
"index",
")",
";",
"}",
"function",
"set",
"(",
"v",
")",
"{",
"return",
"this",
"[",
"ArrayIndex",
".",
"set"... | Returns a property descriptor for the given "index", with "get" and "set"
functions created within the closure.
@api private | [
"Returns",
"a",
"property",
"descriptor",
"for",
"the",
"given",
"index",
"with",
"get",
"and",
"set",
"functions",
"created",
"within",
"the",
"closure",
"."
] | 4b3cc059c70eefd8ef2a0d4213d681b671eb3d11 | https://github.com/TooTallNate/array-index/blob/4b3cc059c70eefd8ef2a0d4213d681b671eb3d11/index.js#L169-L182 | train |
azu/searchive | packages/searchive-app/static/pdfjs/web/l10n.js | loadLocale | function loadLocale(lang, callback) {
// RFC 4646, section 2.1 states that language tags have to be treated as
// case-insensitive. Convert to lowercase for case-insensitive comparisons.
if (lang) {
lang = lang.toLowerCase();
}
callback = callback || function _callba... | javascript | function loadLocale(lang, callback) {
// RFC 4646, section 2.1 states that language tags have to be treated as
// case-insensitive. Convert to lowercase for case-insensitive comparisons.
if (lang) {
lang = lang.toLowerCase();
}
callback = callback || function _callba... | [
"function",
"loadLocale",
"(",
"lang",
",",
"callback",
")",
"{",
"// RFC 4646, section 2.1 states that language tags have to be treated as",
"// case-insensitive. Convert to lowercase for case-insensitive comparisons.",
"if",
"(",
"lang",
")",
"{",
"lang",
"=",
"lang",
".",
"t... | load and parse all resources for the specified locale | [
"load",
"and",
"parse",
"all",
"resources",
"for",
"the",
"specified",
"locale"
] | f541f962ba0ce621455285e6b46d0eb1031e61f8 | https://github.com/azu/searchive/blob/f541f962ba0ce621455285e6b46d0eb1031e61f8/packages/searchive-app/static/pdfjs/web/l10n.js#L297-L374 | train |
azu/searchive | packages/searchive-app/static/pdfjs/web/l10n.js | L10nResourceLink | function L10nResourceLink(link) {
var href = link.href;
// Note: If |gAsyncResourceLoading| is false, then the following callbacks
// are synchronously called.
this.load = function(lang, callback) {
parseResource(href, lang, callback, function() {
... | javascript | function L10nResourceLink(link) {
var href = link.href;
// Note: If |gAsyncResourceLoading| is false, then the following callbacks
// are synchronously called.
this.load = function(lang, callback) {
parseResource(href, lang, callback, function() {
... | [
"function",
"L10nResourceLink",
"(",
"link",
")",
"{",
"var",
"href",
"=",
"link",
".",
"href",
";",
"// Note: If |gAsyncResourceLoading| is false, then the following callbacks",
"// are synchronously called.",
"this",
".",
"load",
"=",
"function",
"(",
"lang",
",",
"ca... | load all resource files | [
"load",
"all",
"resource",
"files"
] | f541f962ba0ce621455285e6b46d0eb1031e61f8 | https://github.com/azu/searchive/blob/f541f962ba0ce621455285e6b46d0eb1031e61f8/packages/searchive-app/static/pdfjs/web/l10n.js#L354-L368 | train |
azu/searchive | packages/searchive-app/static/pdfjs/web/l10n.js | getL10nData | function getL10nData(key, args, fallback) {
var data = gL10nData[key];
if (!data) {
console.warn("#" + key + " is undefined.");
if (!fallback) {
return null;
}
data = fallback;
}
/** This is where l10n expressions should be... | javascript | function getL10nData(key, args, fallback) {
var data = gL10nData[key];
if (!data) {
console.warn("#" + key + " is undefined.");
if (!fallback) {
return null;
}
data = fallback;
}
/** This is where l10n expressions should be... | [
"function",
"getL10nData",
"(",
"key",
",",
"args",
",",
"fallback",
")",
"{",
"var",
"data",
"=",
"gL10nData",
"[",
"key",
"]",
";",
"if",
"(",
"!",
"data",
")",
"{",
"console",
".",
"warn",
"(",
"\"#\"",
"+",
"key",
"+",
"\" is undefined.\"",
")",
... | l10n dictionary functions
fetch an l10n object, warn if not found, apply `args' if possible | [
"l10n",
"dictionary",
"functions",
"fetch",
"an",
"l10n",
"object",
"warn",
"if",
"not",
"found",
"apply",
"args",
"if",
"possible"
] | f541f962ba0ce621455285e6b46d0eb1031e61f8 | https://github.com/azu/searchive/blob/f541f962ba0ce621455285e6b46d0eb1031e61f8/packages/searchive-app/static/pdfjs/web/l10n.js#L772-L795 | train |
azu/searchive | packages/searchive-app/static/pdfjs/web/l10n.js | function(key, args, fallbackString) {
var index = key.lastIndexOf(".");
var prop = gTextProp;
if (index > 0) {
// An attribute has been specified
prop = key.substr(index + 1);
key = key.substring(0, index);
}
var... | javascript | function(key, args, fallbackString) {
var index = key.lastIndexOf(".");
var prop = gTextProp;
if (index > 0) {
// An attribute has been specified
prop = key.substr(index + 1);
key = key.substring(0, index);
}
var... | [
"function",
"(",
"key",
",",
"args",
",",
"fallbackString",
")",
"{",
"var",
"index",
"=",
"key",
".",
"lastIndexOf",
"(",
"\".\"",
")",
";",
"var",
"prop",
"=",
"gTextProp",
";",
"if",
"(",
"index",
">",
"0",
")",
"{",
"// An attribute has been specifie... | get a localized string | [
"get",
"a",
"localized",
"string"
] | f541f962ba0ce621455285e6b46d0eb1031e61f8 | https://github.com/azu/searchive/blob/f541f962ba0ce621455285e6b46d0eb1031e61f8/packages/searchive-app/static/pdfjs/web/l10n.js#L916-L934 | train | |
sokeroner/Delaunay-Triangulation | src/geom/Triangle.js | Triangle | function Triangle ( point1, point2, point3 )
{
/**
* @member {Point}
* @default {x:0,y:0}
*/
this.p1 = point1 || new Point(0,0);
/**
* @member {Point}
* @default {x:0,y:0}
*/
this.p2 = point2 || new Point(0,0);
/**
* @member {Point}
* @default {x:0,y:0}
... | javascript | function Triangle ( point1, point2, point3 )
{
/**
* @member {Point}
* @default {x:0,y:0}
*/
this.p1 = point1 || new Point(0,0);
/**
* @member {Point}
* @default {x:0,y:0}
*/
this.p2 = point2 || new Point(0,0);
/**
* @member {Point}
* @default {x:0,y:0}
... | [
"function",
"Triangle",
"(",
"point1",
",",
"point2",
",",
"point3",
")",
"{",
"/**\n * @member {Point}\n * @default {x:0,y:0}\n */",
"this",
".",
"p1",
"=",
"point1",
"||",
"new",
"Point",
"(",
"0",
",",
"0",
")",
";",
"/**\n * @member {Point}\n ... | The Triangle object represents a set of three points.
@class
@param [point1={x:0,y:0}] {Point} one of the three points
@param [point2={x:0,y:0}] {Point} one of the three points
@param [point3={x:0,y:0}] {Point} one of the three points | [
"The",
"Triangle",
"object",
"represents",
"a",
"set",
"of",
"three",
"points",
"."
] | b5bbbe66964ed7fcf72a7a6d26d88a41d68309ae | https://github.com/sokeroner/Delaunay-Triangulation/blob/b5bbbe66964ed7fcf72a7a6d26d88a41d68309ae/src/geom/Triangle.js#L13-L54 | train |
sean-perkins/ngx-select | examples/webpack/dist/app.e100c23eefa4ef71b346.js | _buildFromEncodedParts | function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
var /** @type {?} */ out = [];
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__facade_lang__["c" /* isPresent */])(opt_scheme)) {
out.push(opt_scheme + ':');
}
if (__we... | javascript | function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
var /** @type {?} */ out = [];
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__facade_lang__["c" /* isPresent */])(opt_scheme)) {
out.push(opt_scheme + ':');
}
if (__we... | [
"function",
"_buildFromEncodedParts",
"(",
"opt_scheme",
",",
"opt_userInfo",
",",
"opt_domain",
",",
"opt_port",
",",
"opt_path",
",",
"opt_queryData",
",",
"opt_fragment",
")",
"{",
"var",
"/** @type {?} */",
"out",
"=",
"[",
"]",
";",
"if",
"(",
"__webpack_re... | Builds a URI string from already-encoded parts.
No encoding is performed. Any component may be omitted as either null or
undefined.
@param {?=} opt_scheme The scheme such as 'http'.
@param {?=} opt_userInfo The user name before the '\@'.
@param {?=} opt_domain The domain such as 'www.google.com', already
URI-encoded... | [
"Builds",
"a",
"URI",
"string",
"from",
"already",
"-",
"encoded",
"parts",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/app.e100c23eefa4ef71b346.js#L10605-L10630 | train |
sean-perkins/ngx-select | examples/webpack/dist/app.e100c23eefa4ef71b346.js | _resolveUrl | function _resolveUrl(base, url) {
var /** @type {?} */ parts = _split(encodeURI(url));
var /** @type {?} */ baseParts = _split(base);
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__facade_lang__["c" /* isPresent */])(parts[_ComponentIndex.Scheme])) {
return _joinAndCanonicalizePath(parts);
... | javascript | function _resolveUrl(base, url) {
var /** @type {?} */ parts = _split(encodeURI(url));
var /** @type {?} */ baseParts = _split(base);
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__facade_lang__["c" /* isPresent */])(parts[_ComponentIndex.Scheme])) {
return _joinAndCanonicalizePath(parts);
... | [
"function",
"_resolveUrl",
"(",
"base",
",",
"url",
")",
"{",
"var",
"/** @type {?} */",
"parts",
"=",
"_split",
"(",
"encodeURI",
"(",
"url",
")",
")",
";",
"var",
"/** @type {?} */",
"baseParts",
"=",
"_split",
"(",
"base",
")",
";",
"if",
"(",
"__webp... | Resolves a URL.
@param {?} base The URL acting as the base URL.
@param {?} url
@return {?} | [
"Resolves",
"a",
"URL",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/app.e100c23eefa4ef71b346.js#L10803-L10827 | train |
sean-perkins/ngx-select | examples/webpack/dist/app.e100c23eefa4ef71b346.js | convertPropertyBinding | function convertPropertyBinding(builder, nameResolver, implicitReceiver, expression, bindingId) {
var /** @type {?} */ currValExpr = createCurrValueExpr(bindingId);
var /** @type {?} */ stmts = [];
if (!nameResolver) {
nameResolver = new DefaultNameResolver();
}
var /** @type {?} */ visitor ... | javascript | function convertPropertyBinding(builder, nameResolver, implicitReceiver, expression, bindingId) {
var /** @type {?} */ currValExpr = createCurrValueExpr(bindingId);
var /** @type {?} */ stmts = [];
if (!nameResolver) {
nameResolver = new DefaultNameResolver();
}
var /** @type {?} */ visitor ... | [
"function",
"convertPropertyBinding",
"(",
"builder",
",",
"nameResolver",
",",
"implicitReceiver",
",",
"expression",
",",
"bindingId",
")",
"{",
"var",
"/** @type {?} */",
"currValExpr",
"=",
"createCurrValueExpr",
"(",
"bindingId",
")",
";",
"var",
"/** @type {?} *... | Converts the given expression AST into an executable output AST, assuming the expression is
used in a property binding.
@param {?} builder
@param {?} nameResolver
@param {?} implicitReceiver
@param {?} expression
@param {?} bindingId
@return {?} | [
"Converts",
"the",
"given",
"expression",
"AST",
"into",
"an",
"executable",
"output",
"AST",
"assuming",
"the",
"expression",
"is",
"used",
"in",
"a",
"property",
"binding",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/app.e100c23eefa4ef71b346.js#L15187-L15215 | train |
sean-perkins/ngx-select | examples/webpack/dist/app.e100c23eefa4ef71b346.js | function (prototype) {
// if the prototype is ZoneAwareError.prototype
// we just return the prebuilt errorProperties.
if (prototype === ZoneAwareError.prototype) {
return errorProperties;
}
var newProps = Object.create(null);
var cKeys = Object.getOwnProperty... | javascript | function (prototype) {
// if the prototype is ZoneAwareError.prototype
// we just return the prebuilt errorProperties.
if (prototype === ZoneAwareError.prototype) {
return errorProperties;
}
var newProps = Object.create(null);
var cKeys = Object.getOwnProperty... | [
"function",
"(",
"prototype",
")",
"{",
"// if the prototype is ZoneAwareError.prototype",
"// we just return the prebuilt errorProperties.",
"if",
"(",
"prototype",
"===",
"ZoneAwareError",
".",
"prototype",
")",
"{",
"return",
"errorProperties",
";",
"}",
"var",
"newProps... | for derived Error class which extends ZoneAwareError we should not override the derived class's property so we create a new props object only copy the properties from errorProperties which not exist in derived Error's prototype | [
"for",
"derived",
"Error",
"class",
"which",
"extends",
"ZoneAwareError",
"we",
"should",
"not",
"override",
"the",
"derived",
"class",
"s",
"property",
"so",
"we",
"create",
"a",
"new",
"props",
"object",
"only",
"copy",
"the",
"properties",
"from",
"errorPro... | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/app.e100c23eefa4ef71b346.js#L61441-L61459 | train | |
sean-perkins/ngx-select | examples/webpack/dist/app.e100c23eefa4ef71b346.js | ZoneAwareError | function ZoneAwareError() {
// make sure we have a valid this
// if this is undefined(call Error without new) or this is global
// or this is some other objects, we should force to create a
// valid ZoneAwareError by call Object.create()
if (!(this instanceof ZoneAwareError)) {
... | javascript | function ZoneAwareError() {
// make sure we have a valid this
// if this is undefined(call Error without new) or this is global
// or this is some other objects, we should force to create a
// valid ZoneAwareError by call Object.create()
if (!(this instanceof ZoneAwareError)) {
... | [
"function",
"ZoneAwareError",
"(",
")",
"{",
"// make sure we have a valid this",
"// if this is undefined(call Error without new) or this is global",
"// or this is some other objects, we should force to create a",
"// valid ZoneAwareError by call Object.create()",
"if",
"(",
"!",
"(",
"t... | This is ZoneAwareError which processes the stack frame and cleans up extra frames as well as
adds zone information to it. | [
"This",
"is",
"ZoneAwareError",
"which",
"processes",
"the",
"stack",
"frame",
"and",
"cleans",
"up",
"extra",
"frames",
"as",
"well",
"as",
"adds",
"zone",
"information",
"to",
"it",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/app.e100c23eefa4ef71b346.js#L61464-L61515 | train |
sean-perkins/ngx-select | examples/webpack/dist/app.e100c23eefa4ef71b346.js | createI18nMessageFactory | function createI18nMessageFactory(interpolationConfig) {
var /** @type {?} */ visitor = new _I18nVisitor(_expParser, interpolationConfig);
return function (nodes, meaning, description) {
return visitor.toI18nMessage(nodes, meaning, description);
};
} | javascript | function createI18nMessageFactory(interpolationConfig) {
var /** @type {?} */ visitor = new _I18nVisitor(_expParser, interpolationConfig);
return function (nodes, meaning, description) {
return visitor.toI18nMessage(nodes, meaning, description);
};
} | [
"function",
"createI18nMessageFactory",
"(",
"interpolationConfig",
")",
"{",
"var",
"/** @type {?} */",
"visitor",
"=",
"new",
"_I18nVisitor",
"(",
"_expParser",
",",
"interpolationConfig",
")",
";",
"return",
"function",
"(",
"nodes",
",",
"meaning",
",",
"descrip... | Returns a function converting html nodes to an i18n Message given an interpolationConfig
@param {?} interpolationConfig
@return {?} | [
"Returns",
"a",
"function",
"converting",
"html",
"nodes",
"to",
"an",
"i18n",
"Message",
"given",
"an",
"interpolationConfig"
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/app.e100c23eefa4ef71b346.js#L66303-L66308 | train |
sean-perkins/ngx-select | examples/webpack/dist/app.e100c23eefa4ef71b346.js | _getOuterContainerOrSelf | function _getOuterContainerOrSelf(node) {
var /** @type {?} */ view = node.view;
while (_isNgContainer(node.parent, view)) {
node = node.parent;
}
return node;
} | javascript | function _getOuterContainerOrSelf(node) {
var /** @type {?} */ view = node.view;
while (_isNgContainer(node.parent, view)) {
node = node.parent;
}
return node;
} | [
"function",
"_getOuterContainerOrSelf",
"(",
"node",
")",
"{",
"var",
"/** @type {?} */",
"view",
"=",
"node",
".",
"view",
";",
"while",
"(",
"_isNgContainer",
"(",
"node",
".",
"parent",
",",
"view",
")",
")",
"{",
"node",
"=",
"node",
".",
"parent",
"... | Walks up the nodes while the direct parent is a container.
Returns the outer container or the node itself when it is not a direct child of a container.
\@internal
@param {?} node
@return {?} | [
"Walks",
"up",
"the",
"nodes",
"while",
"the",
"direct",
"parent",
"is",
"a",
"container",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/app.e100c23eefa4ef71b346.js#L71079-L71085 | train |
sean-perkins/ngx-select | examples/webpack/dist/app.e100c23eefa4ef71b346.js | _getOuterContainerParentOrSelf | function _getOuterContainerParentOrSelf(el) {
var /** @type {?} */ view = el.view;
while (_isNgContainer(el, view)) {
el = el.parent;
}
return el;
} | javascript | function _getOuterContainerParentOrSelf(el) {
var /** @type {?} */ view = el.view;
while (_isNgContainer(el, view)) {
el = el.parent;
}
return el;
} | [
"function",
"_getOuterContainerParentOrSelf",
"(",
"el",
")",
"{",
"var",
"/** @type {?} */",
"view",
"=",
"el",
".",
"view",
";",
"while",
"(",
"_isNgContainer",
"(",
"el",
",",
"view",
")",
")",
"{",
"el",
"=",
"el",
".",
"parent",
";",
"}",
"return",
... | Walks up the nodes while they are container and returns the first parent which is not.
Returns the parent of the outer container or the node itself when it is not a container.
\@internal
@param {?} el
@return {?} | [
"Walks",
"up",
"the",
"nodes",
"while",
"they",
"are",
"container",
"and",
"returns",
"the",
"first",
"parent",
"which",
"is",
"not",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/app.e100c23eefa4ef71b346.js#L71095-L71101 | train |
sean-perkins/ngx-select | examples/webpack/dist/app.e100c23eefa4ef71b346.js | function(TYPE){
var IS_MAP = TYPE == 1
, IS_EVERY = TYPE == 4;
return function(object, callbackfn, that /* = undefined */){
var f = ctx(callbackfn, that, 3)
, O = toIObject(object)
, result = IS_MAP || TYPE == 7 || TYPE == 2
? new (typeof this == 'function' ? this : Dict) :... | javascript | function(TYPE){
var IS_MAP = TYPE == 1
, IS_EVERY = TYPE == 4;
return function(object, callbackfn, that /* = undefined */){
var f = ctx(callbackfn, that, 3)
, O = toIObject(object)
, result = IS_MAP || TYPE == 7 || TYPE == 2
? new (typeof this == 'function' ? this : Dict) :... | [
"function",
"(",
"TYPE",
")",
"{",
"var",
"IS_MAP",
"=",
"TYPE",
"==",
"1",
",",
"IS_EVERY",
"=",
"TYPE",
"==",
"4",
";",
"return",
"function",
"(",
"object",
",",
"callbackfn",
",",
"that",
"/* = undefined */",
")",
"{",
"var",
"f",
"=",
"ctx",
"(",... | 0 -> Dict.forEach 1 -> Dict.map 2 -> Dict.filter 3 -> Dict.some 4 -> Dict.every 5 -> Dict.find 6 -> Dict.findKey 7 -> Dict.mapPairs | [
"0",
"-",
">",
"Dict",
".",
"forEach",
"1",
"-",
">",
"Dict",
".",
"map",
"2",
"-",
">",
"Dict",
".",
"filter",
"3",
"-",
">",
"Dict",
".",
"some",
"4",
"-",
">",
"Dict",
".",
"every",
"5",
"-",
">",
"Dict",
".",
"find",
"6",
"-",
">",
"D... | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/app.e100c23eefa4ef71b346.js#L79032-L79057 | train | |
mvo5/sha512crypt-node | sha512crypt.js | _sha512crypt_intermediate | function _sha512crypt_intermediate(password, salt) {
var digest_a = rstr_sha512(password + salt);
var digest_b = rstr_sha512(password + salt + password);
var key_len = password.length;
// extend digest b so that it has the same size as password
var digest_b_extended = _extend(digest_b, password.len... | javascript | function _sha512crypt_intermediate(password, salt) {
var digest_a = rstr_sha512(password + salt);
var digest_b = rstr_sha512(password + salt + password);
var key_len = password.length;
// extend digest b so that it has the same size as password
var digest_b_extended = _extend(digest_b, password.len... | [
"function",
"_sha512crypt_intermediate",
"(",
"password",
",",
"salt",
")",
"{",
"var",
"digest_a",
"=",
"rstr_sha512",
"(",
"password",
"+",
"salt",
")",
";",
"var",
"digest_b",
"=",
"rstr_sha512",
"(",
"password",
"+",
"salt",
"+",
"password",
")",
";",
... | steps 1-12 | [
"steps",
"1",
"-",
"12"
] | 169e901a484870eca6dbed5caee9411a1acde263 | https://github.com/mvo5/sha512crypt-node/blob/169e901a484870eca6dbed5caee9411a1acde263/sha512crypt.js#L55-L73 | train |
alexindigo/fbbot | lib/middleware.js | use | function use(events, middleware)
{
// if no middleware supplied assume it's single argument call
if (!middleware)
{
middleware = events;
events = null;
}
// make it uniform
events = normalizeEvents(events);
// store middleware per event
events.forEach(function(e)
{
// bind middleware... | javascript | function use(events, middleware)
{
// if no middleware supplied assume it's single argument call
if (!middleware)
{
middleware = events;
events = null;
}
// make it uniform
events = normalizeEvents(events);
// store middleware per event
events.forEach(function(e)
{
// bind middleware... | [
"function",
"use",
"(",
"events",
",",
"middleware",
")",
"{",
"// if no middleware supplied assume it's single argument call",
"if",
"(",
"!",
"middleware",
")",
"{",
"middleware",
"=",
"events",
";",
"events",
"=",
"null",
";",
"}",
"// make it uniform",
"events",... | Adds provided middleware to the stack,
with optional list of events
@this Fbbot#
@param {string|array} [events] - list of events to associate middleware with
@param {function} middleware - request/event handler | [
"Adds",
"provided",
"middleware",
"to",
"the",
"stack",
"with",
"optional",
"list",
"of",
"events"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/middleware.js#L22-L43 | train |
alexindigo/fbbot | lib/middleware.js | run | function run(events, payload, callback)
{
// if no callback supplied assume it's two arguments call
if (!callback)
{
callback = payload;
payload = events;
events = null;
}
// make it uniform
events = normalizeEvents(events);
// apply events/middleware asynchronously and sequentially
pip... | javascript | function run(events, payload, callback)
{
// if no callback supplied assume it's two arguments call
if (!callback)
{
callback = payload;
payload = events;
events = null;
}
// make it uniform
events = normalizeEvents(events);
// apply events/middleware asynchronously and sequentially
pip... | [
"function",
"run",
"(",
"events",
",",
"payload",
",",
"callback",
")",
"{",
"// if no callback supplied assume it's two arguments call",
"if",
"(",
"!",
"callback",
")",
"{",
"callback",
"=",
"payload",
";",
"payload",
"=",
"events",
";",
"events",
"=",
"null",... | Runs middleware in the stack for the provided events with passed payload
@this Fbbot#
@param {string|array} [events] - list of events to determine middleware set to iterate over
@param {object} payload - event payload to pass along to middleware
@param {function} callback - invoked after (if) all middleware been proc... | [
"Runs",
"middleware",
"in",
"the",
"stack",
"for",
"the",
"provided",
"events",
"with",
"passed",
"payload"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/middleware.js#L53-L78 | train |
alexindigo/fbbot | lib/middleware.js | normalizeEvents | function normalizeEvents(events)
{
// start with converting falsy events into catch-all placeholder
events = events || entryPoint;
if (!Array.isArray(events))
{
events = [events];
}
// return shallow copy
return events.concat();
} | javascript | function normalizeEvents(events)
{
// start with converting falsy events into catch-all placeholder
events = events || entryPoint;
if (!Array.isArray(events))
{
events = [events];
}
// return shallow copy
return events.concat();
} | [
"function",
"normalizeEvents",
"(",
"events",
")",
"{",
"// start with converting falsy events into catch-all placeholder",
"events",
"=",
"events",
"||",
"entryPoint",
";",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"events",
")",
")",
"{",
"events",
"=",
"[",... | Normalizes provided events
to keep `add` and `apply` on the same page
@private
@param {null|string|array} events - events to normalize
@returns {array} - normalized list of events | [
"Normalizes",
"provided",
"events",
"to",
"keep",
"add",
"and",
"apply",
"on",
"the",
"same",
"page"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/middleware.js#L106-L118 | train |
alexindigo/fbbot | lib/send.js | generateMessage | function generateMessage(type, data)
{
var message;
switch (type)
{
// default message type, no need to perform special actions, will be sent as is
case types.MESSAGE:
message = data;
break;
case types.TEXT:
// `text` must be UTF-8 and has a 320 character limit
// https://dev... | javascript | function generateMessage(type, data)
{
var message;
switch (type)
{
// default message type, no need to perform special actions, will be sent as is
case types.MESSAGE:
message = data;
break;
case types.TEXT:
// `text` must be UTF-8 and has a 320 character limit
// https://dev... | [
"function",
"generateMessage",
"(",
"type",
",",
"data",
")",
"{",
"var",
"message",
";",
"switch",
"(",
"type",
")",
"{",
"// default message type, no need to perform special actions, will be sent as is",
"case",
"types",
".",
"MESSAGE",
":",
"message",
"=",
"data",
... | Generates message from the provided data object
with respect for the message type
@private
@this Fbbot#
@param {string} type - message type
@param {object} data - message data object
@returns {object} - generated message object | [
"Generates",
"message",
"from",
"the",
"provided",
"data",
"object",
"with",
"respect",
"for",
"the",
"message",
"type"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/send.js#L165-L212 | train |
alexindigo/fbbot | lib/request.js | request | function request(url, options, callback)
{
var connection;
if (typeof options == 'function')
{
callback = options;
options = {};
}
connection = hyperquest(url, options, once(function(error, response)
{
if (error)
{
callback(error, response);
return;
}
// set body
... | javascript | function request(url, options, callback)
{
var connection;
if (typeof options == 'function')
{
callback = options;
options = {};
}
connection = hyperquest(url, options, once(function(error, response)
{
if (error)
{
callback(error, response);
return;
}
// set body
... | [
"function",
"request",
"(",
"url",
",",
"options",
",",
"callback",
")",
"{",
"var",
"connection",
";",
"if",
"(",
"typeof",
"options",
"==",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"connection",
"="... | Wraps hyperquest to provide extra convenience
with handling responses
@param {string} url - url to request
@param {object} [options] - request options
@param {function} callback - invoked on response
@returns {stream.Duplex} - request stream | [
"Wraps",
"hyperquest",
"to",
"provide",
"extra",
"convenience",
"with",
"handling",
"responses"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/request.js#L19-L53 | train |
alexindigo/fbbot | lib/request.js | parseJson | function parseJson(payload)
{
var data;
try
{
data = JSON.parse(payload);
}
catch (e)
{
this.logger.error({message: 'Unable to parse provided JSON', error: e, payload: payload});
}
return data;
} | javascript | function parseJson(payload)
{
var data;
try
{
data = JSON.parse(payload);
}
catch (e)
{
this.logger.error({message: 'Unable to parse provided JSON', error: e, payload: payload});
}
return data;
} | [
"function",
"parseJson",
"(",
"payload",
")",
"{",
"var",
"data",
";",
"try",
"{",
"data",
"=",
"JSON",
".",
"parse",
"(",
"payload",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"this",
".",
"logger",
".",
"error",
"(",
"{",
"message",
":",
"'Una... | Parses provided JSON payload into object
@private
@this Fbbot#
@param {string} payload - JSON string to parse
@returns {object|undefined} - parsed object or `undefined` if unable to parse | [
"Parses",
"provided",
"JSON",
"payload",
"into",
"object"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/request.js#L123-L137 | train |
alexindigo/fbbot | incoming/user_init.js | userInit | function userInit(payload, callback)
{
var type = messaging.getType(payload);
if (payload.sender && payload[type])
{
// detach new object from the source
payload[type].user = clone(payload.sender);
// add user tailored send functions
// but keep it outside of own properties
payload[type].use... | javascript | function userInit(payload, callback)
{
var type = messaging.getType(payload);
if (payload.sender && payload[type])
{
// detach new object from the source
payload[type].user = clone(payload.sender);
// add user tailored send functions
// but keep it outside of own properties
payload[type].use... | [
"function",
"userInit",
"(",
"payload",
",",
"callback",
")",
"{",
"var",
"type",
"=",
"messaging",
".",
"getType",
"(",
"payload",
")",
";",
"if",
"(",
"payload",
".",
"sender",
"&&",
"payload",
"[",
"type",
"]",
")",
"{",
"// detach new object from the s... | Creates `user` object within `message`,
based on `sender` property.
@this Fbbot#
@param {object} payload - messaging envelop object
@param {function} callback - invoked after type casting is done | [
"Creates",
"user",
"object",
"within",
"message",
"based",
"on",
"sender",
"property",
"."
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/incoming/user_init.js#L16-L31 | train |
alexindigo/fbbot | outgoing/quick_reply.js | quickReply | function quickReply(payload, callback)
{
if (typeof payload.payload != 'string')
{
payload.payload = JSON.stringify(payload.payload);
}
callback(null, payload);
} | javascript | function quickReply(payload, callback)
{
if (typeof payload.payload != 'string')
{
payload.payload = JSON.stringify(payload.payload);
}
callback(null, payload);
} | [
"function",
"quickReply",
"(",
"payload",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"payload",
".",
"payload",
"!=",
"'string'",
")",
"{",
"payload",
".",
"payload",
"=",
"JSON",
".",
"stringify",
"(",
"payload",
".",
"payload",
")",
";",
"}",
"c... | Stringifies provided quick reply payload
@this Fbbot#
@param {object} payload - quick_reply object
@param {function} callback - invoked after stringification is done | [
"Stringifies",
"provided",
"quick",
"reply",
"payload"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/outgoing/quick_reply.js#L10-L18 | train |
insin/redux-action-utils | lib/index.js | actionCreator | function actionCreator(type) {
var props = Array.isArray(arguments[1]) ? arguments[1] : slice.call(arguments, 1)
return function() {
if (!props.length) {
return {type: type}
}
var args = slice.call(arguments)
return props.reduce(function(action, prop, index) {
return (action[prop] = args... | javascript | function actionCreator(type) {
var props = Array.isArray(arguments[1]) ? arguments[1] : slice.call(arguments, 1)
return function() {
if (!props.length) {
return {type: type}
}
var args = slice.call(arguments)
return props.reduce(function(action, prop, index) {
return (action[prop] = args... | [
"function",
"actionCreator",
"(",
"type",
")",
"{",
"var",
"props",
"=",
"Array",
".",
"isArray",
"(",
"arguments",
"[",
"1",
"]",
")",
"?",
"arguments",
"[",
"1",
"]",
":",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
"return",
"function",... | Creates an action creator for the given action type, which optionally adds
positional arguments given to it to the action object using specified
property names.
Property names can be specified as an Array of strings or as any number of
addiitonal String arguments; arguments passed to the action creator will
be assigne... | [
"Creates",
"an",
"action",
"creator",
"for",
"the",
"given",
"action",
"type",
"which",
"optionally",
"adds",
"positional",
"arguments",
"given",
"to",
"it",
"to",
"the",
"action",
"object",
"using",
"specified",
"property",
"names",
"."
] | 10a0464815751355fb9d43281cf5e41a9a65d1ae | https://github.com/insin/redux-action-utils/blob/10a0464815751355fb9d43281cf5e41a9a65d1ae/lib/index.js#L14-L25 | train |
insin/redux-action-utils | lib/index.js | optionsActionCreator | function optionsActionCreator(type) {
var props = Array.isArray(arguments[1]) ? arguments[1] : slice.call(arguments, 1)
return function(options) {
var copyProps = props.length === 0 ? Object.keys(options) : props
return copyProps.reduce(function(action, prop) {
return (action[prop] = options[prop], ac... | javascript | function optionsActionCreator(type) {
var props = Array.isArray(arguments[1]) ? arguments[1] : slice.call(arguments, 1)
return function(options) {
var copyProps = props.length === 0 ? Object.keys(options) : props
return copyProps.reduce(function(action, prop) {
return (action[prop] = options[prop], ac... | [
"function",
"optionsActionCreator",
"(",
"type",
")",
"{",
"var",
"props",
"=",
"Array",
".",
"isArray",
"(",
"arguments",
"[",
"1",
"]",
")",
"?",
"arguments",
"[",
"1",
"]",
":",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
"return",
"fun... | Creates an action creator for the given action type which also takes an
options object argument, which will either have all of its properties
or only specified properties added to the action object.
Property names can be specified as an Array of strings or as any number of
addiitonal String arguments. | [
"Creates",
"an",
"action",
"creator",
"for",
"the",
"given",
"action",
"type",
"which",
"also",
"takes",
"an",
"options",
"object",
"argument",
"which",
"will",
"either",
"have",
"all",
"of",
"its",
"properties",
"or",
"only",
"specified",
"properties",
"added... | 10a0464815751355fb9d43281cf5e41a9a65d1ae | https://github.com/insin/redux-action-utils/blob/10a0464815751355fb9d43281cf5e41a9a65d1ae/lib/index.js#L35-L43 | train |
alexindigo/fbbot | incoming/type_cast.js | typeCast | function typeCast(payload, callback)
{
var type = find(types, function(t){ return (t in payload); });
if (type)
{
payload.type = normalize(type);
}
callback(null, payload);
} | javascript | function typeCast(payload, callback)
{
var type = find(types, function(t){ return (t in payload); });
if (type)
{
payload.type = normalize(type);
}
callback(null, payload);
} | [
"function",
"typeCast",
"(",
"payload",
",",
"callback",
")",
"{",
"var",
"type",
"=",
"find",
"(",
"types",
",",
"function",
"(",
"t",
")",
"{",
"return",
"(",
"t",
"in",
"payload",
")",
";",
"}",
")",
";",
"if",
"(",
"type",
")",
"{",
"payload"... | Casts message type based on the present fields from the list
@this Fbbot#
@param {object} payload - message object
@param {function} callback - invoked after type casting is done | [
"Casts",
"message",
"type",
"based",
"on",
"the",
"present",
"fields",
"from",
"the",
"list"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/incoming/type_cast.js#L32-L42 | train |
alexindigo/fbbot | outgoing/button_postback.js | buttonPostback | function buttonPostback(payload, callback)
{
if (typeof payload.payload != 'string')
{
payload.payload = JSON.stringify(payload.payload);
}
callback(null, payload);
} | javascript | function buttonPostback(payload, callback)
{
if (typeof payload.payload != 'string')
{
payload.payload = JSON.stringify(payload.payload);
}
callback(null, payload);
} | [
"function",
"buttonPostback",
"(",
"payload",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"payload",
".",
"payload",
"!=",
"'string'",
")",
"{",
"payload",
".",
"payload",
"=",
"JSON",
".",
"stringify",
"(",
"payload",
".",
"payload",
")",
";",
"}",
... | Stringifies provided button.postback payload
@this Fbbot#
@param {object} payload - button.postback object
@param {function} callback - invoked after stringification is done | [
"Stringifies",
"provided",
"button",
".",
"postback",
"payload"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/outgoing/button_postback.js#L10-L18 | train |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function () {
return {
centered: this.centered,
speedFactor: this.speedFactor * (this._globalOptions.baseSpeedFactor || 1),
radius: this.radius,
color: this.color
};
} | javascript | function () {
return {
centered: this.centered,
speedFactor: this.speedFactor * (this._globalOptions.baseSpeedFactor || 1),
radius: this.radius,
color: this.color
};
} | [
"function",
"(",
")",
"{",
"return",
"{",
"centered",
":",
"this",
".",
"centered",
",",
"speedFactor",
":",
"this",
".",
"speedFactor",
"*",
"(",
"this",
".",
"_globalOptions",
".",
"baseSpeedFactor",
"||",
"1",
")",
",",
"radius",
":",
"this",
".",
"... | Ripple configuration from the directive's input values.
@return {?} | [
"Ripple",
"configuration",
"from",
"the",
"directive",
"s",
"input",
"values",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L7506-L7513 | train | |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | isNativeFormElement | function isNativeFormElement(element) {
var /** @type {?} */ nodeName = element.nodeName.toLowerCase();
return nodeName === 'input' ||
nodeName === 'select' ||
nodeName === 'button' ||
nodeName === 'textarea';
} | javascript | function isNativeFormElement(element) {
var /** @type {?} */ nodeName = element.nodeName.toLowerCase();
return nodeName === 'input' ||
nodeName === 'select' ||
nodeName === 'button' ||
nodeName === 'textarea';
} | [
"function",
"isNativeFormElement",
"(",
"element",
")",
"{",
"var",
"/** @type {?} */",
"nodeName",
"=",
"element",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
";",
"return",
"nodeName",
"===",
"'input'",
"||",
"nodeName",
"===",
"'select'",
"||",
"nodeName",... | Gets whether an element's
@param {?} element
@return {?} | [
"Gets",
"whether",
"an",
"element",
"s"
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L10082-L10088 | train |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | hasValidTabIndex | function hasValidTabIndex(element) {
if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) {
return false;
}
var /** @type {?} */ tabIndex = element.getAttribute('tabindex');
// IE11 parses tabindex="" as the value "-32768"
if (tabIndex == '-32768') {
return false;... | javascript | function hasValidTabIndex(element) {
if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) {
return false;
}
var /** @type {?} */ tabIndex = element.getAttribute('tabindex');
// IE11 parses tabindex="" as the value "-32768"
if (tabIndex == '-32768') {
return false;... | [
"function",
"hasValidTabIndex",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"element",
".",
"hasAttribute",
"(",
"'tabindex'",
")",
"||",
"element",
".",
"tabIndex",
"===",
"undefined",
")",
"{",
"return",
"false",
";",
"}",
"var",
"/** @type {?} */",
"tabInde... | Gets whether an element has a valid tabindex.
@param {?} element
@return {?} | [
"Gets",
"whether",
"an",
"element",
"has",
"a",
"valid",
"tabindex",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L10126-L10136 | train |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | getTabIndexValue | function getTabIndexValue(element) {
if (!hasValidTabIndex(element)) {
return null;
}
// See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
var /** @type {?} */ tabIndex = parseInt(element.getAttribute('tabindex'), 10);
return isNaN(tabIndex) ? -1 : tabIndex;
} | javascript | function getTabIndexValue(element) {
if (!hasValidTabIndex(element)) {
return null;
}
// See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
var /** @type {?} */ tabIndex = parseInt(element.getAttribute('tabindex'), 10);
return isNaN(tabIndex) ? -1 : tabIndex;
} | [
"function",
"getTabIndexValue",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"hasValidTabIndex",
"(",
"element",
")",
")",
"{",
"return",
"null",
";",
"}",
"// See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054",
"var",
"/** @type {?} */",
"tabIn... | Returns the parsed tabindex from the element attributes instead of returning the
evaluated tabindex from the browsers defaults.
@param {?} element
@return {?} | [
"Returns",
"the",
"parsed",
"tabindex",
"from",
"the",
"element",
"attributes",
"instead",
"of",
"returning",
"the",
"evaluated",
"tabindex",
"from",
"the",
"browsers",
"defaults",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L10143-L10150 | train |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | isPotentiallyTabbableIOS | function isPotentiallyTabbableIOS(element) {
var /** @type {?} */ nodeName = element.nodeName.toLowerCase();
var /** @type {?} */ inputType = nodeName === 'input' && ((element)).type;
return inputType === 'text'
|| inputType === 'password'
|| nodeName === 'select'
|| nodeName === 'te... | javascript | function isPotentiallyTabbableIOS(element) {
var /** @type {?} */ nodeName = element.nodeName.toLowerCase();
var /** @type {?} */ inputType = nodeName === 'input' && ((element)).type;
return inputType === 'text'
|| inputType === 'password'
|| nodeName === 'select'
|| nodeName === 'te... | [
"function",
"isPotentiallyTabbableIOS",
"(",
"element",
")",
"{",
"var",
"/** @type {?} */",
"nodeName",
"=",
"element",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
";",
"var",
"/** @type {?} */",
"inputType",
"=",
"nodeName",
"===",
"'input'",
"&&",
"(",
"("... | Checks whether the specified element is potentially tabbable on iOS
@param {?} element
@return {?} | [
"Checks",
"whether",
"the",
"specified",
"element",
"is",
"potentially",
"tabbable",
"on",
"iOS"
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L10156-L10163 | train |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | applyCssTransform | function applyCssTransform(element, transformValue) {
// It's important to trim the result, because the browser will ignore the set operation
// if the string contains only whitespace.
var /** @type {?} */ value = transformValue.trim();
element.style.transform = value;
element.style.webkitTransform ... | javascript | function applyCssTransform(element, transformValue) {
// It's important to trim the result, because the browser will ignore the set operation
// if the string contains only whitespace.
var /** @type {?} */ value = transformValue.trim();
element.style.transform = value;
element.style.webkitTransform ... | [
"function",
"applyCssTransform",
"(",
"element",
",",
"transformValue",
")",
"{",
"// It's important to trim the result, because the browser will ignore the set operation",
"// if the string contains only whitespace.",
"var",
"/** @type {?} */",
"value",
"=",
"transformValue",
".",
"... | Applies a CSS transform to an element, including browser-prefixed properties.
@param {?} element
@param {?} transformValue
@return {?} | [
"Applies",
"a",
"CSS",
"transform",
"to",
"an",
"element",
"including",
"browser",
"-",
"prefixed",
"properties",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L11384-L11390 | train |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function () {
if (this._multiple) {
var /** @type {?} */ selectedOptions = this._selectionModel.selected.map(function (option) { return option.viewValue; });
if (this._isRtl()) {
selectedOptions.reverse();
}
// TODO(crisbeto... | javascript | function () {
if (this._multiple) {
var /** @type {?} */ selectedOptions = this._selectionModel.selected.map(function (option) { return option.viewValue; });
if (this._isRtl()) {
selectedOptions.reverse();
}
// TODO(crisbeto... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_multiple",
")",
"{",
"var",
"/** @type {?} */",
"selectedOptions",
"=",
"this",
".",
"_selectionModel",
".",
"selected",
".",
"map",
"(",
"function",
"(",
"option",
")",
"{",
"return",
"option",
".",
"... | The value displayed in the trigger.
@return {?} | [
"The",
"value",
"displayed",
"in",
"the",
"trigger",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L14285-L14295 | train | |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function () {
var /** @type {?} */ axis = this.vertical ? 'Y' : 'X';
// For a horizontal slider in RTL languages we push the ticks container off the left edge
// instead of the right edge to avoid causing a horizontal scrollbar to appear.
var /** @type {?} */ sign = !this... | javascript | function () {
var /** @type {?} */ axis = this.vertical ? 'Y' : 'X';
// For a horizontal slider in RTL languages we push the ticks container off the left edge
// instead of the right edge to avoid causing a horizontal scrollbar to appear.
var /** @type {?} */ sign = !this... | [
"function",
"(",
")",
"{",
"var",
"/** @type {?} */",
"axis",
"=",
"this",
".",
"vertical",
"?",
"'Y'",
":",
"'X'",
";",
"// For a horizontal slider in RTL languages we push the ticks container off the left edge",
"// instead of the right edge to avoid causing a horizontal scrollba... | CSS styles for the ticks container element.
@return {?} | [
"CSS",
"styles",
"for",
"the",
"ticks",
"container",
"element",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L15727-L15736 | train | |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function () {
var /** @type {?} */ tickSize = this._tickIntervalPercent * 100;
var /** @type {?} */ backgroundSize = this.vertical ? "2px " + tickSize + "%" : tickSize + "% 2px";
var /** @type {?} */ axis = this.vertical ? 'Y' : 'X';
// Depending on the direction we pushe... | javascript | function () {
var /** @type {?} */ tickSize = this._tickIntervalPercent * 100;
var /** @type {?} */ backgroundSize = this.vertical ? "2px " + tickSize + "%" : tickSize + "% 2px";
var /** @type {?} */ axis = this.vertical ? 'Y' : 'X';
// Depending on the direction we pushe... | [
"function",
"(",
")",
"{",
"var",
"/** @type {?} */",
"tickSize",
"=",
"this",
".",
"_tickIntervalPercent",
"*",
"100",
";",
"var",
"/** @type {?} */",
"backgroundSize",
"=",
"this",
".",
"vertical",
"?",
"\"2px \"",
"+",
"tickSize",
"+",
"\"%\"",
":",
"tickSi... | CSS styles for the ticks element.
@return {?} | [
"CSS",
"styles",
"for",
"the",
"ticks",
"element",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L15745-L15766 | train | |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | polarToCartesian | function polarToCartesian(radius, pathRadius, angleInDegrees) {
var /** @type {?} */ angleInRadians = (angleInDegrees - 90) * DEGREE_IN_RADIANS;
return (radius + (pathRadius * Math.cos(angleInRadians))) +
',' + (radius + (pathRadius * Math.sin(angleInRadians)));
} | javascript | function polarToCartesian(radius, pathRadius, angleInDegrees) {
var /** @type {?} */ angleInRadians = (angleInDegrees - 90) * DEGREE_IN_RADIANS;
return (radius + (pathRadius * Math.cos(angleInRadians))) +
',' + (radius + (pathRadius * Math.sin(angleInRadians)));
} | [
"function",
"polarToCartesian",
"(",
"radius",
",",
"pathRadius",
",",
"angleInDegrees",
")",
"{",
"var",
"/** @type {?} */",
"angleInRadians",
"=",
"(",
"angleInDegrees",
"-",
"90",
")",
"*",
"DEGREE_IN_RADIANS",
";",
"return",
"(",
"radius",
"+",
"(",
"pathRad... | Converts Polar coordinates to Cartesian.
@param {?} radius
@param {?} pathRadius
@param {?} angleInDegrees
@return {?} | [
"Converts",
"Polar",
"coordinates",
"to",
"Cartesian",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L19950-L19954 | train |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | materialEase | function materialEase(currentTime, startValue, changeInValue, duration) {
var /** @type {?} */ time = currentTime / duration;
var /** @type {?} */ timeCubed = Math.pow(time, 3);
var /** @type {?} */ timeQuad = Math.pow(time, 4);
var /** @type {?} */ timeQuint = Math.pow(time, 5);
return startValue +... | javascript | function materialEase(currentTime, startValue, changeInValue, duration) {
var /** @type {?} */ time = currentTime / duration;
var /** @type {?} */ timeCubed = Math.pow(time, 3);
var /** @type {?} */ timeQuad = Math.pow(time, 4);
var /** @type {?} */ timeQuint = Math.pow(time, 5);
return startValue +... | [
"function",
"materialEase",
"(",
"currentTime",
",",
"startValue",
",",
"changeInValue",
",",
"duration",
")",
"{",
"var",
"/** @type {?} */",
"time",
"=",
"currentTime",
"/",
"duration",
";",
"var",
"/** @type {?} */",
"timeCubed",
"=",
"Math",
".",
"pow",
"(",... | Easing function to match material design indeterminate animation.
@param {?} currentTime
@param {?} startValue
@param {?} changeInValue
@param {?} duration
@return {?} | [
"Easing",
"function",
"to",
"match",
"material",
"design",
"indeterminate",
"animation",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L19974-L19980 | train |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | getSvgArc | function getSvgArc(currentValue, rotation) {
var /** @type {?} */ startPoint = rotation || 0;
var /** @type {?} */ radius = 50;
var /** @type {?} */ pathRadius = 40;
var /** @type {?} */ startAngle = startPoint * MAX_ANGLE;
var /** @type {?} */ endAngle = currentValue * MAX_ANGLE;
var /** @type ... | javascript | function getSvgArc(currentValue, rotation) {
var /** @type {?} */ startPoint = rotation || 0;
var /** @type {?} */ radius = 50;
var /** @type {?} */ pathRadius = 40;
var /** @type {?} */ startAngle = startPoint * MAX_ANGLE;
var /** @type {?} */ endAngle = currentValue * MAX_ANGLE;
var /** @type ... | [
"function",
"getSvgArc",
"(",
"currentValue",
",",
"rotation",
")",
"{",
"var",
"/** @type {?} */",
"startPoint",
"=",
"rotation",
"||",
"0",
";",
"var",
"/** @type {?} */",
"radius",
"=",
"50",
";",
"var",
"/** @type {?} */",
"pathRadius",
"=",
"40",
";",
"va... | Determines the path value to define the arc. Converting percentage values to to polar
coordinates on the circle, and then to cartesian coordinates in the viewport.
@param {?} currentValue The current percentage value of the progress circle, the percentage of the
circle to fill.
@param {?} rotation The starting point ... | [
"Determines",
"the",
"path",
"value",
"to",
"define",
"the",
"arc",
".",
"Converting",
"percentage",
"values",
"to",
"to",
"polar",
"coordinates",
"on",
"the",
"circle",
"and",
"then",
"to",
"cartesian",
"coordinates",
"in",
"the",
"viewport",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L19991-L20008 | train |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | clamp$1 | function clamp$1(v, min, max) {
if (min === void 0) { min = 0; }
if (max === void 0) { max = 100; }
return Math.max(min, Math.min(max, v));
} | javascript | function clamp$1(v, min, max) {
if (min === void 0) { min = 0; }
if (max === void 0) { max = 100; }
return Math.max(min, Math.min(max, v));
} | [
"function",
"clamp$1",
"(",
"v",
",",
"min",
",",
"max",
")",
"{",
"if",
"(",
"min",
"===",
"void",
"0",
")",
"{",
"min",
"=",
"0",
";",
"}",
"if",
"(",
"max",
"===",
"void",
"0",
")",
"{",
"max",
"=",
"100",
";",
"}",
"return",
"Math",
"."... | Clamps a value to be between two numbers, by default 0 and 100.
@param {?} v
@param {?=} min
@param {?=} max
@return {?} | [
"Clamps",
"a",
"value",
"to",
"be",
"between",
"two",
"numbers",
"by",
"default",
"0",
"and",
"100",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L20144-L20148 | train |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function (origin) {
if (origin == null) {
return;
}
var /** @type {?} */ dir = this._getLayoutDirection();
if ((dir == 'ltr' && origin <= 0) || (dir == 'rtl' && origin > 0)) {
this._origin = 'left';
}
else {
... | javascript | function (origin) {
if (origin == null) {
return;
}
var /** @type {?} */ dir = this._getLayoutDirection();
if ((dir == 'ltr' && origin <= 0) || (dir == 'rtl' && origin > 0)) {
this._origin = 'left';
}
else {
... | [
"function",
"(",
"origin",
")",
"{",
"if",
"(",
"origin",
"==",
"null",
")",
"{",
"return",
";",
"}",
"var",
"/** @type {?} */",
"dir",
"=",
"this",
".",
"_getLayoutDirection",
"(",
")",
";",
"if",
"(",
"(",
"dir",
"==",
"'ltr'",
"&&",
"origin",
"<="... | The origin position from which this tab should appear when it is centered into view.
@param {?} origin
@return {?} | [
"The",
"origin",
"position",
"from",
"which",
"this",
"tab",
"should",
"appear",
"when",
"it",
"is",
"centered",
"into",
"view",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L22255-L22266 | train | |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function (value) {
if (!this._isValidIndex(value) || this._focusIndex == value) {
return;
}
this._focusIndex = value;
this.indexFocused.emit(value);
this._setTabFocus(value);
} | javascript | function (value) {
if (!this._isValidIndex(value) || this._focusIndex == value) {
return;
}
this._focusIndex = value;
this.indexFocused.emit(value);
this._setTabFocus(value);
} | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_isValidIndex",
"(",
"value",
")",
"||",
"this",
".",
"_focusIndex",
"==",
"value",
")",
"{",
"return",
";",
"}",
"this",
".",
"_focusIndex",
"=",
"value",
";",
"this",
".",
"indexFocu... | When the focus index is set, we must manually send focus to the correct label
@param {?} value
@return {?} | [
"When",
"the",
"focus",
"index",
"is",
"set",
"we",
"must",
"manually",
"send",
"focus",
"to",
"the",
"correct",
"label"
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L22538-L22545 | train | |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function (v) {
this._scrollDistance = Math.max(0, Math.min(this._getMaxScrollDistance(), v));
// Mark that the scroll distance has changed so that after the view is checked, the CSS
// transformation can move the header.
this._scrollDistanceChanged = true;
thi... | javascript | function (v) {
this._scrollDistance = Math.max(0, Math.min(this._getMaxScrollDistance(), v));
// Mark that the scroll distance has changed so that after the view is checked, the CSS
// transformation can move the header.
this._scrollDistanceChanged = true;
thi... | [
"function",
"(",
"v",
")",
"{",
"this",
".",
"_scrollDistance",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"Math",
".",
"min",
"(",
"this",
".",
"_getMaxScrollDistance",
"(",
")",
",",
"v",
")",
")",
";",
"// Mark that the scroll distance has changed so that af... | Sets the distance in pixels that the tab header should be transformed in the X-axis.
@param {?} v
@return {?} | [
"Sets",
"the",
"distance",
"in",
"pixels",
"that",
"the",
"tab",
"header",
"should",
"be",
"transformed",
"in",
"the",
"X",
"-",
"axis",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L22646-L22652 | train | |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function (classes) {
this._classList = classes.split(' ').reduce(function (obj, className) {
obj[className] = true;
return obj;
}, {});
this.setPositionClasses(this.positionX, this.positionY);
} | javascript | function (classes) {
this._classList = classes.split(' ').reduce(function (obj, className) {
obj[className] = true;
return obj;
}, {});
this.setPositionClasses(this.positionX, this.positionY);
} | [
"function",
"(",
"classes",
")",
"{",
"this",
".",
"_classList",
"=",
"classes",
".",
"split",
"(",
"' '",
")",
".",
"reduce",
"(",
"function",
"(",
"obj",
",",
"className",
")",
"{",
"obj",
"[",
"className",
"]",
"=",
"true",
";",
"return",
"obj",
... | This method takes classes set on the host md-menu element and applies them on the
menu template that displays in the overlay container. Otherwise, it's difficult
to style the containing menu from outside the component.
@param {?} classes list of class names
@return {?} | [
"This",
"method",
"takes",
"classes",
"set",
"on",
"the",
"host",
"md",
"-",
"menu",
"element",
"and",
"applies",
"them",
"on",
"the",
"menu",
"template",
"that",
"displays",
"in",
"the",
"overlay",
"container",
".",
"Otherwise",
"it",
"s",
"difficult",
"t... | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L23796-L23802 | train | |
sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function () {
return __WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__["Observable"].merge.apply(__WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__["Observable"], this.autocomplete.options.map(function (option) { return option.onSelectionChange; }));
} | javascript | function () {
return __WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__["Observable"].merge.apply(__WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__["Observable"], this.autocomplete.options.map(function (option) { return option.onSelectionChange; }));
} | [
"function",
"(",
")",
"{",
"return",
"__WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__",
"[",
"\"Observable\"",
"]",
".",
"merge",
".",
"apply",
"(",
"__WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__",
"[",
"\"Observable\"",
"]",
",",
"this",
".",
"autocomplete",
".",
"option... | Stream of autocomplete option selections.
@return {?} | [
"Stream",
"of",
"autocomplete",
"option",
"selections",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L25105-L25107 | train | |
alexindigo/fbbot | lib/verify_endpoint.js | verifyEndpoint | function verifyEndpoint(request, respond)
{
var challenge;
if (typeof request.query == 'string')
{
request.query = qs.parse(request.query);
}
if (typeof request.query == 'object'
&& ((request.query['hub.verify_token'] === this.credentials.secret)
// for hapi@10 and restify/express with query... | javascript | function verifyEndpoint(request, respond)
{
var challenge;
if (typeof request.query == 'string')
{
request.query = qs.parse(request.query);
}
if (typeof request.query == 'object'
&& ((request.query['hub.verify_token'] === this.credentials.secret)
// for hapi@10 and restify/express with query... | [
"function",
"verifyEndpoint",
"(",
"request",
",",
"respond",
")",
"{",
"var",
"challenge",
";",
"if",
"(",
"typeof",
"request",
".",
"query",
"==",
"'string'",
")",
"{",
"request",
".",
"query",
"=",
"qs",
".",
"parse",
"(",
"request",
".",
"query",
"... | Verifies endpoint by replying with the provided challenge
@this Fbbot#
@param {EventEmitter} request - incoming http request object
@param {function} respond - http response function | [
"Verifies",
"endpoint",
"by",
"replying",
"with",
"the",
"provided",
"challenge"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/verify_endpoint.js#L12-L37 | train |
yahoo/preceptor | lib/client.js | function (options, send) {
var clientPath = options.clientPath,
coverage = options.coverage,
parentId = options.parentId,
configuration = options.configuration,
globalConfig = options.globalConfig,
decorators = options.decorators,
decoratorPlugins = options.decoratorPlugins,
ClientClass,
clientInstan... | javascript | function (options, send) {
var clientPath = options.clientPath,
coverage = options.coverage,
parentId = options.parentId,
configuration = options.configuration,
globalConfig = options.globalConfig,
decorators = options.decorators,
decoratorPlugins = options.decoratorPlugins,
ClientClass,
clientInstan... | [
"function",
"(",
"options",
",",
"send",
")",
"{",
"var",
"clientPath",
"=",
"options",
".",
"clientPath",
",",
"coverage",
"=",
"options",
".",
"coverage",
",",
"parentId",
"=",
"options",
".",
"parentId",
",",
"configuration",
"=",
"options",
".",
"confi... | Runs the client
@class Client
@method run
@param {object} options
@param {function} send
@private | [
"Runs",
"the",
"client"
] | 061ffeca8751344b06e6768a281cc7a2679fd679 | https://github.com/yahoo/preceptor/blob/061ffeca8751344b06e6768a281cc7a2679fd679/lib/client.js#L18-L107 | train | |
citizenmatt/gitbook-plugin-multipart | index.js | function(summary) {
// If the file contains an h2, we need to reformat it
if (summary.content.match(/^## /m)) {
var parts = summary.content.split(/(?=##)/);
for (var i = 0; i < parts.length; i++) {
// Remove any blank lines
... | javascript | function(summary) {
// If the file contains an h2, we need to reformat it
if (summary.content.match(/^## /m)) {
var parts = summary.content.split(/(?=##)/);
for (var i = 0; i < parts.length; i++) {
// Remove any blank lines
... | [
"function",
"(",
"summary",
")",
"{",
"// If the file contains an h2, we need to reformat it",
"if",
"(",
"summary",
".",
"content",
".",
"match",
"(",
"/",
"^## ",
"/",
"m",
")",
")",
"{",
"var",
"parts",
"=",
"summary",
".",
"content",
".",
"split",
"(",
... | Gets plain text content | [
"Gets",
"plain",
"text",
"content"
] | 6ba8f01d3e83915516d8614e119f0c34390aad96 | https://github.com/citizenmatt/gitbook-plugin-multipart/blob/6ba8f01d3e83915516d8614e119f0c34390aad96/index.js#L10-L32 | train | |
citizenmatt/gitbook-plugin-multipart | index.js | function(page) {
var $ = cheerio.load(page.content);
// Replace top level li.chapter with li.part
$('ul.summary > li.chapter').each(function(i, elem) {
var li = $(elem);
// Replace the classes if the chapter is actually a part, and add a divider
... | javascript | function(page) {
var $ = cheerio.load(page.content);
// Replace top level li.chapter with li.part
$('ul.summary > li.chapter').each(function(i, elem) {
var li = $(elem);
// Replace the classes if the chapter is actually a part, and add a divider
... | [
"function",
"(",
"page",
")",
"{",
"var",
"$",
"=",
"cheerio",
".",
"load",
"(",
"page",
".",
"content",
")",
";",
"// Replace top level li.chapter with li.part",
"$",
"(",
"'ul.summary > li.chapter'",
")",
".",
"each",
"(",
"function",
"(",
"i",
",",
"elem"... | Requires an unhealthy knowledge of the generated template... | [
"Requires",
"an",
"unhealthy",
"knowledge",
"of",
"the",
"generated",
"template",
"..."
] | 6ba8f01d3e83915516d8614e119f0c34390aad96 | https://github.com/citizenmatt/gitbook-plugin-multipart/blob/6ba8f01d3e83915516d8614e119f0c34390aad96/index.js#L35-L80 | train | |
alexindigo/fbbot | index.js | Fbbot | function Fbbot(options)
{
if (!(this instanceof Fbbot)) return new Fbbot(options);
/**
* Custom options per instance
* @type {object}
*/
this.options = merge(Fbbot.defaults, options || {});
/**
* Store credentials
* @type {object}
*/
this.credentials =
{
// keep simple naming for int... | javascript | function Fbbot(options)
{
if (!(this instanceof Fbbot)) return new Fbbot(options);
/**
* Custom options per instance
* @type {object}
*/
this.options = merge(Fbbot.defaults, options || {});
/**
* Store credentials
* @type {object}
*/
this.credentials =
{
// keep simple naming for int... | [
"function",
"Fbbot",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Fbbot",
")",
")",
"return",
"new",
"Fbbot",
"(",
"options",
")",
";",
"/**\n * Custom options per instance\n * @type {object}\n */",
"this",
".",
"options",
"=",
"me... | Fbbot instance constructor
@this Fbbot#
@param {object} options - list of customization parameters
@constructor | [
"Fbbot",
"instance",
"constructor"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/index.js#L57-L136 | train |
Gambiit/mcp3008.js | nodes/core/hardware/37-mcp3008.js | read | function read(mode,callback) {
if (spi === undefined) {return;};
var txBuf = new Buffer([1,mode,0]);
var rxBuf = new Buffer([0,0,0]);
spi.transfer(txBuf,rxBuf,function(dev,buffer) {
var value = ((buffer[1] & 3)<< 8) + buffer[2];
callback(value);
});
} | javascript | function read(mode,callback) {
if (spi === undefined) {return;};
var txBuf = new Buffer([1,mode,0]);
var rxBuf = new Buffer([0,0,0]);
spi.transfer(txBuf,rxBuf,function(dev,buffer) {
var value = ((buffer[1] & 3)<< 8) + buffer[2];
callback(value);
});
} | [
"function",
"read",
"(",
"mode",
",",
"callback",
")",
"{",
"if",
"(",
"spi",
"===",
"undefined",
")",
"{",
"return",
";",
"}",
";",
"var",
"txBuf",
"=",
"new",
"Buffer",
"(",
"[",
"1",
",",
"mode",
",",
"0",
"]",
")",
";",
"var",
"rxBuf",
"=",... | lit l'interface spi | [
"lit",
"l",
"interface",
"spi"
] | 0d3ea73bce000cb8bd1d10242e427e19ede5745d | https://github.com/Gambiit/mcp3008.js/blob/0d3ea73bce000cb8bd1d10242e427e19ede5745d/nodes/core/hardware/37-mcp3008.js#L31-L40 | train |
ddliu/grunt-push-svn | tasks/push_svn.js | function(callback) {
grunt.log.writeln('Prepare tmp path...');
if (!grunt.file.isDir(tmpPath)) {
if (grunt.file.exists(tmpPath)) {
callback(new Error(util.format('"%s" is not a directory', tmpPath)));
}
else {
grunt.file.mkdir(tmpPath);
c... | javascript | function(callback) {
grunt.log.writeln('Prepare tmp path...');
if (!grunt.file.isDir(tmpPath)) {
if (grunt.file.exists(tmpPath)) {
callback(new Error(util.format('"%s" is not a directory', tmpPath)));
}
else {
grunt.file.mkdir(tmpPath);
c... | [
"function",
"(",
"callback",
")",
"{",
"grunt",
".",
"log",
".",
"writeln",
"(",
"'Prepare tmp path...'",
")",
";",
"if",
"(",
"!",
"grunt",
".",
"file",
".",
"isDir",
"(",
"tmpPath",
")",
")",
"{",
"if",
"(",
"grunt",
".",
"file",
".",
"exists",
"... | make sure tmpPath exists | [
"make",
"sure",
"tmpPath",
"exists"
] | 59dc07216fffaf05712d7a4936f2227435a1badf | https://github.com/ddliu/grunt-push-svn/blob/59dc07216fffaf05712d7a4936f2227435a1badf/tasks/push_svn.js#L101-L115 | train | |
ddliu/grunt-push-svn | tasks/push_svn.js | function(callback) {
grunt.log.writeln('Push to tmp path...');
// remove
if (options.remove) {
grunt.file.recurse(tmpPath, function(abs, rootdir, subdir, filename) {
if (typeof subdir !== 'string') {
subdir = '';
}
var subPath = path.jo... | javascript | function(callback) {
grunt.log.writeln('Push to tmp path...');
// remove
if (options.remove) {
grunt.file.recurse(tmpPath, function(abs, rootdir, subdir, filename) {
if (typeof subdir !== 'string') {
subdir = '';
}
var subPath = path.jo... | [
"function",
"(",
"callback",
")",
"{",
"grunt",
".",
"log",
".",
"writeln",
"(",
"'Push to tmp path...'",
")",
";",
"// remove",
"if",
"(",
"options",
".",
"remove",
")",
"{",
"grunt",
".",
"file",
".",
"recurse",
"(",
"tmpPath",
",",
"function",
"(",
... | sync with tmp working directory | [
"sync",
"with",
"tmp",
"working",
"directory"
] | 59dc07216fffaf05712d7a4936f2227435a1badf | https://github.com/ddliu/grunt-push-svn/blob/59dc07216fffaf05712d7a4936f2227435a1badf/tasks/push_svn.js#L159-L231 | train | |
alexindigo/fbbot | traverse/incoming.js | linkParent | function linkParent(original, branch, parentPayload, nextPayload)
{
// get proper name
var normalized = normalize(branch);
var result = original(branch, parentPayload, nextPayload);
// add normalized handle reference
// skip if it's empty string
if (normalized)
{
result.__proto__[normalized] = paren... | javascript | function linkParent(original, branch, parentPayload, nextPayload)
{
// get proper name
var normalized = normalize(branch);
var result = original(branch, parentPayload, nextPayload);
// add normalized handle reference
// skip if it's empty string
if (normalized)
{
result.__proto__[normalized] = paren... | [
"function",
"linkParent",
"(",
"original",
",",
"branch",
",",
"parentPayload",
",",
"nextPayload",
")",
"{",
"// get proper name",
"var",
"normalized",
"=",
"normalize",
"(",
"branch",
")",
";",
"var",
"result",
"=",
"original",
"(",
"branch",
",",
"parentPay... | Wraps original linkParent method
and adds normalized handle reference to the parent object
@param {function} original - original linkParent method
@param {string} branch - current branch of the payload
@param {object} parentPayload - parent payload object
@param {mixed} nextPayload - next step payload object
@... | [
"Wraps",
"original",
"linkParent",
"method",
"and",
"adds",
"normalized",
"handle",
"reference",
"to",
"the",
"parent",
"object"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/traverse/incoming.js#L30-L51 | train |
alexindigo/fbbot | traverse/incoming.js | middleware | function middleware(branch, payload, callback)
{
// get proper name
var normalized = normalize(branch);
this.logger.debug({message: 'Running middleware for incoming payload', branch: branch, normalized: normalized, payload: payload});
// add branch reference to the parent object
// run through all register... | javascript | function middleware(branch, payload, callback)
{
// get proper name
var normalized = normalize(branch);
this.logger.debug({message: 'Running middleware for incoming payload', branch: branch, normalized: normalized, payload: payload});
// add branch reference to the parent object
// run through all register... | [
"function",
"middleware",
"(",
"branch",
",",
"payload",
",",
"callback",
")",
"{",
"// get proper name",
"var",
"normalized",
"=",
"normalize",
"(",
"branch",
")",
";",
"this",
".",
"logger",
".",
"debug",
"(",
"{",
"message",
":",
"'Running middleware for in... | Traverse middleware for incoming flow
@this Fbbot#
@param {string} branch - branch name of the payload
@param {object} payload - initial payload object from facebook messenger
@param {function} callback - invoked upon error or when all entries were processed | [
"Traverse",
"middleware",
"for",
"incoming",
"flow"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/traverse/incoming.js#L61-L86 | train |
neoziro/smime | index.js | sign | function sign(options, cb) {
return new Promise(function (resolve, reject) {
options = options || {};
if (!options.content)
throw new Error('Invalid content.');
if (!options.key)
throw new Error('Invalid key.');
if (!options.cert)
throw new Error('Invalid certificate.');
var ... | javascript | function sign(options, cb) {
return new Promise(function (resolve, reject) {
options = options || {};
if (!options.content)
throw new Error('Invalid content.');
if (!options.key)
throw new Error('Invalid key.');
if (!options.cert)
throw new Error('Invalid certificate.');
var ... | [
"function",
"sign",
"(",
"options",
",",
"cb",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"options",
".",
"content",
")",
"throw",
... | Sign a file.
@param {object} options Options
@param {stream.Readable} options.content Content stream
@param {string} options.key Key path
@param {string} options.cert Cert path
@param {string} [options.password] Key password
@param {function} [cb] Optional callback
@returns {object} result Result
@returns {string} res... | [
"Sign",
"a",
"file",
"."
] | 9ada09c5a0a30ef3e8beac3db181f2cbb3602f2c | https://github.com/neoziro/smime/blob/9ada09c5a0a30ef3e8beac3db181f2cbb3602f2c/index.js#L22-L66 | train |
alexindigo/fbbot | lib/attach.js | attach | function attach(filters, instance)
{
Object.keys(filters).forEach(function(step)
{
filters[step].forEach(function(filter)
{
instance.use(step, filter);
});
});
} | javascript | function attach(filters, instance)
{
Object.keys(filters).forEach(function(step)
{
filters[step].forEach(function(filter)
{
instance.use(step, filter);
});
});
} | [
"function",
"attach",
"(",
"filters",
",",
"instance",
")",
"{",
"Object",
".",
"keys",
"(",
"filters",
")",
".",
"forEach",
"(",
"function",
"(",
"step",
")",
"{",
"filters",
"[",
"step",
"]",
".",
"forEach",
"(",
"function",
"(",
"filter",
")",
"{"... | Attaches list of middleware filters to the provided instance
@param {object} filters - list of filters per step (event)
@param {function} instance - filter instance to attach to an event (step) | [
"Attaches",
"list",
"of",
"middleware",
"filters",
"to",
"the",
"provided",
"instance"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/attach.js#L9-L18 | train |
doochik/react-native-vksdk | index.ios.js | function() {
return new Promise(function(resolve, reject) {
VkSdkLoginManager.authorize(function(error, result) {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
} | javascript | function() {
return new Promise(function(resolve, reject) {
VkSdkLoginManager.authorize(function(error, result) {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
} | [
"function",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"VkSdkLoginManager",
".",
"authorize",
"(",
"function",
"(",
"error",
",",
"result",
")",
"{",
"if",
"(",
"error",
")",
"{",
"reject",
"(",... | Starts authorization process to retrieve unlimited token.
If VKapp is available in system, it will opens and requests access from user.
Otherwise Mobile Safari will be opened for access request.
@returns {Promise} | [
"Starts",
"authorization",
"process",
"to",
"retrieve",
"unlimited",
"token",
".",
"If",
"VKapp",
"is",
"available",
"in",
"system",
"it",
"will",
"opens",
"and",
"requests",
"access",
"from",
"user",
".",
"Otherwise",
"Mobile",
"Safari",
"will",
"be",
"opened... | e06494b5a64121eea155414162b6416a0589b58c | https://github.com/doochik/react-native-vksdk/blob/e06494b5a64121eea155414162b6416a0589b58c/index.ios.js#L13-L23 | train | |
alexindigo/fbbot | lib/pipeline.js | pipeline | function pipeline(list, payload, handler, callback)
{
var item;
if (!list.length)
{
callback(null, payload);
return;
}
list = list.concat();
item = list.shift();
// pipeline it
handler(item, payload, async(function(err, updatedPayload)
{
if (err)
{
callback(err, updatedPayload... | javascript | function pipeline(list, payload, handler, callback)
{
var item;
if (!list.length)
{
callback(null, payload);
return;
}
list = list.concat();
item = list.shift();
// pipeline it
handler(item, payload, async(function(err, updatedPayload)
{
if (err)
{
callback(err, updatedPayload... | [
"function",
"pipeline",
"(",
"list",
",",
"payload",
",",
"handler",
",",
"callback",
")",
"{",
"var",
"item",
";",
"if",
"(",
"!",
"list",
".",
"length",
")",
"{",
"callback",
"(",
"null",
",",
"payload",
")",
";",
"return",
";",
"}",
"list",
"=",... | Pipelines provided payload through the list of of item via handler
@param {array} list - items to iterate over
@param {object} payload - object to pass to pass iteratees
@param {function} handler - function to invoke for each item/payload iteration
@param {function} callback - invoked after all item were proce... | [
"Pipelines",
"provided",
"payload",
"through",
"the",
"list",
"of",
"of",
"item",
"via",
"handler"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/pipeline.js#L13-L38 | train |
JamesMGreene/qunit-assert-compare | qunit-assert-compare.js | gte | function gte(num1, num2, message) {
var output,
input = {
operand1: num1,
operand2: num2,
expected: 1, // Untrue but... internal usage, so meh!
message: message
},
cleanedInput = _validateAndClean(input),
pushContext = _g... | javascript | function gte(num1, num2, message) {
var output,
input = {
operand1: num1,
operand2: num2,
expected: 1, // Untrue but... internal usage, so meh!
message: message
},
cleanedInput = _validateAndClean(input),
pushContext = _g... | [
"function",
"gte",
"(",
"num1",
",",
"num2",
",",
"message",
")",
"{",
"var",
"output",
",",
"input",
"=",
"{",
"operand1",
":",
"num1",
",",
"operand2",
":",
"num2",
",",
"expected",
":",
"1",
",",
"// Untrue but... internal usage, so meh!",
"message",
":... | Is `num1` greater than or equal to `num2`?
@example assert.gte(2, 2, "2 is greater than or equal to 2");
@example assert.gte(2, 1, "2 is greater than or equal to 1");
@param Number num1 The actual left operand
@param Number num2 The actual right operand
@param String message (optional) | [
"Is",
"num1",
"greater",
"than",
"or",
"equal",
"to",
"num2",
"?"
] | 512118ead5a40dd351c766e1b098ab9cf3de3cc4 | https://github.com/JamesMGreene/qunit-assert-compare/blob/512118ead5a40dd351c766e1b098ab9cf3de3cc4/qunit-assert-compare.js#L330-L348 | train |
segmentio/localstorage-retry | lib/store.js | Store | function Store(name, id, keys, optionalEngine) {
this.id = id;
this.name = name;
this.keys = keys || {};
this.engine = optionalEngine || defaultEngine;
} | javascript | function Store(name, id, keys, optionalEngine) {
this.id = id;
this.name = name;
this.keys = keys || {};
this.engine = optionalEngine || defaultEngine;
} | [
"function",
"Store",
"(",
"name",
",",
"id",
",",
"keys",
",",
"optionalEngine",
")",
"{",
"this",
".",
"id",
"=",
"id",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"keys",
"=",
"keys",
"||",
"{",
"}",
";",
"this",
".",
"engine",
"... | Store Implementation with dedicated | [
"Store",
"Implementation",
"with",
"dedicated"
] | 0632fb943fc111b6dbf8f36bff5abc6568ffc65e | https://github.com/segmentio/localstorage-retry/blob/0632fb943fc111b6dbf8f36bff5abc6568ffc65e/lib/store.js#L13-L18 | train |
koistya/gulp-render | index.js | renderToString | function renderToString(page) {
var layout = null, child = null, props = {};
while ((layout = page.type.layout || (page.defaultProps && page.defaultProps.layout))) {
child = React.createElement(page, props, child);
_.extend(props, page.defaultProps);
React.renderToString(React.createElement(page, props,... | javascript | function renderToString(page) {
var layout = null, child = null, props = {};
while ((layout = page.type.layout || (page.defaultProps && page.defaultProps.layout))) {
child = React.createElement(page, props, child);
_.extend(props, page.defaultProps);
React.renderToString(React.createElement(page, props,... | [
"function",
"renderToString",
"(",
"page",
")",
"{",
"var",
"layout",
"=",
"null",
",",
"child",
"=",
"null",
",",
"props",
"=",
"{",
"}",
";",
"while",
"(",
"(",
"layout",
"=",
"page",
".",
"type",
".",
"layout",
"||",
"(",
"page",
".",
"defaultPr... | Check if Page component has a layout property; and if yes, wrap the page
into the specified layout, then render to a string. | [
"Check",
"if",
"Page",
"component",
"has",
"a",
"layout",
"property",
";",
"and",
"if",
"yes",
"wrap",
"the",
"page",
"into",
"the",
"specified",
"layout",
"then",
"render",
"to",
"a",
"string",
"."
] | 97e69fd5c1c7c02017cb6597fe9c5dcc620ed92f | https://github.com/koistya/gulp-render/blob/97e69fd5c1c7c02017cb6597fe9c5dcc620ed92f/index.js#L38-L47 | train |
mysidewalk/jsonapi-parse | dist/jsonapi.js | deserialize | function deserialize(json) {
var data, deserialized;
var includedMap = {};
each(json.included, function(value) {
var key = value.type + '-' + value.id;
includedMap[key] = value;
});
if (isArray(json.data)) {
data = map(
json.d... | javascript | function deserialize(json) {
var data, deserialized;
var includedMap = {};
each(json.included, function(value) {
var key = value.type + '-' + value.id;
includedMap[key] = value;
});
if (isArray(json.data)) {
data = map(
json.d... | [
"function",
"deserialize",
"(",
"json",
")",
"{",
"var",
"data",
",",
"deserialized",
";",
"var",
"includedMap",
"=",
"{",
"}",
";",
"each",
"(",
"json",
".",
"included",
",",
"function",
"(",
"value",
")",
"{",
"var",
"key",
"=",
"value",
".",
"type... | Deserialize the JSONAPI formatted object | [
"Deserialize",
"the",
"JSONAPI",
"formatted",
"object"
] | caf8437908586d649756e6e3e4ee444e78a66cf7 | https://github.com/mysidewalk/jsonapi-parse/blob/caf8437908586d649756e6e3e4ee444e78a66cf7/dist/jsonapi.js#L48-L89 | train |
mysidewalk/jsonapi-parse | dist/jsonapi.js | populateRelatedFields | function populateRelatedFields(record, includedMap, parents) {
// IF: Object has relationships, update so this record is listed as a parent
if (record.relationships) {
parents = parents ? parents.concat([record]) : [record] ;
}
each(
record.relationships,
... | javascript | function populateRelatedFields(record, includedMap, parents) {
// IF: Object has relationships, update so this record is listed as a parent
if (record.relationships) {
parents = parents ? parents.concat([record]) : [record] ;
}
each(
record.relationships,
... | [
"function",
"populateRelatedFields",
"(",
"record",
",",
"includedMap",
",",
"parents",
")",
"{",
"// IF: Object has relationships, update so this record is listed as a parent",
"if",
"(",
"record",
".",
"relationships",
")",
"{",
"parents",
"=",
"parents",
"?",
"parents"... | Populate relations of the provided record from the included objects | [
"Populate",
"relations",
"of",
"the",
"provided",
"record",
"from",
"the",
"included",
"objects"
] | caf8437908586d649756e6e3e4ee444e78a66cf7 | https://github.com/mysidewalk/jsonapi-parse/blob/caf8437908586d649756e6e3e4ee444e78a66cf7/dist/jsonapi.js#L92-L133 | train |
mysidewalk/jsonapi-parse | dist/jsonapi.js | getMatchingRecord | function getMatchingRecord(relationship, included, parents) {
var circular, match;
circular = findWhere(
parents,
{
id: relationship.id,
type: relationship.type
}
);
if (circular) {
return relationship;
... | javascript | function getMatchingRecord(relationship, included, parents) {
var circular, match;
circular = findWhere(
parents,
{
id: relationship.id,
type: relationship.type
}
);
if (circular) {
return relationship;
... | [
"function",
"getMatchingRecord",
"(",
"relationship",
",",
"included",
",",
"parents",
")",
"{",
"var",
"circular",
",",
"match",
";",
"circular",
"=",
"findWhere",
"(",
"parents",
",",
"{",
"id",
":",
"relationship",
".",
"id",
",",
"type",
":",
"relation... | Retrieves the record from the included objects that matches the provided relationship | [
"Retrieves",
"the",
"record",
"from",
"the",
"included",
"objects",
"that",
"matches",
"the",
"provided",
"relationship"
] | caf8437908586d649756e6e3e4ee444e78a66cf7 | https://github.com/mysidewalk/jsonapi-parse/blob/caf8437908586d649756e6e3e4ee444e78a66cf7/dist/jsonapi.js#L136-L168 | train |
mysidewalk/jsonapi-parse | dist/jsonapi.js | flatten | function flatten(record, extraMeta) {
var meta = extend({}, record.meta, extraMeta)
return extend(
{},
{ links: record.links, meta: meta },
record.attributes,
{ id: record.id, type: record.type }
);
} | javascript | function flatten(record, extraMeta) {
var meta = extend({}, record.meta, extraMeta)
return extend(
{},
{ links: record.links, meta: meta },
record.attributes,
{ id: record.id, type: record.type }
);
} | [
"function",
"flatten",
"(",
"record",
",",
"extraMeta",
")",
"{",
"var",
"meta",
"=",
"extend",
"(",
"{",
"}",
",",
"record",
".",
"meta",
",",
"extraMeta",
")",
"return",
"extend",
"(",
"{",
"}",
",",
"{",
"links",
":",
"record",
".",
"links",
","... | Flatten the ID of an object with the rest of the attributes on a new object | [
"Flatten",
"the",
"ID",
"of",
"an",
"object",
"with",
"the",
"rest",
"of",
"the",
"attributes",
"on",
"a",
"new",
"object"
] | caf8437908586d649756e6e3e4ee444e78a66cf7 | https://github.com/mysidewalk/jsonapi-parse/blob/caf8437908586d649756e6e3e4ee444e78a66cf7/dist/jsonapi.js#L171-L179 | train |
marijnh/getdocs | src/index.js | extend | function extend(from, to, path, overrideLoc) {
for (var prop in from) {
if (!(prop in to) || (prop == "loc" && overrideLoc)) {
to[prop] = from[prop]
} else if (prop == "properties" || prop == "staticProperties") {
extend(from[prop], to[prop], path.concat(prop))
} else {
var msg = "Confli... | javascript | function extend(from, to, path, overrideLoc) {
for (var prop in from) {
if (!(prop in to) || (prop == "loc" && overrideLoc)) {
to[prop] = from[prop]
} else if (prop == "properties" || prop == "staticProperties") {
extend(from[prop], to[prop], path.concat(prop))
} else {
var msg = "Confli... | [
"function",
"extend",
"(",
"from",
",",
"to",
",",
"path",
",",
"overrideLoc",
")",
"{",
"for",
"(",
"var",
"prop",
"in",
"from",
")",
"{",
"if",
"(",
"!",
"(",
"prop",
"in",
"to",
")",
"||",
"(",
"prop",
"==",
"\"loc\"",
"&&",
"overrideLoc",
")"... | Deriving context from ancestor nodes | [
"Deriving",
"context",
"from",
"ancestor",
"nodes"
] | 74181d582e041013cb742d057bf53801358b4d93 | https://github.com/marijnh/getdocs/blob/74181d582e041013cb742d057bf53801358b4d93/src/index.js#L283-L297 | train |
lmangani/parsip | lib/Parser.js | getHeader | function getHeader(data, headerStart)
{
// 'start' position of the header.
let start = headerStart;
// 'end' position of the header.
let end = 0;
// 'partial end' position of the header.
let partialEnd = 0;
// End of message.
if (data.substring(start, start + 2).match(/(^\r\n)/))
{
return -2;
}... | javascript | function getHeader(data, headerStart)
{
// 'start' position of the header.
let start = headerStart;
// 'end' position of the header.
let end = 0;
// 'partial end' position of the header.
let partialEnd = 0;
// End of message.
if (data.substring(start, start + 2).match(/(^\r\n)/))
{
return -2;
}... | [
"function",
"getHeader",
"(",
"data",
",",
"headerStart",
")",
"{",
"// 'start' position of the header.",
"let",
"start",
"=",
"headerStart",
";",
"// 'end' position of the header.",
"let",
"end",
"=",
"0",
";",
"// 'partial end' position of the header.",
"let",
"partialE... | Extract and parse every header of a SIP message. | [
"Extract",
"and",
"parse",
"every",
"header",
"of",
"a",
"SIP",
"message",
"."
] | fa1fd873199e9933ed56124760c564c8e6c571d7 | https://github.com/lmangani/parsip/blob/fa1fd873199e9933ed56124760c564c8e6c571d7/lib/Parser.js#L103-L141 | train |
adplabs/JQL | lib/JQL.js | find | function find(prefix, suffix)
{
if(valStack.length > 0)
{
var currentVal = valStack[valStack.length - 1];
if(prefix.length > 0)
{
// Manipulate prefix and suffix
var currentField = prefix.shift();
suffix.push(curren... | javascript | function find(prefix, suffix)
{
if(valStack.length > 0)
{
var currentVal = valStack[valStack.length - 1];
if(prefix.length > 0)
{
// Manipulate prefix and suffix
var currentField = prefix.shift();
suffix.push(curren... | [
"function",
"find",
"(",
"prefix",
",",
"suffix",
")",
"{",
"if",
"(",
"valStack",
".",
"length",
">",
"0",
")",
"{",
"var",
"currentVal",
"=",
"valStack",
"[",
"valStack",
".",
"length",
"-",
"1",
"]",
";",
"if",
"(",
"prefix",
".",
"length",
">",... | This is the foundation of all searching in JQL; it chooses specific search types based upon the current part of the JQL string
@private
@param {Array} prefix - Initial part of path
@param {Array} suffix - Final part of path | [
"This",
"is",
"the",
"foundation",
"of",
"all",
"searching",
"in",
"JQL",
";",
"it",
"chooses",
"specific",
"search",
"types",
"based",
"upon",
"the",
"current",
"part",
"of",
"the",
"JQL",
"string"
] | f4e63693c599dd9ad614327c8ca487b9ca576ffd | https://github.com/adplabs/JQL/blob/f4e63693c599dd9ad614327c8ca487b9ca576ffd/lib/JQL.js#L449-L520 | train |
kengz/telegram-bot-bootstrap | API.js | function(token) {
this.token = token;
this.baseUrl = 'https://api.telegram.org/bot' + this.token;
// A sample Telegram bot JSON data, for req options
this.formData = {
chat_id: "87654321",
text: "Hello there"
};
// template options for req the Telegram Bot API
this.baseopti... | javascript | function(token) {
this.token = token;
this.baseUrl = 'https://api.telegram.org/bot' + this.token;
// A sample Telegram bot JSON data, for req options
this.formData = {
chat_id: "87654321",
text: "Hello there"
};
// template options for req the Telegram Bot API
this.baseopti... | [
"function",
"(",
"token",
")",
"{",
"this",
".",
"token",
"=",
"token",
";",
"this",
".",
"baseUrl",
"=",
"'https://api.telegram.org/bot'",
"+",
"this",
".",
"token",
";",
"// A sample Telegram bot JSON data, for req options",
"this",
".",
"formData",
"=",
"{",
... | The API object prototype
The API bot constructor.
@category Telegram API
@param {string} token Your Telegram bot token.
@returns {Bot} The bot able to call methods.
@example
var fs = require('fs');
var bot = require('telegram-bot-bootstrap');
var Alice = new bot(your_bot_token);
Alice.sendMessage(user_chat_id, 'He... | [
"The",
"API",
"object",
"prototype",
"The",
"API",
"bot",
"constructor",
"."
] | c99281393a1fa3d7c0f81df55634bb956072d20a | https://github.com/kengz/telegram-bot-bootstrap/blob/c99281393a1fa3d7c0f81df55634bb956072d20a/API.js#L39-L120 | train | |
lmangani/parsip | lib/SIPMessage.js | function(name, value) {
var header = { raw: value };
name = Utils.headerize(name);
if(this.headers[name]) {
this.headers[name].push(header);
} else {
this.headers[name] = [header];
}
} | javascript | function(name, value) {
var header = { raw: value };
name = Utils.headerize(name);
if(this.headers[name]) {
this.headers[name].push(header);
} else {
this.headers[name] = [header];
}
} | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"var",
"header",
"=",
"{",
"raw",
":",
"value",
"}",
";",
"name",
"=",
"Utils",
".",
"headerize",
"(",
"name",
")",
";",
"if",
"(",
"this",
".",
"headers",
"[",
"name",
"]",
")",
"{",
"this",
"."... | Insert a header of the given name and value into the last position of the
header array. | [
"Insert",
"a",
"header",
"of",
"the",
"given",
"name",
"and",
"value",
"into",
"the",
"last",
"position",
"of",
"the",
"header",
"array",
"."
] | fa1fd873199e9933ed56124760c564c8e6c571d7 | https://github.com/lmangani/parsip/blob/fa1fd873199e9933ed56124760c564c8e6c571d7/lib/SIPMessage.js#L311-L321 | train | |
lmangani/parsip | lib/SIPMessage.js | function(name) {
var header = this.headers[Utils.headerize(name)];
if(header) {
if(header[0]) {
return header[0].raw;
}
} else {
return;
}
} | javascript | function(name) {
var header = this.headers[Utils.headerize(name)];
if(header) {
if(header[0]) {
return header[0].raw;
}
} else {
return;
}
} | [
"function",
"(",
"name",
")",
"{",
"var",
"header",
"=",
"this",
".",
"headers",
"[",
"Utils",
".",
"headerize",
"(",
"name",
")",
"]",
";",
"if",
"(",
"header",
")",
"{",
"if",
"(",
"header",
"[",
"0",
"]",
")",
"{",
"return",
"header",
"[",
"... | Get the value of the given header name at the given position. | [
"Get",
"the",
"value",
"of",
"the",
"given",
"header",
"name",
"at",
"the",
"given",
"position",
"."
] | fa1fd873199e9933ed56124760c564c8e6c571d7 | https://github.com/lmangani/parsip/blob/fa1fd873199e9933ed56124760c564c8e6c571d7/lib/SIPMessage.js#L326-L336 | train | |
semibran/pack | lib/pack.js | whitespace | function whitespace(layout) {
var whitespace = layout.size[0] * layout.size[1]
for (var i = 0; i < layout.boxes.length; i++) {
var box = layout.boxes[i]
whitespace -= box.size[0] * box.size[1]
}
return whitespace
} | javascript | function whitespace(layout) {
var whitespace = layout.size[0] * layout.size[1]
for (var i = 0; i < layout.boxes.length; i++) {
var box = layout.boxes[i]
whitespace -= box.size[0] * box.size[1]
}
return whitespace
} | [
"function",
"whitespace",
"(",
"layout",
")",
"{",
"var",
"whitespace",
"=",
"layout",
".",
"size",
"[",
"0",
"]",
"*",
"layout",
".",
"size",
"[",
"1",
"]",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"layout",
".",
"boxes",
".",
"length",
... | determines the amount of whitespace area remaining in `layout` | [
"determines",
"the",
"amount",
"of",
"whitespace",
"area",
"remaining",
"in",
"layout"
] | 27103c7b53111ec96624d926b295b2976ea850af | https://github.com/semibran/pack/blob/27103c7b53111ec96624d926b295b2976ea850af/lib/pack.js#L65-L72 | train |
semibran/pack | lib/pack.js | validate | function validate(boxes, box) {
var a = box
for (var i = 0; i < boxes.length; i++) {
var b = boxes[i]
if (intersects(a, b)) {
return false
}
}
return true
} | javascript | function validate(boxes, box) {
var a = box
for (var i = 0; i < boxes.length; i++) {
var b = boxes[i]
if (intersects(a, b)) {
return false
}
}
return true
} | [
"function",
"validate",
"(",
"boxes",
",",
"box",
")",
"{",
"var",
"a",
"=",
"box",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"boxes",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"b",
"=",
"boxes",
"[",
"i",
"]",
"if",
"(",
"inte... | determines if the region specified by `box` is clear of all other `boxes` | [
"determines",
"if",
"the",
"region",
"specified",
"by",
"box",
"is",
"clear",
"of",
"all",
"other",
"boxes"
] | 27103c7b53111ec96624d926b295b2976ea850af | https://github.com/semibran/pack/blob/27103c7b53111ec96624d926b295b2976ea850af/lib/pack.js#L93-L102 | train |
semibran/pack | lib/pack.js | intersects | function intersects(a, b) {
return a.position[0] < b.position[0] + b.size[0] && a.position[0] + a.size[0] > b.position[0]
&& a.position[1] < b.position[1] + b.size[1] && a.position[1] + a.size[1] > b.position[1]
} | javascript | function intersects(a, b) {
return a.position[0] < b.position[0] + b.size[0] && a.position[0] + a.size[0] > b.position[0]
&& a.position[1] < b.position[1] + b.size[1] && a.position[1] + a.size[1] > b.position[1]
} | [
"function",
"intersects",
"(",
"a",
",",
"b",
")",
"{",
"return",
"a",
".",
"position",
"[",
"0",
"]",
"<",
"b",
".",
"position",
"[",
"0",
"]",
"+",
"b",
".",
"size",
"[",
"0",
"]",
"&&",
"a",
".",
"position",
"[",
"0",
"]",
"+",
"a",
".",... | determines if box `a` and box `b` intersect | [
"determines",
"if",
"box",
"a",
"and",
"box",
"b",
"intersect"
] | 27103c7b53111ec96624d926b295b2976ea850af | https://github.com/semibran/pack/blob/27103c7b53111ec96624d926b295b2976ea850af/lib/pack.js#L105-L108 | train |
lxe/stream-replace | stream-replace.js | replaceStream | function replaceStream(needle, replacer) {
var ts = new Transform();
var chunks = [], len = 0, pos = 0;
ts._transform = function _transform(chunk, enc, cb) {
chunks.push(chunk);
len += chunk.length;
if (pos === 1) {
var data = Buffer.concat(chunks, len)
.toString()
.replace(ne... | javascript | function replaceStream(needle, replacer) {
var ts = new Transform();
var chunks = [], len = 0, pos = 0;
ts._transform = function _transform(chunk, enc, cb) {
chunks.push(chunk);
len += chunk.length;
if (pos === 1) {
var data = Buffer.concat(chunks, len)
.toString()
.replace(ne... | [
"function",
"replaceStream",
"(",
"needle",
",",
"replacer",
")",
"{",
"var",
"ts",
"=",
"new",
"Transform",
"(",
")",
";",
"var",
"chunks",
"=",
"[",
"]",
",",
"len",
"=",
"0",
",",
"pos",
"=",
"0",
";",
"ts",
".",
"_transform",
"=",
"function",
... | Returns a transform stream that replaces
'needle' with 'replacer' in the data piped into it.
All read data is converted ot utf-8 strings before
the replacement isperformed.
Honors needles appearing on chunk boundaries.
Abides by the same rules as String.replace();
@param {String|RegExp} needle needle
@param {... | [
"Returns",
"a",
"transform",
"stream",
"that",
"replaces",
"needle",
"with",
"replacer",
"in",
"the",
"data",
"piped",
"into",
"it",
"."
] | 043595c23b99a262fc07c744f975b0bd3d9689b0 | https://github.com/lxe/stream-replace/blob/043595c23b99a262fc07c744f975b0bd3d9689b0/stream-replace.js#L40-L76 | train |
Mik13/nuki-bridge-api | lib/callback.js | Callback | function Callback (connection, callbackId, callbackUrl, nuki) {
EventEmitter.call(this);
this.connection = connection;
this.nuki = nuki;
this.callbackId = callbackId;
this.url = callbackUrl;
} | javascript | function Callback (connection, callbackId, callbackUrl, nuki) {
EventEmitter.call(this);
this.connection = connection;
this.nuki = nuki;
this.callbackId = callbackId;
this.url = callbackUrl;
} | [
"function",
"Callback",
"(",
"connection",
",",
"callbackId",
",",
"callbackUrl",
",",
"nuki",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"connection",
"=",
"connection",
";",
"this",
".",
"nuki",
"=",
"nuki",
";",
"this",... | The constructor for callbacks via bridge or nuki.
If called from nuki it will emit on it and check the battery level,
otherwise (called from bridge) it will only emit on itself (for every nuki connected to bridge).
@class Callback
@param {Bridge} connection the bridge
@param {Number} callbackId th... | [
"The",
"constructor",
"for",
"callbacks",
"via",
"bridge",
"or",
"nuki",
"."
] | 65e802f5eee2cf9e9c9d1b391b749f4a69648876 | https://github.com/Mik13/nuki-bridge-api/blob/65e802f5eee2cf9e9c9d1b391b749f4a69648876/lib/callback.js#L22-L29 | train |
azusa0127/simple-semaphore | example.js | main | async function main () {
console.log(`\n\n[Single step producer]`);
const workers1 = [
new Producer(100),
new Producer(100),
new Producer(100),
new Producer(100),
new Producer(100),
new Consumer(200),
new Consumer(300),
];
await Promise.all(workers1.map(x => x.work()));
console.lo... | javascript | async function main () {
console.log(`\n\n[Single step producer]`);
const workers1 = [
new Producer(100),
new Producer(100),
new Producer(100),
new Producer(100),
new Producer(100),
new Consumer(200),
new Consumer(300),
];
await Promise.all(workers1.map(x => x.work()));
console.lo... | [
"async",
"function",
"main",
"(",
")",
"{",
"console",
".",
"log",
"(",
"`",
"\\n",
"\\n",
"`",
")",
";",
"const",
"workers1",
"=",
"[",
"new",
"Producer",
"(",
"100",
")",
",",
"new",
"Producer",
"(",
"100",
")",
",",
"new",
"Producer",
"(",
"10... | Async wrapped main function. | [
"Async",
"wrapped",
"main",
"function",
"."
] | db97a7bd4e7d1397143c614d70d02de65f8ff6fe | https://github.com/azusa0127/simple-semaphore/blob/db97a7bd4e7d1397143c614d70d02de65f8ff6fe/example.js#L68-L102 | train |
Mik13/nuki-bridge-api | lib/bridge.js | Bridge | function Bridge (ip, port, token, options) {
if (!(this instanceof Bridge)) {
return new Bridge(ip, port, token);
}
this.ip = ip;
this.port = parseInt(port, 10);
this.token = token;
this.delayBetweenRequests = options && options.delayBetweenRequests || 250;
this.delayer = Promise.resolve();
if (!t... | javascript | function Bridge (ip, port, token, options) {
if (!(this instanceof Bridge)) {
return new Bridge(ip, port, token);
}
this.ip = ip;
this.port = parseInt(port, 10);
this.token = token;
this.delayBetweenRequests = options && options.delayBetweenRequests || 250;
this.delayer = Promise.resolve();
if (!t... | [
"function",
"Bridge",
"(",
"ip",
",",
"port",
",",
"token",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Bridge",
")",
")",
"{",
"return",
"new",
"Bridge",
"(",
"ip",
",",
"port",
",",
"token",
")",
";",
"}",
"this",
".",... | The constructor for a connection to a bridge.
@class Bridge
@param {String} ip the ip of the bridge
@param {String} port the port of the bridge
@param {String} token the token of the bridge
@param {Object} [options] ... | [
"The",
"constructor",
"for",
"a",
"connection",
"to",
"a",
"bridge",
"."
] | 65e802f5eee2cf9e9c9d1b391b749f4a69648876 | https://github.com/Mik13/nuki-bridge-api/blob/65e802f5eee2cf9e9c9d1b391b749f4a69648876/lib/bridge.js#L18-L32 | train |
slickplaid/node-slack-mailgun | lib/mailgun-verify.js | verifyMailgun | function verifyMailgun(apikey, token, timestamp, signature) {
var data = [timestamp, token].join('');
var hmac = crypto.createHmac('sha256', apikey).update(data);
var ourSig = hmac.digest('hex');
var output = {
apikey: apikey,
token: token,
timestamp: timestamp,
signature: signature,
genera... | javascript | function verifyMailgun(apikey, token, timestamp, signature) {
var data = [timestamp, token].join('');
var hmac = crypto.createHmac('sha256', apikey).update(data);
var ourSig = hmac.digest('hex');
var output = {
apikey: apikey,
token: token,
timestamp: timestamp,
signature: signature,
genera... | [
"function",
"verifyMailgun",
"(",
"apikey",
",",
"token",
",",
"timestamp",
",",
"signature",
")",
"{",
"var",
"data",
"=",
"[",
"timestamp",
",",
"token",
"]",
".",
"join",
"(",
"''",
")",
";",
"var",
"hmac",
"=",
"crypto",
".",
"createHmac",
"(",
"... | Verify mailgun HMAC authentication token | [
"Verify",
"mailgun",
"HMAC",
"authentication",
"token"
] | 54e523336a85e69766e4d6a2f6a308ebdd0869e9 | https://github.com/slickplaid/node-slack-mailgun/blob/54e523336a85e69766e4d6a2f6a308ebdd0869e9/lib/mailgun-verify.js#L27-L42 | train |
brycebaril/timestreamdb | timestreamdb.js | TimestreamDB | function TimestreamDB(instance, options) {
if (!(this instanceof TimestreamDB))
return new TimestreamDB(instance, options)
var db = Version(instance, options)
db.ts = function (key, options) {
var opts = {reverse: true}
if (options.start) opts.minVersion = options.start
if (options.until) opts.... | javascript | function TimestreamDB(instance, options) {
if (!(this instanceof TimestreamDB))
return new TimestreamDB(instance, options)
var db = Version(instance, options)
db.ts = function (key, options) {
var opts = {reverse: true}
if (options.start) opts.minVersion = options.start
if (options.until) opts.... | [
"function",
"TimestreamDB",
"(",
"instance",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"TimestreamDB",
")",
")",
"return",
"new",
"TimestreamDB",
"(",
"instance",
",",
"options",
")",
"var",
"db",
"=",
"Version",
"(",
"instance",... | Create a new TimestreamDB
@param {LevelUp} instance A LevelUp instance
@param {object} options Configuration options for level-version | [
"Create",
"a",
"new",
"TimestreamDB"
] | cebb50ea8d09f39c70937b0ba8e34020025e216e | https://github.com/brycebaril/timestreamdb/blob/cebb50ea8d09f39c70937b0ba8e34020025e216e/timestreamdb.js#L33-L49 | train |
Erudika/para-client-js | lib/Constraint.js | Constraint | function Constraint(constraintName, constraintPayload) {
var name = constraintName;
var payload = constraintPayload;
/**
* The constraint name.
* @returns {String} a name
*/
this.getName = function () {
return name;
};
/**
* Sets the name of the constraint.
* @param {String} n name
*/
this.setNam... | javascript | function Constraint(constraintName, constraintPayload) {
var name = constraintName;
var payload = constraintPayload;
/**
* The constraint name.
* @returns {String} a name
*/
this.getName = function () {
return name;
};
/**
* Sets the name of the constraint.
* @param {String} n name
*/
this.setNam... | [
"function",
"Constraint",
"(",
"constraintName",
",",
"constraintPayload",
")",
"{",
"var",
"name",
"=",
"constraintName",
";",
"var",
"payload",
"=",
"constraintPayload",
";",
"/**\n\t * The constraint name.\n\t * @returns {String} a name\n\t */",
"this",
".",
"getName",
... | Represents a validation constraint.
@author Alex Bogdanovski [alex@erudika.com]
@param {String} constraintName name
@param {Object} constraintPayload payload
@returns {Constraint} | [
"Represents",
"a",
"validation",
"constraint",
"."
] | 6bcbe7b206ea2b50e65615048b06b43a1fad19f0 | https://github.com/Erudika/para-client-js/blob/6bcbe7b206ea2b50e65615048b06b43a1fad19f0/lib/Constraint.js#L29-L64 | train |
jackzampolin/influx-express | index.js | function (options) {
if (options.username && options.password) {
return (options.protocol + "://" + options.username + ":" + options.password + "@" + options.host + ":" + options.port + "/" + options.database)
}
return (options.protocol + "://" + options.host + ":" + options.port + "/" + options.datab... | javascript | function (options) {
if (options.username && options.password) {
return (options.protocol + "://" + options.username + ":" + options.password + "@" + options.host + ":" + options.port + "/" + options.database)
}
return (options.protocol + "://" + options.host + ":" + options.port + "/" + options.datab... | [
"function",
"(",
"options",
")",
"{",
"if",
"(",
"options",
".",
"username",
"&&",
"options",
".",
"password",
")",
"{",
"return",
"(",
"options",
".",
"protocol",
"+",
"\"://\"",
"+",
"options",
".",
"username",
"+",
"\":\"",
"+",
"options",
".",
"pas... | This is a convinence function for creating the InfluxDB connection string | [
"This",
"is",
"a",
"convinence",
"function",
"for",
"creating",
"the",
"InfluxDB",
"connection",
"string"
] | 599ba9a2485fc6fd2f6bcd434f9d6818c094a497 | https://github.com/jackzampolin/influx-express/blob/599ba9a2485fc6fd2f6bcd434f9d6818c094a497/index.js#L20-L25 | train | |
jackzampolin/influx-express | index.js | function () {
var len = this.points.length
// Check the length of the point buffer
if (len >= options.batchSize) {
// Write the points and log error if any
client.writePoints(this.points).catch(function (error) {
console.log(error.message)
})
// Reset point buff... | javascript | function () {
var len = this.points.length
// Check the length of the point buffer
if (len >= options.batchSize) {
// Write the points and log error if any
client.writePoints(this.points).catch(function (error) {
console.log(error.message)
})
// Reset point buff... | [
"function",
"(",
")",
"{",
"var",
"len",
"=",
"this",
".",
"points",
".",
"length",
"// Check the length of the point buffer",
"if",
"(",
"len",
">=",
"options",
".",
"batchSize",
")",
"{",
"// Write the points and log error if any",
"client",
".",
"writePoints",
... | When each point is added check the size of the batch and send if >= batchSize | [
"When",
"each",
"point",
"is",
"added",
"check",
"the",
"size",
"of",
"the",
"batch",
"and",
"send",
"if",
">",
"=",
"batchSize"
] | 599ba9a2485fc6fd2f6bcd434f9d6818c094a497 | https://github.com/jackzampolin/influx-express/blob/599ba9a2485fc6fd2f6bcd434f9d6818c094a497/index.js#L36-L49 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.