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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
staruml/metadata-json | lib/image.js | exportDiagramBulk | function exportDiagramBulk(diagrams, filename, format, options, fn) {
diagrams = diagrams || [];
filename = filename || "<%=diagram.name%>.png";
format = format || "png";
options = options || {};
// if elements parameter is selector expression, retrieve them from Repository.
if (_.isStrin... | javascript | function exportDiagramBulk(diagrams, filename, format, options, fn) {
diagrams = diagrams || [];
filename = filename || "<%=diagram.name%>.png";
format = format || "png";
options = options || {};
// if elements parameter is selector expression, retrieve them from Repository.
if (_.isStrin... | [
"function",
"exportDiagramBulk",
"(",
"diagrams",
",",
"filename",
",",
"format",
",",
"options",
",",
"fn",
")",
"{",
"diagrams",
"=",
"diagrams",
"||",
"[",
"]",
";",
"filename",
"=",
"filename",
"||",
"\"<%=diagram.name%>.png\"",
";",
"format",
"=",
"form... | Export a set of diagrams at once
@param{Array.<Diagram> | string} diagrams Array of diagrams or selector expression to be exported
@param{string} filename File name for output image file(s). You can use ejs expression (Default: `<%=diagram.name%>.png`)
@param{string} format Image format ("png" or "svg").
@param{Object... | [
"Export",
"a",
"set",
"of",
"diagrams",
"at",
"once"
] | 4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb | https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/lib/image.js#L109-L151 | train |
ripple/ripple-rest | api/info.js | getFee | function getFee(callback) {
var fee = this.remote.createTransaction()._computeFee();
callback(null, {fee: utils.dropsToXrp(fee)});
} | javascript | function getFee(callback) {
var fee = this.remote.createTransaction()._computeFee();
callback(null, {fee: utils.dropsToXrp(fee)});
} | [
"function",
"getFee",
"(",
"callback",
")",
"{",
"var",
"fee",
"=",
"this",
".",
"remote",
".",
"createTransaction",
"(",
")",
".",
"_computeFee",
"(",
")",
";",
"callback",
"(",
"null",
",",
"{",
"fee",
":",
"utils",
".",
"dropsToXrp",
"(",
"fee",
"... | Get the current transaction fee | [
"Get",
"the",
"current",
"transaction",
"fee"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/info.js#L41-L44 | train |
ripple/ripple-rest | api/lib/server-lib.js | isConnected | function isConnected(remote) {
if (isNaN(remote._ledger_current_index)) {
// Remote is missing the index of last ledger closed. Unprepared to submit
// transactions
return false;
}
var server = remote.getServer();
if (!server) {
return false;
}
if (remote._stand_alone) {
// If rippled ... | javascript | function isConnected(remote) {
if (isNaN(remote._ledger_current_index)) {
// Remote is missing the index of last ledger closed. Unprepared to submit
// transactions
return false;
}
var server = remote.getServer();
if (!server) {
return false;
}
if (remote._stand_alone) {
// If rippled ... | [
"function",
"isConnected",
"(",
"remote",
")",
"{",
"if",
"(",
"isNaN",
"(",
"remote",
".",
"_ledger_current_index",
")",
")",
"{",
"// Remote is missing the index of last ledger closed. Unprepared to submit",
"// transactions",
"return",
"false",
";",
"}",
"var",
"serv... | Determine if remote is connected based on time of last ledger closed
@param {Server} server
@return {Boolean} | [
"Determine",
"if",
"remote",
"is",
"connected",
"based",
"on",
"time",
"of",
"last",
"ledger",
"closed"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/lib/server-lib.js#L16-L35 | train |
ripple/ripple-rest | api/lib/server-lib.js | ensureConnected | function ensureConnected(remote, callback) {
if (remote.getServer()) {
callback(null, isConnected(remote));
} else {
callback(null, false);
}
} | javascript | function ensureConnected(remote, callback) {
if (remote.getServer()) {
callback(null, isConnected(remote));
} else {
callback(null, false);
}
} | [
"function",
"ensureConnected",
"(",
"remote",
",",
"callback",
")",
"{",
"if",
"(",
"remote",
".",
"getServer",
"(",
")",
")",
"{",
"callback",
"(",
"null",
",",
"isConnected",
"(",
"remote",
")",
")",
";",
"}",
"else",
"{",
"callback",
"(",
"null",
... | Check if remote is connected and attempt to reconnect if not
@param {Remote} remote
@param {Function} callback | [
"Check",
"if",
"remote",
"is",
"connected",
"and",
"attempt",
"to",
"reconnect",
"if",
"not"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/lib/server-lib.js#L43-L49 | train |
ripple/ripple-rest | server/response-handler.js | success | function success(response, body) {
var content = _.assign(body || {}, {success: true});
send(response, content, StatusCode.ok);
} | javascript | function success(response, body) {
var content = _.assign(body || {}, {success: true});
send(response, content, StatusCode.ok);
} | [
"function",
"success",
"(",
"response",
",",
"body",
")",
"{",
"var",
"content",
"=",
"_",
".",
"assign",
"(",
"body",
"||",
"{",
"}",
",",
"{",
"success",
":",
"true",
"}",
")",
";",
"send",
"(",
"response",
",",
"content",
",",
"StatusCode",
".",... | Send a success response
@param response - response object
@param body - (optional) body to the response, in addition to the
success property | [
"Send",
"a",
"success",
"response"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/server/response-handler.js#L77-L80 | train |
ripple/ripple-rest | server/response-handler.js | transactionError | function transactionError(response, message, body) {
var content = errorContent(ErrorType.transaction, message, body);
send(response, content, StatusCode.internalServerError);
} | javascript | function transactionError(response, message, body) {
var content = errorContent(ErrorType.transaction, message, body);
send(response, content, StatusCode.internalServerError);
} | [
"function",
"transactionError",
"(",
"response",
",",
"message",
",",
"body",
")",
"{",
"var",
"content",
"=",
"errorContent",
"(",
"ErrorType",
".",
"transaction",
",",
"message",
",",
"body",
")",
";",
"send",
"(",
"response",
",",
"content",
",",
"Statu... | Send an transaction error response
@param response - response object
@param message - (optional) message to accompany and describe the
invalid response
@param body - (optional) additional body to the response | [
"Send",
"an",
"transaction",
"error",
"response"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/server/response-handler.js#L115-L118 | train |
ripple/ripple-rest | server/response-handler.js | apiError | function apiError(response, error) {
var content = errorContentExt(ErrorType.server, error);
send(response, content, StatusCode.internalServerError);
} | javascript | function apiError(response, error) {
var content = errorContentExt(ErrorType.server, error);
send(response, content, StatusCode.internalServerError);
} | [
"function",
"apiError",
"(",
"response",
",",
"error",
")",
"{",
"var",
"content",
"=",
"errorContentExt",
"(",
"ErrorType",
".",
"server",
",",
"error",
")",
";",
"send",
"(",
"response",
",",
"content",
",",
"StatusCode",
".",
"internalServerError",
")",
... | Send an api error response
@param response - response object
@param message - (optional) message to accompany and describe the
invalid response
@param body - (optional) additional body to the response | [
"Send",
"an",
"api",
"error",
"response"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/server/response-handler.js#L140-L143 | train |
ripple/ripple-rest | server/response-handler.js | invalidRequestError | function invalidRequestError(response, error) {
var content = errorContentExt(ErrorType.invalidRequest, error);
send(response, content, StatusCode.badRequest);
} | javascript | function invalidRequestError(response, error) {
var content = errorContentExt(ErrorType.invalidRequest, error);
send(response, content, StatusCode.badRequest);
} | [
"function",
"invalidRequestError",
"(",
"response",
",",
"error",
")",
"{",
"var",
"content",
"=",
"errorContentExt",
"(",
"ErrorType",
".",
"invalidRequest",
",",
"error",
")",
";",
"send",
"(",
"response",
",",
"content",
",",
"StatusCode",
".",
"badRequest"... | Send an invalid request error response
@param response - response object
@param error - error to send back to the client | [
"Send",
"an",
"invalid",
"request",
"error",
"response"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/server/response-handler.js#L151-L154 | train |
ripple/ripple-rest | server/response-handler.js | internalError | function internalError(response, message, body) {
var content = errorContent(ErrorType.server, message, body);
send(response, content, StatusCode.internalServerError);
} | javascript | function internalError(response, message, body) {
var content = errorContent(ErrorType.server, message, body);
send(response, content, StatusCode.internalServerError);
} | [
"function",
"internalError",
"(",
"response",
",",
"message",
",",
"body",
")",
"{",
"var",
"content",
"=",
"errorContent",
"(",
"ErrorType",
".",
"server",
",",
"message",
",",
"body",
")",
";",
"send",
"(",
"response",
",",
"content",
",",
"StatusCode",
... | Send an internal error response
@param response - response object
@param message - (optional) additional error message
e.g. description for provided error
@param body - (optional) additional body to the response | [
"Send",
"an",
"internal",
"error",
"response"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/server/response-handler.js#L164-L167 | train |
ripple/ripple-rest | server/response-handler.js | connectionError | function connectionError(response, message, body) {
var content = errorContent(ErrorType.connection, message, body);
send(response, content, StatusCode.badGateway);
} | javascript | function connectionError(response, message, body) {
var content = errorContent(ErrorType.connection, message, body);
send(response, content, StatusCode.badGateway);
} | [
"function",
"connectionError",
"(",
"response",
",",
"message",
",",
"body",
")",
"{",
"var",
"content",
"=",
"errorContent",
"(",
"ErrorType",
".",
"connection",
",",
"message",
",",
"body",
")",
";",
"send",
"(",
"response",
",",
"content",
",",
"StatusC... | Send an connection error response
@param response - response object
@param message - (optional) additional error message
@param body - (optional) additional body to the response | [
"Send",
"an",
"connection",
"error",
"response"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/server/response-handler.js#L176-L179 | train |
ripple/ripple-rest | server/response-handler.js | timeOutError | function timeOutError(response, message, body) {
var content = errorContent(ErrorType.connection, message, body);
send(response, content, StatusCode.timeout);
} | javascript | function timeOutError(response, message, body) {
var content = errorContent(ErrorType.connection, message, body);
send(response, content, StatusCode.timeout);
} | [
"function",
"timeOutError",
"(",
"response",
",",
"message",
",",
"body",
")",
"{",
"var",
"content",
"=",
"errorContent",
"(",
"ErrorType",
".",
"connection",
",",
"message",
",",
"body",
")",
";",
"send",
"(",
"response",
",",
"content",
",",
"StatusCode... | Send a timeout error response
@param response - response object
@param message - (optional) additional error message
@param body - (optional) additional body to the response | [
"Send",
"a",
"timeout",
"error",
"response"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/server/response-handler.js#L199-L202 | train |
ripple/ripple-rest | api/transactions.js | function(transaction, _callback) {
transaction.remote = api.remote;
if (options.blockDuplicates === true) {
blockDuplicates(transaction, options, _callback);
} else {
_callback(null, transaction);
}
} | javascript | function(transaction, _callback) {
transaction.remote = api.remote;
if (options.blockDuplicates === true) {
blockDuplicates(transaction, options, _callback);
} else {
_callback(null, transaction);
}
} | [
"function",
"(",
"transaction",
",",
"_callback",
")",
"{",
"transaction",
".",
"remote",
"=",
"api",
".",
"remote",
";",
"if",
"(",
"options",
".",
"blockDuplicates",
"===",
"true",
")",
"{",
"blockDuplicates",
"(",
"transaction",
",",
"options",
",",
"_c... | Duplicate blocking is performed here | [
"Duplicate",
"blocking",
"is",
"performed",
"here"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/transactions.js#L89-L97 | train | |
ripple/ripple-rest | api/transactions.js | function(transaction, _callback) {
try {
transaction.secret(secret);
} catch (exception) {
return _callback(exception);
}
transaction.once('error', _callback);
transaction.once('submitted', function(message) {
if (message.result.slice(0, 3) === 'tec'
&... | javascript | function(transaction, _callback) {
try {
transaction.secret(secret);
} catch (exception) {
return _callback(exception);
}
transaction.once('error', _callback);
transaction.once('submitted', function(message) {
if (message.result.slice(0, 3) === 'tec'
&... | [
"function",
"(",
"transaction",
",",
"_callback",
")",
"{",
"try",
"{",
"transaction",
".",
"secret",
"(",
"secret",
")",
";",
"}",
"catch",
"(",
"exception",
")",
"{",
"return",
"_callback",
"(",
"exception",
")",
";",
"}",
"transaction",
".",
"once",
... | Transaction parameters are set, listeners are registered, and is submitted here | [
"Transaction",
"parameters",
"are",
"set",
"listeners",
"are",
"registered",
"and",
"is",
"submitted",
"here"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/transactions.js#L100-L161 | train | |
ripple/ripple-rest | api/transactions.js | getTransactionAndRespond | function getTransactionAndRespond(account, identifier, options, callback) {
getTransaction(
this,
account,
identifier,
options,
function(error, transaction) {
if (error) {
callback(error);
} else {
callback(null, {transaction: transaction});
}
}
);
} | javascript | function getTransactionAndRespond(account, identifier, options, callback) {
getTransaction(
this,
account,
identifier,
options,
function(error, transaction) {
if (error) {
callback(error);
} else {
callback(null, {transaction: transaction});
}
}
);
} | [
"function",
"getTransactionAndRespond",
"(",
"account",
",",
"identifier",
",",
"options",
",",
"callback",
")",
"{",
"getTransaction",
"(",
"this",
",",
"account",
",",
"identifier",
",",
"options",
",",
"function",
"(",
"error",
",",
"transaction",
")",
"{",... | Wrapper around getTransaction function that is
meant to be used directly as a client-facing function.
Unlike getTransaction, it will call next with any errors
and send a JSON response to the client on success.
See getTransaction for parameter details | [
"Wrapper",
"around",
"getTransaction",
"function",
"that",
"is",
"meant",
"to",
"be",
"used",
"directly",
"as",
"a",
"client",
"-",
"facing",
"function",
".",
"Unlike",
"getTransaction",
"it",
"will",
"call",
"next",
"with",
"any",
"errors",
"and",
"send",
"... | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/transactions.js#L342-L356 | train |
ripple/ripple-rest | api/transactions.js | getAccountTx | function getAccountTx(api, options, callback) {
var params = {
account: options.account,
ledger_index_min: options.ledger_index_min || options.ledger_index || -1,
ledger_index_max: options.ledger_index_max || options.ledger_index || -1,
limit: options.limit || DEFAULT_RESULTS_PER_PAGE,
forward: op... | javascript | function getAccountTx(api, options, callback) {
var params = {
account: options.account,
ledger_index_min: options.ledger_index_min || options.ledger_index || -1,
ledger_index_max: options.ledger_index_max || options.ledger_index || -1,
limit: options.limit || DEFAULT_RESULTS_PER_PAGE,
forward: op... | [
"function",
"getAccountTx",
"(",
"api",
",",
"options",
",",
"callback",
")",
"{",
"var",
"params",
"=",
"{",
"account",
":",
"options",
".",
"account",
",",
"ledger_index_min",
":",
"options",
".",
"ledger_index_min",
"||",
"options",
".",
"ledger_index",
"... | Wrapper around the standard ripple-lib requestAccountTx function
@param {Remote} remote
@param {RippleAddress} options.account
@param {Number} [-1] options.ledger_index_min
@param {Number} [-1] options.ledger_index_max
@param {Boolean} [false] options.earliestFirst
@param {Boolean} [false] options.binary
@param {opaqu... | [
"Wrapper",
"around",
"the",
"standard",
"ripple",
"-",
"lib",
"requestAccountTx",
"function"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/transactions.js#L375-L406 | train |
ripple/ripple-rest | api/transactions.js | getLocalAndRemoteTransactions | function getLocalAndRemoteTransactions(api, options, callback) {
function queryRippled(_callback) {
getAccountTx(api, options, function(error, results) {
if (error) {
_callback(error);
} else {
// Set marker so that when this function is called again
// recursively it starts f... | javascript | function getLocalAndRemoteTransactions(api, options, callback) {
function queryRippled(_callback) {
getAccountTx(api, options, function(error, results) {
if (error) {
_callback(error);
} else {
// Set marker so that when this function is called again
// recursively it starts f... | [
"function",
"getLocalAndRemoteTransactions",
"(",
"api",
",",
"options",
",",
"callback",
")",
"{",
"function",
"queryRippled",
"(",
"_callback",
")",
"{",
"getAccountTx",
"(",
"api",
",",
"options",
",",
"function",
"(",
"error",
",",
"results",
")",
"{",
"... | Retrieve transactions from the Remote as well as the local database.
@param {Remote} remote
@param {/lib/db-interface} dbinterface
@param {RippleAddress} options.account
@param {Number} [-1] options.ledger_index_min
@param {Number} [-1] options.ledger_index_max
@param {Boolean} [false] options.earliestFirst
@param {Bo... | [
"Retrieve",
"transactions",
"from",
"the",
"Remote",
"as",
"well",
"as",
"the",
"local",
"database",
"."
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/transactions.js#L426-L466 | train |
ripple/ripple-rest | api/transactions.js | transactionFilter | function transactionFilter(transactions, options) {
var filtered_transactions = transactions.filter(function(transaction) {
if (options.exclude_failed) {
if (transaction.state === 'failed' || (transaction.meta
&& transaction.meta.TransactionResult !== 'tesSUCCESS')) {
return false;
}... | javascript | function transactionFilter(transactions, options) {
var filtered_transactions = transactions.filter(function(transaction) {
if (options.exclude_failed) {
if (transaction.state === 'failed' || (transaction.meta
&& transaction.meta.TransactionResult !== 'tesSUCCESS')) {
return false;
}... | [
"function",
"transactionFilter",
"(",
"transactions",
",",
"options",
")",
"{",
"var",
"filtered_transactions",
"=",
"transactions",
".",
"filter",
"(",
"function",
"(",
"transaction",
")",
"{",
"if",
"(",
"options",
".",
"exclude_failed",
")",
"{",
"if",
"(",... | Filter transactions based on the given set of options.
@param {Array of transactions in JSON format} transactions
@param {Boolean} [false] options.exclude_failed
@param {Array of Strings} options.types Possible values are "payment",
"offercreate", "offercancel", "trustset", "accountset"
@param {RippleAddress} options.... | [
"Filter",
"transactions",
"based",
"on",
"the",
"given",
"set",
"of",
"options",
"."
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/transactions.js#L481-L519 | train |
ripple/ripple-rest | api/transactions.js | getAccountTransactions | function getAccountTransactions(api, options, callback) {
try {
validate.address(options.account);
} catch(err) {
return callback(err);
}
if (!options.min) {
options.min = module.exports.DEFAULT_RESULTS_PER_PAGE;
}
if (!options.max) {
options.max = Math.max(options.min,
module.exports... | javascript | function getAccountTransactions(api, options, callback) {
try {
validate.address(options.account);
} catch(err) {
return callback(err);
}
if (!options.min) {
options.min = module.exports.DEFAULT_RESULTS_PER_PAGE;
}
if (!options.max) {
options.max = Math.max(options.min,
module.exports... | [
"function",
"getAccountTransactions",
"(",
"api",
",",
"options",
",",
"callback",
")",
"{",
"try",
"{",
"validate",
".",
"address",
"(",
"options",
".",
"account",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"return",
"callback",
"(",
"err",
")",
";... | Recursively get transactions for the specified account from
the Remote and local database. If options.min is set, this will
recurse until it has retrieved that number of transactions or
it has reached the end of the account's transaction history.
@param {Remote} remote
@param {/lib/db-interface} dbinterface
@param {Ri... | [
"Recursively",
"get",
"transactions",
"for",
"the",
"specified",
"account",
"from",
"the",
"Remote",
"and",
"local",
"database",
".",
"If",
"options",
".",
"min",
"is",
"set",
"this",
"will",
"recurse",
"until",
"it",
"has",
"retrieved",
"that",
"number",
"o... | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/transactions.js#L549-L620 | train |
ripple/ripple-rest | api/notifications.js | attachPreviousAndNextTransactionIdentifiers | function attachPreviousAndNextTransactionIdentifiers(api,
notificationDetails, topCallback) {
// Get all of the transactions affecting the specified
// account in the given ledger. This is done so that
// we can query for one more than that number on either
// side to ensure that we'll find the next and pr... | javascript | function attachPreviousAndNextTransactionIdentifiers(api,
notificationDetails, topCallback) {
// Get all of the transactions affecting the specified
// account in the given ledger. This is done so that
// we can query for one more than that number on either
// side to ensure that we'll find the next and pr... | [
"function",
"attachPreviousAndNextTransactionIdentifiers",
"(",
"api",
",",
"notificationDetails",
",",
"topCallback",
")",
"{",
"// Get all of the transactions affecting the specified",
"// account in the given ledger. This is done so that",
"// we can query for one more than that number on... | Find the previous and next transaction hashes or
client_resource_ids using both the rippled and
local database. Report errors to the client using res.json
or pass the notificationDetails with the added fields
back to the callback.
@param {Remote} $.remote
@param {/lib/db-interface} $.dbinterface
@param {Express.js Res... | [
"Find",
"the",
"previous",
"and",
"next",
"transaction",
"hashes",
"or",
"client_resource_ids",
"using",
"both",
"the",
"rippled",
"and",
"local",
"database",
".",
"Report",
"errors",
"to",
"the",
"client",
"using",
"res",
".",
"json",
"or",
"pass",
"the",
"... | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/notifications.js#L32-L151 | train |
ripple/ripple-rest | api/notifications.js | getAccountTransactionsInBaseTransactionLedger | function getAccountTransactionsInBaseTransactionLedger(callback) {
var params = {
account: notificationDetails.account,
ledger_index_min: notificationDetails.transaction.ledger_index,
ledger_index_max: notificationDetails.transaction.ledger_index,
exclude_failed: false,
max: 99999999,
... | javascript | function getAccountTransactionsInBaseTransactionLedger(callback) {
var params = {
account: notificationDetails.account,
ledger_index_min: notificationDetails.transaction.ledger_index,
ledger_index_max: notificationDetails.transaction.ledger_index,
exclude_failed: false,
max: 99999999,
... | [
"function",
"getAccountTransactionsInBaseTransactionLedger",
"(",
"callback",
")",
"{",
"var",
"params",
"=",
"{",
"account",
":",
"notificationDetails",
".",
"account",
",",
"ledger_index_min",
":",
"notificationDetails",
".",
"transaction",
".",
"ledger_index",
",",
... | Get all of the transactions affecting the specified account in the given ledger. This is done so that we can query for one more than that number on either side to ensure that we'll find the next and previous transactions, no matter how many transactions the given account had in the same ledger | [
"Get",
"all",
"of",
"the",
"transactions",
"affecting",
"the",
"specified",
"account",
"in",
"the",
"given",
"ledger",
".",
"This",
"is",
"done",
"so",
"that",
"we",
"can",
"query",
"for",
"one",
"more",
"than",
"that",
"number",
"on",
"either",
"side",
... | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/notifications.js#L41-L52 | train |
ripple/ripple-rest | api/notifications.js | getNextAndPreviousTransactions | function getNextAndPreviousTransactions(numTransactionsInLedger, callback) {
async.concat([false, true], function(earliestFirst, concat_callback) {
var params = {
account: notificationDetails.account,
max: numTransactionsInLedger + 1,
min: numTransactionsInLedger + 1,
limit: nu... | javascript | function getNextAndPreviousTransactions(numTransactionsInLedger, callback) {
async.concat([false, true], function(earliestFirst, concat_callback) {
var params = {
account: notificationDetails.account,
max: numTransactionsInLedger + 1,
min: numTransactionsInLedger + 1,
limit: nu... | [
"function",
"getNextAndPreviousTransactions",
"(",
"numTransactionsInLedger",
",",
"callback",
")",
"{",
"async",
".",
"concat",
"(",
"[",
"false",
",",
"true",
"]",
",",
"function",
"(",
"earliestFirst",
",",
"concat_callback",
")",
"{",
"var",
"params",
"=",
... | Query for one more than the numTransactionsInLedger going forward and backwards to get a range of transactions that will definitely include the next and previous transactions | [
"Query",
"for",
"one",
"more",
"than",
"the",
"numTransactionsInLedger",
"going",
"forward",
"and",
"backwards",
"to",
"get",
"a",
"range",
"of",
"transactions",
"that",
"will",
"definitely",
"include",
"the",
"next",
"and",
"previous",
"transactions"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/notifications.js#L62-L86 | train |
ripple/ripple-rest | api/notifications.js | sortTransactions | function sortTransactions(allTransactions, callback) {
allTransactions.push(notificationDetails.transaction);
var txns = _.uniq(allTransactions, function(tx) {
return tx.hash;
});
txns.sort(utils.compareTransactions);
callback(null, txns);
} | javascript | function sortTransactions(allTransactions, callback) {
allTransactions.push(notificationDetails.transaction);
var txns = _.uniq(allTransactions, function(tx) {
return tx.hash;
});
txns.sort(utils.compareTransactions);
callback(null, txns);
} | [
"function",
"sortTransactions",
"(",
"allTransactions",
",",
"callback",
")",
"{",
"allTransactions",
".",
"push",
"(",
"notificationDetails",
".",
"transaction",
")",
";",
"var",
"txns",
"=",
"_",
".",
"uniq",
"(",
"allTransactions",
",",
"function",
"(",
"tx... | Sort the transactions returned by ledger_index and remove duplicates | [
"Sort",
"the",
"transactions",
"returned",
"by",
"ledger_index",
"and",
"remove",
"duplicates"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/notifications.js#L89-L99 | train |
ripple/ripple-rest | api/notifications.js | findPreviousAndNextTransactions | function findPreviousAndNextTransactions(txns, callback) {
// Find the index in the array of the baseTransaction
var baseTransactionIndex = _.findIndex(txns, function(possibility) {
if (possibility.hash === notificationDetails.transaction.hash) {
return true;
} else if (possibility.client_r... | javascript | function findPreviousAndNextTransactions(txns, callback) {
// Find the index in the array of the baseTransaction
var baseTransactionIndex = _.findIndex(txns, function(possibility) {
if (possibility.hash === notificationDetails.transaction.hash) {
return true;
} else if (possibility.client_r... | [
"function",
"findPreviousAndNextTransactions",
"(",
"txns",
",",
"callback",
")",
"{",
"// Find the index in the array of the baseTransaction",
"var",
"baseTransactionIndex",
"=",
"_",
".",
"findIndex",
"(",
"txns",
",",
"function",
"(",
"possibility",
")",
"{",
"if",
... | Find the baseTransaction amongst the results. Because the transactions have been sorted, the next and previous transactions will be the ones on either side of the base transaction | [
"Find",
"the",
"baseTransaction",
"amongst",
"the",
"results",
".",
"Because",
"the",
"transactions",
"have",
"been",
"sorted",
"the",
"next",
"and",
"previous",
"transactions",
"will",
"be",
"the",
"ones",
"on",
"either",
"side",
"of",
"the",
"base",
"transac... | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/notifications.js#L104-L140 | train |
ripple/ripple-rest | api/notifications.js | getNotificationHelper | function getNotificationHelper(api, account, identifier, urlBase, topCallback) {
function getTransaction(callback) {
try {
transactions.getTransaction(api, account, identifier, {}, callback);
} catch(err) {
callback(err);
}
}
function checkLedger(baseTransaction, callback) {
serverLi... | javascript | function getNotificationHelper(api, account, identifier, urlBase, topCallback) {
function getTransaction(callback) {
try {
transactions.getTransaction(api, account, identifier, {}, callback);
} catch(err) {
callback(err);
}
}
function checkLedger(baseTransaction, callback) {
serverLi... | [
"function",
"getNotificationHelper",
"(",
"api",
",",
"account",
",",
"identifier",
",",
"urlBase",
",",
"topCallback",
")",
"{",
"function",
"getTransaction",
"(",
"callback",
")",
"{",
"try",
"{",
"transactions",
".",
"getTransaction",
"(",
"api",
",",
"acco... | Get a notification corresponding to the specified
account and transaction identifier. Send errors back
to the client using the res.json method or pass
the notification json to the callback function.
@param {Remote} $.remote
@param {/lib/db-interface} $.dbinterface
@param {RippleAddress} req.params.account
@param {Hex-... | [
"Get",
"a",
"notification",
"corresponding",
"to",
"the",
"specified",
"account",
"and",
"transaction",
"identifier",
".",
"Send",
"errors",
"back",
"to",
"the",
"client",
"using",
"the",
"res",
".",
"json",
"method",
"or",
"pass",
"the",
"notification",
"json... | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/notifications.js#L170-L245 | train |
ripple/ripple-rest | api/notifications.js | getNotification | function getNotification(account, identifier, urlBase, callback) {
validate.address(account);
validate.paymentIdentifier(identifier);
return getNotificationHelper(this, account, identifier, urlBase, callback);
} | javascript | function getNotification(account, identifier, urlBase, callback) {
validate.address(account);
validate.paymentIdentifier(identifier);
return getNotificationHelper(this, account, identifier, urlBase, callback);
} | [
"function",
"getNotification",
"(",
"account",
",",
"identifier",
",",
"urlBase",
",",
"callback",
")",
"{",
"validate",
".",
"address",
"(",
"account",
")",
";",
"validate",
".",
"paymentIdentifier",
"(",
"identifier",
")",
";",
"return",
"getNotificationHelper... | Get a notification corresponding to the specified
account and transaction identifier. Uses the res.json
method to send errors or a notification back to the client.
@param {Remote} $.remote
@param {/lib/db-interface} $.dbinterface
@param {/lib/config-loader} $.config
@param {RippleAddress} req.params.account
@param {He... | [
"Get",
"a",
"notification",
"corresponding",
"to",
"the",
"specified",
"account",
"and",
"transaction",
"identifier",
".",
"Uses",
"the",
"res",
".",
"json",
"method",
"to",
"send",
"errors",
"or",
"a",
"notification",
"back",
"to",
"the",
"client",
"."
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/notifications.js#L258-L263 | train |
ripple/ripple-rest | api/notifications.js | getNotifications | function getNotifications(account, urlBase, options, callback) {
validate.address(account);
var self = this;
function getTransactions(_callback) {
var resultsPerPage = options.results_per_page ||
transactions.DEFAULT_RESULTS_PER_PAGE;
var offset = resultsPerPage * ((options.page || 1) - 1);
... | javascript | function getNotifications(account, urlBase, options, callback) {
validate.address(account);
var self = this;
function getTransactions(_callback) {
var resultsPerPage = options.results_per_page ||
transactions.DEFAULT_RESULTS_PER_PAGE;
var offset = resultsPerPage * ((options.page || 1) - 1);
... | [
"function",
"getNotifications",
"(",
"account",
",",
"urlBase",
",",
"options",
",",
"callback",
")",
"{",
"validate",
".",
"address",
"(",
"account",
")",
";",
"var",
"self",
"=",
"this",
";",
"function",
"getTransactions",
"(",
"_callback",
")",
"{",
"va... | Get a notifications corresponding to the specified
account.
This function calls transactions.getAccountTransactions
recursively to retrieve results_per_page number of transactions
and filters the results using client-specified parameters.
@param {RippleAddress} account
@param {string} urlBase - The url to use for the... | [
"Get",
"a",
"notifications",
"corresponding",
"to",
"the",
"specified",
"account",
"."
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/notifications.js#L284-L367 | train |
ripple/ripple-rest | api/settings.js | getSettings | function getSettings(account, callback) {
validate.address(account);
this.remote.requestAccountInfo({account: account}, function(error, info) {
if (error) {
return callback(error);
}
var data = info.account_data;
var settings = {
account: data.Account,
transfer_rate: '0'
};
... | javascript | function getSettings(account, callback) {
validate.address(account);
this.remote.requestAccountInfo({account: account}, function(error, info) {
if (error) {
return callback(error);
}
var data = info.account_data;
var settings = {
account: data.Account,
transfer_rate: '0'
};
... | [
"function",
"getSettings",
"(",
"account",
",",
"callback",
")",
"{",
"validate",
".",
"address",
"(",
"account",
")",
";",
"this",
".",
"remote",
".",
"requestAccountInfo",
"(",
"{",
"account",
":",
"account",
"}",
",",
"function",
"(",
"error",
",",
"i... | Retrieves account settings for a given account
@url
@param {String} request.params.account | [
"Retrieves",
"account",
"settings",
"for",
"a",
"given",
"account"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/settings.js#L34-L60 | train |
ripple/ripple-rest | api/settings.js | changeSettings | function changeSettings(account, settings, secret, options, callback) {
var transaction = createSettingsTransaction(account, settings);
var converter = _.partial(
TxToRestConverter.parseSettingsResponseFromTx, settings);
transact(transaction, this, secret, options, converter, callback);
} | javascript | function changeSettings(account, settings, secret, options, callback) {
var transaction = createSettingsTransaction(account, settings);
var converter = _.partial(
TxToRestConverter.parseSettingsResponseFromTx, settings);
transact(transaction, this, secret, options, converter, callback);
} | [
"function",
"changeSettings",
"(",
"account",
",",
"settings",
",",
"secret",
",",
"options",
",",
"callback",
")",
"{",
"var",
"transaction",
"=",
"createSettingsTransaction",
"(",
"account",
",",
"settings",
")",
";",
"var",
"converter",
"=",
"_",
".",
"pa... | Change account settings
@body
@param {Settings} request.body.settings
@param {String} request.body.secret
@query
@param {String "true"|"false"} request.query.validated Used to force request
to wait until rippled has finished validating the submitted transaction | [
"Change",
"account",
"settings"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/settings.js#L74-L79 | train |
ripple/ripple-rest | api/transaction/utils.js | setTransactionBitFlags | function setTransactionBitFlags(transaction, options) {
for (var flagName in options.flags) {
var flag = options.flags[flagName];
// Set transaction flags
if (!(flag.name in options.input)) {
continue;
}
var value = options.input[flag.name];
if (value === options.clear_setting) {
... | javascript | function setTransactionBitFlags(transaction, options) {
for (var flagName in options.flags) {
var flag = options.flags[flagName];
// Set transaction flags
if (!(flag.name in options.input)) {
continue;
}
var value = options.input[flag.name];
if (value === options.clear_setting) {
... | [
"function",
"setTransactionBitFlags",
"(",
"transaction",
",",
"options",
")",
"{",
"for",
"(",
"var",
"flagName",
"in",
"options",
".",
"flags",
")",
"{",
"var",
"flag",
"=",
"options",
".",
"flags",
"[",
"flagName",
"]",
";",
"// Set transaction flags",
"i... | Helper that sets bit flags on transactions
@param {Transaction} transaction - Transaction object that is used to submit
requests to ripple
@param {Object} options
@param {Object} options.flags - Holds flag names to set on transaction when
parameter values are true or false on input
@param {Object} options.input - Hold... | [
"Helper",
"that",
"sets",
"bit",
"flags",
"on",
"transactions"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/transaction/utils.js#L36-L57 | train |
ripple/ripple-rest | api/payments.js | formatPaymentHelper | function formatPaymentHelper(account, txJSON) {
if (!(txJSON && /^payment$/i.test(txJSON.TransactionType))) {
throw new InvalidRequestError('Not a payment. The transaction '
+ 'corresponding to the given identifier is not a payment.');
}
var metadata = {
client_resource_id: txJSON.client_resource_id... | javascript | function formatPaymentHelper(account, txJSON) {
if (!(txJSON && /^payment$/i.test(txJSON.TransactionType))) {
throw new InvalidRequestError('Not a payment. The transaction '
+ 'corresponding to the given identifier is not a payment.');
}
var metadata = {
client_resource_id: txJSON.client_resource_id... | [
"function",
"formatPaymentHelper",
"(",
"account",
",",
"txJSON",
")",
"{",
"if",
"(",
"!",
"(",
"txJSON",
"&&",
"/",
"^payment$",
"/",
"i",
".",
"test",
"(",
"txJSON",
".",
"TransactionType",
")",
")",
")",
"{",
"throw",
"new",
"InvalidRequestError",
"(... | Formats the local database transaction into ripple-rest Payment format
@param {RippleAddress} account
@param {Transaction} transaction
@param {Function} callback
@callback
@param {Error} error
@param {RippleRestTransaction} transaction | [
"Formats",
"the",
"local",
"database",
"transaction",
"into",
"ripple",
"-",
"rest",
"Payment",
"format"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/payments.js#L41-L57 | train |
ripple/ripple-rest | api/payments.js | submitPayment | function submitPayment(account, payment, clientResourceID, secret,
urlBase, options, callback) {
function formatTransactionResponse(message, meta) {
if (meta.state === 'validated') {
var txJSON = message.tx_json;
txJSON.meta = message.metadata;
txJSON.validated = message.validated;
tx... | javascript | function submitPayment(account, payment, clientResourceID, secret,
urlBase, options, callback) {
function formatTransactionResponse(message, meta) {
if (meta.state === 'validated') {
var txJSON = message.tx_json;
txJSON.meta = message.metadata;
txJSON.validated = message.validated;
tx... | [
"function",
"submitPayment",
"(",
"account",
",",
"payment",
",",
"clientResourceID",
",",
"secret",
",",
"urlBase",
",",
"options",
",",
"callback",
")",
"{",
"function",
"formatTransactionResponse",
"(",
"message",
",",
"meta",
")",
"{",
"if",
"(",
"meta",
... | Submit a payment in the ripple-rest format.
@global
@param {/config/config-loader} config
@body
@param {Payment} request.body.payment
@param {String} request.body.secret
@param {String} request.body.client_resource_id
@param {Number String} req.body.last_ledger_sequence
- last ledger sequence that this payment can en... | [
"Submit",
"a",
"payment",
"in",
"the",
"ripple",
"-",
"rest",
"format",
"."
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/payments.js#L81-L131 | train |
ripple/ripple-rest | api/payments.js | getPayment | function getPayment(account, identifier, callback) {
var self = this;
validate.address(account);
validate.paymentIdentifier(identifier);
// If the transaction was not in the outgoing_transactions db,
// get it from rippled
function getTransaction(_callback) {
transactions.getTransaction(self, account,... | javascript | function getPayment(account, identifier, callback) {
var self = this;
validate.address(account);
validate.paymentIdentifier(identifier);
// If the transaction was not in the outgoing_transactions db,
// get it from rippled
function getTransaction(_callback) {
transactions.getTransaction(self, account,... | [
"function",
"getPayment",
"(",
"account",
",",
"identifier",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"validate",
".",
"address",
"(",
"account",
")",
";",
"validate",
".",
"paymentIdentifier",
"(",
"identifier",
")",
";",
"// If the trans... | Retrieve the details of a particular payment from the Remote or
the local database and return it in the ripple-rest Payment format.
@param {Remote} remote
@param {/lib/db-interface} dbinterface
@param {RippleAddress} req.params.account
@param {Hex-encoded String|ASCII printable character String}
req.params.identifier | [
"Retrieve",
"the",
"details",
"of",
"a",
"particular",
"payment",
"from",
"the",
"Remote",
"or",
"the",
"local",
"database",
"and",
"return",
"it",
"in",
"the",
"ripple",
"-",
"rest",
"Payment",
"format",
"."
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/payments.js#L143-L161 | train |
ripple/ripple-rest | api/payments.js | getAccountPayments | function getAccountPayments(account, source_account, destination_account,
direction, options, callback) {
var self = this;
function getTransactions(_callback) {
var args = {
account: account,
source_account: source_account,
destination_account: destination_account,
direction: direct... | javascript | function getAccountPayments(account, source_account, destination_account,
direction, options, callback) {
var self = this;
function getTransactions(_callback) {
var args = {
account: account,
source_account: source_account,
destination_account: destination_account,
direction: direct... | [
"function",
"getAccountPayments",
"(",
"account",
",",
"source_account",
",",
"destination_account",
",",
"direction",
",",
"options",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"function",
"getTransactions",
"(",
"_callback",
")",
"{",
"var",
... | Retrieve the details of multiple payments from the Remote
and the local database.
This function calls transactions.getAccountTransactions
recursively to retrieve results_per_page number of transactions
and filters the results by type "payment", along with the other
client-specified parameters.
@param {Remote} remote
... | [
"Retrieve",
"the",
"details",
"of",
"multiple",
"payments",
"from",
"the",
"Remote",
"and",
"the",
"local",
"database",
"."
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/payments.js#L185-L244 | train |
ripple/ripple-rest | api/orders.js | getOrders | function getOrders(account, options, callback) {
var self = this;
validate.address(account);
validate.options(options);
function getAccountOrders(prevResult) {
var isAggregate = options.limit === 'all';
if (prevResult && (!isAggregate || !prevResult.marker)) {
return Promise.resolve(prevResult);... | javascript | function getOrders(account, options, callback) {
var self = this;
validate.address(account);
validate.options(options);
function getAccountOrders(prevResult) {
var isAggregate = options.limit === 'all';
if (prevResult && (!isAggregate || !prevResult.marker)) {
return Promise.resolve(prevResult);... | [
"function",
"getOrders",
"(",
"account",
",",
"options",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"validate",
".",
"address",
"(",
"account",
")",
";",
"validate",
".",
"options",
"(",
"options",
")",
";",
"function",
"getAccountOrders",... | Get orders from the ripple network
@query
@param {String} [request.query.limit]
- Set a limit to the number of results returned
@param {String} [request.query.marker]
- Used to paginate results
@param {String} [request.query.ledger]
- The ledger index to query against
- (required if request.query.marker is present)
@... | [
"Get",
"orders",
"from",
"the",
"ripple",
"network"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/orders.js#L40-L131 | train |
ripple/ripple-rest | api/orders.js | placeOrder | function placeOrder(account, order, secret, options, callback) {
var transaction = createOrderTransaction(account, order);
var converter = TxToRestConverter.parseSubmitOrderFromTx;
transact(transaction, this, secret, options, converter, callback);
} | javascript | function placeOrder(account, order, secret, options, callback) {
var transaction = createOrderTransaction(account, order);
var converter = TxToRestConverter.parseSubmitOrderFromTx;
transact(transaction, this, secret, options, converter, callback);
} | [
"function",
"placeOrder",
"(",
"account",
",",
"order",
",",
"secret",
",",
"options",
",",
"callback",
")",
"{",
"var",
"transaction",
"=",
"createOrderTransaction",
"(",
"account",
",",
"order",
")",
";",
"var",
"converter",
"=",
"TxToRestConverter",
".",
... | Submit an order to the ripple network
More information about order flags can be found at
https://ripple.com/build/transactions/#offercreate-flags
@body
@param {Order} request.body.order
- Object that holds information about the order
@param {String "buy"|"sell"} request.body.order.type
- Choose whether to submit a bu... | [
"Submit",
"an",
"order",
"to",
"the",
"ripple",
"network"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/orders.js#L162-L166 | train |
ripple/ripple-rest | api/orders.js | cancelOrder | function cancelOrder(account, sequence, secret, options, callback) {
var transaction = createOrderCancellationTransaction(account, sequence);
var converter = TxToRestConverter.parseCancelOrderFromTx;
transact(transaction, this, secret, options, converter, callback);
} | javascript | function cancelOrder(account, sequence, secret, options, callback) {
var transaction = createOrderCancellationTransaction(account, sequence);
var converter = TxToRestConverter.parseCancelOrderFromTx;
transact(transaction, this, secret, options, converter, callback);
} | [
"function",
"cancelOrder",
"(",
"account",
",",
"sequence",
",",
"secret",
",",
"options",
",",
"callback",
")",
"{",
"var",
"transaction",
"=",
"createOrderCancellationTransaction",
"(",
"account",
",",
"sequence",
")",
";",
"var",
"converter",
"=",
"TxToRestCo... | Cancel an order in the ripple network
@url
@param {Number String} request.params.sequence
- sequence number of order to cancel
@query
@param {String "true"|"false"} request.query.validated
- used to force request to wait until rippled has finished
validating the submitted transaction | [
"Cancel",
"an",
"order",
"in",
"the",
"ripple",
"network"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/orders.js#L180-L184 | train |
ripple/ripple-rest | api/transaction/settings.js | padValue | function padValue(value, length) {
assert.strictEqual(typeof value, 'string');
assert.strictEqual(typeof length, 'number');
var result = value;
while (result.length < length) {
result = '0' + result;
}
return result;
} | javascript | function padValue(value, length) {
assert.strictEqual(typeof value, 'string');
assert.strictEqual(typeof length, 'number');
var result = value;
while (result.length < length) {
result = '0' + result;
}
return result;
} | [
"function",
"padValue",
"(",
"value",
",",
"length",
")",
"{",
"assert",
".",
"strictEqual",
"(",
"typeof",
"value",
",",
"'string'",
")",
";",
"assert",
".",
"strictEqual",
"(",
"typeof",
"length",
",",
"'number'",
")",
";",
"var",
"result",
"=",
"value... | Pad the value of a fixed-length field
@param {String} value
@param {Number} length
@return {String} | [
"Pad",
"the",
"value",
"of",
"a",
"fixed",
"-",
"length",
"field"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/transaction/settings.js#L23-L34 | train |
ripple/ripple-rest | api/transaction/settings.js | setTransactionIntFlags | function setTransactionIntFlags(transaction, input, flags) {
for (var flagName in flags) {
var flag = flags[flagName];
if (!input.hasOwnProperty(flag.name)) {
continue;
}
var value = input[flag.name];
if (value) {
transaction.tx_json.SetFlag = flag.value;
} else {
transact... | javascript | function setTransactionIntFlags(transaction, input, flags) {
for (var flagName in flags) {
var flag = flags[flagName];
if (!input.hasOwnProperty(flag.name)) {
continue;
}
var value = input[flag.name];
if (value) {
transaction.tx_json.SetFlag = flag.value;
} else {
transact... | [
"function",
"setTransactionIntFlags",
"(",
"transaction",
",",
"input",
",",
"flags",
")",
"{",
"for",
"(",
"var",
"flagName",
"in",
"flags",
")",
"{",
"var",
"flag",
"=",
"flags",
"[",
"flagName",
"]",
";",
"if",
"(",
"!",
"input",
".",
"hasOwnProperty"... | Set integer flags on a transaction based on input and a flag map
@param {Transaction} transaction
@param {Object} input - Object whose properties determine whether
to update the transaction's SetFlag or ClearFlag property
@param {Object} flags - Object that maps property names to transaction
integer flag values
@retu... | [
"Set",
"integer",
"flags",
"on",
"a",
"transaction",
"based",
"on",
"input",
"and",
"a",
"flag",
"map"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/transaction/settings.js#L47-L63 | train |
ripple/ripple-rest | api/transaction/settings.js | setTransactionFields | function setTransactionFields(transaction, input, fieldSchema) {
for (var fieldName in fieldSchema) {
var field = fieldSchema[fieldName];
var value = input[field.name];
if (typeof value === 'undefined') {
continue;
}
// The value required to clear an account root field varies
if (value... | javascript | function setTransactionFields(transaction, input, fieldSchema) {
for (var fieldName in fieldSchema) {
var field = fieldSchema[fieldName];
var value = input[field.name];
if (typeof value === 'undefined') {
continue;
}
// The value required to clear an account root field varies
if (value... | [
"function",
"setTransactionFields",
"(",
"transaction",
",",
"input",
",",
"fieldSchema",
")",
"{",
"for",
"(",
"var",
"fieldName",
"in",
"fieldSchema",
")",
"{",
"var",
"field",
"=",
"fieldSchema",
"[",
"fieldName",
"]",
";",
"var",
"value",
"=",
"input",
... | Set fields on a transaction based on input and fields schema object
@param {Transaction} transaction
@param {Object} input - Object whose properties are used to set fields on
the transaction
@param {Object} fieldSchema - Object that holds the schema of each field
@returns undefined | [
"Set",
"fields",
"on",
"a",
"transaction",
"based",
"on",
"input",
"and",
"fields",
"schema",
"object"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/transaction/settings.js#L75-L112 | train |
ripple/ripple-rest | api/lib/tx-to-rest-converter.js | renameCounterpartyToIssuerInOrderChanges | function renameCounterpartyToIssuerInOrderChanges(orderChanges) {
return _.mapValues(orderChanges, function(changes) {
return _.map(changes, function(change) {
return utils.renameCounterpartyToIssuerInOrder(change);
});
});
} | javascript | function renameCounterpartyToIssuerInOrderChanges(orderChanges) {
return _.mapValues(orderChanges, function(changes) {
return _.map(changes, function(change) {
return utils.renameCounterpartyToIssuerInOrder(change);
});
});
} | [
"function",
"renameCounterpartyToIssuerInOrderChanges",
"(",
"orderChanges",
")",
"{",
"return",
"_",
".",
"mapValues",
"(",
"orderChanges",
",",
"function",
"(",
"changes",
")",
"{",
"return",
"_",
".",
"map",
"(",
"changes",
",",
"function",
"(",
"change",
"... | This is just to support the legacy naming of "counterparty", this function should be removed when "issuer" is eliminated | [
"This",
"is",
"just",
"to",
"support",
"the",
"legacy",
"naming",
"of",
"counterparty",
"this",
"function",
"should",
"be",
"removed",
"when",
"issuer",
"is",
"eliminated"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/lib/tx-to-rest-converter.js#L14-L20 | train |
ripple/ripple-rest | api/lib/tx-to-rest-converter.js | parseFlagsFromResponse | function parseFlagsFromResponse(responseFlags, flags) {
var parsedFlags = {};
for (var flagName in flags) {
var flag = flags[flagName];
parsedFlags[flag.name] = Boolean(responseFlags & flag.value);
}
return parsedFlags;
} | javascript | function parseFlagsFromResponse(responseFlags, flags) {
var parsedFlags = {};
for (var flagName in flags) {
var flag = flags[flagName];
parsedFlags[flag.name] = Boolean(responseFlags & flag.value);
}
return parsedFlags;
} | [
"function",
"parseFlagsFromResponse",
"(",
"responseFlags",
",",
"flags",
")",
"{",
"var",
"parsedFlags",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"flagName",
"in",
"flags",
")",
"{",
"var",
"flag",
"=",
"flags",
"[",
"flagName",
"]",
";",
"parsedFlags",
"... | Helper that parses bit flags from ripple response
@param {Number} responseFlags - Integer flag on the ripple response
@param {Object} flags - Object with parameter name and bit flag value pairs
@returns {Object} parsedFlags - Object with parameter name and boolean
flags depending on response flag | [
"Helper",
"that",
"parses",
"bit",
"flags",
"from",
"ripple",
"response"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/lib/tx-to-rest-converter.js#L39-L48 | train |
ripple/ripple-rest | api/lib/tx-to-rest-converter.js | parseOrderFromTx | function parseOrderFromTx(tx, options) {
if (!options.account) {
throw new Error('Internal Error. must supply options.account');
}
if (tx.TransactionType !== 'OfferCreate'
&& tx.TransactionType !== 'OfferCancel') {
throw new Error('Invalid parameter: identifier. The transaction '
+ 'correspond... | javascript | function parseOrderFromTx(tx, options) {
if (!options.account) {
throw new Error('Internal Error. must supply options.account');
}
if (tx.TransactionType !== 'OfferCreate'
&& tx.TransactionType !== 'OfferCancel') {
throw new Error('Invalid parameter: identifier. The transaction '
+ 'correspond... | [
"function",
"parseOrderFromTx",
"(",
"tx",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"account",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Internal Error. must supply options.account'",
")",
";",
"}",
"if",
"(",
"tx",
".",
"TransactionType",
"... | Convert an OfferCreate or OfferCancel transaction in rippled tx format
to a ripple-rest order_change
@param {Object} tx
@param {Object} options
@param {String} options.account - The account to use as perspective when
parsing the transaction.
@returns {Promise.<Object,Error>} - resolves to a parsed OrderChange
transac... | [
"Convert",
"an",
"OfferCreate",
"or",
"OfferCancel",
"transaction",
"in",
"rippled",
"tx",
"format",
"to",
"a",
"ripple",
"-",
"rest",
"order_change"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/lib/tx-to-rest-converter.js#L181-L248 | train |
ripple/ripple-rest | api/lib/tx-to-rest-converter.js | parsePaymentsFromPathFind | function parsePaymentsFromPathFind(pathfindResults) {
return pathfindResults.alternatives.map(function(alternative) {
return {
source_account: pathfindResults.source_account,
source_tag: '',
source_amount: (typeof alternative.source_amount === 'string' ?
{
value: utils.dropsToXrp(a... | javascript | function parsePaymentsFromPathFind(pathfindResults) {
return pathfindResults.alternatives.map(function(alternative) {
return {
source_account: pathfindResults.source_account,
source_tag: '',
source_amount: (typeof alternative.source_amount === 'string' ?
{
value: utils.dropsToXrp(a... | [
"function",
"parsePaymentsFromPathFind",
"(",
"pathfindResults",
")",
"{",
"return",
"pathfindResults",
".",
"alternatives",
".",
"map",
"(",
"function",
"(",
"alternative",
")",
"{",
"return",
"{",
"source_account",
":",
"pathfindResults",
".",
"source_account",
",... | Convert the pathfind results returned from rippled into an
array of payments in the ripple-rest format. The client should be
able to submit any of the payments in the array back to ripple-rest.
@param {rippled Pathfind results} pathfindResults
@param {Amount} options.destination_amount Since this is not returned by
ri... | [
"Convert",
"the",
"pathfind",
"results",
"returned",
"from",
"rippled",
"into",
"an",
"array",
"of",
"payments",
"in",
"the",
"ripple",
"-",
"rest",
"format",
".",
"The",
"client",
"should",
"be",
"able",
"to",
"submit",
"any",
"of",
"the",
"payments",
"in... | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/lib/tx-to-rest-converter.js#L265-L304 | train |
ripple/ripple-rest | api/trustlines.js | addTrustLine | function addTrustLine(account, trustline, secret, options, callback) {
var transaction = createTrustLineTransaction(account, trustline);
var converter = TxToRestConverter.parseTrustResponseFromTx;
transact(transaction, this, secret, options, converter, callback);
} | javascript | function addTrustLine(account, trustline, secret, options, callback) {
var transaction = createTrustLineTransaction(account, trustline);
var converter = TxToRestConverter.parseTrustResponseFromTx;
transact(transaction, this, secret, options, converter, callback);
} | [
"function",
"addTrustLine",
"(",
"account",
",",
"trustline",
",",
"secret",
",",
"options",
",",
"callback",
")",
"{",
"var",
"transaction",
"=",
"createTrustLineTransaction",
"(",
"account",
",",
"trustline",
")",
";",
"var",
"converter",
"=",
"TxToRestConvert... | Grant a trustline to a counterparty
@body
@param {Trustline} request.body.trustline
@param {String} request.body.secret
@query
@param {String "true"|"false"} request.query.validated Used to force request
to wait until rippled has finished validating the submitted transaction | [
"Grant",
"a",
"trustline",
"to",
"a",
"counterparty"
] | ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8 | https://github.com/ripple/ripple-rest/blob/ff295cd1ea9641813369b02ba75bb3bf5ef4c9b8/api/trustlines.js#L149-L153 | train |
RiotGear/rg | dependencies/js/iframify.js | getStylingNodes | function getStylingNodes (selector) {
if (typeof queryCache[selector] === 'undefined') {
queryCache[selector] = Array.prototype.map.call(
document.querySelectorAll(selector),
function (stylesheet) {
return stylesheet.outerHTML;
}
).join('');
}
return queryCache... | javascript | function getStylingNodes (selector) {
if (typeof queryCache[selector] === 'undefined') {
queryCache[selector] = Array.prototype.map.call(
document.querySelectorAll(selector),
function (stylesheet) {
return stylesheet.outerHTML;
}
).join('');
}
return queryCache... | [
"function",
"getStylingNodes",
"(",
"selector",
")",
"{",
"if",
"(",
"typeof",
"queryCache",
"[",
"selector",
"]",
"===",
"'undefined'",
")",
"{",
"queryCache",
"[",
"selector",
"]",
"=",
"Array",
".",
"prototype",
".",
"map",
".",
"call",
"(",
"document",... | Get the styling nodes to inject in the head of the embedded document
@param {String} selector
@return {String} | [
"Get",
"the",
"styling",
"nodes",
"to",
"inject",
"in",
"the",
"head",
"of",
"the",
"embedded",
"document"
] | 0ff22318073dc475b763f50bb0e9c8d585df9334 | https://github.com/RiotGear/rg/blob/0ff22318073dc475b763f50bb0e9c8d585df9334/dependencies/js/iframify.js#L14-L25 | train |
RiotGear/rg | dependencies/js/iframify.js | getIframeContentForNode | function getIframeContentForNode (node, options) {
return '<!doctype html>' +
'<html ' + options.htmlAttr + '>' +
'<head>' +
options.metaCharset +
options.metaViewport +
options.stylesheets +
options.styles +
'</head>' +
'<body ' + options.bodyAttr + '>' +
... | javascript | function getIframeContentForNode (node, options) {
return '<!doctype html>' +
'<html ' + options.htmlAttr + '>' +
'<head>' +
options.metaCharset +
options.metaViewport +
options.stylesheets +
options.styles +
'</head>' +
'<body ' + options.bodyAttr + '>' +
... | [
"function",
"getIframeContentForNode",
"(",
"node",
",",
"options",
")",
"{",
"return",
"'<!doctype html>'",
"+",
"'<html '",
"+",
"options",
".",
"htmlAttr",
"+",
"'>'",
"+",
"'<head>'",
"+",
"options",
".",
"metaCharset",
"+",
"options",
".",
"metaViewport",
... | Get the content for the iframified version of a node.
@param {HTMLElement} node
@param {Object} options
@return {String} | [
"Get",
"the",
"content",
"for",
"the",
"iframified",
"version",
"of",
"a",
"node",
"."
] | 0ff22318073dc475b763f50bb0e9c8d585df9334 | https://github.com/RiotGear/rg/blob/0ff22318073dc475b763f50bb0e9c8d585df9334/dependencies/js/iframify.js#L34-L47 | train |
RiotGear/rg | dependencies/js/iframify.js | formatAttributes | function formatAttributes (attrObj) {
var attributes = [];
for (var attribute in attrObj) {
attributes.push(attribute + '="' + attrObj[attribute] + '"');
}
return attributes.join(' ');
} | javascript | function formatAttributes (attrObj) {
var attributes = [];
for (var attribute in attrObj) {
attributes.push(attribute + '="' + attrObj[attribute] + '"');
}
return attributes.join(' ');
} | [
"function",
"formatAttributes",
"(",
"attrObj",
")",
"{",
"var",
"attributes",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"attribute",
"in",
"attrObj",
")",
"{",
"attributes",
".",
"push",
"(",
"attribute",
"+",
"'=\"'",
"+",
"attrObj",
"[",
"attribute",
"]"... | Format an object of attributes into a HTML string
@param {Object} attrObj
@return {String} | [
"Format",
"an",
"object",
"of",
"attributes",
"into",
"a",
"HTML",
"string"
] | 0ff22318073dc475b763f50bb0e9c8d585df9334 | https://github.com/RiotGear/rg/blob/0ff22318073dc475b763f50bb0e9c8d585df9334/dependencies/js/iframify.js#L55-L63 | train |
RiotGear/rg | dependencies/js/iframify.js | iframify | function iframify (node, options) {
options = getOptions(options);
var iframe = document.createElement('iframe');
var html = getIframeContentForNode(node, options);
iframe.srcdoc = html;
if (!('srcdoc' in iframe)) {
console.log(
'Your browser does not support the `srcdoc` attribute o... | javascript | function iframify (node, options) {
options = getOptions(options);
var iframe = document.createElement('iframe');
var html = getIframeContentForNode(node, options);
iframe.srcdoc = html;
if (!('srcdoc' in iframe)) {
console.log(
'Your browser does not support the `srcdoc` attribute o... | [
"function",
"iframify",
"(",
"node",
",",
"options",
")",
"{",
"options",
"=",
"getOptions",
"(",
"options",
")",
";",
"var",
"iframe",
"=",
"document",
".",
"createElement",
"(",
"'iframe'",
")",
";",
"var",
"html",
"=",
"getIframeContentForNode",
"(",
"n... | Transform a collection of nodes into an iframe version of themselves
including all the styles they need to perform correctly.
@param {HTMLElement} nodes
@param {Object} options
@return undefined | [
"Transform",
"a",
"collection",
"of",
"nodes",
"into",
"an",
"iframe",
"version",
"of",
"themselves",
"including",
"all",
"the",
"styles",
"they",
"need",
"to",
"perform",
"correctly",
"."
] | 0ff22318073dc475b763f50bb0e9c8d585df9334 | https://github.com/RiotGear/rg/blob/0ff22318073dc475b763f50bb0e9c8d585df9334/dependencies/js/iframify.js#L103-L128 | train |
adrienjoly/playemjs | playem.js | Loader | function Loader () {
var FINAL_STATES = {'loaded': true, 'complete': true, 4: true}
var head = document.getElementsByTagName('head')[0]
var pending = {}
var counter = 0
return {
/**
* @private
* @callback dataCallback
* @memberof Loader.prototype
* @param {object|string} data JSON obje... | javascript | function Loader () {
var FINAL_STATES = {'loaded': true, 'complete': true, 4: true}
var head = document.getElementsByTagName('head')[0]
var pending = {}
var counter = 0
return {
/**
* @private
* @callback dataCallback
* @memberof Loader.prototype
* @param {object|string} data JSON obje... | [
"function",
"Loader",
"(",
")",
"{",
"var",
"FINAL_STATES",
"=",
"{",
"'loaded'",
":",
"true",
",",
"'complete'",
":",
"true",
",",
"4",
":",
"true",
"}",
"var",
"head",
"=",
"document",
".",
"getElementsByTagName",
"(",
"'head'",
")",
"[",
"0",
"]",
... | This class provides helpers to load JavaScript resources and JSON data.
@class Loader | [
"This",
"class",
"provides",
"helpers",
"to",
"load",
"JavaScript",
"resources",
"and",
"JSON",
"data",
"."
] | fe696cc318fb904d9f16515b9a73e56dc4c6198f | https://github.com/adrienjoly/playemjs/blob/fe696cc318fb904d9f16515b9a73e56dc4c6198f/playem.js#L16-L116 | train |
adrienjoly/playemjs | playem.js | createEventHandlers | function createEventHandlers (playemFunctions) {
var eventHandlers = {
onApiReady: function (player) {
// console.log(player.label + " api ready");
if (whenReady && player == whenReady.player) { whenReady.fct() }
if (--playersToLoad == 0) { that.emit('onReady') }
},
... | javascript | function createEventHandlers (playemFunctions) {
var eventHandlers = {
onApiReady: function (player) {
// console.log(player.label + " api ready");
if (whenReady && player == whenReady.player) { whenReady.fct() }
if (--playersToLoad == 0) { that.emit('onReady') }
},
... | [
"function",
"createEventHandlers",
"(",
"playemFunctions",
")",
"{",
"var",
"eventHandlers",
"=",
"{",
"onApiReady",
":",
"function",
"(",
"player",
")",
"{",
"// console.log(player.label + \" api ready\");",
"if",
"(",
"whenReady",
"&&",
"player",
"==",
"whenReady",
... | functions that are called by players => to propagate to client | [
"functions",
"that",
"are",
"called",
"by",
"players",
"=",
">",
"to",
"propagate",
"to",
"client"
] | fe696cc318fb904d9f16515b9a73e56dc4c6198f | https://github.com/adrienjoly/playemjs/blob/fe696cc318fb904d9f16515b9a73e56dc4c6198f/playem.js#L316-L405 | train |
peteward44/node-svn-ultimate | index.js | function( url, dir, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
options = options || {};
addExtraOptions( [ 'force', 'quiet', 'revision', 'depth', 'ignoreExternals' ], options );
var dirPath = dir;
if(typeof options.cwd !== 'undefined')
dirPath = pa... | javascript | function( url, dir, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
options = options || {};
addExtraOptions( [ 'force', 'quiet', 'revision', 'depth', 'ignoreExternals' ], options );
var dirPath = dir;
if(typeof options.cwd !== 'undefined')
dirPath = pa... | [
"function",
"(",
"url",
",",
"dir",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}"... | Checks out a repository to a working copy
@function checkout
@memberof commands
@param {string} url - Repository URL
@param {string} dir - Working copy dir
@param {object} [options] - Options object
@param {function} [callback] - Complete callback
@alias co | [
"Checks",
"out",
"a",
"repository",
"to",
"a",
"working",
"copy"
] | 06d1aeec895c737265c1689520b63aeaf7eca729 | https://github.com/peteward44/node-svn-ultimate/blob/06d1aeec895c737265c1689520b63aeaf7eca729/index.js#L190-L205 | train | |
peteward44/node-svn-ultimate | index.js | function( files, options, callback ) {
if ( !Array.isArray( files ) ) {
files = [files];
}
if ( typeof options === 'function' ) {
callback = options;
options = null;
} else if ( typeof options === 'string' ) {
options = { msg: options };
}
options = options || {};
addExtraOptions( [ 'quiet', 'depth', 'ms... | javascript | function( files, options, callback ) {
if ( !Array.isArray( files ) ) {
files = [files];
}
if ( typeof options === 'function' ) {
callback = options;
options = null;
} else if ( typeof options === 'string' ) {
options = { msg: options };
}
options = options || {};
addExtraOptions( [ 'quiet', 'depth', 'ms... | [
"function",
"(",
"files",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"files",
")",
")",
"{",
"files",
"=",
"[",
"files",
"]",
";",
"}",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"... | Commits a working copy to a repository
@function commit
@memberof commands
@param {Array|string} files - Array of files / folders to commit
@param {object} [options] - Options object
@param {function} [callback] - Complete callback
@alias ci | [
"Commits",
"a",
"working",
"copy",
"to",
"a",
"repository"
] | 06d1aeec895c737265c1689520b63aeaf7eca729 | https://github.com/peteward44/node-svn-ultimate/blob/06d1aeec895c737265c1689520b63aeaf7eca729/index.js#L280-L293 | train | |
peteward44/node-svn-ultimate | index.js | function( url, wc, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
options = options || {};
executeSvn( [ 'relocate', url, wc ], options, callback );
} | javascript | function( url, wc, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
options = options || {};
executeSvn( [ 'relocate', url, wc ], options, callback );
} | [
"function",
"(",
"url",
",",
"wc",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",... | Relocates an svn working copy
@function relocate
@memberof commands
@param {string} url - Relocation URL
@param {string} wc - Working copy to relocate
@param {object} [options] - Options object
@param {function} [callback] - Complete callback | [
"Relocates",
"an",
"svn",
"working",
"copy"
] | 06d1aeec895c737265c1689520b63aeaf7eca729 | https://github.com/peteward44/node-svn-ultimate/blob/06d1aeec895c737265c1689520b63aeaf7eca729/index.js#L706-L713 | train | |
peteward44/node-svn-ultimate | index.js | function( wc, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
options = options || {};
addExtraOptions( [ 'quiet', 'depth' ], options );
executeSvnXml( [ 'status', wc ], options, callback );
} | javascript | function( wc, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
options = options || {};
addExtraOptions( [ 'quiet', 'depth' ], options );
executeSvnXml( [ 'status', wc ], options, callback );
} | [
"function",
"(",
"wc",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"addEx... | Performs an svn status command on a working copy
@function status
@memberof commands
@param {string} wc - Working copy target
@param {object} [options] - Options object
@param {function} [callback] - Complete callback
@alias stat
@alias st | [
"Performs",
"an",
"svn",
"status",
"command",
"on",
"a",
"working",
"copy"
] | 06d1aeec895c737265c1689520b63aeaf7eca729 | https://github.com/peteward44/node-svn-ultimate/blob/06d1aeec895c737265c1689520b63aeaf7eca729/index.js#L748-L756 | train | |
peteward44/node-svn-ultimate | index.js | function( wcs, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
if ( !Array.isArray( wcs ) ) {
wcs = [wcs];
}
options = options || {};
addExtraOptions( [ 'force', 'quiet', 'revision', 'depth', 'ignoreExternals' ], options );
executeSvn( [ 'update' ].concat(... | javascript | function( wcs, options, callback ) {
if ( typeof options === 'function' ) {
callback = options;
options = null;
}
if ( !Array.isArray( wcs ) ) {
wcs = [wcs];
}
options = options || {};
addExtraOptions( [ 'force', 'quiet', 'revision', 'depth', 'ignoreExternals' ], options );
executeSvn( [ 'update' ].concat(... | [
"function",
"(",
"wcs",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"wcs",
... | Updates an svn working copy
@function update
@memberof commands
@param {Array|string} wcs - Working copy targets
@param {object} [options] - Options object
@param {function} [callback] - Complete callback
@alias up | [
"Updates",
"an",
"svn",
"working",
"copy"
] | 06d1aeec895c737265c1689520b63aeaf7eca729 | https://github.com/peteward44/node-svn-ultimate/blob/06d1aeec895c737265c1689520b63aeaf7eca729/index.js#L809-L820 | train | |
peteward44/node-svn-ultimate | index.js | function( target, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
info( target, options, function( err, data ) {
var rev;
if ( !err ) {
var revString;
if ( options.lastChangeRevision ) {
if ( data && data.entry && data.ent... | javascript | function( target, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
info( target, options, function( err, data ) {
var rev;
if ( !err ) {
var revString;
if ( options.lastChangeRevision ) {
if ( data && data.entry && data.ent... | [
"function",
"(",
"target",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"\"function\"",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
";",
... | 'lastChangeRevision' option returns the last commit revision, instead of the working copy revision Gets head revision of a given URL
@function getRevision
@memberof util
@param {string} target - Target URL
@param {object} [options] - Options object
@param {function} [callback] - Complete callback | [
"lastChangeRevision",
"option",
"returns",
"the",
"last",
"commit",
"revision",
"instead",
"of",
"the",
"working",
"copy",
"revision",
"Gets",
"head",
"revision",
"of",
"a",
"given",
"URL"
] | 06d1aeec895c737265c1689520b63aeaf7eca729 | https://github.com/peteward44/node-svn-ultimate/blob/06d1aeec895c737265c1689520b63aeaf7eca729/index.js#L929-L961 | train | |
peteward44/node-svn-ultimate | index.js | function( wcDir, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
if ( !Array.isArray( wcDir ) ) {
wcDir = [wcDir];
}
var args = [ '-n' ];
if ( options.lastChangeRevision ) {
args.push( '-c' );
}
execSvnVersion( wcDir.concat( ar... | javascript | function( wcDir, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
if ( !Array.isArray( wcDir ) ) {
wcDir = [wcDir];
}
var args = [ '-n' ];
if ( options.lastChangeRevision ) {
args.push( '-c' );
}
execSvnVersion( wcDir.concat( ar... | [
"function",
"(",
"wcDir",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"\"function\"",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"... | Gets the revision of a working copy.
@function getWorkingCopyRevision
@memberof util
@param {string} wcDir - Working copy folder
@param {object} [options] - Options object
@param {function} [callback] - Complete callback | [
"Gets",
"the",
"revision",
"of",
"a",
"working",
"copy",
"."
] | 06d1aeec895c737265c1689520b63aeaf7eca729 | https://github.com/peteward44/node-svn-ultimate/blob/06d1aeec895c737265c1689520b63aeaf7eca729/index.js#L972-L1009 | train | |
peteward44/node-svn-ultimate | index.js | function( url ) {
var trunkMatch = url.match( /(.*)\/(trunk|branches|tags)\/*(.*)\/*(.*)$/i );
if ( trunkMatch ) {
var rootUrl = trunkMatch[1];
var projectName = rootUrl.match( /\/([^\/]+)$/ )[1];
return {
rootUrl: rootUrl,
projectName: projectName,
type: trunkMatch[2],
typeName: trunkMatch[3],
t... | javascript | function( url ) {
var trunkMatch = url.match( /(.*)\/(trunk|branches|tags)\/*(.*)\/*(.*)$/i );
if ( trunkMatch ) {
var rootUrl = trunkMatch[1];
var projectName = rootUrl.match( /\/([^\/]+)$/ )[1];
return {
rootUrl: rootUrl,
projectName: projectName,
type: trunkMatch[2],
typeName: trunkMatch[3],
t... | [
"function",
"(",
"url",
")",
"{",
"var",
"trunkMatch",
"=",
"url",
".",
"match",
"(",
"/",
"(.*)\\/(trunk|branches|tags)\\/*(.*)\\/*(.*)$",
"/",
"i",
")",
";",
"if",
"(",
"trunkMatch",
")",
"{",
"var",
"rootUrl",
"=",
"trunkMatch",
"[",
"1",
"]",
";",
"v... | Parse a url for an SVN project repository and breaks it apart
@function parseUrl
@memberof util
@param {string} url - URL to parse
@returns {object} | [
"Parse",
"a",
"url",
"for",
"an",
"SVN",
"project",
"repository",
"and",
"breaks",
"it",
"apart"
] | 06d1aeec895c737265c1689520b63aeaf7eca729 | https://github.com/peteward44/node-svn-ultimate/blob/06d1aeec895c737265c1689520b63aeaf7eca729/index.js#L1019-L1035 | train | |
peteward44/node-svn-ultimate | index.js | function( url, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
var tagsUrl = parseUrl( url ).tagsUrl;
list( tagsUrl, options, function( err, data ) {
var result = [];
if ( !err && data && data.list && data.list.entry ) {
if ( Ar... | javascript | function( url, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
var tagsUrl = parseUrl( url ).tagsUrl;
list( tagsUrl, options, function( err, data ) {
var result = [];
if ( !err && data && data.list && data.list.entry ) {
if ( Ar... | [
"function",
"(",
"url",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"\"function\"",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"va... | Gets all available tags for the given svn URL
@function getTags
@memberof util
@param {string} url - Project URL to get tags for
@param {object} [options] - Options object
@param {function} [callback] - Complete callback | [
"Gets",
"all",
"available",
"tags",
"for",
"the",
"given",
"svn",
"URL"
] | 06d1aeec895c737265c1689520b63aeaf7eca729 | https://github.com/peteward44/node-svn-ultimate/blob/06d1aeec895c737265c1689520b63aeaf7eca729/index.js#L1045-L1067 | train | |
peteward44/node-svn-ultimate | index.js | function( url, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
getTags( url, options, function( err, tagArray ) {
var latest;
if ( !err && Array.isArray( tagArray ) && tagArray.length > 0 ) {
tagArray.sort( function( a, b ) {
... | javascript | function( url, options, callback ) {
if ( typeof options === "function" ) {
callback = options;
options = null;
}
options = options || {};
getTags( url, options, function( err, tagArray ) {
var latest;
if ( !err && Array.isArray( tagArray ) && tagArray.length > 0 ) {
tagArray.sort( function( a, b ) {
... | [
"function",
"(",
"url",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"\"function\"",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"ge... | Uses node's semver package to work out the latest tag value
@function getLatestTag
@memberof util
@param {string} url - Project URL to get latest tag for
@param {object} options - Options object
@param {function} [callback] - Complete callback | [
"Uses",
"node",
"s",
"semver",
"package",
"to",
"work",
"out",
"the",
"latest",
"tag",
"value"
] | 06d1aeec895c737265c1689520b63aeaf7eca729 | https://github.com/peteward44/node-svn-ultimate/blob/06d1aeec895c737265c1689520b63aeaf7eca729/index.js#L1078-L1099 | train | |
peteward44/node-svn-ultimate | index.js | function( options ) {
this._options = options || {};
this._commands = [];
this._options.tempFolder = this._options.tempFolder || path.join( os.tmpdir(), 'mucc_' + uuid.v4() );
} | javascript | function( options ) {
this._options = options || {};
this._commands = [];
this._options.tempFolder = this._options.tempFolder || path.join( os.tmpdir(), 'mucc_' + uuid.v4() );
} | [
"function",
"(",
"options",
")",
"{",
"this",
".",
"_options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"_commands",
"=",
"[",
"]",
";",
"this",
".",
"_options",
".",
"tempFolder",
"=",
"this",
".",
"_options",
".",
"tempFolder",
"||",
"path... | Helper object for using SVNMUCC | [
"Helper",
"object",
"for",
"using",
"SVNMUCC"
] | 06d1aeec895c737265c1689520b63aeaf7eca729 | https://github.com/peteward44/node-svn-ultimate/blob/06d1aeec895c737265c1689520b63aeaf7eca729/index.js#L1137-L1141 | train | |
titon/toolkit | js/components/stalker.js | function(element, options) {
element = this.setElement(element);
options = this.setOptions(options);
if (!options.target || !options.marker) {
throw new Error('A marker and target is required');
}
if (element.css('overflow') === 'auto') {
this.container ... | javascript | function(element, options) {
element = this.setElement(element);
options = this.setOptions(options);
if (!options.target || !options.marker) {
throw new Error('A marker and target is required');
}
if (element.css('overflow') === 'auto') {
this.container ... | [
"function",
"(",
"element",
",",
"options",
")",
"{",
"element",
"=",
"this",
".",
"setElement",
"(",
"element",
")",
";",
"options",
"=",
"this",
".",
"setOptions",
"(",
"options",
")",
";",
"if",
"(",
"!",
"options",
".",
"target",
"||",
"!",
"opti... | Initialize the stalker.
@param {jQuery} element
@param {Object} [options] | [
"Initialize",
"the",
"stalker",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/stalker.js#L36-L58 | train | |
titon/toolkit | js/components/stalker.js | function(marker, type) {
marker = $(marker);
// Stop all the unnecessary processing
if (type === 'activate' && marker.hasClass('is-stalked')) {
return;
} else if (type === 'deactivate' && !marker.hasClass('is-stalked')) {
return;
}
var options = ... | javascript | function(marker, type) {
marker = $(marker);
// Stop all the unnecessary processing
if (type === 'activate' && marker.hasClass('is-stalked')) {
return;
} else if (type === 'deactivate' && !marker.hasClass('is-stalked')) {
return;
}
var options = ... | [
"function",
"(",
"marker",
",",
"type",
")",
"{",
"marker",
"=",
"$",
"(",
"marker",
")",
";",
"// Stop all the unnecessary processing",
"if",
"(",
"type",
"===",
"'activate'",
"&&",
"marker",
".",
"hasClass",
"(",
"'is-stalked'",
")",
")",
"{",
"return",
... | Either active or deactivate a target based on the marker.
@param {Element} marker
@param {String} type | [
"Either",
"active",
"or",
"deactivate",
"a",
"target",
"based",
"on",
"the",
"marker",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/stalker.js#L92-L128 | train | |
titon/toolkit | js/components/stalker.js | function() {
var isWindow = this.container.is(window),
eTop = this.element.offset().top,
offset,
offsets = [];
if (this.element.css('overflow') === 'auto' && !this.element.is('body')) {
this.element[0].scrollTop = 0; // Set scroll to top so offsets are co... | javascript | function() {
var isWindow = this.container.is(window),
eTop = this.element.offset().top,
offset,
offsets = [];
if (this.element.css('overflow') === 'auto' && !this.element.is('body')) {
this.element[0].scrollTop = 0; // Set scroll to top so offsets are co... | [
"function",
"(",
")",
"{",
"var",
"isWindow",
"=",
"this",
".",
"container",
".",
"is",
"(",
"window",
")",
",",
"eTop",
"=",
"this",
".",
"element",
".",
"offset",
"(",
")",
".",
"top",
",",
"offset",
",",
"offsets",
"=",
"[",
"]",
";",
"if",
... | Gather the targets and markers used for stalking. | [
"Gather",
"the",
"targets",
"and",
"markers",
"used",
"for",
"stalking",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/stalker.js#L133-L156 | train | |
titon/toolkit | js/components/stalker.js | function() {
var scroll = this.container.scrollTop(),
offsets = this.offsets,
onlyWithin = this.options.onlyWithin,
threshold = this.options.threshold;
this.markers.each(function(index, marker) {
marker = $(marker);
var offset = offsets[index... | javascript | function() {
var scroll = this.container.scrollTop(),
offsets = this.offsets,
onlyWithin = this.options.onlyWithin,
threshold = this.options.threshold;
this.markers.each(function(index, marker) {
marker = $(marker);
var offset = offsets[index... | [
"function",
"(",
")",
"{",
"var",
"scroll",
"=",
"this",
".",
"container",
".",
"scrollTop",
"(",
")",
",",
"offsets",
"=",
"this",
".",
"offsets",
",",
"onlyWithin",
"=",
"this",
".",
"options",
".",
"onlyWithin",
",",
"threshold",
"=",
"this",
".",
... | While the element is being scrolled, notify the targets when a marker is reached.
@private | [
"While",
"the",
"element",
"is",
"being",
"scrolled",
"notify",
"the",
"targets",
"when",
"a",
"marker",
"is",
"reached",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/stalker.js#L163-L190 | train | |
titon/toolkit | js/components/matrix.js | function(element, options) {
this.setElement(element);
this.setOptions(options, this.element);
// Set events
this.addEvent('horizontalresize', 'window', $.debounce(this.onResize.bind(this)));
this.initialize();
// Render the matrix
this.refresh();
} | javascript | function(element, options) {
this.setElement(element);
this.setOptions(options, this.element);
// Set events
this.addEvent('horizontalresize', 'window', $.debounce(this.onResize.bind(this)));
this.initialize();
// Render the matrix
this.refresh();
} | [
"function",
"(",
"element",
",",
"options",
")",
"{",
"this",
".",
"setElement",
"(",
"element",
")",
";",
"this",
".",
"setOptions",
"(",
"options",
",",
"this",
".",
"element",
")",
";",
"// Set events",
"this",
".",
"addEvent",
"(",
"'horizontalresize'"... | Initialize the matrix.
@param {jQuery} element
@param {Object} [options] | [
"Initialize",
"the",
"matrix",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/matrix.js#L47-L58 | train | |
titon/toolkit | js/components/matrix.js | function() {
this.items = this.element.find('> li').each(function() {
var self = $(this);
// Cache the initial column width
self.cache('matrix-column-width', self.outerWidth());
});
if (this.options.defer) {
this._deferRender();
} else {
... | javascript | function() {
this.items = this.element.find('> li').each(function() {
var self = $(this);
// Cache the initial column width
self.cache('matrix-column-width', self.outerWidth());
});
if (this.options.defer) {
this._deferRender();
} else {
... | [
"function",
"(",
")",
"{",
"this",
".",
"items",
"=",
"this",
".",
"element",
".",
"find",
"(",
"'> li'",
")",
".",
"each",
"(",
"function",
"(",
")",
"{",
"var",
"self",
"=",
"$",
"(",
"this",
")",
";",
"// Cache the initial column width",
"self",
"... | Fetch new items and re-render the grid. | [
"Fetch",
"new",
"items",
"and",
"re",
"-",
"render",
"the",
"grid",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/matrix.js#L101-L114 | train | |
titon/toolkit | js/components/matrix.js | function() {
this._calculateColumns();
this.fireEvent('rendering');
var element = this.element,
items = this.items;
// No items
if (!items.length) {
element.removeAttr('style');
// Single column
} else if (this.colCount <= 1) {
... | javascript | function() {
this._calculateColumns();
this.fireEvent('rendering');
var element = this.element,
items = this.items;
// No items
if (!items.length) {
element.removeAttr('style');
// Single column
} else if (this.colCount <= 1) {
... | [
"function",
"(",
")",
"{",
"this",
".",
"_calculateColumns",
"(",
")",
";",
"this",
".",
"fireEvent",
"(",
"'rendering'",
")",
";",
"var",
"element",
"=",
"this",
".",
"element",
",",
"items",
"=",
"this",
".",
"items",
";",
"// No items",
"if",
"(",
... | Calculate and position items in the grid. | [
"Calculate",
"and",
"position",
"items",
"in",
"the",
"grid",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/matrix.js#L135-L161 | train | |
titon/toolkit | js/components/matrix.js | function() {
var wrapperWidth = this.element.outerWidth(),
colWidth = this.options.width,
gutter = this.options.gutter,
cols = Math.max(Math.floor(wrapperWidth / colWidth), 1),
colsWidth = (cols * (colWidth + gutter)) - gutter,
diff;
if (cols ... | javascript | function() {
var wrapperWidth = this.element.outerWidth(),
colWidth = this.options.width,
gutter = this.options.gutter,
cols = Math.max(Math.floor(wrapperWidth / colWidth), 1),
colsWidth = (cols * (colWidth + gutter)) - gutter,
diff;
if (cols ... | [
"function",
"(",
")",
"{",
"var",
"wrapperWidth",
"=",
"this",
".",
"element",
".",
"outerWidth",
"(",
")",
",",
"colWidth",
"=",
"this",
".",
"options",
".",
"width",
",",
"gutter",
"=",
"this",
".",
"options",
".",
"gutter",
",",
"cols",
"=",
"Math... | Calculate how many columns can be supported in the current resolution.
Modify the column width to account for gaps on either side.
@private | [
"Calculate",
"how",
"many",
"columns",
"can",
"be",
"supported",
"in",
"the",
"current",
"resolution",
".",
"Modify",
"the",
"column",
"width",
"to",
"account",
"for",
"gaps",
"on",
"either",
"side",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/matrix.js#L169-L191 | train | |
titon/toolkit | js/components/matrix.js | function() {
var promises = [];
this.images = this.element.find('img').each(function(index, image) {
if (image.complete) {
return; // Already loaded
}
var src = image.src,
def = $.Deferred();
image.onload = def.resolve;
... | javascript | function() {
var promises = [];
this.images = this.element.find('img').each(function(index, image) {
if (image.complete) {
return; // Already loaded
}
var src = image.src,
def = $.Deferred();
image.onload = def.resolve;
... | [
"function",
"(",
")",
"{",
"var",
"promises",
"=",
"[",
"]",
";",
"this",
".",
"images",
"=",
"this",
".",
"element",
".",
"find",
"(",
"'img'",
")",
".",
"each",
"(",
"function",
"(",
"index",
",",
"image",
")",
"{",
"if",
"(",
"image",
".",
"... | Fetch all images within the matrix and attach an onload event.
This will monitor loaded images and render once all are complete.
Uses a src swap trick to force load cached images.
@private | [
"Fetch",
"all",
"images",
"within",
"the",
"matrix",
"and",
"attach",
"an",
"onload",
"event",
".",
"This",
"will",
"monitor",
"loaded",
"images",
"and",
"render",
"once",
"all",
"are",
"complete",
".",
"Uses",
"a",
"src",
"swap",
"trick",
"to",
"force",
... | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/matrix.js#L200-L220 | train | |
titon/toolkit | js/components/matrix.js | function() {
var item,
span,
size,
l = this.items.length;
this.matrix = [];
for (var i = 0; i < l; i++) {
item = this.items.eq(i);
size = item.data('matrix-column-width');
// How many columns does this item span?
... | javascript | function() {
var item,
span,
size,
l = this.items.length;
this.matrix = [];
for (var i = 0; i < l; i++) {
item = this.items.eq(i);
size = item.data('matrix-column-width');
// How many columns does this item span?
... | [
"function",
"(",
")",
"{",
"var",
"item",
",",
"span",
",",
"size",
",",
"l",
"=",
"this",
".",
"items",
".",
"length",
";",
"this",
".",
"matrix",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"l",
";",
"i",
"++",
... | Organize the items into columns by looping over each item and calculating dimensions.
If an item spans multiple columns, account for it by filling with an empty space.
@private | [
"Organize",
"the",
"items",
"into",
"columns",
"by",
"looping",
"over",
"each",
"item",
"and",
"calculating",
"dimensions",
".",
"If",
"an",
"item",
"spans",
"multiple",
"columns",
"account",
"for",
"it",
"by",
"filling",
"with",
"an",
"empty",
"space",
"."
... | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/matrix.js#L228-L265 | train | |
titon/toolkit | js/components/matrix.js | function() {
var gutter = this.options.gutter,
items = this.matrix,
item,
span,
dir = this.options.rtl ? 'right' : 'left',
y = [], // The top position values indexed by column
c = 0, // Current column in the loop
h = 0, // Small... | javascript | function() {
var gutter = this.options.gutter,
items = this.matrix,
item,
span,
dir = this.options.rtl ? 'right' : 'left',
y = [], // The top position values indexed by column
c = 0, // Current column in the loop
h = 0, // Small... | [
"function",
"(",
")",
"{",
"var",
"gutter",
"=",
"this",
".",
"options",
".",
"gutter",
",",
"items",
"=",
"this",
".",
"matrix",
",",
"item",
",",
"span",
",",
"dir",
"=",
"this",
".",
"options",
".",
"rtl",
"?",
"'right'",
":",
"'left'",
",",
"... | Loop through the items in each column and position them absolutely.
@private | [
"Loop",
"through",
"the",
"items",
"in",
"each",
"column",
"and",
"position",
"them",
"absolutely",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/matrix.js#L272-L344 | train | |
titon/toolkit | js/components/carousel.js | function(element, options) {
var items, self = this;
element = this.setElement(element);
options = this.setOptions(options, element);
// Set animation and ARIA
element
.aria('live', options.autoCycle ? 'assertive' : 'off')
.addClass(options.animation);
... | javascript | function(element, options) {
var items, self = this;
element = this.setElement(element);
options = this.setOptions(options, element);
// Set animation and ARIA
element
.aria('live', options.autoCycle ? 'assertive' : 'off')
.addClass(options.animation);
... | [
"function",
"(",
"element",
",",
"options",
")",
"{",
"var",
"items",
",",
"self",
"=",
"this",
";",
"element",
"=",
"this",
".",
"setElement",
"(",
"element",
")",
";",
"options",
"=",
"this",
".",
"setOptions",
"(",
"options",
",",
"element",
")",
... | Initialize the carousel.
@param {jQuery} element
@param {Object} [options] | [
"Initialize",
"the",
"carousel",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/carousel.js#L59-L140 | train | |
titon/toolkit | js/components/carousel.js | function() {
this.stop();
// Go to first item
this.jump(0);
// Remove clones
var dir = this._position || 'left';
this.container.transitionend(function() {
$(this)
.addClass('no-transition')
.css(dir, 0)
.find(... | javascript | function() {
this.stop();
// Go to first item
this.jump(0);
// Remove clones
var dir = this._position || 'left';
this.container.transitionend(function() {
$(this)
.addClass('no-transition')
.css(dir, 0)
.find(... | [
"function",
"(",
")",
"{",
"this",
".",
"stop",
"(",
")",
";",
"// Go to first item",
"this",
".",
"jump",
"(",
"0",
")",
";",
"// Remove clones",
"var",
"dir",
"=",
"this",
".",
"_position",
"||",
"'left'",
";",
"this",
".",
"container",
".",
"transit... | Stop the carousel before destroying. | [
"Stop",
"the",
"carousel",
"before",
"destroying",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/carousel.js#L145-L161 | train | |
titon/toolkit | js/components/carousel.js | function() {
if (this.options.animation === 'fade') {
return;
}
var dimension = this._dimension, // height or width
containerSize = 0,
sizes = [];
this.container.removeAttr('style');
this.items.each(function() {
var item = $(this... | javascript | function() {
if (this.options.animation === 'fade') {
return;
}
var dimension = this._dimension, // height or width
containerSize = 0,
sizes = [];
this.container.removeAttr('style');
this.items.each(function() {
var item = $(this... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"animation",
"===",
"'fade'",
")",
"{",
"return",
";",
"}",
"var",
"dimension",
"=",
"this",
".",
"_dimension",
",",
"// height or width",
"containerSize",
"=",
"0",
",",
"sizes",
"=",
... | Calculate the widths or heights for the items, the wrapper, and the cycle. | [
"Calculate",
"the",
"widths",
"or",
"heights",
"for",
"the",
"items",
"the",
"wrapper",
"and",
"the",
"cycle",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/carousel.js#L166-L203 | train | |
titon/toolkit | js/components/carousel.js | function(index) {
if (this.animating) {
return;
}
var indexes = this._getIndex(index),
cloneIndex = indexes[0], // The index including clones
visualIndex = indexes[1]; // The index excluding clones
// Exit early if jumping to same index
if (v... | javascript | function(index) {
if (this.animating) {
return;
}
var indexes = this._getIndex(index),
cloneIndex = indexes[0], // The index including clones
visualIndex = indexes[1]; // The index excluding clones
// Exit early if jumping to same index
if (v... | [
"function",
"(",
"index",
")",
"{",
"if",
"(",
"this",
".",
"animating",
")",
"{",
"return",
";",
"}",
"var",
"indexes",
"=",
"this",
".",
"_getIndex",
"(",
"index",
")",
",",
"cloneIndex",
"=",
"indexes",
"[",
"0",
"]",
",",
"// The index including cl... | Go to the item indicated by the index number.
@param {Number} index | [
"Go",
"to",
"the",
"item",
"indicated",
"by",
"the",
"index",
"number",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/carousel.js#L210-L251 | train | |
titon/toolkit | js/components/carousel.js | function() {
if (this.options.autoCycle) {
clearInterval(this.timer);
this.timer = setInterval(this.onCycle.bind(this), this.options.duration);
}
} | javascript | function() {
if (this.options.autoCycle) {
clearInterval(this.timer);
this.timer = setInterval(this.onCycle.bind(this), this.options.duration);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"autoCycle",
")",
"{",
"clearInterval",
"(",
"this",
".",
"timer",
")",
";",
"this",
".",
"timer",
"=",
"setInterval",
"(",
"this",
".",
"onCycle",
".",
"bind",
"(",
"this",
")",
",... | Reset the timer. | [
"Reset",
"the",
"timer",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/carousel.js#L270-L275 | train | |
titon/toolkit | js/components/carousel.js | function() {
this.animating = false;
var container = this.container,
resetTo = this._resetTo;
// Reset the currently shown item to a specific index
// This achieves the circular infinite scrolling effect
if (resetTo !== null) {
container
... | javascript | function() {
this.animating = false;
var container = this.container,
resetTo = this._resetTo;
// Reset the currently shown item to a specific index
// This achieves the circular infinite scrolling effect
if (resetTo !== null) {
container
... | [
"function",
"(",
")",
"{",
"this",
".",
"animating",
"=",
"false",
";",
"var",
"container",
"=",
"this",
".",
"container",
",",
"resetTo",
"=",
"this",
".",
"_resetTo",
";",
"// Reset the currently shown item to a specific index",
"// This achieves the circular infini... | Functionality to trigger after a cycle transition has ended.
Will set animating to false and re-enable jumping.
If `resetTo` is set, then reset the internal DOM index for infinite scrolling.
Also clean-up the `no-transition` class from the container.
@private | [
"Functionality",
"to",
"trigger",
"after",
"a",
"cycle",
"transition",
"has",
"ended",
".",
"Will",
"set",
"animating",
"to",
"false",
"and",
"re",
"-",
"enable",
"jumping",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/carousel.js#L308-L330 | train | |
titon/toolkit | js/components/carousel.js | function() {
var options = this.options,
items = this.items,
container = this.container,
itemsToShow = options.itemsToShow;
if (!options.infinite) {
return;
}
// Append the first items
items.slice(0, itemsToShow)
.clon... | javascript | function() {
var options = this.options,
items = this.items,
container = this.container,
itemsToShow = options.itemsToShow;
if (!options.infinite) {
return;
}
// Append the first items
items.slice(0, itemsToShow)
.clon... | [
"function",
"(",
")",
"{",
"var",
"options",
"=",
"this",
".",
"options",
",",
"items",
"=",
"this",
".",
"items",
",",
"container",
"=",
"this",
".",
"container",
",",
"itemsToShow",
"=",
"options",
".",
"itemsToShow",
";",
"if",
"(",
"!",
"options",
... | Create clones to support infinite scrolling.
The beginning set of cloned items should be appended to the end,
while the end set of cloned items should be prepended to the beginning.
@private | [
"Create",
"clones",
"to",
"support",
"infinite",
"scrolling",
".",
"The",
"beginning",
"set",
"of",
"cloned",
"items",
"should",
"be",
"appended",
"to",
"the",
"end",
"while",
"the",
"end",
"set",
"of",
"cloned",
"items",
"should",
"be",
"prepended",
"to",
... | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/carousel.js#L350-L378 | train | |
titon/toolkit | js/components/carousel.js | function(index) {
var sum = 0;
$.each(this._sizes, function(i, value) {
if (i < index) {
sum += value.totalSize;
}
});
return sum;
} | javascript | function(index) {
var sum = 0;
$.each(this._sizes, function(i, value) {
if (i < index) {
sum += value.totalSize;
}
});
return sum;
} | [
"function",
"(",
"index",
")",
"{",
"var",
"sum",
"=",
"0",
";",
"$",
".",
"each",
"(",
"this",
".",
"_sizes",
",",
"function",
"(",
"i",
",",
"value",
")",
"{",
"if",
"(",
"i",
"<",
"index",
")",
"{",
"sum",
"+=",
"value",
".",
"totalSize",
... | Calculate the size to cycle width based on the sum of all items up to but not including the defined index.
@param {Number} index - Includes the clone index
@returns {Number}
@private | [
"Calculate",
"the",
"size",
"to",
"cycle",
"width",
"based",
"on",
"the",
"sum",
"of",
"all",
"items",
"up",
"to",
"but",
"not",
"including",
"the",
"defined",
"index",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/carousel.js#L472-L482 | train | |
titon/toolkit | js/components/carousel.js | function() {
var options = this.options,
animation = options.animation;
// Cycling more than the show amount causes unexpected issues
if (options.itemsToCycle > options.itemsToShow) {
options.itemsToCycle = options.itemsToShow;
}
// Fade animations can o... | javascript | function() {
var options = this.options,
animation = options.animation;
// Cycling more than the show amount causes unexpected issues
if (options.itemsToCycle > options.itemsToShow) {
options.itemsToCycle = options.itemsToShow;
}
// Fade animations can o... | [
"function",
"(",
")",
"{",
"var",
"options",
"=",
"this",
".",
"options",
",",
"animation",
"=",
"options",
".",
"animation",
";",
"// Cycling more than the show amount causes unexpected issues",
"if",
"(",
"options",
".",
"itemsToCycle",
">",
"options",
".",
"ite... | Setup the carousel state to introspecting property values and resetting options.
@private | [
"Setup",
"the",
"carousel",
"state",
"to",
"introspecting",
"property",
"values",
"and",
"resetting",
"options",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/carousel.js#L489-L512 | train | |
titon/toolkit | js/components/carousel.js | function(index) {
this.items
.removeClass('is-active')
.aria('hidden', true)
.slice(index, index + this.options.itemsToShow)
.addClass('is-active')
.aria('hidden', false);
} | javascript | function(index) {
this.items
.removeClass('is-active')
.aria('hidden', true)
.slice(index, index + this.options.itemsToShow)
.addClass('is-active')
.aria('hidden', false);
} | [
"function",
"(",
"index",
")",
"{",
"this",
".",
"items",
".",
"removeClass",
"(",
"'is-active'",
")",
".",
"aria",
"(",
"'hidden'",
",",
"true",
")",
".",
"slice",
"(",
"index",
",",
"index",
"+",
"this",
".",
"options",
".",
"itemsToShow",
")",
"."... | Update the active state for the items while taking into account cloned elements.
@param {Number} index
@private | [
"Update",
"the",
"active",
"state",
"for",
"the",
"items",
"while",
"taking",
"into",
"account",
"cloned",
"elements",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/carousel.js#L520-L527 | train | |
titon/toolkit | js/components/carousel.js | function(start) {
var itemsToShow = this.options.itemsToShow,
length = this.items.length,
stop = start + itemsToShow,
set = $([]),
tabs = this.tabs
.removeClass('is-active')
.aria('toggled', false);
if (!tabs.length) {
... | javascript | function(start) {
var itemsToShow = this.options.itemsToShow,
length = this.items.length,
stop = start + itemsToShow,
set = $([]),
tabs = this.tabs
.removeClass('is-active')
.aria('toggled', false);
if (!tabs.length) {
... | [
"function",
"(",
"start",
")",
"{",
"var",
"itemsToShow",
"=",
"this",
".",
"options",
".",
"itemsToShow",
",",
"length",
"=",
"this",
".",
"items",
".",
"length",
",",
"stop",
"=",
"start",
"+",
"itemsToShow",
",",
"set",
"=",
"$",
"(",
"[",
"]",
... | Update the active state for the tab indicators.
@param {Number} start
@private | [
"Update",
"the",
"active",
"state",
"for",
"the",
"tab",
"indicators",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/carousel.js#L535-L566 | train | |
titon/toolkit | js/components/showcase.js | function(nodes, options) {
var element;
options = this.setOptions(options);
this.element = element = this.createElement();
// Nodes found in the page on initialization
this.nodes = $(nodes);
// The wrapping items element
this.items = element.find(this.ns('items... | javascript | function(nodes, options) {
var element;
options = this.setOptions(options);
this.element = element = this.createElement();
// Nodes found in the page on initialization
this.nodes = $(nodes);
// The wrapping items element
this.items = element.find(this.ns('items... | [
"function",
"(",
"nodes",
",",
"options",
")",
"{",
"var",
"element",
";",
"options",
"=",
"this",
".",
"setOptions",
"(",
"options",
")",
";",
"this",
".",
"element",
"=",
"element",
"=",
"this",
".",
"createElement",
"(",
")",
";",
"// Nodes found in t... | Initialize the showcase.
@param {jQuery} nodes
@param {Object} [options] | [
"Initialize",
"the",
"showcase",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/showcase.js#L50-L103 | train | |
titon/toolkit | js/components/showcase.js | function(index) {
if (this.animating) {
return;
}
index = $.bound(index, this.data.length);
// Exit since transitions don't occur
if (index === this.index) {
return;
}
var self = this,
element = this.element,
capt... | javascript | function(index) {
if (this.animating) {
return;
}
index = $.bound(index, this.data.length);
// Exit since transitions don't occur
if (index === this.index) {
return;
}
var self = this,
element = this.element,
capt... | [
"function",
"(",
"index",
")",
"{",
"if",
"(",
"this",
".",
"animating",
")",
"{",
"return",
";",
"}",
"index",
"=",
"$",
".",
"bound",
"(",
"index",
",",
"this",
".",
"data",
".",
"length",
")",
";",
"// Exit since transitions don't occur",
"if",
"(",... | Jump to a specific item indicated by the index number.
If the index is too large, jump to the beginning.
If the index is too small, jump to the end.
@param {Number} index | [
"Jump",
"to",
"a",
"specific",
"item",
"indicated",
"by",
"the",
"index",
"number",
".",
"If",
"the",
"index",
"is",
"too",
"large",
"jump",
"to",
"the",
"beginning",
".",
"If",
"the",
"index",
"is",
"too",
"small",
"jump",
"to",
"the",
"end",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/showcase.js#L138-L229 | train | |
titon/toolkit | js/components/showcase.js | function(node) {
this.node = node = $(node);
this.index = -1;
var options = this.inheritOptions(this.options, node),
read = this.readValue,
category = read(node, options.getCategory),
items = [],
index = 0;
// Multiple items based on cate... | javascript | function(node) {
this.node = node = $(node);
this.index = -1;
var options = this.inheritOptions(this.options, node),
read = this.readValue,
category = read(node, options.getCategory),
items = [],
index = 0;
// Multiple items based on cate... | [
"function",
"(",
"node",
")",
"{",
"this",
".",
"node",
"=",
"node",
"=",
"$",
"(",
"node",
")",
";",
"this",
".",
"index",
"=",
"-",
"1",
";",
"var",
"options",
"=",
"this",
".",
"inheritOptions",
"(",
"this",
".",
"options",
",",
"node",
")",
... | Reveal the showcase after scraping for items data.
Will scrape data from the activating node.
If a category exists, scrape data from multiple nodes.
@param {Element} node | [
"Reveal",
"the",
"showcase",
"after",
"scraping",
"for",
"items",
"data",
".",
"Will",
"scrape",
"data",
"from",
"the",
"activating",
"node",
".",
"If",
"a",
"category",
"exists",
"scrape",
"data",
"from",
"multiple",
"nodes",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/showcase.js#L267-L314 | train | |
titon/toolkit | js/components/showcase.js | function(items) {
this.data = items;
this.items.empty();
this.tabs.empty();
for (var li, a, item, i = 0; item = items[i]; i++) {
li = $('<li/>');
li.appendTo(this.items);
a = $('<a/>')
.attr('href', 'javascript:;')
.da... | javascript | function(items) {
this.data = items;
this.items.empty();
this.tabs.empty();
for (var li, a, item, i = 0; item = items[i]; i++) {
li = $('<li/>');
li.appendTo(this.items);
a = $('<a/>')
.attr('href', 'javascript:;')
.da... | [
"function",
"(",
"items",
")",
"{",
"this",
".",
"data",
"=",
"items",
";",
"this",
".",
"items",
".",
"empty",
"(",
")",
";",
"this",
".",
"tabs",
".",
"empty",
"(",
")",
";",
"for",
"(",
"var",
"li",
",",
"a",
",",
"item",
",",
"i",
"=",
... | Build the list of items and tabs based on the generated data.
Determine which elements to show and bind based on the data.
@private
@param {Array} items | [
"Build",
"the",
"list",
"of",
"items",
"and",
"tabs",
"based",
"on",
"the",
"generated",
"data",
".",
"Determine",
"which",
"elements",
"to",
"show",
"and",
"bind",
"based",
"on",
"the",
"data",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/showcase.js#L323-L345 | train | |
titon/toolkit | js/components/showcase.js | function(width, height) {
var gutter = (this.options.gutter * 2),
wWidth = $(window).width() - gutter,
wHeight = $(window).height() - gutter,
ratio,
diff;
// Resize if the width is larger
if (width > wWidth) {
ratio = (width / height);... | javascript | function(width, height) {
var gutter = (this.options.gutter * 2),
wWidth = $(window).width() - gutter,
wHeight = $(window).height() - gutter,
ratio,
diff;
// Resize if the width is larger
if (width > wWidth) {
ratio = (width / height);... | [
"function",
"(",
"width",
",",
"height",
")",
"{",
"var",
"gutter",
"=",
"(",
"this",
".",
"options",
".",
"gutter",
"*",
"2",
")",
",",
"wWidth",
"=",
"$",
"(",
"window",
")",
".",
"width",
"(",
")",
"-",
"gutter",
",",
"wHeight",
"=",
"$",
"(... | Resize the showcase modal when it is larger than the current viewport.
@private
@param {Number} width
@param {Number} height | [
"Resize",
"the",
"showcase",
"modal",
"when",
"it",
"is",
"larger",
"than",
"the",
"current",
"viewport",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/js/components/showcase.js#L354-L383 | train | |
titon/toolkit | dist/toolkit.js | function(plugin, callback, collection) {
var name = plugin;
// Prefix with toolkit to avoid collisions
if ($.fn[name]) {
name = 'toolkit' + name.charAt(0).toUpperCase() + name.slice(1);
}
$.fn[name] = collection ?
// Apply the instance to a collection o... | javascript | function(plugin, callback, collection) {
var name = plugin;
// Prefix with toolkit to avoid collisions
if ($.fn[name]) {
name = 'toolkit' + name.charAt(0).toUpperCase() + name.slice(1);
}
$.fn[name] = collection ?
// Apply the instance to a collection o... | [
"function",
"(",
"plugin",
",",
"callback",
",",
"collection",
")",
"{",
"var",
"name",
"=",
"plugin",
";",
"// Prefix with toolkit to avoid collisions",
"if",
"(",
"$",
".",
"fn",
"[",
"name",
"]",
")",
"{",
"name",
"=",
"'toolkit'",
"+",
"name",
".",
"... | Creates a jQuery plugin by extending the jQuery prototype with a method definition.
The Toolkit plugin is only initialized if one has not been already.
Plugins are either defined per element, or on a collection of elements.
@param {String} plugin
@param {Function} callback
@param {bool} [collection] | [
"Creates",
"a",
"jQuery",
"plugin",
"by",
"extending",
"the",
"jQuery",
"prototype",
"with",
"a",
"method",
"definition",
".",
"The",
"Toolkit",
"plugin",
"is",
"only",
"initialized",
"if",
"one",
"has",
"not",
"been",
"already",
".",
"Plugins",
"are",
"eith... | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L155-L182 | train | |
titon/toolkit | dist/toolkit.js | function() {
var instance = Toolkit.cache[plugin + ':' + this.selector] = callback.apply(this, arguments);
return this.each(function() {
$(this).cache('toolkit.' + plugin, instance);
});
} | javascript | function() {
var instance = Toolkit.cache[plugin + ':' + this.selector] = callback.apply(this, arguments);
return this.each(function() {
$(this).cache('toolkit.' + plugin, instance);
});
} | [
"function",
"(",
")",
"{",
"var",
"instance",
"=",
"Toolkit",
".",
"cache",
"[",
"plugin",
"+",
"':'",
"+",
"this",
".",
"selector",
"]",
"=",
"callback",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"return",
"this",
".",
"each",
"(",
"f... | Apply the instance to a collection of elements | [
"Apply",
"the",
"instance",
"to",
"a",
"collection",
"of",
"elements"
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L166-L172 | train | |
titon/toolkit | dist/toolkit.js | function(event, context, callback, selector) {
var options = this.options;
// Replace tokens
if (event === '{mode}') {
event = options.mode;
}
if (selector === '{selector}') {
selector = this.nodes ? this.nodes.selector : '';
}
// Find a... | javascript | function(event, context, callback, selector) {
var options = this.options;
// Replace tokens
if (event === '{mode}') {
event = options.mode;
}
if (selector === '{selector}') {
selector = this.nodes ? this.nodes.selector : '';
}
// Find a... | [
"function",
"(",
"event",
",",
"context",
",",
"callback",
",",
"selector",
")",
"{",
"var",
"options",
"=",
"this",
".",
"options",
";",
"// Replace tokens",
"if",
"(",
"event",
"===",
"'{mode}'",
")",
"{",
"event",
"=",
"options",
".",
"mode",
";",
"... | Add an event to bind.
@param {String} event
@param {String} context
@param {String|Function} callback
@param {String} selector | [
"Add",
"an",
"event",
"to",
"bind",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L302-L320 | train | |
titon/toolkit | dist/toolkit.js | function(type, callback) {
var list = this.__hooks[type] || [];
list.push(callback);
this.__hooks[type] = list;
} | javascript | function(type, callback) {
var list = this.__hooks[type] || [];
list.push(callback);
this.__hooks[type] = list;
} | [
"function",
"(",
"type",
",",
"callback",
")",
"{",
"var",
"list",
"=",
"this",
".",
"__hooks",
"[",
"type",
"]",
"||",
"[",
"]",
";",
"list",
".",
"push",
"(",
"callback",
")",
";",
"this",
".",
"__hooks",
"[",
"type",
"]",
"=",
"list",
";",
"... | Add a hook to a specific event type.
@param {String} type
@param {Function} callback | [
"Add",
"a",
"hook",
"to",
"a",
"specific",
"event",
"type",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L339-L344 | train | |
titon/toolkit | dist/toolkit.js | function(type, callbacks) {
$.each(callbacks, function(i, callback) {
this.addHook(type, callback);
}.bind(this));
} | javascript | function(type, callbacks) {
$.each(callbacks, function(i, callback) {
this.addHook(type, callback);
}.bind(this));
} | [
"function",
"(",
"type",
",",
"callbacks",
")",
"{",
"$",
".",
"each",
"(",
"callbacks",
",",
"function",
"(",
"i",
",",
"callback",
")",
"{",
"this",
".",
"addHook",
"(",
"type",
",",
"callback",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")"... | Add multiple hooks for a type.
@param {String} type
@param {Array} callbacks | [
"Add",
"multiple",
"hooks",
"for",
"a",
"type",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L352-L356 | train | |
titon/toolkit | dist/toolkit.js | function(type) {
var self = this,
event,
context,
func,
selector,
win = $(window),
doc = $(document);
$.each(this.__events, function(i, value) {
event = value[0];
context = value[1];
func = value... | javascript | function(type) {
var self = this,
event,
context,
func,
selector,
win = $(window),
doc = $(document);
$.each(this.__events, function(i, value) {
event = value[0];
context = value[1];
func = value... | [
"function",
"(",
"type",
")",
"{",
"var",
"self",
"=",
"this",
",",
"event",
",",
"context",
",",
"func",
",",
"selector",
",",
"win",
"=",
"$",
"(",
"window",
")",
",",
"doc",
"=",
"$",
"(",
"document",
")",
";",
"$",
".",
"each",
"(",
"this",... | Loop through the events object and attach events to the specified selector in the correct context.
Take into account window, document, and delegation.
@param {String} type | [
"Loop",
"through",
"the",
"events",
"object",
"and",
"attach",
"events",
"to",
"the",
"specified",
"selector",
"in",
"the",
"correct",
"context",
".",
"Take",
"into",
"account",
"window",
"document",
"and",
"delegation",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L364-L403 | train | |
titon/toolkit | dist/toolkit.js | function(type, args) {
var debug = this.options.debug || Toolkit.debug;
if (debug) {
console.log(this.name + '#' + this.uid, new Date().getMilliseconds(), type, args || []);
if (debug === 'verbose') {
console.dir(this);
}
}
var hooks... | javascript | function(type, args) {
var debug = this.options.debug || Toolkit.debug;
if (debug) {
console.log(this.name + '#' + this.uid, new Date().getMilliseconds(), type, args || []);
if (debug === 'verbose') {
console.dir(this);
}
}
var hooks... | [
"function",
"(",
"type",
",",
"args",
")",
"{",
"var",
"debug",
"=",
"this",
".",
"options",
".",
"debug",
"||",
"Toolkit",
".",
"debug",
";",
"if",
"(",
"debug",
")",
"{",
"console",
".",
"log",
"(",
"this",
".",
"name",
"+",
"'#'",
"+",
"this",... | Trigger all hooks defined by type.
@param {String} type
@param {Array} [args] | [
"Trigger",
"all",
"hooks",
"defined",
"by",
"type",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L455-L473 | train | |
titon/toolkit | dist/toolkit.js | function(type, callback) {
if (!callback) {
delete this.__hooks[type];
return;
}
var hooks = this.__hooks[type];
if (hooks) {
$.each(hooks, function(i, hook) {
if (hook === callback) {
hooks = hooks.splice(i, 1);
... | javascript | function(type, callback) {
if (!callback) {
delete this.__hooks[type];
return;
}
var hooks = this.__hooks[type];
if (hooks) {
$.each(hooks, function(i, hook) {
if (hook === callback) {
hooks = hooks.splice(i, 1);
... | [
"function",
"(",
"type",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"callback",
")",
"{",
"delete",
"this",
".",
"__hooks",
"[",
"type",
"]",
";",
"return",
";",
"}",
"var",
"hooks",
"=",
"this",
".",
"__hooks",
"[",
"type",
"]",
";",
"if",
"(",
... | Remove a hook within a type. If the callback is not provided, remove all hooks in that type.
@param {String} type
@param {Function} [callback] | [
"Remove",
"a",
"hook",
"within",
"a",
"type",
".",
"If",
"the",
"callback",
"is",
"not",
"provided",
"remove",
"all",
"hooks",
"in",
"that",
"type",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L489-L504 | train | |
titon/toolkit | dist/toolkit.js | function(options) {
var opts = $.extend(true, {}, Toolkit[this.name].options, options || {}),
key;
// Inherit options based on responsive media queries
if (opts.responsive && window.matchMedia) {
$.each(opts.responsive, function(key, resOpts) {
if (matchM... | javascript | function(options) {
var opts = $.extend(true, {}, Toolkit[this.name].options, options || {}),
key;
// Inherit options based on responsive media queries
if (opts.responsive && window.matchMedia) {
$.each(opts.responsive, function(key, resOpts) {
if (matchM... | [
"function",
"(",
"options",
")",
"{",
"var",
"opts",
"=",
"$",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"Toolkit",
"[",
"this",
".",
"name",
"]",
".",
"options",
",",
"options",
"||",
"{",
"}",
")",
",",
"key",
";",
"// Inherit options based... | Set the options by merging with defaults. If the `responsive` option exists,
attempt to alter the options based on media query breakpoints. Furthermore,
if an option begins with `on`, add it as a hook.
@param {Object} [options]
@returns {Object} | [
"Set",
"the",
"options",
"by",
"merging",
"with",
"defaults",
".",
"If",
"the",
"responsive",
"option",
"exists",
"attempt",
"to",
"alter",
"the",
"options",
"based",
"on",
"media",
"query",
"breakpoints",
".",
"Furthermore",
"if",
"an",
"option",
"begins",
... | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L514-L539 | train | |
titon/toolkit | dist/toolkit.js | doAria | function doAria(element, key, value) {
if ($.type(value) === 'undefined') {
return element.getAttribute('aria-' + key);
}
if (value === true) {
value = 'true';
} else if (value === false) {
value = 'false';
}
element.setAttribute('aria-' + key, value);
} | javascript | function doAria(element, key, value) {
if ($.type(value) === 'undefined') {
return element.getAttribute('aria-' + key);
}
if (value === true) {
value = 'true';
} else if (value === false) {
value = 'false';
}
element.setAttribute('aria-' + key, value);
} | [
"function",
"doAria",
"(",
"element",
",",
"key",
",",
"value",
")",
"{",
"if",
"(",
"$",
".",
"type",
"(",
"value",
")",
"===",
"'undefined'",
")",
"{",
"return",
"element",
".",
"getAttribute",
"(",
"'aria-'",
"+",
"key",
")",
";",
"}",
"if",
"("... | A multi-purpose getter and setter for ARIA attributes.
Will prefix attribute names and cast values correctly.
@param {Element} element
@param {String|Object} key
@param {*} value | [
"A",
"multi",
"-",
"purpose",
"getter",
"and",
"setter",
"for",
"ARIA",
"attributes",
".",
"Will",
"prefix",
"attribute",
"names",
"and",
"cast",
"values",
"correctly",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L554-L566 | train |
titon/toolkit | dist/toolkit.js | function(type, args) {
Base.prototype.fireEvent.call(this, type, args);
var element = this.element,
node = this.node,
event = $.Event(type + '.toolkit.' + this.keyName);
event.context = this;
// Trigger event on the element and the node
if (element) ... | javascript | function(type, args) {
Base.prototype.fireEvent.call(this, type, args);
var element = this.element,
node = this.node,
event = $.Event(type + '.toolkit.' + this.keyName);
event.context = this;
// Trigger event on the element and the node
if (element) ... | [
"function",
"(",
"type",
",",
"args",
")",
"{",
"Base",
".",
"prototype",
".",
"fireEvent",
".",
"call",
"(",
"this",
",",
"type",
",",
"args",
")",
";",
"var",
"element",
"=",
"this",
".",
"element",
",",
"node",
"=",
"this",
".",
"node",
",",
"... | Trigger all hooks and any DOM events attached to the `element` or `node`.
@param {String} type
@param {Array} [args] | [
"Trigger",
"all",
"hooks",
"and",
"any",
"DOM",
"events",
"attached",
"to",
"the",
"element",
"or",
"node",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L702-L718 | train | |
titon/toolkit | dist/toolkit.js | function(options, element) {
var key, value, obj = {};
for (key in options) {
if (key === 'context' || key === 'template') {
continue;
}
value = element.data((this.keyName + '-' + key).toLowerCase());
if ($.type(value) !== 'undefined') {... | javascript | function(options, element) {
var key, value, obj = {};
for (key in options) {
if (key === 'context' || key === 'template') {
continue;
}
value = element.data((this.keyName + '-' + key).toLowerCase());
if ($.type(value) !== 'undefined') {... | [
"function",
"(",
"options",
",",
"element",
")",
"{",
"var",
"key",
",",
"value",
",",
"obj",
"=",
"{",
"}",
";",
"for",
"(",
"key",
"in",
"options",
")",
"{",
"if",
"(",
"key",
"===",
"'context'",
"||",
"key",
"===",
"'template'",
")",
"{",
"con... | Inherit options from the target elements data attributes.
@param {Object} options
@param {jQuery} element
@returns {Object} | [
"Inherit",
"options",
"from",
"the",
"target",
"elements",
"data",
"attributes",
"."
] | f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c | https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L750-L766 | 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.