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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Urigo/meteor-native-packages | packages/ddp-server/stream_server.js | function (callback) {
var self = this;
self.registration_callbacks.push(callback);
_.each(self.all_sockets(), function (socket) {
callback(socket);
});
} | javascript | function (callback) {
var self = this;
self.registration_callbacks.push(callback);
_.each(self.all_sockets(), function (socket) {
callback(socket);
});
} | [
"function",
"(",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"registration_callbacks",
".",
"push",
"(",
"callback",
")",
";",
"_",
".",
"each",
"(",
"self",
".",
"all_sockets",
"(",
")",
",",
"function",
"(",
"socket",
")",
"... | call my callback when a new socket connects. also call it for all current connections. | [
"call",
"my",
"callback",
"when",
"a",
"new",
"socket",
"connects",
".",
"also",
"call",
"it",
"for",
"all",
"current",
"connections",
"."
] | 8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7 | https://github.com/Urigo/meteor-native-packages/blob/8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7/packages/ddp-server/stream_server.js#L106-L112 | train | |
Urigo/meteor-native-packages | packages/ddp-server/stream_server.js | function(request /*, moreArguments */) {
// Store arguments for use within the closure below
var args = arguments;
// Rewrite /websocket and /websocket/ urls to /sockjs/websocket while
// preserving query string.
var parsedUrl = url.parse(request.url);
if (parsedUrl.path... | javascript | function(request /*, moreArguments */) {
// Store arguments for use within the closure below
var args = arguments;
// Rewrite /websocket and /websocket/ urls to /sockjs/websocket while
// preserving query string.
var parsedUrl = url.parse(request.url);
if (parsedUrl.path... | [
"function",
"(",
"request",
"/*, moreArguments */",
")",
"{",
"// Store arguments for use within the closure below",
"var",
"args",
"=",
"arguments",
";",
"// Rewrite /websocket and /websocket/ urls to /sockjs/websocket while",
"// preserving query string.",
"var",
"parsedUrl",
"=",
... | request and upgrade have different arguments passed but we only care about the first one which is always request | [
"request",
"and",
"upgrade",
"have",
"different",
"arguments",
"passed",
"but",
"we",
"only",
"care",
"about",
"the",
"first",
"one",
"which",
"is",
"always",
"request"
] | 8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7 | https://github.com/Urigo/meteor-native-packages/blob/8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7/packages/ddp-server/stream_server.js#L136-L151 | train | |
a8m/agile | dist/agile.js | add | function add(object) {
var args = Array.prototype.slice.call(arguments, 1);
//loop through all over the arguments
forEach(args, function(value, i) {
switch(typeof object) {
case 'object':
isArray(object)
? object.push(value)
: extend(object, isObject(value) ? value : creObjec... | javascript | function add(object) {
var args = Array.prototype.slice.call(arguments, 1);
//loop through all over the arguments
forEach(args, function(value, i) {
switch(typeof object) {
case 'object':
isArray(object)
? object.push(value)
: extend(object, isObject(value) ? value : creObjec... | [
"function",
"add",
"(",
"object",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"//loop through all over the arguments",
"forEach",
"(",
"args",
",",
"function",
"(",
"value",
",",... | these methods is kind of common methods for chaining wrappers
@description
add methods get an object extend(based on type) and return it.
@param object
@returns {*}
@example
add(1,2) ==> 3
add([],1) ==> [1]
add('f','g') ==> 'fg'
add({}, {a:1}) ==> {a:1} | [
"these",
"methods",
"is",
"kind",
"of",
"common",
"methods",
"for",
"chaining",
"wrappers"
] | fcf3f8667e44c621bcdc3065c3a03b29e16851eb | https://github.com/a8m/agile/blob/fcf3f8667e44c621bcdc3065c3a03b29e16851eb/dist/agile.js#L938-L956 | train |
a8m/agile | dist/agile.js | runInContext | function runInContext(context) {
// Node.js
return (typeof module === "object" && module && module.exports === context)
? module.exports = agile
// Browsers
: context[(context._) ? 'agile' : '_'] = agile;
} | javascript | function runInContext(context) {
// Node.js
return (typeof module === "object" && module && module.exports === context)
? module.exports = agile
// Browsers
: context[(context._) ? 'agile' : '_'] = agile;
} | [
"function",
"runInContext",
"(",
"context",
")",
"{",
"// Node.js",
"return",
"(",
"typeof",
"module",
"===",
"\"object\"",
"&&",
"module",
"&&",
"module",
".",
"exports",
"===",
"context",
")",
"?",
"module",
".",
"exports",
"=",
"agile",
"// Browsers",
":"... | Expose agile.js | [
"Expose",
"agile",
".",
"js"
] | fcf3f8667e44c621bcdc3065c3a03b29e16851eb | https://github.com/a8m/agile/blob/fcf3f8667e44c621bcdc3065c3a03b29e16851eb/dist/agile.js#L2708-L2714 | train |
arccoza/postcss-if-media | index.js | processIfValues | function processIfValues(css, result, rule, decl, queries) {
var query = null;
var re = /(.*)\s+(?:\?if|\?)\s+media\s+(.*)/;
var re2 = /\s/g;
var hash = null;
// Check if we're working with comments.
var match = decl.value ? decl.value.match(re) : decl.text.match(re);
// console.log(match)
if(match && ... | javascript | function processIfValues(css, result, rule, decl, queries) {
var query = null;
var re = /(.*)\s+(?:\?if|\?)\s+media\s+(.*)/;
var re2 = /\s/g;
var hash = null;
// Check if we're working with comments.
var match = decl.value ? decl.value.match(re) : decl.text.match(re);
// console.log(match)
if(match && ... | [
"function",
"processIfValues",
"(",
"css",
",",
"result",
",",
"rule",
",",
"decl",
",",
"queries",
")",
"{",
"var",
"query",
"=",
"null",
";",
"var",
"re",
"=",
"/",
"(.*)\\s+(?:\\?if|\\?)\\s+media\\s+(.*)",
"/",
";",
"var",
"re2",
"=",
"/",
"\\s",
"/",... | Extract the values and add them to the list of queries. Props are grouped by their queries, so that they appear in the same @media block later. | [
"Extract",
"the",
"values",
"and",
"add",
"them",
"to",
"the",
"list",
"of",
"queries",
".",
"Props",
"are",
"grouped",
"by",
"their",
"queries",
"so",
"that",
"they",
"appear",
"in",
"the",
"same"
] | bdd4997231547cb5a82eca64c33aaec1f472c6a6 | https://github.com/arccoza/postcss-if-media/blob/bdd4997231547cb5a82eca64c33aaec1f472c6a6/index.js#L77-L104 | train |
arccoza/postcss-if-media | index.js | createAtRules | function createAtRules(css, rule, queries) {
var parent = rule.parent;
var prev = rule;
for(var k in queries) {
var q = queries[k];
var at = postcss.atRule({name: 'media', params: q.arg, source: rule.source});
var qr = postcss.rule ({selector: q.sel, source: rule.source});
at.append(qr);
fo... | javascript | function createAtRules(css, rule, queries) {
var parent = rule.parent;
var prev = rule;
for(var k in queries) {
var q = queries[k];
var at = postcss.atRule({name: 'media', params: q.arg, source: rule.source});
var qr = postcss.rule ({selector: q.sel, source: rule.source});
at.append(qr);
fo... | [
"function",
"createAtRules",
"(",
"css",
",",
"rule",
",",
"queries",
")",
"{",
"var",
"parent",
"=",
"rule",
".",
"parent",
";",
"var",
"prev",
"=",
"rule",
";",
"for",
"(",
"var",
"k",
"in",
"queries",
")",
"{",
"var",
"q",
"=",
"queries",
"[",
... | The previously extracted inline queries and their associated properties are used to create @media rules below(to maintain CSS specificity) the parent rule. | [
"The",
"previously",
"extracted",
"inline",
"queries",
"and",
"their",
"associated",
"properties",
"are",
"used",
"to",
"create"
] | bdd4997231547cb5a82eca64c33aaec1f472c6a6 | https://github.com/arccoza/postcss-if-media/blob/bdd4997231547cb5a82eca64c33aaec1f472c6a6/index.js#L108-L130 | train |
medialab/sandcrawler | phantom/bindings.js | getContent | function getContent() {
var h = pageInformation.response.headers || {};
if (/json/.test(h['content-type'])) {
try {
return JSON.parse(page.plainText);
}
catch (e) {
return page.content;
}
}
else {
return page.content;
}
} | javascript | function getContent() {
var h = pageInformation.response.headers || {};
if (/json/.test(h['content-type'])) {
try {
return JSON.parse(page.plainText);
}
catch (e) {
return page.content;
}
}
else {
return page.content;
}
} | [
"function",
"getContent",
"(",
")",
"{",
"var",
"h",
"=",
"pageInformation",
".",
"response",
".",
"headers",
"||",
"{",
"}",
";",
"if",
"(",
"/",
"json",
"/",
".",
"test",
"(",
"h",
"[",
"'content-type'",
"]",
")",
")",
"{",
"try",
"{",
"return",
... | Helpers
Get correct page content | [
"Helpers",
"Get",
"correct",
"page",
"content"
] | c08e19095eee42c8ce1f84685960e5ea6cb0fd1d | https://github.com/medialab/sandcrawler/blob/c08e19095eee42c8ce1f84685960e5ea6cb0fd1d/phantom/bindings.js#L159-L172 | train |
medialab/sandcrawler | phantom/bindings.js | wrapFailure | function wrapFailure(reason) {
var res = {
fail: true,
url: page.url,
body: getContent(),
headers: pageInformation.response.headers,
status: pageInformation.response.status
};
if (reason)
res.reason = reason;
if (pageInformation.error)
re... | javascript | function wrapFailure(reason) {
var res = {
fail: true,
url: page.url,
body: getContent(),
headers: pageInformation.response.headers,
status: pageInformation.response.status
};
if (reason)
res.reason = reason;
if (pageInformation.error)
re... | [
"function",
"wrapFailure",
"(",
"reason",
")",
"{",
"var",
"res",
"=",
"{",
"fail",
":",
"true",
",",
"url",
":",
"page",
".",
"url",
",",
"body",
":",
"getContent",
"(",
")",
",",
"headers",
":",
"pageInformation",
".",
"response",
".",
"headers",
"... | Wrapping response helper | [
"Wrapping",
"response",
"helper"
] | c08e19095eee42c8ce1f84685960e5ea6cb0fd1d | https://github.com/medialab/sandcrawler/blob/c08e19095eee42c8ce1f84685960e5ea6cb0fd1d/phantom/bindings.js#L175-L191 | train |
medialab/sandcrawler | phantom/bindings.js | wrapSuccess | function wrapSuccess(result) {
return {
url: page.url,
body: getContent(),
headers: pageInformation.response.headers,
status: pageInformation.response.status,
error: result.error ? helpers.serializeError(result.error) : null,
data: result.data
};
} | javascript | function wrapSuccess(result) {
return {
url: page.url,
body: getContent(),
headers: pageInformation.response.headers,
status: pageInformation.response.status,
error: result.error ? helpers.serializeError(result.error) : null,
data: result.data
};
} | [
"function",
"wrapSuccess",
"(",
"result",
")",
"{",
"return",
"{",
"url",
":",
"page",
".",
"url",
",",
"body",
":",
"getContent",
"(",
")",
",",
"headers",
":",
"pageInformation",
".",
"response",
".",
"headers",
",",
"status",
":",
"pageInformation",
"... | Wrapping success helper | [
"Wrapping",
"success",
"helper"
] | c08e19095eee42c8ce1f84685960e5ea6cb0fd1d | https://github.com/medialab/sandcrawler/blob/c08e19095eee42c8ce1f84685960e5ea6cb0fd1d/phantom/bindings.js#L194-L203 | train |
medialab/sandcrawler | phantom/bindings.js | function(status) {
// Page is now opened
pageInformation.isOpened = true;
pageInformation.status = status;
// Failing
if (status !== 'success') {
parent.replyTo(callId, wrapFailure('fail'));
return cleanup();
}
// Wrong status code
if (!pageInformation.... | javascript | function(status) {
// Page is now opened
pageInformation.isOpened = true;
pageInformation.status = status;
// Failing
if (status !== 'success') {
parent.replyTo(callId, wrapFailure('fail'));
return cleanup();
}
// Wrong status code
if (!pageInformation.... | [
"function",
"(",
"status",
")",
"{",
"// Page is now opened",
"pageInformation",
".",
"isOpened",
"=",
"true",
";",
"pageInformation",
".",
"status",
"=",
"status",
";",
"// Failing",
"if",
"(",
"status",
"!==",
"'success'",
")",
"{",
"parent",
".",
"replyTo",... | When page load is finished | [
"When",
"page",
"load",
"is",
"finished"
] | c08e19095eee42c8ce1f84685960e5ea6cb0fd1d | https://github.com/medialab/sandcrawler/blob/c08e19095eee42c8ce1f84685960e5ea6cb0fd1d/phantom/bindings.js#L395-L426 | train | |
icelab/draft-js-ast-exporter | src/processor.js | processBlockContent | function processBlockContent (block, contentState, options) {
const entityModifiers = options.entityModifiers || {}
let text = block.getText()
// Cribbed from sstur’s implementation in draft-js-export-html
// https://github.com/sstur/draft-js-export-html/blob/master/src/stateToHTML.js#L222
let charMetaList =... | javascript | function processBlockContent (block, contentState, options) {
const entityModifiers = options.entityModifiers || {}
let text = block.getText()
// Cribbed from sstur’s implementation in draft-js-export-html
// https://github.com/sstur/draft-js-export-html/blob/master/src/stateToHTML.js#L222
let charMetaList =... | [
"function",
"processBlockContent",
"(",
"block",
",",
"contentState",
",",
"options",
")",
"{",
"const",
"entityModifiers",
"=",
"options",
".",
"entityModifiers",
"||",
"{",
"}",
"let",
"text",
"=",
"block",
".",
"getText",
"(",
")",
"// Cribbed from sstur’s im... | Process the content of a ContentBlock into appropriate abstract syntax tree
nodes based on their type
@param {ContentBlock} block
@param {ContentState} contentState The draft-js ContentState object
containing this block
@param {Object} options.entityModifier Map of functions for modifying entity
data as it’s exporte... | [
"Process",
"the",
"content",
"of",
"a",
"ContentBlock",
"into",
"appropriate",
"abstract",
"syntax",
"tree",
"nodes",
"based",
"on",
"their",
"type"
] | f4745a8a3ca94b51474f21fedc0f92dbbdafd828 | https://github.com/icelab/draft-js-ast-exporter/blob/f4745a8a3ca94b51474f21fedc0f92dbbdafd828/src/processor.js#L14-L70 | train |
icelab/draft-js-ast-exporter | src/processor.js | processBlocks | function processBlocks (blocks, contentState, options = {}) {
// Track block context
let context = context || []
let currentContext = context
let lastBlock = null
let lastProcessed = null
let parents = []
// Procedurally process individual blocks
blocks.forEach(processBlock)
/**
* Process an indi... | javascript | function processBlocks (blocks, contentState, options = {}) {
// Track block context
let context = context || []
let currentContext = context
let lastBlock = null
let lastProcessed = null
let parents = []
// Procedurally process individual blocks
blocks.forEach(processBlock)
/**
* Process an indi... | [
"function",
"processBlocks",
"(",
"blocks",
",",
"contentState",
",",
"options",
"=",
"{",
"}",
")",
"{",
"// Track block context",
"let",
"context",
"=",
"context",
"||",
"[",
"]",
"let",
"currentContext",
"=",
"context",
"let",
"lastBlock",
"=",
"null",
"l... | Convert the content from a series of draft-js blocks into an abstract
syntax tree
@param {Array} blocks
@param {ContentState} contentState The draft-js ContentState object
containing the blocks
@param {Object} options
@return {Array} An abstract syntax tree representing a draft-js content state | [
"Convert",
"the",
"content",
"from",
"a",
"series",
"of",
"draft",
"-",
"js",
"blocks",
"into",
"an",
"abstract",
"syntax",
"tree"
] | f4745a8a3ca94b51474f21fedc0f92dbbdafd828 | https://github.com/icelab/draft-js-ast-exporter/blob/f4745a8a3ca94b51474f21fedc0f92dbbdafd828/src/processor.js#L81-L138 | train |
Geta/NestedObjectAssign | webpack.config.js | getBaseConfig | function getBaseConfig(isProd) {
// get library details from JSON config
var libraryDesc = require('./package.json').library;
var libraryEntryPoint = path.join('src', libraryDesc.entry);
// generate webpack base config
return {
entry: path.join(__dirname, libraryEntryPoint),
output: {
// ommit... | javascript | function getBaseConfig(isProd) {
// get library details from JSON config
var libraryDesc = require('./package.json').library;
var libraryEntryPoint = path.join('src', libraryDesc.entry);
// generate webpack base config
return {
entry: path.join(__dirname, libraryEntryPoint),
output: {
// ommit... | [
"function",
"getBaseConfig",
"(",
"isProd",
")",
"{",
"// get library details from JSON config",
"var",
"libraryDesc",
"=",
"require",
"(",
"'./package.json'",
")",
".",
"library",
";",
"var",
"libraryEntryPoint",
"=",
"path",
".",
"join",
"(",
"'src'",
",",
"libr... | Build base config
@param {Boolean} isProd [description]
@return {[type]} [description] | [
"Build",
"base",
"config"
] | f63a28f1a285af31c7479a5abba88ffd5d2cb39d | https://github.com/Geta/NestedObjectAssign/blob/f63a28f1a285af31c7479a5abba88ffd5d2cb39d/webpack.config.js#L67-L105 | train |
jadrake75/odata-filter-parser | src/odata-parser.js | function (config) {
if (!config) {
config = {};
}
this.subject = config.subject;
this.value = config.value;
this.operator = (config.operator) ? config.operator : Operators.EQUALS;
return this;
} | javascript | function (config) {
if (!config) {
config = {};
}
this.subject = config.subject;
this.value = config.value;
this.operator = (config.operator) ? config.operator : Operators.EQUALS;
return this;
} | [
"function",
"(",
"config",
")",
"{",
"if",
"(",
"!",
"config",
")",
"{",
"config",
"=",
"{",
"}",
";",
"}",
"this",
".",
"subject",
"=",
"config",
".",
"subject",
";",
"this",
".",
"value",
"=",
"config",
".",
"value",
";",
"this",
".",
"operator... | Predicate is the basic model construct of the odata expression
@param config
@returns {Predicate}
@constructor | [
"Predicate",
"is",
"the",
"basic",
"model",
"construct",
"of",
"the",
"odata",
"expression"
] | f8e6e354bdedafe611d7fe82d5fced65ad33e19e | https://github.com/jadrake75/odata-filter-parser/blob/f8e6e354bdedafe611d7fe82d5fced65ad33e19e/src/odata-parser.js#L61-L69 | train | |
Urigo/meteor-native-packages | packages/ddp-client/livedata_connection.js | function () {
var self = this;
if (!self._waitingForQuiescence())
self._flushBufferedWrites();
_.each(self._stores, function (s) {
s.saveOriginals();
});
} | javascript | function () {
var self = this;
if (!self._waitingForQuiescence())
self._flushBufferedWrites();
_.each(self._stores, function (s) {
s.saveOriginals();
});
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"self",
".",
"_waitingForQuiescence",
"(",
")",
")",
"self",
".",
"_flushBufferedWrites",
"(",
")",
";",
"_",
".",
"each",
"(",
"self",
".",
"_stores",
",",
"function",
"(",
... | Before calling a method stub, prepare all stores to track changes and allow _retrieveAndStoreOriginals to get the original versions of changed documents. | [
"Before",
"calling",
"a",
"method",
"stub",
"prepare",
"all",
"stores",
"to",
"track",
"changes",
"and",
"allow",
"_retrieveAndStoreOriginals",
"to",
"get",
"the",
"original",
"versions",
"of",
"changed",
"documents",
"."
] | 8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7 | https://github.com/Urigo/meteor-native-packages/blob/8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7/packages/ddp-client/livedata_connection.js#L975-L982 | train | |
Urigo/meteor-native-packages | packages/ddp-client/livedata_connection.js | function() {
var self = this;
if (_.isEmpty(self._outstandingMethodBlocks))
return;
_.each(self._outstandingMethodBlocks[0].methods, function (m) {
m.sendMessage();
});
} | javascript | function() {
var self = this;
if (_.isEmpty(self._outstandingMethodBlocks))
return;
_.each(self._outstandingMethodBlocks[0].methods, function (m) {
m.sendMessage();
});
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"_",
".",
"isEmpty",
"(",
"self",
".",
"_outstandingMethodBlocks",
")",
")",
"return",
";",
"_",
".",
"each",
"(",
"self",
".",
"_outstandingMethodBlocks",
"[",
"0",
"]",
".",
"me... | Sends messages for all the methods in the first block in _outstandingMethodBlocks. | [
"Sends",
"messages",
"for",
"all",
"the",
"methods",
"in",
"the",
"first",
"block",
"in",
"_outstandingMethodBlocks",
"."
] | 8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7 | https://github.com/Urigo/meteor-native-packages/blob/8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7/packages/ddp-client/livedata_connection.js#L1662-L1669 | train | |
jaredhanson/passport-fitbit | lib/errors/apierror.js | APIError | function APIError(message, type, field) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.name = 'APIError';
this.message = message;
this.type = type;
this.field = field;
} | javascript | function APIError(message, type, field) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.name = 'APIError';
this.message = message;
this.type = type;
this.field = field;
} | [
"function",
"APIError",
"(",
"message",
",",
"type",
",",
"field",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"Error",
".",
"captureStackTrace",
"(",
"this",
",",
"arguments",
".",
"callee",
")",
";",
"this",
".",
"name",
"=",
"'APIError'",... | `APIError` error.
@constructor
@param {string} [message]
@param {string} [type]
@param {string} [field]
@access public | [
"APIError",
"error",
"."
] | 68f730ac5a834163aeb9c33f8885888de45f0a7d | https://github.com/jaredhanson/passport-fitbit/blob/68f730ac5a834163aeb9c33f8885888de45f0a7d/lib/errors/apierror.js#L10-L17 | train |
Urigo/meteor-native-packages | linker.js | linkPackages | function linkPackages(dstPacksDir) {
if (!dstPacksDir) {
dstPacksDir = Path.resolve(rootDir, "packages");
}
else {
dstPacksDir = Path.resolve(cwd, dstPacksDir);
}
// Ensure destination dir
try {
Fs.mkdirSync(dstPacksDir);
}
catch (_) {}
var packNames = Fs.readdirSync(srcPacksDir);
// ... | javascript | function linkPackages(dstPacksDir) {
if (!dstPacksDir) {
dstPacksDir = Path.resolve(rootDir, "packages");
}
else {
dstPacksDir = Path.resolve(cwd, dstPacksDir);
}
// Ensure destination dir
try {
Fs.mkdirSync(dstPacksDir);
}
catch (_) {}
var packNames = Fs.readdirSync(srcPacksDir);
// ... | [
"function",
"linkPackages",
"(",
"dstPacksDir",
")",
"{",
"if",
"(",
"!",
"dstPacksDir",
")",
"{",
"dstPacksDir",
"=",
"Path",
".",
"resolve",
"(",
"rootDir",
",",
"\"packages\"",
")",
";",
"}",
"else",
"{",
"dstPacksDir",
"=",
"Path",
".",
"resolve",
"(... | Creates a symlink for each native package.
@param dstPacksDir - Synlinks' output dir. Defaults to 'packages' dir. | [
"Creates",
"a",
"symlink",
"for",
"each",
"native",
"package",
"."
] | 8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7 | https://github.com/Urigo/meteor-native-packages/blob/8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7/linker.js#L14-L46 | train |
zotero/zotero-api-node | lib/stream.js | Stream | function Stream(options) {
/**
* Whether or not the Stream was initialized as
* a single- or multi-key stream.
*
* @property multi
* @type Boolean
*/
reader(this, 'multi', !(options && options.apiKey));
if (!this.multi) {
options.headers = options.headers || {};
options.headers['Zotero... | javascript | function Stream(options) {
/**
* Whether or not the Stream was initialized as
* a single- or multi-key stream.
*
* @property multi
* @type Boolean
*/
reader(this, 'multi', !(options && options.apiKey));
if (!this.multi) {
options.headers = options.headers || {};
options.headers['Zotero... | [
"function",
"Stream",
"(",
"options",
")",
"{",
"/**\n * Whether or not the Stream was initialized as\n * a single- or multi-key stream.\n *\n * @property multi\n * @type Boolean\n */",
"reader",
"(",
"this",
",",
"'multi'",
",",
"!",
"(",
"options",
"&&",
"options",
... | Connects to the Zotero Streaming API
by establishing a WebSocket connection.
@class Stream
@constructor
@extends Client
@param {Object} options | [
"Connects",
"to",
"the",
"Zotero",
"Streaming",
"API",
"by",
"establishing",
"a",
"WebSocket",
"connection",
"."
] | df5b03cb6b66580efa52aaa22735b0058fbfdf8d | https://github.com/zotero/zotero-api-node/blob/df5b03cb6b66580efa52aaa22735b0058fbfdf8d/lib/stream.js#L52-L104 | train |
lukeed/dom-selection | dist/dom-selection.es.js | getRange | function getRange(sel) {
sel = sel || getSelection();
return sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
} | javascript | function getRange(sel) {
sel = sel || getSelection();
return sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
} | [
"function",
"getRange",
"(",
"sel",
")",
"{",
"sel",
"=",
"sel",
"||",
"getSelection",
"(",
")",
";",
"return",
"sel",
".",
"rangeCount",
">",
"0",
"?",
"sel",
".",
"getRangeAt",
"(",
"0",
")",
":",
"null",
";",
"}"
] | Get a Selection's Range
@see http://stackoverflow.com/questions/13949059/persisting-the-changes-of-range-objects-after-selection-in-html/13950376#13950376
@param {Selection} sel
@return {Range|null} | [
"Get",
"a",
"Selection",
"s",
"Range"
] | b926c790347ec5b58c219c64aff6c030b2266fd1 | https://github.com/lukeed/dom-selection/blob/b926c790347ec5b58c219c64aff6c030b2266fd1/dist/dom-selection.es.js#L36-L39 | train |
lukeed/dom-selection | dist/dom-selection.es.js | setRange | function setRange(saved, sel) {
if (!saved) { return; }
// will make new selection, if unset
sel = sel || getSelection();
sel.removeAllRanges();
sel.addRange(saved);
} | javascript | function setRange(saved, sel) {
if (!saved) { return; }
// will make new selection, if unset
sel = sel || getSelection();
sel.removeAllRanges();
sel.addRange(saved);
} | [
"function",
"setRange",
"(",
"saved",
",",
"sel",
")",
"{",
"if",
"(",
"!",
"saved",
")",
"{",
"return",
";",
"}",
"// will make new selection, if unset",
"sel",
"=",
"sel",
"||",
"getSelection",
"(",
")",
";",
"sel",
".",
"removeAllRanges",
"(",
")",
";... | Restore a Selection Range
@see http://stackoverflow.com/questions/13949059/persisting-the-changes-of-range-objects-after-selection-in-html/13950376#13950376
@param {Range} saved
@param {Selection} sel | [
"Restore",
"a",
"Selection",
"Range"
] | b926c790347ec5b58c219c64aff6c030b2266fd1 | https://github.com/lukeed/dom-selection/blob/b926c790347ec5b58c219c64aff6c030b2266fd1/dist/dom-selection.es.js#L47-L53 | train |
lukeed/dom-selection | dist/dom-selection.es.js | getRect | function getRect(sel) {
sel = sel || getSelection();
if (!sel.rangeCount) { return false; }
var range = sel.getRangeAt(0).cloneRange();
// on Webkit 'range.getBoundingClientRect()' sometimes return 0/0/0/0 - but 'range.getClientRects()' works
var rects = range.getClientRects ? range.getClientRects() : [];
for (... | javascript | function getRect(sel) {
sel = sel || getSelection();
if (!sel.rangeCount) { return false; }
var range = sel.getRangeAt(0).cloneRange();
// on Webkit 'range.getBoundingClientRect()' sometimes return 0/0/0/0 - but 'range.getClientRects()' works
var rects = range.getClientRects ? range.getClientRects() : [];
for (... | [
"function",
"getRect",
"(",
"sel",
")",
"{",
"sel",
"=",
"sel",
"||",
"getSelection",
"(",
")",
";",
"if",
"(",
"!",
"sel",
".",
"rangeCount",
")",
"{",
"return",
"false",
";",
"}",
"var",
"range",
"=",
"sel",
".",
"getRangeAt",
"(",
"0",
")",
".... | Get a Selection Rectangle
@see http://stackoverflow.com/questions/12603397/calculate-width-height-of-the-selected-text-javascript
@see http://stackoverflow.com/questions/6846230/coordinates-of-selected-text-in-browser-page
@param {Selection} sel
@return {Object|Boolean} | [
"Get",
"a",
"Selection",
"Rectangle"
] | b926c790347ec5b58c219c64aff6c030b2266fd1 | https://github.com/lukeed/dom-selection/blob/b926c790347ec5b58c219c64aff6c030b2266fd1/dist/dom-selection.es.js#L62-L84 | train |
lukeed/dom-selection | dist/dom-selection.es.js | getNodes | function getNodes(sel) {
var range = getRange(sel);
if (!range) { return []; }
var node = range.startContainer;
var endNode = range.endContainer;
// Special case for a range that is contained within a single node
if (node === endNode) { return [node]; }
// Iterate nodes until we hit the end container
var nod... | javascript | function getNodes(sel) {
var range = getRange(sel);
if (!range) { return []; }
var node = range.startContainer;
var endNode = range.endContainer;
// Special case for a range that is contained within a single node
if (node === endNode) { return [node]; }
// Iterate nodes until we hit the end container
var nod... | [
"function",
"getNodes",
"(",
"sel",
")",
"{",
"var",
"range",
"=",
"getRange",
"(",
"sel",
")",
";",
"if",
"(",
"!",
"range",
")",
"{",
"return",
"[",
"]",
";",
"}",
"var",
"node",
"=",
"range",
".",
"startContainer",
";",
"var",
"endNode",
"=",
... | Get all Nodes within a Selection.
@see http://stackoverflow.com/questions/7781963/js-get-array-of-all-selected-nodes-in-contenteditable-div
@param {Selection} sel
@return {Array} | [
"Get",
"all",
"Nodes",
"within",
"a",
"Selection",
"."
] | b926c790347ec5b58c219c64aff6c030b2266fd1 | https://github.com/lukeed/dom-selection/blob/b926c790347ec5b58c219c64aff6c030b2266fd1/dist/dom-selection.es.js#L92-L116 | train |
lukeed/dom-selection | dist/dom-selection.es.js | getHTML | function getHTML(sel) {
sel = sel || getSelection();
if (!sel.rangeCount || sel.isCollapsed) { return null; }
var len = sel.rangeCount;
var container = doc.createElement('div');
for (var i = 0; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
return container.innerHTML;
} | javascript | function getHTML(sel) {
sel = sel || getSelection();
if (!sel.rangeCount || sel.isCollapsed) { return null; }
var len = sel.rangeCount;
var container = doc.createElement('div');
for (var i = 0; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
return container.innerHTML;
} | [
"function",
"getHTML",
"(",
"sel",
")",
"{",
"sel",
"=",
"sel",
"||",
"getSelection",
"(",
")",
";",
"if",
"(",
"!",
"sel",
".",
"rangeCount",
"||",
"sel",
".",
"isCollapsed",
")",
"{",
"return",
"null",
";",
"}",
"var",
"len",
"=",
"sel",
".",
"... | Get the inner HTML content of a selection.
@see http://stackoverflow.com/questions/4652734/return-html-from-a-user-selected-text/4652824#4652824
@param {Selection} sel
@return {String} | [
"Get",
"the",
"inner",
"HTML",
"content",
"of",
"a",
"selection",
"."
] | b926c790347ec5b58c219c64aff6c030b2266fd1 | https://github.com/lukeed/dom-selection/blob/b926c790347ec5b58c219c64aff6c030b2266fd1/dist/dom-selection.es.js#L124-L136 | train |
lukeed/dom-selection | dist/dom-selection.es.js | isWithin | function isWithin(container, sel) {
sel = sel || getSelection();
return container.contains(sel.anchorNode) && container.contains(sel.focusNode);
} | javascript | function isWithin(container, sel) {
sel = sel || getSelection();
return container.contains(sel.anchorNode) && container.contains(sel.focusNode);
} | [
"function",
"isWithin",
"(",
"container",
",",
"sel",
")",
"{",
"sel",
"=",
"sel",
"||",
"getSelection",
"(",
")",
";",
"return",
"container",
".",
"contains",
"(",
"sel",
".",
"anchorNode",
")",
"&&",
"container",
".",
"contains",
"(",
"sel",
".",
"fo... | Is the Selection within given container Node?
@param {Node} container The container node
@param {Selection} sel
@return {Boolean} | [
"Is",
"the",
"Selection",
"within",
"given",
"container",
"Node?"
] | b926c790347ec5b58c219c64aff6c030b2266fd1 | https://github.com/lukeed/dom-selection/blob/b926c790347ec5b58c219c64aff6c030b2266fd1/dist/dom-selection.es.js#L170-L173 | train |
lukeed/dom-selection | dist/dom-selection.es.js | getCaretWord | function getCaretWord(sel) {
sel = sel || getSelection();
var rng = getRange(sel);
expandToWord(sel);
var str = sel.toString(); // range?
// Restore selection
setRange(rng);
return str;
} | javascript | function getCaretWord(sel) {
sel = sel || getSelection();
var rng = getRange(sel);
expandToWord(sel);
var str = sel.toString(); // range?
// Restore selection
setRange(rng);
return str;
} | [
"function",
"getCaretWord",
"(",
"sel",
")",
"{",
"sel",
"=",
"sel",
"||",
"getSelection",
"(",
")",
";",
"var",
"rng",
"=",
"getRange",
"(",
"sel",
")",
";",
"expandToWord",
"(",
"sel",
")",
";",
"var",
"str",
"=",
"sel",
".",
"toString",
"(",
")"... | Get the full word that the Caret is within.
@see http://stackoverflow.com/questions/11247737/how-can-i-get-the-word-that-the-caret-is-upon-inside-a-contenteditable-div
@param {Selection} sel
@return {String} | [
"Get",
"the",
"full",
"word",
"that",
"the",
"Caret",
"is",
"within",
"."
] | b926c790347ec5b58c219c64aff6c030b2266fd1 | https://github.com/lukeed/dom-selection/blob/b926c790347ec5b58c219c64aff6c030b2266fd1/dist/dom-selection.es.js#L211-L219 | train |
lukeed/dom-selection | dist/dom-selection.es.js | isBackwards | function isBackwards(sel) {
sel = sel || getSelection();
if (isCollapsed(sel)) { return; }
// Detect if selection is backwards
var range = doc.createRange();
range.setStart(sel.anchorNode, sel.anchorOffset);
range.setEnd(sel.focusNode, sel.focusOffset);
range.detach();
// if `collapsed` then it's backwards
r... | javascript | function isBackwards(sel) {
sel = sel || getSelection();
if (isCollapsed(sel)) { return; }
// Detect if selection is backwards
var range = doc.createRange();
range.setStart(sel.anchorNode, sel.anchorOffset);
range.setEnd(sel.focusNode, sel.focusOffset);
range.detach();
// if `collapsed` then it's backwards
r... | [
"function",
"isBackwards",
"(",
"sel",
")",
"{",
"sel",
"=",
"sel",
"||",
"getSelection",
"(",
")",
";",
"if",
"(",
"isCollapsed",
"(",
"sel",
")",
")",
"{",
"return",
";",
"}",
"// Detect if selection is backwards",
"var",
"range",
"=",
"doc",
".",
"cre... | Detect the direction of the Selection
@param {Selection} sel
@return {Boolean} | [
"Detect",
"the",
"direction",
"of",
"the",
"Selection"
] | b926c790347ec5b58c219c64aff6c030b2266fd1 | https://github.com/lukeed/dom-selection/blob/b926c790347ec5b58c219c64aff6c030b2266fd1/dist/dom-selection.es.js#L226-L238 | train |
lukeed/dom-selection | dist/dom-selection.es.js | snapSelected | function snapSelected(sel) {
sel = sel || getSelection();
if (isCollapsed(sel)) { return; }
var end = sel.focusNode;
var off = sel.focusOffset;
var dir = ['forward', 'backward'];
isBackwards(sel) && dir.reverse();
// modify() works on the focus of the selection
sel.collapse(sel.anchorNode, sel.anchorOffset);
... | javascript | function snapSelected(sel) {
sel = sel || getSelection();
if (isCollapsed(sel)) { return; }
var end = sel.focusNode;
var off = sel.focusOffset;
var dir = ['forward', 'backward'];
isBackwards(sel) && dir.reverse();
// modify() works on the focus of the selection
sel.collapse(sel.anchorNode, sel.anchorOffset);
... | [
"function",
"snapSelected",
"(",
"sel",
")",
"{",
"sel",
"=",
"sel",
"||",
"getSelection",
"(",
")",
";",
"if",
"(",
"isCollapsed",
"(",
"sel",
")",
")",
"{",
"return",
";",
"}",
"var",
"end",
"=",
"sel",
".",
"focusNode",
";",
"var",
"off",
"=",
... | Snap the Selection to encompass all partially-selected words.
@see http://stackoverflow.com/questions/7380190/select-whole-word-with-getselection
@param {Selection} sel | [
"Snap",
"the",
"Selection",
"to",
"encompass",
"all",
"partially",
"-",
"selected",
"words",
"."
] | b926c790347ec5b58c219c64aff6c030b2266fd1 | https://github.com/lukeed/dom-selection/blob/b926c790347ec5b58c219c64aff6c030b2266fd1/dist/dom-selection.es.js#L245-L262 | train |
Urigo/meteor-native-packages | packages/ddp-server/writefence.js | function () {
var self = this;
if (self === DDPServer._CurrentWriteFence.get())
throw Error("Can't arm the current fence");
self.armed = true;
self._maybeFire();
} | javascript | function () {
var self = this;
if (self === DDPServer._CurrentWriteFence.get())
throw Error("Can't arm the current fence");
self.armed = true;
self._maybeFire();
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"self",
"===",
"DDPServer",
".",
"_CurrentWriteFence",
".",
"get",
"(",
")",
")",
"throw",
"Error",
"(",
"\"Can't arm the current fence\"",
")",
";",
"self",
".",
"armed",
"=",
"true"... | Arm the fence. Once the fence is armed, and there are no more uncommitted writes, it will activate. | [
"Arm",
"the",
"fence",
".",
"Once",
"the",
"fence",
"is",
"armed",
"and",
"there",
"are",
"no",
"more",
"uncommitted",
"writes",
"it",
"will",
"activate",
"."
] | 8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7 | https://github.com/Urigo/meteor-native-packages/blob/8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7/packages/ddp-server/writefence.js#L55-L61 | train | |
Urigo/meteor-native-packages | packages/ddp-server/writefence.js | function () {
var self = this;
var future = new Future;
self.onAllCommitted(function () {
future['return']();
});
self.arm();
future.wait();
} | javascript | function () {
var self = this;
var future = new Future;
self.onAllCommitted(function () {
future['return']();
});
self.arm();
future.wait();
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"future",
"=",
"new",
"Future",
";",
"self",
".",
"onAllCommitted",
"(",
"function",
"(",
")",
"{",
"future",
"[",
"'return'",
"]",
"(",
")",
";",
"}",
")",
";",
"self",
".",
"arm... | Convenience function. Arms the fence, then blocks until it fires. | [
"Convenience",
"function",
".",
"Arms",
"the",
"fence",
"then",
"blocks",
"until",
"it",
"fires",
"."
] | 8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7 | https://github.com/Urigo/meteor-native-packages/blob/8eb7fdd554aad0ff78a0dc19b9c62016d2b2e7a7/packages/ddp-server/writefence.js#L84-L92 | train | |
bitinn/vdom-parser | index.js | createNode | function createNode(el, attr) {
// html comment is not currently supported by virtual-dom
if (el.nodeType === 3) {
return createVirtualTextNode(el);
// cdata or doctype is not currently supported by virtual-dom
} else if (el.nodeType === 1 || el.nodeType === 9) {
return createVirtualDomNode(el, attr);
}
// ... | javascript | function createNode(el, attr) {
// html comment is not currently supported by virtual-dom
if (el.nodeType === 3) {
return createVirtualTextNode(el);
// cdata or doctype is not currently supported by virtual-dom
} else if (el.nodeType === 1 || el.nodeType === 9) {
return createVirtualDomNode(el, attr);
}
// ... | [
"function",
"createNode",
"(",
"el",
",",
"attr",
")",
"{",
"// html comment is not currently supported by virtual-dom",
"if",
"(",
"el",
".",
"nodeType",
"===",
"3",
")",
"{",
"return",
"createVirtualTextNode",
"(",
"el",
")",
";",
"// cdata or doctype is not current... | Create vdom from dom node
@param Object el DOM element
@param String attr Attribute name that contains vdom key
@return Object VNode or VText | [
"Create",
"vdom",
"from",
"dom",
"node"
] | e7dffa55bd205642ee0a675e46e738a515764390 | https://github.com/bitinn/vdom-parser/blob/e7dffa55bd205642ee0a675e46e738a515764390/index.js#L73-L85 | train |
bitinn/vdom-parser | index.js | createVirtualDomNode | function createVirtualDomNode(el, attr) {
var ns = el.namespaceURI !== HTML_NAMESPACE ? el.namespaceURI : null;
var key = attr && el.getAttribute(attr) ? el.getAttribute(attr) : null;
return new VNode(
el.tagName
, createProperties(el)
, createChildren(el, attr)
, key
, ns
);
} | javascript | function createVirtualDomNode(el, attr) {
var ns = el.namespaceURI !== HTML_NAMESPACE ? el.namespaceURI : null;
var key = attr && el.getAttribute(attr) ? el.getAttribute(attr) : null;
return new VNode(
el.tagName
, createProperties(el)
, createChildren(el, attr)
, key
, ns
);
} | [
"function",
"createVirtualDomNode",
"(",
"el",
",",
"attr",
")",
"{",
"var",
"ns",
"=",
"el",
".",
"namespaceURI",
"!==",
"HTML_NAMESPACE",
"?",
"el",
".",
"namespaceURI",
":",
"null",
";",
"var",
"key",
"=",
"attr",
"&&",
"el",
".",
"getAttribute",
"(",... | Create vnode from dom node
@param Object el DOM element
@param String attr Attribute name that contains vdom key
@return Object VNode | [
"Create",
"vnode",
"from",
"dom",
"node"
] | e7dffa55bd205642ee0a675e46e738a515764390 | https://github.com/bitinn/vdom-parser/blob/e7dffa55bd205642ee0a675e46e738a515764390/index.js#L104-L115 | train |
bitinn/vdom-parser | index.js | createChildren | function createChildren(el, attr) {
var children = [];
for (var i = 0; i < el.childNodes.length; i++) {
children.push(createNode(el.childNodes[i], attr));
};
return children;
} | javascript | function createChildren(el, attr) {
var children = [];
for (var i = 0; i < el.childNodes.length; i++) {
children.push(createNode(el.childNodes[i], attr));
};
return children;
} | [
"function",
"createChildren",
"(",
"el",
",",
"attr",
")",
"{",
"var",
"children",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"el",
".",
"childNodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"children",
".",
"push",
"... | Recursively create vdom
@param Object el Parent element
@param String attr Attribute name that contains vdom key
@return Array Child vnode or vtext | [
"Recursively",
"create",
"vdom"
] | e7dffa55bd205642ee0a675e46e738a515764390 | https://github.com/bitinn/vdom-parser/blob/e7dffa55bd205642ee0a675e46e738a515764390/index.js#L124-L131 | train |
bitinn/vdom-parser | index.js | createProperties | function createProperties(el) {
var properties = {};
if (!el.hasAttributes()) {
return properties;
}
var ns;
if (el.namespaceURI && el.namespaceURI !== HTML_NAMESPACE) {
ns = el.namespaceURI;
}
var attr;
for (var i = 0; i < el.attributes.length; i++) {
// use built in css style parsing
if(el.attribut... | javascript | function createProperties(el) {
var properties = {};
if (!el.hasAttributes()) {
return properties;
}
var ns;
if (el.namespaceURI && el.namespaceURI !== HTML_NAMESPACE) {
ns = el.namespaceURI;
}
var attr;
for (var i = 0; i < el.attributes.length; i++) {
// use built in css style parsing
if(el.attribut... | [
"function",
"createProperties",
"(",
"el",
")",
"{",
"var",
"properties",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"el",
".",
"hasAttributes",
"(",
")",
")",
"{",
"return",
"properties",
";",
"}",
"var",
"ns",
";",
"if",
"(",
"el",
".",
"namespaceURI",
... | Create properties from dom node
@param Object el DOM element
@return Object Node properties and attributes | [
"Create",
"properties",
"from",
"dom",
"node"
] | e7dffa55bd205642ee0a675e46e738a515764390 | https://github.com/bitinn/vdom-parser/blob/e7dffa55bd205642ee0a675e46e738a515764390/index.js#L139-L185 | train |
bitinn/vdom-parser | index.js | createProperty | function createProperty(attr) {
var name, value, isAttr;
// using a map to find the correct case of property name
if (propertyMap[attr.name]) {
name = propertyMap[attr.name];
} else {
name = attr.name;
}
// special cases for data attribute, we default to properties.attributes.data
if (name.indexOf('data-') ... | javascript | function createProperty(attr) {
var name, value, isAttr;
// using a map to find the correct case of property name
if (propertyMap[attr.name]) {
name = propertyMap[attr.name];
} else {
name = attr.name;
}
// special cases for data attribute, we default to properties.attributes.data
if (name.indexOf('data-') ... | [
"function",
"createProperty",
"(",
"attr",
")",
"{",
"var",
"name",
",",
"value",
",",
"isAttr",
";",
"// using a map to find the correct case of property name",
"if",
"(",
"propertyMap",
"[",
"attr",
".",
"name",
"]",
")",
"{",
"name",
"=",
"propertyMap",
"[",
... | Create property from dom attribute
@param Object attr DOM attribute
@return Object Normalized attribute | [
"Create",
"property",
"from",
"dom",
"attribute"
] | e7dffa55bd205642ee0a675e46e738a515764390 | https://github.com/bitinn/vdom-parser/blob/e7dffa55bd205642ee0a675e46e738a515764390/index.js#L193-L215 | train |
bitinn/vdom-parser | index.js | createPropertyNS | function createPropertyNS(attr) {
var name, value;
return {
name: attr.name
, value: attr.value
, ns: namespaceMap[attr.name] || ''
};
} | javascript | function createPropertyNS(attr) {
var name, value;
return {
name: attr.name
, value: attr.value
, ns: namespaceMap[attr.name] || ''
};
} | [
"function",
"createPropertyNS",
"(",
"attr",
")",
"{",
"var",
"name",
",",
"value",
";",
"return",
"{",
"name",
":",
"attr",
".",
"name",
",",
"value",
":",
"attr",
".",
"value",
",",
"ns",
":",
"namespaceMap",
"[",
"attr",
".",
"name",
"]",
"||",
... | Create namespaced property from dom attribute
@param Object attr DOM attribute
@return Object Normalized attribute | [
"Create",
"namespaced",
"property",
"from",
"dom",
"attribute"
] | e7dffa55bd205642ee0a675e46e738a515764390 | https://github.com/bitinn/vdom-parser/blob/e7dffa55bd205642ee0a675e46e738a515764390/index.js#L223-L231 | train |
bitinn/vdom-parser | index.js | createStyleProperty | function createStyleProperty(el) {
var style = el.style;
var output = {};
for (var i = 0; i < style.length; ++i) {
var item = style.item(i);
output[item] = String(style[item]);
// hack to workaround browser inconsistency with url()
if (output[item].indexOf('url') > -1) {
output[item] = output[item].replac... | javascript | function createStyleProperty(el) {
var style = el.style;
var output = {};
for (var i = 0; i < style.length; ++i) {
var item = style.item(i);
output[item] = String(style[item]);
// hack to workaround browser inconsistency with url()
if (output[item].indexOf('url') > -1) {
output[item] = output[item].replac... | [
"function",
"createStyleProperty",
"(",
"el",
")",
"{",
"var",
"style",
"=",
"el",
".",
"style",
";",
"var",
"output",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"style",
".",
"length",
";",
"++",
"i",
")",
"{",
"var",... | Create style property from dom node
@param Object el DOM node
@return Object Normalized attribute | [
"Create",
"style",
"property",
"from",
"dom",
"node"
] | e7dffa55bd205642ee0a675e46e738a515764390 | https://github.com/bitinn/vdom-parser/blob/e7dffa55bd205642ee0a675e46e738a515764390/index.js#L239-L251 | train |
IronCoreLabs/ironnode | build.js | tagRepo | function tagRepo(version) {
if (SHOULD_PUBLISH) {
shell.exec(`git tag ${version}`);
shell.exec("git push origin --tags");
} else {
console.log(`\n\nWould publish git tag as version ${version}.`);
}
} | javascript | function tagRepo(version) {
if (SHOULD_PUBLISH) {
shell.exec(`git tag ${version}`);
shell.exec("git push origin --tags");
} else {
console.log(`\n\nWould publish git tag as version ${version}.`);
}
} | [
"function",
"tagRepo",
"(",
"version",
")",
"{",
"if",
"(",
"SHOULD_PUBLISH",
")",
"{",
"shell",
".",
"exec",
"(",
"`",
"${",
"version",
"}",
"`",
")",
";",
"shell",
".",
"exec",
"(",
"\"git push origin --tags\"",
")",
";",
"}",
"else",
"{",
"console",... | Tag the repo with the current version that we're publishing | [
"Tag",
"the",
"repo",
"with",
"the",
"current",
"version",
"that",
"we",
"re",
"publishing"
] | a0c69398c75230720c4a825426d2a73925ea9053 | https://github.com/IronCoreLabs/ironnode/blob/a0c69398c75230720c4a825426d2a73925ea9053/build.js#L50-L57 | train |
IronCoreLabs/ironnode | build.js | ensureNoChangesOnMasterBeforePublish | function ensureNoChangesOnMasterBeforePublish() {
//Let users try the build script as long as they're not doing an actual publish
if (!SHOULD_PUBLISH) {
return true;
}
shell.exec("git fetch origin", {silent: true});
const currentBranch = shell.exec("git symbolic-ref --short -q HEAD", {sile... | javascript | function ensureNoChangesOnMasterBeforePublish() {
//Let users try the build script as long as they're not doing an actual publish
if (!SHOULD_PUBLISH) {
return true;
}
shell.exec("git fetch origin", {silent: true});
const currentBranch = shell.exec("git symbolic-ref --short -q HEAD", {sile... | [
"function",
"ensureNoChangesOnMasterBeforePublish",
"(",
")",
"{",
"//Let users try the build script as long as they're not doing an actual publish",
"if",
"(",
"!",
"SHOULD_PUBLISH",
")",
"{",
"return",
"true",
";",
"}",
"shell",
".",
"exec",
"(",
"\"git fetch origin\"",
"... | Ensure that we're in a pristine, up-to-date repo and on the master branch before allowing user to continue. Only does
verification if user is actually trying to perform an NPM publish | [
"Ensure",
"that",
"we",
"re",
"in",
"a",
"pristine",
"up",
"-",
"to",
"-",
"date",
"repo",
"and",
"on",
"the",
"master",
"branch",
"before",
"allowing",
"user",
"to",
"continue",
".",
"Only",
"does",
"verification",
"if",
"user",
"is",
"actually",
"tryin... | a0c69398c75230720c4a825426d2a73925ea9053 | https://github.com/IronCoreLabs/ironnode/blob/a0c69398c75230720c4a825426d2a73925ea9053/build.js#L63-L88 | train |
mjk/uber-rush | lib/Quote.js | Quote | function Quote(options) {
var self = this;
events.EventEmitter.call(self);
this.quote_id = options.quote_id;
this.start_time = new Date(parseInt(options.start_time,10)*1000);
this.end_time = new Date(parseInt(options.end_time,10)*1000);
this.fee = parseFloat(options.fee);
this.currency_code... | javascript | function Quote(options) {
var self = this;
events.EventEmitter.call(self);
this.quote_id = options.quote_id;
this.start_time = new Date(parseInt(options.start_time,10)*1000);
this.end_time = new Date(parseInt(options.end_time,10)*1000);
this.fee = parseFloat(options.fee);
this.currency_code... | [
"function",
"Quote",
"(",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"self",
")",
";",
"this",
".",
"quote_id",
"=",
"options",
".",
"quote_id",
";",
"this",
".",
"start_time",
"=",
"new",
"... | A delivery quote.
@param quote_id string The ID of the quote.
@param estimated_at integer Unix timestamp of the time this quote was generated.
@param start_time integer Unix timestamp of the start of the delivery window.
@param end_time integer Unix timestamp of the end of the delivery window.
@param fee float The fee... | [
"A",
"delivery",
"quote",
"."
] | 3c43b2e8e1da428dd49e1a516f3c1588756c4576 | https://github.com/mjk/uber-rush/blob/3c43b2e8e1da428dd49e1a516f3c1588756c4576/lib/Quote.js#L23-L38 | train |
layerhq/node-layer-api | lib/resources/messages.js | function(conversationId, userId, text, callback) {
send(null, conversationId, utils.messageText('user_id', userId, text), callback);
} | javascript | function(conversationId, userId, text, callback) {
send(null, conversationId, utils.messageText('user_id', userId, text), callback);
} | [
"function",
"(",
"conversationId",
",",
"userId",
",",
"text",
",",
"callback",
")",
"{",
"send",
"(",
"null",
",",
"conversationId",
",",
"utils",
".",
"messageText",
"(",
"'user_id'",
",",
"userId",
",",
"text",
")",
",",
"callback",
")",
";",
"}"
] | Send a plain text message from `userId`
@param {String} conversationId Conversation ID
@param {String} userId User ID
@param {String} text Message text
@param {Function} callback Callback function | [
"Send",
"a",
"plain",
"text",
"message",
"from",
"userId"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/messages.js#L41-L43 | train | |
layerhq/node-layer-api | lib/resources/messages.js | function(conversationId, name, text, callback) {
send(null, conversationId, utils.messageText('name', name, text), callback);
} | javascript | function(conversationId, name, text, callback) {
send(null, conversationId, utils.messageText('name', name, text), callback);
} | [
"function",
"(",
"conversationId",
",",
"name",
",",
"text",
",",
"callback",
")",
"{",
"send",
"(",
"null",
",",
"conversationId",
",",
"utils",
".",
"messageText",
"(",
"'name'",
",",
"name",
",",
"text",
")",
",",
"callback",
")",
";",
"}"
] | Send a plain text message from `name`
@param {String} conversationId Conversation ID
@param {String} name Sender name
@param {String} text Message text
@param {Function} callback Callback function | [
"Send",
"a",
"plain",
"text",
"message",
"from",
"name"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/messages.js#L53-L55 | train | |
layerhq/node-layer-api | lib/resources/messages.js | function(conversationId, params, callback) {
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.messages.cid));
utils.debug('Message getAll: ' + conversationId);
var queryParams = '';
if (typeof params === 'function') callback = params... | javascript | function(conversationId, params, callback) {
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.messages.cid));
utils.debug('Message getAll: ' + conversationId);
var queryParams = '';
if (typeof params === 'function') callback = params... | [
"function",
"(",
"conversationId",
",",
"params",
",",
"callback",
")",
"{",
"conversationId",
"=",
"utils",
".",
"toUUID",
"(",
"conversationId",
")",
";",
"if",
"(",
"!",
"conversationId",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"utils",
"."... | Retrieve messages in a conversation
@param {String} conversationId Conversation ID
@param {String} [params] Query parameters
@param {Function} callback Callback function | [
"Retrieve",
"messages",
"in",
"a",
"conversation"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/messages.js#L64-L76 | train | |
layerhq/node-layer-api | lib/resources/messages.js | function(messageId, conversationId, callback) {
if (!messageId) return callback(new Error(utils.i18n.messages.mid));
messageId = utils.toUUID(messageId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
conversationId = utils.toUUID(conversationId);
utils.debug... | javascript | function(messageId, conversationId, callback) {
if (!messageId) return callback(new Error(utils.i18n.messages.mid));
messageId = utils.toUUID(messageId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
conversationId = utils.toUUID(conversationId);
utils.debug... | [
"function",
"(",
"messageId",
",",
"conversationId",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"messageId",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"utils",
".",
"i18n",
".",
"messages",
".",
"mid",
")",
")",
";",
"messageId",
"=",
"utils... | Retrieve a message in a conversation
@param {String} messageId Message ID
@param {String} conversationId Conversation ID
@param {Function} callback Callback function | [
"Retrieve",
"a",
"message",
"in",
"a",
"conversation"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/messages.js#L85-L94 | train | |
layerhq/node-layer-api | lib/resources/messages.js | function(userId, messageId, callback) {
if (!userId) return callback(new Error(utils.i18n.messages.userId));
messageId = utils.toUUID(messageId);
if (!messageId) return callback(new Error(utils.i18n.messages.mid));
utils.debug('Message getFromUser: ' + userId + ', ' + messageId);
request.... | javascript | function(userId, messageId, callback) {
if (!userId) return callback(new Error(utils.i18n.messages.userId));
messageId = utils.toUUID(messageId);
if (!messageId) return callback(new Error(utils.i18n.messages.mid));
utils.debug('Message getFromUser: ' + userId + ', ' + messageId);
request.... | [
"function",
"(",
"userId",
",",
"messageId",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"userId",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"utils",
".",
"i18n",
".",
"messages",
".",
"userId",
")",
")",
";",
"messageId",
"=",
"utils",
"."... | Retrieve a message in a conversation from a user
@param {String} userId User ID
@param {String} messageId Message ID
@param {Function} callback Callback function | [
"Retrieve",
"a",
"message",
"in",
"a",
"conversation",
"from",
"a",
"user"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/messages.js#L126-L135 | train | |
medialab/sandcrawler | src/spider.js | retryJob | function retryJob(job, when) {
when = when || 'later';
// Reaching maxRetries?
if (job.req.retries >= this.options.maxRetries)
return;
// Dropping from remains
delete this.remains[job.id];
// Request
job.req.retries++;
job.state.retrying = true;
// Adding to the queue again
this.queue[when =... | javascript | function retryJob(job, when) {
when = when || 'later';
// Reaching maxRetries?
if (job.req.retries >= this.options.maxRetries)
return;
// Dropping from remains
delete this.remains[job.id];
// Request
job.req.retries++;
job.state.retrying = true;
// Adding to the queue again
this.queue[when =... | [
"function",
"retryJob",
"(",
"job",
",",
"when",
")",
"{",
"when",
"=",
"when",
"||",
"'later'",
";",
"// Reaching maxRetries?",
"if",
"(",
"job",
".",
"req",
".",
"retries",
">=",
"this",
".",
"options",
".",
"maxRetries",
")",
"return",
";",
"// Droppi... | Retrying a job | [
"Retrying",
"a",
"job"
] | c08e19095eee42c8ce1f84685960e5ea6cb0fd1d | https://github.com/medialab/sandcrawler/blob/c08e19095eee42c8ce1f84685960e5ea6cb0fd1d/src/spider.js#L241-L259 | train |
medialab/sandcrawler | src/spider.js | beforeScraping | function beforeScraping(job, callback) {
return async.applyEachSeries(
this.middlewares.beforeScraping,
job.req,
callback
);
} | javascript | function beforeScraping(job, callback) {
return async.applyEachSeries(
this.middlewares.beforeScraping,
job.req,
callback
);
} | [
"function",
"beforeScraping",
"(",
"job",
",",
"callback",
")",
"{",
"return",
"async",
".",
"applyEachSeries",
"(",
"this",
".",
"middlewares",
".",
"beforeScraping",
",",
"job",
".",
"req",
",",
"callback",
")",
";",
"}"
] | Applying beforeScraping middlewares | [
"Applying",
"beforeScraping",
"middlewares"
] | c08e19095eee42c8ce1f84685960e5ea6cb0fd1d | https://github.com/medialab/sandcrawler/blob/c08e19095eee42c8ce1f84685960e5ea6cb0fd1d/src/spider.js#L262-L268 | train |
medialab/sandcrawler | src/spider.js | afterScraping | function afterScraping(job, callback) {
return async.applyEachSeries(
this.middlewares.afterScraping,
job.req, job.res,
callback
);
} | javascript | function afterScraping(job, callback) {
return async.applyEachSeries(
this.middlewares.afterScraping,
job.req, job.res,
callback
);
} | [
"function",
"afterScraping",
"(",
"job",
",",
"callback",
")",
"{",
"return",
"async",
".",
"applyEachSeries",
"(",
"this",
".",
"middlewares",
".",
"afterScraping",
",",
"job",
".",
"req",
",",
"job",
".",
"res",
",",
"callback",
")",
";",
"}"
] | Applying afterScraping middlewares | [
"Applying",
"afterScraping",
"middlewares"
] | c08e19095eee42c8ce1f84685960e5ea6cb0fd1d | https://github.com/medialab/sandcrawler/blob/c08e19095eee42c8ce1f84685960e5ea6cb0fd1d/src/spider.js#L276-L282 | train |
medialab/sandcrawler | src/spider.js | iterate | function iterate() {
var lastJob = this.lastJob || {},
feed = this.iterator.call(this, this.index, lastJob.req, lastJob.res);
if (feed)
this.addUrl(feed);
} | javascript | function iterate() {
var lastJob = this.lastJob || {},
feed = this.iterator.call(this, this.index, lastJob.req, lastJob.res);
if (feed)
this.addUrl(feed);
} | [
"function",
"iterate",
"(",
")",
"{",
"var",
"lastJob",
"=",
"this",
".",
"lastJob",
"||",
"{",
"}",
",",
"feed",
"=",
"this",
".",
"iterator",
".",
"call",
"(",
"this",
",",
"this",
".",
"index",
",",
"lastJob",
".",
"req",
",",
"lastJob",
".",
... | Perform an iteration | [
"Perform",
"an",
"iteration"
] | c08e19095eee42c8ce1f84685960e5ea6cb0fd1d | https://github.com/medialab/sandcrawler/blob/c08e19095eee42c8ce1f84685960e5ea6cb0fd1d/src/spider.js#L292-L298 | train |
medialab/sandcrawler | src/spider.js | addUrl | function addUrl(when, feed) {
if (!types.check(feed, 'feed') && !types.check(feed, ['feed']))
throw Error('sandcrawler.spider.url(s): wrong argument.');
var a = !(feed instanceof Array) ? [feed] : feed,
c = !this.state.running ? this.initialBuffer.length : this.index,
job,
i,
l;
for ... | javascript | function addUrl(when, feed) {
if (!types.check(feed, 'feed') && !types.check(feed, ['feed']))
throw Error('sandcrawler.spider.url(s): wrong argument.');
var a = !(feed instanceof Array) ? [feed] : feed,
c = !this.state.running ? this.initialBuffer.length : this.index,
job,
i,
l;
for ... | [
"function",
"addUrl",
"(",
"when",
",",
"feed",
")",
"{",
"if",
"(",
"!",
"types",
".",
"check",
"(",
"feed",
",",
"'feed'",
")",
"&&",
"!",
"types",
".",
"check",
"(",
"feed",
",",
"[",
"'feed'",
"]",
")",
")",
"throw",
"Error",
"(",
"'sandcrawl... | Feeding the spider | [
"Feeding",
"the",
"spider"
] | c08e19095eee42c8ce1f84685960e5ea6cb0fd1d | https://github.com/medialab/sandcrawler/blob/c08e19095eee42c8ce1f84685960e5ea6cb0fd1d/src/spider.js#L426-L453 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | function ( a, order, prop, prop2 )
{
var out = [];
var i=0, ien=order.length;
// Could have the test in the loop for slightly smaller code, but speed
// is essential here
if ( prop2 !== undefined ) {
for ( ; i<ien ; i++ ) {
out.push( a[ order[i] ][ prop ][ prop2 ] );
}
}
else {
... | javascript | function ( a, order, prop, prop2 )
{
var out = [];
var i=0, ien=order.length;
// Could have the test in the loop for slightly smaller code, but speed
// is essential here
if ( prop2 !== undefined ) {
for ( ; i<ien ; i++ ) {
out.push( a[ order[i] ][ prop ][ prop2 ] );
}
}
else {
... | [
"function",
"(",
"a",
",",
"order",
",",
"prop",
",",
"prop2",
")",
"{",
"var",
"out",
"=",
"[",
"]",
";",
"var",
"i",
"=",
"0",
",",
"ien",
"=",
"order",
".",
"length",
";",
"// Could have the test in the loop for slightly smaller code, but speed\r",
"// is... | Basically the same as _pluck, but rather than looping over `a` we use `order` as the indexes to pick from `a` | [
"Basically",
"the",
"same",
"as",
"_pluck",
"but",
"rather",
"than",
"looping",
"over",
"a",
"we",
"use",
"order",
"as",
"the",
"indexes",
"to",
"pick",
"from",
"a"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L179-L198 | train | |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | function ( src )
{
// A faster unique method is to use object keys to identify used values,
// but this doesn't work with arrays or objects, which we must also
// consider. See jsperf.com/compare-array-unique-versions/4 for more
// information.
var
out = [],
val,
i, ien=src.length,
j, k... | javascript | function ( src )
{
// A faster unique method is to use object keys to identify used values,
// but this doesn't work with arrays or objects, which we must also
// consider. See jsperf.com/compare-array-unique-versions/4 for more
// information.
var
out = [],
val,
i, ien=src.length,
j, k... | [
"function",
"(",
"src",
")",
"{",
"// A faster unique method is to use object keys to identify used values,\r",
"// but this doesn't work with arrays or objects, which we must also\r",
"// consider. See jsperf.com/compare-array-unique-versions/4 for more\r",
"// information.\r",
"var",
"out",
... | Find the unique elements in a source array.
@param {array} src Source array
@return {array} Array of unique items
@ignore | [
"Find",
"the",
"unique",
"elements",
"in",
"a",
"source",
"array",
"."
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L235-L261 | train | |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnHungarianMap | function _fnHungarianMap ( o )
{
var
hungarian = 'a aa ao as b fn i m o s ',
match,
newKey,
map = {};
$.each( o, function (key, val) {
match = key.match(/^([^A-Z]+?)([A-Z])/);
if ( match && hungarian.indexOf(match[1]+' ') !== -1 )
{
newKey = key.replace( match[0], match[2]... | javascript | function _fnHungarianMap ( o )
{
var
hungarian = 'a aa ao as b fn i m o s ',
match,
newKey,
map = {};
$.each( o, function (key, val) {
match = key.match(/^([^A-Z]+?)([A-Z])/);
if ( match && hungarian.indexOf(match[1]+' ') !== -1 )
{
newKey = key.replace( match[0], match[2]... | [
"function",
"_fnHungarianMap",
"(",
"o",
")",
"{",
"var",
"hungarian",
"=",
"'a aa ao as b fn i m o s '",
",",
"match",
",",
"newKey",
",",
"map",
"=",
"{",
"}",
";",
"$",
".",
"each",
"(",
"o",
",",
"function",
"(",
"key",
",",
"val",
")",
"{",
"mat... | Create a mapping object that allows camel case parameters to be looked up
for their Hungarian counterparts. The mapping is stored in a private
parameter called `_hungarianMap` which can be accessed on the source object.
@param {object} o
@memberof DataTable#oApi | [
"Create",
"a",
"mapping",
"object",
"that",
"allows",
"camel",
"case",
"parameters",
"to",
"be",
"looked",
"up",
"for",
"their",
"Hungarian",
"counterparts",
".",
"The",
"mapping",
"is",
"stored",
"in",
"a",
"private",
"parameter",
"called",
"_hungarianMap",
"... | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L272-L296 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnCamelToHungarian | function _fnCamelToHungarian ( src, user, force )
{
if ( ! src._hungarianMap )
{
_fnHungarianMap( src );
}
var hungarianKey;
$.each( user, function (key, val) {
hungarianKey = src._hungarianMap[ key ];
if ( hungarianKey !== undefined && (force || user[hungarianKey] === undefined) )... | javascript | function _fnCamelToHungarian ( src, user, force )
{
if ( ! src._hungarianMap )
{
_fnHungarianMap( src );
}
var hungarianKey;
$.each( user, function (key, val) {
hungarianKey = src._hungarianMap[ key ];
if ( hungarianKey !== undefined && (force || user[hungarianKey] === undefined) )... | [
"function",
"_fnCamelToHungarian",
"(",
"src",
",",
"user",
",",
"force",
")",
"{",
"if",
"(",
"!",
"src",
".",
"_hungarianMap",
")",
"{",
"_fnHungarianMap",
"(",
"src",
")",
";",
"}",
"var",
"hungarianKey",
";",
"$",
".",
"each",
"(",
"user",
",",
"... | Convert from camel case parameters to Hungarian, based on a Hungarian map
created by _fnHungarianMap.
@param {object} src The model object which holds all parameters that can be
mapped.
@param {object} user The object to convert from camel case to Hungarian.
@param {boolean} force When set to `true`, properties which a... | [
"Convert",
"from",
"camel",
"case",
"parameters",
"to",
"Hungarian",
"based",
"on",
"a",
"Hungarian",
"map",
"created",
"by",
"_fnHungarianMap",
"."
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L310-L332 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnLanguageCompat | function _fnLanguageCompat( oLanguage )
{
var oDefaults = DataTable.defaults.oLanguage;
var zeroRecords = oLanguage.sZeroRecords;
/* Backwards compatibility - if there is no sEmptyTable given, then use the same as
* sZeroRecords - assuming that is given.
*/
if ( !oLanguage.sEmptyTable && zeroRe... | javascript | function _fnLanguageCompat( oLanguage )
{
var oDefaults = DataTable.defaults.oLanguage;
var zeroRecords = oLanguage.sZeroRecords;
/* Backwards compatibility - if there is no sEmptyTable given, then use the same as
* sZeroRecords - assuming that is given.
*/
if ( !oLanguage.sEmptyTable && zeroRe... | [
"function",
"_fnLanguageCompat",
"(",
"oLanguage",
")",
"{",
"var",
"oDefaults",
"=",
"DataTable",
".",
"defaults",
".",
"oLanguage",
";",
"var",
"zeroRecords",
"=",
"oLanguage",
".",
"sZeroRecords",
";",
"/* Backwards compatibility - if there is no sEmptyTable given, the... | Language compatibility - when certain options are given, and others aren't, we
need to duplicate the values over, in order to provide backwards compatibility
with older language files.
@param {object} oSettings dataTables settings object
@memberof DataTable#oApi | [
"Language",
"compatibility",
"-",
"when",
"certain",
"options",
"are",
"given",
"and",
"others",
"aren",
"t",
"we",
"need",
"to",
"duplicate",
"the",
"values",
"over",
"in",
"order",
"to",
"provide",
"backwards",
"compatibility",
"with",
"older",
"language",
"... | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L342-L362 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | function ( o, knew, old ) {
if ( o[ knew ] !== undefined ) {
o[ old ] = o[ knew ];
}
} | javascript | function ( o, knew, old ) {
if ( o[ knew ] !== undefined ) {
o[ old ] = o[ knew ];
}
} | [
"function",
"(",
"o",
",",
"knew",
",",
"old",
")",
"{",
"if",
"(",
"o",
"[",
"knew",
"]",
"!==",
"undefined",
")",
"{",
"o",
"[",
"old",
"]",
"=",
"o",
"[",
"knew",
"]",
";",
"}",
"}"
] | Map one parameter onto another
@param {object} o Object to map
@param {*} knew The new parameter name
@param {*} old The old parameter name | [
"Map",
"one",
"parameter",
"onto",
"another"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L371-L375 | train | |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnCompatOpts | function _fnCompatOpts ( init )
{
_fnCompatMap( init, 'ordering', 'bSort' );
_fnCompatMap( init, 'orderMulti', 'bSortMulti' );
_fnCompatMap( init, 'orderClasses', 'bSortClasses' );
_fnCompatMap( init, 'orderCellsTop', 'bSortCellsTop' );
_fnCompatMap( init, 'order', 'aaSorting' );
_f... | javascript | function _fnCompatOpts ( init )
{
_fnCompatMap( init, 'ordering', 'bSort' );
_fnCompatMap( init, 'orderMulti', 'bSortMulti' );
_fnCompatMap( init, 'orderClasses', 'bSortClasses' );
_fnCompatMap( init, 'orderCellsTop', 'bSortCellsTop' );
_fnCompatMap( init, 'order', 'aaSorting' );
_f... | [
"function",
"_fnCompatOpts",
"(",
"init",
")",
"{",
"_fnCompatMap",
"(",
"init",
",",
"'ordering'",
",",
"'bSort'",
")",
";",
"_fnCompatMap",
"(",
"init",
",",
"'orderMulti'",
",",
"'bSortMulti'",
")",
";",
"_fnCompatMap",
"(",
"init",
",",
"'orderClasses'",
... | Provide backwards compatibility for the main DT options. Note that the new
options are mapped onto the old parameters, so this is an external interface
change only.
@param {object} init Object to map | [
"Provide",
"backwards",
"compatibility",
"for",
"the",
"main",
"DT",
"options",
".",
"Note",
"that",
"the",
"new",
"options",
"are",
"mapped",
"onto",
"the",
"old",
"parameters",
"so",
"this",
"is",
"an",
"external",
"interface",
"change",
"only",
"."
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L384-L396 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnCompatCols | function _fnCompatCols ( init )
{
_fnCompatMap( init, 'orderable', 'bSortable' );
_fnCompatMap( init, 'orderData', 'aDataSort' );
_fnCompatMap( init, 'orderSequence', 'asSorting' );
_fnCompatMap( init, 'orderDataType', 'sortDataType' );
} | javascript | function _fnCompatCols ( init )
{
_fnCompatMap( init, 'orderable', 'bSortable' );
_fnCompatMap( init, 'orderData', 'aDataSort' );
_fnCompatMap( init, 'orderSequence', 'asSorting' );
_fnCompatMap( init, 'orderDataType', 'sortDataType' );
} | [
"function",
"_fnCompatCols",
"(",
"init",
")",
"{",
"_fnCompatMap",
"(",
"init",
",",
"'orderable'",
",",
"'bSortable'",
")",
";",
"_fnCompatMap",
"(",
"init",
",",
"'orderData'",
",",
"'aDataSort'",
")",
";",
"_fnCompatMap",
"(",
"init",
",",
"'orderSequence'... | Provide backwards compatibility for column options. Note that the new options
are mapped onto the old parameters, so this is an external interface change
only.
@param {object} init Object to map | [
"Provide",
"backwards",
"compatibility",
"for",
"column",
"options",
".",
"Note",
"that",
"the",
"new",
"options",
"are",
"mapped",
"onto",
"the",
"old",
"parameters",
"so",
"this",
"is",
"an",
"external",
"interface",
"change",
"only",
"."
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L405-L411 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnBrowserDetect | function _fnBrowserDetect( settings )
{
var browser = settings.oBrowser;
// Scrolling feature / quirks detection
var n = $('<div/>')
.css( {
position: 'absolute',
top: 0,
left: 0,
height: 1,
width: 1,
overflow: 'hidden'
} )
.append(
$('<div/>')
.css( {
... | javascript | function _fnBrowserDetect( settings )
{
var browser = settings.oBrowser;
// Scrolling feature / quirks detection
var n = $('<div/>')
.css( {
position: 'absolute',
top: 0,
left: 0,
height: 1,
width: 1,
overflow: 'hidden'
} )
.append(
$('<div/>')
.css( {
... | [
"function",
"_fnBrowserDetect",
"(",
"settings",
")",
"{",
"var",
"browser",
"=",
"settings",
".",
"oBrowser",
";",
"// Scrolling feature / quirks detection\r",
"var",
"n",
"=",
"$",
"(",
"'<div/>'",
")",
".",
"css",
"(",
"{",
"position",
":",
"'absolute'",
",... | Browser feature detection for capabilities, quirks
@param {object} settings dataTables settings object
@memberof DataTable#oApi | [
"Browser",
"feature",
"detection",
"for",
"capabilities",
"quirks"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L419-L464 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnGetColumns | function _fnGetColumns( oSettings, sParam )
{
var a = [];
$.map( oSettings.aoColumns, function(val, i) {
if ( val[sParam] ) {
a.push( i );
}
} );
return a;
} | javascript | function _fnGetColumns( oSettings, sParam )
{
var a = [];
$.map( oSettings.aoColumns, function(val, i) {
if ( val[sParam] ) {
a.push( i );
}
} );
return a;
} | [
"function",
"_fnGetColumns",
"(",
"oSettings",
",",
"sParam",
")",
"{",
"var",
"a",
"=",
"[",
"]",
";",
"$",
".",
"map",
"(",
"oSettings",
".",
"aoColumns",
",",
"function",
"(",
"val",
",",
"i",
")",
"{",
"if",
"(",
"val",
"[",
"sParam",
"]",
")... | Get an array of column indexes that match a given property
@param {object} oSettings dataTables settings object
@param {string} sParam Parameter in aoColumns to look for - typically
bVisible or bSearchable
@returns {array} Array of indexes with matched properties
@memberof DataTable#oApi | [
"Get",
"an",
"array",
"of",
"column",
"indexes",
"that",
"match",
"a",
"given",
"property"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L701-L712 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnApplyColumnDefs | function _fnApplyColumnDefs( oSettings, aoColDefs, aoCols, fn )
{
var i, iLen, j, jLen, k, kLen, def;
// Column definitions with aTargets
if ( aoColDefs )
{
/* Loop over the definitions array - loop in reverse so first instance has priority */
for ( i=aoColDefs.length-1 ; i>=0 ; i-- )
{
... | javascript | function _fnApplyColumnDefs( oSettings, aoColDefs, aoCols, fn )
{
var i, iLen, j, jLen, k, kLen, def;
// Column definitions with aTargets
if ( aoColDefs )
{
/* Loop over the definitions array - loop in reverse so first instance has priority */
for ( i=aoColDefs.length-1 ; i>=0 ; i-- )
{
... | [
"function",
"_fnApplyColumnDefs",
"(",
"oSettings",
",",
"aoColDefs",
",",
"aoCols",
",",
"fn",
")",
"{",
"var",
"i",
",",
"iLen",
",",
"j",
",",
"jLen",
",",
"k",
",",
"kLen",
",",
"def",
";",
"// Column definitions with aTargets\r",
"if",
"(",
"aoColDefs... | Take the column definitions and static columns arrays and calculate how
they relate to column indexes. The callback function will then apply the
definition found for a column to a suitable configuration object.
@param {object} oSettings dataTables settings object
@param {array} aoColDefs The aoColumnDefs array that is ... | [
"Take",
"the",
"column",
"definitions",
"and",
"static",
"columns",
"arrays",
"and",
"calculate",
"how",
"they",
"relate",
"to",
"column",
"indexes",
".",
"The",
"callback",
"function",
"will",
"then",
"apply",
"the",
"definition",
"found",
"for",
"a",
"column... | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L779-L843 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnGetCellData | function _fnGetCellData( oSettings, iRow, iCol, sSpecific )
{
var oCol = oSettings.aoColumns[iCol];
var oData = oSettings.aoData[iRow]._aData;
var sData = oCol.fnGetData( oData, sSpecific );
if ( sData === undefined )
{
if ( oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === nul... | javascript | function _fnGetCellData( oSettings, iRow, iCol, sSpecific )
{
var oCol = oSettings.aoColumns[iCol];
var oData = oSettings.aoData[iRow]._aData;
var sData = oCol.fnGetData( oData, sSpecific );
if ( sData === undefined )
{
if ( oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === nul... | [
"function",
"_fnGetCellData",
"(",
"oSettings",
",",
"iRow",
",",
"iCol",
",",
"sSpecific",
")",
"{",
"var",
"oCol",
"=",
"oSettings",
".",
"aoColumns",
"[",
"iCol",
"]",
";",
"var",
"oData",
"=",
"oSettings",
".",
"aoData",
"[",
"iRow",
"]",
".",
"_aD... | Get the data for a given cell from the internal cache, taking into account data mapping
@param {object} oSettings dataTables settings object
@param {int} iRow aoData row id
@param {int} iCol Column index
@param {string} sSpecific data get type ('display', 'type' 'filter' 'sort')
@returns {*} Cell data
@memberof DataTab... | [
"Get",
"the",
"data",
"for",
"a",
"given",
"cell",
"from",
"the",
"internal",
"cache",
"taking",
"into",
"account",
"data",
"mapping"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L978-L1012 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnInvalidateRow | function _fnInvalidateRow( settings, rowIdx, src, column )
{
var row = settings.aoData[ rowIdx ];
var i, ien;
// Are we reading last data from DOM or the data object?
if ( src === 'dom' || ((! src || src === 'auto') && row.src === 'dom') ) {
// Read the data from the DOM
row._aData = _fnGetRowE... | javascript | function _fnInvalidateRow( settings, rowIdx, src, column )
{
var row = settings.aoData[ rowIdx ];
var i, ien;
// Are we reading last data from DOM or the data object?
if ( src === 'dom' || ((! src || src === 'auto') && row.src === 'dom') ) {
// Read the data from the DOM
row._aData = _fnGetRowE... | [
"function",
"_fnInvalidateRow",
"(",
"settings",
",",
"rowIdx",
",",
"src",
",",
"column",
")",
"{",
"var",
"row",
"=",
"settings",
".",
"aoData",
"[",
"rowIdx",
"]",
";",
"var",
"i",
",",
"ien",
";",
"// Are we reading last data from DOM or the data object?\r",... | Mark cached data as invalid such that a re-read of the data will occur when
the cached data is next requested. Also update from the data source object.
@param {object} settings DataTables settings object
@param {int} rowIdx Row index to invalidate
@memberof DataTable#oApi
@todo For the modularisation of v1.11 t... | [
"Mark",
"cached",
"data",
"as",
"invalid",
"such",
"that",
"a",
"re",
"-",
"read",
"of",
"the",
"data",
"will",
"occur",
"when",
"the",
"cached",
"data",
"is",
"next",
"requested",
".",
"Also",
"update",
"from",
"the",
"data",
"source",
"object",
"."
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L1346-L1382 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnGetRowElements | function _fnGetRowElements( settings, row )
{
var
d = [],
tds = [],
td = row.firstChild,
name, col, o, i=0, contents,
columns = settings.aoColumns;
var attr = function ( str, data, td ) {
if ( typeof str === 'string' ) {
var idx = str.indexOf('@');
if ( idx !== -1 ) {
... | javascript | function _fnGetRowElements( settings, row )
{
var
d = [],
tds = [],
td = row.firstChild,
name, col, o, i=0, contents,
columns = settings.aoColumns;
var attr = function ( str, data, td ) {
if ( typeof str === 'string' ) {
var idx = str.indexOf('@');
if ( idx !== -1 ) {
... | [
"function",
"_fnGetRowElements",
"(",
"settings",
",",
"row",
")",
"{",
"var",
"d",
"=",
"[",
"]",
",",
"tds",
"=",
"[",
"]",
",",
"td",
"=",
"row",
".",
"firstChild",
",",
"name",
",",
"col",
",",
"o",
",",
"i",
"=",
"0",
",",
"contents",
",",... | Build a data source object from an HTML row, reading the contents of the
cells that are in the row.
@param {object} settings DataTables settings object
@param {node} TR element from which to read data
@returns {object} Object with two parameters: `data` the data read, in
document order, and `cells` and array of nodes ... | [
"Build",
"a",
"data",
"source",
"object",
"from",
"an",
"HTML",
"row",
"reading",
"the",
"contents",
"of",
"the",
"cells",
"that",
"are",
"in",
"the",
"row",
"."
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L1397-L1450 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnBuildAjax | function _fnBuildAjax( oSettings, data, fn )
{
// Compatibility with 1.9-, allow fnServerData and event to manipulate
_fnCallbackFire( oSettings, 'aoServerParams', 'serverParams', [data] );
// Convert to object based for 1.10+ if using the old scheme
if ( data && data.__legacy ) {
var tmp = {};
... | javascript | function _fnBuildAjax( oSettings, data, fn )
{
// Compatibility with 1.9-, allow fnServerData and event to manipulate
_fnCallbackFire( oSettings, 'aoServerParams', 'serverParams', [data] );
// Convert to object based for 1.10+ if using the old scheme
if ( data && data.__legacy ) {
var tmp = {};
... | [
"function",
"_fnBuildAjax",
"(",
"oSettings",
",",
"data",
",",
"fn",
")",
"{",
"// Compatibility with 1.9-, allow fnServerData and event to manipulate\r",
"_fnCallbackFire",
"(",
"oSettings",
",",
"'aoServerParams'",
",",
"'serverParams'",
",",
"[",
"data",
"]",
")",
"... | Create an Ajax call based on the table's settings, taking into account that
parameters can have multiple forms, and backwards compatibility.
@param {object} oSettings dataTables settings object
@param {array} data Data to send to the server, required by
DataTables - may be augmented by developer callbacks
@param {func... | [
"Create",
"an",
"Ajax",
"call",
"based",
"on",
"the",
"table",
"s",
"settings",
"taking",
"into",
"account",
"that",
"parameters",
"can",
"have",
"multiple",
"forms",
"and",
"backwards",
"compatibility",
"."
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L2199-L2304 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnAjaxDataSrc | function _fnAjaxDataSrc ( oSettings, json )
{
var dataSrc = $.isPlainObject( oSettings.ajax ) && oSettings.ajax.dataSrc !== undefined ?
oSettings.ajax.dataSrc :
oSettings.sAjaxDataProp; // Compatibility with 1.9-.
// Compatibility with 1.9-. In order to read from aaData, check if the
// default ha... | javascript | function _fnAjaxDataSrc ( oSettings, json )
{
var dataSrc = $.isPlainObject( oSettings.ajax ) && oSettings.ajax.dataSrc !== undefined ?
oSettings.ajax.dataSrc :
oSettings.sAjaxDataProp; // Compatibility with 1.9-.
// Compatibility with 1.9-. In order to read from aaData, check if the
// default ha... | [
"function",
"_fnAjaxDataSrc",
"(",
"oSettings",
",",
"json",
")",
"{",
"var",
"dataSrc",
"=",
"$",
".",
"isPlainObject",
"(",
"oSettings",
".",
"ajax",
")",
"&&",
"oSettings",
".",
"ajax",
".",
"dataSrc",
"!==",
"undefined",
"?",
"oSettings",
".",
"ajax",
... | Get the data from the JSON data source to use for drawing a table. Using
`_fnGetObjectDataFn` allows the data to be sourced from a property of the
source object, or from a processing function.
@param {object} oSettings dataTables settings object
@param {object} json Data source object / array from the server
@return {... | [
"Get",
"the",
"data",
"from",
"the",
"JSON",
"data",
"source",
"to",
"use",
"for",
"drawing",
"a",
"table",
".",
"Using",
"_fnGetObjectDataFn",
"allows",
"the",
"data",
"to",
"be",
"sourced",
"from",
"a",
"property",
"of",
"the",
"source",
"object",
"or",
... | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L2494-L2509 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | function(nSizer) {
var style = nSizer.style;
style.paddingTop = "0";
style.paddingBottom = "0";
style.borderTopWidth = "0";
style.borderBottomWidth = "0";
style.height = 0;
} | javascript | function(nSizer) {
var style = nSizer.style;
style.paddingTop = "0";
style.paddingBottom = "0";
style.borderTopWidth = "0";
style.borderBottomWidth = "0";
style.height = 0;
} | [
"function",
"(",
"nSizer",
")",
"{",
"var",
"style",
"=",
"nSizer",
".",
"style",
";",
"style",
".",
"paddingTop",
"=",
"\"0\"",
";",
"style",
".",
"paddingBottom",
"=",
"\"0\"",
";",
"style",
".",
"borderTopWidth",
"=",
"\"0\"",
";",
"style",
".",
"bo... | Given that this is such a monster function, a lot of variables are use to try and keep the minimised size as small as possible | [
"Given",
"that",
"this",
"is",
"such",
"a",
"monster",
"function",
"a",
"lot",
"of",
"variables",
"are",
"use",
"to",
"try",
"and",
"keep",
"the",
"minimised",
"size",
"as",
"small",
"as",
"possible"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L3473-L3480 | train | |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnScrollingWidthAdjust | function _fnScrollingWidthAdjust ( settings, n )
{
var scroll = settings.oScroll;
if ( scroll.sX || scroll.sY ) {
// When y-scrolling only, we want to remove the width of the scroll bar
// so the table + scroll bar will fit into the area available, otherwise
// we fix the table at its current siz... | javascript | function _fnScrollingWidthAdjust ( settings, n )
{
var scroll = settings.oScroll;
if ( scroll.sX || scroll.sY ) {
// When y-scrolling only, we want to remove the width of the scroll bar
// so the table + scroll bar will fit into the area available, otherwise
// we fix the table at its current siz... | [
"function",
"_fnScrollingWidthAdjust",
"(",
"settings",
",",
"n",
")",
"{",
"var",
"scroll",
"=",
"settings",
".",
"oScroll",
";",
"if",
"(",
"scroll",
".",
"sX",
"||",
"scroll",
".",
"sY",
")",
"{",
"// When y-scrolling only, we want to remove the width of the sc... | Adjust a table's width to take account of vertical scroll bar
@param {object} oSettings dataTables settings object
@param {node} n table node
@memberof DataTable#oApi | [
"Adjust",
"a",
"table",
"s",
"width",
"to",
"take",
"account",
"of",
"vertical",
"scroll",
"bar"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L3986-L3997 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnScrollBarWidth | function _fnScrollBarWidth ()
{
// On first run a static variable is set, since this is only needed once.
// Subsequent runs will just use the previously calculated value
if ( ! DataTable.__scrollbarWidth ) {
var inner = $('<p/>').css( {
width: '100%',
height: 200,
padding: 0
} )[0];
... | javascript | function _fnScrollBarWidth ()
{
// On first run a static variable is set, since this is only needed once.
// Subsequent runs will just use the previously calculated value
if ( ! DataTable.__scrollbarWidth ) {
var inner = $('<p/>').css( {
width: '100%',
height: 200,
padding: 0
} )[0];
... | [
"function",
"_fnScrollBarWidth",
"(",
")",
"{",
"// On first run a static variable is set, since this is only needed once.\r",
"// Subsequent runs will just use the previously calculated value\r",
"if",
"(",
"!",
"DataTable",
".",
"__scrollbarWidth",
")",
"{",
"var",
"inner",
"=",
... | Get the width of a scroll bar in this browser being used
@returns {int} width in pixels
@memberof DataTable#oApi | [
"Get",
"the",
"width",
"of",
"a",
"scroll",
"bar",
"in",
"this",
"browser",
"being",
"used"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L4076-L4115 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnSortListener | function _fnSortListener ( settings, colIdx, append, callback )
{
var col = settings.aoColumns[ colIdx ];
var sorting = settings.aaSorting;
var asSorting = col.asSorting;
var nextSortIdx;
var next = function ( a ) {
var idx = a._idx;
if ( idx === undefined ) {
idx = $.inArray( a[1], asSort... | javascript | function _fnSortListener ( settings, colIdx, append, callback )
{
var col = settings.aoColumns[ colIdx ];
var sorting = settings.aaSorting;
var asSorting = col.asSorting;
var nextSortIdx;
var next = function ( a ) {
var idx = a._idx;
if ( idx === undefined ) {
idx = $.inArray( a[1], asSort... | [
"function",
"_fnSortListener",
"(",
"settings",
",",
"colIdx",
",",
"append",
",",
"callback",
")",
"{",
"var",
"col",
"=",
"settings",
".",
"aoColumns",
"[",
"colIdx",
"]",
";",
"var",
"sorting",
"=",
"settings",
".",
"aaSorting",
";",
"var",
"asSorting",... | Function to run on user sort request
@param {object} settings dataTables settings object
@param {node} attachTo node to attach the handler to
@param {int} colIdx column sorting index
@param {boolean} [append=false] Append the requested sort to the existing
sort if true (i.e. multi-column sort)
@param {function} [callba... | [
"Function",
"to",
"run",
"on",
"user",
"sort",
"request"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L4362-L4417 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | _fnLoadState | function _fnLoadState ( oSettings, oInit )
{
var i, ien;
var columns = oSettings.aoColumns;
if ( !oSettings.oFeatures.bStateSave )
{
return;
}
var oData = oSettings.fnStateLoadCallback.call( oSettings.oInstance, oSettings );
if ( !oData )
{
return;
}
/* Allow custom and ... | javascript | function _fnLoadState ( oSettings, oInit )
{
var i, ien;
var columns = oSettings.aoColumns;
if ( !oSettings.oFeatures.bStateSave )
{
return;
}
var oData = oSettings.fnStateLoadCallback.call( oSettings.oInstance, oSettings );
if ( !oData )
{
return;
}
/* Allow custom and ... | [
"function",
"_fnLoadState",
"(",
"oSettings",
",",
"oInit",
")",
"{",
"var",
"i",
",",
"ien",
";",
"var",
"columns",
"=",
"oSettings",
".",
"aoColumns",
";",
"if",
"(",
"!",
"oSettings",
".",
"oFeatures",
".",
"bStateSave",
")",
"{",
"return",
";",
"}"... | Attempt to load a saved table state
@param {object} oSettings dataTables settings object
@param {object} oInit DataTables init object so we can override settings
@memberof DataTable#oApi | [
"Attempt",
"to",
"load",
"a",
"saved",
"table",
"state"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L4572-L4634 | train |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | function ( mixed )
{
var idx, jq;
var settings = DataTable.settings;
var tables = $.map( settings, function (el, i) {
return el.nTable;
} );
if ( mixed.nTable && mixed.oApi ) {
// DataTables settings object
return [ mixed ];
}
else if ( mixed.nodeName && mixed.nodeName.toLowerCase(... | javascript | function ( mixed )
{
var idx, jq;
var settings = DataTable.settings;
var tables = $.map( settings, function (el, i) {
return el.nTable;
} );
if ( mixed.nTable && mixed.oApi ) {
// DataTables settings object
return [ mixed ];
}
else if ( mixed.nodeName && mixed.nodeName.toLowerCase(... | [
"function",
"(",
"mixed",
")",
"{",
"var",
"idx",
",",
"jq",
";",
"var",
"settings",
"=",
"DataTable",
".",
"settings",
";",
"var",
"tables",
"=",
"$",
".",
"map",
"(",
"settings",
",",
"function",
"(",
"el",
",",
"i",
")",
"{",
"return",
"el",
"... | Abstraction for `context` parameter of the `Api` constructor to allow it to
take several different forms for ease of use.
Each of the input parameter types will be converted to a DataTables settings
object where possible.
@param {string|node|jQuery|object} mixed DataTable identifier. Can be one
of:
* `string` - jQu... | [
"Abstraction",
"for",
"context",
"parameter",
"of",
"the",
"Api",
"constructor",
"to",
"allow",
"it",
"to",
"take",
"several",
"different",
"forms",
"for",
"ease",
"of",
"use",
"."
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L6339-L6371 | train | |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | function ( fn )
{
if ( __arrayProto.forEach ) {
// Where possible, use the built-in forEach
__arrayProto.forEach.call( this, fn, this );
}
else {
// Compatibility for browsers without EMCA-252-5 (JS 1.6)
for ( var i=0, ien=this.length ; i<ien; i++ ) {
// In strict mode the execu... | javascript | function ( fn )
{
if ( __arrayProto.forEach ) {
// Where possible, use the built-in forEach
__arrayProto.forEach.call( this, fn, this );
}
else {
// Compatibility for browsers without EMCA-252-5 (JS 1.6)
for ( var i=0, ien=this.length ; i<ien; i++ ) {
// In strict mode the execu... | [
"function",
"(",
"fn",
")",
"{",
"if",
"(",
"__arrayProto",
".",
"forEach",
")",
"{",
"// Where possible, use the built-in forEach\r",
"__arrayProto",
".",
"forEach",
".",
"call",
"(",
"this",
",",
"fn",
",",
"this",
")",
";",
"}",
"else",
"{",
"// Compatibi... | array of table settings objects | [
"array",
"of",
"table",
"settings",
"objects"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L6491-L6506 | train | |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | function ( flatten, type, fn ) {
var
a = [], ret,
i, ien, j, jen,
context = this.context,
rows, items, item,
selector = this.selector;
// Argument shifting
if ( typeof flatten === 'string' ) {
fn = type;
type = flatten;
flatten = false;
}
for ( i=0, ien=... | javascript | function ( flatten, type, fn ) {
var
a = [], ret,
i, ien, j, jen,
context = this.context,
rows, items, item,
selector = this.selector;
// Argument shifting
if ( typeof flatten === 'string' ) {
fn = type;
type = flatten;
flatten = false;
}
for ( i=0, ien=... | [
"function",
"(",
"flatten",
",",
"type",
",",
"fn",
")",
"{",
"var",
"a",
"=",
"[",
"]",
",",
"ret",
",",
"i",
",",
"ien",
",",
"j",
",",
"jen",
",",
"context",
"=",
"this",
".",
"context",
",",
"rows",
",",
"items",
",",
"item",
",",
"select... | Internal only at the moment - relax? | [
"Internal",
"only",
"at",
"the",
"moment",
"-",
"relax?"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L6550-L6616 | train | |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | function ( selector, a )
{
// Integer is used to pick out a table by index
if ( typeof selector === 'number' ) {
return [ a[ selector ] ];
}
// Perform a jQuery selector on the table nodes
var nodes = $.map( a, function (el, i) {
return el.nTable;
} );
return $(nodes)
.filter( s... | javascript | function ( selector, a )
{
// Integer is used to pick out a table by index
if ( typeof selector === 'number' ) {
return [ a[ selector ] ];
}
// Perform a jQuery selector on the table nodes
var nodes = $.map( a, function (el, i) {
return el.nTable;
} );
return $(nodes)
.filter( s... | [
"function",
"(",
"selector",
",",
"a",
")",
"{",
"// Integer is used to pick out a table by index\r",
"if",
"(",
"typeof",
"selector",
"===",
"'number'",
")",
"{",
"return",
"[",
"a",
"[",
"selector",
"]",
"]",
";",
"}",
"// Perform a jQuery selector on the table no... | Selector for HTML tables. Apply the given selector to the give array of
DataTables settings objects.
@param {string|integer} [selector] jQuery selector string or integer
@param {array} Array of DataTables settings objects to be filtered
@return {array}
@ignore | [
"Selector",
"for",
"HTML",
"tables",
".",
"Apply",
"the",
"given",
"selector",
"to",
"the",
"give",
"array",
"of",
"DataTables",
"settings",
"objects",
"."
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L6923-L6943 | train | |
altairstudios/nodeserver | admin/public/js/plugins/dataTables/jquery.dataTables.js | function ()
{
var
len = this._iDisplayLength,
start = this._iDisplayStart,
calc = start + len,
records = this.aiDisplay.length,
features = this.oFeatures,
paginate = features.bPaginate;
if ( features.bServerSide ) {
return paginate === false || len === -1 ?
... | javascript | function ()
{
var
len = this._iDisplayLength,
start = this._iDisplayStart,
calc = start + len,
records = this.aiDisplay.length,
features = this.oFeatures,
paginate = features.bPaginate;
if ( features.bServerSide ) {
return paginate === false || len === -1 ?
... | [
"function",
"(",
")",
"{",
"var",
"len",
"=",
"this",
".",
"_iDisplayLength",
",",
"start",
"=",
"this",
".",
"_iDisplayStart",
",",
"calc",
"=",
"start",
"+",
"len",
",",
"records",
"=",
"this",
".",
"aiDisplay",
".",
"length",
",",
"features",
"=",
... | Get the display end point - aiDisplay index
@type function | [
"Get",
"the",
"display",
"end",
"point",
"-",
"aiDisplay",
"index"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/admin/public/js/plugins/dataTables/jquery.dataTables.js#L12783-L12803 | train | |
layerhq/node-layer-api | lib/resources/identities.js | function(userId, callback) {
if (!userId) return callback(new Error(utils.i18n.identities.id));
utils.debug('Identities get: ' + userId);
request.get({
path: '/users/' + userId + '/identity'
}, callback);
} | javascript | function(userId, callback) {
if (!userId) return callback(new Error(utils.i18n.identities.id));
utils.debug('Identities get: ' + userId);
request.get({
path: '/users/' + userId + '/identity'
}, callback);
} | [
"function",
"(",
"userId",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"userId",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"utils",
".",
"i18n",
".",
"identities",
".",
"id",
")",
")",
";",
"utils",
".",
"debug",
"(",
"'Identities get: '",
... | Retrieve an Identity
@param {String} userId User ID
@param {Function} callback Callback function | [
"Retrieve",
"an",
"Identity"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/identities.js#L38-L45 | train | |
layerhq/node-layer-api | lib/resources/identities.js | function(userId, properties, callback) {
if (!userId) return callback(new Error(utils.i18n.identities.id));
utils.debug('Identity edit: ' + userId);
request.patch({
path: '/users/' + userId + '/identity',
body: Object.keys(properties).map(function(propertyName) {
return {
... | javascript | function(userId, properties, callback) {
if (!userId) return callback(new Error(utils.i18n.identities.id));
utils.debug('Identity edit: ' + userId);
request.patch({
path: '/users/' + userId + '/identity',
body: Object.keys(properties).map(function(propertyName) {
return {
... | [
"function",
"(",
"userId",
",",
"properties",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"userId",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"utils",
".",
"i18n",
".",
"identities",
".",
"id",
")",
")",
";",
"utils",
".",
"debug",
"(",
"... | Edit Identity properties.
@param {String} userId User ID
@param {Object} properties Hash of properties to update
@param {Function} callback Callback function | [
"Edit",
"Identity",
"properties",
"."
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/identities.js#L54-L68 | train | |
altairstudios/nodeserver | core/workers/node.js | function(website) {
var self = this;
var scriptPath = path.dirname(website.script);
var script = '';
var port = website.port;
if(website.absoluteScript === false) {
scriptPath = process.cwd() + '/' + path.dirname(website.script);
}
script = path.basename(website.script);
var env = JSON.parse(JSO... | javascript | function(website) {
var self = this;
var scriptPath = path.dirname(website.script);
var script = '';
var port = website.port;
if(website.absoluteScript === false) {
scriptPath = process.cwd() + '/' + path.dirname(website.script);
}
script = path.basename(website.script);
var env = JSON.parse(JSO... | [
"function",
"(",
"website",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"scriptPath",
"=",
"path",
".",
"dirname",
"(",
"website",
".",
"script",
")",
";",
"var",
"script",
"=",
"''",
";",
"var",
"port",
"=",
"website",
".",
"port",
";",
"if"... | Start the nodejs process. Spawn the proccess and listen on a port
@param {Website} website Website to start | [
"Start",
"the",
"nodejs",
"process",
".",
"Spawn",
"the",
"proccess",
"and",
"listen",
"on",
"a",
"port"
] | 559ae91b025573ec772c51b838ee691d34abbbbb | https://github.com/altairstudios/nodeserver/blob/559ae91b025573ec772c51b838ee691d34abbbbb/core/workers/node.js#L16-L77 | train | |
elidoran/comma-number | lib/index.js | commaNumber | function commaNumber(inputNumber, optionalSeparator, optionalDecimalChar) {
// we'll strip off and hold the decimal value to reattach later.
// we'll hold both the `number` value and `stringNumber` value.
let number, stringNumber, decimal
// default `separator` is a comma
const separator = optionalSeparator... | javascript | function commaNumber(inputNumber, optionalSeparator, optionalDecimalChar) {
// we'll strip off and hold the decimal value to reattach later.
// we'll hold both the `number` value and `stringNumber` value.
let number, stringNumber, decimal
// default `separator` is a comma
const separator = optionalSeparator... | [
"function",
"commaNumber",
"(",
"inputNumber",
",",
"optionalSeparator",
",",
"optionalDecimalChar",
")",
"{",
"// we'll strip off and hold the decimal value to reattach later.",
"// we'll hold both the `number` value and `stringNumber` value.",
"let",
"number",
",",
"stringNumber",
... | return a string with the provided number formatted with commas. can specify either a Number or a String. | [
"return",
"a",
"string",
"with",
"the",
"provided",
"number",
"formatted",
"with",
"commas",
".",
"can",
"specify",
"either",
"a",
"Number",
"or",
"a",
"String",
"."
] | 4aaca601ec6a69b56b61d1fb104c191b1848aadc | https://github.com/elidoran/comma-number/blob/4aaca601ec6a69b56b61d1fb104c191b1848aadc/lib/index.js#L5-L74 | train |
psychobunny/nodebb-plugin-gallery | public/vendor/fancybox/jquery.fancybox.js | function () {
var coming = F.coming;
if (!coming || false === F.trigger('onCancel')) {
return;
}
F.hideLoading();
if (F.ajaxLoad) {
F.ajaxLoad.abort();
}
F.ajaxLoad = null;
if (F.imgPreload) {
F.imgPreload.onload = F.imgPreload.onerror = null;
}
if (coming.wrap) {
com... | javascript | function () {
var coming = F.coming;
if (!coming || false === F.trigger('onCancel')) {
return;
}
F.hideLoading();
if (F.ajaxLoad) {
F.ajaxLoad.abort();
}
F.ajaxLoad = null;
if (F.imgPreload) {
F.imgPreload.onload = F.imgPreload.onerror = null;
}
if (coming.wrap) {
com... | [
"function",
"(",
")",
"{",
"var",
"coming",
"=",
"F",
".",
"coming",
";",
"if",
"(",
"!",
"coming",
"||",
"false",
"===",
"F",
".",
"trigger",
"(",
"'onCancel'",
")",
")",
"{",
"return",
";",
"}",
"F",
".",
"hideLoading",
"(",
")",
";",
"if",
"... | Cancel image loading or abort ajax request | [
"Cancel",
"image",
"loading",
"or",
"abort",
"ajax",
"request"
] | 2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631 | https://github.com/psychobunny/nodebb-plugin-gallery/blob/2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631/public/vendor/fancybox/jquery.fancybox.js#L363-L392 | train | |
psychobunny/nodebb-plugin-gallery | public/vendor/fancybox/jquery.fancybox.js | function ( direction ) {
var current = F.current;
if (current) {
if (!isString(direction)) {
direction = current.direction.next;
}
F.jumpto(current.index + 1, direction, 'next');
}
} | javascript | function ( direction ) {
var current = F.current;
if (current) {
if (!isString(direction)) {
direction = current.direction.next;
}
F.jumpto(current.index + 1, direction, 'next');
}
} | [
"function",
"(",
"direction",
")",
"{",
"var",
"current",
"=",
"F",
".",
"current",
";",
"if",
"(",
"current",
")",
"{",
"if",
"(",
"!",
"isString",
"(",
"direction",
")",
")",
"{",
"direction",
"=",
"current",
".",
"direction",
".",
"next",
";",
"... | Navigate to next gallery item | [
"Navigate",
"to",
"next",
"gallery",
"item"
] | 2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631 | https://github.com/psychobunny/nodebb-plugin-gallery/blob/2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631/public/vendor/fancybox/jquery.fancybox.js#L473-L483 | train | |
psychobunny/nodebb-plugin-gallery | public/vendor/fancybox/jquery.fancybox.js | function ( direction ) {
var current = F.current;
if (current) {
if (!isString(direction)) {
direction = current.direction.prev;
}
F.jumpto(current.index - 1, direction, 'prev');
}
} | javascript | function ( direction ) {
var current = F.current;
if (current) {
if (!isString(direction)) {
direction = current.direction.prev;
}
F.jumpto(current.index - 1, direction, 'prev');
}
} | [
"function",
"(",
"direction",
")",
"{",
"var",
"current",
"=",
"F",
".",
"current",
";",
"if",
"(",
"current",
")",
"{",
"if",
"(",
"!",
"isString",
"(",
"direction",
")",
")",
"{",
"direction",
"=",
"current",
".",
"direction",
".",
"prev",
";",
"... | Navigate to previous gallery item | [
"Navigate",
"to",
"previous",
"gallery",
"item"
] | 2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631 | https://github.com/psychobunny/nodebb-plugin-gallery/blob/2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631/public/vendor/fancybox/jquery.fancybox.js#L486-L496 | train | |
psychobunny/nodebb-plugin-gallery | public/vendor/fancybox/jquery.fancybox.js | function ( index, direction, router ) {
var current = F.current;
if (!current) {
return;
}
index = getScalar(index);
F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
F.router = router || 'jumpto';
if (current.loop) {
if (index < 0) {
in... | javascript | function ( index, direction, router ) {
var current = F.current;
if (!current) {
return;
}
index = getScalar(index);
F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
F.router = router || 'jumpto';
if (current.loop) {
if (index < 0) {
in... | [
"function",
"(",
"index",
",",
"direction",
",",
"router",
")",
"{",
"var",
"current",
"=",
"F",
".",
"current",
";",
"if",
"(",
"!",
"current",
")",
"{",
"return",
";",
"}",
"index",
"=",
"getScalar",
"(",
"index",
")",
";",
"F",
".",
"direction",... | Navigate to gallery item by index | [
"Navigate",
"to",
"gallery",
"item",
"by",
"index"
] | 2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631 | https://github.com/psychobunny/nodebb-plugin-gallery/blob/2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631/public/vendor/fancybox/jquery.fancybox.js#L499-L524 | train | |
psychobunny/nodebb-plugin-gallery | public/vendor/fancybox/jquery.fancybox.js | function (e, onlyAbsolute) {
var current = F.current,
wrap = current ? current.wrap : null,
pos;
if (wrap) {
pos = F._getPosition(onlyAbsolute);
if (e && e.type === 'scroll') {
delete pos.position;
wrap.stop(true, true).animate(pos, 200);
} else {
wrap.css(pos);
cur... | javascript | function (e, onlyAbsolute) {
var current = F.current,
wrap = current ? current.wrap : null,
pos;
if (wrap) {
pos = F._getPosition(onlyAbsolute);
if (e && e.type === 'scroll') {
delete pos.position;
wrap.stop(true, true).animate(pos, 200);
} else {
wrap.css(pos);
cur... | [
"function",
"(",
"e",
",",
"onlyAbsolute",
")",
"{",
"var",
"current",
"=",
"F",
".",
"current",
",",
"wrap",
"=",
"current",
"?",
"current",
".",
"wrap",
":",
"null",
",",
"pos",
";",
"if",
"(",
"wrap",
")",
"{",
"pos",
"=",
"F",
".",
"_getPosit... | Center inside viewport and toggle position type to fixed or absolute if needed | [
"Center",
"inside",
"viewport",
"and",
"toggle",
"position",
"type",
"to",
"fixed",
"or",
"absolute",
"if",
"needed"
] | 2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631 | https://github.com/psychobunny/nodebb-plugin-gallery/blob/2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631/public/vendor/fancybox/jquery.fancybox.js#L527-L546 | train | |
psychobunny/nodebb-plugin-gallery | public/vendor/fancybox/jquery.fancybox.js | function ( action ) {
if (F.isOpen) {
F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
// Help browser to restore document dimensions
if (isTouch) {
F.wrap.removeAttr('style').addClass('fancybox-tmp');
F.trigger('onUpdate');
}
F.update();
}
} | javascript | function ( action ) {
if (F.isOpen) {
F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
// Help browser to restore document dimensions
if (isTouch) {
F.wrap.removeAttr('style').addClass('fancybox-tmp');
F.trigger('onUpdate');
}
F.update();
}
} | [
"function",
"(",
"action",
")",
"{",
"if",
"(",
"F",
".",
"isOpen",
")",
"{",
"F",
".",
"current",
".",
"fitToView",
"=",
"$",
".",
"type",
"(",
"action",
")",
"===",
"\"boolean\"",
"?",
"action",
":",
"!",
"F",
".",
"current",
".",
"fitToView",
... | Shrink content to fit inside viewport or restore if resized | [
"Shrink",
"content",
"to",
"fit",
"inside",
"viewport",
"or",
"restore",
"if",
"resized"
] | 2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631 | https://github.com/psychobunny/nodebb-plugin-gallery/blob/2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631/public/vendor/fancybox/jquery.fancybox.js#L587-L600 | train | |
psychobunny/nodebb-plugin-gallery | public/vendor/fancybox/jquery.fancybox.js | function(opts) {
opts = $.extend({}, this.defaults, opts);
if (this.overlay) {
this.close();
}
this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( F.coming ? F.coming.parent : opts.parent );
this.fixed = false;
if (opts.fixed && F.defaults.fixed) {
this.overlay.addClass('fa... | javascript | function(opts) {
opts = $.extend({}, this.defaults, opts);
if (this.overlay) {
this.close();
}
this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( F.coming ? F.coming.parent : opts.parent );
this.fixed = false;
if (opts.fixed && F.defaults.fixed) {
this.overlay.addClass('fa... | [
"function",
"(",
"opts",
")",
"{",
"opts",
"=",
"$",
".",
"extend",
"(",
"{",
"}",
",",
"this",
".",
"defaults",
",",
"opts",
")",
";",
"if",
"(",
"this",
".",
"overlay",
")",
"{",
"this",
".",
"close",
"(",
")",
";",
"}",
"this",
".",
"overl... | element that contains "the lock" Public methods | [
"element",
"that",
"contains",
"the",
"lock",
"Public",
"methods"
] | 2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631 | https://github.com/psychobunny/nodebb-plugin-gallery/blob/2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631/public/vendor/fancybox/jquery.fancybox.js#L1705-L1720 | train | |
psychobunny/nodebb-plugin-gallery | public/vendor/fancybox/jquery.fancybox.js | function (opts, obj) {
var overlay = this.overlay;
$('.fancybox-overlay').stop(true, true);
if (!overlay) {
this.create(opts);
}
if (opts.locked && this.fixed && obj.fixed) {
if (!overlay) {
this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false;
... | javascript | function (opts, obj) {
var overlay = this.overlay;
$('.fancybox-overlay').stop(true, true);
if (!overlay) {
this.create(opts);
}
if (opts.locked && this.fixed && obj.fixed) {
if (!overlay) {
this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false;
... | [
"function",
"(",
"opts",
",",
"obj",
")",
"{",
"var",
"overlay",
"=",
"this",
".",
"overlay",
";",
"$",
"(",
"'.fancybox-overlay'",
")",
".",
"stop",
"(",
"true",
",",
"true",
")",
";",
"if",
"(",
"!",
"overlay",
")",
"{",
"this",
".",
"create",
... | This is where we can manipulate DOM, because later it would cause iframes to reload | [
"This",
"is",
"where",
"we",
"can",
"manipulate",
"DOM",
"because",
"later",
"it",
"would",
"cause",
"iframes",
"to",
"reload"
] | 2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631 | https://github.com/psychobunny/nodebb-plugin-gallery/blob/2e90f0f7a2bbfe75585bfee2cfa2df52e9a42631/public/vendor/fancybox/jquery.fancybox.js#L1805-L1826 | train | |
layerhq/node-layer-api | lib/resources/conversations.js | function(conversationId, callback) {
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
utils.debug('Conversation get: ' + conversationId);
request.get({
path: '/conversations/' + conversationId
}, callback)... | javascript | function(conversationId, callback) {
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
utils.debug('Conversation get: ' + conversationId);
request.get({
path: '/conversations/' + conversationId
}, callback)... | [
"function",
"(",
"conversationId",
",",
"callback",
")",
"{",
"conversationId",
"=",
"utils",
".",
"toUUID",
"(",
"conversationId",
")",
";",
"if",
"(",
"!",
"conversationId",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"utils",
".",
"i18n",
".",
... | Retrieve a conversation
@param {String} conversationId Conversation ID
@param {Function} callback Callback function | [
"Retrieve",
"a",
"conversation"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/conversations.js#L37-L45 | train | |
layerhq/node-layer-api | lib/resources/conversations.js | function(userId, conversationId, callback) {
if (!userId) return callback(new Error(utils.i18n.conversations.userId));
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
utils.debug('Conversation getFromUser: ' + userId + ... | javascript | function(userId, conversationId, callback) {
if (!userId) return callback(new Error(utils.i18n.conversations.userId));
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
utils.debug('Conversation getFromUser: ' + userId + ... | [
"function",
"(",
"userId",
",",
"conversationId",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"userId",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"utils",
".",
"i18n",
".",
"conversations",
".",
"userId",
")",
")",
";",
"conversationId",
"=",
... | Retrieve a conversation from user
@param {String} userId User ID
@param {String} conversationId Conversation ID
@param {Function} callback Callback function | [
"Retrieve",
"a",
"conversation",
"from",
"user"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/conversations.js#L54-L63 | train | |
layerhq/node-layer-api | lib/resources/conversations.js | function(userId, params, callback) {
if (!userId) return callback(new Error(utils.i18n.conversations.userId));
utils.debug('Conversation getAllFromUser: ' + userId);
var queryParams = '';
if (typeof params === 'function') callback = params;
else queryParams = '?' + querystring.stringify(p... | javascript | function(userId, params, callback) {
if (!userId) return callback(new Error(utils.i18n.conversations.userId));
utils.debug('Conversation getAllFromUser: ' + userId);
var queryParams = '';
if (typeof params === 'function') callback = params;
else queryParams = '?' + querystring.stringify(p... | [
"function",
"(",
"userId",
",",
"params",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"userId",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"utils",
".",
"i18n",
".",
"conversations",
".",
"userId",
")",
")",
";",
"utils",
".",
"debug",
"(",
... | Retrieve all conversations from user
@param {String} userId User ID
@param {String} [params] Query parameters
@param {Function} callback Callback function | [
"Retrieve",
"all",
"conversations",
"from",
"user"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/conversations.js#L72-L83 | train | |
layerhq/node-layer-api | lib/resources/conversations.js | function(conversationId, operations, callback) {
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
if (!utils.isArray(operations)) return callback(new Error(utils.i18n.conversations.operations));
utils.debug('Conversation... | javascript | function(conversationId, operations, callback) {
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
if (!utils.isArray(operations)) return callback(new Error(utils.i18n.conversations.operations));
utils.debug('Conversation... | [
"function",
"(",
"conversationId",
",",
"operations",
",",
"callback",
")",
"{",
"conversationId",
"=",
"utils",
".",
"toUUID",
"(",
"conversationId",
")",
";",
"if",
"(",
"!",
"conversationId",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"utils",
... | Edit a conversation
@param {String} conversationId Conversation UUID
@param {Array} operations Array of operations
@param {Function} callback Callback function | [
"Edit",
"a",
"conversation"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/conversations.js#L92-L99 | train | |
layerhq/node-layer-api | lib/resources/conversations.js | function(conversationId, properties, callback) {
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
utils.debug('Conversation setMetadataProperties: ' + conversationId);
var operations = [];
Object.keys(properties).... | javascript | function(conversationId, properties, callback) {
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
utils.debug('Conversation setMetadataProperties: ' + conversationId);
var operations = [];
Object.keys(properties).... | [
"function",
"(",
"conversationId",
",",
"properties",
",",
"callback",
")",
"{",
"conversationId",
"=",
"utils",
".",
"toUUID",
"(",
"conversationId",
")",
";",
"if",
"(",
"!",
"conversationId",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"utils",
... | Set metadata on a conversation
@param {String} conversationId Conversation UUID
@param {Object} properties Properties object
@param {Function} callback Callback function | [
"Set",
"metadata",
"on",
"a",
"conversation"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/conversations.js#L108-L126 | train | |
layerhq/node-layer-api | lib/resources/conversations.js | function(conversationId, properties, callback) {
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
utils.debug('Conversation deleteMetadataProperties: ' + conversationId);
var operations = [];
Object.keys(propertie... | javascript | function(conversationId, properties, callback) {
conversationId = utils.toUUID(conversationId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
utils.debug('Conversation deleteMetadataProperties: ' + conversationId);
var operations = [];
Object.keys(propertie... | [
"function",
"(",
"conversationId",
",",
"properties",
",",
"callback",
")",
"{",
"conversationId",
"=",
"utils",
".",
"toUUID",
"(",
"conversationId",
")",
";",
"if",
"(",
"!",
"conversationId",
")",
"return",
"callback",
"(",
"new",
"Error",
"(",
"utils",
... | Delete metadata on a conversation
@param {String} conversationId Conversation UUID
@param {Object} properties Properties object
@param {Function} callback Callback function | [
"Delete",
"metadata",
"on",
"a",
"conversation"
] | 284c161350e2cf3d3f5b45f2918798d981f1ada4 | https://github.com/layerhq/node-layer-api/blob/284c161350e2cf3d3f5b45f2918798d981f1ada4/lib/resources/conversations.js#L135-L152 | train | |
60frames/jestpack | Plugin.js | resolveArgument | function resolveArgument(expr, argIndex) {
if (typeof argIndex === 'undefined') {
argIndex = 0;
}
if (!expr.arguments.length || !expr.arguments[argIndex]) {
return;
}
this.applyPluginsBailResult('call require:commonjs:item', expr,
this.evaluateExpression(expr.arguments[ar... | javascript | function resolveArgument(expr, argIndex) {
if (typeof argIndex === 'undefined') {
argIndex = 0;
}
if (!expr.arguments.length || !expr.arguments[argIndex]) {
return;
}
this.applyPluginsBailResult('call require:commonjs:item', expr,
this.evaluateExpression(expr.arguments[ar... | [
"function",
"resolveArgument",
"(",
"expr",
",",
"argIndex",
")",
"{",
"if",
"(",
"typeof",
"argIndex",
"===",
"'undefined'",
")",
"{",
"argIndex",
"=",
"0",
";",
"}",
"if",
"(",
"!",
"expr",
".",
"arguments",
".",
"length",
"||",
"!",
"expr",
".",
"... | Resolves module paths.
@param {Object} expr The expression.
@param {Number} argIndex Which argument to resolve, defaults to the first arg. | [
"Resolves",
"module",
"paths",
"."
] | 2e3c26d856ebe4c1b3b786a26178e3ba81108616 | https://github.com/60frames/jestpack/blob/2e3c26d856ebe4c1b3b786a26178e3ba81108616/Plugin.js#L10-L19 | train |
60frames/jestpack | example/webpack.config.js | getEntryPoints | function getEntryPoints(globPattern) {
var testFiles = glob.sync(globPattern);
var entryPoints = {};
testFiles.forEach(function(file) {
entryPoints[file.replace(/\.js$/, '')] = './' + file;
});
return entryPoints;
} | javascript | function getEntryPoints(globPattern) {
var testFiles = glob.sync(globPattern);
var entryPoints = {};
testFiles.forEach(function(file) {
entryPoints[file.replace(/\.js$/, '')] = './' + file;
});
return entryPoints;
} | [
"function",
"getEntryPoints",
"(",
"globPattern",
")",
"{",
"var",
"testFiles",
"=",
"glob",
".",
"sync",
"(",
"globPattern",
")",
";",
"var",
"entryPoints",
"=",
"{",
"}",
";",
"testFiles",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"entryP... | Given a glob pattern returns the matched paths as an entry point object for Webpack.
@param {String} globPattern A glob pattern to match tests.
@return {Object} Key value pairs, keyed on filepath. | [
"Given",
"a",
"glob",
"pattern",
"returns",
"the",
"matched",
"paths",
"as",
"an",
"entry",
"point",
"object",
"for",
"Webpack",
"."
] | 2e3c26d856ebe4c1b3b786a26178e3ba81108616 | https://github.com/60frames/jestpack/blob/2e3c26d856ebe4c1b3b786a26178e3ba81108616/example/webpack.config.js#L13-L20 | train |
Collaborne/gulp-polymer-build-utils | polymer-build.js | polymerBuild | function polymerBuild(config) {
const skipRootFolder = function(file) {
const rootFolder = config.root || '.';
file.dirname = path.relative(rootFolder, file.dirname);
};
const project = new build.PolymerProject(config);
const bundler = project.bundler({
// XXX: sourcemaps makes V8 run out of memory
source... | javascript | function polymerBuild(config) {
const skipRootFolder = function(file) {
const rootFolder = config.root || '.';
file.dirname = path.relative(rootFolder, file.dirname);
};
const project = new build.PolymerProject(config);
const bundler = project.bundler({
// XXX: sourcemaps makes V8 run out of memory
source... | [
"function",
"polymerBuild",
"(",
"config",
")",
"{",
"const",
"skipRootFolder",
"=",
"function",
"(",
"file",
")",
"{",
"const",
"rootFolder",
"=",
"config",
".",
"root",
"||",
"'.'",
";",
"file",
".",
"dirname",
"=",
"path",
".",
"relative",
"(",
"rootF... | Executes the polymer-build, which a.o. vulcanizes and minifies the HTML
@param {Object} config Content of polymer.json
@returns | [
"Executes",
"the",
"polymer",
"-",
"build",
"which",
"a",
".",
"o",
".",
"vulcanizes",
"and",
"minifies",
"the",
"HTML"
] | 76f83ea018f726a9e4390444deef65dbe9dde1ff | https://github.com/Collaborne/gulp-polymer-build-utils/blob/76f83ea018f726a9e4390444deef65dbe9dde1ff/polymer-build.js#L15-L33 | train |
medialab/sandcrawler | src/helpers.js | serializeError | function serializeError(err) {
var o = {};
Object.getOwnPropertyNames(err).forEach(function (k) {
o[k] = err[k];
});
return _.omit(o, ['stack', 'type', 'arguments']);
} | javascript | function serializeError(err) {
var o = {};
Object.getOwnPropertyNames(err).forEach(function (k) {
o[k] = err[k];
});
return _.omit(o, ['stack', 'type', 'arguments']);
} | [
"function",
"serializeError",
"(",
"err",
")",
"{",
"var",
"o",
"=",
"{",
"}",
";",
"Object",
".",
"getOwnPropertyNames",
"(",
"err",
")",
".",
"forEach",
"(",
"function",
"(",
"k",
")",
"{",
"o",
"[",
"k",
"]",
"=",
"err",
"[",
"k",
"]",
";",
... | Serialize a JavaScript error | [
"Serialize",
"a",
"JavaScript",
"error"
] | c08e19095eee42c8ce1f84685960e5ea6cb0fd1d | https://github.com/medialab/sandcrawler/blob/c08e19095eee42c8ce1f84685960e5ea6cb0fd1d/src/helpers.js#L34-L42 | train |
medialab/sandcrawler | src/helpers.js | serializeCookie | function serializeCookie(cookie) {
return {
path: cookie.path,
name: cookie.key,
value: cookie.value,
domain: cookie.domain
};
} | javascript | function serializeCookie(cookie) {
return {
path: cookie.path,
name: cookie.key,
value: cookie.value,
domain: cookie.domain
};
} | [
"function",
"serializeCookie",
"(",
"cookie",
")",
"{",
"return",
"{",
"path",
":",
"cookie",
".",
"path",
",",
"name",
":",
"cookie",
".",
"key",
",",
"value",
":",
"cookie",
".",
"value",
",",
"domain",
":",
"cookie",
".",
"domain",
"}",
";",
"}"
] | Serialize a tough-cookie Cookie instance | [
"Serialize",
"a",
"tough",
"-",
"cookie",
"Cookie",
"instance"
] | c08e19095eee42c8ce1f84685960e5ea6cb0fd1d | https://github.com/medialab/sandcrawler/blob/c08e19095eee42c8ce1f84685960e5ea6cb0fd1d/src/helpers.js#L45-L52 | train |
dbkaplun/hterm-umdjs | dist/index.js | norm16 | function norm16(v) {
v = parseInt(v, 16);
return size == 2 ? v : // 16 bit
size == 1 ? v << 4 : // 8 bit
v >> (4 * (size - 2)); // 24 or 32 bit
} | javascript | function norm16(v) {
v = parseInt(v, 16);
return size == 2 ? v : // 16 bit
size == 1 ? v << 4 : // 8 bit
v >> (4 * (size - 2)); // 24 or 32 bit
} | [
"function",
"norm16",
"(",
"v",
")",
"{",
"v",
"=",
"parseInt",
"(",
"v",
",",
"16",
")",
";",
"return",
"size",
"==",
"2",
"?",
"v",
":",
"// 16 bit",
"size",
"==",
"1",
"?",
"v",
"<<",
"4",
":",
"// 8 bit",
"v",
">>",
"(",
"4",
"*",
"(",
... | Normalize to 16 bits. | [
"Normalize",
"to",
"16",
"bits",
"."
] | 5cf0fe1f73302ca543c6bcd2d27852362ecada97 | https://github.com/dbkaplun/hterm-umdjs/blob/5cf0fe1f73302ca543c6bcd2d27852362ecada97/dist/index.js#L485-L490 | 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.