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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
citronneur/node-rdpjs | lib/protocol/t125/gcc.js | clientCoreData | function clientCoreData(opt) {
var self = {
__TYPE__ : MessageType.CS_CORE,
rdpVersion : new type.UInt32Le(VERSION.RDP_VERSION_5_PLUS),
desktopWidth : new type.UInt16Le(1280),
desktopHeight : new type.UInt16Le(800),
colorDepth : new type.UInt16Le(ColorDepth.RNS_UD_COLOR_8BPP),
sasSequence : new type.UInt16... | javascript | function clientCoreData(opt) {
var self = {
__TYPE__ : MessageType.CS_CORE,
rdpVersion : new type.UInt32Le(VERSION.RDP_VERSION_5_PLUS),
desktopWidth : new type.UInt16Le(1280),
desktopHeight : new type.UInt16Le(800),
colorDepth : new type.UInt16Le(ColorDepth.RNS_UD_COLOR_8BPP),
sasSequence : new type.UInt16... | [
"function",
"clientCoreData",
"(",
"opt",
")",
"{",
"var",
"self",
"=",
"{",
"__TYPE__",
":",
"MessageType",
".",
"CS_CORE",
",",
"rdpVersion",
":",
"new",
"type",
".",
"UInt32Le",
"(",
"VERSION",
".",
"RDP_VERSION_5_PLUS",
")",
",",
"desktopWidth",
":",
"... | Main client informations
keyboard
screen definition
color depth
@see http://msdn.microsoft.com/en-us/library/cc240510.aspx
@param opt {object} Classic type options
@returns {type.Component} | [
"Main",
"client",
"informations",
"keyboard",
"screen",
"definition",
"color",
"depth"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/t125/gcc.js#L263-L291 | train |
citronneur/node-rdpjs | lib/protocol/t125/gcc.js | settings | function settings(blocks, opt) {
var self = {
blocks : blocks || new type.Factory(function(s) {
self.blocks = new type.Component([]);
// read until end of stream
while(s.availableLength() > 0) {
self.blocks.obj.push(block().read(s));
}
}),
};
return new type.Component(self, opt);
} | javascript | function settings(blocks, opt) {
var self = {
blocks : blocks || new type.Factory(function(s) {
self.blocks = new type.Component([]);
// read until end of stream
while(s.availableLength() > 0) {
self.blocks.obj.push(block().read(s));
}
}),
};
return new type.Component(self, opt);
} | [
"function",
"settings",
"(",
"blocks",
",",
"opt",
")",
"{",
"var",
"self",
"=",
"{",
"blocks",
":",
"blocks",
"||",
"new",
"type",
".",
"Factory",
"(",
"function",
"(",
"s",
")",
"{",
"self",
".",
"blocks",
"=",
"new",
"type",
".",
"Component",
"(... | Client or server GCC settings block
@param blocks {type.Component} array of gcc blocks
@param opt {object} options to component type
@returns {type.Component} | [
"Client",
"or",
"server",
"GCC",
"settings",
"block"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/t125/gcc.js#L409-L421 | train |
citronneur/node-rdpjs | lib/protocol/t125/gcc.js | readConferenceCreateResponse | function readConferenceCreateResponse(s) {
per.readChoice(s);
if(!per.readObjectIdentifier(s, t124_02_98_oid)) {
throw new error.ProtocolError('NODE_RDP_PROTOCOL_T125_GCC_BAD_OBJECT_IDENTIFIER_T124');
}
per.readLength(s);
per.readChoice(s);
per.readInteger16(s, 1001);
per.readInteger(s);
per.readEnumerate... | javascript | function readConferenceCreateResponse(s) {
per.readChoice(s);
if(!per.readObjectIdentifier(s, t124_02_98_oid)) {
throw new error.ProtocolError('NODE_RDP_PROTOCOL_T125_GCC_BAD_OBJECT_IDENTIFIER_T124');
}
per.readLength(s);
per.readChoice(s);
per.readInteger16(s, 1001);
per.readInteger(s);
per.readEnumerate... | [
"function",
"readConferenceCreateResponse",
"(",
"s",
")",
"{",
"per",
".",
"readChoice",
"(",
"s",
")",
";",
"if",
"(",
"!",
"per",
".",
"readObjectIdentifier",
"(",
"s",
",",
"t124_02_98_oid",
")",
")",
"{",
"throw",
"new",
"error",
".",
"ProtocolError",... | Read GCC response from server
@param s {type.Stream} current stream
@returns {Array(type.Component)} list of server block | [
"Read",
"GCC",
"response",
"from",
"server"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/t125/gcc.js#L428-L454 | train |
citronneur/node-rdpjs | lib/protocol/t125/gcc.js | readConferenceCreateRequest | function readConferenceCreateRequest (s) {
per.readChoice(s);
if (!per.readObjectIdentifier(s, t124_02_98_oid)) {
throw new error.ProtocolError('NODE_RDP_PROTOCOL_T125_GCC_BAD_H221_SC_KEY');
}
per.readLength(s);
per.readChoice(s);
per.readSelection(s);
per.readNumericString(s, 1);
per.readPadding(s, 1);
if ... | javascript | function readConferenceCreateRequest (s) {
per.readChoice(s);
if (!per.readObjectIdentifier(s, t124_02_98_oid)) {
throw new error.ProtocolError('NODE_RDP_PROTOCOL_T125_GCC_BAD_H221_SC_KEY');
}
per.readLength(s);
per.readChoice(s);
per.readSelection(s);
per.readNumericString(s, 1);
per.readPadding(s, 1);
if ... | [
"function",
"readConferenceCreateRequest",
"(",
"s",
")",
"{",
"per",
".",
"readChoice",
"(",
"s",
")",
";",
"if",
"(",
"!",
"per",
".",
"readObjectIdentifier",
"(",
"s",
",",
"t124_02_98_oid",
")",
")",
"{",
"throw",
"new",
"error",
".",
"ProtocolError",
... | Read GCC request
@param s {type.Stream}
@returns {Array(type.Component)} list of client block | [
"Read",
"GCC",
"request"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/t125/gcc.js#L461-L489 | train |
citronneur/node-rdpjs | lib/protocol/cert.js | certBlob | function certBlob() {
var self = {
cbCert : new type.UInt32Le(function() {
return self.abCert.size();
}),
abCert : new type.BinaryString(null, { readLength : new type.CallableValue(function() {
return self.cbCert.value;
}) })
};
return new type.Component(self);
} | javascript | function certBlob() {
var self = {
cbCert : new type.UInt32Le(function() {
return self.abCert.size();
}),
abCert : new type.BinaryString(null, { readLength : new type.CallableValue(function() {
return self.cbCert.value;
}) })
};
return new type.Component(self);
} | [
"function",
"certBlob",
"(",
")",
"{",
"var",
"self",
"=",
"{",
"cbCert",
":",
"new",
"type",
".",
"UInt32Le",
"(",
"function",
"(",
")",
"{",
"return",
"self",
".",
"abCert",
".",
"size",
"(",
")",
";",
"}",
")",
",",
"abCert",
":",
"new",
"type... | For x509 certificate
@see http://msdn.microsoft.com/en-us/library/cc241911.aspx
@returns {type.Component} | [
"For",
"x509",
"certificate"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/cert.js#L100-L111 | train |
citronneur/node-rdpjs | lib/protocol/cert.js | x509CertificateChain | function x509CertificateChain() {
var self = {
__TYPE__ : CertificateType.CERT_CHAIN_VERSION_2,
NumCertBlobs : new type.UInt32Le(),
CertBlobArray : new type.Factory(function(s) {
self.CertBlobArray = new type.Component([]);
for(var i = 0; i < self.NumCertBlobs.value; i++) {
self... | javascript | function x509CertificateChain() {
var self = {
__TYPE__ : CertificateType.CERT_CHAIN_VERSION_2,
NumCertBlobs : new type.UInt32Le(),
CertBlobArray : new type.Factory(function(s) {
self.CertBlobArray = new type.Component([]);
for(var i = 0; i < self.NumCertBlobs.value; i++) {
self... | [
"function",
"x509CertificateChain",
"(",
")",
"{",
"var",
"self",
"=",
"{",
"__TYPE__",
":",
"CertificateType",
".",
"CERT_CHAIN_VERSION_2",
",",
"NumCertBlobs",
":",
"new",
"type",
".",
"UInt32Le",
"(",
")",
",",
"CertBlobArray",
":",
"new",
"type",
".",
"F... | x509 certificate chain
@see http://msdn.microsoft.com/en-us/library/cc241910.aspx
@returns {type.Component} | [
"x509",
"certificate",
"chain"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/cert.js#L118-L143 | train |
citronneur/node-rdpjs | lib/protocol/t125/mcs.js | MCS | function MCS(transport, recvOpCode, sendOpCode) {
this.transport = transport;
this.recvOpCode = recvOpCode;
this.sendOpCode = sendOpCode;
this.channels = [{id : Channel.MCS_GLOBAL_CHANNEL, name : 'global'}];
this.channels.find = function(callback) {
for(var i in this) {
if(callback(this[i])) return this[i];
... | javascript | function MCS(transport, recvOpCode, sendOpCode) {
this.transport = transport;
this.recvOpCode = recvOpCode;
this.sendOpCode = sendOpCode;
this.channels = [{id : Channel.MCS_GLOBAL_CHANNEL, name : 'global'}];
this.channels.find = function(callback) {
for(var i in this) {
if(callback(this[i])) return this[i];
... | [
"function",
"MCS",
"(",
"transport",
",",
"recvOpCode",
",",
"sendOpCode",
")",
"{",
"this",
".",
"transport",
"=",
"transport",
";",
"this",
".",
"recvOpCode",
"=",
"recvOpCode",
";",
"this",
".",
"sendOpCode",
"=",
"sendOpCode",
";",
"this",
".",
"channe... | Multi-Channel Services
@param transport {events.EventEmitter} transport layer listen (connect, data) events
@param recvOpCode {DomainMCSPDU} opcode use in receive automata
@param sendOpCode {DomainMCSPDU} opcode use to send message | [
"Multi",
"-",
"Channel",
"Services"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/t125/mcs.js#L125-L143 | train |
citronneur/node-rdpjs | lib/protocol/t125/mcs.js | Client | function Client(transport) {
MCS.call(this, transport, DomainMCSPDU.SEND_DATA_INDICATION, DomainMCSPDU.SEND_DATA_REQUEST);
// channel context automata
this.channelsConnected = 0;
// init gcc information
this.clientCoreData = gcc.clientCoreData();
this.clientNetworkData = gcc.clientNetworkData(new type.Compone... | javascript | function Client(transport) {
MCS.call(this, transport, DomainMCSPDU.SEND_DATA_INDICATION, DomainMCSPDU.SEND_DATA_REQUEST);
// channel context automata
this.channelsConnected = 0;
// init gcc information
this.clientCoreData = gcc.clientCoreData();
this.clientNetworkData = gcc.clientNetworkData(new type.Compone... | [
"function",
"Client",
"(",
"transport",
")",
"{",
"MCS",
".",
"call",
"(",
"this",
",",
"transport",
",",
"DomainMCSPDU",
".",
"SEND_DATA_INDICATION",
",",
"DomainMCSPDU",
".",
"SEND_DATA_REQUEST",
")",
";",
"// channel context automata",
"this",
".",
"channelsCon... | Only main channels handle actually
@param transport {event.EventEmitter} bind connect and data events
@returns | [
"Only",
"main",
"channels",
"handle",
"actually"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/t125/mcs.js#L203-L223 | train |
citronneur/node-rdpjs | lib/protocol/t125/mcs.js | Server | function Server (transport) {
MCS.call(this, transport, DomainMCSPDU.SEND_DATA_REQUEST, DomainMCSPDU.SEND_DATA_INDICATION);
// must be readed from protocol
this.clientCoreData = null;
this.clientNetworkData = null;
this.clientSecurityData = null;
// init gcc information
this.serverCoreData = gcc.serverCoreDa... | javascript | function Server (transport) {
MCS.call(this, transport, DomainMCSPDU.SEND_DATA_REQUEST, DomainMCSPDU.SEND_DATA_INDICATION);
// must be readed from protocol
this.clientCoreData = null;
this.clientNetworkData = null;
this.clientSecurityData = null;
// init gcc information
this.serverCoreData = gcc.serverCoreDa... | [
"function",
"Server",
"(",
"transport",
")",
"{",
"MCS",
".",
"call",
"(",
"this",
",",
"transport",
",",
"DomainMCSPDU",
".",
"SEND_DATA_REQUEST",
",",
"DomainMCSPDU",
".",
"SEND_DATA_INDICATION",
")",
";",
"// must be readed from protocol",
"this",
".",
"clientC... | Server side of MCS layer
@param transport | [
"Server",
"side",
"of",
"MCS",
"layer"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/t125/mcs.js#L414-L433 | train |
citronneur/node-rdpjs | lib/protocol/tpkt.js | TPKT | function TPKT(transport) {
this.transport = transport;
// wait 2 bytes
this.transport.expect(2);
// next state is receive header
var self = this;
this.transport.once('data', function(s) {
self.recvHeader(s);
}).on('close', function() {
self.emit('close');
}).on('error', function (err) {
self.emit('error',... | javascript | function TPKT(transport) {
this.transport = transport;
// wait 2 bytes
this.transport.expect(2);
// next state is receive header
var self = this;
this.transport.once('data', function(s) {
self.recvHeader(s);
}).on('close', function() {
self.emit('close');
}).on('error', function (err) {
self.emit('error',... | [
"function",
"TPKT",
"(",
"transport",
")",
"{",
"this",
".",
"transport",
"=",
"transport",
";",
"// wait 2 bytes",
"this",
".",
"transport",
".",
"expect",
"(",
"2",
")",
";",
"// next state is receive header",
"var",
"self",
"=",
"this",
";",
"this",
".",
... | TPKT layer of rdp stack | [
"TPKT",
"layer",
"of",
"rdp",
"stack"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/tpkt.js#L38-L51 | train |
citronneur/node-rdpjs | lib/protocol/pdu/lic.js | licenseBinaryBlob | function licenseBinaryBlob(blobType) {
blobType = blobType || BinaryBlobType.BB_ANY_BLOB;
var self = {
wBlobType : new type.UInt16Le(blobType, { constant : (blobType === BinaryBlobType.BB_ANY_BLOB)?false:true }),
wBlobLen : new type.UInt16Le(function() {
return self.blobData.size();
}),
... | javascript | function licenseBinaryBlob(blobType) {
blobType = blobType || BinaryBlobType.BB_ANY_BLOB;
var self = {
wBlobType : new type.UInt16Le(blobType, { constant : (blobType === BinaryBlobType.BB_ANY_BLOB)?false:true }),
wBlobLen : new type.UInt16Le(function() {
return self.blobData.size();
}),
... | [
"function",
"licenseBinaryBlob",
"(",
"blobType",
")",
"{",
"blobType",
"=",
"blobType",
"||",
"BinaryBlobType",
".",
"BB_ANY_BLOB",
";",
"var",
"self",
"=",
"{",
"wBlobType",
":",
"new",
"type",
".",
"UInt16Le",
"(",
"blobType",
",",
"{",
"constant",
":",
... | Binary blob to emcompass license information
@see http://msdn.microsoft.com/en-us/library/cc240481.aspx
@param blobType {BinaryBlobType.*}
@returns {type.Component} | [
"Binary",
"blob",
"to",
"emcompass",
"license",
"information"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/pdu/lic.js#L86-L99 | train |
citronneur/node-rdpjs | lib/protocol/pdu/lic.js | licensingErrorMessage | function licensingErrorMessage(opt) {
var self = {
__TYPE__ : MessageType.ERROR_ALERT,
dwErrorCode : new type.UInt32Le(),
dwStateTransition : new type.UInt32Le(),
blob : licenseBinaryBlob(BinaryBlobType.BB_ANY_BLOB)
};
return new type.Component(self, opt);
} | javascript | function licensingErrorMessage(opt) {
var self = {
__TYPE__ : MessageType.ERROR_ALERT,
dwErrorCode : new type.UInt32Le(),
dwStateTransition : new type.UInt32Le(),
blob : licenseBinaryBlob(BinaryBlobType.BB_ANY_BLOB)
};
return new type.Component(self, opt);
} | [
"function",
"licensingErrorMessage",
"(",
"opt",
")",
"{",
"var",
"self",
"=",
"{",
"__TYPE__",
":",
"MessageType",
".",
"ERROR_ALERT",
",",
"dwErrorCode",
":",
"new",
"type",
".",
"UInt32Le",
"(",
")",
",",
"dwStateTransition",
":",
"new",
"type",
".",
"U... | Error message in license PDU automata
@see http://msdn.microsoft.com/en-us/library/cc240482.aspx
@param opt {object} type options
@returns {type.Component} | [
"Error",
"message",
"in",
"license",
"PDU",
"automata"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/pdu/lic.js#L107-L116 | train |
citronneur/node-rdpjs | lib/protocol/pdu/lic.js | productInformation | function productInformation() {
var self = {
dwVersion : new type.UInt32Le(),
cbCompanyName : new type.UInt32Le(function() {
return self.pbCompanyName.size();
}),
// may contain "Microsoft Corporation" from server microsoft
pbCompanyName : new type.BinaryString(new Buffer('Mi... | javascript | function productInformation() {
var self = {
dwVersion : new type.UInt32Le(),
cbCompanyName : new type.UInt32Le(function() {
return self.pbCompanyName.size();
}),
// may contain "Microsoft Corporation" from server microsoft
pbCompanyName : new type.BinaryString(new Buffer('Mi... | [
"function",
"productInformation",
"(",
")",
"{",
"var",
"self",
"=",
"{",
"dwVersion",
":",
"new",
"type",
".",
"UInt32Le",
"(",
")",
",",
"cbCompanyName",
":",
"new",
"type",
".",
"UInt32Le",
"(",
"function",
"(",
")",
"{",
"return",
"self",
".",
"pbC... | License product informations
@see http://msdn.microsoft.com/en-us/library/cc241915.aspx
@returns {type.Component} | [
"License",
"product",
"informations"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/pdu/lic.js#L123-L143 | train |
citronneur/node-rdpjs | lib/protocol/pdu/lic.js | licensePacket | function licensePacket(message) {
var self = {
bMsgtype : new type.UInt8(function() {
return self.licensingMessage.obj.__TYPE__;
}),
flag : new type.UInt8(Preambule.PREAMBLE_VERSION_3_0),
wMsgSize : new type.UInt16Le(function() {
return new type.Component(self).size();
}),
... | javascript | function licensePacket(message) {
var self = {
bMsgtype : new type.UInt8(function() {
return self.licensingMessage.obj.__TYPE__;
}),
flag : new type.UInt8(Preambule.PREAMBLE_VERSION_3_0),
wMsgSize : new type.UInt16Le(function() {
return new type.Component(self).size();
}),
... | [
"function",
"licensePacket",
"(",
"message",
")",
"{",
"var",
"self",
"=",
"{",
"bMsgtype",
":",
"new",
"type",
".",
"UInt8",
"(",
"function",
"(",
")",
"{",
"return",
"self",
".",
"licensingMessage",
".",
"obj",
".",
"__TYPE__",
";",
"}",
")",
",",
... | Global license packet
@param packet {type.* | null} send packet
@returns {type.Component} | [
"Global",
"license",
"packet"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/pdu/lic.js#L254-L297 | train |
jhnns/rewire | lib/moduleEnv.js | requireProxy | function requireProxy(path) {
reset();
currentModule.require = nodeRequire;
return nodeRequire.call(currentModule, path); // node's require only works when "this" points to the module
} | javascript | function requireProxy(path) {
reset();
currentModule.require = nodeRequire;
return nodeRequire.call(currentModule, path); // node's require only works when "this" points to the module
} | [
"function",
"requireProxy",
"(",
"path",
")",
"{",
"reset",
"(",
")",
";",
"currentModule",
".",
"require",
"=",
"nodeRequire",
";",
"return",
"nodeRequire",
".",
"call",
"(",
"currentModule",
",",
"path",
")",
";",
"// node's require only works when \"this\" poin... | Proxies the first require call in order to draw back all changes to the Module.wrapper.
Thus our changes don't influence other modules
@param {!String} path | [
"Proxies",
"the",
"first",
"require",
"call",
"in",
"order",
"to",
"draw",
"back",
"all",
"changes",
"to",
"the",
"Module",
".",
"wrapper",
".",
"Thus",
"our",
"changes",
"don",
"t",
"influence",
"other",
"modules"
] | 5bea3d816d0258e5204f1b49b08b9fb302ac53e1 | https://github.com/jhnns/rewire/blob/5bea3d816d0258e5204f1b49b08b9fb302ac53e1/lib/moduleEnv.js#L77-L81 | train |
jhnns/rewire | lib/getImportGlobalsSrc.js | getImportGlobalsSrc | function getImportGlobalsSrc(ignore) {
var key,
value,
src = "",
globalObj = typeof global === "undefined"? window: global;
ignore = ignore || [];
// global itself can't be overridden because it's the only reference to our real global objects
ignore.push("global");
// ignore... | javascript | function getImportGlobalsSrc(ignore) {
var key,
value,
src = "",
globalObj = typeof global === "undefined"? window: global;
ignore = ignore || [];
// global itself can't be overridden because it's the only reference to our real global objects
ignore.push("global");
// ignore... | [
"function",
"getImportGlobalsSrc",
"(",
"ignore",
")",
"{",
"var",
"key",
",",
"value",
",",
"src",
"=",
"\"\"",
",",
"globalObj",
"=",
"typeof",
"global",
"===",
"\"undefined\"",
"?",
"window",
":",
"global",
";",
"ignore",
"=",
"ignore",
"||",
"[",
"]"... | Declares all globals with a var and assigns the global object. Thus you're able to
override globals without changing the global object itself.
Returns something like
"var console = global.console; var process = global.process; ..."
@return {String} | [
"Declares",
"all",
"globals",
"with",
"a",
"var",
"and",
"assigns",
"the",
"global",
"object",
".",
"Thus",
"you",
"re",
"able",
"to",
"override",
"globals",
"without",
"changing",
"the",
"global",
"object",
"itself",
"."
] | 5bea3d816d0258e5204f1b49b08b9fb302ac53e1 | https://github.com/jhnns/rewire/blob/5bea3d816d0258e5204f1b49b08b9fb302ac53e1/lib/getImportGlobalsSrc.js#L10-L38 | train |
jhnns/rewire | lib/detectStrictMode.js | detectStrictMode | function detectStrictMode(src) {
var singleLine;
var multiLine;
while ((singleLine = singleLineComment.test(src)) || (multiLine = multiLineComment.test(src))) {
if (singleLine) {
src = src.replace(singleLineComment, "");
}
if (multiLine) {
src = src.... | javascript | function detectStrictMode(src) {
var singleLine;
var multiLine;
while ((singleLine = singleLineComment.test(src)) || (multiLine = multiLineComment.test(src))) {
if (singleLine) {
src = src.replace(singleLineComment, "");
}
if (multiLine) {
src = src.... | [
"function",
"detectStrictMode",
"(",
"src",
")",
"{",
"var",
"singleLine",
";",
"var",
"multiLine",
";",
"while",
"(",
"(",
"singleLine",
"=",
"singleLineComment",
".",
"test",
"(",
"src",
")",
")",
"||",
"(",
"multiLine",
"=",
"multiLineComment",
".",
"te... | Returns true if the source code is intended to run in strict mode. Does not detect
"use strict" if it occurs in a nested function.
@param {String} src
@return {Boolean} | [
"Returns",
"true",
"if",
"the",
"source",
"code",
"is",
"intended",
"to",
"run",
"in",
"strict",
"mode",
".",
"Does",
"not",
"detect",
"use",
"strict",
"if",
"it",
"occurs",
"in",
"a",
"nested",
"function",
"."
] | 5bea3d816d0258e5204f1b49b08b9fb302ac53e1 | https://github.com/jhnns/rewire/blob/5bea3d816d0258e5204f1b49b08b9fb302ac53e1/lib/detectStrictMode.js#L12-L26 | train |
jhnns/rewire | lib/rewire.js | internalRewire | function internalRewire(parentModulePath, targetPath) {
var targetModule,
prelude,
appendix,
src;
// Checking params
if (typeof targetPath !== "string") {
throw new TypeError("Filename must be a string");
}
// Resolve full filename relative to the parent module
... | javascript | function internalRewire(parentModulePath, targetPath) {
var targetModule,
prelude,
appendix,
src;
// Checking params
if (typeof targetPath !== "string") {
throw new TypeError("Filename must be a string");
}
// Resolve full filename relative to the parent module
... | [
"function",
"internalRewire",
"(",
"parentModulePath",
",",
"targetPath",
")",
"{",
"var",
"targetModule",
",",
"prelude",
",",
"appendix",
",",
"src",
";",
"// Checking params",
"if",
"(",
"typeof",
"targetPath",
"!==",
"\"string\"",
")",
"{",
"throw",
"new",
... | Does actual rewiring the module. For further documentation @see index.js | [
"Does",
"actual",
"rewiring",
"the",
"module",
".",
"For",
"further",
"documentation"
] | 5bea3d816d0258e5204f1b49b08b9fb302ac53e1 | https://github.com/jhnns/rewire/blob/5bea3d816d0258e5204f1b49b08b9fb302ac53e1/lib/rewire.js#L11-L52 | train |
GroceriStar/groceristar-fetch | src/projects/GroceriStar/groceristar.js | function () {
return _.map(groceries, item => {
const object = {
id: item.id,
name: item.name,
departmentsCount: item.departments.length
}
delete object.departments // @TODO ????
return object
})
} | javascript | function () {
return _.map(groceries, item => {
const object = {
id: item.id,
name: item.name,
departmentsCount: item.departments.length
}
delete object.departments // @TODO ????
return object
})
} | [
"function",
"(",
")",
"{",
"return",
"_",
".",
"map",
"(",
"groceries",
",",
"item",
"=>",
"{",
"const",
"object",
"=",
"{",
"id",
":",
"item",
".",
"id",
",",
"name",
":",
"item",
".",
"name",
",",
"departmentsCount",
":",
"item",
".",
"department... | strange turnaround. @TODO can we | [
"strange",
"turnaround",
"."
] | 463012c2053f8fdc188c38ecd454f1d240819656 | https://github.com/GroceriStar/groceristar-fetch/blob/463012c2053f8fdc188c38ecd454f1d240819656/src/projects/GroceriStar/groceristar.js#L169-L180 | train | |
GroceriStar/groceristar-fetch | src/projects/GroceriStar/groceristar.js | function () {
const departments = []
// @TODO this is an example what should be updated. loooooks so bad and unreadable
_.forEach(_.range(0, groceries.length), value =>
departments.push(..._.map(groceries[value]['departments']))
)
return departments
} | javascript | function () {
const departments = []
// @TODO this is an example what should be updated. loooooks so bad and unreadable
_.forEach(_.range(0, groceries.length), value =>
departments.push(..._.map(groceries[value]['departments']))
)
return departments
} | [
"function",
"(",
")",
"{",
"const",
"departments",
"=",
"[",
"]",
"// @TODO this is an example what should be updated. loooooks so bad and unreadable",
"_",
".",
"forEach",
"(",
"_",
".",
"range",
"(",
"0",
",",
"groceries",
".",
"length",
")",
",",
"value",
"=>",... | i assume this cannot work, because we don't have groceries variable... @TODO | [
"i",
"assume",
"this",
"cannot",
"work",
"because",
"we",
"don",
"t",
"have",
"groceries",
"variable",
"..."
] | 463012c2053f8fdc188c38ecd454f1d240819656 | https://github.com/GroceriStar/groceristar-fetch/blob/463012c2053f8fdc188c38ecd454f1d240819656/src/projects/GroceriStar/groceristar.js#L183-L191 | train | |
matreshkajs/matreshka | src/on/_addtreelistener.js | createTreeListener | function createTreeListener({ handler, restPath }) {
const newHandler = function treeListener(changeEvent) {
const extendedChangeEvent = {
restPath,
...changeEvent
};
const { previousValue, value } = changeEvent;
// removes listener for all branches of the pa... | javascript | function createTreeListener({ handler, restPath }) {
const newHandler = function treeListener(changeEvent) {
const extendedChangeEvent = {
restPath,
...changeEvent
};
const { previousValue, value } = changeEvent;
// removes listener for all branches of the pa... | [
"function",
"createTreeListener",
"(",
"{",
"handler",
",",
"restPath",
"}",
")",
"{",
"const",
"newHandler",
"=",
"function",
"treeListener",
"(",
"changeEvent",
")",
"{",
"const",
"extendedChangeEvent",
"=",
"{",
"restPath",
",",
"...",
"changeEvent",
"}",
"... | creates tree listener | [
"creates",
"tree",
"listener"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/on/_addtreelistener.js#L5-L30 | train |
matreshkajs/matreshka | src/instantiate.js | defaultUpdateFunction | function defaultUpdateFunction(instance, data) {
if (instance.isMatreshkaArray) {
instance.recreate(data);
} else if (instance.isMatreshkaObject) {
instance.setData(data, { replaceData: true });
} else {
// for other objects just extend them with given data
nofn.assign(instan... | javascript | function defaultUpdateFunction(instance, data) {
if (instance.isMatreshkaArray) {
instance.recreate(data);
} else if (instance.isMatreshkaObject) {
instance.setData(data, { replaceData: true });
} else {
// for other objects just extend them with given data
nofn.assign(instan... | [
"function",
"defaultUpdateFunction",
"(",
"instance",
",",
"data",
")",
"{",
"if",
"(",
"instance",
".",
"isMatreshkaArray",
")",
"{",
"instance",
".",
"recreate",
"(",
"data",
")",
";",
"}",
"else",
"if",
"(",
"instance",
".",
"isMatreshkaObject",
")",
"{... | the function is used when no update function is given | [
"the",
"function",
"is",
"used",
"when",
"no",
"update",
"function",
"is",
"given"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/instantiate.js#L5-L14 | train |
matreshkajs/matreshka | src/instantiate.js | createInstantiateMediator | function createInstantiateMediator({
UsedClass,
updateFunction
}) {
return function mediator(value, previousValue, key, object) {
if (previousValue instanceof UsedClass) {
updateFunction.call(object, previousValue, value, key);
return previousValue;
}
return ... | javascript | function createInstantiateMediator({
UsedClass,
updateFunction
}) {
return function mediator(value, previousValue, key, object) {
if (previousValue instanceof UsedClass) {
updateFunction.call(object, previousValue, value, key);
return previousValue;
}
return ... | [
"function",
"createInstantiateMediator",
"(",
"{",
"UsedClass",
",",
"updateFunction",
"}",
")",
"{",
"return",
"function",
"mediator",
"(",
"value",
",",
"previousValue",
",",
"key",
",",
"object",
")",
"{",
"if",
"(",
"previousValue",
"instanceof",
"UsedClass"... | returns mediator which controls assignments | [
"returns",
"mediator",
"which",
"controls",
"assignments"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/instantiate.js#L17-L29 | train |
matreshkajs/matreshka | src/array/pull.js | shift | function shift(arr, index) {
for (let i = index; i < arr.length; i++) {
arr[i] = arr[i + 1];
}
delete arr[arr.length - 1];
arr.length -= 1;
} | javascript | function shift(arr, index) {
for (let i = index; i < arr.length; i++) {
arr[i] = arr[i + 1];
}
delete arr[arr.length - 1];
arr.length -= 1;
} | [
"function",
"shift",
"(",
"arr",
",",
"index",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"index",
";",
"i",
"<",
"arr",
".",
"length",
";",
"i",
"++",
")",
"{",
"arr",
"[",
"i",
"]",
"=",
"arr",
"[",
"i",
"+",
"1",
"]",
";",
"}",
"delete",
"... | removes array item by given index | [
"removes",
"array",
"item",
"by",
"given",
"index"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/array/pull.js#L5-L11 | train |
matreshkajs/matreshka | src/array/pull.js | pullByValue | function pullByValue(arr, value) {
for (let i = 0; i < arr.length; i++) {
if (arr[i] === value) {
shift(arr, i);
return value;
}
}
return undefined;
} | javascript | function pullByValue(arr, value) {
for (let i = 0; i < arr.length; i++) {
if (arr[i] === value) {
shift(arr, i);
return value;
}
}
return undefined;
} | [
"function",
"pullByValue",
"(",
"arr",
",",
"value",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"arr",
"[",
"i",
"]",
"===",
"value",
")",
"{",
"shift",
"(",
"arr",
... | finds array item that equals to given value and removes it returns removed value | [
"finds",
"array",
"item",
"that",
"equals",
"to",
"given",
"value",
"and",
"removes",
"it",
"returns",
"removed",
"value"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/array/pull.js#L15-L24 | train |
matreshkajs/matreshka | src/array/pull.js | pullByIndex | function pullByIndex(arr, index) {
if (index < arr.length) {
const value = arr[index];
shift(arr, index);
return value;
}
return undefined;
} | javascript | function pullByIndex(arr, index) {
if (index < arr.length) {
const value = arr[index];
shift(arr, index);
return value;
}
return undefined;
} | [
"function",
"pullByIndex",
"(",
"arr",
",",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"arr",
".",
"length",
")",
"{",
"const",
"value",
"=",
"arr",
"[",
"index",
"]",
";",
"shift",
"(",
"arr",
",",
"index",
")",
";",
"return",
"value",
";",
"}"... | removes array item by given index if the index is not over array length returns removed value | [
"removes",
"array",
"item",
"by",
"given",
"index",
"if",
"the",
"index",
"is",
"not",
"over",
"array",
"length",
"returns",
"removed",
"value"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/array/pull.js#L28-L36 | train |
matreshkajs/matreshka | src/object/setdata.js | getNotListedKeys | function getNotListedKeys(inObject, fromObject) {
const result = [];
nofn.forOwn(inObject, (_, key) => {
if (!(key in fromObject)) {
result.push(key);
}
});
return result;
} | javascript | function getNotListedKeys(inObject, fromObject) {
const result = [];
nofn.forOwn(inObject, (_, key) => {
if (!(key in fromObject)) {
result.push(key);
}
});
return result;
} | [
"function",
"getNotListedKeys",
"(",
"inObject",
",",
"fromObject",
")",
"{",
"const",
"result",
"=",
"[",
"]",
";",
"nofn",
".",
"forOwn",
"(",
"inObject",
",",
"(",
"_",
",",
"key",
")",
"=>",
"{",
"if",
"(",
"!",
"(",
"key",
"in",
"fromObject",
... | returns an array of keys listed at inObject but not listed at fromObject | [
"returns",
"an",
"array",
"of",
"keys",
"listed",
"at",
"inObject",
"but",
"not",
"listed",
"at",
"fromObject"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/object/setdata.js#L6-L15 | train |
matreshkajs/matreshka | src/on/_adddomlistener.js | createBindingHandlers | function createBindingHandlers({
fullEventName,
domEventHandler,
selector
}) {
return {
bindHandler(evt = {}) {
const { node } = evt;
if (node) {
dom.$(node).on(fullEventName, selector, domEventHandler);
}
},
unbindHandler(evt =... | javascript | function createBindingHandlers({
fullEventName,
domEventHandler,
selector
}) {
return {
bindHandler(evt = {}) {
const { node } = evt;
if (node) {
dom.$(node).on(fullEventName, selector, domEventHandler);
}
},
unbindHandler(evt =... | [
"function",
"createBindingHandlers",
"(",
"{",
"fullEventName",
",",
"domEventHandler",
",",
"selector",
"}",
")",
"{",
"return",
"{",
"bindHandler",
"(",
"evt",
"=",
"{",
"}",
")",
"{",
"const",
"{",
"node",
"}",
"=",
"evt",
";",
"if",
"(",
"node",
")... | returns an object with event handlers used at addDomListener | [
"returns",
"an",
"object",
"with",
"event",
"handlers",
"used",
"at",
"addDomListener"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/on/_adddomlistener.js#L8-L27 | train |
matreshkajs/matreshka | src/object/_afterinit.js | changeHandler | function changeHandler(eventOptions = {}) {
const { key, silent } = eventOptions;
const def = defs.get(this);
if (key && key in def.keys && !silent) {
triggerOne(this, 'set', eventOptions);
triggerOne(this, 'modify', eventOptions);
}
} | javascript | function changeHandler(eventOptions = {}) {
const { key, silent } = eventOptions;
const def = defs.get(this);
if (key && key in def.keys && !silent) {
triggerOne(this, 'set', eventOptions);
triggerOne(this, 'modify', eventOptions);
}
} | [
"function",
"changeHandler",
"(",
"eventOptions",
"=",
"{",
"}",
")",
"{",
"const",
"{",
"key",
",",
"silent",
"}",
"=",
"eventOptions",
";",
"const",
"def",
"=",
"defs",
".",
"get",
"(",
"this",
")",
";",
"if",
"(",
"key",
"&&",
"key",
"in",
"def"... | called on change triggers set and modify if data keys are changed | [
"called",
"on",
"change",
"triggers",
"set",
"and",
"modify",
"if",
"data",
"keys",
"are",
"changed"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/object/_afterinit.js#L30-L38 | train |
matreshkajs/matreshka | src/mediate.js | createMediator | function createMediator({
object,
propDef,
key,
mediator
}) {
return function propMediator(value) {
// args: value, previousValue, key, object itself
return mediator.call(object, value, propDef.value, key, object);
};
} | javascript | function createMediator({
object,
propDef,
key,
mediator
}) {
return function propMediator(value) {
// args: value, previousValue, key, object itself
return mediator.call(object, value, propDef.value, key, object);
};
} | [
"function",
"createMediator",
"(",
"{",
"object",
",",
"propDef",
",",
"key",
",",
"mediator",
"}",
")",
"{",
"return",
"function",
"propMediator",
"(",
"value",
")",
"{",
"// args: value, previousValue, key, object itself",
"return",
"mediator",
".",
"call",
"(",... | creates property mediator | [
"creates",
"property",
"mediator"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/mediate.js#L8-L18 | train |
matreshkajs/matreshka | src/_dom/mq/on.js | is | function is(node, selector) {
return (node.matches
|| node.webkitMatchesSelector
|| node.mozMatchesSelector
|| node.msMatchesSelector
|| node.oMatchesSelector).call(node, selector);
} | javascript | function is(node, selector) {
return (node.matches
|| node.webkitMatchesSelector
|| node.mozMatchesSelector
|| node.msMatchesSelector
|| node.oMatchesSelector).call(node, selector);
} | [
"function",
"is",
"(",
"node",
",",
"selector",
")",
"{",
"return",
"(",
"node",
".",
"matches",
"||",
"node",
".",
"webkitMatchesSelector",
"||",
"node",
".",
"mozMatchesSelector",
"||",
"node",
".",
"msMatchesSelector",
"||",
"node",
".",
"oMatchesSelector",... | x12345y checks an element against a selector | [
"x12345y",
"checks",
"an",
"element",
"against",
"a",
"selector"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/_dom/mq/on.js#L8-L14 | train |
matreshkajs/matreshka | src/_dom/mq/on.js | delegateHandler | function delegateHandler(evt, selector, handler) {
const scopeSelector = `[${randomID}="${randomID}"] `;
const splittedSelector = selector.split(',');
let matching = '';
for (let i = 0; i < splittedSelector.length; i++) {
const sel = splittedSelector[i];
matching += `${i === 0 ? '' : '... | javascript | function delegateHandler(evt, selector, handler) {
const scopeSelector = `[${randomID}="${randomID}"] `;
const splittedSelector = selector.split(',');
let matching = '';
for (let i = 0; i < splittedSelector.length; i++) {
const sel = splittedSelector[i];
matching += `${i === 0 ? '' : '... | [
"function",
"delegateHandler",
"(",
"evt",
",",
"selector",
",",
"handler",
")",
"{",
"const",
"scopeSelector",
"=",
"`",
"${",
"randomID",
"}",
"${",
"randomID",
"}",
"`",
";",
"const",
"splittedSelector",
"=",
"selector",
".",
"split",
"(",
"','",
")",
... | the function is used when a selector is given | [
"the",
"function",
"is",
"used",
"when",
"a",
"selector",
"is",
"given"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/_dom/mq/on.js#L17-L36 | train |
matreshkajs/matreshka | src/array/mediateitem.js | createItemMediator | function createItemMediator({
arr,
mediator
}) {
return function itemMediator(value, index) {
// args: value, old value, index, array itself
return mediator.call(arr, value, index, arr);
};
} | javascript | function createItemMediator({
arr,
mediator
}) {
return function itemMediator(value, index) {
// args: value, old value, index, array itself
return mediator.call(arr, value, index, arr);
};
} | [
"function",
"createItemMediator",
"(",
"{",
"arr",
",",
"mediator",
"}",
")",
"{",
"return",
"function",
"itemMediator",
"(",
"value",
",",
"index",
")",
"{",
"// args: value, old value, index, array itself",
"return",
"mediator",
".",
"call",
"(",
"arr",
",",
"... | creates item mediator | [
"creates",
"item",
"mediator"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/array/mediateitem.js#L4-L12 | train |
matreshkajs/matreshka | src/array/_afterinit.js | modelItemMediator | function modelItemMediator(item, index) {
const { Model } = this;
// if an item is already instance of Model
if (item instanceof Model) {
return item;
}
let itemData;
if (item && typeof item.toJSON === 'function') {
// if item is not falsy and if it has toJSON method
/... | javascript | function modelItemMediator(item, index) {
const { Model } = this;
// if an item is already instance of Model
if (item instanceof Model) {
return item;
}
let itemData;
if (item && typeof item.toJSON === 'function') {
// if item is not falsy and if it has toJSON method
/... | [
"function",
"modelItemMediator",
"(",
"item",
",",
"index",
")",
"{",
"const",
"{",
"Model",
"}",
"=",
"this",
";",
"// if an item is already instance of Model",
"if",
"(",
"item",
"instanceof",
"Model",
")",
"{",
"return",
"item",
";",
"}",
"let",
"itemData",... | the function returns array item converted to Model instance | [
"the",
"function",
"returns",
"array",
"item",
"converted",
"to",
"Model",
"instance"
] | 943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb | https://github.com/matreshkajs/matreshka/blob/943ab6b8dd07bdeec7ffe089196fb5dde5a4dabb/src/array/_afterinit.js#L6-L26 | train |
lonelyplanet/backpack-ui | src/utils/grid.js | percentage | function percentage(target, context) {
if (target.slice(-1) === "%" || context.slice(-1) === "%") {
throw new Error(`Cannot calculate percentage; one or more units appear to
be %. Units must be rem or px.`);
}
if (target.slice(-1) !== context.slice(-1)) {
throw new Error("Cannot calculate percentag... | javascript | function percentage(target, context) {
if (target.slice(-1) === "%" || context.slice(-1) === "%") {
throw new Error(`Cannot calculate percentage; one or more units appear to
be %. Units must be rem or px.`);
}
if (target.slice(-1) !== context.slice(-1)) {
throw new Error("Cannot calculate percentag... | [
"function",
"percentage",
"(",
"target",
",",
"context",
")",
"{",
"if",
"(",
"target",
".",
"slice",
"(",
"-",
"1",
")",
"===",
"\"%\"",
"||",
"context",
".",
"slice",
"(",
"-",
"1",
")",
"===",
"\"%\"",
")",
"{",
"throw",
"new",
"Error",
"(",
"... | Calculate a percent value from two static values
@todo Add better regex matching to validate rem or px only
@param {String} target The width of the element that will be converted to a percent
@param {String} context The width of the element's container
@return {String} Converted value
@usage
percentage("12... | [
"Calculate",
"a",
"percent",
"value",
"from",
"two",
"static",
"values"
] | 999b4cc15b1f0d3186357161340f20ed56ded8bc | https://github.com/lonelyplanet/backpack-ui/blob/999b4cc15b1f0d3186357161340f20ed56ded8bc/src/utils/grid.js#L129-L143 | train |
lonelyplanet/backpack-ui | src/utils/grid.js | gutter | function gutter(
math = settings.math,
columns = settings.columns,
multiplier = 1
) {
const gutterWidth = _calculateGutter(multiplier);
const containerWidth = _updateContext(
typeof columns === "string" ?
parseInt(columns, 10) :
columns
);
if (math === "static") {
return _staticCalculatio... | javascript | function gutter(
math = settings.math,
columns = settings.columns,
multiplier = 1
) {
const gutterWidth = _calculateGutter(multiplier);
const containerWidth = _updateContext(
typeof columns === "string" ?
parseInt(columns, 10) :
columns
);
if (math === "static") {
return _staticCalculatio... | [
"function",
"gutter",
"(",
"math",
"=",
"settings",
".",
"math",
",",
"columns",
"=",
"settings",
".",
"columns",
",",
"multiplier",
"=",
"1",
")",
"{",
"const",
"gutterWidth",
"=",
"_calculateGutter",
"(",
"multiplier",
")",
";",
"const",
"containerWidth",
... | Output the gutter width
@param {string} math Type of calculation, "fluid" or "static";
defaults to global settings
@param {number} columns The number of columns; changes context
@param {number} multiplier Number to multiply the gutter by
@return {function} Function to make calculation | [
"Output",
"the",
"gutter",
"width"
] | 999b4cc15b1f0d3186357161340f20ed56ded8bc | https://github.com/lonelyplanet/backpack-ui/blob/999b4cc15b1f0d3186357161340f20ed56ded8bc/src/utils/grid.js#L161-L182 | train |
lonelyplanet/backpack-ui | src/utils/mixins.js | visuallyHidden | function visuallyHidden(focusable) {
const focusableStyles = {
clip: "auto",
clipPath: "none",
height: "auto",
margin: 0,
overflow: "visible",
position: "static",
whiteSpace: "inherit",
width: "auto",
};
return Object.assign({}, {
border: 0,
clipPath: "inset(50%)",
dis... | javascript | function visuallyHidden(focusable) {
const focusableStyles = {
clip: "auto",
clipPath: "none",
height: "auto",
margin: 0,
overflow: "visible",
position: "static",
whiteSpace: "inherit",
width: "auto",
};
return Object.assign({}, {
border: 0,
clipPath: "inset(50%)",
dis... | [
"function",
"visuallyHidden",
"(",
"focusable",
")",
"{",
"const",
"focusableStyles",
"=",
"{",
"clip",
":",
"\"auto\"",
",",
"clipPath",
":",
"\"none\"",
",",
"height",
":",
"\"auto\"",
",",
"margin",
":",
"0",
",",
"overflow",
":",
"\"visible\"",
",",
"p... | Hide only visually, but have available for screen readers
@return {Object} CSS styles | [
"Hide",
"only",
"visually",
"but",
"have",
"available",
"for",
"screen",
"readers"
] | 999b4cc15b1f0d3186357161340f20ed56ded8bc | https://github.com/lonelyplanet/backpack-ui/blob/999b4cc15b1f0d3186357161340f20ed56ded8bc/src/utils/mixins.js#L21-L47 | train |
lonelyplanet/backpack-ui | src/utils/mixins.js | blueLink | function blueLink() {
return {
color: colors.linkPrimary,
textDecoration: "none",
transition: `color ${timing.fast} ease-in-out`,
":hover": {
color: colors.linkPrimaryHover,
},
":active": {
color: colors.linkPrimaryHover,
},
":focus": Object.assign({}, outline(), {
... | javascript | function blueLink() {
return {
color: colors.linkPrimary,
textDecoration: "none",
transition: `color ${timing.fast} ease-in-out`,
":hover": {
color: colors.linkPrimaryHover,
},
":active": {
color: colors.linkPrimaryHover,
},
":focus": Object.assign({}, outline(), {
... | [
"function",
"blueLink",
"(",
")",
"{",
"return",
"{",
"color",
":",
"colors",
".",
"linkPrimary",
",",
"textDecoration",
":",
"\"none\"",
",",
"transition",
":",
"`",
"${",
"timing",
".",
"fast",
"}",
"`",
",",
"\":hover\"",
":",
"{",
"color",
":",
"co... | Creates a blue hyperlink; for use with inline styles via Radium
@return {Object} CSS styles | [
"Creates",
"a",
"blue",
"hyperlink",
";",
"for",
"use",
"with",
"inline",
"styles",
"via",
"Radium"
] | 999b4cc15b1f0d3186357161340f20ed56ded8bc | https://github.com/lonelyplanet/backpack-ui/blob/999b4cc15b1f0d3186357161340f20ed56ded8bc/src/utils/mixins.js#L53-L71 | train |
lonelyplanet/backpack-ui | src/utils/mixins.js | underlinedLink | function underlinedLink(linkColor = colors.textPrimary) {
const underlineOffset = 2;
const underlineWeight = 1;
const backgroundColor = colors.bgPrimary;
const underlineColor = rgba(linkColor, 0.4);
return {
color: linkColor,
position: "relative",
textDecoration: "none",
transition: `color ${... | javascript | function underlinedLink(linkColor = colors.textPrimary) {
const underlineOffset = 2;
const underlineWeight = 1;
const backgroundColor = colors.bgPrimary;
const underlineColor = rgba(linkColor, 0.4);
return {
color: linkColor,
position: "relative",
textDecoration: "none",
transition: `color ${... | [
"function",
"underlinedLink",
"(",
"linkColor",
"=",
"colors",
".",
"textPrimary",
")",
"{",
"const",
"underlineOffset",
"=",
"2",
";",
"const",
"underlineWeight",
"=",
"1",
";",
"const",
"backgroundColor",
"=",
"colors",
".",
"bgPrimary",
";",
"const",
"under... | Creates a nicely underlined hyperlink
@param {String} linkColor Link color
@return {Object} CSS styles object | [
"Creates",
"a",
"nicely",
"underlined",
"hyperlink"
] | 999b4cc15b1f0d3186357161340f20ed56ded8bc | https://github.com/lonelyplanet/backpack-ui/blob/999b4cc15b1f0d3186357161340f20ed56ded8bc/src/utils/mixins.js#L78-L106 | train |
vapid/vapid | lib/middleware/webpack/config.js | config | function config(mode = 'production', assetDirs = [], moduleDirs = [], outputDir = false) {
const context = resolve(__dirname, '../../../node_modules');
const entry = _entry(Utils.castArray(assetDirs));
const output = outputDir ? { filename: '[name].js', path: outputDir } : {};
const removeFiles = _removeFiles(e... | javascript | function config(mode = 'production', assetDirs = [], moduleDirs = [], outputDir = false) {
const context = resolve(__dirname, '../../../node_modules');
const entry = _entry(Utils.castArray(assetDirs));
const output = outputDir ? { filename: '[name].js', path: outputDir } : {};
const removeFiles = _removeFiles(e... | [
"function",
"config",
"(",
"mode",
"=",
"'production'",
",",
"assetDirs",
"=",
"[",
"]",
",",
"moduleDirs",
"=",
"[",
"]",
",",
"outputDir",
"=",
"false",
")",
"{",
"const",
"context",
"=",
"resolve",
"(",
"__dirname",
",",
"'../../../node_modules'",
")",
... | Dynamic config for Webpack
@param {string} options
@return {Object} Webpack configuration | [
"Dynamic",
"config",
"for",
"Webpack"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/lib/middleware/webpack/config.js#L14-L56 | train |
vapid/vapid | lib/middleware/webpack/config.js | _removeFiles | function _removeFiles(entry) {
return Utils.reduce(entry, (memo, value, key) => {
if (value[0].match(/\.pack\.s[ac]ss/)) {
memo.push(`${key}.js`);
}
return memo;
}, []);
} | javascript | function _removeFiles(entry) {
return Utils.reduce(entry, (memo, value, key) => {
if (value[0].match(/\.pack\.s[ac]ss/)) {
memo.push(`${key}.js`);
}
return memo;
}, []);
} | [
"function",
"_removeFiles",
"(",
"entry",
")",
"{",
"return",
"Utils",
".",
"reduce",
"(",
"entry",
",",
"(",
"memo",
",",
"value",
",",
"key",
")",
"=>",
"{",
"if",
"(",
"value",
"[",
"0",
"]",
".",
"match",
"(",
"/",
"\\.pack\\.s[ac]ss",
"/",
")"... | Scans entries for Sass files, and excludes the associated .js garbage files
@param {Object} entry
@return {array} list of files to remove from the final output | [
"Scans",
"entries",
"for",
"Sass",
"files",
"and",
"excludes",
"the",
"associated",
".",
"js",
"garbage",
"files"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/lib/middleware/webpack/config.js#L84-L91 | train |
vapid/vapid | lib/deployer.js | _updatePjson | function _updatePjson(siteId) {
pjson.vapid.site = siteId;
writePkg.sync(pjsonPath, pjson);
} | javascript | function _updatePjson(siteId) {
pjson.vapid.site = siteId;
writePkg.sync(pjsonPath, pjson);
} | [
"function",
"_updatePjson",
"(",
"siteId",
")",
"{",
"pjson",
".",
"vapid",
".",
"site",
"=",
"siteId",
";",
"writePkg",
".",
"sync",
"(",
"pjsonPath",
",",
"pjson",
")",
";",
"}"
] | Save the site UUID into package.json
@param {string} siteId | [
"Save",
"the",
"site",
"UUID",
"into",
"package",
".",
"json"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/lib/deployer.js#L146-L149 | train |
vapid/vapid | lib/deployer.js | _generateManifest | function _generateManifest(siteChecksums, presignedPosts) {
return Utils.reduce(siteChecksums, (memo, checksum, path) => {
/* eslint-disable-next-line no-param-reassign */
memo[path] = presignedPosts[path].digest;
return memo;
}, {});
} | javascript | function _generateManifest(siteChecksums, presignedPosts) {
return Utils.reduce(siteChecksums, (memo, checksum, path) => {
/* eslint-disable-next-line no-param-reassign */
memo[path] = presignedPosts[path].digest;
return memo;
}, {});
} | [
"function",
"_generateManifest",
"(",
"siteChecksums",
",",
"presignedPosts",
")",
"{",
"return",
"Utils",
".",
"reduce",
"(",
"siteChecksums",
",",
"(",
"memo",
",",
"checksum",
",",
"path",
")",
"=>",
"{",
"/* eslint-disable-next-line no-param-reassign */",
"memo"... | Generate a manifest
@param {Object} siteChecksums
@param {Object} presignedPosts
@return {Object} manifest | [
"Generate",
"a",
"manifest"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/lib/deployer.js#L157-L163 | train |
vapid/vapid | lib/deployer.js | _checksums | function _checksums(dir) {
const checksums = {};
glob.sync(resolve(dir, '**/!(*.pack.+(s[ac]ss|js))'), { mark: true }).forEach((file) => {
if (Utils.endsWith(file, '/')) { return; }
const relativePath = relative(dir, file);
checksums[relativePath] = Utils.checksum(file);
});
return checksums;
} | javascript | function _checksums(dir) {
const checksums = {};
glob.sync(resolve(dir, '**/!(*.pack.+(s[ac]ss|js))'), { mark: true }).forEach((file) => {
if (Utils.endsWith(file, '/')) { return; }
const relativePath = relative(dir, file);
checksums[relativePath] = Utils.checksum(file);
});
return checksums;
} | [
"function",
"_checksums",
"(",
"dir",
")",
"{",
"const",
"checksums",
"=",
"{",
"}",
";",
"glob",
".",
"sync",
"(",
"resolve",
"(",
"dir",
",",
"'**/!(*.pack.+(s[ac]ss|js))'",
")",
",",
"{",
"mark",
":",
"true",
"}",
")",
".",
"forEach",
"(",
"(",
"f... | Generates a legend of file paths to checksums
@param {string} dir
@return {Object} | [
"Generates",
"a",
"legend",
"of",
"file",
"paths",
"to",
"checksums"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/lib/deployer.js#L171-L182 | train |
vapid/vapid | lib/deployer.js | _getPresignedPosts | async function _getPresignedPosts(siteId, checksums) {
const endpoint = url.resolve(apiURL, `/sites/${siteId}/presigned_posts`);
const body = { checksums };
const response = await got.post(endpoint, { body, json: true, headers: _bearer() });
return response.body.presignedPosts;
} | javascript | async function _getPresignedPosts(siteId, checksums) {
const endpoint = url.resolve(apiURL, `/sites/${siteId}/presigned_posts`);
const body = { checksums };
const response = await got.post(endpoint, { body, json: true, headers: _bearer() });
return response.body.presignedPosts;
} | [
"async",
"function",
"_getPresignedPosts",
"(",
"siteId",
",",
"checksums",
")",
"{",
"const",
"endpoint",
"=",
"url",
".",
"resolve",
"(",
"apiURL",
",",
"`",
"${",
"siteId",
"}",
"`",
")",
";",
"const",
"body",
"=",
"{",
"checksums",
"}",
";",
"const... | Gets presigned posts
@param {string} siteId
@param {Object} checksums
@return {Object} | [
"Gets",
"presigned",
"posts"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/lib/deployer.js#L191-L197 | train |
vapid/vapid | lib/deployer.js | _uploadFiles | async function _uploadFiles(dir, presignedPosts) {
const promises = [];
const limit = pLimit(5);
let uploaded = false;
Object.keys(presignedPosts).forEach(async (path) => {
const { post } = presignedPosts[path];
if (!post) {
Logger.tagged('exists', path, 'blue');
} else {
const filePat... | javascript | async function _uploadFiles(dir, presignedPosts) {
const promises = [];
const limit = pLimit(5);
let uploaded = false;
Object.keys(presignedPosts).forEach(async (path) => {
const { post } = presignedPosts[path];
if (!post) {
Logger.tagged('exists', path, 'blue');
} else {
const filePat... | [
"async",
"function",
"_uploadFiles",
"(",
"dir",
",",
"presignedPosts",
")",
"{",
"const",
"promises",
"=",
"[",
"]",
";",
"const",
"limit",
"=",
"pLimit",
"(",
"5",
")",
";",
"let",
"uploaded",
"=",
"false",
";",
"Object",
".",
"keys",
"(",
"presigned... | Upload files to S3
@param {Object} paths
@param {Object} presignedPosts | [
"Upload",
"files",
"to",
"S3"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/lib/deployer.js#L205-L233 | train |
vapid/vapid | lib/deployer.js | _updateSite | async function _updateSite(siteId, tree, manifest, content) {
const endpoint = url.resolve(apiURL, `/sites/${siteId}`);
const body = { tree, content, manifest };
const response = await got.post(endpoint, { body, json: true, headers: _bearer() });
return response.body.site;
} | javascript | async function _updateSite(siteId, tree, manifest, content) {
const endpoint = url.resolve(apiURL, `/sites/${siteId}`);
const body = { tree, content, manifest };
const response = await got.post(endpoint, { body, json: true, headers: _bearer() });
return response.body.site;
} | [
"async",
"function",
"_updateSite",
"(",
"siteId",
",",
"tree",
",",
"manifest",
",",
"content",
")",
"{",
"const",
"endpoint",
"=",
"url",
".",
"resolve",
"(",
"apiURL",
",",
"`",
"${",
"siteId",
"}",
"`",
")",
";",
"const",
"body",
"=",
"{",
"tree"... | Update the site
@param {string} siteId
@param {Object} manifest | [
"Update",
"the",
"site"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/lib/deployer.js#L241-L246 | train |
vapid/vapid | lib/deployer.js | _compileAssets | async function _compileAssets(wwwDir, tmpDir) {
const nodeDir = resolve(wwwDir, '../node_modules');
const moduleDirs = (function _moduleDirs() {
const dirs = [wwwDir];
if (fs.existsSync(nodeDir)) dirs.push(nodeDir);
return dirs;
}());
const config = webPackConfig('production', tmpDir, moduleDirs, t... | javascript | async function _compileAssets(wwwDir, tmpDir) {
const nodeDir = resolve(wwwDir, '../node_modules');
const moduleDirs = (function _moduleDirs() {
const dirs = [wwwDir];
if (fs.existsSync(nodeDir)) dirs.push(nodeDir);
return dirs;
}());
const config = webPackConfig('production', tmpDir, moduleDirs, t... | [
"async",
"function",
"_compileAssets",
"(",
"wwwDir",
",",
"tmpDir",
")",
"{",
"const",
"nodeDir",
"=",
"resolve",
"(",
"wwwDir",
",",
"'../node_modules'",
")",
";",
"const",
"moduleDirs",
"=",
"(",
"function",
"_moduleDirs",
"(",
")",
"{",
"const",
"dirs",
... | Compiles Webpack assets | [
"Compiles",
"Webpack",
"assets"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/lib/deployer.js#L268-L289 | train |
vapid/vapid | assets/dashboard/vendor/html5sortable.js | addData | function addData(element, key, value) {
if (value === undefined) {
return element && element.h5s && element.h5s.data && element.h5s.data[key];
}
else {
element.h5s = element.h5s || {};
element.h5s.data = element.h5s.data || {};
element.h5s.data[key... | javascript | function addData(element, key, value) {
if (value === undefined) {
return element && element.h5s && element.h5s.data && element.h5s.data[key];
}
else {
element.h5s = element.h5s || {};
element.h5s.data = element.h5s.data || {};
element.h5s.data[key... | [
"function",
"addData",
"(",
"element",
",",
"key",
",",
"value",
")",
"{",
"if",
"(",
"value",
"===",
"undefined",
")",
"{",
"return",
"element",
"&&",
"element",
".",
"h5s",
"&&",
"element",
".",
"h5s",
".",
"data",
"&&",
"element",
".",
"h5s",
".",... | Get or set data on element
@param {HTMLElement} element
@param {string} key
@param {any} value
@return {*} | [
"Get",
"or",
"set",
"data",
"on",
"element"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/assets/dashboard/vendor/html5sortable.js#L18-L27 | train |
vapid/vapid | assets/dashboard/vendor/html5sortable.js | function (config) {
if (typeof config !== 'object') {
throw new Error('You must provide a valid configuration object to the config setter.');
}
// combine config with default
var mergedConfig = Object.assign({}, config);
... | javascript | function (config) {
if (typeof config !== 'object') {
throw new Error('You must provide a valid configuration object to the config setter.');
}
// combine config with default
var mergedConfig = Object.assign({}, config);
... | [
"function",
"(",
"config",
")",
"{",
"if",
"(",
"typeof",
"config",
"!==",
"'object'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'You must provide a valid configuration object to the config setter.'",
")",
";",
"}",
"// combine config with default",
"var",
"mergedConfig"... | set the configuration of a class instance
@method config
@param {object} config object of configurations | [
"set",
"the",
"configuration",
"of",
"a",
"class",
"instance"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/assets/dashboard/vendor/html5sortable.js#L80-L88 | train | |
vapid/vapid | assets/dashboard/vendor/html5sortable.js | function (draggedElement, elementOffset, event) {
return {
element: draggedElement,
posX: event.pageX - elementOffset.left,
posY: event.pageY - elementOffset.top
};
} | javascript | function (draggedElement, elementOffset, event) {
return {
element: draggedElement,
posX: event.pageX - elementOffset.left,
posY: event.pageY - elementOffset.top
};
} | [
"function",
"(",
"draggedElement",
",",
"elementOffset",
",",
"event",
")",
"{",
"return",
"{",
"element",
":",
"draggedElement",
",",
"posX",
":",
"event",
".",
"pageX",
"-",
"elementOffset",
".",
"left",
",",
"posY",
":",
"event",
".",
"pageY",
"-",
"e... | defaultDragImage returns the current item as dragged image
@param {HTMLElement} draggedElement - the item that the user drags
@param {object} elementOffset - an object with the offsets top, left, right & bottom
@param {Event} event - the original drag event object
@return {object} with element, posX and posY properties | [
"defaultDragImage",
"returns",
"the",
"current",
"item",
"as",
"dragged",
"image"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/assets/dashboard/vendor/html5sortable.js#L424-L430 | train | |
vapid/vapid | assets/dashboard/vendor/html5sortable.js | _throttle | function _throttle (fn, threshold) {
var _this = this;
if (threshold === void 0) { threshold = 250; }
// check function
if (typeof fn !== 'function') {
throw new Error('You must provide a function as the first argument for throttle.');
}
// check threshold
... | javascript | function _throttle (fn, threshold) {
var _this = this;
if (threshold === void 0) { threshold = 250; }
// check function
if (typeof fn !== 'function') {
throw new Error('You must provide a function as the first argument for throttle.');
}
// check threshold
... | [
"function",
"_throttle",
"(",
"fn",
",",
"threshold",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"if",
"(",
"threshold",
"===",
"void",
"0",
")",
"{",
"threshold",
"=",
"250",
";",
"}",
"// check function",
"if",
"(",
"typeof",
"fn",
"!==",
"'function... | make sure a function is only called once within the given amount of time
@param {Function} fn the function to throttle
@param {number} threshold time limit for throttling
must use function to keep this context | [
"make",
"sure",
"a",
"function",
"is",
"only",
"called",
"once",
"within",
"the",
"given",
"amount",
"of",
"time"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/assets/dashboard/vendor/html5sortable.js#L514-L537 | train |
vapid/vapid | assets/dashboard/vendor/html5sortable.js | function (items) {
removeEventListener(items, 'dragstart');
removeEventListener(items, 'dragend');
removeEventListener(items, 'dragover');
removeEventListener(items, 'dragenter');
removeEventListener(items, 'drop');
removeEventListener(items, 'mouseenter');
remove... | javascript | function (items) {
removeEventListener(items, 'dragstart');
removeEventListener(items, 'dragend');
removeEventListener(items, 'dragover');
removeEventListener(items, 'dragenter');
removeEventListener(items, 'drop');
removeEventListener(items, 'mouseenter');
remove... | [
"function",
"(",
"items",
")",
"{",
"removeEventListener",
"(",
"items",
",",
"'dragstart'",
")",
";",
"removeEventListener",
"(",
"items",
",",
"'dragend'",
")",
";",
"removeEventListener",
"(",
"items",
",",
"'dragover'",
")",
";",
"removeEventListener",
"(",
... | remove event handlers from items
@param {Array|NodeList} items | [
"remove",
"event",
"handlers",
"from",
"items"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/assets/dashboard/vendor/html5sortable.js#L594-L602 | train | |
vapid/vapid | assets/dashboard/vendor/html5sortable.js | function (draggedItem, sortable) {
var ditem = draggedItem;
if (store(sortable).getConfig('copy') === true) {
ditem = draggedItem.cloneNode(true);
addAttribute(ditem, 'aria-copied', 'true');
draggedItem.parentElement.appendChild(ditem);
ditem.style.display... | javascript | function (draggedItem, sortable) {
var ditem = draggedItem;
if (store(sortable).getConfig('copy') === true) {
ditem = draggedItem.cloneNode(true);
addAttribute(ditem, 'aria-copied', 'true');
draggedItem.parentElement.appendChild(ditem);
ditem.style.display... | [
"function",
"(",
"draggedItem",
",",
"sortable",
")",
"{",
"var",
"ditem",
"=",
"draggedItem",
";",
"if",
"(",
"store",
"(",
"sortable",
")",
".",
"getConfig",
"(",
"'copy'",
")",
"===",
"true",
")",
"{",
"ditem",
"=",
"draggedItem",
".",
"cloneNode",
... | _getDragging returns the current element to drag or
a copy of the element.
Is Copy Active for sortable
@param {HTMLElement} draggedItem - the item that the user drags
@param {HTMLElement} sortable a single sortable | [
"_getDragging",
"returns",
"the",
"current",
"element",
"to",
"drag",
"or",
"a",
"copy",
"of",
"the",
"element",
".",
"Is",
"Copy",
"Active",
"for",
"sortable"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/assets/dashboard/vendor/html5sortable.js#L610-L620 | train | |
vapid/vapid | assets/dashboard/vendor/html5sortable.js | findDragElement | function findDragElement(sortableElement, element) {
var options = addData(sortableElement, 'opts');
var items = _filter(sortableElement.children, options.items);
var itemlist = items.filter(function (ele) {
return ele.contains(element);
});
return itemlist.length > 0... | javascript | function findDragElement(sortableElement, element) {
var options = addData(sortableElement, 'opts');
var items = _filter(sortableElement.children, options.items);
var itemlist = items.filter(function (ele) {
return ele.contains(element);
});
return itemlist.length > 0... | [
"function",
"findDragElement",
"(",
"sortableElement",
",",
"element",
")",
"{",
"var",
"options",
"=",
"addData",
"(",
"sortableElement",
",",
"'opts'",
")",
";",
"var",
"items",
"=",
"_filter",
"(",
"sortableElement",
".",
"children",
",",
"options",
".",
... | Dragging event is on the sortable element. finds the top child that
contains the element.
@param {HTMLElement} sortableElement a single sortable
@param {HTMLElement} element is that being dragged | [
"Dragging",
"event",
"is",
"on",
"the",
"sortable",
"element",
".",
"finds",
"the",
"top",
"child",
"that",
"contains",
"the",
"element",
"."
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/assets/dashboard/vendor/html5sortable.js#L655-L662 | train |
vapid/vapid | assets/dashboard/vendor/html5sortable.js | function (sortableElement) {
var opts = addData(sortableElement, 'opts') || {};
var items = _filter(sortableElement.children, opts.items);
var handles = _getHandles(items, opts.handle);
// remove event handlers & data from sortable
removeEventListener(sortableElement, 'dragover')... | javascript | function (sortableElement) {
var opts = addData(sortableElement, 'opts') || {};
var items = _filter(sortableElement.children, opts.items);
var handles = _getHandles(items, opts.handle);
// remove event handlers & data from sortable
removeEventListener(sortableElement, 'dragover')... | [
"function",
"(",
"sortableElement",
")",
"{",
"var",
"opts",
"=",
"addData",
"(",
"sortableElement",
",",
"'opts'",
")",
"||",
"{",
"}",
";",
"var",
"items",
"=",
"_filter",
"(",
"sortableElement",
".",
"children",
",",
"opts",
".",
"items",
")",
";",
... | Destroy the sortable
@param {HTMLElement} sortableElement a single sortable | [
"Destroy",
"the",
"sortable"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/assets/dashboard/vendor/html5sortable.js#L667-L681 | train | |
vapid/vapid | assets/dashboard/vendor/html5sortable.js | function (sortableElement) {
var opts = addData(sortableElement, 'opts');
var items = _filter(sortableElement.children, opts.items);
var handles = _getHandles(items, opts.handle);
addAttribute(sortableElement, 'aria-dropeffect', 'move');
addData(sortableElement, '_disabled', 'fal... | javascript | function (sortableElement) {
var opts = addData(sortableElement, 'opts');
var items = _filter(sortableElement.children, opts.items);
var handles = _getHandles(items, opts.handle);
addAttribute(sortableElement, 'aria-dropeffect', 'move');
addData(sortableElement, '_disabled', 'fal... | [
"function",
"(",
"sortableElement",
")",
"{",
"var",
"opts",
"=",
"addData",
"(",
"sortableElement",
",",
"'opts'",
")",
";",
"var",
"items",
"=",
"_filter",
"(",
"sortableElement",
".",
"children",
",",
"opts",
".",
"items",
")",
";",
"var",
"handles",
... | Enable the sortable
@param {HTMLElement} sortableElement a single sortable | [
"Enable",
"the",
"sortable"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/assets/dashboard/vendor/html5sortable.js#L686-L714 | train | |
vapid/vapid | assets/dashboard/vendor/html5sortable.js | function (sortableElement) {
var opts = addData(sortableElement, 'opts');
var items = _filter(sortableElement.children, opts.items);
var handles = _getHandles(items, opts.handle);
addAttribute(sortableElement, 'aria-dropeffect', 'none');
addData(sortableElement, '_disabled', 'tru... | javascript | function (sortableElement) {
var opts = addData(sortableElement, 'opts');
var items = _filter(sortableElement.children, opts.items);
var handles = _getHandles(items, opts.handle);
addAttribute(sortableElement, 'aria-dropeffect', 'none');
addData(sortableElement, '_disabled', 'tru... | [
"function",
"(",
"sortableElement",
")",
"{",
"var",
"opts",
"=",
"addData",
"(",
"sortableElement",
",",
"'opts'",
")",
";",
"var",
"items",
"=",
"_filter",
"(",
"sortableElement",
".",
"children",
",",
"opts",
".",
"items",
")",
";",
"var",
"handles",
... | Disable the sortable
@param {HTMLElement} sortableElement a single sortable | [
"Disable",
"the",
"sortable"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/assets/dashboard/vendor/html5sortable.js#L719-L727 | train | |
vapid/vapid | assets/dashboard/vendor/html5sortable.js | function (e) {
var element = e.target;
var sortableElement = element.isSortable === true ? element : findSortable(element);
element = findDragElement(sortableElement, element);
if (!dragging || !_listsConnected(sortableElement, dragging.parentElement) || a... | javascript | function (e) {
var element = e.target;
var sortableElement = element.isSortable === true ? element : findSortable(element);
element = findDragElement(sortableElement, element);
if (!dragging || !_listsConnected(sortableElement, dragging.parentElement) || a... | [
"function",
"(",
"e",
")",
"{",
"var",
"element",
"=",
"e",
".",
"target",
";",
"var",
"sortableElement",
"=",
"element",
".",
"isSortable",
"===",
"true",
"?",
"element",
":",
"findSortable",
"(",
"element",
")",
";",
"element",
"=",
"findDragElement",
... | Handle dragover and dragenter events on draggable items | [
"Handle",
"dragover",
"and",
"dragenter",
"events",
"on",
"draggable",
"items"
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/assets/dashboard/vendor/html5sortable.js#L1060-L1075 | train | |
vapid/vapid | lib/directives/index.js | find | function find(params = {}) {
const name = params.type;
if (Utils.has(availableDirectives, name)) {
return new availableDirectives[name](params);
}
// Only show warning if someone explicity enters a bad name
if (name) { Logger.warn(`Directive type '${name}' does not exist. Falling back to 'text'`); }
/... | javascript | function find(params = {}) {
const name = params.type;
if (Utils.has(availableDirectives, name)) {
return new availableDirectives[name](params);
}
// Only show warning if someone explicity enters a bad name
if (name) { Logger.warn(`Directive type '${name}' does not exist. Falling back to 'text'`); }
/... | [
"function",
"find",
"(",
"params",
"=",
"{",
"}",
")",
"{",
"const",
"name",
"=",
"params",
".",
"type",
";",
"if",
"(",
"Utils",
".",
"has",
"(",
"availableDirectives",
",",
"name",
")",
")",
"{",
"return",
"new",
"availableDirectives",
"[",
"name",
... | Lookup function for available directives
Falls back to "text" directive if one can't be found.
@params {Object} params - options and attributes
@return {Directive} - an directive instance | [
"Lookup",
"function",
"for",
"available",
"directives",
"Falls",
"back",
"to",
"text",
"directive",
"if",
"one",
"can",
"t",
"be",
"found",
"."
] | a851360c08a8b8577b2f3126596546e20092055c | https://github.com/vapid/vapid/blob/a851360c08a8b8577b2f3126596546e20092055c/lib/directives/index.js#L27-L38 | train |
BasqueVoIPMafia/cordova-plugin-iosrtc | extra/hooks/iosrtc-swift-support.js | getProjectName | function getProjectName(protoPath) {
var
cordovaConfigPath = path.join(protoPath, 'config.xml'),
content = fs.readFileSync(cordovaConfigPath, 'utf-8');
return /<name>([\s\S]*)<\/name>/mi.exec(content)[1].trim();
} | javascript | function getProjectName(protoPath) {
var
cordovaConfigPath = path.join(protoPath, 'config.xml'),
content = fs.readFileSync(cordovaConfigPath, 'utf-8');
return /<name>([\s\S]*)<\/name>/mi.exec(content)[1].trim();
} | [
"function",
"getProjectName",
"(",
"protoPath",
")",
"{",
"var",
"cordovaConfigPath",
"=",
"path",
".",
"join",
"(",
"protoPath",
",",
"'config.xml'",
")",
",",
"content",
"=",
"fs",
".",
"readFileSync",
"(",
"cordovaConfigPath",
",",
"'utf-8'",
")",
";",
"r... | Helpers Returns the project name | [
"Helpers",
"Returns",
"the",
"project",
"name"
] | 8f0637b84790780a39fe5bf07f939bebfaf56e1a | https://github.com/BasqueVoIPMafia/cordova-plugin-iosrtc/blob/8f0637b84790780a39fe5bf07f939bebfaf56e1a/extra/hooks/iosrtc-swift-support.js#L28-L34 | train |
mkoryak/floatThead | dist/jquery.floatThead.js | getOffsetWidth | function getOffsetWidth(el) {
var rect = el.getBoundingClientRect();
return rect.width || rect.right - rect.left;
} | javascript | function getOffsetWidth(el) {
var rect = el.getBoundingClientRect();
return rect.width || rect.right - rect.left;
} | [
"function",
"getOffsetWidth",
"(",
"el",
")",
"{",
"var",
"rect",
"=",
"el",
".",
"getBoundingClientRect",
"(",
")",
";",
"return",
"rect",
".",
"width",
"||",
"rect",
".",
"right",
"-",
"rect",
".",
"left",
";",
"}"
] | returns fractional pixel widths | [
"returns",
"fractional",
"pixel",
"widths"
] | ab47d739d005f24ff0308a7a20fa566a7a343a11 | https://github.com/mkoryak/floatThead/blob/ab47d739d005f24ff0308a7a20fa566a7a343a11/dist/jquery.floatThead.js#L197-L200 | train |
mkoryak/floatThead | dist/jquery.floatThead.js | columnNum | function columnNum(){
var count;
var $headerColumns = $header.find(opts.headerCellSelector);
if(existingColGroup){
count = $tableColGroup.find('col').length;
} else {
count = 0;
$headerColumns.each(function () {
count += parseInt(($(this).attr('c... | javascript | function columnNum(){
var count;
var $headerColumns = $header.find(opts.headerCellSelector);
if(existingColGroup){
count = $tableColGroup.find('col').length;
} else {
count = 0;
$headerColumns.each(function () {
count += parseInt(($(this).attr('c... | [
"function",
"columnNum",
"(",
")",
"{",
"var",
"count",
";",
"var",
"$headerColumns",
"=",
"$header",
".",
"find",
"(",
"opts",
".",
"headerCellSelector",
")",
";",
"if",
"(",
"existingColGroup",
")",
"{",
"count",
"=",
"$tableColGroup",
".",
"find",
"(",
... | get the number of columns and also rebuild resizer rows if the count is different than the last count | [
"get",
"the",
"number",
"of",
"columns",
"and",
"also",
"rebuild",
"resizer",
"rows",
"if",
"the",
"count",
"is",
"different",
"than",
"the",
"last",
"count"
] | ab47d739d005f24ff0308a7a20fa566a7a343a11 | https://github.com/mkoryak/floatThead/blob/ab47d739d005f24ff0308a7a20fa566a7a343a11/dist/jquery.floatThead.js#L523-L570 | train |
mkoryak/floatThead | dist/jquery.floatThead.js | calculateScrollBarSize | function calculateScrollBarSize(){ //this should happen after the floating table has been positioned
if($scrollContainer.length){
if(opts.support && opts.support.perfectScrollbar && $scrollContainer.data().perfectScrollbar){
scrollbarOffset = {horizontal:0, vertical:0};
} else {
... | javascript | function calculateScrollBarSize(){ //this should happen after the floating table has been positioned
if($scrollContainer.length){
if(opts.support && opts.support.perfectScrollbar && $scrollContainer.data().perfectScrollbar){
scrollbarOffset = {horizontal:0, vertical:0};
} else {
... | [
"function",
"calculateScrollBarSize",
"(",
")",
"{",
"//this should happen after the floating table has been positioned",
"if",
"(",
"$scrollContainer",
".",
"length",
")",
"{",
"if",
"(",
"opts",
".",
"support",
"&&",
"opts",
".",
"support",
".",
"perfectScrollbar",
... | checks if THIS table has scrollbars, and finds their widths | [
"checks",
"if",
"THIS",
"table",
"has",
"scrollbars",
"and",
"finds",
"their",
"widths"
] | ab47d739d005f24ff0308a7a20fa566a7a343a11 | https://github.com/mkoryak/floatThead/blob/ab47d739d005f24ff0308a7a20fa566a7a343a11/dist/jquery.floatThead.js#L884-L905 | train |
ExactTarget/fuelux | index.js | function (options, callback) {
// build dataSource based with options
var resp = {
count: data.repeater.listData.length,
items: [],
page: options.pageIndex
};
// get start and end limits for JSON
var i, l;
resp.pages = Math.ceil(resp.count / (options.pageSize || 50));
i = options.page... | javascript | function (options, callback) {
// build dataSource based with options
var resp = {
count: data.repeater.listData.length,
items: [],
page: options.pageIndex
};
// get start and end limits for JSON
var i, l;
resp.pages = Math.ceil(resp.count / (options.pageSize || 50));
i = options.page... | [
"function",
"(",
"options",
",",
"callback",
")",
"{",
"// build dataSource based with options",
"var",
"resp",
"=",
"{",
"count",
":",
"data",
".",
"repeater",
".",
"listData",
".",
"length",
",",
"items",
":",
"[",
"]",
",",
"page",
":",
"options",
".",
... | list view setup | [
"list",
"view",
"setup"
] | f7596fecac00c0a3506cb150d16a229e57a23e25 | https://github.com/ExactTarget/fuelux/blob/f7596fecac00c0a3506cb150d16a229e57a23e25/index.js#L552-L608 | train | |
ExactTarget/fuelux | index.js | function (options, callback) {
var sampleImageCategories = ['abstract', 'animals', 'business', 'cats', 'city', 'food', 'nature', 'technics', 'transport'];
var numItems = 200;
// build dataSource based with options
var resp = {
count: numItems,
items: [],
pages: (Math.ceil(numItems / (options.pa... | javascript | function (options, callback) {
var sampleImageCategories = ['abstract', 'animals', 'business', 'cats', 'city', 'food', 'nature', 'technics', 'transport'];
var numItems = 200;
// build dataSource based with options
var resp = {
count: numItems,
items: [],
pages: (Math.ceil(numItems / (options.pa... | [
"function",
"(",
"options",
",",
"callback",
")",
"{",
"var",
"sampleImageCategories",
"=",
"[",
"'abstract'",
",",
"'animals'",
",",
"'business'",
",",
"'cats'",
",",
"'city'",
",",
"'food'",
",",
"'nature'",
",",
"'technics'",
",",
"'transport'",
"]",
";",... | thumbnail view setup | [
"thumbnail",
"view",
"setup"
] | f7596fecac00c0a3506cb150d16a229e57a23e25 | https://github.com/ExactTarget/fuelux/blob/f7596fecac00c0a3506cb150d16a229e57a23e25/index.js#L612-L643 | train | |
toomuchdesign/re-reselect | src/index.js | function(...args) {
const cacheKey = keySelector(...args);
if (isValidCacheKey(cacheKey)) {
let cacheResponse = cache.get(cacheKey);
if (cacheResponse === undefined) {
cacheResponse = selectorCreator(...funcs);
cache.set(cacheKey, cacheResponse);
}
retu... | javascript | function(...args) {
const cacheKey = keySelector(...args);
if (isValidCacheKey(cacheKey)) {
let cacheResponse = cache.get(cacheKey);
if (cacheResponse === undefined) {
cacheResponse = selectorCreator(...funcs);
cache.set(cacheKey, cacheResponse);
}
retu... | [
"function",
"(",
"...",
"args",
")",
"{",
"const",
"cacheKey",
"=",
"keySelector",
"(",
"...",
"args",
")",
";",
"if",
"(",
"isValidCacheKey",
"(",
"cacheKey",
")",
")",
"{",
"let",
"cacheResponse",
"=",
"cache",
".",
"get",
"(",
"cacheKey",
")",
";",
... | Application receives this function | [
"Application",
"receives",
"this",
"function"
] | 263c998e466c8aae5aa60cb617efa4fd1d71f008 | https://github.com/toomuchdesign/re-reselect/blob/263c998e466c8aae5aa60cb617efa4fd1d71f008/src/index.js#L32-L49 | train | |
mozilla/protocol | gulpfile.js/tasks/compress-js.js | compressJS | function compressJS() {
let tasks = [];
Object.keys(config.tasks).forEach((key) => {
let val = config.tasks[key];
tasks.push(gulp.src(val.src)
.pipe(plumber({ errorHandler: handleErrors }))
.pipe(uglify())
.pipe(rename(config.rename))
.pipe(gulp.d... | javascript | function compressJS() {
let tasks = [];
Object.keys(config.tasks).forEach((key) => {
let val = config.tasks[key];
tasks.push(gulp.src(val.src)
.pipe(plumber({ errorHandler: handleErrors }))
.pipe(uglify())
.pipe(rename(config.rename))
.pipe(gulp.d... | [
"function",
"compressJS",
"(",
")",
"{",
"let",
"tasks",
"=",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"config",
".",
"tasks",
")",
".",
"forEach",
"(",
"(",
"key",
")",
"=>",
"{",
"let",
"val",
"=",
"config",
".",
"tasks",
"[",
"key",
"]",
"... | Create minified versions of all JS assets. | [
"Create",
"minified",
"versions",
"of",
"all",
"JS",
"assets",
"."
] | 9d9f5bd8bd8f45a477bcb852e88abdad4b40974d | https://github.com/mozilla/protocol/blob/9d9f5bd8bd8f45a477bcb852e88abdad4b40974d/gulpfile.js/tasks/compress-js.js#L12-L25 | train |
mozilla/protocol | gulpfile.js/tasks/watch.js | watchTask | function watchTask() {
gulp.watch(config.watchers.static, copyStaticFiles);
gulp.watch(config.watchers.css, gulp.series(lintCSS, compileSass));
gulp.watch(config.watchers.js, gulp.series(lintJS, concatJS, copyJS));
gulp.watch(config.watchers.drizzle, drizzleTask);
} | javascript | function watchTask() {
gulp.watch(config.watchers.static, copyStaticFiles);
gulp.watch(config.watchers.css, gulp.series(lintCSS, compileSass));
gulp.watch(config.watchers.js, gulp.series(lintJS, concatJS, copyJS));
gulp.watch(config.watchers.drizzle, drizzleTask);
} | [
"function",
"watchTask",
"(",
")",
"{",
"gulp",
".",
"watch",
"(",
"config",
".",
"watchers",
".",
"static",
",",
"copyStaticFiles",
")",
";",
"gulp",
".",
"watch",
"(",
"config",
".",
"watchers",
".",
"css",
",",
"gulp",
".",
"series",
"(",
"lintCSS",... | Watch files for changes & rebuild. | [
"Watch",
"files",
"for",
"changes",
"&",
"rebuild",
"."
] | 9d9f5bd8bd8f45a477bcb852e88abdad4b40974d | https://github.com/mozilla/protocol/blob/9d9f5bd8bd8f45a477bcb852e88abdad4b40974d/gulpfile.js/tasks/watch.js#L14-L19 | train |
mozilla/protocol | gulpfile.js/tasks/compress-css.js | compressCSS | function compressCSS() {
let tasks = [];
Object.keys(config.tasks).forEach((key) => {
let val = config.tasks[key];
tasks.push(gulp.src(val.src)
.pipe(cleanCSS({processImport: false}))
.pipe(rename(config.rename))
.pipe(gulp.dest(val.dest)));
});
retu... | javascript | function compressCSS() {
let tasks = [];
Object.keys(config.tasks).forEach((key) => {
let val = config.tasks[key];
tasks.push(gulp.src(val.src)
.pipe(cleanCSS({processImport: false}))
.pipe(rename(config.rename))
.pipe(gulp.dest(val.dest)));
});
retu... | [
"function",
"compressCSS",
"(",
")",
"{",
"let",
"tasks",
"=",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"config",
".",
"tasks",
")",
".",
"forEach",
"(",
"(",
"key",
")",
"=>",
"{",
"let",
"val",
"=",
"config",
".",
"tasks",
"[",
"key",
"]",
... | Create minified versions of all CSS assets. | [
"Create",
"minified",
"versions",
"of",
"all",
"CSS",
"assets",
"."
] | 9d9f5bd8bd8f45a477bcb852e88abdad4b40974d | https://github.com/mozilla/protocol/blob/9d9f5bd8bd8f45a477bcb852e88abdad4b40974d/gulpfile.js/tasks/compress-css.js#L10-L22 | train |
mozilla/protocol | src/assets/js/protocol/protocol-newsletter.js | initEmailForm | function initEmailForm() {
var newsletterForm = document.getElementById('newsletter-form');
var submitButton = document.getElementById('newsletter-submit');
var formDetails = document.getElementById('newsletter-details');
var emailField = document.querySelector('.mzp-js-email-field');
... | javascript | function initEmailForm() {
var newsletterForm = document.getElementById('newsletter-form');
var submitButton = document.getElementById('newsletter-submit');
var formDetails = document.getElementById('newsletter-details');
var emailField = document.querySelector('.mzp-js-email-field');
... | [
"function",
"initEmailForm",
"(",
")",
"{",
"var",
"newsletterForm",
"=",
"document",
".",
"getElementById",
"(",
"'newsletter-form'",
")",
";",
"var",
"submitButton",
"=",
"document",
".",
"getElementById",
"(",
"'newsletter-submit'",
")",
";",
"var",
"formDetail... | !! This file assumes only one signup form per page !! Expand email form on input focus or submit if details aren't visible | [
"!!",
"This",
"file",
"assumes",
"only",
"one",
"signup",
"form",
"per",
"page",
"!!",
"Expand",
"email",
"form",
"on",
"input",
"focus",
"or",
"submit",
"if",
"details",
"aren",
"t",
"visible"
] | 9d9f5bd8bd8f45a477bcb852e88abdad4b40974d | https://github.com/mozilla/protocol/blob/9d9f5bd8bd8f45a477bcb852e88abdad4b40974d/src/assets/js/protocol/protocol-newsletter.js#L11-L42 | train |
mozilla/protocol | gulpfile.js/tasks/copy-js.js | copyJS | function copyJS() {
let tasks = [];
Object.keys(config).forEach((key) => {
let val = config[key];
tasks.push(gulp.src(val.src).pipe(gulp.dest(val.dest)));
});
return merge(tasks);
} | javascript | function copyJS() {
let tasks = [];
Object.keys(config).forEach((key) => {
let val = config[key];
tasks.push(gulp.src(val.src).pipe(gulp.dest(val.dest)));
});
return merge(tasks);
} | [
"function",
"copyJS",
"(",
")",
"{",
"let",
"tasks",
"=",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"config",
")",
".",
"forEach",
"(",
"(",
"key",
")",
"=>",
"{",
"let",
"val",
"=",
"config",
"[",
"key",
"]",
";",
"tasks",
".",
"push",
"(",
... | Copy across all original JS files for distribution. | [
"Copy",
"across",
"all",
"original",
"JS",
"files",
"for",
"distribution",
"."
] | 9d9f5bd8bd8f45a477bcb852e88abdad4b40974d | https://github.com/mozilla/protocol/blob/9d9f5bd8bd8f45a477bcb852e88abdad4b40974d/gulpfile.js/tasks/copy-js.js#L8-L16 | train |
mozilla/protocol | gulpfile.js/tasks/concat-js.js | concatJS | function concatJS() {
let tasks = [];
Object.keys(config).forEach((key) => {
let val = config[key];
tasks.push(gulp.src(val.src)
.pipe(plumber({ errorHandler: handleErrors }))
.pipe(concat(key + '.js'))
.pipe(gulp.dest(val.dest)));
});
return merge(t... | javascript | function concatJS() {
let tasks = [];
Object.keys(config).forEach((key) => {
let val = config[key];
tasks.push(gulp.src(val.src)
.pipe(plumber({ errorHandler: handleErrors }))
.pipe(concat(key + '.js'))
.pipe(gulp.dest(val.dest)));
});
return merge(t... | [
"function",
"concatJS",
"(",
")",
"{",
"let",
"tasks",
"=",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"config",
")",
".",
"forEach",
"(",
"(",
"key",
")",
"=>",
"{",
"let",
"val",
"=",
"config",
"[",
"key",
"]",
";",
"tasks",
".",
"push",
"(",... | Concatenate docs JS files. | [
"Concatenate",
"docs",
"JS",
"files",
"."
] | 9d9f5bd8bd8f45a477bcb852e88abdad4b40974d | https://github.com/mozilla/protocol/blob/9d9f5bd8bd8f45a477bcb852e88abdad4b40974d/gulpfile.js/tasks/concat-js.js#L11-L23 | train |
omnidan/node-emoji | lib/emoji.js | stripColons | function stripColons (str) {
var colonIndex = str.indexOf(':');
if (colonIndex > -1) {
// :emoji: (http://www.emoji-cheat-sheet.com/)
if (colonIndex === str.length - 1) {
str = str.substring(0, colonIndex);
return stripColons(str);
} else {
str = str.substr(colonIndex + 1);
retur... | javascript | function stripColons (str) {
var colonIndex = str.indexOf(':');
if (colonIndex > -1) {
// :emoji: (http://www.emoji-cheat-sheet.com/)
if (colonIndex === str.length - 1) {
str = str.substring(0, colonIndex);
return stripColons(str);
} else {
str = str.substr(colonIndex + 1);
retur... | [
"function",
"stripColons",
"(",
"str",
")",
"{",
"var",
"colonIndex",
"=",
"str",
".",
"indexOf",
"(",
"':'",
")",
";",
"if",
"(",
"colonIndex",
">",
"-",
"1",
")",
"{",
"// :emoji: (http://www.emoji-cheat-sheet.com/)",
"if",
"(",
"colonIndex",
"===",
"str",... | Removes colons on either side
of the string if present
@param {string} str
@return {string} | [
"Removes",
"colons",
"on",
"either",
"side",
"of",
"the",
"string",
"if",
"present"
] | e6d9acb85692f5c5d6a156b04aa0de4d353c5b33 | https://github.com/omnidan/node-emoji/blob/e6d9acb85692f5c5d6a156b04aa0de4d353c5b33/lib/emoji.js#L24-L38 | train |
laverdet/node-fibers | future.js | function() {
if (!this.resolved) {
throw new Error('Future must resolve before value is ready');
} else if (this.error) {
// Link the stack traces up
var error = this.error;
var localStack = {};
Error.captureStackTrace(localStack, Future.prototype.get);
var futureStack = Object.getOwnPropertyDescr... | javascript | function() {
if (!this.resolved) {
throw new Error('Future must resolve before value is ready');
} else if (this.error) {
// Link the stack traces up
var error = this.error;
var localStack = {};
Error.captureStackTrace(localStack, Future.prototype.get);
var futureStack = Object.getOwnPropertyDescr... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"resolved",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Future must resolve before value is ready'",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"error",
")",
"{",
"// Link the stack traces up",
"var",... | Return the value of this future. If the future hasn't resolved yet this will throw an error. | [
"Return",
"the",
"value",
"of",
"this",
"future",
".",
"If",
"the",
"future",
"hasn",
"t",
"resolved",
"yet",
"this",
"will",
"throw",
"an",
"error",
"."
] | 5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f | https://github.com/laverdet/node-fibers/blob/5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f/future.js#L208-L254 | train | |
laverdet/node-fibers | future.js | function(value) {
if (this.resolved) {
throw new Error('Future resolved more than once');
}
this.value = value;
this.resolved = true;
var callbacks = this.callbacks;
if (callbacks) {
delete this.callbacks;
for (var ii = 0; ii < callbacks.length; ++ii) {
try {
var ref = callbacks[ii];
... | javascript | function(value) {
if (this.resolved) {
throw new Error('Future resolved more than once');
}
this.value = value;
this.resolved = true;
var callbacks = this.callbacks;
if (callbacks) {
delete this.callbacks;
for (var ii = 0; ii < callbacks.length; ++ii) {
try {
var ref = callbacks[ii];
... | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"this",
".",
"resolved",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Future resolved more than once'",
")",
";",
"}",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"resolved",
"=",
"true",
";",
"var"... | Mark this future as returned. All pending callbacks will be invoked immediately. | [
"Mark",
"this",
"future",
"as",
"returned",
".",
"All",
"pending",
"callbacks",
"will",
"be",
"invoked",
"immediately",
"."
] | 5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f | https://github.com/laverdet/node-fibers/blob/5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f/future.js#L259-L285 | train | |
laverdet/node-fibers | future.js | function(error) {
if (this.resolved) {
throw new Error('Future resolved more than once');
} else if (!error) {
throw new Error('Must throw non-empty error');
}
this.error = error;
this.resolved = true;
var callbacks = this.callbacks;
if (callbacks) {
delete this.callbacks;
for (var ii = 0; ii... | javascript | function(error) {
if (this.resolved) {
throw new Error('Future resolved more than once');
} else if (!error) {
throw new Error('Must throw non-empty error');
}
this.error = error;
this.resolved = true;
var callbacks = this.callbacks;
if (callbacks) {
delete this.callbacks;
for (var ii = 0; ii... | [
"function",
"(",
"error",
")",
"{",
"if",
"(",
"this",
".",
"resolved",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Future resolved more than once'",
")",
";",
"}",
"else",
"if",
"(",
"!",
"error",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Must throw non-e... | Throw from this future as returned. All pending callbacks will be invoked immediately. | [
"Throw",
"from",
"this",
"future",
"as",
"returned",
".",
"All",
"pending",
"callbacks",
"will",
"be",
"invoked",
"immediately",
"."
] | 5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f | https://github.com/laverdet/node-fibers/blob/5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f/future.js#L290-L318 | train | |
laverdet/node-fibers | future.js | function(arg1, arg2) {
if (this.resolved) {
if (arg2) {
if (this.error) {
arg1.throw(this.error);
} else {
arg2(this.value);
}
} else {
arg1(this.error, this.value);
}
} else {
(this.callbacks = this.callbacks || []).push([arg1, arg2]);
}
return this;
} | javascript | function(arg1, arg2) {
if (this.resolved) {
if (arg2) {
if (this.error) {
arg1.throw(this.error);
} else {
arg2(this.value);
}
} else {
arg1(this.error, this.value);
}
} else {
(this.callbacks = this.callbacks || []).push([arg1, arg2]);
}
return this;
} | [
"function",
"(",
"arg1",
",",
"arg2",
")",
"{",
"if",
"(",
"this",
".",
"resolved",
")",
"{",
"if",
"(",
"arg2",
")",
"{",
"if",
"(",
"this",
".",
"error",
")",
"{",
"arg1",
".",
"throw",
"(",
"this",
".",
"error",
")",
";",
"}",
"else",
"{",... | Waits for this future to resolve and then invokes a callback.
If two arguments are passed, the first argument is a future which will be thrown to in the case
of error, and the second is a function(val){} callback.
If only one argument is passed it is a standard function(err, val){} callback. | [
"Waits",
"for",
"this",
"future",
"to",
"resolve",
"and",
"then",
"invokes",
"a",
"callback",
"."
] | 5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f | https://github.com/laverdet/node-fibers/blob/5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f/future.js#L362-L377 | train | |
laverdet/node-fibers | future.js | function(futures) {
this.resolve(function(err) {
if (!err) {
return;
}
if (futures instanceof Array) {
for (var ii = 0; ii < futures.length; ++ii) {
futures[ii].throw(err);
}
} else {
futures.throw(err);
}
});
return this;
} | javascript | function(futures) {
this.resolve(function(err) {
if (!err) {
return;
}
if (futures instanceof Array) {
for (var ii = 0; ii < futures.length; ++ii) {
futures[ii].throw(err);
}
} else {
futures.throw(err);
}
});
return this;
} | [
"function",
"(",
"futures",
")",
"{",
"this",
".",
"resolve",
"(",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"!",
"err",
")",
"{",
"return",
";",
"}",
"if",
"(",
"futures",
"instanceof",
"Array",
")",
"{",
"for",
"(",
"var",
"ii",
"=",
"0",
... | Propogate only errors to an another future or array of futures. | [
"Propogate",
"only",
"errors",
"to",
"an",
"another",
"future",
"or",
"array",
"of",
"futures",
"."
] | 5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f | https://github.com/laverdet/node-fibers/blob/5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f/future.js#L408-L422 | train | |
laverdet/node-fibers | future.js | function() {
var that = this;
return new Promise(function(resolve, reject) {
that.resolve(function(err, val) {
if (err) {
reject(err);
} else {
resolve(val);
}
});
});
} | javascript | function() {
var that = this;
return new Promise(function(resolve, reject) {
that.resolve(function(err, val) {
if (err) {
reject(err);
} else {
resolve(val);
}
});
});
} | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"that",
".",
"resolve",
"(",
"function",
"(",
"err",
",",
"val",
")",
"{",
"if",
"(",
"err",
")",
"{... | Returns an ES6 Promise | [
"Returns",
"an",
"ES6",
"Promise"
] | 5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f | https://github.com/laverdet/node-fibers/blob/5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f/future.js#L427-L438 | train | |
laverdet/node-fibers | future.js | FiberFuture | function FiberFuture(fn, context, args) {
this.fn = fn;
this.context = context;
this.args = args;
this.started = false;
var that = this;
process.nextTick(function() {
if (!that.started) {
that.started = true;
Fiber(function() {
try {
that.return(fn.apply(context, args));
} catch(e) {
tha... | javascript | function FiberFuture(fn, context, args) {
this.fn = fn;
this.context = context;
this.args = args;
this.started = false;
var that = this;
process.nextTick(function() {
if (!that.started) {
that.started = true;
Fiber(function() {
try {
that.return(fn.apply(context, args));
} catch(e) {
tha... | [
"function",
"FiberFuture",
"(",
"fn",
",",
"context",
",",
"args",
")",
"{",
"this",
".",
"fn",
"=",
"fn",
";",
"this",
".",
"context",
"=",
"context",
";",
"this",
".",
"args",
"=",
"args",
";",
"this",
".",
"started",
"=",
"false",
";",
"var",
... | A function call which loads inside a fiber automatically and returns a future. | [
"A",
"function",
"call",
"which",
"loads",
"inside",
"a",
"fiber",
"automatically",
"and",
"returns",
"a",
"future",
"."
] | 5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f | https://github.com/laverdet/node-fibers/blob/5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f/future.js#L456-L474 | train |
laverdet/node-fibers | build.js | afterBuild | function afterBuild() {
var targetPath = path.join(__dirname, 'build', debug ? 'Debug' : 'Release', 'fibers.node');
var installPath = path.join(__dirname, 'bin', modPath, 'fibers.node');
try {
fs.mkdirSync(path.join(__dirname, 'bin', modPath));
} catch (ex) {}
try {
fs.statSync(targetPath);
} catch (ex) {
... | javascript | function afterBuild() {
var targetPath = path.join(__dirname, 'build', debug ? 'Debug' : 'Release', 'fibers.node');
var installPath = path.join(__dirname, 'bin', modPath, 'fibers.node');
try {
fs.mkdirSync(path.join(__dirname, 'bin', modPath));
} catch (ex) {}
try {
fs.statSync(targetPath);
} catch (ex) {
... | [
"function",
"afterBuild",
"(",
")",
"{",
"var",
"targetPath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'build'",
",",
"debug",
"?",
"'Debug'",
":",
"'Release'",
",",
"'fibers.node'",
")",
";",
"var",
"installPath",
"=",
"path",
".",
"join",
"(",... | Move it to expected location | [
"Move",
"it",
"to",
"expected",
"location"
] | 5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f | https://github.com/laverdet/node-fibers/blob/5c24f960bc8d2a5a4e1aaf5de5ded3587566a86f/build.js#L89-L110 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/common.d313593452690288a963.js | isArray | function isArray (arr) {
return Array.isArray
? Array.isArray(arr)
: Object.prototype.toString.call(arr) === '[object Array]'
} | javascript | function isArray (arr) {
return Array.isArray
? Array.isArray(arr)
: Object.prototype.toString.call(arr) === '[object Array]'
} | [
"function",
"isArray",
"(",
"arr",
")",
"{",
"return",
"Array",
".",
"isArray",
"?",
"Array",
".",
"isArray",
"(",
"arr",
")",
":",
"Object",
".",
"prototype",
".",
"toString",
".",
"call",
"(",
"arr",
")",
"===",
"'[object Array]'",
"}"
] | checks if passed argument is an array
@param {any} arr - the object to check
@return {Boolean} - true if `arr` is an array | [
"checks",
"if",
"passed",
"argument",
"is",
"an",
"array"
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/common.d313593452690288a963.js#L338-L342 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/common.d313593452690288a963.js | function (info) { return Object.keys(info).reduce(function (escaped, key) {
var ref = info.__dangerouslyDisableSanitizers;
var isDisabled = ref && ref.indexOf(key) > -1;
var val = info[key];
escaped[key] = val;
if (key === '__dangerouslyDisableSanitizers') {
return escaped
}
... | javascript | function (info) { return Object.keys(info).reduce(function (escaped, key) {
var ref = info.__dangerouslyDisableSanitizers;
var isDisabled = ref && ref.indexOf(key) > -1;
var val = info[key];
escaped[key] = val;
if (key === '__dangerouslyDisableSanitizers') {
return escaped
}
... | [
"function",
"(",
"info",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"info",
")",
".",
"reduce",
"(",
"function",
"(",
"escaped",
",",
"key",
")",
"{",
"var",
"ref",
"=",
"info",
".",
"__dangerouslyDisableSanitizers",
";",
"var",
"isDisabled",
"=",
... | sanitizes potentially dangerous characters | [
"sanitizes",
"potentially",
"dangerous",
"characters"
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/common.d313593452690288a963.js#L498-L521 | train | |
zhanziyang/vue-croppa | docs/static/kute-page_files/common.d313593452690288a963.js | VueMeta | function VueMeta (Vue, options) {
if ( options === void 0 ) options = {};
// set some default options
var defaultOptions = {
keyName: VUE_META_KEY_NAME,
attribute: VUE_META_ATTRIBUTE,
ssrAttribute: VUE_META_SERVER_RENDERED_ATTRIBUTE,
tagIDKeyName: VUE_META_TAG_LIST_ID_KEY_NAME
};
// combine o... | javascript | function VueMeta (Vue, options) {
if ( options === void 0 ) options = {};
// set some default options
var defaultOptions = {
keyName: VUE_META_KEY_NAME,
attribute: VUE_META_ATTRIBUTE,
ssrAttribute: VUE_META_SERVER_RENDERED_ATTRIBUTE,
tagIDKeyName: VUE_META_TAG_LIST_ID_KEY_NAME
};
// combine o... | [
"function",
"VueMeta",
"(",
"Vue",
",",
"options",
")",
"{",
"if",
"(",
"options",
"===",
"void",
"0",
")",
"options",
"=",
"{",
"}",
";",
"// set some default options",
"var",
"defaultOptions",
"=",
"{",
"keyName",
":",
"VUE_META_KEY_NAME",
",",
"attribute"... | Plugin install function.
@param {Function} Vue - the Vue constructor. | [
"Plugin",
"install",
"function",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/common.d313593452690288a963.js#L979-L1067 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/common.d313593452690288a963.js | encodeURIComponentPretty | function encodeURIComponentPretty (str) {
return encodeURI(str).replace(/[\/?#]/g, function (c) {
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
})
} | javascript | function encodeURIComponentPretty (str) {
return encodeURI(str).replace(/[\/?#]/g, function (c) {
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
})
} | [
"function",
"encodeURIComponentPretty",
"(",
"str",
")",
"{",
"return",
"encodeURI",
"(",
"str",
")",
".",
"replace",
"(",
"/",
"[\\/?#]",
"/",
"g",
",",
"function",
"(",
"c",
")",
"{",
"return",
"'%'",
"+",
"c",
".",
"charCodeAt",
"(",
"0",
")",
"."... | Prettier encoding of URI path segments.
@param {string}
@return {string} | [
"Prettier",
"encoding",
"of",
"URI",
"path",
"segments",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/common.d313593452690288a963.js#L1808-L1812 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/app.e653d17f57bebeb097ee.js | ansiHTML | function ansiHTML (text) {
// Returns the text if the string has no ANSI escape code.
if (!_regANSI.test(text)) {
return text
}
// Cache opened sequence.
var ansiCodes = []
// Replace with markup.
var ret = text.replace(/\033\[(\d+)*m/g, function (match, seq) {
var ot = _openTags[seq]
if (ot)... | javascript | function ansiHTML (text) {
// Returns the text if the string has no ANSI escape code.
if (!_regANSI.test(text)) {
return text
}
// Cache opened sequence.
var ansiCodes = []
// Replace with markup.
var ret = text.replace(/\033\[(\d+)*m/g, function (match, seq) {
var ot = _openTags[seq]
if (ot)... | [
"function",
"ansiHTML",
"(",
"text",
")",
"{",
"// Returns the text if the string has no ANSI escape code.",
"if",
"(",
"!",
"_regANSI",
".",
"test",
"(",
"text",
")",
")",
"{",
"return",
"text",
"}",
"// Cache opened sequence.",
"var",
"ansiCodes",
"=",
"[",
"]",... | Converts text with ANSI color codes to HTML markup.
@param {String} text
@returns {*} | [
"Converts",
"text",
"with",
"ANSI",
"color",
"codes",
"to",
"HTML",
"markup",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/app.e653d17f57bebeb097ee.js#L2808-L2844 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/app.e653d17f57bebeb097ee.js | race$1 | function race$1(entries) {
/*jshint validthis:true */
var Constructor = this;
if (!isArray(entries)) {
return new Constructor(function (_, reject) {
return reject(new TypeError('You must pass an array to race.'));
});
} else {
return new Constructor(function (resolve, reject) {
var leng... | javascript | function race$1(entries) {
/*jshint validthis:true */
var Constructor = this;
if (!isArray(entries)) {
return new Constructor(function (_, reject) {
return reject(new TypeError('You must pass an array to race.'));
});
} else {
return new Constructor(function (resolve, reject) {
var leng... | [
"function",
"race$1",
"(",
"entries",
")",
"{",
"/*jshint validthis:true */",
"var",
"Constructor",
"=",
"this",
";",
"if",
"(",
"!",
"isArray",
"(",
"entries",
")",
")",
"{",
"return",
"new",
"Constructor",
"(",
"function",
"(",
"_",
",",
"reject",
")",
... | `Promise.race` returns a new promise which is settled in the same way as the
first passed promise to settle.
Example:
```javascript
let promise1 = new Promise(function(resolve, reject){
setTimeout(function(){
resolve('promise 1');
}, 200);
});
let promise2 = new Promise(function(resolve, reject){
setTimeout(function... | [
"Promise",
".",
"race",
"returns",
"a",
"new",
"promise",
"which",
"is",
"settled",
"in",
"the",
"same",
"way",
"as",
"the",
"first",
"passed",
"promise",
"to",
"settle",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/app.e653d17f57bebeb097ee.js#L7301-L7317 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | arrayEachRight | function arrayEachRight(array, iteratee) {
var length = array == null ? 0 : array.length;
while (length--) {
if (iteratee(array[length], length, array) === false) {
break;
}
}
return array;
} | javascript | function arrayEachRight(array, iteratee) {
var length = array == null ? 0 : array.length;
while (length--) {
if (iteratee(array[length], length, array) === false) {
break;
}
}
return array;
} | [
"function",
"arrayEachRight",
"(",
"array",
",",
"iteratee",
")",
"{",
"var",
"length",
"=",
"array",
"==",
"null",
"?",
"0",
":",
"array",
".",
"length",
";",
"while",
"(",
"length",
"--",
")",
"{",
"if",
"(",
"iteratee",
"(",
"array",
"[",
"length"... | A specialized version of `_.forEachRight` for arrays without support for
iteratee shorthands.
@private
@param {Array} [array] The array to iterate over.
@param {Function} iteratee The function invoked per iteration.
@returns {Array} Returns `array`. | [
"A",
"specialized",
"version",
"of",
"_",
".",
"forEachRight",
"for",
"arrays",
"without",
"support",
"for",
"iteratee",
"shorthands",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L660-L669 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | arrayEvery | function arrayEvery(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (!predicate(array[index], index, array)) {
return false;
}
}
return true;
} | javascript | function arrayEvery(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (!predicate(array[index], index, array)) {
return false;
}
}
return true;
} | [
"function",
"arrayEvery",
"(",
"array",
",",
"predicate",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"array",
"==",
"null",
"?",
"0",
":",
"array",
".",
"length",
";",
"while",
"(",
"++",
"index",
"<",
"length",
")",
"{",
"if",
... | A specialized version of `_.every` for arrays without support for
iteratee shorthands.
@private
@param {Array} [array] The array to iterate over.
@param {Function} predicate The function invoked per iteration.
@returns {boolean} Returns `true` if all elements pass the predicate check,
else `false`. | [
"A",
"specialized",
"version",
"of",
"_",
".",
"every",
"for",
"arrays",
"without",
"support",
"for",
"iteratee",
"shorthands",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L681-L691 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | baseFindKey | function baseFindKey(collection, predicate, eachFunc) {
var result;
eachFunc(collection, function(value, key, collection) {
if (predicate(value, key, collection)) {
result = key;
return false;
}
});
return result;
} | javascript | function baseFindKey(collection, predicate, eachFunc) {
var result;
eachFunc(collection, function(value, key, collection) {
if (predicate(value, key, collection)) {
result = key;
return false;
}
});
return result;
} | [
"function",
"baseFindKey",
"(",
"collection",
",",
"predicate",
",",
"eachFunc",
")",
"{",
"var",
"result",
";",
"eachFunc",
"(",
"collection",
",",
"function",
"(",
"value",
",",
"key",
",",
"collection",
")",
"{",
"if",
"(",
"predicate",
"(",
"value",
... | The base implementation of methods like `_.findKey` and `_.findLastKey`,
without support for iteratee shorthands, which iterates over `collection`
using `eachFunc`.
@private
@param {Array|Object} collection The collection to inspect.
@param {Function} predicate The function invoked per iteration.
@param {Function} eac... | [
"The",
"base",
"implementation",
"of",
"methods",
"like",
"_",
".",
"findKey",
"and",
"_",
".",
"findLastKey",
"without",
"support",
"for",
"iteratee",
"shorthands",
"which",
"iterates",
"over",
"collection",
"using",
"eachFunc",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L903-L912 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | baseIndexOfWith | function baseIndexOfWith(array, value, fromIndex, comparator) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (comparator(array[index], value)) {
return index;
}
}
return -1;
} | javascript | function baseIndexOfWith(array, value, fromIndex, comparator) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (comparator(array[index], value)) {
return index;
}
}
return -1;
} | [
"function",
"baseIndexOfWith",
"(",
"array",
",",
"value",
",",
"fromIndex",
",",
"comparator",
")",
"{",
"var",
"index",
"=",
"fromIndex",
"-",
"1",
",",
"length",
"=",
"array",
".",
"length",
";",
"while",
"(",
"++",
"index",
"<",
"length",
")",
"{",... | This function is like `baseIndexOf` except that it accepts a comparator.
@private
@param {Array} array The array to inspect.
@param {*} value The value to search for.
@param {number} fromIndex The index to search from.
@param {Function} comparator The comparator invoked per element.
@returns {number} Returns the index... | [
"This",
"function",
"is",
"like",
"baseIndexOf",
"except",
"that",
"it",
"accepts",
"a",
"comparator",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L962-L972 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | charsStartIndex | function charsStartIndex(strSymbols, chrSymbols) {
var index = -1,
length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
} | javascript | function charsStartIndex(strSymbols, chrSymbols) {
var index = -1,
length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
} | [
"function",
"charsStartIndex",
"(",
"strSymbols",
",",
"chrSymbols",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"strSymbols",
".",
"length",
";",
"while",
"(",
"++",
"index",
"<",
"length",
"&&",
"baseIndexOf",
"(",
"chrSymbols",
",",
"... | Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
that is not found in the character symbols.
@private
@param {Array} strSymbols The string symbols to inspect.
@param {Array} chrSymbols The character symbols to find.
@returns {number} Returns the index of the first unmatched string symbol. | [
"Used",
"by",
"_",
".",
"trim",
"and",
"_",
".",
"trimStart",
"to",
"get",
"the",
"index",
"of",
"the",
"first",
"string",
"symbol",
"that",
"is",
"not",
"found",
"in",
"the",
"character",
"symbols",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L1174-L1180 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | charsEndIndex | function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
} | javascript | function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
} | [
"function",
"charsEndIndex",
"(",
"strSymbols",
",",
"chrSymbols",
")",
"{",
"var",
"index",
"=",
"strSymbols",
".",
"length",
";",
"while",
"(",
"index",
"--",
"&&",
"baseIndexOf",
"(",
"chrSymbols",
",",
"strSymbols",
"[",
"index",
"]",
",",
"0",
")",
... | Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
that is not found in the character symbols.
@private
@param {Array} strSymbols The string symbols to inspect.
@param {Array} chrSymbols The character symbols to find.
@returns {number} Returns the index of the last unmatched string symbol. | [
"Used",
"by",
"_",
".",
"trim",
"and",
"_",
".",
"trimEnd",
"to",
"get",
"the",
"index",
"of",
"the",
"last",
"string",
"symbol",
"that",
"is",
"not",
"found",
"in",
"the",
"character",
"symbols",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L1191-L1196 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | setToPairs | function setToPairs(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = [value, value];
});
return result;
} | javascript | function setToPairs(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = [value, value];
});
return result;
} | [
"function",
"setToPairs",
"(",
"set",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"result",
"=",
"Array",
"(",
"set",
".",
"size",
")",
";",
"set",
".",
"forEach",
"(",
"function",
"(",
"value",
")",
"{",
"result",
"[",
"++",
"index",
"]",
"=",... | Converts `set` to its value-value pairs.
@private
@param {Object} set The set to convert.
@returns {Array} Returns the value-value pairs. | [
"Converts",
"set",
"to",
"its",
"value",
"-",
"value",
"pairs",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L1379-L1387 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | lazyClone | function lazyClone() {
var result = new LazyWrapper(this.__wrapped__);
result.__actions__ = copyArray(this.__actions__);
result.__dir__ = this.__dir__;
result.__filtered__ = this.__filtered__;
result.__iteratees__ = copyArray(this.__iteratees__);
result.__takeCount__ = this.__takeCou... | javascript | function lazyClone() {
var result = new LazyWrapper(this.__wrapped__);
result.__actions__ = copyArray(this.__actions__);
result.__dir__ = this.__dir__;
result.__filtered__ = this.__filtered__;
result.__iteratees__ = copyArray(this.__iteratees__);
result.__takeCount__ = this.__takeCou... | [
"function",
"lazyClone",
"(",
")",
"{",
"var",
"result",
"=",
"new",
"LazyWrapper",
"(",
"this",
".",
"__wrapped__",
")",
";",
"result",
".",
"__actions__",
"=",
"copyArray",
"(",
"this",
".",
"__actions__",
")",
";",
"result",
".",
"__dir__",
"=",
"this... | Creates a clone of the lazy wrapper object.
@private
@name clone
@memberOf LazyWrapper
@returns {Object} Returns the cloned `LazyWrapper` object. | [
"Creates",
"a",
"clone",
"of",
"the",
"lazy",
"wrapper",
"object",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L1931-L1940 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | arraySampleSize | function arraySampleSize(array, n) {
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
} | javascript | function arraySampleSize(array, n) {
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
} | [
"function",
"arraySampleSize",
"(",
"array",
",",
"n",
")",
"{",
"return",
"shuffleSelf",
"(",
"copyArray",
"(",
"array",
")",
",",
"baseClamp",
"(",
"n",
",",
"0",
",",
"array",
".",
"length",
")",
")",
";",
"}"
] | A specialized version of `_.sampleSize` for arrays.
@private
@param {Array} array The array to sample.
@param {number} n The number of elements to sample.
@returns {Array} Returns the random elements. | [
"A",
"specialized",
"version",
"of",
"_",
".",
"sampleSize",
"for",
"arrays",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L2558-L2560 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | baseConforms | function baseConforms(source) {
var props = keys(source);
return function(object) {
return baseConformsTo(object, source, props);
};
} | javascript | function baseConforms(source) {
var props = keys(source);
return function(object) {
return baseConformsTo(object, source, props);
};
} | [
"function",
"baseConforms",
"(",
"source",
")",
"{",
"var",
"props",
"=",
"keys",
"(",
"source",
")",
";",
"return",
"function",
"(",
"object",
")",
"{",
"return",
"baseConformsTo",
"(",
"object",
",",
"source",
",",
"props",
")",
";",
"}",
";",
"}"
] | The base implementation of `_.conforms` which doesn't clone `source`.
@private
@param {Object} source The object of property predicates to conform to.
@returns {Function} Returns the new spec function. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"conforms",
"which",
"doesn",
"t",
"clone",
"source",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L2821-L2826 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | baseConformsTo | function baseConformsTo(object, source, props) {
var length = props.length;
if (object == null) {
return !length;
}
object = Object(object);
while (length--) {
var key = props[length],
predicate = source[key],
value = object[key];
if ((value... | javascript | function baseConformsTo(object, source, props) {
var length = props.length;
if (object == null) {
return !length;
}
object = Object(object);
while (length--) {
var key = props[length],
predicate = source[key],
value = object[key];
if ((value... | [
"function",
"baseConformsTo",
"(",
"object",
",",
"source",
",",
"props",
")",
"{",
"var",
"length",
"=",
"props",
".",
"length",
";",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"!",
"length",
";",
"}",
"object",
"=",
"Object",
"(",
"obje... | The base implementation of `_.conformsTo` which accepts `props` to check.
@private
@param {Object} object The object to inspect.
@param {Object} source The object of property predicates to conform to.
@returns {boolean} Returns `true` if `object` conforms, else `false`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"conformsTo",
"which",
"accepts",
"props",
"to",
"check",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L2836-L2852 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | baseFill | function baseFill(array, value, start, end) {
var length = array.length;
start = toInteger(start);
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = (end === undefined || end > length) ? length : toInteger(end);
if (end < 0) {
end += length;
... | javascript | function baseFill(array, value, start, end) {
var length = array.length;
start = toInteger(start);
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = (end === undefined || end > length) ? length : toInteger(end);
if (end < 0) {
end += length;
... | [
"function",
"baseFill",
"(",
"array",
",",
"value",
",",
"start",
",",
"end",
")",
"{",
"var",
"length",
"=",
"array",
".",
"length",
";",
"start",
"=",
"toInteger",
"(",
"start",
")",
";",
"if",
"(",
"start",
"<",
"0",
")",
"{",
"start",
"=",
"-... | The base implementation of `_.fill` without an iteratee call guard.
@private
@param {Array} array The array to fill.
@param {*} value The value to fill `array` with.
@param {number} [start=0] The start position.
@param {number} [end=array.length] The end position.
@returns {Array} Returns `array`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"fill",
"without",
"an",
"iteratee",
"call",
"guard",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L3004-L3020 | 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.