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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
rollbar/rollbar.js | dist/rollbar.named-amd.js | Api | function Api(options, t, u, j) {
this.options = options;
this.transport = t;
this.url = u;
this.jsonBackup = j;
this.accessToken = options.accessToken;
this.transportOptions = _getTransport(options, u);
} | javascript | function Api(options, t, u, j) {
this.options = options;
this.transport = t;
this.url = u;
this.jsonBackup = j;
this.accessToken = options.accessToken;
this.transportOptions = _getTransport(options, u);
} | [
"function",
"Api",
"(",
"options",
",",
"t",
",",
"u",
",",
"j",
")",
"{",
"this",
".",
"options",
"=",
"options",
";",
"this",
".",
"transport",
"=",
"t",
";",
"this",
".",
"url",
"=",
"u",
";",
"this",
".",
"jsonBackup",
"=",
"j",
";",
"this"... | Api is an object that encapsulates methods of communicating with
the Rollbar API. It is a standard interface with some parts implemented
differently for server or browser contexts. It is an object that should
be instantiated when used so it can contain non-global options that may
be different for another instance of ... | [
"Api",
"is",
"an",
"object",
"that",
"encapsulates",
"methods",
"of",
"communicating",
"with",
"the",
"Rollbar",
"API",
".",
"It",
"is",
"a",
"standard",
"interface",
"with",
"some",
"parts",
"implemented",
"differently",
"for",
"server",
"or",
"browser",
"con... | d35e544f4347970e2a3082cac3e4af43e5e35113 | https://github.com/rollbar/rollbar.js/blob/d35e544f4347970e2a3082cac3e4af43e5e35113/dist/rollbar.named-amd.js#L3025-L3032 | train |
rollbar/rollbar.js | dist/rollbar.named-amd.js | ErrorStackParser$$parse | function ErrorStackParser$$parse(error) {
if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {
return this.parseOpera(error);
} else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
return this.parseV... | javascript | function ErrorStackParser$$parse(error) {
if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {
return this.parseOpera(error);
} else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
return this.parseV... | [
"function",
"ErrorStackParser$$parse",
"(",
"error",
")",
"{",
"if",
"(",
"typeof",
"error",
".",
"stacktrace",
"!==",
"'undefined'",
"||",
"typeof",
"error",
"[",
"'opera#sourceloc'",
"]",
"!==",
"'undefined'",
")",
"{",
"return",
"this",
".",
"parseOpera",
"... | Given an Error object, extract the most information from it.
@param error {Error}
@return Array[StackFrame] | [
"Given",
"an",
"Error",
"object",
"extract",
"the",
"most",
"information",
"from",
"it",
"."
] | d35e544f4347970e2a3082cac3e4af43e5e35113 | https://github.com/rollbar/rollbar.js/blob/d35e544f4347970e2a3082cac3e4af43e5e35113/dist/rollbar.named-amd.js#L4340-L4350 | train |
rollbar/rollbar.js | release/rollbar-1.0.1.require.js | _rollbarWindowOnError | function _rollbarWindowOnError(client, old, args) {
if (!args[4] && window._rollbarWrappedError) {
args[4] = window._rollbarWrappedError;
window._rollbarWrappedError = null;
}
globalNotifier.uncaughtError.apply(globalNotifier, args);
if (old) {
old.apply(window, args);
}
} | javascript | function _rollbarWindowOnError(client, old, args) {
if (!args[4] && window._rollbarWrappedError) {
args[4] = window._rollbarWrappedError;
window._rollbarWrappedError = null;
}
globalNotifier.uncaughtError.apply(globalNotifier, args);
if (old) {
old.apply(window, args);
}
} | [
"function",
"_rollbarWindowOnError",
"(",
"client",
",",
"old",
",",
"args",
")",
"{",
"if",
"(",
"!",
"args",
"[",
"4",
"]",
"&&",
"window",
".",
"_rollbarWrappedError",
")",
"{",
"args",
"[",
"4",
"]",
"=",
"window",
".",
"_rollbarWrappedError",
";",
... | Global window.onerror handler | [
"Global",
"window",
".",
"onerror",
"handler"
] | d35e544f4347970e2a3082cac3e4af43e5e35113 | https://github.com/rollbar/rollbar.js/blob/d35e544f4347970e2a3082cac3e4af43e5e35113/release/rollbar-1.0.1.require.js#L2395-L2405 | train |
jonschlinkert/gray-matter | examples/excerpt.js | firstFourLines | function firstFourLines(file, options) {
file.excerpt = file.content.split('\n').slice(0, 4).join(' ');
} | javascript | function firstFourLines(file, options) {
file.excerpt = file.content.split('\n').slice(0, 4).join(' ');
} | [
"function",
"firstFourLines",
"(",
"file",
",",
"options",
")",
"{",
"file",
".",
"excerpt",
"=",
"file",
".",
"content",
".",
"split",
"(",
"'\\n'",
")",
".",
"slice",
"(",
"0",
",",
"4",
")",
".",
"join",
"(",
"' '",
")",
";",
"}"
] | excerpt as a function returns the first 4 lines of the contents | [
"excerpt",
"as",
"a",
"function",
"returns",
"the",
"first",
"4",
"lines",
"of",
"the",
"contents"
] | 8a22958e0afd4b2e09c705becec1c35e76c4f0ee | https://github.com/jonschlinkert/gray-matter/blob/8a22958e0afd4b2e09c705becec1c35e76c4f0ee/examples/excerpt.js#L20-L22 | train |
jonschlinkert/gray-matter | benchmark/code/read.js | parser | function parser(lang, opts) {
lang = lang || opts.lang;
if (engines.hasOwnProperty(lang)) {
return engines[lang];
}
return engines.yaml;
} | javascript | function parser(lang, opts) {
lang = lang || opts.lang;
if (engines.hasOwnProperty(lang)) {
return engines[lang];
}
return engines.yaml;
} | [
"function",
"parser",
"(",
"lang",
",",
"opts",
")",
"{",
"lang",
"=",
"lang",
"||",
"opts",
".",
"lang",
";",
"if",
"(",
"engines",
".",
"hasOwnProperty",
"(",
"lang",
")",
")",
"{",
"return",
"engines",
"[",
"lang",
"]",
";",
"}",
"return",
"engi... | Determine the correct the parser to use
@param {String} `lang` Use this if defined and it exists
@param {Object} `opts` Otherwise, fall back to options.parser or js-yaml
@return {Function} | [
"Determine",
"the",
"correct",
"the",
"parser",
"to",
"use"
] | 8a22958e0afd4b2e09c705becec1c35e76c4f0ee | https://github.com/jonschlinkert/gray-matter/blob/8a22958e0afd4b2e09c705becec1c35e76c4f0ee/benchmark/code/read.js#L67-L73 | train |
jonschlinkert/gray-matter | index.js | parseMatter | function parseMatter(file, options) {
const opts = defaults(options);
const open = opts.delimiters[0];
const close = '\n' + opts.delimiters[1];
let str = file.content;
if (opts.language) {
file.language = opts.language;
}
// get the length of the opening delimiter
const openLen = open.length;
if... | javascript | function parseMatter(file, options) {
const opts = defaults(options);
const open = opts.delimiters[0];
const close = '\n' + opts.delimiters[1];
let str = file.content;
if (opts.language) {
file.language = opts.language;
}
// get the length of the opening delimiter
const openLen = open.length;
if... | [
"function",
"parseMatter",
"(",
"file",
",",
"options",
")",
"{",
"const",
"opts",
"=",
"defaults",
"(",
"options",
")",
";",
"const",
"open",
"=",
"opts",
".",
"delimiters",
"[",
"0",
"]",
";",
"const",
"close",
"=",
"'\\n'",
"+",
"opts",
".",
"deli... | Parse front matter | [
"Parse",
"front",
"matter"
] | 8a22958e0afd4b2e09c705becec1c35e76c4f0ee | https://github.com/jonschlinkert/gray-matter/blob/8a22958e0afd4b2e09c705becec1c35e76c4f0ee/index.js#L57-L131 | train |
nkzawa/socket.io-stream | lib/socket.js | Socket | function Socket(sio, options) {
if (!(this instanceof Socket)) {
return new Socket(sio, options);
}
EventEmitter.call(this);
options = options || {};
this.sio = sio;
this.forceBase64 = !!options.forceBase64;
this.streams = {};
this.encoder = new parser.Encoder();
this.decoder = new parser.Decod... | javascript | function Socket(sio, options) {
if (!(this instanceof Socket)) {
return new Socket(sio, options);
}
EventEmitter.call(this);
options = options || {};
this.sio = sio;
this.forceBase64 = !!options.forceBase64;
this.streams = {};
this.encoder = new parser.Encoder();
this.decoder = new parser.Decod... | [
"function",
"Socket",
"(",
"sio",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Socket",
")",
")",
"{",
"return",
"new",
"Socket",
"(",
"sio",
",",
"options",
")",
";",
"}",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";"... | Bidirectional stream socket which wraps Socket.IO.
@param {socket.io#Socket} socket.io
@api public | [
"Bidirectional",
"stream",
"socket",
"which",
"wraps",
"Socket",
".",
"IO",
"."
] | 8feef9e9ce296ec87e471731735abc6982e4158d | https://github.com/nkzawa/socket.io-stream/blob/8feef9e9ce296ec87e471731735abc6982e4158d/lib/socket.js#L35-L61 | train |
nkzawa/socket.io-stream | lib/index.js | lookup | function lookup(sio, options) {
options = options || {};
if (null == options.forceBase64) {
options.forceBase64 = exports.forceBase64;
}
if (!sio._streamSocket) {
sio._streamSocket = new Socket(sio, options);
}
return sio._streamSocket;
} | javascript | function lookup(sio, options) {
options = options || {};
if (null == options.forceBase64) {
options.forceBase64 = exports.forceBase64;
}
if (!sio._streamSocket) {
sio._streamSocket = new Socket(sio, options);
}
return sio._streamSocket;
} | [
"function",
"lookup",
"(",
"sio",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"null",
"==",
"options",
".",
"forceBase64",
")",
"{",
"options",
".",
"forceBase64",
"=",
"exports",
".",
"forceBase64",
";",
"}",
... | Look up an existing Socket.
@param {socket.io#Socket} socket.io
@param {Object} options
@return {Socket} Socket instance
@api public | [
"Look",
"up",
"an",
"existing",
"Socket",
"."
] | 8feef9e9ce296ec87e471731735abc6982e4158d | https://github.com/nkzawa/socket.io-stream/blob/8feef9e9ce296ec87e471731735abc6982e4158d/lib/index.js#L44-L54 | train |
nkzawa/socket.io-stream | lib/blob-read-stream.js | BlobReadStream | function BlobReadStream(blob, options) {
if (!(this instanceof BlobReadStream)) {
return new BlobReadStream(blob, options);
}
Readable.call(this, options);
options = options || {};
this.blob = blob;
this.slice = blob.slice || blob.webkitSlice || blob.mozSlice;
this.start = 0;
this.sync = options.s... | javascript | function BlobReadStream(blob, options) {
if (!(this instanceof BlobReadStream)) {
return new BlobReadStream(blob, options);
}
Readable.call(this, options);
options = options || {};
this.blob = blob;
this.slice = blob.slice || blob.webkitSlice || blob.mozSlice;
this.start = 0;
this.sync = options.s... | [
"function",
"BlobReadStream",
"(",
"blob",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"BlobReadStream",
")",
")",
"{",
"return",
"new",
"BlobReadStream",
"(",
"blob",
",",
"options",
")",
";",
"}",
"Readable",
".",
"call",
"(",
... | Readable stream for Blob and File on browser.
@param {Object} options
@api private | [
"Readable",
"stream",
"for",
"Blob",
"and",
"File",
"on",
"browser",
"."
] | 8feef9e9ce296ec87e471731735abc6982e4158d | https://github.com/nkzawa/socket.io-stream/blob/8feef9e9ce296ec87e471731735abc6982e4158d/lib/blob-read-stream.js#L16-L39 | train |
LeaVerou/prefixfree | plugins/prefixfree.jsapi.js | dig | function dig(o, namerg) {
var os = [],
out;
function digger(o, namerg, res) {
o = o || this;
res = res || [];
for(var i = 0; i < res.length; i++) {
if(o === res[i]) {
return res;
}
}
os.push(o);
try{
for(var name in o);
} catch(e) {
return [];
}
var inside,
cle... | javascript | function dig(o, namerg) {
var os = [],
out;
function digger(o, namerg, res) {
o = o || this;
res = res || [];
for(var i = 0; i < res.length; i++) {
if(o === res[i]) {
return res;
}
}
os.push(o);
try{
for(var name in o);
} catch(e) {
return [];
}
var inside,
cle... | [
"function",
"dig",
"(",
"o",
",",
"namerg",
")",
"{",
"var",
"os",
"=",
"[",
"]",
",",
"out",
";",
"function",
"digger",
"(",
"o",
",",
"namerg",
",",
"res",
")",
"{",
"o",
"=",
"o",
"||",
"this",
";",
"res",
"=",
"res",
"||",
"[",
"]",
";"... | This function digs through the objects in order to find out which have prefixed methods and therefore, which need to be extended. | [
"This",
"function",
"digs",
"through",
"the",
"objects",
"in",
"order",
"to",
"find",
"out",
"which",
"have",
"prefixed",
"methods",
"and",
"therefore",
"which",
"need",
"to",
"be",
"extended",
"."
] | d69c83ae5e149363a480cd0182f91bce61600482 | https://github.com/LeaVerou/prefixfree/blob/d69c83ae5e149363a480cd0182f91bce61600482/plugins/prefixfree.jsapi.js#L50-L96 | train |
felipernb/algorithms.js | src/algorithms/math/collatz_conjecture.js | calculateCollatzConjecture | function calculateCollatzConjecture(number) {
if (!(number in cache)) {
if (number % 2 === 0) cache[number] = number >> 1;
else cache[number] = number * 3 + 1;
}
return cache[number];
} | javascript | function calculateCollatzConjecture(number) {
if (!(number in cache)) {
if (number % 2 === 0) cache[number] = number >> 1;
else cache[number] = number * 3 + 1;
}
return cache[number];
} | [
"function",
"calculateCollatzConjecture",
"(",
"number",
")",
"{",
"if",
"(",
"!",
"(",
"number",
"in",
"cache",
")",
")",
"{",
"if",
"(",
"number",
"%",
"2",
"===",
"0",
")",
"cache",
"[",
"number",
"]",
"=",
"number",
">>",
"1",
";",
"else",
"cac... | Collatz Conjecture algorithm
@param Number
@return Number | [
"Collatz",
"Conjecture",
"algorithm"
] | 94b4bb6050b5671f3405af0189369452fda6b4df | https://github.com/felipernb/algorithms.js/blob/94b4bb6050b5671f3405af0189369452fda6b4df/src/algorithms/math/collatz_conjecture.js#L10-L17 | train |
felipernb/algorithms.js | src/algorithms/math/collatz_conjecture.js | generateCollatzConjecture | function generateCollatzConjecture(number) {
const collatzConjecture = [];
do {
number = calculateCollatzConjecture(number);
collatzConjecture.push(number);
} while (number !== 1);
return collatzConjecture;
} | javascript | function generateCollatzConjecture(number) {
const collatzConjecture = [];
do {
number = calculateCollatzConjecture(number);
collatzConjecture.push(number);
} while (number !== 1);
return collatzConjecture;
} | [
"function",
"generateCollatzConjecture",
"(",
"number",
")",
"{",
"const",
"collatzConjecture",
"=",
"[",
"]",
";",
"do",
"{",
"number",
"=",
"calculateCollatzConjecture",
"(",
"number",
")",
";",
"collatzConjecture",
".",
"push",
"(",
"number",
")",
";",
"}",... | Generate Collatz Conjecture
@param Number
@return Array | [
"Generate",
"Collatz",
"Conjecture"
] | 94b4bb6050b5671f3405af0189369452fda6b4df | https://github.com/felipernb/algorithms.js/blob/94b4bb6050b5671f3405af0189369452fda6b4df/src/algorithms/math/collatz_conjecture.js#L25-L34 | train |
felipernb/algorithms.js | src/algorithms/graph/dijkstra.js | dijkstra | function dijkstra(graph, s) {
const distance = {};
const previous = {};
const q = new PriorityQueue();
// Initialize
distance[s] = 0;
graph.vertices.forEach(v => {
if (v !== s) {
distance[v] = Infinity;
}
q.insert(v, distance[v]);
});
let currNode;
const relax = v => {
const new... | javascript | function dijkstra(graph, s) {
const distance = {};
const previous = {};
const q = new PriorityQueue();
// Initialize
distance[s] = 0;
graph.vertices.forEach(v => {
if (v !== s) {
distance[v] = Infinity;
}
q.insert(v, distance[v]);
});
let currNode;
const relax = v => {
const new... | [
"function",
"dijkstra",
"(",
"graph",
",",
"s",
")",
"{",
"const",
"distance",
"=",
"{",
"}",
";",
"const",
"previous",
"=",
"{",
"}",
";",
"const",
"q",
"=",
"new",
"PriorityQueue",
"(",
")",
";",
"// Initialize",
"distance",
"[",
"s",
"]",
"=",
"... | Calculates the shortest paths in a graph to every node from the node s
with Dijkstra's algorithm
@param {Object} graph An adjacency list representing the graph
@param {string} s the starting node | [
"Calculates",
"the",
"shortest",
"paths",
"in",
"a",
"graph",
"to",
"every",
"node",
"from",
"the",
"node",
"s",
"with",
"Dijkstra",
"s",
"algorithm"
] | 94b4bb6050b5671f3405af0189369452fda6b4df | https://github.com/felipernb/algorithms.js/blob/94b4bb6050b5671f3405af0189369452fda6b4df/src/algorithms/graph/dijkstra.js#L11-L41 | train |
timekit-io/booking-js | src/render.js | function(suppliedConfig) {
var targetElement = suppliedConfig.el || getConfig().el;
rootTarget = $(targetElement);
if (rootTarget.length === 0) {
throw triggerError('No target DOM element was found (' + targetElement + ')');
}
rootTarget.addClass('bookingjs');
rootTarget.children(':not... | javascript | function(suppliedConfig) {
var targetElement = suppliedConfig.el || getConfig().el;
rootTarget = $(targetElement);
if (rootTarget.length === 0) {
throw triggerError('No target DOM element was found (' + targetElement + ')');
}
rootTarget.addClass('bookingjs');
rootTarget.children(':not... | [
"function",
"(",
"suppliedConfig",
")",
"{",
"var",
"targetElement",
"=",
"suppliedConfig",
".",
"el",
"||",
"getConfig",
"(",
")",
".",
"el",
";",
"rootTarget",
"=",
"$",
"(",
"targetElement",
")",
";",
"if",
"(",
"rootTarget",
".",
"length",
"===",
"0"... | Make sure DOM element is ready and clean it | [
"Make",
"sure",
"DOM",
"element",
"is",
"ready",
"and",
"clean",
"it"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L34-L47 | train | |
timekit-io/booking-js | src/render.js | function() {
showLoadingScreen();
calendarTarget.fullCalendar('removeEventSources');
if (getConfig().booking.graph === 'group_customer' || getConfig().booking.graph === 'group_customer_payment') {
// If in group bookings mode, fetch slots
timekitGetBookingSlots();
} else {
// If in ... | javascript | function() {
showLoadingScreen();
calendarTarget.fullCalendar('removeEventSources');
if (getConfig().booking.graph === 'group_customer' || getConfig().booking.graph === 'group_customer_payment') {
// If in group bookings mode, fetch slots
timekitGetBookingSlots();
} else {
// If in ... | [
"function",
"(",
")",
"{",
"showLoadingScreen",
"(",
")",
";",
"calendarTarget",
".",
"fullCalendar",
"(",
"'removeEventSources'",
")",
";",
"if",
"(",
"getConfig",
"(",
")",
".",
"booking",
".",
"graph",
"===",
"'group_customer'",
"||",
"getConfig",
"(",
")... | Universal functional to retrieve availability through either findtime or group booking slots | [
"Universal",
"functional",
"to",
"retrieve",
"availability",
"through",
"either",
"findtime",
"or",
"group",
"booking",
"slots"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L144-L158 | train | |
timekit-io/booking-js | src/render.js | function(firstEventStart) {
calendarTarget.fullCalendar('gotoDate', firstEventStart);
var firstEventStartHour = moment(firstEventStart).format('H');
scrollToTime(firstEventStartHour);
} | javascript | function(firstEventStart) {
calendarTarget.fullCalendar('gotoDate', firstEventStart);
var firstEventStartHour = moment(firstEventStart).format('H');
scrollToTime(firstEventStartHour);
} | [
"function",
"(",
"firstEventStart",
")",
"{",
"calendarTarget",
".",
"fullCalendar",
"(",
"'gotoDate'",
",",
"firstEventStart",
")",
";",
"var",
"firstEventStartHour",
"=",
"moment",
"(",
"firstEventStart",
")",
".",
"format",
"(",
"'H'",
")",
";",
"scrollToTime... | Go to the first timeslot in a list of timeslots | [
"Go",
"to",
"the",
"first",
"timeslot",
"in",
"a",
"list",
"of",
"timeslots"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L161-L168 | train | |
timekit-io/booking-js | src/render.js | function(time) {
// Only proceed for agendaWeek view
if (calendarTarget.fullCalendar('getView').name !== 'agendaWeek'){
return;
}
// Get height of each hour row
var slotDuration = calendarTarget.fullCalendar('option', 'slotDuration');
var slotDurationMinutes = 30;
if (slotDuration) s... | javascript | function(time) {
// Only proceed for agendaWeek view
if (calendarTarget.fullCalendar('getView').name !== 'agendaWeek'){
return;
}
// Get height of each hour row
var slotDuration = calendarTarget.fullCalendar('option', 'slotDuration');
var slotDurationMinutes = 30;
if (slotDuration) s... | [
"function",
"(",
"time",
")",
"{",
"// Only proceed for agendaWeek view",
"if",
"(",
"calendarTarget",
".",
"fullCalendar",
"(",
"'getView'",
")",
".",
"name",
"!==",
"'agendaWeek'",
")",
"{",
"return",
";",
"}",
"// Get height of each hour row",
"var",
"slotDuratio... | Scrolls fullcalendar to the specified hour | [
"Scrolls",
"fullcalendar",
"to",
"the",
"specified",
"hour"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L171-L212 | train | |
timekit-io/booking-js | src/render.js | function() {
var showTimezoneHelper = getConfig().ui.show_timezone_helper;
var showCredits = getConfig().ui.show_credits;
// If neither TZ helper or credits is shown, dont render the footer
if (!showTimezoneHelper && !showCredits) return
var campaignName = 'widget';
var campaignSource = windo... | javascript | function() {
var showTimezoneHelper = getConfig().ui.show_timezone_helper;
var showCredits = getConfig().ui.show_credits;
// If neither TZ helper or credits is shown, dont render the footer
if (!showTimezoneHelper && !showCredits) return
var campaignName = 'widget';
var campaignSource = windo... | [
"function",
"(",
")",
"{",
"var",
"showTimezoneHelper",
"=",
"getConfig",
"(",
")",
".",
"ui",
".",
"show_timezone_helper",
";",
"var",
"showCredits",
"=",
"getConfig",
"(",
")",
".",
"ui",
".",
"show_credits",
";",
"// If neither TZ helper or credits is shown, do... | Calculate and display timezone helper | [
"Calculate",
"and",
"display",
"timezone",
"helper"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L228-L267 | train | |
timekit-io/booking-js | src/render.js | function () {
var tzGuess = moment.tz.guess() || 'UTC';
setCustomerTimezone(tzGuess);
// Add the guessed customer timezone to list if its unknwon
var knownTimezone = $.grep(timezones, function (tz) {
return tz.key === customerTimezone
}).length > 0
if (!knownTimezone) {
var name = '... | javascript | function () {
var tzGuess = moment.tz.guess() || 'UTC';
setCustomerTimezone(tzGuess);
// Add the guessed customer timezone to list if its unknwon
var knownTimezone = $.grep(timezones, function (tz) {
return tz.key === customerTimezone
}).length > 0
if (!knownTimezone) {
var name = '... | [
"function",
"(",
")",
"{",
"var",
"tzGuess",
"=",
"moment",
".",
"tz",
".",
"guess",
"(",
")",
"||",
"'UTC'",
";",
"setCustomerTimezone",
"(",
"tzGuess",
")",
";",
"// Add the guessed customer timezone to list if its unknwon",
"var",
"knownTimezone",
"=",
"$",
"... | Guess the timezone and set global variable | [
"Guess",
"the",
"timezone",
"and",
"set",
"global",
"variable"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L270-L285 | train | |
timekit-io/booking-js | src/render.js | function() {
var sizing = decideCalendarSize(getConfig().fullcalendar.defaultView);
var args = {
height: sizing.height,
eventClick: clickTimeslot,
windowResize: function() {
var sizing = decideCalendarSize();
calendarTarget.fullCalendar('changeView', sizing.view);
cal... | javascript | function() {
var sizing = decideCalendarSize(getConfig().fullcalendar.defaultView);
var args = {
height: sizing.height,
eventClick: clickTimeslot,
windowResize: function() {
var sizing = decideCalendarSize();
calendarTarget.fullCalendar('changeView', sizing.view);
cal... | [
"function",
"(",
")",
"{",
"var",
"sizing",
"=",
"decideCalendarSize",
"(",
"getConfig",
"(",
")",
".",
"fullcalendar",
".",
"defaultView",
")",
";",
"var",
"args",
"=",
"{",
"height",
":",
"sizing",
".",
"height",
",",
"eventClick",
":",
"clickTimeslot",
... | Setup and render FullCalendar | [
"Setup",
"and",
"render",
"FullCalendar"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L296-L326 | train | |
timekit-io/booking-js | src/render.js | function(eventData) {
if (!getConfig().disable_confirm_page) {
showBookingPage(eventData)
} else {
$('.fc-event-clicked').removeClass('fc-event-clicked');
$(this).addClass('fc-event-clicked');
utils.doCallback('clickTimeslot', eventData);
}
} | javascript | function(eventData) {
if (!getConfig().disable_confirm_page) {
showBookingPage(eventData)
} else {
$('.fc-event-clicked').removeClass('fc-event-clicked');
$(this).addClass('fc-event-clicked');
utils.doCallback('clickTimeslot', eventData);
}
} | [
"function",
"(",
"eventData",
")",
"{",
"if",
"(",
"!",
"getConfig",
"(",
")",
".",
"disable_confirm_page",
")",
"{",
"showBookingPage",
"(",
"eventData",
")",
"}",
"else",
"{",
"$",
"(",
"'.fc-event-clicked'",
")",
".",
"removeClass",
"(",
"'fc-event-clicke... | Clicking a timeslot | [
"Clicking",
"a",
"timeslot"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L329-L339 | train | |
timekit-io/booking-js | src/render.js | function(currentView) {
currentView = currentView || calendarTarget.fullCalendar('getView').name
var view = getConfig().fullcalendar.defaultView
var height = 385;
if (rootTarget.width() < 480) {
rootTarget.addClass('is-small');
if (getConfig().ui.avatar) height -= 15;
if (currentVie... | javascript | function(currentView) {
currentView = currentView || calendarTarget.fullCalendar('getView').name
var view = getConfig().fullcalendar.defaultView
var height = 385;
if (rootTarget.width() < 480) {
rootTarget.addClass('is-small');
if (getConfig().ui.avatar) height -= 15;
if (currentVie... | [
"function",
"(",
"currentView",
")",
"{",
"currentView",
"=",
"currentView",
"||",
"calendarTarget",
".",
"fullCalendar",
"(",
"'getView'",
")",
".",
"name",
"var",
"view",
"=",
"getConfig",
"(",
")",
".",
"fullcalendar",
".",
"defaultView",
"var",
"height",
... | Fires when window is resized and calendar must adhere | [
"Fires",
"when",
"window",
"is",
"resized",
"and",
"calendar",
"must",
"adhere"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L342-L370 | train | |
timekit-io/booking-js | src/render.js | function(eventData) {
var firstEventStart = moment(eventData[0].start)
var firstEventEnd = moment(eventData[0].end)
var firstEventDuration = firstEventEnd.diff(firstEventStart, 'minutes')
if (firstEventDuration <= 90) {
calendarTarget.fullCalendar('option', 'slotDuration', '00:15:00')
}
... | javascript | function(eventData) {
var firstEventStart = moment(eventData[0].start)
var firstEventEnd = moment(eventData[0].end)
var firstEventDuration = firstEventEnd.diff(firstEventStart, 'minutes')
if (firstEventDuration <= 90) {
calendarTarget.fullCalendar('option', 'slotDuration', '00:15:00')
}
... | [
"function",
"(",
"eventData",
")",
"{",
"var",
"firstEventStart",
"=",
"moment",
"(",
"eventData",
"[",
"0",
"]",
".",
"start",
")",
"var",
"firstEventEnd",
"=",
"moment",
"(",
"eventData",
"[",
"0",
"]",
".",
"end",
")",
"var",
"firstEventDuration",
"="... | Render the supplied calendar events in FullCalendar | [
"Render",
"the",
"supplied",
"calendar",
"events",
"in",
"FullCalendar"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L373-L392 | train | |
timekit-io/booking-js | src/render.js | function() {
utils.doCallback('showLoadingScreen');
var template = require('./templates/loading.html');
loadingTarget = $(template.render({
loadingIcon: require('!svg-inline!./assets/loading-spinner.svg')
}));
rootTarget.append(loadingTarget);
} | javascript | function() {
utils.doCallback('showLoadingScreen');
var template = require('./templates/loading.html');
loadingTarget = $(template.render({
loadingIcon: require('!svg-inline!./assets/loading-spinner.svg')
}));
rootTarget.append(loadingTarget);
} | [
"function",
"(",
")",
"{",
"utils",
".",
"doCallback",
"(",
"'showLoadingScreen'",
")",
";",
"var",
"template",
"=",
"require",
"(",
"'./templates/loading.html'",
")",
";",
"loadingTarget",
"=",
"$",
"(",
"template",
".",
"render",
"(",
"{",
"loadingIcon",
"... | Show loading spinner screen | [
"Show",
"loading",
"spinner",
"screen"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L421-L432 | train | |
timekit-io/booking-js | src/render.js | function(message) {
// If an error already has been thrown, exit
if (errorTarget) return message
utils.doCallback('errorTriggered', message);
utils.logError(message)
// If no target DOM element exists, only do the logging
if (!rootTarget) return message
var messageProcessed = message
... | javascript | function(message) {
// If an error already has been thrown, exit
if (errorTarget) return message
utils.doCallback('errorTriggered', message);
utils.logError(message)
// If no target DOM element exists, only do the logging
if (!rootTarget) return message
var messageProcessed = message
... | [
"function",
"(",
"message",
")",
"{",
"// If an error already has been thrown, exit",
"if",
"(",
"errorTarget",
")",
"return",
"message",
"utils",
".",
"doCallback",
"(",
"'errorTriggered'",
",",
"message",
")",
";",
"utils",
".",
"logError",
"(",
"message",
")",
... | Show error and warning screen | [
"Show",
"error",
"and",
"warning",
"screen"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L447-L481 | train | |
timekit-io/booking-js | src/render.js | function () {
var textTemplate = require('./templates/fields/text.html');
var textareaTemplate = require('./templates/fields/textarea.html');
var selectTemplate = require('./templates/fields/select.html');
var checkboxTemplate = require('./templates/fields/checkbox.html');
var fieldsTarget = [... | javascript | function () {
var textTemplate = require('./templates/fields/text.html');
var textareaTemplate = require('./templates/fields/textarea.html');
var selectTemplate = require('./templates/fields/select.html');
var checkboxTemplate = require('./templates/fields/checkbox.html');
var fieldsTarget = [... | [
"function",
"(",
")",
"{",
"var",
"textTemplate",
"=",
"require",
"(",
"'./templates/fields/text.html'",
")",
";",
"var",
"textareaTemplate",
"=",
"require",
"(",
"'./templates/fields/textarea.html'",
")",
";",
"var",
"selectTemplate",
"=",
"require",
"(",
"'./templ... | Render customer fields | [
"Render",
"customer",
"fields"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L484-L508 | train | |
timekit-io/booking-js | src/render.js | function(eventData) {
utils.doCallback('showBookingPage', eventData);
var template = require('./templates/booking-page.html');
var dateFormat = getConfig().ui.booking_date_format || moment.localeData().longDateFormat('LL');
var timeFormat = getConfig().ui.booking_time_format || moment.localeData().lo... | javascript | function(eventData) {
utils.doCallback('showBookingPage', eventData);
var template = require('./templates/booking-page.html');
var dateFormat = getConfig().ui.booking_date_format || moment.localeData().longDateFormat('LL');
var timeFormat = getConfig().ui.booking_time_format || moment.localeData().lo... | [
"function",
"(",
"eventData",
")",
"{",
"utils",
".",
"doCallback",
"(",
"'showBookingPage'",
",",
"eventData",
")",
";",
"var",
"template",
"=",
"require",
"(",
"'./templates/booking-page.html'",
")",
";",
"var",
"dateFormat",
"=",
"getConfig",
"(",
")",
".",... | Event handler when a timeslot is clicked in FullCalendar | [
"Event",
"handler",
"when",
"a",
"timeslot",
"is",
"clicked",
"in",
"FullCalendar"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L511-L577 | train | |
timekit-io/booking-js | src/render.js | function(form, e, eventData) {
e.preventDefault();
var formElement = $(form);
if(formElement.hasClass('success')) {
getAvailability();
hideBookingPage();
return;
}
// Abort if form is submitting, have submitted or does not validate
if(formElement.hasClass('loading') || form... | javascript | function(form, e, eventData) {
e.preventDefault();
var formElement = $(form);
if(formElement.hasClass('success')) {
getAvailability();
hideBookingPage();
return;
}
// Abort if form is submitting, have submitted or does not validate
if(formElement.hasClass('loading') || form... | [
"function",
"(",
"form",
",",
"e",
",",
"eventData",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"var",
"formElement",
"=",
"$",
"(",
"form",
")",
";",
"if",
"(",
"formElement",
".",
"hasClass",
"(",
"'success'",
")",
")",
"{",
"getAvailabil... | Event handler on form submit | [
"Event",
"handler",
"on",
"form",
"submit"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L600-L643 | train | |
timekit-io/booking-js | src/render.js | function(formData, eventData) {
var nativeFields = ['name', 'email', 'location', 'comment', 'phone', 'voip']
var args = {
start: eventData.start.format(),
end: eventData.end.format(),
description: '',
customer: {
name: formData.name,
email: formData.email,
timez... | javascript | function(formData, eventData) {
var nativeFields = ['name', 'email', 'location', 'comment', 'phone', 'voip']
var args = {
start: eventData.start.format(),
end: eventData.end.format(),
description: '',
customer: {
name: formData.name,
email: formData.email,
timez... | [
"function",
"(",
"formData",
",",
"eventData",
")",
"{",
"var",
"nativeFields",
"=",
"[",
"'name'",
",",
"'email'",
",",
"'location'",
",",
"'comment'",
",",
"'phone'",
",",
"'voip'",
"]",
"var",
"args",
"=",
"{",
"start",
":",
"eventData",
".",
"start",... | Create new booking | [
"Create",
"new",
"booking"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/render.js#L661-L740 | train | |
timekit-io/booking-js | src/init.js | function (response, suppliedConfig) {
var remoteConfig = response.data
// streamline naming of object keys
if (remoteConfig.id) {
remoteConfig.project_id = remoteConfig.id
delete remoteConfig.id
}
if (remoteConfig.slug) {
remoteConfig.project_slug = remoteConfig.slug
delete r... | javascript | function (response, suppliedConfig) {
var remoteConfig = response.data
// streamline naming of object keys
if (remoteConfig.id) {
remoteConfig.project_id = remoteConfig.id
delete remoteConfig.id
}
if (remoteConfig.slug) {
remoteConfig.project_slug = remoteConfig.slug
delete r... | [
"function",
"(",
"response",
",",
"suppliedConfig",
")",
"{",
"var",
"remoteConfig",
"=",
"response",
".",
"data",
"// streamline naming of object keys",
"if",
"(",
"remoteConfig",
".",
"id",
")",
"{",
"remoteConfig",
".",
"project_id",
"=",
"remoteConfig",
".",
... | Process retrieved project config and start | [
"Process",
"retrieved",
"project",
"config",
"and",
"start"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/init.js#L105-L120 | train | |
timekit-io/booking-js | src/init.js | function(suppliedConfig) {
// Handle config and defaults
try {
config.parseAndUpdate(suppliedConfig);
} catch (e) {
render.triggerError(e);
return this
}
utils.logDebug(['Final config:', getConfig()]);
try {
return startRender();
} catch (e) {
render.triggerEr... | javascript | function(suppliedConfig) {
// Handle config and defaults
try {
config.parseAndUpdate(suppliedConfig);
} catch (e) {
render.triggerError(e);
return this
}
utils.logDebug(['Final config:', getConfig()]);
try {
return startRender();
} catch (e) {
render.triggerEr... | [
"function",
"(",
"suppliedConfig",
")",
"{",
"// Handle config and defaults",
"try",
"{",
"config",
".",
"parseAndUpdate",
"(",
"suppliedConfig",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"render",
".",
"triggerError",
"(",
"e",
")",
";",
"return",
"this",... | Parse the config and start rendering | [
"Parse",
"the",
"config",
"and",
"start",
"rendering"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/init.js#L123-L140 | train | |
timekit-io/booking-js | src/config.js | function(suppliedConfig) {
if (typeof suppliedConfig.sdk === 'undefined') suppliedConfig.sdk = {}
if (suppliedConfig.app_key) suppliedConfig.sdk.appKey = suppliedConfig.app_key
return $.extend(true, {}, defaultConfig.primary.sdk, suppliedConfig.sdk);
} | javascript | function(suppliedConfig) {
if (typeof suppliedConfig.sdk === 'undefined') suppliedConfig.sdk = {}
if (suppliedConfig.app_key) suppliedConfig.sdk.appKey = suppliedConfig.app_key
return $.extend(true, {}, defaultConfig.primary.sdk, suppliedConfig.sdk);
} | [
"function",
"(",
"suppliedConfig",
")",
"{",
"if",
"(",
"typeof",
"suppliedConfig",
".",
"sdk",
"===",
"'undefined'",
")",
"suppliedConfig",
".",
"sdk",
"=",
"{",
"}",
"if",
"(",
"suppliedConfig",
".",
"app_key",
")",
"suppliedConfig",
".",
"sdk",
".",
"ap... | Setup defaults for the SDK | [
"Setup",
"defaults",
"for",
"the",
"SDK"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/config.js#L13-L17 | train | |
timekit-io/booking-js | src/config.js | function(suppliedConfig) {
suppliedConfig.sdk = prepareSdkConfig(suppliedConfig)
return $.extend(true, {}, defaultConfig.primary, suppliedConfig);
} | javascript | function(suppliedConfig) {
suppliedConfig.sdk = prepareSdkConfig(suppliedConfig)
return $.extend(true, {}, defaultConfig.primary, suppliedConfig);
} | [
"function",
"(",
"suppliedConfig",
")",
"{",
"suppliedConfig",
".",
"sdk",
"=",
"prepareSdkConfig",
"(",
"suppliedConfig",
")",
"return",
"$",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"defaultConfig",
".",
"primary",
",",
"suppliedConfig",
")",
";",
... | Merge defaults into passed config | [
"Merge",
"defaults",
"into",
"passed",
"config"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/config.js#L20-L23 | train | |
timekit-io/booking-js | src/config.js | function(config) {
$.each(config.customer_fields, function (key, field) {
if (!defaultConfig.customerFieldsNativeFormats[key]) return
config.customer_fields[key] = $.extend({}, defaultConfig.customerFieldsNativeFormats[key], field);
})
return config
} | javascript | function(config) {
$.each(config.customer_fields, function (key, field) {
if (!defaultConfig.customerFieldsNativeFormats[key]) return
config.customer_fields[key] = $.extend({}, defaultConfig.customerFieldsNativeFormats[key], field);
})
return config
} | [
"function",
"(",
"config",
")",
"{",
"$",
".",
"each",
"(",
"config",
".",
"customer_fields",
",",
"function",
"(",
"key",
",",
"field",
")",
"{",
"if",
"(",
"!",
"defaultConfig",
".",
"customerFieldsNativeFormats",
"[",
"key",
"]",
")",
"return",
"confi... | Set default formats for native fields | [
"Set",
"default",
"formats",
"for",
"native",
"fields"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/config.js#L31-L37 | train | |
timekit-io/booking-js | src/config.js | function (localConfig, propertyName, propertyObject) {
var presetCheck = defaultConfig.presets[propertyName][propertyObject];
if (presetCheck) return $.extend(true, {}, presetCheck, localConfig);
return localConfig
} | javascript | function (localConfig, propertyName, propertyObject) {
var presetCheck = defaultConfig.presets[propertyName][propertyObject];
if (presetCheck) return $.extend(true, {}, presetCheck, localConfig);
return localConfig
} | [
"function",
"(",
"localConfig",
",",
"propertyName",
",",
"propertyObject",
")",
"{",
"var",
"presetCheck",
"=",
"defaultConfig",
".",
"presets",
"[",
"propertyName",
"]",
"[",
"propertyObject",
"]",
";",
"if",
"(",
"presetCheck",
")",
"return",
"$",
".",
"e... | Apply the config presets given a configuration | [
"Apply",
"the",
"config",
"presets",
"given",
"a",
"configuration"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/config.js#L40-L44 | train | |
timekit-io/booking-js | src/config.js | function (suppliedConfig, urlParams) {
$.each(suppliedConfig.customer_fields, function (key) {
if (!urlParams['customer.' + key]) return
suppliedConfig.customer_fields[key].prefilled = urlParams['customer.' + key];
});
return suppliedConfig
} | javascript | function (suppliedConfig, urlParams) {
$.each(suppliedConfig.customer_fields, function (key) {
if (!urlParams['customer.' + key]) return
suppliedConfig.customer_fields[key].prefilled = urlParams['customer.' + key];
});
return suppliedConfig
} | [
"function",
"(",
"suppliedConfig",
",",
"urlParams",
")",
"{",
"$",
".",
"each",
"(",
"suppliedConfig",
".",
"customer_fields",
",",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"!",
"urlParams",
"[",
"'customer.'",
"+",
"key",
"]",
")",
"return",
"suppl... | Prefill customer fields based on URL query string | [
"Prefill",
"customer",
"fields",
"based",
"on",
"URL",
"query",
"string"
] | c6dc20bccc9407d3f090c6f454bb9796388df218 | https://github.com/timekit-io/booking-js/blob/c6dc20bccc9407d3f090c6f454bb9796388df218/src/config.js#L47-L53 | train | |
yoannmoinet/nipplejs | src/collection.js | function (evt, data) {
// Identify the event type with the nipple's id.
type = evt.type + ' ' + data.id + ':' + evt.type;
self.trigger(type, data);
} | javascript | function (evt, data) {
// Identify the event type with the nipple's id.
type = evt.type + ' ' + data.id + ':' + evt.type;
self.trigger(type, data);
} | [
"function",
"(",
"evt",
",",
"data",
")",
"{",
"// Identify the event type with the nipple's id.",
"type",
"=",
"evt",
".",
"type",
"+",
"' '",
"+",
"data",
".",
"id",
"+",
"':'",
"+",
"evt",
".",
"type",
";",
"self",
".",
"trigger",
"(",
"type",
",",
... | Bubble up identified events. | [
"Bubble",
"up",
"identified",
"events",
"."
] | dfa253f80230c31478aca083bfe2dac2bc45ea08 | https://github.com/yoannmoinet/nipplejs/blob/dfa253f80230c31478aca083bfe2dac2bc45ea08/src/collection.js#L196-L200 | train | |
werk85/node-html-to-text | lib/helper.js | splitLongWord | function splitLongWord(word, options) {
var wrapCharacters = options.longWordSplit.wrapCharacters || [];
var forceWrapOnLimit = options.longWordSplit.forceWrapOnLimit || false;
var max = options.wordwrap;
var fuseWord = [];
var idx = 0;
while (word.length > max) {
var firstLine = word.substr(0, max);
... | javascript | function splitLongWord(word, options) {
var wrapCharacters = options.longWordSplit.wrapCharacters || [];
var forceWrapOnLimit = options.longWordSplit.forceWrapOnLimit || false;
var max = options.wordwrap;
var fuseWord = [];
var idx = 0;
while (word.length > max) {
var firstLine = word.substr(0, max);
... | [
"function",
"splitLongWord",
"(",
"word",
",",
"options",
")",
"{",
"var",
"wrapCharacters",
"=",
"options",
".",
"longWordSplit",
".",
"wrapCharacters",
"||",
"[",
"]",
";",
"var",
"forceWrapOnLimit",
"=",
"options",
".",
"longWordSplit",
".",
"forceWrapOnLimit... | Split a long word up to fit within the word wrap limit. Use either a character to split looking back from the word wrap limit, or truncate to the word wrap limit. | [
"Split",
"a",
"long",
"word",
"up",
"to",
"fit",
"within",
"the",
"word",
"wrap",
"limit",
".",
"Use",
"either",
"a",
"character",
"to",
"split",
"looking",
"back",
"from",
"the",
"word",
"wrap",
"limit",
"or",
"truncate",
"to",
"the",
"word",
"wrap",
... | b5f26807a8f8987a8a2f4a9f349ec9d0dba4a2e3 | https://github.com/werk85/node-html-to-text/blob/b5f26807a8f8987a8a2f4a9f349ec9d0dba4a2e3/lib/helper.js#L7-L50 | train |
remarkjs/remark-lint | script/util/rule.js | ruleSync | function ruleSync(filePath) {
var ruleId = path.basename(filePath)
var result = {}
var tests = {}
var description
var code
var tags
var name
ruleId = ruleId.slice('remark-lint-'.length)
code = fs.readFileSync(path.join(filePath, 'index.js'), 'utf-8')
tags = dox.parseComments(code)[0].tags
descrip... | javascript | function ruleSync(filePath) {
var ruleId = path.basename(filePath)
var result = {}
var tests = {}
var description
var code
var tags
var name
ruleId = ruleId.slice('remark-lint-'.length)
code = fs.readFileSync(path.join(filePath, 'index.js'), 'utf-8')
tags = dox.parseComments(code)[0].tags
descrip... | [
"function",
"ruleSync",
"(",
"filePath",
")",
"{",
"var",
"ruleId",
"=",
"path",
".",
"basename",
"(",
"filePath",
")",
"var",
"result",
"=",
"{",
"}",
"var",
"tests",
"=",
"{",
"}",
"var",
"description",
"var",
"code",
"var",
"tags",
"var",
"name",
... | Get information for a rule at `filePath`. | [
"Get",
"information",
"for",
"a",
"rule",
"at",
"filePath",
"."
] | 315156a02ed4cd2bb87448b4e0cafd86d7b93d5a | https://github.com/remarkjs/remark-lint/blob/315156a02ed4cd2bb87448b4e0cafd86d7b93d5a/script/util/rule.js#L13-L112 | train |
remarkjs/remark-lint | packages/remark-lint-no-reference-like-url/index.js | check | function check(node) {
var url = node.url
var reason
if (identifiers.indexOf(url.toLowerCase()) !== -1) {
reason =
'Did you mean to use `[' +
url +
']` instead of ' +
'`(' +
url +
')`, a reference?'
file.message(reason, node)
}
} | javascript | function check(node) {
var url = node.url
var reason
if (identifiers.indexOf(url.toLowerCase()) !== -1) {
reason =
'Did you mean to use `[' +
url +
']` instead of ' +
'`(' +
url +
')`, a reference?'
file.message(reason, node)
}
} | [
"function",
"check",
"(",
"node",
")",
"{",
"var",
"url",
"=",
"node",
".",
"url",
"var",
"reason",
"if",
"(",
"identifiers",
".",
"indexOf",
"(",
"url",
".",
"toLowerCase",
"(",
")",
")",
"!==",
"-",
"1",
")",
"{",
"reason",
"=",
"'Did you mean to u... | Check `node`. | [
"Check",
"node",
"."
] | 315156a02ed4cd2bb87448b4e0cafd86d7b93d5a | https://github.com/remarkjs/remark-lint/blob/315156a02ed4cd2bb87448b4e0cafd86d7b93d5a/packages/remark-lint-no-reference-like-url/index.js#L48-L63 | train |
remarkjs/remark-lint | packages/remark-lint-no-consecutive-blank-lines/index.js | compare | function compare(start, end, max) {
var diff = end.line - start.line
var lines = Math.abs(diff) - max
var reason
if (lines > 0) {
reason =
'Remove ' +
lines +
' ' +
plural('line', lines) +
' ' +
(diff > 0 ? 'before' : 'after') +
' node'
... | javascript | function compare(start, end, max) {
var diff = end.line - start.line
var lines = Math.abs(diff) - max
var reason
if (lines > 0) {
reason =
'Remove ' +
lines +
' ' +
plural('line', lines) +
' ' +
(diff > 0 ? 'before' : 'after') +
' node'
... | [
"function",
"compare",
"(",
"start",
",",
"end",
",",
"max",
")",
"{",
"var",
"diff",
"=",
"end",
".",
"line",
"-",
"start",
".",
"line",
"var",
"lines",
"=",
"Math",
".",
"abs",
"(",
"diff",
")",
"-",
"max",
"var",
"reason",
"if",
"(",
"lines",
... | Compare the difference between `start` and `end`, and warn when that difference exceeds `max`. | [
"Compare",
"the",
"difference",
"between",
"start",
"and",
"end",
"and",
"warn",
"when",
"that",
"difference",
"exceeds",
"max",
"."
] | 315156a02ed4cd2bb87448b4e0cafd86d7b93d5a | https://github.com/remarkjs/remark-lint/blob/315156a02ed4cd2bb87448b4e0cafd86d7b93d5a/packages/remark-lint-no-consecutive-blank-lines/index.js#L94-L111 | train |
remarkjs/remark-lint | packages/remark-lint-code-block-style/index.js | check | function check(node) {
var initial = start(node).offset
var final = end(node).offset
if (generated(node)) {
return null
}
return node.lang || /^\s*([~`])\1{2,}/.test(contents.slice(initial, final))
? 'fenced'
: 'indented'
} | javascript | function check(node) {
var initial = start(node).offset
var final = end(node).offset
if (generated(node)) {
return null
}
return node.lang || /^\s*([~`])\1{2,}/.test(contents.slice(initial, final))
? 'fenced'
: 'indented'
} | [
"function",
"check",
"(",
"node",
")",
"{",
"var",
"initial",
"=",
"start",
"(",
"node",
")",
".",
"offset",
"var",
"final",
"=",
"end",
"(",
"node",
")",
".",
"offset",
"if",
"(",
"generated",
"(",
"node",
")",
")",
"{",
"return",
"null",
"}",
"... | Get the style of `node`. | [
"Get",
"the",
"style",
"of",
"node",
"."
] | 315156a02ed4cd2bb87448b4e0cafd86d7b93d5a | https://github.com/remarkjs/remark-lint/blob/315156a02ed4cd2bb87448b4e0cafd86d7b93d5a/packages/remark-lint-code-block-style/index.js#L136-L147 | train |
bttmly/nba | src/util/string.js | unDashHyphen | function unDashHyphen (str) {
return str
.trim()
.toLowerCase()
.replace(/[-_\s]+(.)?/g, function (match, c) {
return c ? c.toUpperCase() : "";
});
} | javascript | function unDashHyphen (str) {
return str
.trim()
.toLowerCase()
.replace(/[-_\s]+(.)?/g, function (match, c) {
return c ? c.toUpperCase() : "";
});
} | [
"function",
"unDashHyphen",
"(",
"str",
")",
"{",
"return",
"str",
".",
"trim",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"replace",
"(",
"/",
"[-_\\s]+(.)?",
"/",
"g",
",",
"function",
"(",
"match",
",",
"c",
")",
"{",
"return",
"c",
"?",
"c",
... | converts a dash or hypen separated string to camelCase | [
"converts",
"a",
"dash",
"or",
"hypen",
"separated",
"string",
"to",
"camelCase"
] | 653a7199857a2e7ef96b44cf0262033349fa2354 | https://github.com/bttmly/nba/blob/653a7199857a2e7ef96b44cf0262033349fa2354/src/util/string.js#L12-L19 | train |
bttmly/nba | src/util/string.js | isAllUpperCase | function isAllUpperCase (str) {
return str
.split("")
.map(ch => ch.charCodeAt(0))
.every(n => n >= 65 && n <= 90);
} | javascript | function isAllUpperCase (str) {
return str
.split("")
.map(ch => ch.charCodeAt(0))
.every(n => n >= 65 && n <= 90);
} | [
"function",
"isAllUpperCase",
"(",
"str",
")",
"{",
"return",
"str",
".",
"split",
"(",
"\"\"",
")",
".",
"map",
"(",
"ch",
"=>",
"ch",
".",
"charCodeAt",
"(",
"0",
")",
")",
".",
"every",
"(",
"n",
"=>",
"n",
">=",
"65",
"&&",
"n",
"<=",
"90",... | checks if a string consists of only uppercase letters | [
"checks",
"if",
"a",
"string",
"consists",
"of",
"only",
"uppercase",
"letters"
] | 653a7199857a2e7ef96b44cf0262033349fa2354 | https://github.com/bttmly/nba/blob/653a7199857a2e7ef96b44cf0262033349fa2354/src/util/string.js#L22-L27 | train |
bttmly/nba | src/transforms.js | players | function players (resp) {
return base(resp).map(function (player) {
var names = player.displayLastCommaFirst.split(", ").reverse();
return {
firstName: names[0].trim(),
lastName: (names[1] ? names[1] : "").trim(),
playerId: player.personId,
teamId: player.teamId,
};
});
} | javascript | function players (resp) {
return base(resp).map(function (player) {
var names = player.displayLastCommaFirst.split(", ").reverse();
return {
firstName: names[0].trim(),
lastName: (names[1] ? names[1] : "").trim(),
playerId: player.personId,
teamId: player.teamId,
};
});
} | [
"function",
"players",
"(",
"resp",
")",
"{",
"return",
"base",
"(",
"resp",
")",
".",
"map",
"(",
"function",
"(",
"player",
")",
"{",
"var",
"names",
"=",
"player",
".",
"displayLastCommaFirst",
".",
"split",
"(",
"\", \"",
")",
".",
"reverse",
"(",
... | todo make this work identical to update-players.js | [
"todo",
"make",
"this",
"work",
"identical",
"to",
"update",
"-",
"players",
".",
"js"
] | 653a7199857a2e7ef96b44cf0262033349fa2354 | https://github.com/bttmly/nba/blob/653a7199857a2e7ef96b44cf0262033349fa2354/src/transforms.js#L24-L34 | train |
steveukx/git-js | src/git.js | Git | function Git (baseDir, ChildProcess, Buffer) {
this._baseDir = baseDir;
this._runCache = [];
this.ChildProcess = ChildProcess;
this.Buffer = Buffer;
} | javascript | function Git (baseDir, ChildProcess, Buffer) {
this._baseDir = baseDir;
this._runCache = [];
this.ChildProcess = ChildProcess;
this.Buffer = Buffer;
} | [
"function",
"Git",
"(",
"baseDir",
",",
"ChildProcess",
",",
"Buffer",
")",
"{",
"this",
".",
"_baseDir",
"=",
"baseDir",
";",
"this",
".",
"_runCache",
"=",
"[",
"]",
";",
"this",
".",
"ChildProcess",
"=",
"ChildProcess",
";",
"this",
".",
"Buffer",
"... | Git handling for node. All public functions can be chained and all `then` handlers are optional.
@param {string} baseDir base directory for all processes to run
@param {Object} ChildProcess The ChildProcess module
@param {Function} Buffer The Buffer implementation to use
@constructor | [
"Git",
"handling",
"for",
"node",
".",
"All",
"public",
"functions",
"can",
"be",
"chained",
"and",
"all",
"then",
"handlers",
"are",
"optional",
"."
] | 11fe5e8dfe271317ce902f9b1816322ac97271bd | https://github.com/steveukx/git-js/blob/11fe5e8dfe271317ce902f9b1816322ac97271bd/src/git.js#L20-L26 | train |
db-migrate/node-db-migrate | api.js | function (callback) {
var plugins = this.internals.plugins;
var self = this;
return Promise.resolve(Object.keys(APIHooks))
.each(function (hook) {
var plugin = plugins.hook(hook);
if (!plugin) return;
var APIHook = APIHooks[hook].bind(self);
return Promise.resolve(pl... | javascript | function (callback) {
var plugins = this.internals.plugins;
var self = this;
return Promise.resolve(Object.keys(APIHooks))
.each(function (hook) {
var plugin = plugins.hook(hook);
if (!plugin) return;
var APIHook = APIHooks[hook].bind(self);
return Promise.resolve(pl... | [
"function",
"(",
"callback",
")",
"{",
"var",
"plugins",
"=",
"this",
".",
"internals",
".",
"plugins",
";",
"var",
"self",
"=",
"this",
";",
"return",
"Promise",
".",
"resolve",
"(",
"Object",
".",
"keys",
"(",
"APIHooks",
")",
")",
".",
"each",
"("... | Registers and initializes hooks.
@returns Promise | [
"Registers",
"and",
"initializes",
"hooks",
"."
] | 3f22c400490f5714cc1aa7a1890406a0ea1b900e | https://github.com/db-migrate/node-db-migrate/blob/3f22c400490f5714cc1aa7a1890406a0ea1b900e/api.js#L114-L134 | train | |
db-migrate/node-db-migrate | api.js | function (description, args, type) {
var name = args.shift();
this.internals.argv.describe(name, description);
for (var i = 0; i < args.length; ++i) {
this.internals.argv.alias(args[i], name);
}
switch (type) {
case 'string':
this.internals.argv.string(name);
break;
... | javascript | function (description, args, type) {
var name = args.shift();
this.internals.argv.describe(name, description);
for (var i = 0; i < args.length; ++i) {
this.internals.argv.alias(args[i], name);
}
switch (type) {
case 'string':
this.internals.argv.string(name);
break;
... | [
"function",
"(",
"description",
",",
"args",
",",
"type",
")",
"{",
"var",
"name",
"=",
"args",
".",
"shift",
"(",
")",
";",
"this",
".",
"internals",
".",
"argv",
".",
"describe",
"(",
"name",
",",
"description",
")",
";",
"for",
"(",
"var",
"i",
... | Add a configuration option to dbmigrate.
@return boolean | [
"Add",
"a",
"configuration",
"option",
"to",
"dbmigrate",
"."
] | 3f22c400490f5714cc1aa7a1890406a0ea1b900e | https://github.com/db-migrate/node-db-migrate/blob/3f22c400490f5714cc1aa7a1890406a0ea1b900e/api.js#L143-L165 | train | |
db-migrate/node-db-migrate | api.js | function (specification, opts, callback) {
var executeSync = load('sync');
if (arguments.length > 0) {
if (typeof specification === 'string') {
this.internals.argv.destination = specification;
}
if (typeof opts === 'string') {
this.internals.migrationMode = opts;
this... | javascript | function (specification, opts, callback) {
var executeSync = load('sync');
if (arguments.length > 0) {
if (typeof specification === 'string') {
this.internals.argv.destination = specification;
}
if (typeof opts === 'string') {
this.internals.migrationMode = opts;
this... | [
"function",
"(",
"specification",
",",
"opts",
",",
"callback",
")",
"{",
"var",
"executeSync",
"=",
"load",
"(",
"'sync'",
")",
";",
"if",
"(",
"arguments",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"typeof",
"specification",
"===",
"'string'",
")... | Executes up a given number of migrations or a specific one.
Defaults to up all migrations if no count is given. | [
"Executes",
"up",
"a",
"given",
"number",
"of",
"migrations",
"or",
"a",
"specific",
"one",
"."
] | 3f22c400490f5714cc1aa7a1890406a0ea1b900e | https://github.com/db-migrate/node-db-migrate/blob/3f22c400490f5714cc1aa7a1890406a0ea1b900e/api.js#L266-L287 | train | |
db-migrate/node-db-migrate | api.js | function (scope, callback) {
var executeDown = load('down');
if (typeof scope === 'string') {
this.internals.migrationMode = scope;
this.internals.matching = scope;
} else if (typeof scope === 'function') {
callback = scope;
}
this.internals.argv.count = Number.MAX_VALUE;
ret... | javascript | function (scope, callback) {
var executeDown = load('down');
if (typeof scope === 'string') {
this.internals.migrationMode = scope;
this.internals.matching = scope;
} else if (typeof scope === 'function') {
callback = scope;
}
this.internals.argv.count = Number.MAX_VALUE;
ret... | [
"function",
"(",
"scope",
",",
"callback",
")",
"{",
"var",
"executeDown",
"=",
"load",
"(",
"'down'",
")",
";",
"if",
"(",
"typeof",
"scope",
"===",
"'string'",
")",
"{",
"this",
".",
"internals",
".",
"migrationMode",
"=",
"scope",
";",
"this",
".",
... | Executes down for all currently migrated migrations. | [
"Executes",
"down",
"for",
"all",
"currently",
"migrated",
"migrations",
"."
] | 3f22c400490f5714cc1aa7a1890406a0ea1b900e | https://github.com/db-migrate/node-db-migrate/blob/3f22c400490f5714cc1aa7a1890406a0ea1b900e/api.js#L292-L308 | train | |
db-migrate/node-db-migrate | api.js | function (migrationName, scope, callback) {
var executeCreateMigration = load('create-migration');
if (typeof scope === 'function') {
callback = scope;
} else if (scope) {
this.internals.migrationMode = scope;
this.internals.matching = scope;
}
this.internals.argv._.push(migration... | javascript | function (migrationName, scope, callback) {
var executeCreateMigration = load('create-migration');
if (typeof scope === 'function') {
callback = scope;
} else if (scope) {
this.internals.migrationMode = scope;
this.internals.matching = scope;
}
this.internals.argv._.push(migration... | [
"function",
"(",
"migrationName",
",",
"scope",
",",
"callback",
")",
"{",
"var",
"executeCreateMigration",
"=",
"load",
"(",
"'create-migration'",
")",
";",
"if",
"(",
"typeof",
"scope",
"===",
"'function'",
")",
"{",
"callback",
"=",
"scope",
";",
"}",
"... | Creates a correctly formatted migration | [
"Creates",
"a",
"correctly",
"formatted",
"migration"
] | 3f22c400490f5714cc1aa7a1890406a0ea1b900e | https://github.com/db-migrate/node-db-migrate/blob/3f22c400490f5714cc1aa7a1890406a0ea1b900e/api.js#L327-L342 | train | |
db-migrate/node-db-migrate | api.js | function (dbname, callback) {
var executeDB = load('db');
this.internals.argv._.push(dbname);
this.internals.mode = 'create';
return Promise.fromCallback(
function (callback) {
executeDB(this.internals, this.config, callback);
}.bind(this)
).asCallback(callback);
} | javascript | function (dbname, callback) {
var executeDB = load('db');
this.internals.argv._.push(dbname);
this.internals.mode = 'create';
return Promise.fromCallback(
function (callback) {
executeDB(this.internals, this.config, callback);
}.bind(this)
).asCallback(callback);
} | [
"function",
"(",
"dbname",
",",
"callback",
")",
"{",
"var",
"executeDB",
"=",
"load",
"(",
"'db'",
")",
";",
"this",
".",
"internals",
".",
"argv",
".",
"_",
".",
"push",
"(",
"dbname",
")",
";",
"this",
".",
"internals",
".",
"mode",
"=",
"'creat... | Creates a database of the given dbname. | [
"Creates",
"a",
"database",
"of",
"the",
"given",
"dbname",
"."
] | 3f22c400490f5714cc1aa7a1890406a0ea1b900e | https://github.com/db-migrate/node-db-migrate/blob/3f22c400490f5714cc1aa7a1890406a0ea1b900e/api.js#L347-L356 | train | |
db-migrate/node-db-migrate | api.js | function (mode, scope, callback) {
var executeSeed = load('seed');
if (scope) {
this.internals.migrationMode = scope;
this.internals.matching = scope;
}
this.internals.mode = mode || 'vc';
return Promise.fromCallback(
function (callback) {
executeSeed(this.internals, this.... | javascript | function (mode, scope, callback) {
var executeSeed = load('seed');
if (scope) {
this.internals.migrationMode = scope;
this.internals.matching = scope;
}
this.internals.mode = mode || 'vc';
return Promise.fromCallback(
function (callback) {
executeSeed(this.internals, this.... | [
"function",
"(",
"mode",
",",
"scope",
",",
"callback",
")",
"{",
"var",
"executeSeed",
"=",
"load",
"(",
"'seed'",
")",
";",
"if",
"(",
"scope",
")",
"{",
"this",
".",
"internals",
".",
"migrationMode",
"=",
"scope",
";",
"this",
".",
"internals",
"... | Seeds either the static or version controlled seeders, controlled by
the passed mode. | [
"Seeds",
"either",
"the",
"static",
"or",
"version",
"controlled",
"seeders",
"controlled",
"by",
"the",
"passed",
"mode",
"."
] | 3f22c400490f5714cc1aa7a1890406a0ea1b900e | https://github.com/db-migrate/node-db-migrate/blob/3f22c400490f5714cc1aa7a1890406a0ea1b900e/api.js#L400-L413 | train | |
db-migrate/node-db-migrate | api.js | function (specification, scope, callback) {
var executeUndoSeed = load('undo-seed');
if (arguments.length > 0) {
if (typeof specification === 'number') {
this.internals.argv.count = specification;
if (scope) {
this.internals.migrationMode = scope;
this.internals.matchi... | javascript | function (specification, scope, callback) {
var executeUndoSeed = load('undo-seed');
if (arguments.length > 0) {
if (typeof specification === 'number') {
this.internals.argv.count = specification;
if (scope) {
this.internals.migrationMode = scope;
this.internals.matchi... | [
"function",
"(",
"specification",
",",
"scope",
",",
"callback",
")",
"{",
"var",
"executeUndoSeed",
"=",
"load",
"(",
"'undo-seed'",
")",
";",
"if",
"(",
"arguments",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"typeof",
"specification",
"===",
"'numb... | Execute the down function of currently executed seeds. | [
"Execute",
"the",
"down",
"function",
"of",
"currently",
"executed",
"seeds",
"."
] | 3f22c400490f5714cc1aa7a1890406a0ea1b900e | https://github.com/db-migrate/node-db-migrate/blob/3f22c400490f5714cc1aa7a1890406a0ea1b900e/api.js#L418-L439 | train | |
db-migrate/node-db-migrate | lib/walker.js | SeedLink | function SeedLink (driver, internals) {
this.seeder = require('./seeder.js')(
driver,
internals.argv['vcseeder-dir'],
true,
internals
);
this.internals = internals;
this.links = [];
} | javascript | function SeedLink (driver, internals) {
this.seeder = require('./seeder.js')(
driver,
internals.argv['vcseeder-dir'],
true,
internals
);
this.internals = internals;
this.links = [];
} | [
"function",
"SeedLink",
"(",
"driver",
",",
"internals",
")",
"{",
"this",
".",
"seeder",
"=",
"require",
"(",
"'./seeder.js'",
")",
"(",
"driver",
",",
"internals",
".",
"argv",
"[",
"'vcseeder-dir'",
"]",
",",
"true",
",",
"internals",
")",
";",
"this"... | Not sure what will happen to this yet | [
"Not",
"sure",
"what",
"will",
"happen",
"to",
"this",
"yet"
] | 3f22c400490f5714cc1aa7a1890406a0ea1b900e | https://github.com/db-migrate/node-db-migrate/blob/3f22c400490f5714cc1aa7a1890406a0ea1b900e/lib/walker.js#L9-L18 | train |
jhipster/jhipster-core | lib/export/jdl_exporter.js | exportToJDL | function exportToJDL(jdl, path) {
if (!jdl) {
throw new Error('A JDLObject has to be passed to be exported.');
}
if (!path) {
path = './jhipster-jdl.jh';
}
fs.writeFileSync(path, jdl.toString());
} | javascript | function exportToJDL(jdl, path) {
if (!jdl) {
throw new Error('A JDLObject has to be passed to be exported.');
}
if (!path) {
path = './jhipster-jdl.jh';
}
fs.writeFileSync(path, jdl.toString());
} | [
"function",
"exportToJDL",
"(",
"jdl",
",",
"path",
")",
"{",
"if",
"(",
"!",
"jdl",
")",
"{",
"throw",
"new",
"Error",
"(",
"'A JDLObject has to be passed to be exported.'",
")",
";",
"}",
"if",
"(",
"!",
"path",
")",
"{",
"path",
"=",
"'./jhipster-jdl.jh... | Writes down the given JDL to a file.
@param jdl the JDL to write.
@param path the path where the file will be written. | [
"Writes",
"down",
"the",
"given",
"JDL",
"to",
"a",
"file",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/export/jdl_exporter.js#L31-L39 | train |
jhipster/jhipster-core | lib/converters/json_to_jdl_entity_converter.js | convertEntitiesToJDL | function convertEntitiesToJDL(entities, jdl) {
if (!entities) {
throw new Error('Entities have to be passed to be converted.');
}
init(entities, jdl);
addEntities();
addRelationshipsToJDL();
return configuration.jdl;
} | javascript | function convertEntitiesToJDL(entities, jdl) {
if (!entities) {
throw new Error('Entities have to be passed to be converted.');
}
init(entities, jdl);
addEntities();
addRelationshipsToJDL();
return configuration.jdl;
} | [
"function",
"convertEntitiesToJDL",
"(",
"entities",
",",
"jdl",
")",
"{",
"if",
"(",
"!",
"entities",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Entities have to be passed to be converted.'",
")",
";",
"}",
"init",
"(",
"entities",
",",
"jdl",
")",
";",
"add... | Converts the JSON entities into JDL.
@param entities the entities in plain JS format.
@param jdl {JDLObject} the base JDLObject to use as conversion result.
@returns {*} the updated JDLObject. | [
"Converts",
"the",
"JSON",
"entities",
"into",
"JDL",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/converters/json_to_jdl_entity_converter.js#L62-L70 | train |
jhipster/jhipster-core | lib/export/jhipster_entity_exporter.js | exportEntitiesInApplications | function exportEntitiesInApplications(passedConfiguration) {
if (!passedConfiguration || !passedConfiguration.entities) {
throw new Error('Entities have to be passed to be exported.');
}
let exportedEntities = [];
Object.keys(passedConfiguration.applications).forEach(applicationName => {
const applicati... | javascript | function exportEntitiesInApplications(passedConfiguration) {
if (!passedConfiguration || !passedConfiguration.entities) {
throw new Error('Entities have to be passed to be exported.');
}
let exportedEntities = [];
Object.keys(passedConfiguration.applications).forEach(applicationName => {
const applicati... | [
"function",
"exportEntitiesInApplications",
"(",
"passedConfiguration",
")",
"{",
"if",
"(",
"!",
"passedConfiguration",
"||",
"!",
"passedConfiguration",
".",
"entities",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Entities have to be passed to be exported.'",
")",
";",
... | Exports the passed entities to JSON in the applications.
@param passedConfiguration the object having the keys:
- entities: the entities to export,
- forceNoFiltering: whether to filter out unchanged entities,
- applications: the application iterable containing some or all the entities
@return the exported entities per... | [
"Exports",
"the",
"passed",
"entities",
"to",
"JSON",
"in",
"the",
"applications",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/export/jhipster_entity_exporter.js#L43-L64 | train |
jhipster/jhipster-core | lib/export/jhipster_entity_exporter.js | exportEntities | function exportEntities(passedConfiguration) {
init(passedConfiguration);
createJHipsterJSONFolder(
passedConfiguration.application.forSeveralApplications ? configuration.application.name : ''
);
if (!configuration.forceNoFiltering) {
filterOutUnchangedEntities();
}
if (shouldFilterOutEntitiesBasedO... | javascript | function exportEntities(passedConfiguration) {
init(passedConfiguration);
createJHipsterJSONFolder(
passedConfiguration.application.forSeveralApplications ? configuration.application.name : ''
);
if (!configuration.forceNoFiltering) {
filterOutUnchangedEntities();
}
if (shouldFilterOutEntitiesBasedO... | [
"function",
"exportEntities",
"(",
"passedConfiguration",
")",
"{",
"init",
"(",
"passedConfiguration",
")",
";",
"createJHipsterJSONFolder",
"(",
"passedConfiguration",
".",
"application",
".",
"forSeveralApplications",
"?",
"configuration",
".",
"application",
".",
"n... | Exports the passed entities to JSON.
@param passedConfiguration the object having the keys:
- entities: the entity objects to export (key: entity name, value: the entity),
- forceNoFiltering: whether to filter out unchanged entities,
- application:
- forSeveralApplications: whether more than one application have to be ... | [
"Exports",
"the",
"passed",
"entities",
"to",
"JSON",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/export/jhipster_entity_exporter.js#L85-L98 | train |
jhipster/jhipster-core | lib/export/jhipster_entity_exporter.js | writeEntities | function writeEntities(subFolder) {
for (let i = 0, entityNames = Object.keys(configuration.entities); i < entityNames.length; i++) {
const filePath = path.join(subFolder, toFilePath(entityNames[i]));
const entity = updateChangelogDate(filePath, configuration.entities[entityNames[i]]);
fs.writeFileSync(fi... | javascript | function writeEntities(subFolder) {
for (let i = 0, entityNames = Object.keys(configuration.entities); i < entityNames.length; i++) {
const filePath = path.join(subFolder, toFilePath(entityNames[i]));
const entity = updateChangelogDate(filePath, configuration.entities[entityNames[i]]);
fs.writeFileSync(fi... | [
"function",
"writeEntities",
"(",
"subFolder",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"entityNames",
"=",
"Object",
".",
"keys",
"(",
"configuration",
".",
"entities",
")",
";",
"i",
"<",
"entityNames",
".",
"length",
";",
"i",
"++",
")",
"... | Writes entities in a sub folder.
@param subFolder the folder (to create) in which the JHipster entity folder will be. | [
"Writes",
"entities",
"in",
"a",
"sub",
"folder",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/export/jhipster_entity_exporter.js#L119-L125 | train |
jhipster/jhipster-core | lib/export/export_utils.js | writeConfigFile | function writeConfigFile(config, yoRcPath = '.yo-rc.json') {
let newYoRc = { ...config };
if (FileUtils.doesFileExist(yoRcPath)) {
const yoRc = JSON.parse(fs.readFileSync(yoRcPath, { encoding: 'utf-8' }));
newYoRc = {
...yoRc,
...config,
[GENERATOR_NAME]: {
...yoRc[GENERATOR_NAME],... | javascript | function writeConfigFile(config, yoRcPath = '.yo-rc.json') {
let newYoRc = { ...config };
if (FileUtils.doesFileExist(yoRcPath)) {
const yoRc = JSON.parse(fs.readFileSync(yoRcPath, { encoding: 'utf-8' }));
newYoRc = {
...yoRc,
...config,
[GENERATOR_NAME]: {
...yoRc[GENERATOR_NAME],... | [
"function",
"writeConfigFile",
"(",
"config",
",",
"yoRcPath",
"=",
"'.yo-rc.json'",
")",
"{",
"let",
"newYoRc",
"=",
"{",
"...",
"config",
"}",
";",
"if",
"(",
"FileUtils",
".",
"doesFileExist",
"(",
"yoRcPath",
")",
")",
"{",
"const",
"yoRc",
"=",
"JSO... | This function writes a Yeoman config file in the current folder.
@param config the configuration.
@param yoRcPath the yeoman conf file path | [
"This",
"function",
"writes",
"a",
"Yeoman",
"config",
"file",
"in",
"the",
"current",
"folder",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/export/export_utils.js#L51-L65 | train |
jhipster/jhipster-core | lib/reader/file_reader.js | readFile | function readFile(path) {
if (!path) {
throw new Error('The passed file must not be nil to be read.');
}
if (!FileUtils.doesFileExist(path)) {
throw new Error(`The passed file '${path}' must exist and must not be a directory to be read.`);
}
return fs.readFileSync(path, 'utf-8').toString();
} | javascript | function readFile(path) {
if (!path) {
throw new Error('The passed file must not be nil to be read.');
}
if (!FileUtils.doesFileExist(path)) {
throw new Error(`The passed file '${path}' must exist and must not be a directory to be read.`);
}
return fs.readFileSync(path, 'utf-8').toString();
} | [
"function",
"readFile",
"(",
"path",
")",
"{",
"if",
"(",
"!",
"path",
")",
"{",
"throw",
"new",
"Error",
"(",
"'The passed file must not be nil to be read.'",
")",
";",
"}",
"if",
"(",
"!",
"FileUtils",
".",
"doesFileExist",
"(",
"path",
")",
")",
"{",
... | Reads a given file.
@param path the file's path.
@returns {string} the file's content. | [
"Reads",
"a",
"given",
"file",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/reader/file_reader.js#L45-L53 | train |
jhipster/jhipster-core | lib/parser/entity_parser.js | parse | function parse(args) {
const merged = merge(defaults(), args);
if (!args || !merged.jdlObject || !args.databaseType) {
throw new Error('The JDL object and the database type are both mandatory.');
}
if (merged.applicationType !== GATEWAY) {
checkNoSQLModeling(merged.jdlObject, args.databaseType);
}
i... | javascript | function parse(args) {
const merged = merge(defaults(), args);
if (!args || !merged.jdlObject || !args.databaseType) {
throw new Error('The JDL object and the database type are both mandatory.');
}
if (merged.applicationType !== GATEWAY) {
checkNoSQLModeling(merged.jdlObject, args.databaseType);
}
i... | [
"function",
"parse",
"(",
"args",
")",
"{",
"const",
"merged",
"=",
"merge",
"(",
"defaults",
"(",
")",
",",
"args",
")",
";",
"if",
"(",
"!",
"args",
"||",
"!",
"merged",
".",
"jdlObject",
"||",
"!",
"args",
".",
"databaseType",
")",
"{",
"throw",... | Converts a JDLObject to ready-to-be exported JSON entities.
@param args the configuration object, keys:
- jdlObject, the JDLObject to convert to JSON
- databaseType
- applicationType
@returns {*} entities that can be exported to JSON. | [
"Converts",
"a",
"JDLObject",
"to",
"ready",
"-",
"to",
"-",
"be",
"exported",
"JSON",
"entities",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/parser/entity_parser.js#L57-L71 | train |
jhipster/jhipster-core | lib/exceptions/application_validator.js | checkApplication | function checkApplication(jdlApplication) {
if (!jdlApplication || !jdlApplication.config) {
throw new Error('An application must be passed to be validated.');
}
applicationConfig = jdlApplication.config;
checkForValidValues();
checkForNoDatabaseType();
checkForInvalidDatabaseCombinations();
} | javascript | function checkApplication(jdlApplication) {
if (!jdlApplication || !jdlApplication.config) {
throw new Error('An application must be passed to be validated.');
}
applicationConfig = jdlApplication.config;
checkForValidValues();
checkForNoDatabaseType();
checkForInvalidDatabaseCombinations();
} | [
"function",
"checkApplication",
"(",
"jdlApplication",
")",
"{",
"if",
"(",
"!",
"jdlApplication",
"||",
"!",
"jdlApplication",
".",
"config",
")",
"{",
"throw",
"new",
"Error",
"(",
"'An application must be passed to be validated.'",
")",
";",
"}",
"applicationConf... | Checks whether a JDL application is valid. If everything's okay, no exception is thrown.
@param jdlApplication the application to check | [
"Checks",
"whether",
"a",
"JDL",
"application",
"is",
"valid",
".",
"If",
"everything",
"s",
"okay",
"no",
"exception",
"is",
"thrown",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/exceptions/application_validator.js#L50-L58 | train |
jhipster/jhipster-core | lib/export/jhipster_application_exporter.js | exportApplication | function exportApplication(application) {
checkForErrors(application);
const formattedApplication = setUpApplicationStructure(application);
writeConfigFile(formattedApplication);
return formattedApplication;
} | javascript | function exportApplication(application) {
checkForErrors(application);
const formattedApplication = setUpApplicationStructure(application);
writeConfigFile(formattedApplication);
return formattedApplication;
} | [
"function",
"exportApplication",
"(",
"application",
")",
"{",
"checkForErrors",
"(",
"application",
")",
";",
"const",
"formattedApplication",
"=",
"setUpApplicationStructure",
"(",
"application",
")",
";",
"writeConfigFile",
"(",
"formattedApplication",
")",
";",
"r... | Exports JDL a application to a JDL file in the current directory.
@param application, the JDL application to export.
@return the exported application in its final form. | [
"Exports",
"JDL",
"a",
"application",
"to",
"a",
"JDL",
"file",
"in",
"the",
"current",
"directory",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/export/jhipster_application_exporter.js#L52-L57 | train |
jhipster/jhipster-core | lib/export/jhipster_application_exporter.js | writeApplicationFileForMultipleApplications | function writeApplicationFileForMultipleApplications(application) {
const applicationBaseName = application[GENERATOR_NAME].baseName;
checkPath(applicationBaseName);
createFolderIfNeeded(applicationBaseName);
writeConfigFile(application, path.join(applicationBaseName, '.yo-rc.json'));
} | javascript | function writeApplicationFileForMultipleApplications(application) {
const applicationBaseName = application[GENERATOR_NAME].baseName;
checkPath(applicationBaseName);
createFolderIfNeeded(applicationBaseName);
writeConfigFile(application, path.join(applicationBaseName, '.yo-rc.json'));
} | [
"function",
"writeApplicationFileForMultipleApplications",
"(",
"application",
")",
"{",
"const",
"applicationBaseName",
"=",
"application",
"[",
"GENERATOR_NAME",
"]",
".",
"baseName",
";",
"checkPath",
"(",
"applicationBaseName",
")",
";",
"createFolderIfNeeded",
"(",
... | This function writes a Yeoman config file in an application folder.
@param application the application. | [
"This",
"function",
"writes",
"a",
"Yeoman",
"config",
"file",
"in",
"an",
"application",
"folder",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/export/jhipster_application_exporter.js#L99-L104 | train |
jhipster/jhipster-core | lib/converters/json_to_jdl_option_converter.js | convertServerOptionsToJDL | function convertServerOptionsToJDL(config, jdl) {
const jdlObject = jdl || new JDLObject();
const jhipsterConfig = config || {};
[SKIP_CLIENT, SKIP_SERVER, SKIP_USER_MANAGEMENT].forEach(option => {
if (jhipsterConfig[option] === true) {
jdlObject.addOption(
new JDLUnaryOption({
name: o... | javascript | function convertServerOptionsToJDL(config, jdl) {
const jdlObject = jdl || new JDLObject();
const jhipsterConfig = config || {};
[SKIP_CLIENT, SKIP_SERVER, SKIP_USER_MANAGEMENT].forEach(option => {
if (jhipsterConfig[option] === true) {
jdlObject.addOption(
new JDLUnaryOption({
name: o... | [
"function",
"convertServerOptionsToJDL",
"(",
"config",
",",
"jdl",
")",
"{",
"const",
"jdlObject",
"=",
"jdl",
"||",
"new",
"JDLObject",
"(",
")",
";",
"const",
"jhipsterConfig",
"=",
"config",
"||",
"{",
"}",
";",
"[",
"SKIP_CLIENT",
",",
"SKIP_SERVER",
... | Parses the jhipster configuration into JDL.
@param config the jhipster config ('generator-jhipster' in .yo-rc.json)
@param jdl {JDLObject} to which the parsed options are added. If undefined a new JDLObject is created.
@returns {JDLObject} the JDLObject | [
"Parses",
"the",
"jhipster",
"configuration",
"into",
"JDL",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/converters/json_to_jdl_option_converter.js#L34-L48 | train |
jhipster/jhipster-core | lib/parser/document_parser.js | parseFromConfigurationObject | function parseFromConfigurationObject(configuration) {
if (!configuration.document) {
throw new Error('The parsed JDL content must be passed.');
}
init(configuration);
fillApplications();
fillDeployments();
fillEnums();
fillClassesAndFields();
fillAssociations();
fillOptions();
return jdlObject;... | javascript | function parseFromConfigurationObject(configuration) {
if (!configuration.document) {
throw new Error('The parsed JDL content must be passed.');
}
init(configuration);
fillApplications();
fillDeployments();
fillEnums();
fillClassesAndFields();
fillAssociations();
fillOptions();
return jdlObject;... | [
"function",
"parseFromConfigurationObject",
"(",
"configuration",
")",
"{",
"if",
"(",
"!",
"configuration",
".",
"document",
")",
"{",
"throw",
"new",
"Error",
"(",
"'The parsed JDL content must be passed.'",
")",
";",
"}",
"init",
"(",
"configuration",
")",
";",... | Converts the intermediate document to a JDLObject from a configuration object.
@param configuration The configuration object, keys:
- document
- applicationType
- applicationName
- generatorVersion | [
"Converts",
"the",
"intermediate",
"document",
"to",
"a",
"JDLObject",
"from",
"a",
"configuration",
"object",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/parser/document_parser.js#L59-L71 | train |
jhipster/jhipster-core | lib/exceptions/option_validator.js | checkOptions | function checkOptions(
{ jdlObject, applicationSettings, applicationsPerEntityName } = {
applicationSettings: {},
applicationsPerEntityName: {}
}
) {
if (!jdlObject) {
throw new Error('A JDL object has to be passed to check its options.');
}
configuration = {
jdlObject,
applicationSettings... | javascript | function checkOptions(
{ jdlObject, applicationSettings, applicationsPerEntityName } = {
applicationSettings: {},
applicationsPerEntityName: {}
}
) {
if (!jdlObject) {
throw new Error('A JDL object has to be passed to check its options.');
}
configuration = {
jdlObject,
applicationSettings... | [
"function",
"checkOptions",
"(",
"{",
"jdlObject",
",",
"applicationSettings",
",",
"applicationsPerEntityName",
"}",
"=",
"{",
"applicationSettings",
":",
"{",
"}",
",",
"applicationsPerEntityName",
":",
"{",
"}",
"}",
")",
"{",
"if",
"(",
"!",
"jdlObject",
"... | Checks whether the passed JDL options are valid.
@param jdlObject the JDL object containing the options to check.
@param applicationSettings the application configuration.
@param applicationsPerEntityName applications per entity entity name. | [
"Checks",
"whether",
"the",
"passed",
"JDL",
"options",
"are",
"valid",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/exceptions/option_validator.js#L35-L52 | train |
jhipster/jhipster-core | lib/utils/format_utils.js | formatComment | function formatComment(comment) {
if (!comment) {
return undefined;
}
const parts = comment.trim().split('\n');
if (parts.length === 1 && parts[0].indexOf('*') !== 0) {
return parts[0];
}
return parts.reduce((previousValue, currentValue) => {
// newlines in the middle of the comment should stay ... | javascript | function formatComment(comment) {
if (!comment) {
return undefined;
}
const parts = comment.trim().split('\n');
if (parts.length === 1 && parts[0].indexOf('*') !== 0) {
return parts[0];
}
return parts.reduce((previousValue, currentValue) => {
// newlines in the middle of the comment should stay ... | [
"function",
"formatComment",
"(",
"comment",
")",
"{",
"if",
"(",
"!",
"comment",
")",
"{",
"return",
"undefined",
";",
"}",
"const",
"parts",
"=",
"comment",
".",
"trim",
"(",
")",
".",
"split",
"(",
"'\\n'",
")",
";",
"if",
"(",
"parts",
".",
"le... | formats a comment
@param {String} comment string.
@returns {String} formatted comment string | [
"formats",
"a",
"comment"
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/utils/format_utils.js#L32-L50 | train |
jhipster/jhipster-core | lib/utils/file_utils.js | createDirectory | function createDirectory(directory) {
if (!directory) {
throw new Error('A directory must be passed to be created.');
}
const statObject = getStatObject(directory);
if (statObject && statObject.isFile()) {
throw new Error(`The directory to create '${directory}' is a file.`);
}
fse.ensureDirSync(dire... | javascript | function createDirectory(directory) {
if (!directory) {
throw new Error('A directory must be passed to be created.');
}
const statObject = getStatObject(directory);
if (statObject && statObject.isFile()) {
throw new Error(`The directory to create '${directory}' is a file.`);
}
fse.ensureDirSync(dire... | [
"function",
"createDirectory",
"(",
"directory",
")",
"{",
"if",
"(",
"!",
"directory",
")",
"{",
"throw",
"new",
"Error",
"(",
"'A directory must be passed to be created.'",
")",
";",
"}",
"const",
"statObject",
"=",
"getStatObject",
"(",
"directory",
")",
";",... | Creates a directory, if it doesn't exist already.
@param directory the directory to create.
@throws WrongDirException if the directory to create exists and is a file. | [
"Creates",
"a",
"directory",
"if",
"it",
"doesn",
"t",
"exist",
"already",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/utils/file_utils.js#L53-L62 | train |
jhipster/jhipster-core | lib/export/jhipster_deployment_exporter.js | writeDeploymentConfigs | function writeDeploymentConfigs(deployment) {
const folderName = deployment[GENERATOR_NAME].deploymentType;
checkPath(folderName);
createFolderIfNeeded(folderName);
writeConfigFile(deployment, path.join(folderName, '.yo-rc.json'));
} | javascript | function writeDeploymentConfigs(deployment) {
const folderName = deployment[GENERATOR_NAME].deploymentType;
checkPath(folderName);
createFolderIfNeeded(folderName);
writeConfigFile(deployment, path.join(folderName, '.yo-rc.json'));
} | [
"function",
"writeDeploymentConfigs",
"(",
"deployment",
")",
"{",
"const",
"folderName",
"=",
"deployment",
"[",
"GENERATOR_NAME",
"]",
".",
"deploymentType",
";",
"checkPath",
"(",
"folderName",
")",
";",
"createFolderIfNeeded",
"(",
"folderName",
")",
";",
"wri... | This function writes a Yeoman config file in a folder.
@param deployment the deployment. | [
"This",
"function",
"writes",
"a",
"Yeoman",
"config",
"file",
"in",
"a",
"folder",
"."
] | dce9a29cd27a3c62eb8db580669d7d01a98290c3 | https://github.com/jhipster/jhipster-core/blob/dce9a29cd27a3c62eb8db580669d7d01a98290c3/lib/export/jhipster_deployment_exporter.js#L78-L83 | train |
farzher/fuzzysort | fuzzysort.js | function(target) {
if(target.length > 999) return fuzzysort.prepare(target) // don't cache huge targets
var targetPrepared = preparedCache.get(target)
if(targetPrepared !== undefined) return targetPrepared
targetPrepared = fuzzysort.prepare(target)
preparedCache.set(target, targetPrepared)... | javascript | function(target) {
if(target.length > 999) return fuzzysort.prepare(target) // don't cache huge targets
var targetPrepared = preparedCache.get(target)
if(targetPrepared !== undefined) return targetPrepared
targetPrepared = fuzzysort.prepare(target)
preparedCache.set(target, targetPrepared)... | [
"function",
"(",
"target",
")",
"{",
"if",
"(",
"target",
".",
"length",
">",
"999",
")",
"return",
"fuzzysort",
".",
"prepare",
"(",
"target",
")",
"// don't cache huge targets",
"var",
"targetPrepared",
"=",
"preparedCache",
".",
"get",
"(",
"target",
")",... | Below this point is only internal code Below this point is only internal code Below this point is only internal code Below this point is only internal code | [
"Below",
"this",
"point",
"is",
"only",
"internal",
"code",
"Below",
"this",
"point",
"is",
"only",
"internal",
"code",
"Below",
"this",
"point",
"is",
"only",
"internal",
"code",
"Below",
"this",
"point",
"is",
"only",
"internal",
"code"
] | c6604993ac51bfe4de8e82c0a4d9b0c6e1794682 | https://github.com/farzher/fuzzysort/blob/c6604993ac51bfe4de8e82c0a4d9b0c6e1794682/fuzzysort.js#L310-L317 | train | |
citronneur/node-rdpjs | lib/protocol/x224.js | negotiation | function negotiation(opt) {
var self = {
type : new type.UInt8(),
flag : new type.UInt8(),
length : new type.UInt16Le(0x0008, { constant : true }),
result : new type.UInt32Le()
};
return new type.Component(self, opt);
} | javascript | function negotiation(opt) {
var self = {
type : new type.UInt8(),
flag : new type.UInt8(),
length : new type.UInt16Le(0x0008, { constant : true }),
result : new type.UInt32Le()
};
return new type.Component(self, opt);
} | [
"function",
"negotiation",
"(",
"opt",
")",
"{",
"var",
"self",
"=",
"{",
"type",
":",
"new",
"type",
".",
"UInt8",
"(",
")",
",",
"flag",
":",
"new",
"type",
".",
"UInt8",
"(",
")",
",",
"length",
":",
"new",
"type",
".",
"UInt16Le",
"(",
"0x000... | Use to negotiate security layer of RDP stack
In node-rdpjs only ssl is available
@param opt {object} component type options
@see request -> http://msdn.microsoft.com/en-us/library/cc240500.aspx
@see response -> http://msdn.microsoft.com/en-us/library/cc240506.aspx
@see failure ->http://msdn.microsoft.com/en-us/library/... | [
"Use",
"to",
"negotiate",
"security",
"layer",
"of",
"RDP",
"stack",
"In",
"node",
"-",
"rdpjs",
"only",
"ssl",
"is",
"available"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/x224.js#L64-L72 | train |
citronneur/node-rdpjs | lib/protocol/x224.js | clientConnectionRequestPDU | function clientConnectionRequestPDU(opt, cookie) {
var self = {
len : new type.UInt8(function() {
return new type.Component(self).size() - 1;
}),
code : new type.UInt8(MessageType.X224_TPDU_CONNECTION_REQUEST, { constant : true }),
padding : new type.Component([new type.UInt16Le(), new type.UInt16Le(), ne... | javascript | function clientConnectionRequestPDU(opt, cookie) {
var self = {
len : new type.UInt8(function() {
return new type.Component(self).size() - 1;
}),
code : new type.UInt8(MessageType.X224_TPDU_CONNECTION_REQUEST, { constant : true }),
padding : new type.Component([new type.UInt16Le(), new type.UInt16Le(), ne... | [
"function",
"clientConnectionRequestPDU",
"(",
"opt",
",",
"cookie",
")",
"{",
"var",
"self",
"=",
"{",
"len",
":",
"new",
"type",
".",
"UInt8",
"(",
"function",
"(",
")",
"{",
"return",
"new",
"type",
".",
"Component",
"(",
"self",
")",
".",
"size",
... | X224 client connection request
@param opt {object} component type options
@see http://msdn.microsoft.com/en-us/library/cc240470.aspx | [
"X224",
"client",
"connection",
"request"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/x224.js#L79-L105 | train |
citronneur/node-rdpjs | lib/protocol/x224.js | serverConnectionConfirm | function serverConnectionConfirm(opt) {
var self = {
len : new type.UInt8(function() {
return new type.Component(self).size() - 1;
}),
code : new type.UInt8(MessageType.X224_TPDU_CONNECTION_CONFIRM, { constant : true }),
padding : new type.Component([new type.UInt16Le(), new type.UInt16Le(), new type.UInt... | javascript | function serverConnectionConfirm(opt) {
var self = {
len : new type.UInt8(function() {
return new type.Component(self).size() - 1;
}),
code : new type.UInt8(MessageType.X224_TPDU_CONNECTION_CONFIRM, { constant : true }),
padding : new type.Component([new type.UInt16Le(), new type.UInt16Le(), new type.UInt... | [
"function",
"serverConnectionConfirm",
"(",
"opt",
")",
"{",
"var",
"self",
"=",
"{",
"len",
":",
"new",
"type",
".",
"UInt8",
"(",
"function",
"(",
")",
"{",
"return",
"new",
"type",
".",
"Component",
"(",
"self",
")",
".",
"size",
"(",
")",
"-",
... | X224 Server connection confirm
@param opt {object} component type options
@see http://msdn.microsoft.com/en-us/library/cc240506.aspx | [
"X224",
"Server",
"connection",
"confirm"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/x224.js#L112-L123 | train |
citronneur/node-rdpjs | lib/protocol/x224.js | x224DataHeader | function x224DataHeader() {
var self = {
header : new type.UInt8(2),
messageType : new type.UInt8(MessageType.X224_TPDU_DATA, { constant : true }),
separator : new type.UInt8(0x80, { constant : true })
};
return new type.Component(self);
} | javascript | function x224DataHeader() {
var self = {
header : new type.UInt8(2),
messageType : new type.UInt8(MessageType.X224_TPDU_DATA, { constant : true }),
separator : new type.UInt8(0x80, { constant : true })
};
return new type.Component(self);
} | [
"function",
"x224DataHeader",
"(",
")",
"{",
"var",
"self",
"=",
"{",
"header",
":",
"new",
"type",
".",
"UInt8",
"(",
"2",
")",
",",
"messageType",
":",
"new",
"type",
".",
"UInt8",
"(",
"MessageType",
".",
"X224_TPDU_DATA",
",",
"{",
"constant",
":",... | Header of each data message from x224 layer
@returns {type.Component} | [
"Header",
"of",
"each",
"data",
"message",
"from",
"x224",
"layer"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/x224.js#L129-L136 | train |
citronneur/node-rdpjs | lib/protocol/x224.js | X224 | function X224(transport) {
this.transport = transport;
this.requestedProtocol = Protocols.PROTOCOL_SSL;
this.selectedProtocol = Protocols.PROTOCOL_SSL;
var self = this;
this.transport.on('close', function() {
self.emit('close');
}).on('error', function (err) {
self.emit('error', err);
});
} | javascript | function X224(transport) {
this.transport = transport;
this.requestedProtocol = Protocols.PROTOCOL_SSL;
this.selectedProtocol = Protocols.PROTOCOL_SSL;
var self = this;
this.transport.on('close', function() {
self.emit('close');
}).on('error', function (err) {
self.emit('error', err);
});
} | [
"function",
"X224",
"(",
"transport",
")",
"{",
"this",
".",
"transport",
"=",
"transport",
";",
"this",
".",
"requestedProtocol",
"=",
"Protocols",
".",
"PROTOCOL_SSL",
";",
"this",
".",
"selectedProtocol",
"=",
"Protocols",
".",
"PROTOCOL_SSL",
";",
"var",
... | Common X224 Automata
@param presentation {Layer} presentation layer | [
"Common",
"X224",
"Automata"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/x224.js#L142-L153 | train |
citronneur/node-rdpjs | lib/protocol/x224.js | Server | function Server(transport, keyFilePath, crtFilePath) {
X224.call(this, transport);
this.keyFilePath = keyFilePath;
this.crtFilePath = crtFilePath;
var self = this;
this.transport.once('data', function (s) {
self.recvConnectionRequest(s);
});
} | javascript | function Server(transport, keyFilePath, crtFilePath) {
X224.call(this, transport);
this.keyFilePath = keyFilePath;
this.crtFilePath = crtFilePath;
var self = this;
this.transport.once('data', function (s) {
self.recvConnectionRequest(s);
});
} | [
"function",
"Server",
"(",
"transport",
",",
"keyFilePath",
",",
"crtFilePath",
")",
"{",
"X224",
".",
"call",
"(",
"this",
",",
"transport",
")",
";",
"this",
".",
"keyFilePath",
"=",
"keyFilePath",
";",
"this",
".",
"crtFilePath",
"=",
"crtFilePath",
";"... | Server x224 automata | [
"Server",
"x224",
"automata"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/x224.js#L256-L264 | train |
citronneur/node-rdpjs | lib/core/layer.js | BufferLayer | function BufferLayer(socket) {
//for ssl connection
this.securePair = null;
this.socket = socket;
var self = this;
// bind event
this.socket.on('data', function(data) {
try {
self.recv(data);
}
catch(e) {
self.socket.destroy();
self.emit('error', e);
}
}).on('close', function() {
self.emit('c... | javascript | function BufferLayer(socket) {
//for ssl connection
this.securePair = null;
this.socket = socket;
var self = this;
// bind event
this.socket.on('data', function(data) {
try {
self.recv(data);
}
catch(e) {
self.socket.destroy();
self.emit('error', e);
}
}).on('close', function() {
self.emit('c... | [
"function",
"BufferLayer",
"(",
"socket",
")",
"{",
"//for ssl connection",
"this",
".",
"securePair",
"=",
"null",
";",
"this",
".",
"socket",
"=",
"socket",
";",
"var",
"self",
"=",
"this",
";",
"// bind event",
"this",
".",
"socket",
".",
"on",
"(",
"... | Buffer data from socket to present
well formed packets | [
"Buffer",
"data",
"from",
"socket",
"to",
"present",
"well",
"formed",
"packets"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/core/layer.js#L33-L59 | train |
citronneur/node-rdpjs | lib/protocol/t125/per.js | readObjectIdentifier | function readObjectIdentifier(s, oid) {
var size = readLength(s);
if(size !== 5) {
return false;
}
var a_oid = [0, 0, 0, 0, 0, 0];
var t12 = new type.UInt8().read(s).value;
a_oid[0] = t12 >> 4;
a_oid[1] = t12 & 0x0f;
a_oid[2] = new type.UInt8().read(s).value;
a_oid[3] = new type.UInt8().read(s).value;
a_oi... | javascript | function readObjectIdentifier(s, oid) {
var size = readLength(s);
if(size !== 5) {
return false;
}
var a_oid = [0, 0, 0, 0, 0, 0];
var t12 = new type.UInt8().read(s).value;
a_oid[0] = t12 >> 4;
a_oid[1] = t12 & 0x0f;
a_oid[2] = new type.UInt8().read(s).value;
a_oid[3] = new type.UInt8().read(s).value;
a_oi... | [
"function",
"readObjectIdentifier",
"(",
"s",
",",
"oid",
")",
"{",
"var",
"size",
"=",
"readLength",
"(",
"s",
")",
";",
"if",
"(",
"size",
"!==",
"5",
")",
"{",
"return",
"false",
";",
"}",
"var",
"a_oid",
"=",
"[",
"0",
",",
"0",
",",
"0",
"... | Check object identifier
@param s {type.Stream}
@param oid {array} object identifier to check | [
"Check",
"object",
"identifier"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/t125/per.js#L180-L200 | train |
citronneur/node-rdpjs | lib/protocol/t125/per.js | readNumericString | function readNumericString(s, minValue) {
var length = readLength(s);
length = (length + minValue + 1) / 2;
s.readPadding(length);
} | javascript | function readNumericString(s, minValue) {
var length = readLength(s);
length = (length + minValue + 1) / 2;
s.readPadding(length);
} | [
"function",
"readNumericString",
"(",
"s",
",",
"minValue",
")",
"{",
"var",
"length",
"=",
"readLength",
"(",
"s",
")",
";",
"length",
"=",
"(",
"length",
"+",
"minValue",
"+",
"1",
")",
"/",
"2",
";",
"s",
".",
"readPadding",
"(",
"length",
")",
... | Read as padding...
@param s {type.Stream}
@param minValue | [
"Read",
"as",
"padding",
"..."
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/t125/per.js#L215-L219 | train |
citronneur/node-rdpjs | lib/security/jsbn.js | bnToBuffer | function bnToBuffer(trimOrSize) {
var res = new Buffer(this.toByteArray());
if (trimOrSize === true && res[0] === 0) {
res = res.slice(1);
} else if (_.isNumber(trimOrSize)) {
if (res.length > trimOrSize) {
for (var i = 0; i < res.length - trimOrSize; i++) {
if (r... | javascript | function bnToBuffer(trimOrSize) {
var res = new Buffer(this.toByteArray());
if (trimOrSize === true && res[0] === 0) {
res = res.slice(1);
} else if (_.isNumber(trimOrSize)) {
if (res.length > trimOrSize) {
for (var i = 0; i < res.length - trimOrSize; i++) {
if (r... | [
"function",
"bnToBuffer",
"(",
"trimOrSize",
")",
"{",
"var",
"res",
"=",
"new",
"Buffer",
"(",
"this",
".",
"toByteArray",
"(",
")",
")",
";",
"if",
"(",
"trimOrSize",
"===",
"true",
"&&",
"res",
"[",
"0",
"]",
"===",
"0",
")",
"{",
"res",
"=",
... | return Buffer object
@param trim {boolean} slice buffer if first element == 0
@returns {Buffer} | [
"return",
"Buffer",
"object"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/security/jsbn.js#L831-L851 | train |
citronneur/node-rdpjs | lib/protocol/pdu/global.js | Global | function Global(transport, fastPathTransport) {
this.transport = transport;
this.fastPathTransport = fastPathTransport;
// must be init via connect event
this.userId = 0;
this.serverCapabilities = [];
this.clientCapabilities = [];
} | javascript | function Global(transport, fastPathTransport) {
this.transport = transport;
this.fastPathTransport = fastPathTransport;
// must be init via connect event
this.userId = 0;
this.serverCapabilities = [];
this.clientCapabilities = [];
} | [
"function",
"Global",
"(",
"transport",
",",
"fastPathTransport",
")",
"{",
"this",
".",
"transport",
"=",
"transport",
";",
"this",
".",
"fastPathTransport",
"=",
"fastPathTransport",
";",
"// must be init via connect event",
"this",
".",
"userId",
"=",
"0",
";",... | Global channel for all graphic updates
capabilities exchange and input handles | [
"Global",
"channel",
"for",
"all",
"graphic",
"updates",
"capabilities",
"exchange",
"and",
"input",
"handles"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/pdu/global.js#L31-L38 | train |
citronneur/node-rdpjs | lib/protocol/rdp.js | decompress | function decompress (bitmap) {
var fName = null;
switch (bitmap.bitsPerPixel.value) {
case 15:
fName = 'bitmap_decompress_15';
break;
case 16:
fName = 'bitmap_decompress_16';
break;
case 24:
fName = 'bitmap_decompress_24';
break;
case 32:
fName = 'bitmap_decompress_32';
break;
default:
throw 'i... | javascript | function decompress (bitmap) {
var fName = null;
switch (bitmap.bitsPerPixel.value) {
case 15:
fName = 'bitmap_decompress_15';
break;
case 16:
fName = 'bitmap_decompress_16';
break;
case 24:
fName = 'bitmap_decompress_24';
break;
case 32:
fName = 'bitmap_decompress_32';
break;
default:
throw 'i... | [
"function",
"decompress",
"(",
"bitmap",
")",
"{",
"var",
"fName",
"=",
"null",
";",
"switch",
"(",
"bitmap",
".",
"bitsPerPixel",
".",
"value",
")",
"{",
"case",
"15",
":",
"fName",
"=",
"'bitmap_decompress_15'",
";",
"break",
";",
"case",
"16",
":",
... | decompress bitmap from RLE algorithm
@param bitmap {object} bitmap object of bitmap event of node-rdpjs | [
"decompress",
"bitmap",
"from",
"RLE",
"algorithm"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/rdp.js#L36-L77 | train |
citronneur/node-rdpjs | lib/protocol/rdp.js | RdpClient | function RdpClient(config) {
config = config || {};
this.connected = false;
this.bufferLayer = new layer.BufferLayer(new net.Socket());
this.tpkt = new TPKT(this.bufferLayer);
this.x224 = new x224.Client(this.tpkt);
this.mcs = new t125.mcs.Client(this.x224);
this.sec = new pdu.sec.Client(this.mcs, this.tpkt);
t... | javascript | function RdpClient(config) {
config = config || {};
this.connected = false;
this.bufferLayer = new layer.BufferLayer(new net.Socket());
this.tpkt = new TPKT(this.bufferLayer);
this.x224 = new x224.Client(this.tpkt);
this.mcs = new t125.mcs.Client(this.x224);
this.sec = new pdu.sec.Client(this.mcs, this.tpkt);
t... | [
"function",
"RdpClient",
"(",
"config",
")",
"{",
"config",
"=",
"config",
"||",
"{",
"}",
";",
"this",
".",
"connected",
"=",
"false",
";",
"this",
".",
"bufferLayer",
"=",
"new",
"layer",
".",
"BufferLayer",
"(",
"new",
"net",
".",
"Socket",
"(",
"... | Main RDP module | [
"Main",
"RDP",
"module"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/rdp.js#L82-L180 | train |
citronneur/node-rdpjs | lib/protocol/rdp.js | RdpServer | function RdpServer(config, socket) {
if (!(config.key && config.cert)) {
throw new error.FatalError('NODE_RDP_PROTOCOL_RDP_SERVER_CONFIG_MISSING', 'missing cryptographic tools')
}
this.connected = false;
this.bufferLayer = new layer.BufferLayer(socket);
this.tpkt = new TPKT(this.bufferLayer);
this.x224 = new x2... | javascript | function RdpServer(config, socket) {
if (!(config.key && config.cert)) {
throw new error.FatalError('NODE_RDP_PROTOCOL_RDP_SERVER_CONFIG_MISSING', 'missing cryptographic tools')
}
this.connected = false;
this.bufferLayer = new layer.BufferLayer(socket);
this.tpkt = new TPKT(this.bufferLayer);
this.x224 = new x2... | [
"function",
"RdpServer",
"(",
"config",
",",
"socket",
")",
"{",
"if",
"(",
"!",
"(",
"config",
".",
"key",
"&&",
"config",
".",
"cert",
")",
")",
"{",
"throw",
"new",
"error",
".",
"FatalError",
"(",
"'NODE_RDP_PROTOCOL_RDP_SERVER_CONFIG_MISSING'",
",",
"... | RDP server side protocol
@param config {object} configuration
@param socket {net.Socket} | [
"RDP",
"server",
"side",
"protocol"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/rdp.js#L330-L339 | train |
citronneur/node-rdpjs | lib/protocol/pdu/sec.js | rdpInfos | function rdpInfos(extendedInfoConditional) {
var self = {
codePage : new type.UInt32Le(),
flag : new type.UInt32Le(InfoFlag.INFO_MOUSE | InfoFlag.INFO_UNICODE | InfoFlag.INFO_LOGONNOTIFY | InfoFlag.INFO_LOGONERRORS | InfoFlag.INFO_DISABLECTRLALTDEL | InfoFlag.INFO_ENABLEWINDOWSKEY),
cbDomain : new ty... | javascript | function rdpInfos(extendedInfoConditional) {
var self = {
codePage : new type.UInt32Le(),
flag : new type.UInt32Le(InfoFlag.INFO_MOUSE | InfoFlag.INFO_UNICODE | InfoFlag.INFO_LOGONNOTIFY | InfoFlag.INFO_LOGONERRORS | InfoFlag.INFO_DISABLECTRLALTDEL | InfoFlag.INFO_ENABLEWINDOWSKEY),
cbDomain : new ty... | [
"function",
"rdpInfos",
"(",
"extendedInfoConditional",
")",
"{",
"var",
"self",
"=",
"{",
"codePage",
":",
"new",
"type",
".",
"UInt32Le",
"(",
")",
",",
"flag",
":",
"new",
"type",
".",
"UInt32Le",
"(",
"InfoFlag",
".",
"INFO_MOUSE",
"|",
"InfoFlag",
"... | RDP client informations
@param extendedInfoConditional {boolean} true if RDP5+
@returns {type.Component} | [
"RDP",
"client",
"informations"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/pdu/sec.js#L191-L229 | train |
citronneur/node-rdpjs | lib/protocol/pdu/sec.js | rdpExtendedInfos | function rdpExtendedInfos(opt) {
var self = {
clientAddressFamily : new type.UInt16Le(AfInet.AfInet),
cbClientAddress : new type.UInt16Le(function() {
return self.clientAddress.size();
}),
clientAddress : new type.BinaryString(new Buffer('\x00', 'ucs2'),{ readLength : new type.CallableValu... | javascript | function rdpExtendedInfos(opt) {
var self = {
clientAddressFamily : new type.UInt16Le(AfInet.AfInet),
cbClientAddress : new type.UInt16Le(function() {
return self.clientAddress.size();
}),
clientAddress : new type.BinaryString(new Buffer('\x00', 'ucs2'),{ readLength : new type.CallableValu... | [
"function",
"rdpExtendedInfos",
"(",
"opt",
")",
"{",
"var",
"self",
"=",
"{",
"clientAddressFamily",
":",
"new",
"type",
".",
"UInt16Le",
"(",
"AfInet",
".",
"AfInet",
")",
",",
"cbClientAddress",
":",
"new",
"type",
".",
"UInt16Le",
"(",
"function",
"(",... | RDP client extended informations present in RDP5+
@param opt
@returns {type.Component} | [
"RDP",
"client",
"extended",
"informations",
"present",
"in",
"RDP5",
"+"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/pdu/sec.js#L236-L256 | train |
citronneur/node-rdpjs | lib/protocol/pdu/sec.js | securityHeader | function securityHeader() {
var self = {
securityFlag : new type.UInt16Le(),
securityFlagHi : new type.UInt16Le()
};
return new type.Component(self);
} | javascript | function securityHeader() {
var self = {
securityFlag : new type.UInt16Le(),
securityFlagHi : new type.UInt16Le()
};
return new type.Component(self);
} | [
"function",
"securityHeader",
"(",
")",
"{",
"var",
"self",
"=",
"{",
"securityFlag",
":",
"new",
"type",
".",
"UInt16Le",
"(",
")",
",",
"securityFlagHi",
":",
"new",
"type",
".",
"UInt16Le",
"(",
")",
"}",
";",
"return",
"new",
"type",
".",
"Componen... | Header of security header
@returns {type.Component} | [
"Header",
"of",
"security",
"header"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/pdu/sec.js#L262-L269 | train |
citronneur/node-rdpjs | lib/protocol/pdu/sec.js | Client | function Client(transport, fastPathTransport) {
Sec.call(this, transport, fastPathTransport);
// for basic RDP layer (in futur)
this.enableSecureCheckSum = false;
var self = this;
this.transport.on('connect', function(gccClient, gccServer, userId, channels) {
self.connect(gccClient, gccServer, userId, channels);... | javascript | function Client(transport, fastPathTransport) {
Sec.call(this, transport, fastPathTransport);
// for basic RDP layer (in futur)
this.enableSecureCheckSum = false;
var self = this;
this.transport.on('connect', function(gccClient, gccServer, userId, channels) {
self.connect(gccClient, gccServer, userId, channels);... | [
"function",
"Client",
"(",
"transport",
",",
"fastPathTransport",
")",
"{",
"Sec",
".",
"call",
"(",
"this",
",",
"transport",
",",
"fastPathTransport",
")",
";",
"// for basic RDP layer (in futur)",
"this",
".",
"enableSecureCheckSum",
"=",
"false",
";",
"var",
... | Client security layer
@param transport {events.EventEmitter} | [
"Client",
"security",
"layer"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/protocol/pdu/sec.js#L351-L363 | train |
citronneur/node-rdpjs | lib/asn1/spec.js | Asn1Tag | function Asn1Tag(tagClass, tagFormat, tagNumber) {
this.tagClass = tagClass;
this.tagFormat = tagFormat;
this.tagNumber = tagNumber;
} | javascript | function Asn1Tag(tagClass, tagFormat, tagNumber) {
this.tagClass = tagClass;
this.tagFormat = tagFormat;
this.tagNumber = tagNumber;
} | [
"function",
"Asn1Tag",
"(",
"tagClass",
",",
"tagFormat",
",",
"tagNumber",
")",
"{",
"this",
".",
"tagClass",
"=",
"tagClass",
";",
"this",
".",
"tagFormat",
"=",
"tagFormat",
";",
"this",
".",
"tagNumber",
"=",
"tagNumber",
";",
"}"
] | ASN.1 tag
@param tagClass {TagClass}
@param tagFormat {TagFormat}
@param tagNumber {integer} | [
"ASN",
".",
"1",
"tag"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/asn1/spec.js#L48-L52 | train |
citronneur/node-rdpjs | lib/core/type.js | Stream | function Stream(i) {
this.offset = 0;
if (i instanceof Buffer) {
this.buffer = i;
}
else {
this.buffer = new Buffer(i || 8192);
}
} | javascript | function Stream(i) {
this.offset = 0;
if (i instanceof Buffer) {
this.buffer = i;
}
else {
this.buffer = new Buffer(i || 8192);
}
} | [
"function",
"Stream",
"(",
"i",
")",
"{",
"this",
".",
"offset",
"=",
"0",
";",
"if",
"(",
"i",
"instanceof",
"Buffer",
")",
"{",
"this",
".",
"buffer",
"=",
"i",
";",
"}",
"else",
"{",
"this",
".",
"buffer",
"=",
"new",
"Buffer",
"(",
"i",
"||... | Stream wrapper around buffer type
@param i {Buffer | integer} size of init buffer
@returns | [
"Stream",
"wrapper",
"around",
"buffer",
"type"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/core/type.js#L29-L37 | train |
citronneur/node-rdpjs | lib/core/type.js | Type | function Type(opt) {
CallableValue.call(this);
this.opt = opt || {};
this.isReaded = false;
this.isWritten = false;
} | javascript | function Type(opt) {
CallableValue.call(this);
this.opt = opt || {};
this.isReaded = false;
this.isWritten = false;
} | [
"function",
"Type",
"(",
"opt",
")",
"{",
"CallableValue",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"opt",
"=",
"opt",
"||",
"{",
"}",
";",
"this",
".",
"isReaded",
"=",
"false",
";",
"this",
".",
"isWritten",
"=",
"false",
";",
"}"
] | Type readable or writable by binary stream
@param {object} opt
.conditional {boolean} read or write type depend on conditional call
@returns | [
"Type",
"readable",
"or",
"writable",
"by",
"binary",
"stream"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/core/type.js#L94-L99 | train |
citronneur/node-rdpjs | lib/core/type.js | SingleType | function SingleType(value, nbBytes, readBufferCallback, writeBufferCallback, opt){
Type.call(this, opt);
this.value = value || 0;
this.nbBytes = nbBytes;
this.readBufferCallback = readBufferCallback;
this.writeBufferCallback = writeBufferCallback;
} | javascript | function SingleType(value, nbBytes, readBufferCallback, writeBufferCallback, opt){
Type.call(this, opt);
this.value = value || 0;
this.nbBytes = nbBytes;
this.readBufferCallback = readBufferCallback;
this.writeBufferCallback = writeBufferCallback;
} | [
"function",
"SingleType",
"(",
"value",
",",
"nbBytes",
",",
"readBufferCallback",
",",
"writeBufferCallback",
",",
"opt",
")",
"{",
"Type",
".",
"call",
"(",
"this",
",",
"opt",
")",
";",
"this",
".",
"value",
"=",
"value",
"||",
"0",
";",
"this",
"."... | Leaf of tree type
@param {number} value of type
@param {function} readBufferCallback Buffer prototype read function
@param {function} writeBufferCallback Buffer prototype write function
@param {object} opt Type parameter | [
"Leaf",
"of",
"tree",
"type"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/core/type.js#L290-L296 | train |
citronneur/node-rdpjs | lib/core/type.js | UInt8 | function UInt8(value, opt) {
SingleType.call(this, value, 1, Buffer.prototype.readUInt8, Buffer.prototype.writeUInt8, opt);
} | javascript | function UInt8(value, opt) {
SingleType.call(this, value, 1, Buffer.prototype.readUInt8, Buffer.prototype.writeUInt8, opt);
} | [
"function",
"UInt8",
"(",
"value",
",",
"opt",
")",
"{",
"SingleType",
".",
"call",
"(",
"this",
",",
"value",
",",
"1",
",",
"Buffer",
".",
"prototype",
".",
"readUInt8",
",",
"Buffer",
".",
"prototype",
".",
"writeUInt8",
",",
"opt",
")",
";",
"}"
... | Integer on 1 byte
@param {number | function} value of type
@param {object} opt Type parameter
@returns | [
"Integer",
"on",
"1",
"byte"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/core/type.js#L333-L335 | train |
citronneur/node-rdpjs | lib/core/type.js | UInt16Le | function UInt16Le(value, opt) {
SingleType.call(this, value, 2, Buffer.prototype.readUInt16LE, Buffer.prototype.writeUInt16LE, opt);
} | javascript | function UInt16Le(value, opt) {
SingleType.call(this, value, 2, Buffer.prototype.readUInt16LE, Buffer.prototype.writeUInt16LE, opt);
} | [
"function",
"UInt16Le",
"(",
"value",
",",
"opt",
")",
"{",
"SingleType",
".",
"call",
"(",
"this",
",",
"value",
",",
"2",
",",
"Buffer",
".",
"prototype",
".",
"readUInt16LE",
",",
"Buffer",
".",
"prototype",
".",
"writeUInt16LE",
",",
"opt",
")",
";... | Integer on 2 bytes in Little Endian
@param {number | function} value to write or compare if constant
@param {object} opt Type parameter
@returns | [
"Integer",
"on",
"2",
"bytes",
"in",
"Little",
"Endian"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/core/type.js#L346-L348 | train |
citronneur/node-rdpjs | lib/core/type.js | UInt16Be | function UInt16Be(value, opt) {
SingleType.call(this, value, 2, Buffer.prototype.readUInt16BE, Buffer.prototype.writeUInt16BE, opt);
} | javascript | function UInt16Be(value, opt) {
SingleType.call(this, value, 2, Buffer.prototype.readUInt16BE, Buffer.prototype.writeUInt16BE, opt);
} | [
"function",
"UInt16Be",
"(",
"value",
",",
"opt",
")",
"{",
"SingleType",
".",
"call",
"(",
"this",
",",
"value",
",",
"2",
",",
"Buffer",
".",
"prototype",
".",
"readUInt16BE",
",",
"Buffer",
".",
"prototype",
".",
"writeUInt16BE",
",",
"opt",
")",
";... | Integer on 2 bytes in Big Endian
@param {number | function} value to write or compare if constant
@param {object} opt Type parameter
@returns | [
"Integer",
"on",
"2",
"bytes",
"in",
"Big",
"Endian"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/core/type.js#L359-L361 | train |
citronneur/node-rdpjs | lib/core/type.js | UInt32Le | function UInt32Le(value, opt) {
SingleType.call(this, value, 4, Buffer.prototype.readUInt32LE, Buffer.prototype.writeUInt32LE, opt);
} | javascript | function UInt32Le(value, opt) {
SingleType.call(this, value, 4, Buffer.prototype.readUInt32LE, Buffer.prototype.writeUInt32LE, opt);
} | [
"function",
"UInt32Le",
"(",
"value",
",",
"opt",
")",
"{",
"SingleType",
".",
"call",
"(",
"this",
",",
"value",
",",
"4",
",",
"Buffer",
".",
"prototype",
".",
"readUInt32LE",
",",
"Buffer",
".",
"prototype",
".",
"writeUInt32LE",
",",
"opt",
")",
";... | Integer on 4 bytes in Little Endian
@param {number | function} value to write or compare if constant
@param {object} opt Type parameter
@returns | [
"Integer",
"on",
"4",
"bytes",
"in",
"Little",
"Endian"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/core/type.js#L372-L374 | train |
citronneur/node-rdpjs | lib/core/type.js | UInt32Be | function UInt32Be(value, opt) {
SingleType.call(this, value, 4, Buffer.prototype.readUInt32BE, Buffer.prototype.writeUInt32BE, opt);
} | javascript | function UInt32Be(value, opt) {
SingleType.call(this, value, 4, Buffer.prototype.readUInt32BE, Buffer.prototype.writeUInt32BE, opt);
} | [
"function",
"UInt32Be",
"(",
"value",
",",
"opt",
")",
"{",
"SingleType",
".",
"call",
"(",
"this",
",",
"value",
",",
"4",
",",
"Buffer",
".",
"prototype",
".",
"readUInt32BE",
",",
"Buffer",
".",
"prototype",
".",
"writeUInt32BE",
",",
"opt",
")",
";... | Integer on 4 bytes in Big Endian
@param {number | function} value to write or compare if constant
@param {object} opt Type parameter
@returns | [
"Integer",
"on",
"4",
"bytes",
"in",
"Big",
"Endian"
] | 0f487aa6c1f681bde6b416ca5b574e92f9184148 | https://github.com/citronneur/node-rdpjs/blob/0f487aa6c1f681bde6b416ca5b574e92f9184148/lib/core/type.js#L385-L387 | 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.