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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
joaquinfq/jf-json-parse | index.js | parseJson | function parseJson(json, cache, cwd)
{
return json.replace(
/"([^"]+\.json)"/gi,
(match, jsonFile) =>
{
const _json = loadJsonFile(jsonFile, cache, cwd);
return _json === null
? match
: _json;
}
);
} | javascript | function parseJson(json, cache, cwd)
{
return json.replace(
/"([^"]+\.json)"/gi,
(match, jsonFile) =>
{
const _json = loadJsonFile(jsonFile, cache, cwd);
return _json === null
? match
: _json;
}
);
} | [
"function",
"parseJson",
"(",
"json",
",",
"cache",
",",
"cwd",
")",
"{",
"return",
"json",
".",
"replace",
"(",
"/",
"\"([^\"]+\\.json)\"",
"/",
"gi",
",",
"(",
"match",
",",
"jsonFile",
")",
"=>",
"{",
"const",
"_json",
"=",
"loadJsonFile",
"(",
"jso... | Lee el texto en formato JSON y busca los archivos JSON incluidos.
Si un archivo no existe se deja el texto tal cual.
@param {string} json Texto en formato JSON a analizar.
@param {object} cache Archivos y textos procesados previamente.
@param {object} cwd Directorio actual a usar para resolver las inclusiones.
@re... | [
"Lee",
"el",
"texto",
"en",
"formato",
"JSON",
"y",
"busca",
"los",
"archivos",
"JSON",
"incluidos",
".",
"Si",
"un",
"archivo",
"no",
"existe",
"se",
"deja",
"el",
"texto",
"tal",
"cual",
"."
] | 73ad42e71de95426d51c98a9780419945fe2004e | https://github.com/joaquinfq/jf-json-parse/blob/73ad42e71de95426d51c98a9780419945fe2004e/index.js#L67-L80 | train |
erelsgl/languagemodel | LanguageModel.js | function(dataset) {
// calculate counts for equation (3):
var mapWordToTotalCount = {};
var totalNumberOfWordsInDataset = 0;
for (var i in dataset) {
var datum = dataset[i];
var totalPerDatum = 0;
// for each input sentence, count the total number of words in it:
for (var word in datum) {
m... | javascript | function(dataset) {
// calculate counts for equation (3):
var mapWordToTotalCount = {};
var totalNumberOfWordsInDataset = 0;
for (var i in dataset) {
var datum = dataset[i];
var totalPerDatum = 0;
// for each input sentence, count the total number of words in it:
for (var word in datum) {
m... | [
"function",
"(",
"dataset",
")",
"{",
"// calculate counts for equation (3):",
"var",
"mapWordToTotalCount",
"=",
"{",
"}",
";",
"var",
"totalNumberOfWordsInDataset",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"in",
"dataset",
")",
"{",
"var",
"datum",
"=",
"datas... | Train the language with all the given documents.
@param dataset
an array with hashes of the format:
{word1:count1, word2:count2,...}
each object represents the a sentence (it should be tokenized in advance). | [
"Train",
"the",
"language",
"with",
"all",
"the",
"given",
"documents",
"."
] | 462644dc32f97a970e3f4827fe92d0e709db21db | https://github.com/erelsgl/languagemodel/blob/462644dc32f97a970e3f4827fe92d0e709db21db/LanguageModel.js#L32-L64 | train | |
ottojs/otto-errors | lib/read.error.js | ErrorRead | function ErrorRead (message) {
Error.call(this);
// Add Information
this.name = 'ErrorRead';
this.type = 'server';
this.status = 500;
if (message) {
this.message = message;
}
} | javascript | function ErrorRead (message) {
Error.call(this);
// Add Information
this.name = 'ErrorRead';
this.type = 'server';
this.status = 500;
if (message) {
this.message = message;
}
} | [
"function",
"ErrorRead",
"(",
"message",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"// Add Information",
"this",
".",
"name",
"=",
"'ErrorRead'",
";",
"this",
".",
"type",
"=",
"'server'",
";",
"this",
".",
"status",
"=",
"500",
";",
"if",... | Error - ErrorRead | [
"Error",
"-",
"ErrorRead"
] | a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9 | https://github.com/ottojs/otto-errors/blob/a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9/lib/read.error.js#L8-L20 | train |
kevinoid/promised-read | index.js | tryUnshift | function tryUnshift(stream, result, desiredLength, emptySlice) {
if (typeof stream.unshift !== 'function') {
debug('Unable to unshift, stream does not have an unshift method.');
return result;
}
const errorListeners = stream.listeners('error');
stream.removeAllListeners('error');
// Note: Don't rel... | javascript | function tryUnshift(stream, result, desiredLength, emptySlice) {
if (typeof stream.unshift !== 'function') {
debug('Unable to unshift, stream does not have an unshift method.');
return result;
}
const errorListeners = stream.listeners('error');
stream.removeAllListeners('error');
// Note: Don't rel... | [
"function",
"tryUnshift",
"(",
"stream",
",",
"result",
",",
"desiredLength",
",",
"emptySlice",
")",
"{",
"if",
"(",
"typeof",
"stream",
".",
"unshift",
"!==",
"'function'",
")",
"{",
"debug",
"(",
"'Unable to unshift, stream does not have an unshift method.'",
")"... | Attempts to unshift result data down to a desired length.
@param {stream.Readable} stream Stream into which to unshift data.
@param {!Buffer|string|!Array} result Read result data.
@param {number} desiredLength Desired length of result after unshifting.
@param {boolean=} emptySlice Return an empty slice when all data i... | [
"Attempts",
"to",
"unshift",
"result",
"data",
"down",
"to",
"a",
"desired",
"length",
"."
] | c6adf477f4a64d5142363d84f7f83f5f07b8f682 | https://github.com/kevinoid/promised-read/blob/c6adf477f4a64d5142363d84f7f83f5f07b8f682/index.js#L28-L74 | train |
kevinoid/promised-read | index.js | checkUntil | function checkUntil(resultWithData, data, ended) {
let desiredLength;
try {
desiredLength = until(resultWithData, data, ended);
} catch (errUntil) {
doReject(errUntil, true);
return true;
}
const resultLength = result ? result.length : 0;
if (typeof desiredLe... | javascript | function checkUntil(resultWithData, data, ended) {
let desiredLength;
try {
desiredLength = until(resultWithData, data, ended);
} catch (errUntil) {
doReject(errUntil, true);
return true;
}
const resultLength = result ? result.length : 0;
if (typeof desiredLe... | [
"function",
"checkUntil",
"(",
"resultWithData",
",",
"data",
",",
"ended",
")",
"{",
"let",
"desiredLength",
";",
"try",
"{",
"desiredLength",
"=",
"until",
"(",
"resultWithData",
",",
"data",
",",
"ended",
")",
";",
"}",
"catch",
"(",
"errUntil",
")",
... | Calls the until function and handles its result.
@return {boolean} <code>true</code> if done reading, <code>false</code>
otherwise.
@private | [
"Calls",
"the",
"until",
"function",
"and",
"handles",
"its",
"result",
"."
] | c6adf477f4a64d5142363d84f7f83f5f07b8f682 | https://github.com/kevinoid/promised-read/blob/c6adf477f4a64d5142363d84f7f83f5f07b8f682/index.js#L242-L299 | train |
kevinoid/promised-read | index.js | read | function read(stream, size, options) {
if (!options && typeof size === 'object') {
options = size;
size = null;
}
return readInternal(stream, size, undefined, options);
} | javascript | function read(stream, size, options) {
if (!options && typeof size === 'object') {
options = size;
size = null;
}
return readInternal(stream, size, undefined, options);
} | [
"function",
"read",
"(",
"stream",
",",
"size",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
"&&",
"typeof",
"size",
"===",
"'object'",
")",
"{",
"options",
"=",
"size",
";",
"size",
"=",
"null",
";",
"}",
"return",
"readInternal",
"(",
"stre... | Reads from a stream.Readable.
@param {stream.Readable} stream Stream from which to read.
@param {number=} size Number of bytes to read. If <code>stream.read</code>
is a function, <code>size</code> is passed to it, guaranteeing maximum
result size. Otherwise, <code>'data'</code> events will be consumed until
<code>siz... | [
"Reads",
"from",
"a",
"stream",
".",
"Readable",
"."
] | c6adf477f4a64d5142363d84f7f83f5f07b8f682 | https://github.com/kevinoid/promised-read/blob/c6adf477f4a64d5142363d84f7f83f5f07b8f682/index.js#L457-L463 | train |
kevinoid/promised-read | index.js | readUntil | function readUntil(stream, until, options) {
if (typeof until !== 'function') {
// Note: Synchronous Yaku emits unhandledRejection before returning.
// Best current option is to use an async promise, even when flowing
const ReadPromise = (options && options.Promise) || Promise;
return ReadPromise.rej... | javascript | function readUntil(stream, until, options) {
if (typeof until !== 'function') {
// Note: Synchronous Yaku emits unhandledRejection before returning.
// Best current option is to use an async promise, even when flowing
const ReadPromise = (options && options.Promise) || Promise;
return ReadPromise.rej... | [
"function",
"readUntil",
"(",
"stream",
",",
"until",
",",
"options",
")",
"{",
"if",
"(",
"typeof",
"until",
"!==",
"'function'",
")",
"{",
"// Note: Synchronous Yaku emits unhandledRejection before returning.",
"// Best current option is to use an async promise, even when fl... | Reads from a stream.Readable until a given test is satisfied.
@param {stream.Readable} stream Stream from which to read.
@param {function((!Buffer|string|!Array), (Buffer|string|*)): number|boolean}
test Test function called with the data read so far and the most recent
chunk read. If it returns a negative or falsey v... | [
"Reads",
"from",
"a",
"stream",
".",
"Readable",
"until",
"a",
"given",
"test",
"is",
"satisfied",
"."
] | c6adf477f4a64d5142363d84f7f83f5f07b8f682 | https://github.com/kevinoid/promised-read/blob/c6adf477f4a64d5142363d84f7f83f5f07b8f682/index.js#L486-L494 | train |
kevinoid/promised-read | index.js | readTo | function readTo(stream, needle, options) {
const endOK = Boolean(options && (options.endOK || options.endOk));
let needleForIndexOf;
let needleLength;
function until(result, chunk, ended) {
if (ended) {
return endOK ? (result ? result.length : 0) : -1;
}
if (Array.isArray(result)) {
// ... | javascript | function readTo(stream, needle, options) {
const endOK = Boolean(options && (options.endOK || options.endOk));
let needleForIndexOf;
let needleLength;
function until(result, chunk, ended) {
if (ended) {
return endOK ? (result ? result.length : 0) : -1;
}
if (Array.isArray(result)) {
// ... | [
"function",
"readTo",
"(",
"stream",
",",
"needle",
",",
"options",
")",
"{",
"const",
"endOK",
"=",
"Boolean",
"(",
"options",
"&&",
"(",
"options",
".",
"endOK",
"||",
"options",
".",
"endOk",
")",
")",
";",
"let",
"needleForIndexOf",
";",
"let",
"ne... | Reads from a stream.Readable until a given value is found.
<p>This function calls {@link readUntil} with an <code>until</code> function
which uses <code>.indexOf</code> to search for <code>needle</code>. When
reading Buffers and performance is paramount, consider using
{@link readUntil} directly with an optional func... | [
"Reads",
"from",
"a",
"stream",
".",
"Readable",
"until",
"a",
"given",
"value",
"is",
"found",
"."
] | c6adf477f4a64d5142363d84f7f83f5f07b8f682 | https://github.com/kevinoid/promised-read/blob/c6adf477f4a64d5142363d84f7f83f5f07b8f682/index.js#L529-L591 | train |
kevinoid/promised-read | index.js | readToEnd | function readToEnd(stream, options) {
function until(result, chunk, ended) {
return ended;
}
return readInternal(stream, undefined, until, options);
} | javascript | function readToEnd(stream, options) {
function until(result, chunk, ended) {
return ended;
}
return readInternal(stream, undefined, until, options);
} | [
"function",
"readToEnd",
"(",
"stream",
",",
"options",
")",
"{",
"function",
"until",
"(",
"result",
",",
"chunk",
",",
"ended",
")",
"{",
"return",
"ended",
";",
"}",
"return",
"readInternal",
"(",
"stream",
",",
"undefined",
",",
"until",
",",
"option... | Reads from a stream.Readable until 'end' is emitted.
@param {stream.Readable} stream Stream from which to read.
@param {ReadOptions=} options Options.
@return {Promise<!Buffer|string|!Array>|
CancellableReadPromise<!Buffer|string|!Array>} Promise with the data read,
<code>null</code> if no data was read, or an <code>Er... | [
"Reads",
"from",
"a",
"stream",
".",
"Readable",
"until",
"end",
"is",
"emitted",
"."
] | c6adf477f4a64d5142363d84f7f83f5f07b8f682 | https://github.com/kevinoid/promised-read/blob/c6adf477f4a64d5142363d84f7f83f5f07b8f682/index.js#L604-L609 | train |
kevinoid/promised-read | index.js | readToMatch | function readToMatch(stream, regexp, options) {
const endOK = Boolean(options && (options.endOK || options.endOk));
const maxMatchLen = Number(options && options.maxMatchLen);
// Convert to RegExp where necessary, like String.prototype.match
// Make sure RegExp has global flag so lastIndex will be set
if (!(r... | javascript | function readToMatch(stream, regexp, options) {
const endOK = Boolean(options && (options.endOK || options.endOk));
const maxMatchLen = Number(options && options.maxMatchLen);
// Convert to RegExp where necessary, like String.prototype.match
// Make sure RegExp has global flag so lastIndex will be set
if (!(r... | [
"function",
"readToMatch",
"(",
"stream",
",",
"regexp",
",",
"options",
")",
"{",
"const",
"endOK",
"=",
"Boolean",
"(",
"options",
"&&",
"(",
"options",
".",
"endOK",
"||",
"options",
".",
"endOk",
")",
")",
";",
"const",
"maxMatchLen",
"=",
"Number",
... | Reads from a stream.Readable until a given expression is matched.
<p>This function calls {@link readUntil} with an <code>until</code> function
which applies <code>regexp</code> to the data read.</p>
<p>Doc note: options should be a ReadToMatchOptions type which extends
ReadToOptions, but record types can't currently... | [
"Reads",
"from",
"a",
"stream",
".",
"Readable",
"until",
"a",
"given",
"expression",
"is",
"matched",
"."
] | c6adf477f4a64d5142363d84f7f83f5f07b8f682 | https://github.com/kevinoid/promised-read/blob/c6adf477f4a64d5142363d84f7f83f5f07b8f682/index.js#L641-L678 | train |
HaroldPutman/hubot-taboo-topics | src/main.js | loadList | function loadList(brain) {
const taboolist = brain.get("taboo");
if (taboolist != null) {
for (let topic of taboolist) {
taboo.set(topic, new RegExp(`\\b${topic}\\b`, "i"));
}
}
} | javascript | function loadList(brain) {
const taboolist = brain.get("taboo");
if (taboolist != null) {
for (let topic of taboolist) {
taboo.set(topic, new RegExp(`\\b${topic}\\b`, "i"));
}
}
} | [
"function",
"loadList",
"(",
"brain",
")",
"{",
"const",
"taboolist",
"=",
"brain",
".",
"get",
"(",
"\"taboo\"",
")",
";",
"if",
"(",
"taboolist",
"!=",
"null",
")",
"{",
"for",
"(",
"let",
"topic",
"of",
"taboolist",
")",
"{",
"taboo",
".",
"set",
... | Recall the Taboo list from brain | [
"Recall",
"the",
"Taboo",
"list",
"from",
"brain"
] | 0868ce82cd259dd8701d4b069014d295811d6904 | https://github.com/HaroldPutman/hubot-taboo-topics/blob/0868ce82cd259dd8701d4b069014d295811d6904/src/main.js#L44-L51 | train |
HaroldPutman/hubot-taboo-topics | src/main.js | saveList | function saveList(brain) {
const taboolist = [];
taboo.forEach((re, topic) => {
taboolist.push(topic);
});
brain.set("taboo", taboolist);
} | javascript | function saveList(brain) {
const taboolist = [];
taboo.forEach((re, topic) => {
taboolist.push(topic);
});
brain.set("taboo", taboolist);
} | [
"function",
"saveList",
"(",
"brain",
")",
"{",
"const",
"taboolist",
"=",
"[",
"]",
";",
"taboo",
".",
"forEach",
"(",
"(",
"re",
",",
"topic",
")",
"=>",
"{",
"taboolist",
".",
"push",
"(",
"topic",
")",
";",
"}",
")",
";",
"brain",
".",
"set",... | Stores the taboolist in brain. | [
"Stores",
"the",
"taboolist",
"in",
"brain",
"."
] | 0868ce82cd259dd8701d4b069014d295811d6904 | https://github.com/HaroldPutman/hubot-taboo-topics/blob/0868ce82cd259dd8701d4b069014d295811d6904/src/main.js#L80-L86 | train |
HaroldPutman/hubot-taboo-topics | src/main.js | deleteTopic | function deleteTopic(res, topic) {
const keyTopic = topic.toLowerCase();
if (taboo.delete(keyTopic)) {
res.reply(capitalize(`${topic} is no longer taboo`));
saveList(res.robot.brain);
} else {
res.reply(`Oops, ${topic} is not taboo`);
}
} | javascript | function deleteTopic(res, topic) {
const keyTopic = topic.toLowerCase();
if (taboo.delete(keyTopic)) {
res.reply(capitalize(`${topic} is no longer taboo`));
saveList(res.robot.brain);
} else {
res.reply(`Oops, ${topic} is not taboo`);
}
} | [
"function",
"deleteTopic",
"(",
"res",
",",
"topic",
")",
"{",
"const",
"keyTopic",
"=",
"topic",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"taboo",
".",
"delete",
"(",
"keyTopic",
")",
")",
"{",
"res",
".",
"reply",
"(",
"capitalize",
"(",
"`",
... | Removes a topic from the taboo list. | [
"Removes",
"a",
"topic",
"from",
"the",
"taboo",
"list",
"."
] | 0868ce82cd259dd8701d4b069014d295811d6904 | https://github.com/HaroldPutman/hubot-taboo-topics/blob/0868ce82cd259dd8701d4b069014d295811d6904/src/main.js#L91-L99 | train |
HaroldPutman/hubot-taboo-topics | src/main.js | addTopic | function addTopic(res, topic) {
const keyTopic = topic.toLowerCase();
if (!taboo.has(keyTopic)) {
taboo.set(keyTopic, new RegExp(`\\b${topic}\\b`, "i"));
saveList(res.robot.brain);
res.reply(capitalize(`${topic} is now taboo`));
} else {
res.reply(`Oops, ${topic} is already taboo`);
... | javascript | function addTopic(res, topic) {
const keyTopic = topic.toLowerCase();
if (!taboo.has(keyTopic)) {
taboo.set(keyTopic, new RegExp(`\\b${topic}\\b`, "i"));
saveList(res.robot.brain);
res.reply(capitalize(`${topic} is now taboo`));
} else {
res.reply(`Oops, ${topic} is already taboo`);
... | [
"function",
"addTopic",
"(",
"res",
",",
"topic",
")",
"{",
"const",
"keyTopic",
"=",
"topic",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"!",
"taboo",
".",
"has",
"(",
"keyTopic",
")",
")",
"{",
"taboo",
".",
"set",
"(",
"keyTopic",
",",
"new",... | Adds a new taboo topic. | [
"Adds",
"a",
"new",
"taboo",
"topic",
"."
] | 0868ce82cd259dd8701d4b069014d295811d6904 | https://github.com/HaroldPutman/hubot-taboo-topics/blob/0868ce82cd259dd8701d4b069014d295811d6904/src/main.js#L104-L113 | train |
HaroldPutman/hubot-taboo-topics | src/main.js | listTopics | function listTopics(res) {
loadList(res.robot.brain); // Not necessary, but helps for testing.
if (taboo.size == 0) {
res.reply("Nothing is taboo here.");
} else {
let topics = [];
taboo.forEach((re, topic) => {
topics.push(topic);
})
res.reply("Taboo topics are: " + to... | javascript | function listTopics(res) {
loadList(res.robot.brain); // Not necessary, but helps for testing.
if (taboo.size == 0) {
res.reply("Nothing is taboo here.");
} else {
let topics = [];
taboo.forEach((re, topic) => {
topics.push(topic);
})
res.reply("Taboo topics are: " + to... | [
"function",
"listTopics",
"(",
"res",
")",
"{",
"loadList",
"(",
"res",
".",
"robot",
".",
"brain",
")",
";",
"// Not necessary, but helps for testing.",
"if",
"(",
"taboo",
".",
"size",
"==",
"0",
")",
"{",
"res",
".",
"reply",
"(",
"\"Nothing is taboo here... | Lists all the taboo topics. | [
"Lists",
"all",
"the",
"taboo",
"topics",
"."
] | 0868ce82cd259dd8701d4b069014d295811d6904 | https://github.com/HaroldPutman/hubot-taboo-topics/blob/0868ce82cd259dd8701d4b069014d295811d6904/src/main.js#L118-L129 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | extend | function extend(what, whit) {
Object.keys(whit).forEach(function(key) {
var def = whit[key];
if (what[key] === undefined) {
if (def.get && def.set) {
// TODO: look at element.dataset polyfill (iOS?)
} else {
what[key] = def;
}
}
});
} | javascript | function extend(what, whit) {
Object.keys(whit).forEach(function(key) {
var def = whit[key];
if (what[key] === undefined) {
if (def.get && def.set) {
// TODO: look at element.dataset polyfill (iOS?)
} else {
what[key] = def;
}
}
});
} | [
"function",
"extend",
"(",
"what",
",",
"whit",
")",
"{",
"Object",
".",
"keys",
"(",
"whit",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"var",
"def",
"=",
"whit",
"[",
"key",
"]",
";",
"if",
"(",
"what",
"[",
"key",
"]",
"==="... | Extend one object with another.
@param {object} what Native prototype
@param {object} whit Extension methods | [
"Extend",
"one",
"object",
"with",
"another",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L20-L31 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | strings | function strings() {
extend(String.prototype, {
trim: function() {
return this.replace(/^\s*/, "").replace(/\s*$/, "");
},
repeat: function(n) {
return new Array(n + 1).join(this);
},
startsWith: function(sub) {
return this.indexOf(sub) === 0;
},
endsWith: function(sub) {
sub = St... | javascript | function strings() {
extend(String.prototype, {
trim: function() {
return this.replace(/^\s*/, "").replace(/\s*$/, "");
},
repeat: function(n) {
return new Array(n + 1).join(this);
},
startsWith: function(sub) {
return this.indexOf(sub) === 0;
},
endsWith: function(sub) {
sub = St... | [
"function",
"strings",
"(",
")",
"{",
"extend",
"(",
"String",
".",
"prototype",
",",
"{",
"trim",
":",
"function",
"(",
")",
"{",
"return",
"this",
".",
"replace",
"(",
"/",
"^\\s*",
"/",
",",
"\"\"",
")",
".",
"replace",
"(",
"/",
"\\s*$",
"/",
... | Patching `String.prototype` | [
"Patching",
"String",
".",
"prototype"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L36-L59 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | arrays | function arrays() {
extend(Array, {
every: function every(array, fun, thisp) {
var res = true,
len = array.length >>> 0;
for (var i = 0; i < len; i++) {
if (array[i] !== undefined) {
if (!fun.call(thisp, array[i], i, array)) {
res = false;
break;
}
}
}
retur... | javascript | function arrays() {
extend(Array, {
every: function every(array, fun, thisp) {
var res = true,
len = array.length >>> 0;
for (var i = 0; i < len; i++) {
if (array[i] !== undefined) {
if (!fun.call(thisp, array[i], i, array)) {
res = false;
break;
}
}
}
retur... | [
"function",
"arrays",
"(",
")",
"{",
"extend",
"(",
"Array",
",",
"{",
"every",
":",
"function",
"every",
"(",
"array",
",",
"fun",
",",
"thisp",
")",
"{",
"var",
"res",
"=",
"true",
",",
"len",
"=",
"array",
".",
"length",
">>>",
"0",
";",
"for"... | Patching arrays. | [
"Patching",
"arrays",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L64-L110 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(action, thisp) {
var is = this.initialized;
if (arguments.length) {
if (is) {
action.call(thisp);
} else {
this._initcallbacks = this._initcallbacks || [];
this._initcallbacks.push(function() {
if (gui.debug) {
try {
action.call(thisp);
} catch (exceptio... | javascript | function(action, thisp) {
var is = this.initialized;
if (arguments.length) {
if (is) {
action.call(thisp);
} else {
this._initcallbacks = this._initcallbacks || [];
this._initcallbacks.push(function() {
if (gui.debug) {
try {
action.call(thisp);
} catch (exceptio... | [
"function",
"(",
"action",
",",
"thisp",
")",
"{",
"var",
"is",
"=",
"this",
".",
"initialized",
";",
"if",
"(",
"arguments",
".",
"length",
")",
"{",
"if",
"(",
"is",
")",
"{",
"action",
".",
"call",
"(",
"thisp",
")",
";",
"}",
"else",
"{",
"... | Do something before the spirits get here.
if that's already too late, just do it now.
@param @optional {function} action
@param @optional {object} thisp
@returns {boolean} True when ready already | [
"Do",
"something",
"before",
"the",
"spirits",
"get",
"here",
".",
"if",
"that",
"s",
"already",
"too",
"late",
"just",
"do",
"it",
"now",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L531-L553 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(action, thisp) {
this.init(action, thisp);
if(gui.debug) {
console.warn('gui.ready() is for spirits, use gui.init()');
}
return false;
} | javascript | function(action, thisp) {
this.init(action, thisp);
if(gui.debug) {
console.warn('gui.ready() is for spirits, use gui.init()');
}
return false;
} | [
"function",
"(",
"action",
",",
"thisp",
")",
"{",
"this",
".",
"init",
"(",
"action",
",",
"thisp",
")",
";",
"if",
"(",
"gui",
".",
"debug",
")",
"{",
"console",
".",
"warn",
"(",
"'gui.ready() is for spirits, use gui.init()'",
")",
";",
"}",
"return",... | Featured in core-spirits@wunderbyte.com
@param @optional {function} action
@param @optional {object} thisp
@returns {boolean} True when ready already (so false) | [
"Featured",
"in",
"core",
"-",
"spirits"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L561-L567 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(name, module) {
var Module;
if (gui.Type.isString(name) && name.length) {
Module = gui.Module.extend(name, module || {});
module = gui.Module.$register(new Module(name));
return module;
} else {
throw new Error("Module needs an identity token");
}
} | javascript | function(name, module) {
var Module;
if (gui.Type.isString(name) && name.length) {
Module = gui.Module.extend(name, module || {});
module = gui.Module.$register(new Module(name));
return module;
} else {
throw new Error("Module needs an identity token");
}
} | [
"function",
"(",
"name",
",",
"module",
")",
"{",
"var",
"Module",
";",
"if",
"(",
"gui",
".",
"Type",
".",
"isString",
"(",
"name",
")",
"&&",
"name",
".",
"length",
")",
"{",
"Module",
"=",
"gui",
".",
"Module",
".",
"extend",
"(",
"name",
",",... | Register module.
@param {String} name
@param {object} module
@returns {gui.Module} | [
"Register",
"module",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L575-L584 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(ns, members) {
var no;
if (gui.Type.isString(ns)) {
no = gui.Object.lookup(ns);
no = new gui.Namespace(ns);
no = gui.Object.assert(ns, no);
} else {
throw new TypeError("Expected a namespace string");
}
return gui.Object.extend(no, members || {});
} | javascript | function(ns, members) {
var no;
if (gui.Type.isString(ns)) {
no = gui.Object.lookup(ns);
no = new gui.Namespace(ns);
no = gui.Object.assert(ns, no);
} else {
throw new TypeError("Expected a namespace string");
}
return gui.Object.extend(no, members || {});
} | [
"function",
"(",
"ns",
",",
"members",
")",
"{",
"var",
"no",
";",
"if",
"(",
"gui",
".",
"Type",
".",
"isString",
"(",
"ns",
")",
")",
"{",
"no",
"=",
"gui",
".",
"Object",
".",
"lookup",
"(",
"ns",
")",
";",
"no",
"=",
"new",
"gui",
".",
... | Declare namespace. Optionally add members.
@param {String} ns
@param {Map<String,object>} members
@returns {gui.Namespace} | [
"Declare",
"namespace",
".",
"Optionally",
"add",
"members",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L622-L632 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(msg, arg) {
if (gui.Type.isEvent(arg)) {
arg = new gui.EventSummary(arg);
}
gui.Broadcast.dispatchGlobal(msg, arg);
} | javascript | function(msg, arg) {
if (gui.Type.isEvent(arg)) {
arg = new gui.EventSummary(arg);
}
gui.Broadcast.dispatchGlobal(msg, arg);
} | [
"function",
"(",
"msg",
",",
"arg",
")",
"{",
"if",
"(",
"gui",
".",
"Type",
".",
"isEvent",
"(",
"arg",
")",
")",
"{",
"arg",
"=",
"new",
"gui",
".",
"EventSummary",
"(",
"arg",
")",
";",
"}",
"gui",
".",
"Broadcast",
".",
"dispatchGlobal",
"(",... | Broadcast something globally. Events will be wrapped in an EventSummary.
@param {String} message gui.BROADCAST_MOUSECLICK or similar
@param @optional {object} arg This could well be a MouseEvent | [
"Broadcast",
"something",
"globally",
".",
"Events",
"will",
"be",
"wrapped",
"in",
"an",
"EventSummary",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L639-L644 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(o, name) {
gui.Object.each(o, function(key, value) {
if (key !== "$superclass" && gui.Type.isConstructor(value)) {
if (value.$classname === gui.Class.ANONYMOUS) {
Object.defineProperty(value, '$classname', {
value: name + "." + key,
enumerable: true,
writable: false
... | javascript | function(o, name) {
gui.Object.each(o, function(key, value) {
if (key !== "$superclass" && gui.Type.isConstructor(value)) {
if (value.$classname === gui.Class.ANONYMOUS) {
Object.defineProperty(value, '$classname', {
value: name + "." + key,
enumerable: true,
writable: false
... | [
"function",
"(",
"o",
",",
"name",
")",
"{",
"gui",
".",
"Object",
".",
"each",
"(",
"o",
",",
"function",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"key",
"!==",
"\"$superclass\"",
"&&",
"gui",
".",
"Type",
".",
"isConstructor",
"(",
"value",... | Name members recursively.
@param {object|function} o
@param {String} name | [
"Name",
"members",
"recursively",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L749-L762 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(string) {
var hit = null,
looks = false;
if (gui.Type.isString(string)) {
hit = this.extractKey(string);
looks = hit && hit[0] === string;
}
return looks;
} | javascript | function(string) {
var hit = null,
looks = false;
if (gui.Type.isString(string)) {
hit = this.extractKey(string);
looks = hit && hit[0] === string;
}
return looks;
} | [
"function",
"(",
"string",
")",
"{",
"var",
"hit",
"=",
"null",
",",
"looks",
"=",
"false",
";",
"if",
"(",
"gui",
".",
"Type",
".",
"isString",
"(",
"string",
")",
")",
"{",
"hit",
"=",
"this",
".",
"extractKey",
"(",
"string",
")",
";",
"looks"... | String appears to be a generated key? We don't look it up in the key cache,
so this method can be used to check a key that was generated in old session.
@param {String} string
@returns {boolean} | [
"String",
"appears",
"to",
"be",
"a",
"generated",
"key?",
"We",
"don",
"t",
"look",
"it",
"up",
"in",
"the",
"key",
"cache",
"so",
"this",
"method",
"can",
"be",
"used",
"to",
"check",
"a",
"key",
"that",
"was",
"generated",
"in",
"old",
"session",
... | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L811-L819 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(proto, props) {
var resolved = {};
Object.keys(props).forEach(function(prop) {
resolved[prop] = {
value: props[prop],
writable: true,
enumerable: true,
configurable: true
};
});
return Object.create(proto, resolved);
} | javascript | function(proto, props) {
var resolved = {};
Object.keys(props).forEach(function(prop) {
resolved[prop] = {
value: props[prop],
writable: true,
enumerable: true,
configurable: true
};
});
return Object.create(proto, resolved);
} | [
"function",
"(",
"proto",
",",
"props",
")",
"{",
"var",
"resolved",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"props",
")",
".",
"forEach",
"(",
"function",
"(",
"prop",
")",
"{",
"resolved",
"[",
"prop",
"]",
"=",
"{",
"value",
":",
"prop... | Object.create with default property descriptors.
@see http://wiki.ecmascript.org/doku.php?id=strawman:define_properties_operator
@param {object} proto
@param {object} props | [
"Object",
".",
"create",
"with",
"default",
"property",
"descriptors",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L854-L865 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(source, domap, thisp) {
var result = {},
mapping;
this.each(source, function(key, value) {
mapping = domap.call(thisp, key, value);
if (mapping !== undefined) {
result[key] = mapping;
}
});
return result;
} | javascript | function(source, domap, thisp) {
var result = {},
mapping;
this.each(source, function(key, value) {
mapping = domap.call(thisp, key, value);
if (mapping !== undefined) {
result[key] = mapping;
}
});
return result;
} | [
"function",
"(",
"source",
",",
"domap",
",",
"thisp",
")",
"{",
"var",
"result",
"=",
"{",
"}",
",",
"mapping",
";",
"this",
".",
"each",
"(",
"source",
",",
"function",
"(",
"key",
",",
"value",
")",
"{",
"mapping",
"=",
"domap",
".",
"call",
"... | Create new object by passing all property
names and values through a resolver call.
Eliminate values that map to `undefined`.
@param {object} source
@param {function} domap
@param @optional {object} thisp
@returns {object} | [
"Create",
"new",
"object",
"by",
"passing",
"all",
"property",
"names",
"and",
"values",
"through",
"a",
"resolver",
"call",
".",
"Eliminate",
"values",
"that",
"map",
"to",
"undefined",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L957-L967 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(opath, context) {
var result, struct = context || self;
if (gui.Type.isString(opath)) {
if (!opath.contains(".")) {
result = struct[opath];
} else {
var parts = opath.split(".");
parts.every(function(part) {
struct = struct[part];
return gui.Type.isDefined(struct);
});
r... | javascript | function(opath, context) {
var result, struct = context || self;
if (gui.Type.isString(opath)) {
if (!opath.contains(".")) {
result = struct[opath];
} else {
var parts = opath.split(".");
parts.every(function(part) {
struct = struct[part];
return gui.Type.isDefined(struct);
});
r... | [
"function",
"(",
"opath",
",",
"context",
")",
"{",
"var",
"result",
",",
"struct",
"=",
"context",
"||",
"self",
";",
"if",
"(",
"gui",
".",
"Type",
".",
"isString",
"(",
"opath",
")",
")",
"{",
"if",
"(",
"!",
"opath",
".",
"contains",
"(",
"\"... | Lookup object for string of type "my.ns.Thing" in given context or this window.
@param {String} opath Object path eg. "my.ns.Thing"
@param @optional {Window} context
@returns {object} | [
"Lookup",
"object",
"for",
"string",
"of",
"type",
"my",
".",
"ns",
".",
"Thing",
"in",
"given",
"context",
"or",
"this",
"window",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L975-L992 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(desc) {
if (desc.value && gui.Type.isFunction(desc.value)) {
if (desc.value.$hidden && desc.configurable) {
desc.enumerable = false;
}
}
return desc;
} | javascript | function(desc) {
if (desc.value && gui.Type.isFunction(desc.value)) {
if (desc.value.$hidden && desc.configurable) {
desc.enumerable = false;
}
}
return desc;
} | [
"function",
"(",
"desc",
")",
"{",
"if",
"(",
"desc",
".",
"value",
"&&",
"gui",
".",
"Type",
".",
"isFunction",
"(",
"desc",
".",
"value",
")",
")",
"{",
"if",
"(",
"desc",
".",
"value",
".",
"$hidden",
"&&",
"desc",
".",
"configurable",
")",
"{... | Modify method descriptor to hide from inspection.
Do note that the method may still be called upon.
@param {object} desc
@returns {object} | [
"Modify",
"method",
"descriptor",
"to",
"hide",
"from",
"inspection",
".",
"Do",
"note",
"that",
"the",
"method",
"may",
"still",
"be",
"called",
"upon",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1117-L1124 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(o) {
var type = ({}).toString.call(o).match(this._typeexp)[1].toLowerCase();
if (type === "domwindow" && String(typeof o) === "undefined") {
type = "undefined"; // some kind of degenerate bug in Safari on iPad
}
return type;
} | javascript | function(o) {
var type = ({}).toString.call(o).match(this._typeexp)[1].toLowerCase();
if (type === "domwindow" && String(typeof o) === "undefined") {
type = "undefined"; // some kind of degenerate bug in Safari on iPad
}
return type;
} | [
"function",
"(",
"o",
")",
"{",
"var",
"type",
"=",
"(",
"{",
"}",
")",
".",
"toString",
".",
"call",
"(",
"o",
")",
".",
"match",
"(",
"this",
".",
"_typeexp",
")",
"[",
"1",
"]",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"type",
"===",
... | Get type of argument. Note that response may differ between user agents.
@see http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator
@param {object} o
@returns {String} | [
"Get",
"type",
"of",
"argument",
".",
"Note",
"that",
"response",
"may",
"differ",
"between",
"user",
"agents",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1140-L1146 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(o) {
return o && o.document && o.location && o.alert && o.setInterval;
} | javascript | function(o) {
return o && o.document && o.location && o.alert && o.setInterval;
} | [
"function",
"(",
"o",
")",
"{",
"return",
"o",
"&&",
"o",
".",
"document",
"&&",
"o",
".",
"location",
"&&",
"o",
".",
"alert",
"&&",
"o",
".",
"setInterval",
";",
"}"
] | Is Window object?
@param {object} o
@returns {boolean} | [
"Is",
"Window",
"object?"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1180-L1182 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(what) {
return this.isFunction(what) &&
this.isObject(what.prototype) &&
Object.keys(what.prototype).length;
} | javascript | function(what) {
return this.isFunction(what) &&
this.isObject(what.prototype) &&
Object.keys(what.prototype).length;
} | [
"function",
"(",
"what",
")",
"{",
"return",
"this",
".",
"isFunction",
"(",
"what",
")",
"&&",
"this",
".",
"isObject",
"(",
"what",
".",
"prototype",
")",
"&&",
"Object",
".",
"keys",
"(",
"what",
".",
"prototype",
")",
".",
"length",
";",
"}"
] | Is function fit to be invoked via the "new" operator?
We assume so if the prototype reveals any properties.
@param {function} what
@returns {boolean} | [
"Is",
"function",
"fit",
"to",
"be",
"invoked",
"via",
"the",
"new",
"operator?",
"We",
"assume",
"so",
"if",
"the",
"prototype",
"reveals",
"any",
"properties",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1226-L1230 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(string) {
var result = String(string);
switch (result) {
case "null":
result = null;
break;
case "true":
case "false":
result = (result === "true");
break;
default:
if (String(parseInt(result, 10)) === result) {
result = parseInt(result, 10);
} else if (String(parse... | javascript | function(string) {
var result = String(string);
switch (result) {
case "null":
result = null;
break;
case "true":
case "false":
result = (result === "true");
break;
default:
if (String(parseInt(result, 10)) === result) {
result = parseInt(result, 10);
} else if (String(parse... | [
"function",
"(",
"string",
")",
"{",
"var",
"result",
"=",
"String",
"(",
"string",
")",
";",
"switch",
"(",
"result",
")",
"{",
"case",
"\"null\"",
":",
"result",
"=",
"null",
";",
"break",
";",
"case",
"\"true\"",
":",
"case",
"\"false\"",
":",
"re... | Autocast string to an inferred type. "123" will
return a number, "false" will return a boolean.
@param {String} string
@returns {object} | [
"Autocast",
"string",
"to",
"an",
"inferred",
"type",
".",
"123",
"will",
"return",
"a",
"number",
"false",
"will",
"return",
"a",
"boolean",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1265-L1284 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(/* ...types */) {
var types = gui.Array.from(arguments);
return function(action) {
return function() {
if (gui.Arguments._match(arguments, types)) {
return action.apply(this, arguments);
}
};
};
} | javascript | function(/* ...types */) {
var types = gui.Array.from(arguments);
return function(action) {
return function() {
if (gui.Arguments._match(arguments, types)) {
return action.apply(this, arguments);
}
};
};
} | [
"function",
"(",
"/* ...types */",
")",
"{",
"var",
"types",
"=",
"gui",
".",
"Array",
".",
"from",
"(",
"arguments",
")",
";",
"return",
"function",
"(",
"action",
")",
"{",
"return",
"function",
"(",
")",
"{",
"if",
"(",
"gui",
".",
"Arguments",
".... | Forgiving arguments matcher.
Ignores action if no match. | [
"Forgiving",
"arguments",
"matcher",
".",
"Ignores",
"action",
"if",
"no",
"match",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1428-L1437 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(/* ...types */) {
var types = gui.Array.from(arguments);
return function(action) {
return function() {
if (gui.Arguments._validate(arguments, types)) {
return action.apply(this, arguments);
} else {
gui.Arguments._abort(this);
}
};
};
} | javascript | function(/* ...types */) {
var types = gui.Array.from(arguments);
return function(action) {
return function() {
if (gui.Arguments._validate(arguments, types)) {
return action.apply(this, arguments);
} else {
gui.Arguments._abort(this);
}
};
};
} | [
"function",
"(",
"/* ...types */",
")",
"{",
"var",
"types",
"=",
"gui",
".",
"Array",
".",
"from",
"(",
"arguments",
")",
";",
"return",
"function",
"(",
"action",
")",
"{",
"return",
"function",
"(",
")",
"{",
"if",
"(",
"gui",
".",
"Arguments",
".... | Revengeful arguments validator.
Throws an exception if no match. | [
"Revengeful",
"arguments",
"validator",
".",
"Throws",
"an",
"exception",
"if",
"no",
"match",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1443-L1454 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(xpect, arg, index) {
var needs = !xpect.startsWith("(");
var split = this._xtract(xpect, !needs).split("|");
var input = gui.Type.of(arg);
var match = (xpect === "*" ||
(xpect === 'node' && arg && arg.nodeType) ||
(xpect === 'element' && arg && arg.nodeType === Node.ELEMENT_NODE) ||
(xpect =... | javascript | function(xpect, arg, index) {
var needs = !xpect.startsWith("(");
var split = this._xtract(xpect, !needs).split("|");
var input = gui.Type.of(arg);
var match = (xpect === "*" ||
(xpect === 'node' && arg && arg.nodeType) ||
(xpect === 'element' && arg && arg.nodeType === Node.ELEMENT_NODE) ||
(xpect =... | [
"function",
"(",
"xpect",
",",
"arg",
",",
"index",
")",
"{",
"var",
"needs",
"=",
"!",
"xpect",
".",
"startsWith",
"(",
"\"(\"",
")",
";",
"var",
"split",
"=",
"this",
".",
"_xtract",
"(",
"xpect",
",",
"!",
"needs",
")",
".",
"split",
"(",
"\"|... | Check if argument matches expected type.
@param {string} xpect
@param {object} arg
@param {number} index
@returns {boolean} | [
"Check",
"if",
"argument",
"matches",
"expected",
"type",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1515-L1533 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(that) {
var summ = this._bugsummary;
var name = that.constructor.$classname || String(that);
console.error([
"Bad argument " + summ.shift(),
"for " + name + ":",
"Expected " + summ.shift() + ",",
"got " + summ.shift() + ":",
summ.shift()
].join(" "));
} | javascript | function(that) {
var summ = this._bugsummary;
var name = that.constructor.$classname || String(that);
console.error([
"Bad argument " + summ.shift(),
"for " + name + ":",
"Expected " + summ.shift() + ",",
"got " + summ.shift() + ":",
summ.shift()
].join(" "));
} | [
"function",
"(",
"that",
")",
"{",
"var",
"summ",
"=",
"this",
".",
"_bugsummary",
";",
"var",
"name",
"=",
"that",
".",
"constructor",
".",
"$classname",
"||",
"String",
"(",
"that",
")",
";",
"console",
".",
"error",
"(",
"[",
"\"Bad argument \"",
"+... | Throw exception.
@TODO: Rig up to report offended methods name.
@param {object} that
@param {Array<String>} report | [
"Throw",
"exception",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1541-L1551 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(name, params, body, context) {
var F = context ? context.Function : Function;
name = this.safename(name);
params = params ? params.join(",") : "";
body = body || "";
return new F(
"return function " + name + " ( " + params + " ) {" + body + "}"
)();
} | javascript | function(name, params, body, context) {
var F = context ? context.Function : Function;
name = this.safename(name);
params = params ? params.join(",") : "";
body = body || "";
return new F(
"return function " + name + " ( " + params + " ) {" + body + "}"
)();
} | [
"function",
"(",
"name",
",",
"params",
",",
"body",
",",
"context",
")",
"{",
"var",
"F",
"=",
"context",
"?",
"context",
".",
"Function",
":",
"Function",
";",
"name",
"=",
"this",
".",
"safename",
"(",
"name",
")",
";",
"params",
"=",
"params",
... | Create named function. This may not be the most optimized thing to compile.
@see https://mail.mozilla.org/pipermail/es-discuss/2009-March/008954.html
@see http://wiki.ecmascript.org/doku.php?id=strawman:name_property_of_functions
@param @optional {String} name
@param @optional {Array<String>} params
@param @optional {S... | [
"Create",
"named",
"function",
".",
"This",
"may",
"not",
"be",
"the",
"most",
"optimized",
"thing",
"to",
"compile",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1571-L1579 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function() {
var b = this._breakdown_base(arguments);
var C = this._createclass(null, b.proto, b.name);
gui.Object.extend(C.prototype, b.protos);
gui.Object.extend(C, b.statics);
gui.Property.extendall(b.protos, C.prototype);
if (b.recurring) {
gui.Object.each(b.recurring, function(key, val) {
var de... | javascript | function() {
var b = this._breakdown_base(arguments);
var C = this._createclass(null, b.proto, b.name);
gui.Object.extend(C.prototype, b.protos);
gui.Object.extend(C, b.statics);
gui.Property.extendall(b.protos, C.prototype);
if (b.recurring) {
gui.Object.each(b.recurring, function(key, val) {
var de... | [
"function",
"(",
")",
"{",
"var",
"b",
"=",
"this",
".",
"_breakdown_base",
"(",
"arguments",
")",
";",
"var",
"C",
"=",
"this",
".",
"_createclass",
"(",
"null",
",",
"b",
".",
"proto",
",",
"b",
".",
"name",
")",
";",
"gui",
".",
"Object",
".",... | Create constructor. Use method `extend` on
the constructor to subclass further.
@param @optional {String} name
@param {object} proto Base prototype
@param {object} protos Prototype extensions
@param {object} recurring Constructor and subconstructor extensions
@param {object} statics Constructor extensions
@returns {fun... | [
"Create",
"constructor",
".",
"Use",
"method",
"extend",
"on",
"the",
"constructor",
"to",
"subclass",
"further",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1671-L1686 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(SuperC, args) {
args = this._breakdown_subs(args);
return this._extendclass(
SuperC,
args.protos,
args.recurring,
args.statics,
args.name
);
} | javascript | function(SuperC, args) {
args = this._breakdown_subs(args);
return this._extendclass(
SuperC,
args.protos,
args.recurring,
args.statics,
args.name
);
} | [
"function",
"(",
"SuperC",
",",
"args",
")",
"{",
"args",
"=",
"this",
".",
"_breakdown_subs",
"(",
"args",
")",
";",
"return",
"this",
".",
"_extendclass",
"(",
"SuperC",
",",
"args",
".",
"protos",
",",
"args",
".",
"recurring",
",",
"args",
".",
"... | Create subclass for given class.
@param {funciton} SuperC
@param {Object} args
@return {function} | [
"Create",
"subclass",
"for",
"given",
"class",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1826-L1835 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(SuperC, protos, recurring, statics, name) {
var C = this._createclass(SuperC, SuperC.prototype, name);
gui.Object.extend(C, statics);
gui.Object.extend(C.$recurring, recurring);
gui.Object.each(C.$recurring, function(key, val) {
var desc = Object.getOwnPropertyDescriptor(C, key);
if (!desc || des... | javascript | function(SuperC, protos, recurring, statics, name) {
var C = this._createclass(SuperC, SuperC.prototype, name);
gui.Object.extend(C, statics);
gui.Object.extend(C.$recurring, recurring);
gui.Object.each(C.$recurring, function(key, val) {
var desc = Object.getOwnPropertyDescriptor(C, key);
if (!desc || des... | [
"function",
"(",
"SuperC",
",",
"protos",
",",
"recurring",
",",
"statics",
",",
"name",
")",
"{",
"var",
"C",
"=",
"this",
".",
"_createclass",
"(",
"SuperC",
",",
"SuperC",
".",
"prototype",
",",
"name",
")",
";",
"gui",
".",
"Object",
".",
"extend... | Create subclass constructor.
@param {object} SuperC super constructor
@param {object} protos Prototype extensions
@param {object} recurring Constructor and subconstructor extensions
@param {object} statics Constructor extensions
@param {String} generated display name (for development)
@returns {function} Constructor | [
"Create",
"subclass",
"constructor",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1846-L1859 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(C, SuperC) {
C.$super = null; // what's this?
C.$subclasses = [];
C.$superclass = SuperC || null;
C.$recurring = SuperC ?
gui.Object.copy(SuperC.$recurring) : Object.create(null);
if (SuperC) {
SuperC.$subclasses.push(C);
}
return C;
} | javascript | function(C, SuperC) {
C.$super = null; // what's this?
C.$subclasses = [];
C.$superclass = SuperC || null;
C.$recurring = SuperC ?
gui.Object.copy(SuperC.$recurring) : Object.create(null);
if (SuperC) {
SuperC.$subclasses.push(C);
}
return C;
} | [
"function",
"(",
"C",
",",
"SuperC",
")",
"{",
"C",
".",
"$super",
"=",
"null",
";",
"// what's this?",
"C",
".",
"$subclasses",
"=",
"[",
"]",
";",
"C",
".",
"$superclass",
"=",
"SuperC",
"||",
"null",
";",
"C",
".",
"$recurring",
"=",
"SuperC",
"... | Setup framework internal propeties.
@param {function} C
@param @optional {function} superclass
@param @optional {Map<String,object>} recurring
@returns {function} | [
"Setup",
"framework",
"internal",
"propeties",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1868-L1878 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(proto, recurring, statics) {
Array.forEach(arguments, function(mixins, i) {
if (mixins) {
gui.Object.each(mixins, function(name, value) {
if (i === 0) {
// TODO: something more elaborate (like defineProperty)
this.prototype[name] = value;
} else { // TODO: only at index 1 right?
... | javascript | function(proto, recurring, statics) {
Array.forEach(arguments, function(mixins, i) {
if (mixins) {
gui.Object.each(mixins, function(name, value) {
if (i === 0) {
// TODO: something more elaborate (like defineProperty)
this.prototype[name] = value;
} else { // TODO: only at index 1 right?
... | [
"function",
"(",
"proto",
",",
"recurring",
",",
"statics",
")",
"{",
"Array",
".",
"forEach",
"(",
"arguments",
",",
"function",
"(",
"mixins",
",",
"i",
")",
"{",
"if",
"(",
"mixins",
")",
"{",
"gui",
".",
"Object",
".",
"each",
"(",
"mixins",
",... | Mixin something.
@param {object} proto
@param {object} recurring
@param {object} statics
@returns {function} | [
"Mixin",
"something",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L1979-L1996 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(C, action, thisp) {
var results = [];
action = action || gui.Combo.identity;
C.$subclasses.forEach(function(sub) {
results.push(action.call(thisp, sub));
}, thisp);
return results;
} | javascript | function(C, action, thisp) {
var results = [];
action = action || gui.Combo.identity;
C.$subclasses.forEach(function(sub) {
results.push(action.call(thisp, sub));
}, thisp);
return results;
} | [
"function",
"(",
"C",
",",
"action",
",",
"thisp",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"action",
"=",
"action",
"||",
"gui",
".",
"Combo",
".",
"identity",
";",
"C",
".",
"$subclasses",
".",
"forEach",
"(",
"function",
"(",
"sub",
")",
... | Return superclass. If action is provided, return an array of the results
of executing the action for each subclass with the subclass as argument.
@param {function} C constructor
@param @optional {function} action
@param @optional {object} thisp
@returns {Array<gui.Class|object>} | [
"Return",
"superclass",
".",
"If",
"action",
"is",
"provided",
"return",
"an",
"array",
"of",
"the",
"results",
"of",
"executing",
"the",
"action",
"for",
"each",
"subclass",
"with",
"the",
"subclass",
"as",
"argument",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2029-L2036 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(C, action, thisp, results) {
results = results || [];
action = action || gui.Combo.identity;
C.$subclasses.forEach(function(sub) {
results.push(action.call(thisp, sub));
gui.Class.descendants(sub, action, thisp, results);
}, thisp);
return results;
} | javascript | function(C, action, thisp, results) {
results = results || [];
action = action || gui.Combo.identity;
C.$subclasses.forEach(function(sub) {
results.push(action.call(thisp, sub));
gui.Class.descendants(sub, action, thisp, results);
}, thisp);
return results;
} | [
"function",
"(",
"C",
",",
"action",
",",
"thisp",
",",
"results",
")",
"{",
"results",
"=",
"results",
"||",
"[",
"]",
";",
"action",
"=",
"action",
"||",
"gui",
".",
"Combo",
".",
"identity",
";",
"C",
".",
"$subclasses",
".",
"forEach",
"(",
"fu... | Apply action recursively to all derived subclasses of given class.
Returns an array of accumulated results. If no action is provided,
returns array of descendant sublasses.
@param {function} C constructor
@param @optional {function} action
@param @optional {object} thisp
@param @internal {Array<gui.Class|object>} resul... | [
"Apply",
"action",
"recursively",
"to",
"all",
"derived",
"subclasses",
"of",
"given",
"class",
".",
"Returns",
"an",
"array",
"of",
"accumulated",
"results",
".",
"If",
"no",
"action",
"is",
"provided",
"returns",
"array",
"of",
"descendant",
"sublasses",
"."... | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2048-L2056 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(C, action, thisp) {
var results = [];
action = action || gui.Combo.identity;
results.push(action.call(thisp, C));
return this.descendants(C, action, thisp, results);
} | javascript | function(C, action, thisp) {
var results = [];
action = action || gui.Combo.identity;
results.push(action.call(thisp, C));
return this.descendants(C, action, thisp, results);
} | [
"function",
"(",
"C",
",",
"action",
",",
"thisp",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"action",
"=",
"action",
"||",
"gui",
".",
"Combo",
".",
"identity",
";",
"results",
".",
"push",
"(",
"action",
".",
"call",
"(",
"thisp",
",",
"C... | Return descendant classes and class itself. If action is provided, return
array of the results of executing the action for each descendant class
and class itself with the class as argument.
@param {function} C constructor
@param @optional {function} action
@param @optional {object} thisp
@returns {Array<gui.Class|objec... | [
"Return",
"descendant",
"classes",
"and",
"class",
"itself",
".",
"If",
"action",
"is",
"provided",
"return",
"array",
"of",
"the",
"results",
"of",
"executing",
"the",
"action",
"for",
"each",
"descendant",
"class",
"and",
"class",
"itself",
"with",
"the",
... | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2067-L2072 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(C, action, thisp) {
if (C && C.$superclass) {
action = action || gui.Combo.identity;
return action.call(thisp, C.$superclass);
}
return null;
} | javascript | function(C, action, thisp) {
if (C && C.$superclass) {
action = action || gui.Combo.identity;
return action.call(thisp, C.$superclass);
}
return null;
} | [
"function",
"(",
"C",
",",
"action",
",",
"thisp",
")",
"{",
"if",
"(",
"C",
"&&",
"C",
".",
"$superclass",
")",
"{",
"action",
"=",
"action",
"||",
"gui",
".",
"Combo",
".",
"identity",
";",
"return",
"action",
".",
"call",
"(",
"thisp",
",",
"C... | Return superclass. If action is provided, return the result
of executing the action with the superclass as argument.
@param {function} C constructor
@param @optional {function} action
@param @optional {object} thisp
@returns {gui.Class|object} | [
"Return",
"superclass",
".",
"If",
"action",
"is",
"provided",
"return",
"the",
"result",
"of",
"executing",
"the",
"action",
"with",
"the",
"superclass",
"as",
"argument",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2082-L2088 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(C, action, thisp) {
var results = this.ancestorsAndSelf(C).concat(this.descendants(C));
if (action) {
results = results.map(function(C) {
return action.call(thisp, C);
});
}
return results;
} | javascript | function(C, action, thisp) {
var results = this.ancestorsAndSelf(C).concat(this.descendants(C));
if (action) {
results = results.map(function(C) {
return action.call(thisp, C);
});
}
return results;
} | [
"function",
"(",
"C",
",",
"action",
",",
"thisp",
")",
"{",
"var",
"results",
"=",
"this",
".",
"ancestorsAndSelf",
"(",
"C",
")",
".",
"concat",
"(",
"this",
".",
"descendants",
"(",
"C",
")",
")",
";",
"if",
"(",
"action",
")",
"{",
"results",
... | Return ancestor classes, descendant classes and class itself. If action is
provided, return array of the results of executing the action for each
related class and class itself with the class as argument.
@param {constructor} C
@param @optional {function} action Takes the class as argument
@param @optional {object} thi... | [
"Return",
"ancestor",
"classes",
"descendant",
"classes",
"and",
"class",
"itself",
".",
"If",
"action",
"is",
"provided",
"return",
"array",
"of",
"the",
"results",
"of",
"executing",
"the",
"action",
"for",
"each",
"related",
"class",
"and",
"class",
"itself... | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2134-L2142 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(proto, key, desc) {
var val = desc.value;
if (gui.Type.isObject(val)) {
if (val.getter || val.setter) {
if (this._isactive(val)) {
desc = this._activeaccessor(proto, key, val);
}
}
}
return desc;
} | javascript | function(proto, key, desc) {
var val = desc.value;
if (gui.Type.isObject(val)) {
if (val.getter || val.setter) {
if (this._isactive(val)) {
desc = this._activeaccessor(proto, key, val);
}
}
}
return desc;
} | [
"function",
"(",
"proto",
",",
"key",
",",
"desc",
")",
"{",
"var",
"val",
"=",
"desc",
".",
"value",
";",
"if",
"(",
"gui",
".",
"Type",
".",
"isObject",
"(",
"val",
")",
")",
"{",
"if",
"(",
"val",
".",
"getter",
"||",
"val",
".",
"setter",
... | Copy single property to function prototype.
@param {object} proto
@param {String} key
@param {object} desc
@returns {object} | [
"Copy",
"single",
"property",
"to",
"function",
"prototype",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2318-L2328 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(proto, key, def) {
var desc;
["getter", "setter"].forEach(function(name, set) {
while (proto && proto[key] && !gui.Type.isDefined(def[name])) {
proto = Object.getPrototypeOf(proto);
desc = Object.getOwnPropertyDescriptor(proto, key);
if (desc) {
def[name] = desc[set ? "set" : "get"];
... | javascript | function(proto, key, def) {
var desc;
["getter", "setter"].forEach(function(name, set) {
while (proto && proto[key] && !gui.Type.isDefined(def[name])) {
proto = Object.getPrototypeOf(proto);
desc = Object.getOwnPropertyDescriptor(proto, key);
if (desc) {
def[name] = desc[set ? "set" : "get"];
... | [
"function",
"(",
"proto",
",",
"key",
",",
"def",
")",
"{",
"var",
"desc",
";",
"[",
"\"getter\"",
",",
"\"setter\"",
"]",
".",
"forEach",
"(",
"function",
"(",
"name",
",",
"set",
")",
"{",
"while",
"(",
"proto",
"&&",
"proto",
"[",
"key",
"]",
... | Compute property descriptor for getter-setter
type definition and assign it to the prototype.
@param {object} proto
@param {String} key
@param {object} def
@returns {defect} | [
"Compute",
"property",
"descriptor",
"for",
"getter",
"-",
"setter",
"type",
"definition",
"and",
"assign",
"it",
"to",
"the",
"prototype",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2356-L2373 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(interfais, object) {
var is = true;
var expected = interfais.toString();
var type = gui.Type.of(object);
switch (type) {
case "null":
case "string":
case "number":
case "boolean":
case "undefined":
throw new Error("Expected " + expected + ", got " + type + ": " + object);
default:... | javascript | function(interfais, object) {
var is = true;
var expected = interfais.toString();
var type = gui.Type.of(object);
switch (type) {
case "null":
case "string":
case "number":
case "boolean":
case "undefined":
throw new Error("Expected " + expected + ", got " + type + ": " + object);
default:... | [
"function",
"(",
"interfais",
",",
"object",
")",
"{",
"var",
"is",
"=",
"true",
";",
"var",
"expected",
"=",
"interfais",
".",
"toString",
"(",
")",
";",
"var",
"type",
"=",
"gui",
".",
"Type",
".",
"of",
"(",
"object",
")",
";",
"switch",
"(",
... | Check object interface. Throw exception on fail.
@param {object} interfais
@param {object} osbject
@returns {boolean} | [
"Check",
"object",
"interface",
".",
"Throw",
"exception",
"on",
"fail",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2408-L2437 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(decoration) {
return function(base) {
return function() {
var result = base.apply(this, arguments);
decoration.apply(this, arguments);
return result;
};
};
} | javascript | function(decoration) {
return function(base) {
return function() {
var result = base.apply(this, arguments);
decoration.apply(this, arguments);
return result;
};
};
} | [
"function",
"(",
"decoration",
")",
"{",
"return",
"function",
"(",
"base",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"result",
"=",
"base",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"decoration",
".",
"apply",
"(",
"this",
"... | Decorate function after.
@param {function} decoration
@returns {function} | [
"Decorate",
"function",
"after",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2468-L2476 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(decoration) {
var slice = [].slice;
return function(base) {
return function() {
var argv, callback, result, that = this;
argv = 1 <= arguments.length ? slice.call(arguments, 0) : [];
result = void 0;
callback = function() {
return (result = base.apply(that, argv));
};
decora... | javascript | function(decoration) {
var slice = [].slice;
return function(base) {
return function() {
var argv, callback, result, that = this;
argv = 1 <= arguments.length ? slice.call(arguments, 0) : [];
result = void 0;
callback = function() {
return (result = base.apply(that, argv));
};
decora... | [
"function",
"(",
"decoration",
")",
"{",
"var",
"slice",
"=",
"[",
"]",
".",
"slice",
";",
"return",
"function",
"(",
"base",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"argv",
",",
"callback",
",",
"result",
",",
"that",
"=",
"this",
";... | Decorate function around.
@param {function} decoration
@returns {function} | [
"Decorate",
"function",
"around",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2483-L2497 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(condition) {
return function(base, otherwise) {
return function() {
if (condition.apply(this, arguments)) {
return base.apply(this, arguments);
} else if (otherwise) {
return otherwise.apply(this, arguments);
}
};
};
} | javascript | function(condition) {
return function(base, otherwise) {
return function() {
if (condition.apply(this, arguments)) {
return base.apply(this, arguments);
} else if (otherwise) {
return otherwise.apply(this, arguments);
}
};
};
} | [
"function",
"(",
"condition",
")",
"{",
"return",
"function",
"(",
"base",
",",
"otherwise",
")",
"{",
"return",
"function",
"(",
")",
"{",
"if",
"(",
"condition",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
")",
"{",
"return",
"base",
".",
"ap... | Decorate function provided with support for an otherwise operation.
@param {function} condition | [
"Decorate",
"function",
"provided",
"with",
"support",
"for",
"an",
"otherwise",
"operation",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2503-L2513 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(client) {
this.client = client;
if(gui.hasModule('gui-spirits@wunderbyte.com')) {
if(client instanceof gui.Spirit) {
this.spirit = client || null;
this.context = window; // otherwise web worker scenario, maybe deprecate
}
}
this.onconstruct();
} | javascript | function(client) {
this.client = client;
if(gui.hasModule('gui-spirits@wunderbyte.com')) {
if(client instanceof gui.Spirit) {
this.spirit = client || null;
this.context = window; // otherwise web worker scenario, maybe deprecate
}
}
this.onconstruct();
} | [
"function",
"(",
"client",
")",
"{",
"this",
".",
"client",
"=",
"client",
";",
"if",
"(",
"gui",
".",
"hasModule",
"(",
"'gui-spirits@wunderbyte.com'",
")",
")",
"{",
"if",
"(",
"client",
"instanceof",
"gui",
".",
"Spirit",
")",
"{",
"this",
".",
"spi... | Secret constructor. Called before `onconstruct`.
@type {gui.Spirit|gui.Plugin|edb.Object|edb.Array} | [
"Secret",
"constructor",
".",
"Called",
"before",
"onconstruct",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2605-L2614 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function() {
gui.Plugin.prototype.ondestruct.call(this);
gui.Object.each(this._trackedtypes, function(type, list) {
list.slice().forEach(function(checks) {
this._cleanup(type, checks);
}, this);
}, this);
} | javascript | function() {
gui.Plugin.prototype.ondestruct.call(this);
gui.Object.each(this._trackedtypes, function(type, list) {
list.slice().forEach(function(checks) {
this._cleanup(type, checks);
}, this);
}, this);
} | [
"function",
"(",
")",
"{",
"gui",
".",
"Plugin",
".",
"prototype",
".",
"ondestruct",
".",
"call",
"(",
"this",
")",
";",
"gui",
".",
"Object",
".",
"each",
"(",
"this",
".",
"_trackedtypes",
",",
"function",
"(",
"type",
",",
"list",
")",
"{",
"li... | Cleanup on destruction. | [
"Cleanup",
"on",
"destruction",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2706-L2713 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(on /*...rest */ ) {
var rest = gui.Array.from(arguments).slice(1);
if (on) {
return this.add.apply(this, rest);
} else {
return this.remove.apply(this, rest);
}
} | javascript | function(on /*...rest */ ) {
var rest = gui.Array.from(arguments).slice(1);
if (on) {
return this.add.apply(this, rest);
} else {
return this.remove.apply(this, rest);
}
} | [
"function",
"(",
"on",
"/*...rest */",
")",
"{",
"var",
"rest",
"=",
"gui",
".",
"Array",
".",
"from",
"(",
"arguments",
")",
".",
"slice",
"(",
"1",
")",
";",
"if",
"(",
"on",
")",
"{",
"return",
"this",
".",
"add",
".",
"apply",
"(",
"this",
... | Invokes `add` or `remove` according to first argument given.
The remaining arguments are applied to the method we invoke.
@param {boolean} on
@returns {gui.Tracker} | [
"Invokes",
"add",
"or",
"remove",
"according",
"to",
"first",
"argument",
"given",
".",
"The",
"remaining",
"arguments",
"are",
"applied",
"to",
"the",
"method",
"we",
"invoke",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2730-L2737 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(type, checks) {
var result = false;
var list = this._trackedtypes[type];
if (!list) {
list = this._trackedtypes[type] = [];
result = true;
} else {
result = !this._haschecks(list, checks);
}
if (result && checks) {
list.push(checks);
}
return result;
} | javascript | function(type, checks) {
var result = false;
var list = this._trackedtypes[type];
if (!list) {
list = this._trackedtypes[type] = [];
result = true;
} else {
result = !this._haschecks(list, checks);
}
if (result && checks) {
list.push(checks);
}
return result;
} | [
"function",
"(",
"type",
",",
"checks",
")",
"{",
"var",
"result",
"=",
"false",
";",
"var",
"list",
"=",
"this",
".",
"_trackedtypes",
"[",
"type",
"]",
";",
"if",
"(",
"!",
"list",
")",
"{",
"list",
"=",
"this",
".",
"_trackedtypes",
"[",
"type",... | Can add type of given checks?
@param {String} type
@param {Array<object>} checks
@returns {boolean} | [
"Can",
"add",
"type",
"of",
"given",
"checks?"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2793-L2806 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(type, checks) {
var result = false;
var list = this._trackedtypes[type];
if (list) {
var index = this._checksindex(list, checks);
if (index > -1) {
result = true;
// TODO: this seems to not run when checks is none (undefined)!
if (gui.Array.remove(list, index) === 0) {
delete this.... | javascript | function(type, checks) {
var result = false;
var list = this._trackedtypes[type];
if (list) {
var index = this._checksindex(list, checks);
if (index > -1) {
result = true;
// TODO: this seems to not run when checks is none (undefined)!
if (gui.Array.remove(list, index) === 0) {
delete this.... | [
"function",
"(",
"type",
",",
"checks",
")",
"{",
"var",
"result",
"=",
"false",
";",
"var",
"list",
"=",
"this",
".",
"_trackedtypes",
"[",
"type",
"]",
";",
"if",
"(",
"list",
")",
"{",
"var",
"index",
"=",
"this",
".",
"_checksindex",
"(",
"list... | Can remove type of given checks? If so, do it now.
@param {String} type
@param {Array<object>} checks
@returns {boolean} | [
"Can",
"remove",
"type",
"of",
"given",
"checks?",
"If",
"so",
"do",
"it",
"now",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2814-L2828 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(type, checks) {
var result = false;
var list = this._trackedtypes[type];
if (list) {
result = !checks || this._haschecks(list, checks);
}
return result;
} | javascript | function(type, checks) {
var result = false;
var list = this._trackedtypes[type];
if (list) {
result = !checks || this._haschecks(list, checks);
}
return result;
} | [
"function",
"(",
"type",
",",
"checks",
")",
"{",
"var",
"result",
"=",
"false",
";",
"var",
"list",
"=",
"this",
".",
"_trackedtypes",
"[",
"type",
"]",
";",
"if",
"(",
"list",
")",
"{",
"result",
"=",
"!",
"checks",
"||",
"this",
".",
"_haschecks... | Has list for type AND given checks?
@param {String} type
@param {Array<object>} checks | [
"Has",
"list",
"for",
"type",
"AND",
"given",
"checks?"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2835-L2842 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(list, checks) {
var result = !checks || false;
if (!result) {
list.every(function(a) {
if (a.every(function(b, i) {
return b === checks[i];
})) {
result = true;
}
return !result;
});
}
return result;
} | javascript | function(list, checks) {
var result = !checks || false;
if (!result) {
list.every(function(a) {
if (a.every(function(b, i) {
return b === checks[i];
})) {
result = true;
}
return !result;
});
}
return result;
} | [
"function",
"(",
"list",
",",
"checks",
")",
"{",
"var",
"result",
"=",
"!",
"checks",
"||",
"false",
";",
"if",
"(",
"!",
"result",
")",
"{",
"list",
".",
"every",
"(",
"function",
"(",
"a",
")",
"{",
"if",
"(",
"a",
".",
"every",
"(",
"functi... | Has checks indexed?
@param {Array<Array<object>>} list
@param {Array<object>} checks
@returns {boolean} | [
"Has",
"checks",
"indexed?"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2850-L2863 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(list, checks) {
var result = -1;
list.every(function(a, index) {
if (a.every(function(b, i) {
return b === checks[i];
})) {
result = index;
}
return result === -1;
});
return result;
} | javascript | function(list, checks) {
var result = -1;
list.every(function(a, index) {
if (a.every(function(b, i) {
return b === checks[i];
})) {
result = index;
}
return result === -1;
});
return result;
} | [
"function",
"(",
"list",
",",
"checks",
")",
"{",
"var",
"result",
"=",
"-",
"1",
";",
"list",
".",
"every",
"(",
"function",
"(",
"a",
",",
"index",
")",
"{",
"if",
"(",
"a",
".",
"every",
"(",
"function",
"(",
"b",
",",
"i",
")",
"{",
"retu... | Get index of checks.
@param {Array<Array<object>>} list
@param {Array<object>} checks
@returns {number} | [
"Get",
"index",
"of",
"checks",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L2879-L2890 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(a, key) {
var prefix = "spiritual-action:";
return prefix + (function() {
a.target = null;
a.data = (function(d) {
if (gui.Type.isComplex(d)) {
if (gui.Type.isFunction(d.stringify)) {
d = d.stringify();
} else {
try {
JSON.stringify(d);
} catch... | javascript | function(a, key) {
var prefix = "spiritual-action:";
return prefix + (function() {
a.target = null;
a.data = (function(d) {
if (gui.Type.isComplex(d)) {
if (gui.Type.isFunction(d.stringify)) {
d = d.stringify();
} else {
try {
JSON.stringify(d);
} catch... | [
"function",
"(",
"a",
",",
"key",
")",
"{",
"var",
"prefix",
"=",
"\"spiritual-action:\"",
";",
"return",
"prefix",
"+",
"(",
"function",
"(",
")",
"{",
"a",
".",
"target",
"=",
"null",
";",
"a",
".",
"data",
"=",
"(",
"function",
"(",
"d",
")",
... | Encode action to be posted xdomain.
@param {gui.Action} a
@param @optional {String} key Associates dispatching document
to the hosting iframespirit (ascending action scenario)
@returns {String} | [
"Encode",
"action",
"to",
"be",
"posted",
"xdomain",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L3132-L3153 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(b) {
var prefix = "spiritual-broadcast:";
return prefix + (function() {
b.target = null;
b.data = (function(d) {
if (gui.Type.isComplex(d)) {
if (gui.Type.isFunction(d.stringify)) {
d = d.stringify();
} else {
try {
JSON.stringify(d); // @TODO: think mcfly -... | javascript | function(b) {
var prefix = "spiritual-broadcast:";
return prefix + (function() {
b.target = null;
b.data = (function(d) {
if (gui.Type.isComplex(d)) {
if (gui.Type.isFunction(d.stringify)) {
d = d.stringify();
} else {
try {
JSON.stringify(d); // @TODO: think mcfly -... | [
"function",
"(",
"b",
")",
"{",
"var",
"prefix",
"=",
"\"spiritual-broadcast:\"",
";",
"return",
"prefix",
"+",
"(",
"function",
"(",
")",
"{",
"b",
".",
"target",
"=",
"null",
";",
"b",
".",
"data",
"=",
"(",
"function",
"(",
"d",
")",
"{",
"if",
... | Encode broadcast to be posted xdomain.
@param {gui.Broacast} b
@returns {String} | [
"Encode",
"broadcast",
"to",
"be",
"posted",
"xdomain",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L3498-L3518 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(msg) {
var prefix = "spiritual-broadcast:";
if (msg.startsWith(prefix)) {
return JSON.parse(msg.split(prefix)[1]);
}
} | javascript | function(msg) {
var prefix = "spiritual-broadcast:";
if (msg.startsWith(prefix)) {
return JSON.parse(msg.split(prefix)[1]);
}
} | [
"function",
"(",
"msg",
")",
"{",
"var",
"prefix",
"=",
"\"spiritual-broadcast:\"",
";",
"if",
"(",
"msg",
".",
"startsWith",
"(",
"prefix",
")",
")",
"{",
"return",
"JSON",
".",
"parse",
"(",
"msg",
".",
"split",
"(",
"prefix",
")",
"[",
"1",
"]",
... | Decode broadcast posted from xdomain and return a broadcast-like object.
@param {String} msg
@returns {object} | [
"Decode",
"broadcast",
"posted",
"from",
"xdomain",
"and",
"return",
"a",
"broadcast",
"-",
"like",
"object",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L3525-L3530 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(b) {
var map = b.global ? this._globals : this._locals[gui.$contextid];
if (gui.hasModule('gui-spirits@wunderbyte.com')) {
if(!gui.spiritualized) {
if(b.type !== gui.BROADCAST_WILL_SPIRITUALIZE) {
// TODO: cache broadcast until spiritualized?
}
}
}
if (this.$target) {
if... | javascript | function(b) {
var map = b.global ? this._globals : this._locals[gui.$contextid];
if (gui.hasModule('gui-spirits@wunderbyte.com')) {
if(!gui.spiritualized) {
if(b.type !== gui.BROADCAST_WILL_SPIRITUALIZE) {
// TODO: cache broadcast until spiritualized?
}
}
}
if (this.$target) {
if... | [
"function",
"(",
"b",
")",
"{",
"var",
"map",
"=",
"b",
".",
"global",
"?",
"this",
".",
"_globals",
":",
"this",
".",
"_locals",
"[",
"gui",
".",
"$contextid",
"]",
";",
"if",
"(",
"gui",
".",
"hasModule",
"(",
"'gui-spirits@wunderbyte.com'",
")",
"... | Dispatch broadcast.
@param {gui.Broadcast|Map<String,object>} b | [
"Dispatch",
"broadcast",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L3624-L3654 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(b) {
var postmessage = (function stamp() {
b.$contextids.push(gui.$contextid);
return gui.Broadcast.stringify(b);
}());
this._propagateDown(postmessage);
this._propagateUp(postmessage, b.type);
} | javascript | function(b) {
var postmessage = (function stamp() {
b.$contextids.push(gui.$contextid);
return gui.Broadcast.stringify(b);
}());
this._propagateDown(postmessage);
this._propagateUp(postmessage, b.type);
} | [
"function",
"(",
"b",
")",
"{",
"var",
"postmessage",
"=",
"(",
"function",
"stamp",
"(",
")",
"{",
"b",
".",
"$contextids",
".",
"push",
"(",
"gui",
".",
"$contextid",
")",
";",
"return",
"gui",
".",
"Broadcast",
".",
"stringify",
"(",
"b",
")",
"... | Propagate broadcast xframe.
1. Propagate descending
2. Propagate ascending
TODO: Don't post to universal domain "*"
@param {gui.Broadcast} b | [
"Propagate",
"broadcast",
"xframe",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L3664-L3671 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(type, time, sig) {
var map = this._tempname;
var types = map.types;
var tick = new gui.Tick(type);
time = time || 0;
if (!types[type]) { // !!!!!!!!!!!!!!!!!!!!!!!
types[type] = true;
var that = this,
id = null;
if (!time) {
id = setImmediate(function() {
delete types... | javascript | function(type, time, sig) {
var map = this._tempname;
var types = map.types;
var tick = new gui.Tick(type);
time = time || 0;
if (!types[type]) { // !!!!!!!!!!!!!!!!!!!!!!!
types[type] = true;
var that = this,
id = null;
if (!time) {
id = setImmediate(function() {
delete types... | [
"function",
"(",
"type",
",",
"time",
",",
"sig",
")",
"{",
"var",
"map",
"=",
"this",
".",
"_tempname",
";",
"var",
"types",
"=",
"map",
".",
"types",
";",
"var",
"tick",
"=",
"new",
"gui",
".",
"Tick",
"(",
"type",
")",
";",
"time",
"=",
"tim... | Dispatch tick sooner or later.
@param {String} type
@param @optional {number} time
@param @optional {String} sig | [
"Dispatch",
"tick",
"sooner",
"or",
"later",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L3962-L3984 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(spirit) {
var prefixes = [],
plugins = spirit.life.plugins;
gui.Object.each(plugins, function(prefix, instantiated) {
if (instantiated) {
if (prefix !== "life") {
prefixes.push(prefix);
}
} else {
Object.defineProperty(spirit, prefix, {
enumerable: true,
configurable: tr... | javascript | function(spirit) {
var prefixes = [],
plugins = spirit.life.plugins;
gui.Object.each(plugins, function(prefix, instantiated) {
if (instantiated) {
if (prefix !== "life") {
prefixes.push(prefix);
}
} else {
Object.defineProperty(spirit, prefix, {
enumerable: true,
configurable: tr... | [
"function",
"(",
"spirit",
")",
"{",
"var",
"prefixes",
"=",
"[",
"]",
",",
"plugins",
"=",
"spirit",
".",
"life",
".",
"plugins",
";",
"gui",
".",
"Object",
".",
"each",
"(",
"plugins",
",",
"function",
"(",
"prefix",
",",
"instantiated",
")",
"{",
... | Nuke that spirit.
- Nuke lazy plugins so that we don't accidentally instantiate them
- Destruct remaining plugins, saving the {gui.Life} plugin for last
- Replace all properties with an accessor to throw an exception
@param {gui.Spirit} spirit | [
"Nuke",
"that",
"spirit",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4072-L4100 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(plugins, nuke) {
if (nuke) {
plugins.forEach(function(plugin) {
this.$nukeallofit(plugin);
}, this);
} else {
plugins.map(function(plugin) {
plugin.ondestruct();
return plugin;
}).forEach(function(plugin) {
plugin.$ondestruct();
});
}
} | javascript | function(plugins, nuke) {
if (nuke) {
plugins.forEach(function(plugin) {
this.$nukeallofit(plugin);
}, this);
} else {
plugins.map(function(plugin) {
plugin.ondestruct();
return plugin;
}).forEach(function(plugin) {
plugin.$ondestruct();
});
}
} | [
"function",
"(",
"plugins",
",",
"nuke",
")",
"{",
"if",
"(",
"nuke",
")",
"{",
"plugins",
".",
"forEach",
"(",
"function",
"(",
"plugin",
")",
"{",
"this",
".",
"$nukeallofit",
"(",
"plugin",
")",
";",
"}",
",",
"this",
")",
";",
"}",
"else",
"{... | Nuke plugins in three steps to minimize access violations.
@param {gui.Spirit} spirit
@param {Array<String>} prefixes
@param {boolean} nuke | [
"Nuke",
"plugins",
"in",
"three",
"steps",
"to",
"minimize",
"access",
"violations",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4108-L4121 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(thing) {
var nativeprops = Object.prototype;
if (!gui.unloading && !thing.$destructed) {
thing.$destructed = true;
for (var prop in thing) {
if (thing.hasOwnProperty(prop) || gui.debug) {
if (nativeprops[prop] === undefined) {
if (prop !== '$destructed') {
var desc = Object.getO... | javascript | function(thing) {
var nativeprops = Object.prototype;
if (!gui.unloading && !thing.$destructed) {
thing.$destructed = true;
for (var prop in thing) {
if (thing.hasOwnProperty(prop) || gui.debug) {
if (nativeprops[prop] === undefined) {
if (prop !== '$destructed') {
var desc = Object.getO... | [
"function",
"(",
"thing",
")",
"{",
"var",
"nativeprops",
"=",
"Object",
".",
"prototype",
";",
"if",
"(",
"!",
"gui",
".",
"unloading",
"&&",
"!",
"thing",
".",
"$destructed",
")",
"{",
"thing",
".",
"$destructed",
"=",
"true",
";",
"for",
"(",
"var... | Replace own properties with an accessor to throw an exception.
In 'gui.debug' mode we replace all props, not just own props,
so that we may fail fast on attempt to handle destructed spirit.
@TODO: keep track of non-enumerables and nuke those as well :/
@param {object} thing | [
"Replace",
"own",
"properties",
"with",
"an",
"accessor",
"to",
"throw",
"an",
"exception",
".",
"In",
"gui",
".",
"debug",
"mode",
"we",
"replace",
"all",
"props",
"not",
"just",
"own",
"props",
"so",
"that",
"we",
"may",
"fail",
"fast",
"on",
"attempt"... | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4141-L4162 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(message) {
var stack, e = new Error(
gui.GreatSpirit.DENIAL + (message ? ": " + message : "")
);
if (!gui.Client.isExplorer && (stack = e.stack)) {
if (gui.Client.isWebKit) {
stack = stack.replace(/^[^\(]+?[\n$]/gm, "").
replace(/^\s+at\s+/gm, "").
replace(/^Object.<anonymous>\s*\(/gm, ... | javascript | function(message) {
var stack, e = new Error(
gui.GreatSpirit.DENIAL + (message ? ": " + message : "")
);
if (!gui.Client.isExplorer && (stack = e.stack)) {
if (gui.Client.isWebKit) {
stack = stack.replace(/^[^\(]+?[\n$]/gm, "").
replace(/^\s+at\s+/gm, "").
replace(/^Object.<anonymous>\s*\(/gm, ... | [
"function",
"(",
"message",
")",
"{",
"var",
"stack",
",",
"e",
"=",
"new",
"Error",
"(",
"gui",
".",
"GreatSpirit",
".",
"DENIAL",
"+",
"(",
"message",
"?",
"\": \"",
"+",
"message",
":",
"\"\"",
")",
")",
";",
"if",
"(",
"!",
"gui",
".",
"Clien... | Obscure mechanism to include the whole stacktrace in the error message
because some kind of Selenium WebDriver can't print stack traces...
@see https://gist.github.com/jay3sh/1158940
@param @optional {String} message | [
"Obscure",
"mechanism",
"to",
"include",
"the",
"whole",
"stacktrace",
"in",
"the",
"error",
"message",
"because",
"some",
"kind",
"of",
"Selenium",
"WebDriver",
"can",
"t",
"print",
"stack",
"traces",
"..."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4185-L4204 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(thing, prop) {
Object.defineProperty(thing, prop, {
enumerable: true,
configurable: true,
get: function() {
gui.GreatSpirit.DENY(thing);
},
set: function() {
gui.GreatSpirit.DENY(thing);
}
});
} | javascript | function(thing, prop) {
Object.defineProperty(thing, prop, {
enumerable: true,
configurable: true,
get: function() {
gui.GreatSpirit.DENY(thing);
},
set: function() {
gui.GreatSpirit.DENY(thing);
}
});
} | [
"function",
"(",
"thing",
",",
"prop",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"thing",
",",
"prop",
",",
"{",
"enumerable",
":",
"true",
",",
"configurable",
":",
"true",
",",
"get",
":",
"function",
"(",
")",
"{",
"gui",
".",
"GreatSpirit",
... | In debug mode, throw a more qualified "attempt to handle destructed spirit"
@param {object} thing
@param {String} prop | [
"In",
"debug",
"mode",
"throw",
"a",
"more",
"qualified",
"attempt",
"to",
"handle",
"destructed",
"spirit"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4220-L4231 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function() {
var spirit, spirits = this._spirits.slice();
if (window.gui) { // hotfix IE window unloaded scenario...
while ((spirit = spirits.shift())) {
this.$nuke(spirit);
}
this._spirits = [];
}
} | javascript | function() {
var spirit, spirits = this._spirits.slice();
if (window.gui) { // hotfix IE window unloaded scenario...
while ((spirit = spirits.shift())) {
this.$nuke(spirit);
}
this._spirits = [];
}
} | [
"function",
"(",
")",
"{",
"var",
"spirit",
",",
"spirits",
"=",
"this",
".",
"_spirits",
".",
"slice",
"(",
")",
";",
"if",
"(",
"window",
".",
"gui",
")",
"{",
"// hotfix IE window unloaded scenario...",
"while",
"(",
"(",
"spirit",
"=",
"spirits",
"."... | Nuke spirits now. | [
"Nuke",
"spirits",
"now",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4236-L4244 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function() {
var that = this,
add = function(target, events, capture) {
events.split(' ').forEach(function(type) {
target.addEventListener(type, that, capture);
});
};
add(document, 'DOMContentLoaded');
add(document, 'click mousedown mouseup', true);
add(window, 'load hashchange');
... | javascript | function() {
var that = this,
add = function(target, events, capture) {
events.split(' ').forEach(function(type) {
target.addEventListener(type, that, capture);
});
};
add(document, 'DOMContentLoaded');
add(document, 'click mousedown mouseup', true);
add(window, 'load hashchange');
... | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
",",
"add",
"=",
"function",
"(",
"target",
",",
"events",
",",
"capture",
")",
"{",
"events",
".",
"split",
"(",
"' '",
")",
".",
"forEach",
"(",
"function",
"(",
"type",
")",
"{",
"target",
... | Setup loads of event listeners. | [
"Setup",
"loads",
"of",
"event",
"listeners",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4288-L4313 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function() {
this._loaded = true;
dobrodcast(gui.BROADCAST_TOLOAD, gui.BROADCAST_ONLOAD);
doaction(gui.ACTION_DOC_ONLOAD, location.href);
} | javascript | function() {
this._loaded = true;
dobrodcast(gui.BROADCAST_TOLOAD, gui.BROADCAST_ONLOAD);
doaction(gui.ACTION_DOC_ONLOAD, location.href);
} | [
"function",
"(",
")",
"{",
"this",
".",
"_loaded",
"=",
"true",
";",
"dobrodcast",
"(",
"gui",
".",
"BROADCAST_TOLOAD",
",",
"gui",
".",
"BROADCAST_ONLOAD",
")",
";",
"doaction",
"(",
"gui",
".",
"ACTION_DOC_ONLOAD",
",",
"location",
".",
"href",
")",
";... | Dispatch `load` event to hosting document. | [
"Dispatch",
"load",
"event",
"to",
"hosting",
"document",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4399-L4403 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function() {
if (!gui.hosted) {
clearTimeout(this._timeout);
this._timeout = setTimeout(function() {
gui.broadcastGlobal(gui.BROADCAST_RESIZE_END);
}, gui.TIMEOUT_RESIZE_END);
}
} | javascript | function() {
if (!gui.hosted) {
clearTimeout(this._timeout);
this._timeout = setTimeout(function() {
gui.broadcastGlobal(gui.BROADCAST_RESIZE_END);
}, gui.TIMEOUT_RESIZE_END);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"gui",
".",
"hosted",
")",
"{",
"clearTimeout",
"(",
"this",
".",
"_timeout",
")",
";",
"this",
".",
"_timeout",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"gui",
".",
"broadcastGlobal",
"(",
"gui",
... | Intensive resize procedures should subscribe
to the resize-end message as broadcasted here. | [
"Intensive",
"resize",
"procedures",
"should",
"subscribe",
"to",
"the",
"resize",
"-",
"end",
"message",
"as",
"broadcasted",
"here",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4440-L4447 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(spaces) {
var prop, def, metas = document.querySelectorAll('meta[name]');
Array.forEach(metas, function(meta) {
prop = meta.getAttribute('name');
spaces.forEach(function(ns) {
if (prop.startsWith(ns + '.')) {
def = gui.Object.lookup(prop);
if (gui.Type.isDefined(def)) {
gu... | javascript | function(spaces) {
var prop, def, metas = document.querySelectorAll('meta[name]');
Array.forEach(metas, function(meta) {
prop = meta.getAttribute('name');
spaces.forEach(function(ns) {
if (prop.startsWith(ns + '.')) {
def = gui.Object.lookup(prop);
if (gui.Type.isDefined(def)) {
gu... | [
"function",
"(",
"spaces",
")",
"{",
"var",
"prop",
",",
"def",
",",
"metas",
"=",
"document",
".",
"querySelectorAll",
"(",
"'meta[name]'",
")",
";",
"Array",
".",
"forEach",
"(",
"metas",
",",
"function",
"(",
"meta",
")",
"{",
"prop",
"=",
"meta",
... | Resolve metatags that appear to
configure stuff in namespaces.
@param {Array<string>} spaces | [
"Resolve",
"metatags",
"that",
"appear",
"to",
"configure",
"stuff",
"in",
"namespaces",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4465-L4482 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(callback, thisp) {
this._callback = callback ? callback : null;
this._pointer = thisp ? thisp : null;
if (this._now) {
this.now();
}
} | javascript | function(callback, thisp) {
this._callback = callback ? callback : null;
this._pointer = thisp ? thisp : null;
if (this._now) {
this.now();
}
} | [
"function",
"(",
"callback",
",",
"thisp",
")",
"{",
"this",
".",
"_callback",
"=",
"callback",
"?",
"callback",
":",
"null",
";",
"this",
".",
"_pointer",
"=",
"thisp",
"?",
"thisp",
":",
"null",
";",
"if",
"(",
"this",
".",
"_now",
")",
"{",
"thi... | Setup callback with optional this-pointer.
@param {function} callback
@param @optional {object} pointer | [
"Setup",
"callback",
"with",
"optional",
"this",
"-",
"pointer",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4894-L4900 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function() {
var c = this._callback;
var p = this._pointer;
if (c) {
this.then(null, null);
c.apply(p, arguments);
} else {
this._now = true;
}
} | javascript | function() {
var c = this._callback;
var p = this._pointer;
if (c) {
this.then(null, null);
c.apply(p, arguments);
} else {
this._now = true;
}
} | [
"function",
"(",
")",
"{",
"var",
"c",
"=",
"this",
".",
"_callback",
";",
"var",
"p",
"=",
"this",
".",
"_pointer",
";",
"if",
"(",
"c",
")",
"{",
"this",
".",
"then",
"(",
"null",
",",
"null",
")",
";",
"c",
".",
"apply",
"(",
"p",
",",
"... | Callback with optional this-pointer.
@returns {object} | [
"Callback",
"with",
"optional",
"this",
"-",
"pointer",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4906-L4915 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(markup, targetdoc) {
return this.parseToNodes(markup, targetdoc).filter(function(node) {
return node.nodeType === Node.ELEMENT_NODE;
});
} | javascript | function(markup, targetdoc) {
return this.parseToNodes(markup, targetdoc).filter(function(node) {
return node.nodeType === Node.ELEMENT_NODE;
});
} | [
"function",
"(",
"markup",
",",
"targetdoc",
")",
"{",
"return",
"this",
".",
"parseToNodes",
"(",
"markup",
",",
"targetdoc",
")",
".",
"filter",
"(",
"function",
"(",
"node",
")",
"{",
"return",
"node",
".",
"nodeType",
"===",
"Node",
".",
"ELEMENT_NOD... | Parse to array of one or more elements.
@param {String} markup
@param @optional {Document} targetdoc
@returns {Array<Element>} | [
"Parse",
"to",
"array",
"of",
"one",
"or",
"more",
"elements",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4972-L4976 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(markup, targetdoc) {
var elm, doc = this._document ||
(this._document = document.implementation.createHTMLDocument(""));
return gui.Guide.suspend(function() {
doc.body.innerHTML = this._unsanitize(markup);
elm = doc.querySelector("." + this._classname) || doc.body;
return Array.map(elm.childNod... | javascript | function(markup, targetdoc) {
var elm, doc = this._document ||
(this._document = document.implementation.createHTMLDocument(""));
return gui.Guide.suspend(function() {
doc.body.innerHTML = this._unsanitize(markup);
elm = doc.querySelector("." + this._classname) || doc.body;
return Array.map(elm.childNod... | [
"function",
"(",
"markup",
",",
"targetdoc",
")",
"{",
"var",
"elm",
",",
"doc",
"=",
"this",
".",
"_document",
"||",
"(",
"this",
".",
"_document",
"=",
"document",
".",
"implementation",
".",
"createHTMLDocument",
"(",
"\"\"",
")",
")",
";",
"return",
... | Parse to array of one or more nodes.
@param {String} markup
@param @optional {Document} targetdoc
@returns {Array<Node>} | [
"Parse",
"to",
"array",
"of",
"one",
"or",
"more",
"nodes",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L4994-L5004 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(markup) {
markup = markup || "";
return gui.Guide.suspend(function() {
var doc = document.implementation.createHTMLDocument("");
if (markup.toLowerCase().contains("<!doctype")) {
try {
doc.documentElement.innerHTML = markup;
} catch (ie9exception) {
doc = new ActiveXObject("htmlfile... | javascript | function(markup) {
markup = markup || "";
return gui.Guide.suspend(function() {
var doc = document.implementation.createHTMLDocument("");
if (markup.toLowerCase().contains("<!doctype")) {
try {
doc.documentElement.innerHTML = markup;
} catch (ie9exception) {
doc = new ActiveXObject("htmlfile... | [
"function",
"(",
"markup",
")",
"{",
"markup",
"=",
"markup",
"||",
"\"\"",
";",
"return",
"gui",
".",
"Guide",
".",
"suspend",
"(",
"function",
"(",
")",
"{",
"var",
"doc",
"=",
"document",
".",
"implementation",
".",
"createHTMLDocument",
"(",
"\"\"",
... | Parse to document. Bear in mind that the
document.defaultView of this thing is null.
@TODO: Use DOMParser for text/html supporters
@param {String} markup
@returns {HTMLDocument} | [
"Parse",
"to",
"document",
".",
"Bear",
"in",
"mind",
"that",
"the",
"document",
".",
"defaultView",
"of",
"this",
"thing",
"is",
"null",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L5013-L5031 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(markup) {
var match, fix;
markup = markup.trim().replace(this._comments, "");
if ((match = markup.match(this._firsttag))) {
if ((fix = this._unsanestructures[match[1]])) {
markup = fix.
replace("${class}", this._classname).
replace("${markup}", markup);
}
}
return markup;
} | javascript | function(markup) {
var match, fix;
markup = markup.trim().replace(this._comments, "");
if ((match = markup.match(this._firsttag))) {
if ((fix = this._unsanestructures[match[1]])) {
markup = fix.
replace("${class}", this._classname).
replace("${markup}", markup);
}
}
return markup;
} | [
"function",
"(",
"markup",
")",
"{",
"var",
"match",
",",
"fix",
";",
"markup",
"=",
"markup",
".",
"trim",
"(",
")",
".",
"replace",
"(",
"this",
".",
"_comments",
",",
"\"\"",
")",
";",
"if",
"(",
"(",
"match",
"=",
"markup",
".",
"match",
"(",... | Some elements must be created in obscure markup
structures in order to be rendered correctly.
@param {String} markup
@returns {String} | [
"Some",
"elements",
"must",
"be",
"created",
"in",
"obscure",
"markup",
"structures",
"in",
"order",
"to",
"be",
"rendered",
"correctly",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L5067-L5078 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(start, handler) {
this.direction = gui.Crawler.ASCENDING;
var supports = gui.hasModule('gui-spirits@wunderbyte.com');
var isspirit = supports && start instanceof gui.Spirit;
var win, elm = isspirit ? start.element : start;
do {
if (elm.nodeType === Node.DOCUMENT_NODE) {
if (this.global) {
... | javascript | function(start, handler) {
this.direction = gui.Crawler.ASCENDING;
var supports = gui.hasModule('gui-spirits@wunderbyte.com');
var isspirit = supports && start instanceof gui.Spirit;
var win, elm = isspirit ? start.element : start;
do {
if (elm.nodeType === Node.DOCUMENT_NODE) {
if (this.global) {
... | [
"function",
"(",
"start",
",",
"handler",
")",
"{",
"this",
".",
"direction",
"=",
"gui",
".",
"Crawler",
".",
"ASCENDING",
";",
"var",
"supports",
"=",
"gui",
".",
"hasModule",
"(",
"'gui-spirits@wunderbyte.com'",
")",
";",
"var",
"isspirit",
"=",
"suppor... | Crawl DOM ascending.
@param {Element|gui.Spirit} start
@param {object} handler | [
"Crawl",
"DOM",
"ascending",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L5224-L5265 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(start, handler, arg) {
this.direction = gui.Crawler.DESCENDING;
var elm = start instanceof gui.Spirit ? start.element : start;
if (elm.nodeType === Node.DOCUMENT_NODE) {
elm = elm.documentElement;
}
this._descend(elm, handler, arg, true);
} | javascript | function(start, handler, arg) {
this.direction = gui.Crawler.DESCENDING;
var elm = start instanceof gui.Spirit ? start.element : start;
if (elm.nodeType === Node.DOCUMENT_NODE) {
elm = elm.documentElement;
}
this._descend(elm, handler, arg, true);
} | [
"function",
"(",
"start",
",",
"handler",
",",
"arg",
")",
"{",
"this",
".",
"direction",
"=",
"gui",
".",
"Crawler",
".",
"DESCENDING",
";",
"var",
"elm",
"=",
"start",
"instanceof",
"gui",
".",
"Spirit",
"?",
"start",
".",
"element",
":",
"start",
... | Crawl DOM descending.
@param {object} start Spirit or Element
@param {object} handler
@param @optional {object} arg @TODO: is this even supported? | [
"Crawl",
"DOM",
"descending",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L5284-L5291 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(start, handler, arg) {
this.global = true;
this.descend(start, handler, arg);
this.global = false;
} | javascript | function(start, handler, arg) {
this.global = true;
this.descend(start, handler, arg);
this.global = false;
} | [
"function",
"(",
"start",
",",
"handler",
",",
"arg",
")",
"{",
"this",
".",
"global",
"=",
"true",
";",
"this",
".",
"descend",
"(",
"start",
",",
"handler",
",",
"arg",
")",
";",
"this",
".",
"global",
"=",
"false",
";",
"}"
] | Crawl DOM descending, transcend into iframes.
@param {object} start Spirit or Element
@param {object} handler
@param @optional {object} arg @TODO: is this even supported? | [
"Crawl",
"DOM",
"descending",
"transcend",
"into",
"iframes",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L5299-L5303 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(element, handler, arg) {
var hasspirit = gui.hasModule('gui-spirits@wunderbyte.com');
var directive = gui.Crawler.CONTINUE;
var spirit = hasspirit ? element.spirit : null;
if (spirit) {
directive = spirit.oncrawler(this);
}
if (!directive) {
if (handler) {
if (gui.Type.isFunction(handler.... | javascript | function(element, handler, arg) {
var hasspirit = gui.hasModule('gui-spirits@wunderbyte.com');
var directive = gui.Crawler.CONTINUE;
var spirit = hasspirit ? element.spirit : null;
if (spirit) {
directive = spirit.oncrawler(this);
}
if (!directive) {
if (handler) {
if (gui.Type.isFunction(handler.... | [
"function",
"(",
"element",
",",
"handler",
",",
"arg",
")",
"{",
"var",
"hasspirit",
"=",
"gui",
".",
"hasModule",
"(",
"'gui-spirits@wunderbyte.com'",
")",
";",
"var",
"directive",
"=",
"gui",
".",
"Crawler",
".",
"CONTINUE",
";",
"var",
"spirit",
"=",
... | Handle element. Invoked by both ascending and descending crawler.
@param {Element} element
@param {object} handler
@returns {number} directive | [
"Handle",
"element",
".",
"Invoked",
"by",
"both",
"ascending",
"and",
"descending",
"crawler",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L5354-L5377 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(text) {
var result = text;
try {
switch (this._headers.Accept) {
case "application/json":
result = JSON.parse(text);
break;
case "text/xml":
result = new DOMParser().parseFromString(text, "text/xml");
break;
}
} catch (exception) {
if (gui.debug) {
co... | javascript | function(text) {
var result = text;
try {
switch (this._headers.Accept) {
case "application/json":
result = JSON.parse(text);
break;
case "text/xml":
result = new DOMParser().parseFromString(text, "text/xml");
break;
}
} catch (exception) {
if (gui.debug) {
co... | [
"function",
"(",
"text",
")",
"{",
"var",
"result",
"=",
"text",
";",
"try",
"{",
"switch",
"(",
"this",
".",
"_headers",
".",
"Accept",
")",
"{",
"case",
"\"application/json\"",
":",
"result",
"=",
"JSON",
".",
"parse",
"(",
"text",
")",
";",
"break... | Parse response to expected type.
@param {String} text
@returns {object} | [
"Parse",
"response",
"to",
"expected",
"type",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L5581-L5600 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | supports | function supports(feature) {
var root = document.documentElement;
var fixt = feature[0].toUpperCase() + feature.substring(1);
return !["", "Webkit", "Moz", "O", "ms"].every(function(prefix) {
return root.style[prefix ? prefix + fixt : feature] === undefined;
});
} | javascript | function supports(feature) {
var root = document.documentElement;
var fixt = feature[0].toUpperCase() + feature.substring(1);
return !["", "Webkit", "Moz", "O", "ms"].every(function(prefix) {
return root.style[prefix ? prefix + fixt : feature] === undefined;
});
} | [
"function",
"supports",
"(",
"feature",
")",
"{",
"var",
"root",
"=",
"document",
".",
"documentElement",
";",
"var",
"fixt",
"=",
"feature",
"[",
"0",
"]",
".",
"toUpperCase",
"(",
")",
"+",
"feature",
".",
"substring",
"(",
"1",
")",
";",
"return",
... | Supports CSS feature?
@param {String} feature
@returns {boolean} | [
"Supports",
"CSS",
"feature?"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L5639-L5645 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(elm) {
var res = null;
if (elm.nodeType === Node.ELEMENT_NODE) {
var doc = elm.ownerDocument;
var win = doc.defaultView;
if (win.gui) {
if (win.gui.attributes.every(function(fix) {
res = this._evaluateinline(elm, win, fix);
return res === null;
}, this)) {
if (gui.hasChannel... | javascript | function(elm) {
var res = null;
if (elm.nodeType === Node.ELEMENT_NODE) {
var doc = elm.ownerDocument;
var win = doc.defaultView;
if (win.gui) {
if (win.gui.attributes.every(function(fix) {
res = this._evaluateinline(elm, win, fix);
return res === null;
}, this)) {
if (gui.hasChannel... | [
"function",
"(",
"elm",
")",
"{",
"var",
"res",
"=",
"null",
";",
"if",
"(",
"elm",
".",
"nodeType",
"===",
"Node",
".",
"ELEMENT_NODE",
")",
"{",
"var",
"doc",
"=",
"elm",
".",
"ownerDocument",
";",
"var",
"win",
"=",
"doc",
".",
"defaultView",
";... | Get Spirit constructor for element.
1. Test for element `gui` attribute(s)
2. Test if element matches selectors
@param {Element} element
@returns {function} Spirit constructor | [
"Get",
"Spirit",
"constructor",
"for",
"element",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L6178-L6202 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(spirit) {
var all = this._spirits;
var key = spirit.$instanceid;
delete all.inside[key];
delete all.outside[key];
this._stoptracking(spirit);
} | javascript | function(spirit) {
var all = this._spirits;
var key = spirit.$instanceid;
delete all.inside[key];
delete all.outside[key];
this._stoptracking(spirit);
} | [
"function",
"(",
"spirit",
")",
"{",
"var",
"all",
"=",
"this",
".",
"_spirits",
";",
"var",
"key",
"=",
"spirit",
".",
"$instanceid",
";",
"delete",
"all",
".",
"inside",
"[",
"key",
"]",
";",
"delete",
"all",
".",
"outside",
"[",
"key",
"]",
";",... | Stop tracking the spirit.
@param {gui.Spirit} spirit | [
"Stop",
"tracking",
"the",
"spirit",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L6220-L6226 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function() {
this.spiritualized = true;
var list = this._readycallbacks;
if (list) {
while (list.length) {
list.shift()();
}
this._readycallbacks = null;
}
} | javascript | function() {
this.spiritualized = true;
var list = this._readycallbacks;
if (list) {
while (list.length) {
list.shift()();
}
this._readycallbacks = null;
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"spiritualized",
"=",
"true",
";",
"var",
"list",
"=",
"this",
".",
"_readycallbacks",
";",
"if",
"(",
"list",
")",
"{",
"while",
"(",
"list",
".",
"length",
")",
"{",
"list",
".",
"shift",
"(",
")",
"(",
"... | Initial spirits are ready.
Run accumulated callbacks. | [
"Initial",
"spirits",
"are",
"ready",
".",
"Run",
"accumulated",
"callbacks",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L6397-L6406 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(action) {
var list = this._trackedtypes[action.type];
if (list) {
list.forEach(function(checks) {
var handler = checks[0];
var matches = checks[1] === action.global;
var hacking = handler === this.spirit && this.$handleownaction;
if (matches && (handler !== action.target || hackin... | javascript | function(action) {
var list = this._trackedtypes[action.type];
if (list) {
list.forEach(function(checks) {
var handler = checks[0];
var matches = checks[1] === action.global;
var hacking = handler === this.spirit && this.$handleownaction;
if (matches && (handler !== action.target || hackin... | [
"function",
"(",
"action",
")",
"{",
"var",
"list",
"=",
"this",
".",
"_trackedtypes",
"[",
"action",
".",
"type",
"]",
";",
"if",
"(",
"list",
")",
"{",
"list",
".",
"forEach",
"(",
"function",
"(",
"checks",
")",
"{",
"var",
"handler",
"=",
"chec... | Handle action. If it matches listeners, the action will be
delegated to the spirit. Called by crawler in `gui.Action`.
@see {gui.Action#dispatch}
@param {gui.Action} action | [
"Handle",
"action",
".",
"If",
"it",
"matches",
"listeners",
"the",
"action",
"will",
"be",
"delegated",
"to",
"the",
"spirit",
".",
"Called",
"by",
"crawler",
"in",
"gui",
".",
"Action",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L6672-L6684 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(action, time, thisp) {
return gui.Tick.time(action, time, thisp || this.spirit);
} | javascript | function(action, time, thisp) {
return gui.Tick.time(action, time, thisp || this.spirit);
} | [
"function",
"(",
"action",
",",
"time",
",",
"thisp",
")",
"{",
"return",
"gui",
".",
"Tick",
".",
"time",
"(",
"action",
",",
"time",
",",
"thisp",
"||",
"this",
".",
"spirit",
")",
";",
"}"
] | Schedule timeout.
@param {function} action
@param {number} time
@param @optional {object|function} thisp
@returns {number} | [
"Schedule",
"timeout",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L6936-L6938 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(type, handler, one) {
var sig = this.spirit.$contextid;
if (one) {
if (this._global) {
gui.Tick.oneGlobal(type, handler);
} else {
gui.Tick.one(type, handler, sig);
}
} else {
if (this._global) {
gui.Tick.addGlobal(type, handler);
} else {
gui.Tick.add(type, han... | javascript | function(type, handler, one) {
var sig = this.spirit.$contextid;
if (one) {
if (this._global) {
gui.Tick.oneGlobal(type, handler);
} else {
gui.Tick.one(type, handler, sig);
}
} else {
if (this._global) {
gui.Tick.addGlobal(type, handler);
} else {
gui.Tick.add(type, han... | [
"function",
"(",
"type",
",",
"handler",
",",
"one",
")",
"{",
"var",
"sig",
"=",
"this",
".",
"spirit",
".",
"$contextid",
";",
"if",
"(",
"one",
")",
"{",
"if",
"(",
"this",
".",
"_global",
")",
"{",
"gui",
".",
"Tick",
".",
"oneGlobal",
"(",
... | Add handler.
@param {String} type
@param {object|function} handler
@param {boolean} one | [
"Add",
"handler",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L6990-L7005 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(type, handler) {
var sig = this.spirit.$contextid;
if (this._global) {
gui.Tick.removeGlobal(type, handler);
} else {
gui.Tick.remove(type, handler, sig);
}
} | javascript | function(type, handler) {
var sig = this.spirit.$contextid;
if (this._global) {
gui.Tick.removeGlobal(type, handler);
} else {
gui.Tick.remove(type, handler, sig);
}
} | [
"function",
"(",
"type",
",",
"handler",
")",
"{",
"var",
"sig",
"=",
"this",
".",
"spirit",
".",
"$contextid",
";",
"if",
"(",
"this",
".",
"_global",
")",
"{",
"gui",
".",
"Tick",
".",
"removeGlobal",
"(",
"type",
",",
"handler",
")",
";",
"}",
... | Remove handler.
@param {String} type
@param {object|function} handler | [
"Remove",
"handler",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L7012-L7019 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(type, checks) {
var handler = checks[0];
var bglobal = checks[1];
if (this._remove(type, [handler])) {
if (bglobal) {
gui.Tick.removeGlobal(type, handler);
} else {
gui.Tick.remove(type, handler, this.$contextid);
}
}
} | javascript | function(type, checks) {
var handler = checks[0];
var bglobal = checks[1];
if (this._remove(type, [handler])) {
if (bglobal) {
gui.Tick.removeGlobal(type, handler);
} else {
gui.Tick.remove(type, handler, this.$contextid);
}
}
} | [
"function",
"(",
"type",
",",
"checks",
")",
"{",
"var",
"handler",
"=",
"checks",
"[",
"0",
"]",
";",
"var",
"bglobal",
"=",
"checks",
"[",
"1",
"]",
";",
"if",
"(",
"this",
".",
"_remove",
"(",
"type",
",",
"[",
"handler",
"]",
")",
")",
"{",... | Remove delegated handlers.
@overwrites {gui.Tracker#_cleanup}
@param {String} type
@param {Array<object>} checks | [
"Remove",
"delegated",
"handlers",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L7042-L7052 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(arg, handler) {
handler = handler ? handler : this.spirit;
gui.Array.make(arg).forEach(function(type) {
if (this._addchecks(type, [handler])) {
if (!this._handlers[type]) {
this._handlers[type] = [];
}
this._handlers[type].push(handler);
}
}, this);
return this.spirit;
} | javascript | function(arg, handler) {
handler = handler ? handler : this.spirit;
gui.Array.make(arg).forEach(function(type) {
if (this._addchecks(type, [handler])) {
if (!this._handlers[type]) {
this._handlers[type] = [];
}
this._handlers[type].push(handler);
}
}, this);
return this.spirit;
} | [
"function",
"(",
"arg",
",",
"handler",
")",
"{",
"handler",
"=",
"handler",
"?",
"handler",
":",
"this",
".",
"spirit",
";",
"gui",
".",
"Array",
".",
"make",
"(",
"arg",
")",
".",
"forEach",
"(",
"function",
"(",
"type",
")",
"{",
"if",
"(",
"t... | Add one or more action handlers.
@param {object} arg
@param @optional {object} handler implements LifeListener
interface, defaults to this.spirit
@returns {gui.Spirit} | [
"Add",
"one",
"or",
"more",
"action",
"handlers",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L7219-L7230 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-gui.js | function(arg, handler) {
handler = handler ? handler : this.spirit;
gui.Array.make(arg).forEach(function(type) {
if (this._removechecks(type, [handler])) {
if (this._handlers[type]) { // weirdo Gecko condition...
var index = this._handlers[type].indexOf(type);
gui.Array.remove(this._handlers[type],... | javascript | function(arg, handler) {
handler = handler ? handler : this.spirit;
gui.Array.make(arg).forEach(function(type) {
if (this._removechecks(type, [handler])) {
if (this._handlers[type]) { // weirdo Gecko condition...
var index = this._handlers[type].indexOf(type);
gui.Array.remove(this._handlers[type],... | [
"function",
"(",
"arg",
",",
"handler",
")",
"{",
"handler",
"=",
"handler",
"?",
"handler",
":",
"this",
".",
"spirit",
";",
"gui",
".",
"Array",
".",
"make",
"(",
"arg",
")",
".",
"forEach",
"(",
"function",
"(",
"type",
")",
"{",
"if",
"(",
"t... | Remove one or more action handlers.
@param {object} arg
@param @optional {object} handler implements LifeListener
interface, defaults to spirit
@returns {gui.Spirit} | [
"Remove",
"one",
"or",
"more",
"action",
"handlers",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-gui.js#L7239-L7253 | 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.