id
int32
0
58k
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
17,400
APIDevTools/swagger-parser
karma.conf.js
configureCodeCoverage
function configureCodeCoverage (config) { if (process.argv.indexOf("--coverage") === -1) { console.warn("Code-coverage is not enabled"); return; } config.reporters.push("coverage"); config.coverageReporter = { reporters: [ { type: "text-summary" }, { type: "lcov" } ] }; config....
javascript
function configureCodeCoverage (config) { if (process.argv.indexOf("--coverage") === -1) { console.warn("Code-coverage is not enabled"); return; } config.reporters.push("coverage"); config.coverageReporter = { reporters: [ { type: "text-summary" }, { type: "lcov" } ] }; config....
[ "function", "configureCodeCoverage", "(", "config", ")", "{", "if", "(", "process", ".", "argv", ".", "indexOf", "(", "\"--coverage\"", ")", "===", "-", "1", ")", "{", "console", ".", "warn", "(", "\"Code-coverage is not enabled\"", ")", ";", "return", ";", ...
Configures the code-coverage reporter
[ "Configures", "the", "code", "-", "coverage", "reporter" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/karma.conf.js#L48-L68
17,401
APIDevTools/swagger-parser
online/src/js/form.js
form
function form () { form.form = $("#swagger-parser-form"); form.allow = { label: form.form.find("#allow-label"), menu: form.form.find("#allow-menu"), json: form.form.find("input[name=allow-json]"), yaml: form.form.find("input[name=allow-yaml]"), text: form.form.find("input[name=allow-text]"), ...
javascript
function form () { form.form = $("#swagger-parser-form"); form.allow = { label: form.form.find("#allow-label"), menu: form.form.find("#allow-menu"), json: form.form.find("input[name=allow-json]"), yaml: form.form.find("input[name=allow-yaml]"), text: form.form.find("input[name=allow-text]"), ...
[ "function", "form", "(", ")", "{", "form", ".", "form", "=", "$", "(", "\"#swagger-parser-form\"", ")", ";", "form", ".", "allow", "=", "{", "label", ":", "form", ".", "form", ".", "find", "(", "\"#allow-label\"", ")", ",", "menu", ":", "form", ".", ...
Finds all form fields and exposes them as properties.
[ "Finds", "all", "form", "fields", "and", "exposes", "them", "as", "properties", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/form.js#L8-L59
17,402
APIDevTools/swagger-parser
online/src/js/samples.js
samples
function samples () { form.samples.url.link.on("click", function (event) { event.preventDefault(); form.url.val(samples.url); }); form.samples.text.link.on("click", function (event) { event.preventDefault(); form.textBox.setValue(samples.text, -1); form.samples.text.container.hide(); form...
javascript
function samples () { form.samples.url.link.on("click", function (event) { event.preventDefault(); form.url.val(samples.url); }); form.samples.text.link.on("click", function (event) { event.preventDefault(); form.textBox.setValue(samples.text, -1); form.samples.text.container.hide(); form...
[ "function", "samples", "(", ")", "{", "form", ".", "samples", ".", "url", ".", "link", ".", "on", "(", "\"click\"", ",", "function", "(", "event", ")", "{", "event", ".", "preventDefault", "(", ")", ";", "form", ".", "url", ".", "val", "(", "sample...
Allows the user to use a sample URL or sample API text
[ "Allows", "the", "user", "to", "use", "a", "sample", "URL", "or", "sample", "API", "text" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/samples.js#L10-L31
17,403
APIDevTools/swagger-parser
online/src/js/dropdowns.js
dropdowns
function dropdowns () { // Set the initial method name (in case it was set by the querystring module) setSelectedMethod(form.method.button.val()); // Update each dropdown's label when its value(s) change onChange(form.allow.menu, setAllowLabel); onChange(form.refs.menu, setRefsLabel); onChange(form.validat...
javascript
function dropdowns () { // Set the initial method name (in case it was set by the querystring module) setSelectedMethod(form.method.button.val()); // Update each dropdown's label when its value(s) change onChange(form.allow.menu, setAllowLabel); onChange(form.refs.menu, setRefsLabel); onChange(form.validat...
[ "function", "dropdowns", "(", ")", "{", "// Set the initial method name (in case it was set by the querystring module)", "setSelectedMethod", "(", "form", ".", "method", ".", "button", ".", "val", "(", ")", ")", ";", "// Update each dropdown's label when its value(s) change", ...
Adds all the drop-down menu functionality
[ "Adds", "all", "the", "drop", "-", "down", "menu", "functionality" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/dropdowns.js#L11-L39
17,404
APIDevTools/swagger-parser
online/src/js/dropdowns.js
setAllowLabel
function setAllowLabel () { var values = getCheckedAndUnchecked( form.allow.json, form.allow.yaml, form.allow.text, form.allow.empty, form.allow.unknown); switch (values.checked.length) { case 0: form.allow.label.text("No file types allowed"); break; case 1: form.allow.label.text("Onl...
javascript
function setAllowLabel () { var values = getCheckedAndUnchecked( form.allow.json, form.allow.yaml, form.allow.text, form.allow.empty, form.allow.unknown); switch (values.checked.length) { case 0: form.allow.label.text("No file types allowed"); break; case 1: form.allow.label.text("Onl...
[ "function", "setAllowLabel", "(", ")", "{", "var", "values", "=", "getCheckedAndUnchecked", "(", "form", ".", "allow", ".", "json", ",", "form", ".", "allow", ".", "yaml", ",", "form", ".", "allow", ".", "text", ",", "form", ".", "allow", ".", "empty",...
Sets the "allow" label, based on which options are selected
[ "Sets", "the", "allow", "label", "based", "on", "which", "options", "are", "selected" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/dropdowns.js#L69-L92
17,405
APIDevTools/swagger-parser
online/src/js/dropdowns.js
setRefsLabel
function setRefsLabel () { var values = getCheckedAndUnchecked(form.refs.external, form.refs.circular); switch (values.checked.length) { case 0: form.refs.label.text("Only follow internal $refs"); break; case 1: form.refs.label.text("Don't follow " + values.unchecked[0] + " $refs"); ...
javascript
function setRefsLabel () { var values = getCheckedAndUnchecked(form.refs.external, form.refs.circular); switch (values.checked.length) { case 0: form.refs.label.text("Only follow internal $refs"); break; case 1: form.refs.label.text("Don't follow " + values.unchecked[0] + " $refs"); ...
[ "function", "setRefsLabel", "(", ")", "{", "var", "values", "=", "getCheckedAndUnchecked", "(", "form", ".", "refs", ".", "external", ",", "form", ".", "refs", ".", "circular", ")", ";", "switch", "(", "values", ".", "checked", ".", "length", ")", "{", ...
Sets the "refs" label, based on which options are selected
[ "Sets", "the", "refs", "label", "based", "on", "which", "options", "are", "selected" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/dropdowns.js#L97-L110
17,406
APIDevTools/swagger-parser
online/src/js/dropdowns.js
setValidateLabel
function setValidateLabel () { var values = getCheckedAndUnchecked(form.validate.schema, form.validate.spec); switch (values.checked.length) { case 0: form.validate.label.text("Don't validate anything"); break; case 1: form.validate.label.text("Don't validate Swagger " + values.unchecked[...
javascript
function setValidateLabel () { var values = getCheckedAndUnchecked(form.validate.schema, form.validate.spec); switch (values.checked.length) { case 0: form.validate.label.text("Don't validate anything"); break; case 1: form.validate.label.text("Don't validate Swagger " + values.unchecked[...
[ "function", "setValidateLabel", "(", ")", "{", "var", "values", "=", "getCheckedAndUnchecked", "(", "form", ".", "validate", ".", "schema", ",", "form", ".", "validate", ".", "spec", ")", ";", "switch", "(", "values", ".", "checked", ".", "length", ")", ...
Sets the "validate" label, based on which options are selected
[ "Sets", "the", "validate", "label", "based", "on", "which", "options", "are", "selected" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/dropdowns.js#L115-L128
17,407
APIDevTools/swagger-parser
online/src/js/dropdowns.js
setSelectedMethod
function setSelectedMethod (methodName) { form.method.button.val(methodName.toLowerCase()); methodName = methodName[0].toUpperCase() + methodName.substr(1); form.method.button.text(methodName + " it!"); form.tabs.url.text(methodName + " a URL"); form.tabs.text.text(methodName + " Text"); }
javascript
function setSelectedMethod (methodName) { form.method.button.val(methodName.toLowerCase()); methodName = methodName[0].toUpperCase() + methodName.substr(1); form.method.button.text(methodName + " it!"); form.tabs.url.text(methodName + " a URL"); form.tabs.text.text(methodName + " Text"); }
[ "function", "setSelectedMethod", "(", "methodName", ")", "{", "form", ".", "method", ".", "button", ".", "val", "(", "methodName", ".", "toLowerCase", "(", ")", ")", ";", "methodName", "=", "methodName", "[", "0", "]", ".", "toUpperCase", "(", ")", "+", ...
Updates the UI to match the specified method name @param {string} methodName - The method name (e.g. "validate", "dereference", etc.)
[ "Updates", "the", "UI", "to", "match", "the", "specified", "method", "name" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/dropdowns.js#L135-L142
17,408
APIDevTools/swagger-parser
online/src/js/dropdowns.js
trackCheckbox
function trackCheckbox (checkbox) { checkbox.on("change", function () { var value = checkbox.is(":checked") ? 1 : 0; analytics.trackEvent("options", "changed", checkbox.attr("name"), value); }); }
javascript
function trackCheckbox (checkbox) { checkbox.on("change", function () { var value = checkbox.is(":checked") ? 1 : 0; analytics.trackEvent("options", "changed", checkbox.attr("name"), value); }); }
[ "function", "trackCheckbox", "(", "checkbox", ")", "{", "checkbox", ".", "on", "(", "\"change\"", ",", "function", "(", ")", "{", "var", "value", "=", "checkbox", ".", "is", "(", "\":checked\"", ")", "?", "1", ":", "0", ";", "analytics", ".", "trackEve...
Tracks changes to a checkbox option @param {jQuery} checkbox
[ "Tracks", "changes", "to", "a", "checkbox", "option" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/dropdowns.js#L149-L154
17,409
APIDevTools/swagger-parser
online/src/js/dropdowns.js
getCheckedAndUnchecked
function getCheckedAndUnchecked (checkboxes) { var checked = [], unchecked = []; for (var i = 0; i < arguments.length; i++) { var checkbox = arguments[i]; if (checkbox.is(":checked")) { checked.push(checkbox.data("value")); } else { unchecked.push(checkbox.data("value")); } } ret...
javascript
function getCheckedAndUnchecked (checkboxes) { var checked = [], unchecked = []; for (var i = 0; i < arguments.length; i++) { var checkbox = arguments[i]; if (checkbox.is(":checked")) { checked.push(checkbox.data("value")); } else { unchecked.push(checkbox.data("value")); } } ret...
[ "function", "getCheckedAndUnchecked", "(", "checkboxes", ")", "{", "var", "checked", "=", "[", "]", ",", "unchecked", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "var", ...
Examines the given checkboxes, and returns arrays of checked and unchecked values. @param {...jQuery} checkboxes @returns {{checked: string[], unchecked: string[]}}
[ "Examines", "the", "given", "checkboxes", "and", "returns", "arrays", "of", "checked", "and", "unchecked", "values", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/dropdowns.js#L172-L184
17,410
APIDevTools/swagger-parser
online/src/js/querystring.js
setFormFields
function setFormFields () { var query = qs.parse(window.location.search.substr(1)); setCheckbox(form.allow.json, query["allow-json"]); setCheckbox(form.allow.yaml, query["allow-yaml"]); setCheckbox(form.allow.text, query["allow-text"]); setCheckbox(form.allow.empty, query["allow-empty"]); setCheckbox(form....
javascript
function setFormFields () { var query = qs.parse(window.location.search.substr(1)); setCheckbox(form.allow.json, query["allow-json"]); setCheckbox(form.allow.yaml, query["allow-yaml"]); setCheckbox(form.allow.text, query["allow-text"]); setCheckbox(form.allow.empty, query["allow-empty"]); setCheckbox(form....
[ "function", "setFormFields", "(", ")", "{", "var", "query", "=", "qs", ".", "parse", "(", "window", ".", "location", ".", "search", ".", "substr", "(", "1", ")", ")", ";", "setCheckbox", "(", "form", ".", "allow", ".", "json", ",", "query", "[", "\...
Populates all form fields based on the query-string in the URL
[ "Populates", "all", "form", "fields", "based", "on", "the", "query", "-", "string", "in", "the", "URL" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/querystring.js#L20-L45
17,411
APIDevTools/swagger-parser
online/src/js/querystring.js
setCheckbox
function setCheckbox (input, value) { if (!value || value === "true" || value === "on") { value = "yes"; } input.val([value]); }
javascript
function setCheckbox (input, value) { if (!value || value === "true" || value === "on") { value = "yes"; } input.val([value]); }
[ "function", "setCheckbox", "(", "input", ",", "value", ")", "{", "if", "(", "!", "value", "||", "value", "===", "\"true\"", "||", "value", "===", "\"on\"", ")", "{", "value", "=", "\"yes\"", ";", "}", "input", ".", "val", "(", "[", "value", "]", ")...
Checks or unchecks the given checkbox, based on the given value. @param {jQuery} input @param {*} value
[ "Checks", "or", "unchecks", "the", "given", "checkbox", "based", "on", "the", "given", "value", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/querystring.js#L53-L58
17,412
APIDevTools/swagger-parser
online/src/js/querystring.js
setBookmarkURL
function setBookmarkURL () { var query = {}; var options = form.getOptions(); options.parse.json || (query["allow-json"] = "no"); options.parse.yaml || (query["allow-yaml"] = "no"); options.parse.text || (query["allow-text"] = "no"); options.parse.json.allowEmpty || (query["allow-empty"] = "no"); options....
javascript
function setBookmarkURL () { var query = {}; var options = form.getOptions(); options.parse.json || (query["allow-json"] = "no"); options.parse.yaml || (query["allow-yaml"] = "no"); options.parse.text || (query["allow-text"] = "no"); options.parse.json.allowEmpty || (query["allow-empty"] = "no"); options....
[ "function", "setBookmarkURL", "(", ")", "{", "var", "query", "=", "{", "}", ";", "var", "options", "=", "form", ".", "getOptions", "(", ")", ";", "options", ".", "parse", ".", "json", "||", "(", "query", "[", "\"allow-json\"", "]", "=", "\"no\"", ")"...
Sets the href of the bookmark link, based on the values of each form field
[ "Sets", "the", "href", "of", "the", "bookmark", "link", "based", "on", "the", "values", "of", "each", "form", "field" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/querystring.js#L63-L84
17,413
APIDevTools/swagger-parser
online/src/js/editors.js
editors
function editors () { editors.textBox = form.textBox = ace.edit("text-box"); form.textBox.setTheme(ACE_THEME); var session = form.textBox.getSession(); session.setMode("ace/mode/yaml"); session.setTabSize(2); editors.results = $("#results"); editors.tabs = editors.results.find(".nav-tabs"); editors.pan...
javascript
function editors () { editors.textBox = form.textBox = ace.edit("text-box"); form.textBox.setTheme(ACE_THEME); var session = form.textBox.getSession(); session.setMode("ace/mode/yaml"); session.setTabSize(2); editors.results = $("#results"); editors.tabs = editors.results.find(".nav-tabs"); editors.pan...
[ "function", "editors", "(", ")", "{", "editors", ".", "textBox", "=", "form", ".", "textBox", "=", "ace", ".", "edit", "(", "\"text-box\"", ")", ";", "form", ".", "textBox", ".", "setTheme", "(", "ACE_THEME", ")", ";", "var", "session", "=", "form", ...
Initializes the ACE text editors
[ "Initializes", "the", "ACE", "text", "editors" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/editors.js#L12-L22
17,414
APIDevTools/swagger-parser
online/src/js/editors.js
getShortTitle
function getShortTitle (title) { // Get just the file name var lastSlash = title.lastIndexOf("/"); if (lastSlash !== -1) { title = title.substr(lastSlash + 1); } if (title.length > 15) { // It's still too long, so, just return the first 10 characters title = title.substr(0, 10) + "..."; } re...
javascript
function getShortTitle (title) { // Get just the file name var lastSlash = title.lastIndexOf("/"); if (lastSlash !== -1) { title = title.substr(lastSlash + 1); } if (title.length > 15) { // It's still too long, so, just return the first 10 characters title = title.substr(0, 10) + "..."; } re...
[ "function", "getShortTitle", "(", "title", ")", "{", "// Get just the file name", "var", "lastSlash", "=", "title", ".", "lastIndexOf", "(", "\"/\"", ")", ";", "if", "(", "lastSlash", "!==", "-", "1", ")", "{", "title", "=", "title", ".", "substr", "(", ...
Returns a short version of the given title text, to better fit in a tab @param {string} title @returns {string}
[ "Returns", "a", "short", "version", "of", "the", "given", "title", "text", "to", "better", "fit", "in", "a", "tab" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/editors.js#L102-L115
17,415
APIDevTools/swagger-parser
online/src/js/editors.js
showResults
function showResults () { var results = editors.results; setTimeout(function () { results[0].scrollIntoView(); results.addClass("animated") .one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function () { // Remove the "animated" class when the animation ends...
javascript
function showResults () { var results = editors.results; setTimeout(function () { results[0].scrollIntoView(); results.addClass("animated") .one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function () { // Remove the "animated" class when the animation ends...
[ "function", "showResults", "(", ")", "{", "var", "results", "=", "editors", ".", "results", ";", "setTimeout", "(", "function", "(", ")", "{", "results", "[", "0", "]", ".", "scrollIntoView", "(", ")", ";", "results", ".", "addClass", "(", "\"animated\""...
Ensures that the results are visible, and plays an animation to get the user's attention.
[ "Ensures", "that", "the", "results", "are", "visible", "and", "plays", "an", "animation", "to", "get", "the", "user", "s", "attention", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/editors.js#L120-L132
17,416
APIDevTools/swagger-parser
online/src/js/editors.js
toText
function toText (obj) { if (obj instanceof Error) { return { isJSON: false, text: obj.message + "\n\n" + obj.stack }; } else { try { return { isJSON: true, text: JSON.stringify(obj, null, 2) }; } catch (e) { return { isJSON: false, ...
javascript
function toText (obj) { if (obj instanceof Error) { return { isJSON: false, text: obj.message + "\n\n" + obj.stack }; } else { try { return { isJSON: true, text: JSON.stringify(obj, null, 2) }; } catch (e) { return { isJSON: false, ...
[ "function", "toText", "(", "obj", ")", "{", "if", "(", "obj", "instanceof", "Error", ")", "{", "return", "{", "isJSON", ":", "false", ",", "text", ":", "obj", ".", "message", "+", "\"\\n\\n\"", "+", "obj", ".", "stack", "}", ";", "}", "else", "{", ...
Converts the given object to text. If possible, it is converted to JSON; otherwise, plain text. @param {object} obj @returns {object}
[ "Converts", "the", "given", "object", "to", "text", ".", "If", "possible", "it", "is", "converted", "to", "JSON", ";", "otherwise", "plain", "text", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/editors.js#L141-L162
17,417
APIDevTools/swagger-parser
online/src/js/parser.js
parser
function parser () { // When the form is submitted, parse the Swagger API form.form.on("submit", function (event) { event.preventDefault(); parseSwagger(); }); // When the "x" button is clicked, discard the results $("#clear").on("click", function () { swaggerParser = null; editors.clearResul...
javascript
function parser () { // When the form is submitted, parse the Swagger API form.form.on("submit", function (event) { event.preventDefault(); parseSwagger(); }); // When the "x" button is clicked, discard the results $("#clear").on("click", function () { swaggerParser = null; editors.clearResul...
[ "function", "parser", "(", ")", "{", "// When the form is submitted, parse the Swagger API", "form", ".", "form", ".", "on", "(", "\"submit\"", ",", "function", "(", "event", ")", "{", "event", ".", "preventDefault", "(", ")", ";", "parseSwagger", "(", ")", ";...
Adds event handlers to trigger Swagger Parser methods
[ "Adds", "event", "handlers", "to", "trigger", "Swagger", "Parser", "methods" ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/parser.js#L15-L28
17,418
APIDevTools/swagger-parser
online/src/js/parser.js
parseSwagger
function parseSwagger () { try { // Clear any previous results editors.clearResults(); // Get all the parameters swaggerParser = swaggerParser || new SwaggerParser(); var options = form.getOptions(); var method = form.method.button.val(); var api = form.getAPI(); // Call Swagger Pars...
javascript
function parseSwagger () { try { // Clear any previous results editors.clearResults(); // Get all the parameters swaggerParser = swaggerParser || new SwaggerParser(); var options = form.getOptions(); var method = form.method.button.val(); var api = form.getAPI(); // Call Swagger Pars...
[ "function", "parseSwagger", "(", ")", "{", "try", "{", "// Clear any previous results", "editors", ".", "clearResults", "(", ")", ";", "// Get all the parameters", "swaggerParser", "=", "swaggerParser", "||", "new", "SwaggerParser", "(", ")", ";", "var", "options", ...
This function is called when the "Validate it!" button is clicked. It calls Swagger Parser, passing it all the options selected on the form.
[ "This", "function", "is", "called", "when", "the", "Validate", "it!", "button", "is", "clicked", ".", "It", "calls", "Swagger", "Parser", "passing", "it", "all", "the", "options", "selected", "on", "the", "form", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/online/src/js/parser.js#L34-L67
17,419
APIDevTools/swagger-parser
lib/validators/spec.js
validateSpec
function validateSpec (api) { if (api.openapi) { // We don't (yet) support validating against the OpenAPI spec return; } var paths = Object.keys(api.paths || {}); var operationIds = []; paths.forEach(function (pathName) { var path = api.paths[pathName]; var pathId = "/paths" + pathName; ...
javascript
function validateSpec (api) { if (api.openapi) { // We don't (yet) support validating against the OpenAPI spec return; } var paths = Object.keys(api.paths || {}); var operationIds = []; paths.forEach(function (pathName) { var path = api.paths[pathName]; var pathId = "/paths" + pathName; ...
[ "function", "validateSpec", "(", "api", ")", "{", "if", "(", "api", ".", "openapi", ")", "{", "// We don't (yet) support validating against the OpenAPI spec", "return", ";", "}", "var", "paths", "=", "Object", ".", "keys", "(", "api", ".", "paths", "||", "{", ...
Validates parts of the Swagger 2.0 spec that aren't covered by the Swagger 2.0 JSON Schema. @param {SwaggerObject} api
[ "Validates", "parts", "of", "the", "Swagger", "2", ".", "0", "spec", "that", "aren", "t", "covered", "by", "the", "Swagger", "2", ".", "0", "JSON", "Schema", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/spec.js#L16-L38
17,420
APIDevTools/swagger-parser
lib/validators/spec.js
validatePath
function validatePath (api, path, pathId, operationIds) { swaggerMethods.forEach(function (operationName) { var operation = path[operationName]; var operationId = pathId + "/" + operationName; if (operation) { var declaredOperationId = operation.operationId; if (declaredOperationId) { ...
javascript
function validatePath (api, path, pathId, operationIds) { swaggerMethods.forEach(function (operationName) { var operation = path[operationName]; var operationId = pathId + "/" + operationName; if (operation) { var declaredOperationId = operation.operationId; if (declaredOperationId) { ...
[ "function", "validatePath", "(", "api", ",", "path", ",", "pathId", ",", "operationIds", ")", "{", "swaggerMethods", ".", "forEach", "(", "function", "(", "operationName", ")", "{", "var", "operation", "=", "path", "[", "operationName", "]", ";", "var", "o...
Validates the given path. @param {SwaggerObject} api - The entire Swagger API object @param {object} path - A Path object, from the Swagger API @param {string} pathId - A value that uniquely identifies the path @param {string} operationIds - An array of collected operati...
[ "Validates", "the", "given", "path", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/spec.js#L48-L73
17,421
APIDevTools/swagger-parser
lib/validators/spec.js
validateParameters
function validateParameters (api, path, pathId, operation, operationId) { var pathParams = path.parameters || []; var operationParams = operation.parameters || []; // Check for duplicate path parameters try { checkForDuplicates(pathParams); } catch (e) { throw ono.syntax(e, "Validation failed. %s h...
javascript
function validateParameters (api, path, pathId, operation, operationId) { var pathParams = path.parameters || []; var operationParams = operation.parameters || []; // Check for duplicate path parameters try { checkForDuplicates(pathParams); } catch (e) { throw ono.syntax(e, "Validation failed. %s h...
[ "function", "validateParameters", "(", "api", ",", "path", ",", "pathId", ",", "operation", ",", "operationId", ")", "{", "var", "pathParams", "=", "path", ".", "parameters", "||", "[", "]", ";", "var", "operationParams", "=", "operation", ".", "parameters",...
Validates the parameters for the given operation. @param {SwaggerObject} api - The entire Swagger API object @param {object} path - A Path object, from the Swagger API @param {string} pathId - A value that uniquely identifies the path @param {object} operation - An Op...
[ "Validates", "the", "parameters", "for", "the", "given", "operation", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/spec.js#L84-L119
17,422
APIDevTools/swagger-parser
lib/validators/spec.js
validateBodyParameters
function validateBodyParameters (params, operationId) { var bodyParams = params.filter(function (param) { return param.in === "body"; }); var formParams = params.filter(function (param) { return param.in === "formData"; }); // There can only be one "body" parameter if (bodyParams.length > 1) { throw ono.sy...
javascript
function validateBodyParameters (params, operationId) { var bodyParams = params.filter(function (param) { return param.in === "body"; }); var formParams = params.filter(function (param) { return param.in === "formData"; }); // There can only be one "body" parameter if (bodyParams.length > 1) { throw ono.sy...
[ "function", "validateBodyParameters", "(", "params", ",", "operationId", ")", "{", "var", "bodyParams", "=", "params", ".", "filter", "(", "function", "(", "param", ")", "{", "return", "param", ".", "in", "===", "\"body\"", ";", "}", ")", ";", "var", "fo...
Validates body and formData parameters for the given operation. @param {object[]} params - An array of Parameter objects @param {string} operationId - A value that uniquely identifies the operation
[ "Validates", "body", "and", "formData", "parameters", "for", "the", "given", "operation", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/spec.js#L127-L145
17,423
APIDevTools/swagger-parser
lib/validators/spec.js
validatePathParameters
function validatePathParameters (params, pathId, operationId) { // Find all {placeholders} in the path string var placeholders = pathId.match(util.swaggerParamRegExp) || []; // Check for duplicates for (var i = 0; i < placeholders.length; i++) { for (var j = i + 1; j < placeholders.length; j++) { if ...
javascript
function validatePathParameters (params, pathId, operationId) { // Find all {placeholders} in the path string var placeholders = pathId.match(util.swaggerParamRegExp) || []; // Check for duplicates for (var i = 0; i < placeholders.length; i++) { for (var j = i + 1; j < placeholders.length; j++) { if ...
[ "function", "validatePathParameters", "(", "params", ",", "pathId", ",", "operationId", ")", "{", "// Find all {placeholders} in the path string", "var", "placeholders", "=", "pathId", ".", "match", "(", "util", ".", "swaggerParamRegExp", ")", "||", "[", "]", ";", ...
Validates path parameters for the given path. @param {object[]} params - An array of Parameter objects @param {string} pathId - A value that uniquely identifies the path @param {string} operationId - A value that uniquely identifies the operation
[ "Validates", "path", "parameters", "for", "the", "given", "path", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/spec.js#L154-L194
17,424
APIDevTools/swagger-parser
lib/validators/spec.js
validateParameterTypes
function validateParameterTypes (params, api, operation, operationId) { params.forEach(function (param) { var parameterId = operationId + "/parameters/" + param.name; var schema, validTypes; switch (param.in) { case "body": schema = param.schema; validTypes = schemaTypes; br...
javascript
function validateParameterTypes (params, api, operation, operationId) { params.forEach(function (param) { var parameterId = operationId + "/parameters/" + param.name; var schema, validTypes; switch (param.in) { case "body": schema = param.schema; validTypes = schemaTypes; br...
[ "function", "validateParameterTypes", "(", "params", ",", "api", ",", "operation", ",", "operationId", ")", "{", "params", ".", "forEach", "(", "function", "(", "param", ")", "{", "var", "parameterId", "=", "operationId", "+", "\"/parameters/\"", "+", "param",...
Validates data types of parameters for the given operation. @param {object[]} params - An array of Parameter objects @param {object} api - The entire Swagger API object @param {object} operation - An Operation object, from the Swagger API @param {string} operationId - A value t...
[ "Validates", "data", "types", "of", "parameters", "for", "the", "given", "operation", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/spec.js#L204-L246
17,425
APIDevTools/swagger-parser
lib/validators/spec.js
checkForDuplicates
function checkForDuplicates (params) { for (var i = 0; i < params.length - 1; i++) { var outer = params[i]; for (var j = i + 1; j < params.length; j++) { var inner = params[j]; if (outer.name === inner.name && outer.in === inner.in) { throw ono.syntax('Validation failed. Found multiple %s ...
javascript
function checkForDuplicates (params) { for (var i = 0; i < params.length - 1; i++) { var outer = params[i]; for (var j = i + 1; j < params.length; j++) { var inner = params[j]; if (outer.name === inner.name && outer.in === inner.in) { throw ono.syntax('Validation failed. Found multiple %s ...
[ "function", "checkForDuplicates", "(", "params", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "params", ".", "length", "-", "1", ";", "i", "++", ")", "{", "var", "outer", "=", "params", "[", "i", "]", ";", "for", "(", "var", "j", ...
Checks the given parameter list for duplicates, and throws an error if found. @param {object[]} params - An array of Parameter objects
[ "Checks", "the", "given", "parameter", "list", "for", "duplicates", "and", "throws", "an", "error", "if", "found", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/spec.js#L253-L263
17,426
APIDevTools/swagger-parser
lib/validators/spec.js
validateResponse
function validateResponse (code, response, responseId) { if (code !== "default" && (code < 100 || code > 599)) { throw ono.syntax("Validation failed. %s has an invalid response code (%s)", responseId, code); } var headers = Object.keys(response.headers || {}); headers.forEach(function (headerName) { va...
javascript
function validateResponse (code, response, responseId) { if (code !== "default" && (code < 100 || code > 599)) { throw ono.syntax("Validation failed. %s has an invalid response code (%s)", responseId, code); } var headers = Object.keys(response.headers || {}); headers.forEach(function (headerName) { va...
[ "function", "validateResponse", "(", "code", ",", "response", ",", "responseId", ")", "{", "if", "(", "code", "!==", "\"default\"", "&&", "(", "code", "<", "100", "||", "code", ">", "599", ")", ")", "{", "throw", "ono", ".", "syntax", "(", "\"Validatio...
Validates the given response object. @param {string} code - The HTTP response code (or "default") @param {object} response - A Response object, from the Swagger API @param {string} responseId - A value that uniquely identifies the response
[ "Validates", "the", "given", "response", "object", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/spec.js#L272-L294
17,427
APIDevTools/swagger-parser
lib/validators/spec.js
validateSchema
function validateSchema (schema, schemaId, validTypes) { if (validTypes.indexOf(schema.type) === -1) { throw ono.syntax( "Validation failed. %s has an invalid type (%s)", schemaId, schema.type); } if (schema.type === "array" && !schema.items) { throw ono.syntax('Validation failed. %s is an array, s...
javascript
function validateSchema (schema, schemaId, validTypes) { if (validTypes.indexOf(schema.type) === -1) { throw ono.syntax( "Validation failed. %s has an invalid type (%s)", schemaId, schema.type); } if (schema.type === "array" && !schema.items) { throw ono.syntax('Validation failed. %s is an array, s...
[ "function", "validateSchema", "(", "schema", ",", "schemaId", ",", "validTypes", ")", "{", "if", "(", "validTypes", ".", "indexOf", "(", "schema", ".", "type", ")", "===", "-", "1", ")", "{", "throw", "ono", ".", "syntax", "(", "\"Validation failed. %s has...
Validates the given Swagger schema object. @param {object} schema - A Schema object, from the Swagger API @param {string} schemaId - A value that uniquely identifies the schema object @param {string[]} validTypes - An array of the allowed schema types
[ "Validates", "the", "given", "Swagger", "schema", "object", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/spec.js#L303-L312
17,428
APIDevTools/swagger-parser
lib/validators/spec.js
validateRequiredPropertiesExist
function validateRequiredPropertiesExist (schema, schemaId) { /** * Recursively collects all properties of the schema and its ancestors. They are added to the props object. */ function collectProperties (schemaObj, props) { if (schemaObj.properties) { for (var property in schemaObj.properties) { ...
javascript
function validateRequiredPropertiesExist (schema, schemaId) { /** * Recursively collects all properties of the schema and its ancestors. They are added to the props object. */ function collectProperties (schemaObj, props) { if (schemaObj.properties) { for (var property in schemaObj.properties) { ...
[ "function", "validateRequiredPropertiesExist", "(", "schema", ",", "schemaId", ")", "{", "/**\n * Recursively collects all properties of the schema and its ancestors. They are added to the props object.\n */", "function", "collectProperties", "(", "schemaObj", ",", "props", ")", ...
Validates that the declared properties of the given Swagger schema object actually exist. @param {object} schema - A Schema object, from the Swagger API @param {string} schemaId - A value that uniquely identifies the schema object
[ "Validates", "that", "the", "declared", "properties", "of", "the", "given", "Swagger", "schema", "object", "actually", "exist", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/spec.js#L320-L349
17,429
APIDevTools/swagger-parser
lib/validators/spec.js
collectProperties
function collectProperties (schemaObj, props) { if (schemaObj.properties) { for (var property in schemaObj.properties) { if (schemaObj.properties.hasOwnProperty(property)) { props[property] = schemaObj.properties[property]; } } } if (schemaObj.allOf) { schemaObj.a...
javascript
function collectProperties (schemaObj, props) { if (schemaObj.properties) { for (var property in schemaObj.properties) { if (schemaObj.properties.hasOwnProperty(property)) { props[property] = schemaObj.properties[property]; } } } if (schemaObj.allOf) { schemaObj.a...
[ "function", "collectProperties", "(", "schemaObj", ",", "props", ")", "{", "if", "(", "schemaObj", ".", "properties", ")", "{", "for", "(", "var", "property", "in", "schemaObj", ".", "properties", ")", "{", "if", "(", "schemaObj", ".", "properties", ".", ...
Recursively collects all properties of the schema and its ancestors. They are added to the props object.
[ "Recursively", "collects", "all", "properties", "of", "the", "schema", "and", "its", "ancestors", ".", "They", "are", "added", "to", "the", "props", "object", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/spec.js#L324-L337
17,430
APIDevTools/swagger-parser
lib/validators/schema.js
validateSchema
function validateSchema (api) { // Choose the appropriate schema (Swagger or OpenAPI) var schema = api.swagger ? require("swagger-schema-official/schema.json") : require("openapi-schema-validation/schema/openapi-3.0.json"); var isValid = ZSchema.validate(api, schema); if (!isValid) { var err = ZSc...
javascript
function validateSchema (api) { // Choose the appropriate schema (Swagger or OpenAPI) var schema = api.swagger ? require("swagger-schema-official/schema.json") : require("openapi-schema-validation/schema/openapi-3.0.json"); var isValid = ZSchema.validate(api, schema); if (!isValid) { var err = ZSc...
[ "function", "validateSchema", "(", "api", ")", "{", "// Choose the appropriate schema (Swagger or OpenAPI)", "var", "schema", "=", "api", ".", "swagger", "?", "require", "(", "\"swagger-schema-official/schema.json\"", ")", ":", "require", "(", "\"openapi-schema-validation/s...
Validates the given Swagger API against the Swagger 2.0 or 3.0 schema. @param {SwaggerObject} api
[ "Validates", "the", "given", "Swagger", "API", "against", "the", "Swagger", "2", ".", "0", "or", "3", ".", "0", "schema", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/schema.js#L16-L29
17,431
APIDevTools/swagger-parser
lib/validators/schema.js
initializeZSchema
function initializeZSchema () { ZSchema = new ZSchema({ breakOnFirstError: true, noExtraKeywords: true, ignoreUnknownFormats: false, reportPathAsArray: true }); }
javascript
function initializeZSchema () { ZSchema = new ZSchema({ breakOnFirstError: true, noExtraKeywords: true, ignoreUnknownFormats: false, reportPathAsArray: true }); }
[ "function", "initializeZSchema", "(", ")", "{", "ZSchema", "=", "new", "ZSchema", "(", "{", "breakOnFirstError", ":", "true", ",", "noExtraKeywords", ":", "true", ",", "ignoreUnknownFormats", ":", "false", ",", "reportPathAsArray", ":", "true", "}", ")", ";", ...
Performs one-time initialization logic to prepare for Swagger Schema validation.
[ "Performs", "one", "-", "time", "initialization", "logic", "to", "prepare", "for", "Swagger", "Schema", "validation", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/schema.js#L34-L41
17,432
APIDevTools/swagger-parser
lib/validators/schema.js
formatZSchemaError
function formatZSchemaError (errors, indent) { indent = indent || " "; var message = ""; errors.forEach(function (error, index) { message += util.format("%s%s at #/%s\n", indent, error.message, error.path.join("/")); if (error.inner) { message += formatZSchemaError(error.inner, indent + " "); ...
javascript
function formatZSchemaError (errors, indent) { indent = indent || " "; var message = ""; errors.forEach(function (error, index) { message += util.format("%s%s at #/%s\n", indent, error.message, error.path.join("/")); if (error.inner) { message += formatZSchemaError(error.inner, indent + " "); ...
[ "function", "formatZSchemaError", "(", "errors", ",", "indent", ")", "{", "indent", "=", "indent", "||", "\" \"", ";", "var", "message", "=", "\"\"", ";", "errors", ".", "forEach", "(", "function", "(", "error", ",", "index", ")", "{", "message", "+=", ...
Z-Schema validation errors are a nested tree structure. This function crawls that tree and builds an error message string. @param {object[]} errors - The Z-Schema error details @param {string} [indent] - The whitespace used to indent the error message @returns {string}
[ "Z", "-", "Schema", "validation", "errors", "are", "a", "nested", "tree", "structure", ".", "This", "function", "crawls", "that", "tree", "and", "builds", "an", "error", "message", "string", "." ]
3cbf3357ea64a31ca66d9c460be97947f12dfb51
https://github.com/APIDevTools/swagger-parser/blob/3cbf3357ea64a31ca66d9c460be97947f12dfb51/lib/validators/schema.js#L51-L61
17,433
bvaughn/redux-search
source/selectors.js
createFilterFunction
function createFilterFunction (resource) { return resource.has instanceof Function ? id => resource.has(id) : id => resource[id] }
javascript
function createFilterFunction (resource) { return resource.has instanceof Function ? id => resource.has(id) : id => resource[id] }
[ "function", "createFilterFunction", "(", "resource", ")", "{", "return", "resource", ".", "has", "instanceof", "Function", "?", "id", "=>", "resource", ".", "has", "(", "id", ")", ":", "id", "=>", "resource", "[", "id", "]", "}" ]
Creates a default filter function capable of handling Maps and Objects.
[ "Creates", "a", "default", "filter", "function", "capable", "of", "handling", "Maps", "and", "Objects", "." ]
f6e770ee30d8bcdb713b731a28d757aaabbc9560
https://github.com/bvaughn/redux-search/blob/f6e770ee30d8bcdb713b731a28d757aaabbc9560/source/selectors.js#L47-L51
17,434
QingWei-Li/laue
dist/laue.js
genTicks
function genTicks(min, max, count) { var assign; if (max < min) { (assign = [max, min], min = assign[0], max = assign[1]); } var step = tickStep(min, max, count); var first = Math.floor(min / step) * step; var ticks$$1 = [first]; var cur = first; while (cur < max) { cur += step; ticks$$1....
javascript
function genTicks(min, max, count) { var assign; if (max < min) { (assign = [max, min], min = assign[0], max = assign[1]); } var step = tickStep(min, max, count); var first = Math.floor(min / step) * step; var ticks$$1 = [first]; var cur = first; while (cur < max) { cur += step; ticks$$1....
[ "function", "genTicks", "(", "min", ",", "max", ",", "count", ")", "{", "var", "assign", ";", "if", "(", "max", "<", "min", ")", "{", "(", "assign", "=", "[", "max", ",", "min", "]", ",", "min", "=", "assign", "[", "0", "]", ",", "max", "=", ...
Returns nick ticks
[ "Returns", "nick", "ticks" ]
65f9a4ce0c5971ec6fe1d927d9f8e471bfa88df5
https://github.com/QingWei-Li/laue/blob/65f9a4ce0c5971ec6fe1d927d9f8e471bfa88df5/dist/laue.js#L316-L344
17,435
mathjax/MathJax-node
lib/main.js
function () { var styles = document.head.getElementsByTagName("style"); CHTMLSTYLES = styles[styles.length-1].innerHTML; this.pxPerInch = 96; this.defaultEx = 6; this.defaultEm = 6 / CHTML.TEX.x_height * 1000; this.defaultWidth = 100; ...
javascript
function () { var styles = document.head.getElementsByTagName("style"); CHTMLSTYLES = styles[styles.length-1].innerHTML; this.pxPerInch = 96; this.defaultEx = 6; this.defaultEm = 6 / CHTML.TEX.x_height * 1000; this.defaultWidth = 100; ...
[ "function", "(", ")", "{", "var", "styles", "=", "document", ".", "head", ".", "getElementsByTagName", "(", "\"style\"", ")", ";", "CHTMLSTYLES", "=", "styles", "[", "styles", ".", "length", "-", "1", "]", ".", "innerHTML", ";", "this", ".", "pxPerInch",...
Set up the default ex-size and width
[ "Set", "up", "the", "default", "ex", "-", "size", "and", "width" ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L389-L396
17,436
mathjax/MathJax-node
lib/main.js
Insert
function Insert(dst,src) { for (var id in src) {if (src.hasOwnProperty(id)) { // allow for concatenation of arrays? if (typeof src[id] === 'object' && !(src[id] instanceof Array) && (typeof dst[id] === 'object' || typeof dst[id] === 'function')) {Insert(dst[id],src[id])} else {dst[id] = src[id...
javascript
function Insert(dst,src) { for (var id in src) {if (src.hasOwnProperty(id)) { // allow for concatenation of arrays? if (typeof src[id] === 'object' && !(src[id] instanceof Array) && (typeof dst[id] === 'object' || typeof dst[id] === 'function')) {Insert(dst[id],src[id])} else {dst[id] = src[id...
[ "function", "Insert", "(", "dst", ",", "src", ")", "{", "for", "(", "var", "id", "in", "src", ")", "{", "if", "(", "src", ".", "hasOwnProperty", "(", "id", ")", ")", "{", "// allow for concatenation of arrays?", "if", "(", "typeof", "src", "[", "id", ...
Insert one objects into another
[ "Insert", "one", "objects", "into", "another" ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L574-L582
17,437
mathjax/MathJax-node
lib/main.js
StartMathJax
function StartMathJax() { serverState = STATE.STARTED; var script = document.createElement("script"); script.src = MathJaxPath; script.onerror = function () {AddError("Can't load MathJax.js from "+MathJaxPath)}; document.head.appendChild(script); }
javascript
function StartMathJax() { serverState = STATE.STARTED; var script = document.createElement("script"); script.src = MathJaxPath; script.onerror = function () {AddError("Can't load MathJax.js from "+MathJaxPath)}; document.head.appendChild(script); }
[ "function", "StartMathJax", "(", ")", "{", "serverState", "=", "STATE", ".", "STARTED", ";", "var", "script", "=", "document", ".", "createElement", "(", "\"script\"", ")", ";", "script", ".", "src", "=", "MathJaxPath", ";", "script", ".", "onerror", "=", ...
Load MathJax into the DOM
[ "Load", "MathJax", "into", "the", "DOM" ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L587-L593
17,438
mathjax/MathJax-node
lib/main.js
AddError
function AddError(message,nopush) { if (displayErrors) console.error(message); if (!nopush) errors.push(message); }
javascript
function AddError(message,nopush) { if (displayErrors) console.error(message); if (!nopush) errors.push(message); }
[ "function", "AddError", "(", "message", ",", "nopush", ")", "{", "if", "(", "displayErrors", ")", "console", ".", "error", "(", "message", ")", ";", "if", "(", "!", "nopush", ")", "errors", ".", "push", "(", "message", ")", ";", "}" ]
Add an error to the error list and display it on the console
[ "Add", "an", "error", "to", "the", "error", "list", "and", "display", "it", "on", "the", "console" ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L608-L611
17,439
mathjax/MathJax-node
lib/main.js
GetSpeech
function GetSpeech(result) { if (!data.speakText) return; result.speakText = "Equation"; if (data.format !== "MathML") result.speakText = data.math; else { var jax = MathJax.Hub.getAllJax()[0]; if (jax.root.alttext) result.speakText = jax.root.alttext; } }
javascript
function GetSpeech(result) { if (!data.speakText) return; result.speakText = "Equation"; if (data.format !== "MathML") result.speakText = data.math; else { var jax = MathJax.Hub.getAllJax()[0]; if (jax.root.alttext) result.speakText = jax.root.alttext; } }
[ "function", "GetSpeech", "(", "result", ")", "{", "if", "(", "!", "data", ".", "speakText", ")", "return", ";", "result", ".", "speakText", "=", "\"Equation\"", ";", "if", "(", "data", ".", "format", "!==", "\"MathML\"", ")", "result", ".", "speakText", ...
Creates speech string and updates the MathML to include it, if needed
[ "Creates", "speech", "string", "and", "updates", "the", "MathML", "to", "include", "it", "if", "needed" ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L643-L651
17,440
mathjax/MathJax-node
lib/main.js
GetHTML
function GetHTML(result) { if (data.css) result.css = CHTMLSTYLES; if (!data.html && !data.htmlNode) return; var jax = MathJax.Hub.getAllJax()[0]; if (!jax) return; var script = jax.SourceElement(), html = script.previousSibling; // add speech text if there isn't one if (data.speakText){ var labelTarge...
javascript
function GetHTML(result) { if (data.css) result.css = CHTMLSTYLES; if (!data.html && !data.htmlNode) return; var jax = MathJax.Hub.getAllJax()[0]; if (!jax) return; var script = jax.SourceElement(), html = script.previousSibling; // add speech text if there isn't one if (data.speakText){ var labelTarge...
[ "function", "GetHTML", "(", "result", ")", "{", "if", "(", "data", ".", "css", ")", "result", ".", "css", "=", "CHTMLSTYLES", ";", "if", "(", "!", "data", ".", "html", "&&", "!", "data", ".", "htmlNode", ")", "return", ";", "var", "jax", "=", "Ma...
Create HTML and CSS output, if requested
[ "Create", "HTML", "and", "CSS", "output", "if", "requested" ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L656-L688
17,441
mathjax/MathJax-node
lib/main.js
GetSVG
function GetSVG(result) { if (!data.svg && !data.svgNode) return; var jax = MathJax.Hub.getAllJax()[0]; if (!jax) return; var script = jax.SourceElement(), svg = script.previousSibling.getElementsByTagName("svg")[0]; svg.setAttribute("xmlns","http://www.w3.org/2000/svg"); // // Add the speech text a...
javascript
function GetSVG(result) { if (!data.svg && !data.svgNode) return; var jax = MathJax.Hub.getAllJax()[0]; if (!jax) return; var script = jax.SourceElement(), svg = script.previousSibling.getElementsByTagName("svg")[0]; svg.setAttribute("xmlns","http://www.w3.org/2000/svg"); // // Add the speech text a...
[ "function", "GetSVG", "(", "result", ")", "{", "if", "(", "!", "data", ".", "svg", "&&", "!", "data", ".", "svgNode", ")", "return", ";", "var", "jax", "=", "MathJax", ".", "Hub", ".", "getAllJax", "(", ")", "[", "0", "]", ";", "if", "(", "!", ...
Create SVG output, if requested
[ "Create", "SVG", "output", "if", "requested" ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L693-L733
17,442
mathjax/MathJax-node
lib/main.js
StartQueue
function StartQueue() { data = callback = originalData = null; // clear existing equation, if any errors = sErrors; sErrors = []; // clear any errors if (!queue.length) return; // return if nothing to do serverState = STATE.BUSY; var result = {}, $$ = window.Array; // // Get th...
javascript
function StartQueue() { data = callback = originalData = null; // clear existing equation, if any errors = sErrors; sErrors = []; // clear any errors if (!queue.length) return; // return if nothing to do serverState = STATE.BUSY; var result = {}, $$ = window.Array; // // Get th...
[ "function", "StartQueue", "(", ")", "{", "data", "=", "callback", "=", "originalData", "=", "null", ";", "// clear existing equation, if any", "errors", "=", "sErrors", ";", "sErrors", "=", "[", "]", ";", "// clear any errors", "if", "(", "!", "queue", ".", ...
Start typesetting the queued expressions
[ "Start", "typesetting", "the", "queued", "expressions" ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L740-L805
17,443
mathjax/MathJax-node
lib/main.js
GetState
function GetState(state) { var SVG = MathJax.OutputJax.SVG, TEX = MathJax.InputJax.TeX, MML = MathJax.ElementJax.mml, AMS = MathJax.Extension["TeX/AMSmath"], HUB = MathJax.Hub, HTML = MathJax.HTML, GLYPH = (SVG.BBOX||{}).GLYPH; if (state && state.AMS) { AMS.startNumber = state.AMS...
javascript
function GetState(state) { var SVG = MathJax.OutputJax.SVG, TEX = MathJax.InputJax.TeX, MML = MathJax.ElementJax.mml, AMS = MathJax.Extension["TeX/AMSmath"], HUB = MathJax.Hub, HTML = MathJax.HTML, GLYPH = (SVG.BBOX||{}).GLYPH; if (state && state.AMS) { AMS.startNumber = state.AMS...
[ "function", "GetState", "(", "state", ")", "{", "var", "SVG", "=", "MathJax", ".", "OutputJax", ".", "SVG", ",", "TEX", "=", "MathJax", ".", "InputJax", ".", "TeX", ",", "MML", "=", "MathJax", ".", "ElementJax", ".", "mml", ",", "AMS", "=", "MathJax"...
Update the MathJax values from the state, or clear them if there is no state.
[ "Update", "the", "MathJax", "values", "from", "the", "state", "or", "clear", "them", "if", "there", "is", "no", "state", "." ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L811-L840
17,444
mathjax/MathJax-node
lib/main.js
TypesetDone
function TypesetDone(result) { if (timer) {clearTimeout(timer); timer = null} html.removeAttribute("xmlns:"+data.xmlns); }
javascript
function TypesetDone(result) { if (timer) {clearTimeout(timer); timer = null} html.removeAttribute("xmlns:"+data.xmlns); }
[ "function", "TypesetDone", "(", "result", ")", "{", "if", "(", "timer", ")", "{", "clearTimeout", "(", "timer", ")", ";", "timer", "=", "null", "}", "html", ".", "removeAttribute", "(", "\"xmlns:\"", "+", "data", ".", "xmlns", ")", ";", "}" ]
When the expression is typeset, clear the timeout timer, if any, and update the MathJax state,
[ "When", "the", "expression", "is", "typeset", "clear", "the", "timeout", "timer", "if", "any", "and", "update", "the", "MathJax", "state" ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L847-L850
17,445
mathjax/MathJax-node
lib/main.js
ReturnResult
function ReturnResult(result) { if (errors.length) { result.errors = errors; } var state = data.state; if (state) { var AMS = MathJax.Extension["TeX/AMSmath"]; var GLYPH = (MathJax.OutputJax.SVG||{}).BBOX.GLYPH; state.AMS.startNumber = AMS.startNumber; state.AMS.labels = AMS.labels; stat...
javascript
function ReturnResult(result) { if (errors.length) { result.errors = errors; } var state = data.state; if (state) { var AMS = MathJax.Extension["TeX/AMSmath"]; var GLYPH = (MathJax.OutputJax.SVG||{}).BBOX.GLYPH; state.AMS.startNumber = AMS.startNumber; state.AMS.labels = AMS.labels; stat...
[ "function", "ReturnResult", "(", "result", ")", "{", "if", "(", "errors", ".", "length", ")", "{", "result", ".", "errors", "=", "errors", ";", "}", "var", "state", "=", "data", ".", "state", ";", "if", "(", "state", ")", "{", "var", "AMS", "=", ...
Return the result object, and do the next queued expression
[ "Return", "the", "result", "object", "and", "do", "the", "next", "queued", "expression" ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L856-L876
17,446
mathjax/MathJax-node
lib/main.js
function (data, callback) { if (!callback || typeof(callback) !== "function") { if (displayErrors) console.error("Missing callback"); return; } var options = {}; for (var id in defaults) {if (defaults.hasOwnProperty(id)) { options[id] = (data.hasOwnProperty(id) ? data[id]: defaults[id]); }} if (...
javascript
function (data, callback) { if (!callback || typeof(callback) !== "function") { if (displayErrors) console.error("Missing callback"); return; } var options = {}; for (var id in defaults) {if (defaults.hasOwnProperty(id)) { options[id] = (data.hasOwnProperty(id) ? data[id]: defaults[id]); }} if (...
[ "function", "(", "data", ",", "callback", ")", "{", "if", "(", "!", "callback", "||", "typeof", "(", "callback", ")", "!==", "\"function\"", ")", "{", "if", "(", "displayErrors", ")", "console", ".", "error", "(", "\"Missing callback\"", ")", ";", "retur...
The API call to typeset an equation %%% cache results? %%% check types and values of parameters callback API for compatibility with MathJax
[ "The", "API", "call", "to", "typeset", "an", "equation", "%%%", "cache", "results?", "%%%", "check", "types", "and", "values", "of", "parameters", "callback", "API", "for", "compatibility", "with", "MathJax" ]
c7e5bf3baf4af820e68be58cb93ade38b8e19cbe
https://github.com/mathjax/MathJax-node/blob/c7e5bf3baf4af820e68be58cb93ade38b8e19cbe/lib/main.js#L926-L940
17,447
messageformat/messageformat
packages/formatters/lib/duration.js
duration
function duration(value) { if (!isFinite(value)) return String(value); var sign = ''; if (value < 0) { sign = '-'; value = Math.abs(value); } else { value = Number(value); } var sec = value % 60; var parts = [Math.round(sec) === sec ? sec : sec.toFixed(3)]; if (value < 60) { parts.unshif...
javascript
function duration(value) { if (!isFinite(value)) return String(value); var sign = ''; if (value < 0) { sign = '-'; value = Math.abs(value); } else { value = Number(value); } var sec = value % 60; var parts = [Math.round(sec) === sec ? sec : sec.toFixed(3)]; if (value < 60) { parts.unshif...
[ "function", "duration", "(", "value", ")", "{", "if", "(", "!", "isFinite", "(", "value", ")", ")", "return", "String", "(", "value", ")", ";", "var", "sign", "=", "''", ";", "if", "(", "value", "<", "0", ")", "{", "sign", "=", "'-'", ";", "val...
Represent a duration in seconds as a string Input should be a finite number; output will include one or two `:` separators, and match the pattern `hhhh:mm:ss`, possibly with a leading `-` for negative values and a trailing `.sss` part for non-integer input @memberof Formatters @param {number|string} value - A finite ...
[ "Represent", "a", "duration", "in", "seconds", "as", "a", "string" ]
6378fc35ed774675f4a8849a1348717344e6a13a
https://github.com/messageformat/messageformat/blob/6378fc35ed774675f4a8849a1348717344e6a13a/packages/formatters/lib/duration.js#L20-L52
17,448
letsgetrandy/brototype
brototype.js
Bromise
function Bromise(object, method, args) { this.object = object; this.method = method; this.args = args.length > 1 ? args.slice(1) : []; }
javascript
function Bromise(object, method, args) { this.object = object; this.method = method; this.args = args.length > 1 ? args.slice(1) : []; }
[ "function", "Bromise", "(", "object", ",", "method", ",", "args", ")", "{", "this", ".", "object", "=", "object", ";", "this", ".", "method", "=", "method", ";", "this", ".", "args", "=", "args", ".", "length", ">", "1", "?", "args", ".", "slice", ...
Bromise... it's stronger than a Promise
[ "Bromise", "...", "it", "s", "stronger", "than", "a", "Promise" ]
731b02f614971341e6677adc763cb3efafb64c35
https://github.com/letsgetrandy/brototype/blob/731b02f614971341e6677adc763cb3efafb64c35/brototype.js#L6-L10
17,449
nwjs-community/nw-builder
lib/versions.js
function(downloadUrl, manifestUrl, flavor) { return getManifest(manifestUrl) .then(function(manifest) { return { desiredVersion: manifest.stable.replace('v', ''), downloadUrl: downloadUrl, manifestUrl: manifestUrl, ...
javascript
function(downloadUrl, manifestUrl, flavor) { return getManifest(manifestUrl) .then(function(manifest) { return { desiredVersion: manifest.stable.replace('v', ''), downloadUrl: downloadUrl, manifestUrl: manifestUrl, ...
[ "function", "(", "downloadUrl", ",", "manifestUrl", ",", "flavor", ")", "{", "return", "getManifest", "(", "manifestUrl", ")", ".", "then", "(", "function", "(", "manifest", ")", "{", "return", "{", "desiredVersion", ":", "manifest", ".", "stable", ".", "r...
Gets the latest stable version @param {string} downloadUrl @param {string} manifestUrl @param {string} flavor @returns {promise} which resolves to a {Version}
[ "Gets", "the", "latest", "stable", "version" ]
d2208f47d374c2eca75de09a14310ccee903abf5
https://github.com/nwjs-community/nw-builder/blob/d2208f47d374c2eca75de09a14310ccee903abf5/lib/versions.js#L152-L163
17,450
gcanti/tcomb
lib/update.js
$apply
function $apply(f, value) { if (process.env.NODE_ENV !== 'production') { assert(isFunction(f), 'Invalid argument f supplied to immutability helper { $apply: f } (expected a function)'); } return f(value); }
javascript
function $apply(f, value) { if (process.env.NODE_ENV !== 'production') { assert(isFunction(f), 'Invalid argument f supplied to immutability helper { $apply: f } (expected a function)'); } return f(value); }
[ "function", "$apply", "(", "f", ",", "value", ")", "{", "if", "(", "process", ".", "env", ".", "NODE_ENV", "!==", "'production'", ")", "{", "assert", "(", "isFunction", "(", "f", ")", ",", "'Invalid argument f supplied to immutability helper { $apply: f } (expecte...
built-in commands
[ "built", "-", "in", "commands" ]
bef7690a072c056a8604efd376fb4c959a407557
https://github.com/gcanti/tcomb/blob/bef7690a072c056a8604efd376fb4c959a407557/lib/update.js#L64-L69
17,451
gcanti/tcomb
lib/list.js
List
function List(value, path) { if (process.env.NODE_ENV === 'production') { if (identity) { return value; // just trust the input if elements must not be hydrated } } if (process.env.NODE_ENV !== 'production') { path = path || [displayName]; assert(isArray(value), function ()...
javascript
function List(value, path) { if (process.env.NODE_ENV === 'production') { if (identity) { return value; // just trust the input if elements must not be hydrated } } if (process.env.NODE_ENV !== 'production') { path = path || [displayName]; assert(isArray(value), function ()...
[ "function", "List", "(", "value", ",", "path", ")", "{", "if", "(", "process", ".", "env", ".", "NODE_ENV", "===", "'production'", ")", "{", "if", "(", "identity", ")", "{", "return", "value", ";", "// just trust the input if elements must not be hydrated", "}...
the list is identity iif type is identity
[ "the", "list", "is", "identity", "iif", "type", "is", "identity" ]
bef7690a072c056a8604efd376fb4c959a407557
https://github.com/gcanti/tcomb/blob/bef7690a072c056a8604efd376fb4c959a407557/lib/list.js#L25-L56
17,452
nordnet/cordova-universal-links-plugin
hooks/lib/android/webSiteHook.js
generateWebHook
function generateWebHook(cordovaContext, pluginPreferences) { var projectRoot = cordovaContext.opts.projectRoot; var configXmlHelper = new ConfigXmlHelper(cordovaContext); var packageName = configXmlHelper.getPackageName('android'); var template = readTemplate(projectRoot); // if template was not found - exi...
javascript
function generateWebHook(cordovaContext, pluginPreferences) { var projectRoot = cordovaContext.opts.projectRoot; var configXmlHelper = new ConfigXmlHelper(cordovaContext); var packageName = configXmlHelper.getPackageName('android'); var template = readTemplate(projectRoot); // if template was not found - exi...
[ "function", "generateWebHook", "(", "cordovaContext", ",", "pluginPreferences", ")", "{", "var", "projectRoot", "=", "cordovaContext", ".", "opts", ".", "projectRoot", ";", "var", "configXmlHelper", "=", "new", "ConfigXmlHelper", "(", "cordovaContext", ")", ";", "...
region Public API Generate website hook for android application. @param {Object} cordovaContext - cordova context object @param {Object} pluginPreferences - plugin preferences from config.xml file; already parsed
[ "region", "Public", "API", "Generate", "website", "hook", "for", "android", "application", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/webSiteHook.js#L31-L48
17,453
nordnet/cordova-universal-links-plugin
hooks/lib/android/webSiteHook.js
readTemplate
function readTemplate(projectRoot) { var filePath = path.join(projectRoot, WEB_HOOK_TPL_FILE_PATH); var tplData = null; try { tplData = fs.readFileSync(filePath, 'utf8'); } catch (err) { console.warn('Template file for android web hook is not found!'); console.warn(err); } return tplData; }
javascript
function readTemplate(projectRoot) { var filePath = path.join(projectRoot, WEB_HOOK_TPL_FILE_PATH); var tplData = null; try { tplData = fs.readFileSync(filePath, 'utf8'); } catch (err) { console.warn('Template file for android web hook is not found!'); console.warn(err); } return tplData; }
[ "function", "readTemplate", "(", "projectRoot", ")", "{", "var", "filePath", "=", "path", ".", "join", "(", "projectRoot", ",", "WEB_HOOK_TPL_FILE_PATH", ")", ";", "var", "tplData", "=", "null", ";", "try", "{", "tplData", "=", "fs", ".", "readFileSync", "...
region Public API Read hook teplate from plugin directory. @param {String} projectRoot - absolute path to cordova's project root @return {String} data from the template file
[ "region", "Public", "API", "Read", "hook", "teplate", "from", "plugin", "directory", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/webSiteHook.js#L60-L72
17,454
nordnet/cordova-universal-links-plugin
hooks/lib/android/webSiteHook.js
saveWebHook
function saveWebHook(projectRoot, hookContent) { var filePath = path.join(projectRoot, WEB_HOOK_FILE_PATH); var isSaved = true; // ensure directory exists createDirectoryIfNeeded(path.dirname(filePath)); // write data to file try { fs.writeFileSync(filePath, hookContent, 'utf8'); } catch (err) { ...
javascript
function saveWebHook(projectRoot, hookContent) { var filePath = path.join(projectRoot, WEB_HOOK_FILE_PATH); var isSaved = true; // ensure directory exists createDirectoryIfNeeded(path.dirname(filePath)); // write data to file try { fs.writeFileSync(filePath, hookContent, 'utf8'); } catch (err) { ...
[ "function", "saveWebHook", "(", "projectRoot", ",", "hookContent", ")", "{", "var", "filePath", "=", "path", ".", "join", "(", "projectRoot", ",", "WEB_HOOK_FILE_PATH", ")", ";", "var", "isSaved", "=", "true", ";", "// ensure directory exists", "createDirectoryIfN...
Save data to website hook file. @param {String} projectRoot - absolute path to project root @param {String} hookContent - data to save @return {boolean} true - if data was saved; otherwise - false;
[ "Save", "data", "to", "website", "hook", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/webSiteHook.js#L130-L147
17,455
nordnet/cordova-universal-links-plugin
hooks/lib/ios/projectEntitlements.js
generateEntitlements
function generateEntitlements(cordovaContext, pluginPreferences) { context = cordovaContext; var currentEntitlements = getEntitlementsFileContent(); var newEntitlements = injectPreferences(currentEntitlements, pluginPreferences); saveContentToEntitlementsFile(newEntitlements); }
javascript
function generateEntitlements(cordovaContext, pluginPreferences) { context = cordovaContext; var currentEntitlements = getEntitlementsFileContent(); var newEntitlements = injectPreferences(currentEntitlements, pluginPreferences); saveContentToEntitlementsFile(newEntitlements); }
[ "function", "generateEntitlements", "(", "cordovaContext", ",", "pluginPreferences", ")", "{", "context", "=", "cordovaContext", ";", "var", "currentEntitlements", "=", "getEntitlementsFileContent", "(", ")", ";", "var", "newEntitlements", "=", "injectPreferences", "(",...
region Public API Generate entitlements file content. @param {Object} cordovaContext - cordova context object @param {Object} pluginPreferences - plugin preferences from config.xml; already parsed
[ "region", "Public", "API", "Generate", "entitlements", "file", "content", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/projectEntitlements.js#L32-L39
17,456
nordnet/cordova-universal-links-plugin
hooks/lib/ios/projectEntitlements.js
saveContentToEntitlementsFile
function saveContentToEntitlementsFile(content) { var plistContent = plist.build(content); var filePath = pathToEntitlementsFile(); // ensure that file exists mkpath.sync(path.dirname(filePath)); // save it's content fs.writeFileSync(filePath, plistContent, 'utf8'); }
javascript
function saveContentToEntitlementsFile(content) { var plistContent = plist.build(content); var filePath = pathToEntitlementsFile(); // ensure that file exists mkpath.sync(path.dirname(filePath)); // save it's content fs.writeFileSync(filePath, plistContent, 'utf8'); }
[ "function", "saveContentToEntitlementsFile", "(", "content", ")", "{", "var", "plistContent", "=", "plist", ".", "build", "(", "content", ")", ";", "var", "filePath", "=", "pathToEntitlementsFile", "(", ")", ";", "// ensure that file exists", "mkpath", ".", "sync"...
region Work with entitlements file Save data to entitlements file. @param {Object} content - data to save; JSON object that will be transformed into xml
[ "region", "Work", "with", "entitlements", "file", "Save", "data", "to", "entitlements", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/projectEntitlements.js#L50-L59
17,457
nordnet/cordova-universal-links-plugin
hooks/lib/ios/projectEntitlements.js
getEntitlementsFileContent
function getEntitlementsFileContent() { var pathToFile = pathToEntitlementsFile(); var content; try { content = fs.readFileSync(pathToFile, 'utf8'); } catch (err) { return defaultEntitlementsFile(); } return plist.parse(content); }
javascript
function getEntitlementsFileContent() { var pathToFile = pathToEntitlementsFile(); var content; try { content = fs.readFileSync(pathToFile, 'utf8'); } catch (err) { return defaultEntitlementsFile(); } return plist.parse(content); }
[ "function", "getEntitlementsFileContent", "(", ")", "{", "var", "pathToFile", "=", "pathToEntitlementsFile", "(", ")", ";", "var", "content", ";", "try", "{", "content", "=", "fs", ".", "readFileSync", "(", "pathToFile", ",", "'utf8'", ")", ";", "}", "catch"...
Read data from existing entitlements file. If none exist - default value is returned @return {String} entitlements file content
[ "Read", "data", "from", "existing", "entitlements", "file", ".", "If", "none", "exist", "-", "default", "value", "is", "returned" ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/projectEntitlements.js#L66-L77
17,458
nordnet/cordova-universal-links-plugin
hooks/lib/ios/projectEntitlements.js
injectPreferences
function injectPreferences(currentEntitlements, pluginPreferences) { var newEntitlements = currentEntitlements; var content = generateAssociatedDomainsContent(pluginPreferences); newEntitlements[ASSOCIATED_DOMAINS] = content; return newEntitlements; }
javascript
function injectPreferences(currentEntitlements, pluginPreferences) { var newEntitlements = currentEntitlements; var content = generateAssociatedDomainsContent(pluginPreferences); newEntitlements[ASSOCIATED_DOMAINS] = content; return newEntitlements; }
[ "function", "injectPreferences", "(", "currentEntitlements", ",", "pluginPreferences", ")", "{", "var", "newEntitlements", "=", "currentEntitlements", ";", "var", "content", "=", "generateAssociatedDomainsContent", "(", "pluginPreferences", ")", ";", "newEntitlements", "[...
Inject list of hosts into entitlements file. @param {Object} currentEntitlements - entitlements where to inject preferences @param {Object} pluginPreferences - list of hosts from config.xml @return {Object} new entitlements content
[ "Inject", "list", "of", "hosts", "into", "entitlements", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/projectEntitlements.js#L95-L102
17,459
nordnet/cordova-universal-links-plugin
hooks/lib/ios/projectEntitlements.js
generateAssociatedDomainsContent
function generateAssociatedDomainsContent(pluginPreferences) { var domainsList = []; // generate list of host links pluginPreferences.hosts.forEach(function(host) { var link = domainsListEntryForHost(host); if (domainsList.indexOf(link) == -1) { domainsList.push(link); } }); return domains...
javascript
function generateAssociatedDomainsContent(pluginPreferences) { var domainsList = []; // generate list of host links pluginPreferences.hosts.forEach(function(host) { var link = domainsListEntryForHost(host); if (domainsList.indexOf(link) == -1) { domainsList.push(link); } }); return domains...
[ "function", "generateAssociatedDomainsContent", "(", "pluginPreferences", ")", "{", "var", "domainsList", "=", "[", "]", ";", "// generate list of host links", "pluginPreferences", ".", "hosts", ".", "forEach", "(", "function", "(", "host", ")", "{", "var", "link", ...
Generate content for associated-domains dictionary in the entitlements file. @param {Object} pluginPreferences - list of hosts from conig.xml @return {Object} associated-domains dictionary content
[ "Generate", "content", "for", "associated", "-", "domains", "dictionary", "in", "the", "entitlements", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/projectEntitlements.js#L110-L122
17,460
nordnet/cordova-universal-links-plugin
hooks/lib/ios/projectEntitlements.js
pathToEntitlementsFile
function pathToEntitlementsFile() { if (entitlementsFilePath === undefined) { entitlementsFilePath = path.join(getProjectRoot(), 'platforms', 'ios', getProjectName(), 'Resources', getProjectName() + '.entitlements'); } return entitlementsFilePath; }
javascript
function pathToEntitlementsFile() { if (entitlementsFilePath === undefined) { entitlementsFilePath = path.join(getProjectRoot(), 'platforms', 'ios', getProjectName(), 'Resources', getProjectName() + '.entitlements'); } return entitlementsFilePath; }
[ "function", "pathToEntitlementsFile", "(", ")", "{", "if", "(", "entitlementsFilePath", "===", "undefined", ")", "{", "entitlementsFilePath", "=", "path", ".", "join", "(", "getProjectRoot", "(", ")", ",", "'platforms'", ",", "'ios'", ",", "getProjectName", "(",...
region Path helper methods Path to entitlements file. @return {String} absolute path to entitlements file
[ "region", "Path", "helper", "methods", "Path", "to", "entitlements", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/projectEntitlements.js#L143-L149
17,461
nordnet/cordova-universal-links-plugin
hooks/lib/ios/projectEntitlements.js
getProjectName
function getProjectName() { if (projectName === undefined) { var configXmlHelper = new ConfigXmlHelper(context); projectName = configXmlHelper.getProjectName(); } return projectName; }
javascript
function getProjectName() { if (projectName === undefined) { var configXmlHelper = new ConfigXmlHelper(context); projectName = configXmlHelper.getProjectName(); } return projectName; }
[ "function", "getProjectName", "(", ")", "{", "if", "(", "projectName", "===", "undefined", ")", "{", "var", "configXmlHelper", "=", "new", "ConfigXmlHelper", "(", "context", ")", ";", "projectName", "=", "configXmlHelper", ".", "getProjectName", "(", ")", ";",...
Name of the project from config.xml @return {String} project name
[ "Name", "of", "the", "project", "from", "config", ".", "xml" ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/projectEntitlements.js#L165-L172
17,462
nordnet/cordova-universal-links-plugin
hooks/iosBeforePrepareHook.js
run
function run(ctx) { var projectRoot = ctx.opts.projectRoot; var iosProjectFilePath = path.join(projectRoot, 'platforms', 'ios'); var configXmlHelper = new ConfigXmlHelper(ctx); var newProjectName = configXmlHelper.getProjectName(); var oldProjectName = getOldProjectName(iosProjectFilePath); // if name has...
javascript
function run(ctx) { var projectRoot = ctx.opts.projectRoot; var iosProjectFilePath = path.join(projectRoot, 'platforms', 'ios'); var configXmlHelper = new ConfigXmlHelper(ctx); var newProjectName = configXmlHelper.getProjectName(); var oldProjectName = getOldProjectName(iosProjectFilePath); // if name has...
[ "function", "run", "(", "ctx", ")", "{", "var", "projectRoot", "=", "ctx", ".", "opts", ".", "projectRoot", ";", "var", "iosProjectFilePath", "=", "path", ".", "join", "(", "projectRoot", ",", "'platforms'", ",", "'ios'", ")", ";", "var", "configXmlHelper"...
Run the hook logic. @param {Object} ctx - cordova context object
[ "Run", "the", "hook", "logic", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/iosBeforePrepareHook.js#L20-L45
17,463
nordnet/cordova-universal-links-plugin
hooks/iosBeforePrepareHook.js
getOldProjectName
function getOldProjectName(projectDir) { var files = []; try { files = fs.readdirSync(projectDir); } catch (err) { return ''; } var projectFile = ''; files.forEach(function(fileName) { if (path.extname(fileName) === '.xcodeproj') { projectFile = path.basename(fileName, '.xcodeproj'); ...
javascript
function getOldProjectName(projectDir) { var files = []; try { files = fs.readdirSync(projectDir); } catch (err) { return ''; } var projectFile = ''; files.forEach(function(fileName) { if (path.extname(fileName) === '.xcodeproj') { projectFile = path.basename(fileName, '.xcodeproj'); ...
[ "function", "getOldProjectName", "(", "projectDir", ")", "{", "var", "files", "=", "[", "]", ";", "try", "{", "files", "=", "fs", ".", "readdirSync", "(", "projectDir", ")", ";", "}", "catch", "(", "err", ")", "{", "return", "''", ";", "}", "var", ...
region Private API Get old name of the project. Name is detected by the name of the .xcodeproj file. @param {String} projectDir absolute path to ios project directory @return {String} old project name
[ "region", "Private", "API", "Get", "old", "name", "of", "the", "project", ".", "Name", "is", "detected", "by", "the", "name", "of", "the", ".", "xcodeproj", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/iosBeforePrepareHook.js#L56-L72
17,464
nordnet/cordova-universal-links-plugin
hooks/lib/android/manifestWriter.js
writePreferences
function writePreferences(cordovaContext, pluginPreferences) { var pathToManifest = path.join(cordovaContext.opts.projectRoot, 'platforms', 'android', 'AndroidManifest.xml'); var manifestSource = xmlHelper.readXmlAsJson(pathToManifest); var cleanManifest; var updatedManifest; // remove old intent-filters c...
javascript
function writePreferences(cordovaContext, pluginPreferences) { var pathToManifest = path.join(cordovaContext.opts.projectRoot, 'platforms', 'android', 'AndroidManifest.xml'); var manifestSource = xmlHelper.readXmlAsJson(pathToManifest); var cleanManifest; var updatedManifest; // remove old intent-filters c...
[ "function", "writePreferences", "(", "cordovaContext", ",", "pluginPreferences", ")", "{", "var", "pathToManifest", "=", "path", ".", "join", "(", "cordovaContext", ".", "opts", ".", "projectRoot", ",", "'platforms'", ",", "'android'", ",", "'AndroidManifest.xml'", ...
region Public API Inject preferences into AndroidManifest.xml file. @param {Object} cordovaContext - cordova context object @param {Object} pluginPreferences - plugin preferences as JSON object; already parsed
[ "region", "Public", "API", "Inject", "preferences", "into", "AndroidManifest", ".", "xml", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/manifestWriter.js#L20-L34
17,465
nordnet/cordova-universal-links-plugin
hooks/lib/android/manifestWriter.js
removeOldOptions
function removeOldOptions(manifestData) { var cleanManifest = manifestData; var activities = manifestData['manifest']['application'][0]['activity']; activities.forEach(removeIntentFiltersFromActivity); cleanManifest['manifest']['application'][0]['activity'] = activities; return cleanManifest; }
javascript
function removeOldOptions(manifestData) { var cleanManifest = manifestData; var activities = manifestData['manifest']['application'][0]['activity']; activities.forEach(removeIntentFiltersFromActivity); cleanManifest['manifest']['application'][0]['activity'] = activities; return cleanManifest; }
[ "function", "removeOldOptions", "(", "manifestData", ")", "{", "var", "cleanManifest", "=", "manifestData", ";", "var", "activities", "=", "manifestData", "[", "'manifest'", "]", "[", "'application'", "]", "[", "0", "]", "[", "'activity'", "]", ";", "activitie...
region Manifest cleanup methods Remove old intent-filters from the manifest file. @param {Object} manifestData - manifest content as JSON object @return {Object} manifest data without old intent-filters
[ "region", "Manifest", "cleanup", "methods", "Remove", "old", "intent", "-", "filters", "from", "the", "manifest", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/manifestWriter.js#L46-L54
17,466
nordnet/cordova-universal-links-plugin
hooks/lib/android/manifestWriter.js
removeIntentFiltersFromActivity
function removeIntentFiltersFromActivity(activity) { var oldIntentFilters = activity['intent-filter']; var newIntentFilters = []; if (oldIntentFilters == null || oldIntentFilters.length == 0) { return; } oldIntentFilters.forEach(function(intentFilter) { if (!isIntentFilterForUniversalLinks(intentFil...
javascript
function removeIntentFiltersFromActivity(activity) { var oldIntentFilters = activity['intent-filter']; var newIntentFilters = []; if (oldIntentFilters == null || oldIntentFilters.length == 0) { return; } oldIntentFilters.forEach(function(intentFilter) { if (!isIntentFilterForUniversalLinks(intentFil...
[ "function", "removeIntentFiltersFromActivity", "(", "activity", ")", "{", "var", "oldIntentFilters", "=", "activity", "[", "'intent-filter'", "]", ";", "var", "newIntentFilters", "=", "[", "]", ";", "if", "(", "oldIntentFilters", "==", "null", "||", "oldIntentFilt...
Remove old intent filters from the given activity. @param {Object} activity - activity, from which we need to remove intent-filters. Changes applied to the passed object.
[ "Remove", "old", "intent", "filters", "from", "the", "given", "activity", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/manifestWriter.js#L62-L77
17,467
nordnet/cordova-universal-links-plugin
hooks/lib/android/manifestWriter.js
isIntentFilterForUniversalLinks
function isIntentFilterForUniversalLinks(intentFilter) { var actions = intentFilter['action']; var categories = intentFilter['category']; var data = intentFilter['data']; return isActionForUniversalLinks(actions) && isCategoriesForUniversalLinks(categories) && isDataTagForUniversalLinks(data); }
javascript
function isIntentFilterForUniversalLinks(intentFilter) { var actions = intentFilter['action']; var categories = intentFilter['category']; var data = intentFilter['data']; return isActionForUniversalLinks(actions) && isCategoriesForUniversalLinks(categories) && isDataTagForUniversalLinks(data); }
[ "function", "isIntentFilterForUniversalLinks", "(", "intentFilter", ")", "{", "var", "actions", "=", "intentFilter", "[", "'action'", "]", ";", "var", "categories", "=", "intentFilter", "[", "'category'", "]", ";", "var", "data", "=", "intentFilter", "[", "'data...
Check if given intent-filter is for Universal Links. @param {Object} intentFilter - intent-filter to check @return {Boolean} true - if intent-filter for Universal Links; otherwise - false;
[ "Check", "if", "given", "intent", "-", "filter", "is", "for", "Universal", "Links", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/manifestWriter.js#L85-L93
17,468
nordnet/cordova-universal-links-plugin
hooks/lib/android/manifestWriter.js
isActionForUniversalLinks
function isActionForUniversalLinks(actions) { // there can be only 1 action if (actions == null || actions.length != 1) { return false; } var action = actions[0]['$']['android:name']; return ('android.intent.action.VIEW' === action); }
javascript
function isActionForUniversalLinks(actions) { // there can be only 1 action if (actions == null || actions.length != 1) { return false; } var action = actions[0]['$']['android:name']; return ('android.intent.action.VIEW' === action); }
[ "function", "isActionForUniversalLinks", "(", "actions", ")", "{", "// there can be only 1 action", "if", "(", "actions", "==", "null", "||", "actions", ".", "length", "!=", "1", ")", "{", "return", "false", ";", "}", "var", "action", "=", "actions", "[", "0...
Check if actions from the intent-filter corresponds to actions for Universal Links. @param {Array} actions - list of actions in the intent-filter @return {Boolean} true - if action for Universal Links; otherwise - false
[ "Check", "if", "actions", "from", "the", "intent", "-", "filter", "corresponds", "to", "actions", "for", "Universal", "Links", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/manifestWriter.js#L101-L110
17,469
nordnet/cordova-universal-links-plugin
hooks/lib/android/manifestWriter.js
isCategoriesForUniversalLinks
function isCategoriesForUniversalLinks(categories) { // there can be only 2 categories if (categories == null || categories.length != 2) { return false; } var isBrowsable = false; var isDefault = false; // check intent categories categories.forEach(function(category) { var categoryName = categor...
javascript
function isCategoriesForUniversalLinks(categories) { // there can be only 2 categories if (categories == null || categories.length != 2) { return false; } var isBrowsable = false; var isDefault = false; // check intent categories categories.forEach(function(category) { var categoryName = categor...
[ "function", "isCategoriesForUniversalLinks", "(", "categories", ")", "{", "// there can be only 2 categories", "if", "(", "categories", "==", "null", "||", "categories", ".", "length", "!=", "2", ")", "{", "return", "false", ";", "}", "var", "isBrowsable", "=", ...
Check if categories in the intent-filter corresponds to categories for Universal Links. @param {Array} categories - list of categories in the intent-filter @return {Boolean} true - if action for Universal Links; otherwise - false
[ "Check", "if", "categories", "in", "the", "intent", "-", "filter", "corresponds", "to", "categories", "for", "Universal", "Links", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/manifestWriter.js#L118-L140
17,470
nordnet/cordova-universal-links-plugin
hooks/lib/android/manifestWriter.js
isDataTagForUniversalLinks
function isDataTagForUniversalLinks(data) { // can have only 1 data tag in the intent-filter if (data == null || data.length != 1) { return false; } var dataHost = data[0]['$']['android:host']; var dataScheme = data[0]['$']['android:scheme']; var hostIsSet = dataHost != null && dataHost.length > 0; v...
javascript
function isDataTagForUniversalLinks(data) { // can have only 1 data tag in the intent-filter if (data == null || data.length != 1) { return false; } var dataHost = data[0]['$']['android:host']; var dataScheme = data[0]['$']['android:scheme']; var hostIsSet = dataHost != null && dataHost.length > 0; v...
[ "function", "isDataTagForUniversalLinks", "(", "data", ")", "{", "// can have only 1 data tag in the intent-filter", "if", "(", "data", "==", "null", "||", "data", ".", "length", "!=", "1", ")", "{", "return", "false", ";", "}", "var", "dataHost", "=", "data", ...
Check if data tag from intent-filter corresponds to data for Universal Links. @param {Array} data - list of data tags in the intent-filter @return {Boolean} true - if data tag for Universal Links; otherwise - false
[ "Check", "if", "data", "tag", "from", "intent", "-", "filter", "corresponds", "to", "data", "for", "Universal", "Links", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/manifestWriter.js#L148-L160
17,471
nordnet/cordova-universal-links-plugin
hooks/lib/android/manifestWriter.js
injectOptions
function injectOptions(manifestData, pluginPreferences) { var changedManifest = manifestData; var activitiesList = changedManifest['manifest']['application'][0]['activity']; var launchActivityIndex = getMainLaunchActivityIndex(activitiesList); var ulIntentFilters = []; var launchActivity; if (launchActivit...
javascript
function injectOptions(manifestData, pluginPreferences) { var changedManifest = manifestData; var activitiesList = changedManifest['manifest']['application'][0]['activity']; var launchActivityIndex = getMainLaunchActivityIndex(activitiesList); var ulIntentFilters = []; var launchActivity; if (launchActivit...
[ "function", "injectOptions", "(", "manifestData", ",", "pluginPreferences", ")", "{", "var", "changedManifest", "=", "manifestData", ";", "var", "activitiesList", "=", "changedManifest", "[", "'manifest'", "]", "[", "'application'", "]", "[", "0", "]", "[", "'ac...
region Methods to inject preferences into AndroidManifest.xml file Inject options into manifest file. @param {Object} manifestData - manifest content where preferences should be injected @param {Object} pluginPreferences - plugin preferences from config.xml; already parsed @return {Object} updated manifest data with ...
[ "region", "Methods", "to", "inject", "preferences", "into", "AndroidManifest", ".", "xml", "file", "Inject", "options", "into", "manifest", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/manifestWriter.js#L173-L199
17,472
nordnet/cordova-universal-links-plugin
hooks/lib/android/manifestWriter.js
getMainLaunchActivityIndex
function getMainLaunchActivityIndex(activities) { var launchActivityIndex = -1; activities.some(function(activity, index) { if (isLaunchActivity(activity)) { launchActivityIndex = index; return true; } return false; }); return launchActivityIndex; }
javascript
function getMainLaunchActivityIndex(activities) { var launchActivityIndex = -1; activities.some(function(activity, index) { if (isLaunchActivity(activity)) { launchActivityIndex = index; return true; } return false; }); return launchActivityIndex; }
[ "function", "getMainLaunchActivityIndex", "(", "activities", ")", "{", "var", "launchActivityIndex", "=", "-", "1", ";", "activities", ".", "some", "(", "function", "(", "activity", ",", "index", ")", "{", "if", "(", "isLaunchActivity", "(", "activity", ")", ...
Find index of the applications launcher activity. @param {Array} activities - list of all activities in the app @return {Integer} index of the launch activity; -1 - if none was found
[ "Find", "index", "of", "the", "applications", "launcher", "activity", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/manifestWriter.js#L207-L219
17,473
nordnet/cordova-universal-links-plugin
hooks/lib/android/manifestWriter.js
createIntentFilter
function createIntentFilter(host, scheme, pathName) { var intentFilter = { '$': { 'android:autoVerify': 'true' }, 'action': [{ '$': { 'android:name': 'android.intent.action.VIEW' } }], 'category': [{ '$': { 'android:name': 'android.intent.category.DEFAULT' ...
javascript
function createIntentFilter(host, scheme, pathName) { var intentFilter = { '$': { 'android:autoVerify': 'true' }, 'action': [{ '$': { 'android:name': 'android.intent.action.VIEW' } }], 'category': [{ '$': { 'android:name': 'android.intent.category.DEFAULT' ...
[ "function", "createIntentFilter", "(", "host", ",", "scheme", ",", "pathName", ")", "{", "var", "intentFilter", "=", "{", "'$'", ":", "{", "'android:autoVerify'", ":", "'true'", "}", ",", "'action'", ":", "[", "{", "'$'", ":", "{", "'android:name'", ":", ...
Create JSON object that represent intent-filter for universal link. @param {String} host - host name @param {String} scheme - host scheme @param {String} pathName - host path @return {Object} intent-filter as a JSON object
[ "Create", "JSON", "object", "that", "represent", "intent", "-", "filter", "for", "universal", "link", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/manifestWriter.js#L260-L290
17,474
nordnet/cordova-universal-links-plugin
hooks/lib/android/manifestWriter.js
injectPathComponentIntoIntentFilter
function injectPathComponentIntoIntentFilter(intentFilter, pathName) { if (pathName == null || pathName === '*') { return; } var attrKey = 'android:path'; if (pathName.indexOf('*') >= 0) { attrKey = 'android:pathPattern'; pathName = pathName.replace(/\*/g, '.*'); } if (pathName.indexOf('/') !=...
javascript
function injectPathComponentIntoIntentFilter(intentFilter, pathName) { if (pathName == null || pathName === '*') { return; } var attrKey = 'android:path'; if (pathName.indexOf('*') >= 0) { attrKey = 'android:pathPattern'; pathName = pathName.replace(/\*/g, '.*'); } if (pathName.indexOf('/') !=...
[ "function", "injectPathComponentIntoIntentFilter", "(", "intentFilter", ",", "pathName", ")", "{", "if", "(", "pathName", "==", "null", "||", "pathName", "===", "'*'", ")", "{", "return", ";", "}", "var", "attrKey", "=", "'android:path'", ";", "if", "(", "pa...
Inject host path into provided intent-filter. @param {Object} intentFilter - intent-filter object where path component should be injected @param {String} pathName - host path to inject
[ "Inject", "host", "path", "into", "provided", "intent", "-", "filter", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/android/manifestWriter.js#L298-L314
17,475
nordnet/cordova-universal-links-plugin
hooks/lib/configXmlParser.js
readPreferences
function readPreferences(cordovaContext) { // read data from projects root config.xml file var configXml = new ConfigXmlHelper(cordovaContext).read(); if (configXml == null) { console.warn('config.xml not found! Please, check that it exist\'s in your project\'s root directory.'); return null; } // lo...
javascript
function readPreferences(cordovaContext) { // read data from projects root config.xml file var configXml = new ConfigXmlHelper(cordovaContext).read(); if (configXml == null) { console.warn('config.xml not found! Please, check that it exist\'s in your project\'s root directory.'); return null; } // lo...
[ "function", "readPreferences", "(", "cordovaContext", ")", "{", "// read data from projects root config.xml file", "var", "configXml", "=", "new", "ConfigXmlHelper", "(", "cordovaContext", ")", ".", "read", "(", ")", ";", "if", "(", "configXml", "==", "null", ")", ...
region Public API Read plugin preferences from the config.xml file. @param {Object} cordovaContext - cordova context object @return {Array} list of host objects
[ "region", "Public", "API", "Read", "plugin", "preferences", "from", "the", "config", ".", "xml", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/configXmlParser.js#L20-L47
17,476
nordnet/cordova-universal-links-plugin
hooks/lib/configXmlParser.js
constructHostsList
function constructHostsList(xmlPreferences) { var hostsList = []; // look for defined hosts var xmlHostList = xmlPreferences['host']; if (xmlHostList == null || xmlHostList.length == 0) { return []; } xmlHostList.forEach(function(xmlElement) { var host = constructHostEntry(xmlElement); if (hos...
javascript
function constructHostsList(xmlPreferences) { var hostsList = []; // look for defined hosts var xmlHostList = xmlPreferences['host']; if (xmlHostList == null || xmlHostList.length == 0) { return []; } xmlHostList.forEach(function(xmlElement) { var host = constructHostEntry(xmlElement); if (hos...
[ "function", "constructHostsList", "(", "xmlPreferences", ")", "{", "var", "hostsList", "=", "[", "]", ";", "// look for defined hosts", "var", "xmlHostList", "=", "xmlPreferences", "[", "'host'", "]", ";", "if", "(", "xmlHostList", "==", "null", "||", "xmlHostLi...
Construct list of host objects, defined in xml file. @param {Object} xmlPreferences - plugin preferences from config.xml as JSON object @return {Array} array of JSON objects, where each entry defines host data from config.xml.
[ "Construct", "list", "of", "host", "objects", "defined", "in", "xml", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/configXmlParser.js#L67-L84
17,477
nordnet/cordova-universal-links-plugin
hooks/lib/configXmlParser.js
constructHostEntry
function constructHostEntry(xmlElement) { var host = { scheme: DEFAULT_SCHEME, name: '', paths: [] }; var hostProperties = xmlElement['$']; if (hostProperties == null || hostProperties.length == 0) { return null; } // read host name host.name = hostProperties.name; // read sch...
javascript
function constructHostEntry(xmlElement) { var host = { scheme: DEFAULT_SCHEME, name: '', paths: [] }; var hostProperties = xmlElement['$']; if (hostProperties == null || hostProperties.length == 0) { return null; } // read host name host.name = hostProperties.name; // read sch...
[ "function", "constructHostEntry", "(", "xmlElement", ")", "{", "var", "host", "=", "{", "scheme", ":", "DEFAULT_SCHEME", ",", "name", ":", "''", ",", "paths", ":", "[", "]", "}", ";", "var", "hostProperties", "=", "xmlElement", "[", "'$'", "]", ";", "i...
Construct host object from xml data. @param {Object} xmlElement - xml data to process. @return {Object} host entry as JSON object
[ "Construct", "host", "object", "from", "xml", "data", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/configXmlParser.js#L92-L116
17,478
nordnet/cordova-universal-links-plugin
hooks/lib/configXmlParser.js
constructPaths
function constructPaths(xmlElement) { if (xmlElement['path'] == null) { return ['*']; } var paths = []; xmlElement.path.some(function(pathElement) { var url = pathElement['$']['url']; // Ignore explicit paths if '*' is defined if (url === '*') { paths = ['*']; return true; } ...
javascript
function constructPaths(xmlElement) { if (xmlElement['path'] == null) { return ['*']; } var paths = []; xmlElement.path.some(function(pathElement) { var url = pathElement['$']['url']; // Ignore explicit paths if '*' is defined if (url === '*') { paths = ['*']; return true; } ...
[ "function", "constructPaths", "(", "xmlElement", ")", "{", "if", "(", "xmlElement", "[", "'path'", "]", "==", "null", ")", "{", "return", "[", "'*'", "]", ";", "}", "var", "paths", "=", "[", "]", ";", "xmlElement", ".", "path", ".", "some", "(", "f...
Construct list of path objects from the xml data. @param {Object} xmlElement - xml data to process @return {Array} list of path entries, each on is a JSON object
[ "Construct", "list", "of", "path", "objects", "from", "the", "xml", "data", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/configXmlParser.js#L124-L143
17,479
nordnet/cordova-universal-links-plugin
hooks/lib/ios/appleAppSiteAssociationFile.js
createNewAssociationFiles
function createNewAssociationFiles(pluginPreferences) { var teamId = pluginPreferences.iosTeamId; if (!teamId) { teamId = IOS_TEAM_ID; } pluginPreferences.hosts.forEach(function(host) { var content = generateFileContentForHost(host, teamId); saveContentToFile(host.name, content); }); }
javascript
function createNewAssociationFiles(pluginPreferences) { var teamId = pluginPreferences.iosTeamId; if (!teamId) { teamId = IOS_TEAM_ID; } pluginPreferences.hosts.forEach(function(host) { var content = generateFileContentForHost(host, teamId); saveContentToFile(host.name, content); }); }
[ "function", "createNewAssociationFiles", "(", "pluginPreferences", ")", "{", "var", "teamId", "=", "pluginPreferences", ".", "iosTeamId", ";", "if", "(", "!", "teamId", ")", "{", "teamId", "=", "IOS_TEAM_ID", ";", "}", "pluginPreferences", ".", "hosts", ".", "...
Generate new set of apple-app-site-association files. @param {Object} pluginPreferences - list of hosts from config.xml
[ "Generate", "new", "set", "of", "apple", "-", "app", "-", "site", "-", "association", "files", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/appleAppSiteAssociationFile.js#L64-L74
17,480
nordnet/cordova-universal-links-plugin
hooks/lib/ios/appleAppSiteAssociationFile.js
generateFileContentForHost
function generateFileContentForHost(host, teamId) { var appID = teamId + '.' + getBundleId(); var paths = host.paths.slice(); // if paths are '*' - we should add '/' to it to support root domains. // https://github.com/nordnet/cordova-universal-links-plugin/issues/46 if (paths.length == 1 && paths[0] === '*'...
javascript
function generateFileContentForHost(host, teamId) { var appID = teamId + '.' + getBundleId(); var paths = host.paths.slice(); // if paths are '*' - we should add '/' to it to support root domains. // https://github.com/nordnet/cordova-universal-links-plugin/issues/46 if (paths.length == 1 && paths[0] === '*'...
[ "function", "generateFileContentForHost", "(", "host", ",", "teamId", ")", "{", "var", "appID", "=", "teamId", "+", "'.'", "+", "getBundleId", "(", ")", ";", "var", "paths", "=", "host", ".", "paths", ".", "slice", "(", ")", ";", "// if paths are '*' - we ...
Generate content of the apple-app-site-association file for the specific host. @param {Object} host - host information @return {Object} content of the file as JSON object
[ "Generate", "content", "of", "the", "apple", "-", "app", "-", "site", "-", "association", "file", "for", "the", "specific", "host", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/appleAppSiteAssociationFile.js#L82-L101
17,481
nordnet/cordova-universal-links-plugin
hooks/lib/ios/appleAppSiteAssociationFile.js
saveContentToFile
function saveContentToFile(filePrefix, content) { var dirPath = getWebHookDirectory(); var filePath = path.join(dirPath, filePrefix + '#' + ASSOCIATION_FILE_NAME); // create all directories from file path createDirectoriesIfNeeded(dirPath); // write content to the file try { fs.writeFileSync(filePath,...
javascript
function saveContentToFile(filePrefix, content) { var dirPath = getWebHookDirectory(); var filePath = path.join(dirPath, filePrefix + '#' + ASSOCIATION_FILE_NAME); // create all directories from file path createDirectoriesIfNeeded(dirPath); // write content to the file try { fs.writeFileSync(filePath,...
[ "function", "saveContentToFile", "(", "filePrefix", ",", "content", ")", "{", "var", "dirPath", "=", "getWebHookDirectory", "(", ")", ";", "var", "filePath", "=", "path", ".", "join", "(", "dirPath", ",", "filePrefix", "+", "'#'", "+", "ASSOCIATION_FILE_NAME",...
Save data to the the apple-app-site-association file. @param {String} filePrefix - prefix for the generated file; usually - hostname @param {Object} content - file content as JSON object
[ "Save", "data", "to", "the", "the", "apple", "-", "app", "-", "site", "-", "association", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/appleAppSiteAssociationFile.js#L109-L122
17,482
nordnet/cordova-universal-links-plugin
hooks/lib/ios/appleAppSiteAssociationFile.js
getBundleId
function getBundleId() { if (bundleId === undefined) { var configXmlHelper = new ConfigXmlHelper(context); bundleId = configXmlHelper.getPackageName('ios'); } return bundleId; }
javascript
function getBundleId() { if (bundleId === undefined) { var configXmlHelper = new ConfigXmlHelper(context); bundleId = configXmlHelper.getPackageName('ios'); } return bundleId; }
[ "function", "getBundleId", "(", ")", "{", "if", "(", "bundleId", "===", "undefined", ")", "{", "var", "configXmlHelper", "=", "new", "ConfigXmlHelper", "(", "context", ")", ";", "bundleId", "=", "configXmlHelper", ".", "getPackageName", "(", "'ios'", ")", ";...
Get bundle id from the config.xml file. @return {String} bundle id
[ "Get", "bundle", "id", "from", "the", "config", ".", "xml", "file", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/appleAppSiteAssociationFile.js#L164-L171
17,483
nordnet/cordova-universal-links-plugin
hooks/lib/configXmlHelper.js
getCordovaConfigParser
function getCordovaConfigParser(configFilePath) { var ConfigParser; // If we are running Cordova 5.4 or abova - use parser from cordova-common. // Otherwise - from cordova-lib. try { ConfigParser = context.requireCordovaModule('cordova-common/src/ConfigParser/ConfigParser'); } catch (e) { ConfigParse...
javascript
function getCordovaConfigParser(configFilePath) { var ConfigParser; // If we are running Cordova 5.4 or abova - use parser from cordova-common. // Otherwise - from cordova-lib. try { ConfigParser = context.requireCordovaModule('cordova-common/src/ConfigParser/ConfigParser'); } catch (e) { ConfigParse...
[ "function", "getCordovaConfigParser", "(", "configFilePath", ")", "{", "var", "ConfigParser", ";", "// If we are running Cordova 5.4 or abova - use parser from cordova-common.", "// Otherwise - from cordova-lib.", "try", "{", "ConfigParser", "=", "context", ".", "requireCordovaModu...
region Private API Get config parser from cordova library. @param {String} configFilePath absolute path to the config.xml file @return {Object}
[ "region", "Private", "API", "Get", "config", "parser", "from", "cordova", "library", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/configXmlHelper.js#L86-L98
17,484
nordnet/cordova-universal-links-plugin
hooks/afterPrepareHook.js
run
function run(cordovaContext) { var pluginPreferences = configParser.readPreferences(cordovaContext); var platformsList = cordovaContext.opts.platforms; // if no preferences are found - exit if (pluginPreferences == null) { return; } // if no host is defined - exit if (pluginPreferences.hosts == null...
javascript
function run(cordovaContext) { var pluginPreferences = configParser.readPreferences(cordovaContext); var platformsList = cordovaContext.opts.platforms; // if no preferences are found - exit if (pluginPreferences == null) { return; } // if no host is defined - exit if (pluginPreferences.hosts == null...
[ "function", "run", "(", "cordovaContext", ")", "{", "var", "pluginPreferences", "=", "configParser", ".", "readPreferences", "(", "cordovaContext", ")", ";", "var", "platformsList", "=", "cordovaContext", ".", "opts", ".", "platforms", ";", "// if no preferences are...
Execute hook. @param {Object} cordovaContext - cordova context object
[ "Execute", "hook", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/afterPrepareHook.js#L26-L55
17,485
nordnet/cordova-universal-links-plugin
hooks/afterPrepareHook.js
activateUniversalLinksInAndroid
function activateUniversalLinksInAndroid(cordovaContext, pluginPreferences) { // inject preferenes into AndroidManifest.xml androidManifestWriter.writePreferences(cordovaContext, pluginPreferences); // generate html file with the <link> tags that you should inject on the website. androidWebHook.generate(cordov...
javascript
function activateUniversalLinksInAndroid(cordovaContext, pluginPreferences) { // inject preferenes into AndroidManifest.xml androidManifestWriter.writePreferences(cordovaContext, pluginPreferences); // generate html file with the <link> tags that you should inject on the website. androidWebHook.generate(cordov...
[ "function", "activateUniversalLinksInAndroid", "(", "cordovaContext", ",", "pluginPreferences", ")", "{", "// inject preferenes into AndroidManifest.xml", "androidManifestWriter", ".", "writePreferences", "(", "cordovaContext", ",", "pluginPreferences", ")", ";", "// generate htm...
Activate Deep Links for Android application. @param {Object} cordovaContext - cordova context object @param {Object} pluginPreferences - plugin preferences from the config.xml file. Basically, content from <universal-links> tag.
[ "Activate", "Deep", "Links", "for", "Android", "application", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/afterPrepareHook.js#L63-L69
17,486
nordnet/cordova-universal-links-plugin
hooks/afterPrepareHook.js
activateUniversalLinksInIos
function activateUniversalLinksInIos(cordovaContext, pluginPreferences) { // modify xcode project preferences iosProjectPreferences.enableAssociativeDomainsCapability(cordovaContext); // generate entitlements file iosProjectEntitlements.generateAssociatedDomainsEntitlements(cordovaContext, pluginPreferences); ...
javascript
function activateUniversalLinksInIos(cordovaContext, pluginPreferences) { // modify xcode project preferences iosProjectPreferences.enableAssociativeDomainsCapability(cordovaContext); // generate entitlements file iosProjectEntitlements.generateAssociatedDomainsEntitlements(cordovaContext, pluginPreferences); ...
[ "function", "activateUniversalLinksInIos", "(", "cordovaContext", ",", "pluginPreferences", ")", "{", "// modify xcode project preferences", "iosProjectPreferences", ".", "enableAssociativeDomainsCapability", "(", "cordovaContext", ")", ";", "// generate entitlements file", "iosPro...
Activate Universal Links for iOS application. @param {Object} cordovaContext - cordova context object @param {Object} pluginPreferences - plugin preferences from the config.xml file. Basically, content from <universal-links> tag.
[ "Activate", "Universal", "Links", "for", "iOS", "application", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/afterPrepareHook.js#L77-L86
17,487
nordnet/cordova-universal-links-plugin
hooks/lib/ios/xcodePreferences.js
enableAssociativeDomainsCapability
function enableAssociativeDomainsCapability(cordovaContext) { context = cordovaContext; var projectFile = loadProjectFile(); // adjust preferences activateAssociativeDomains(projectFile.xcode); // add entitlements file to pbxfilereference addPbxReference(projectFile.xcode); // save changes projectFi...
javascript
function enableAssociativeDomainsCapability(cordovaContext) { context = cordovaContext; var projectFile = loadProjectFile(); // adjust preferences activateAssociativeDomains(projectFile.xcode); // add entitlements file to pbxfilereference addPbxReference(projectFile.xcode); // save changes projectFi...
[ "function", "enableAssociativeDomainsCapability", "(", "cordovaContext", ")", "{", "context", "=", "cordovaContext", ";", "var", "projectFile", "=", "loadProjectFile", "(", ")", ";", "// adjust preferences", "activateAssociativeDomains", "(", "projectFile", ".", "xcode", ...
region Public API Activate associated domains capability for the application. @param {Object} cordovaContext - cordova context object
[ "region", "Public", "API", "Activate", "associated", "domains", "capability", "for", "the", "application", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/xcodePreferences.js#L27-L40
17,488
nordnet/cordova-universal-links-plugin
hooks/lib/ios/xcodePreferences.js
addPbxReference
function addPbxReference(xcodeProject) { var fileReferenceSection = nonComments(xcodeProject.pbxFileReferenceSection()); var entitlementsFileName = path.basename(pathToEntitlementsFile()); if (isPbxReferenceAlreadySet(fileReferenceSection, entitlementsFileName)) { console.log('Entitlements file is in referen...
javascript
function addPbxReference(xcodeProject) { var fileReferenceSection = nonComments(xcodeProject.pbxFileReferenceSection()); var entitlementsFileName = path.basename(pathToEntitlementsFile()); if (isPbxReferenceAlreadySet(fileReferenceSection, entitlementsFileName)) { console.log('Entitlements file is in referen...
[ "function", "addPbxReference", "(", "xcodeProject", ")", "{", "var", "fileReferenceSection", "=", "nonComments", "(", "xcodeProject", ".", "pbxFileReferenceSection", "(", ")", ")", ";", "var", "entitlementsFileName", "=", "path", ".", "basename", "(", "pathToEntitle...
region PBXReference methods Add .entitlemets file into the project. @param {Object} xcodeProject - xcode project preferences; all changes are made in that instance
[ "region", "PBXReference", "methods", "Add", ".", "entitlemets", "file", "into", "the", "project", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/xcodePreferences.js#L92-L103
17,489
nordnet/cordova-universal-links-plugin
hooks/lib/ios/xcodePreferences.js
loadProjectFile
function loadProjectFile() { var platform_ios; var projectFile; try { // try pre-5.0 cordova structure platform_ios = context.requireCordovaModule('cordova-lib/src/plugman/platforms')['ios']; projectFile = platform_ios.parseProjectFile(iosPlatformPath()); } catch (e) { // let's try cordova 5.0 ...
javascript
function loadProjectFile() { var platform_ios; var projectFile; try { // try pre-5.0 cordova structure platform_ios = context.requireCordovaModule('cordova-lib/src/plugman/platforms')['ios']; projectFile = platform_ios.parseProjectFile(iosPlatformPath()); } catch (e) { // let's try cordova 5.0 ...
[ "function", "loadProjectFile", "(", ")", "{", "var", "platform_ios", ";", "var", "projectFile", ";", "try", "{", "// try pre-5.0 cordova structure", "platform_ios", "=", "context", ".", "requireCordovaModule", "(", "'cordova-lib/src/plugman/platforms'", ")", "[", "'ios'...
region Xcode project file helpers Load iOS project file from platform specific folder. @return {Object} projectFile - project file information
[ "region", "Xcode", "project", "file", "helpers", "Load", "iOS", "project", "file", "from", "platform", "specific", "folder", "." ]
9f2e812a0bf686279f94f68983707bc36efd7b11
https://github.com/nordnet/cordova-universal-links-plugin/blob/9f2e812a0bf686279f94f68983707bc36efd7b11/hooks/lib/ios/xcodePreferences.js#L135-L150
17,490
SassDoc/sassdoc
src/sassdoc.js
refresh
function refresh (env) { return safeWipe(env.dest, { force: true, parent: is.string(env.src) || is.array(env.src) ? g2b(env.src) : null, silent: true, }) .then(() => mkdir(env.dest)) .then(() => { env.logger.log(`Folder \`${env.displayDest}\` successfully refreshed.`) ...
javascript
function refresh (env) { return safeWipe(env.dest, { force: true, parent: is.string(env.src) || is.array(env.src) ? g2b(env.src) : null, silent: true, }) .then(() => mkdir(env.dest)) .then(() => { env.logger.log(`Folder \`${env.displayDest}\` successfully refreshed.`) ...
[ "function", "refresh", "(", "env", ")", "{", "return", "safeWipe", "(", "env", ".", "dest", ",", "{", "force", ":", "true", ",", "parent", ":", "is", ".", "string", "(", "env", ".", "src", ")", "||", "is", ".", "array", "(", "env", ".", "src", ...
Safely wipe and re-create the destination directory. @return {Promise}
[ "Safely", "wipe", "and", "re", "-", "create", "the", "destination", "directory", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L90-L104
17,491
SassDoc/sassdoc
src/sassdoc.js
theme
function theme (env) { let promise = env.theme(env.dest, env) if (!is.promise(promise)) { let type = Object.prototype.toString.call(promise) throw new errors.Error(`Theme didn't return a promise, got ${type}.`) } return promise .then(() => { let displayTheme = env.displayThem...
javascript
function theme (env) { let promise = env.theme(env.dest, env) if (!is.promise(promise)) { let type = Object.prototype.toString.call(promise) throw new errors.Error(`Theme didn't return a promise, got ${type}.`) } return promise .then(() => { let displayTheme = env.displayThem...
[ "function", "theme", "(", "env", ")", "{", "let", "promise", "=", "env", ".", "theme", "(", "env", ".", "dest", ",", "env", ")", "if", "(", "!", "is", ".", "promise", "(", "promise", ")", ")", "{", "let", "type", "=", "Object", ".", "prototype", ...
Render theme with parsed data context. @return {Promise}
[ "Render", "theme", "with", "parsed", "data", "context", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L110-L123
17,492
SassDoc/sassdoc
src/sassdoc.js
documentize
async function documentize (env) { init(env) let data = await baseDocumentize(env) try { await refresh(env) await theme(env) okay(env) } catch (err) { env.emit('error', err) throw err } return data }
javascript
async function documentize (env) { init(env) let data = await baseDocumentize(env) try { await refresh(env) await theme(env) okay(env) } catch (err) { env.emit('error', err) throw err } return data }
[ "async", "function", "documentize", "(", "env", ")", "{", "init", "(", "env", ")", "let", "data", "=", "await", "baseDocumentize", "(", "env", ")", "try", "{", "await", "refresh", "(", "env", ")", "await", "theme", "(", "env", ")", "okay", "(", "env"...
Execute full SassDoc sequence from a source directory. @return {Promise}
[ "Execute", "full", "SassDoc", "sequence", "from", "a", "source", "directory", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L129-L143
17,493
SassDoc/sassdoc
src/sassdoc.js
stream
function stream (env) { let filter = parseFilter(env) filter.promise .then(data => { env.logger.log('Sass sources successfully parsed.') env.data = data onEmpty(data, env) }) /** * Returned Promise await the full sequence, * instead of just the parsing step. ...
javascript
function stream (env) { let filter = parseFilter(env) filter.promise .then(data => { env.logger.log('Sass sources successfully parsed.') env.data = data onEmpty(data, env) }) /** * Returned Promise await the full sequence, * instead of just the parsing step. ...
[ "function", "stream", "(", "env", ")", "{", "let", "filter", "=", "parseFilter", "(", "env", ")", "filter", ".", "promise", ".", "then", "(", "data", "=>", "{", "env", ".", "logger", ".", "log", "(", "'Sass sources successfully parsed.'", ")", "env", "."...
Execute full SassDoc sequence from a Vinyl files stream. @return {Stream} @return {Promise} - as a property of Stream.
[ "Execute", "full", "SassDoc", "sequence", "from", "a", "Vinyl", "files", "stream", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L150-L188
17,494
SassDoc/sassdoc
src/sassdoc.js
stream
function stream (env) { let parseStream = parseFilter(env) let filter = through.obj((file, enc, cb) => cb(), function (cb) { parseStream.promise.then(data => { this.push(data) cb() }, cb) }) return pipe(parseStream, filter) }
javascript
function stream (env) { let parseStream = parseFilter(env) let filter = through.obj((file, enc, cb) => cb(), function (cb) { parseStream.promise.then(data => { this.push(data) cb() }, cb) }) return pipe(parseStream, filter) }
[ "function", "stream", "(", "env", ")", "{", "let", "parseStream", "=", "parseFilter", "(", "env", ")", "let", "filter", "=", "through", ".", "obj", "(", "(", "file", ",", "enc", ",", "cb", ")", "=>", "cb", "(", ")", ",", "function", "(", "cb", ")...
Don't pass files through, but pass final data at the end. @return {Stream}
[ "Don", "t", "pass", "files", "through", "but", "pass", "final", "data", "at", "the", "end", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L215-L226
17,495
SassDoc/sassdoc
src/sassdoc.js
baseDocumentize
async function baseDocumentize (env) { let filter = parseFilter(env) filter.promise .then(data => { env.logger.log(`Folder \`${env.src}\` successfully parsed.`) env.data = data onEmpty(data, env) env.logger.debug(() => { fs.writeFile( 'sassdoc-data.json', JS...
javascript
async function baseDocumentize (env) { let filter = parseFilter(env) filter.promise .then(data => { env.logger.log(`Folder \`${env.src}\` successfully parsed.`) env.data = data onEmpty(data, env) env.logger.debug(() => { fs.writeFile( 'sassdoc-data.json', JS...
[ "async", "function", "baseDocumentize", "(", "env", ")", "{", "let", "filter", "=", "parseFilter", "(", "env", ")", "filter", ".", "promise", ".", "then", "(", "data", "=>", "{", "env", ".", "logger", ".", "log", "(", "`", "\\`", "${", "env", ".", ...
Source directory fetching and parsing.
[ "Source", "directory", "fetching", "and", "parsing", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L232-L279
17,496
SassDoc/sassdoc
src/sassdoc.js
onEmpty
function onEmpty (data, env) { let message = `SassDoc could not find anything to document.\n * Are you still using \`/**\` comments ? They're no more supported since 2.0. See <http://sassdoc.com/upgrading/#c-style-comments>.\n` if (!data.length && env.verbose) { env.emit('warning', new errors.Warning(mes...
javascript
function onEmpty (data, env) { let message = `SassDoc could not find anything to document.\n * Are you still using \`/**\` comments ? They're no more supported since 2.0. See <http://sassdoc.com/upgrading/#c-style-comments>.\n` if (!data.length && env.verbose) { env.emit('warning', new errors.Warning(mes...
[ "function", "onEmpty", "(", "data", ",", "env", ")", "{", "let", "message", "=", "`", "\\n", "\\`", "\\`", "\\n", "`", "if", "(", "!", "data", ".", "length", "&&", "env", ".", "verbose", ")", "{", "env", ".", "emit", "(", "'warning'", ",", "new",...
Warn user on empty documentation. @param {Array} data @param {Object} env
[ "Warn", "user", "on", "empty", "documentation", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L341-L349
17,497
SassDoc/sassdoc
src/cli.js
ensure
function ensure (env, options, names) { for (let k of Object.keys(names)) { let v = names[k] if (options[v]) { env[k] = options[v] env[k + 'Cwd'] = true } } }
javascript
function ensure (env, options, names) { for (let k of Object.keys(names)) { let v = names[k] if (options[v]) { env[k] = options[v] env[k + 'Cwd'] = true } } }
[ "function", "ensure", "(", "env", ",", "options", ",", "names", ")", "{", "for", "(", "let", "k", "of", "Object", ".", "keys", "(", "names", ")", ")", "{", "let", "v", "=", "names", "[", "k", "]", "if", "(", "options", "[", "v", "]", ")", "{"...
Ensure that CLI options take precedence over configuration values. For each name/option tuple, if the option is set, override configuration value.
[ "Ensure", "that", "CLI", "options", "take", "precedence", "over", "configuration", "values", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/cli.js#L94-L103
17,498
ruddell/ignite-jhipster
boilerplate/app/navigation/layouts.js
handleOpenURL
function handleOpenURL (event) { console.tron.log(event.url) let splitUrl = event.url.split('/') // ['https:', '', 'domain', 'route', 'params'] let importantParameters = splitUrl.splice(3) // ['route', 'params'] if (importantParameters.length === 0) { console.tron.log('Sending to home page') return null...
javascript
function handleOpenURL (event) { console.tron.log(event.url) let splitUrl = event.url.split('/') // ['https:', '', 'domain', 'route', 'params'] let importantParameters = splitUrl.splice(3) // ['route', 'params'] if (importantParameters.length === 0) { console.tron.log('Sending to home page') return null...
[ "function", "handleOpenURL", "(", "event", ")", "{", "console", ".", "tron", ".", "log", "(", "event", ".", "url", ")", "let", "splitUrl", "=", "event", ".", "url", ".", "split", "(", "'/'", ")", "// ['https:', '', 'domain', 'route', 'params']", "let", "impo...
for deep linking
[ "for", "deep", "linking" ]
301c3aa9e4286715b0f5ad6f32f516672ea8d09d
https://github.com/ruddell/ignite-jhipster/blob/301c3aa9e4286715b0f5ad6f32f516672ea8d09d/boilerplate/app/navigation/layouts.js#L83-L102
17,499
ruddell/ignite-jhipster
src/boilerplate/index.js
mergePackageJsons
async function mergePackageJsons () { // transform our package.json incase we need to replace variables const rawJson = await template.generate({ directory: `${ignite.ignitePluginPath()}/boilerplate`, template: 'package.json.ejs', props: props }) const newPackageJson = JSON.parse(rawJs...
javascript
async function mergePackageJsons () { // transform our package.json incase we need to replace variables const rawJson = await template.generate({ directory: `${ignite.ignitePluginPath()}/boilerplate`, template: 'package.json.ejs', props: props }) const newPackageJson = JSON.parse(rawJs...
[ "async", "function", "mergePackageJsons", "(", ")", "{", "// transform our package.json incase we need to replace variables", "const", "rawJson", "=", "await", "template", ".", "generate", "(", "{", "directory", ":", "`", "${", "ignite", ".", "ignitePluginPath", "(", ...
Merge the package.json from our template into the one provided from react-native init.
[ "Merge", "the", "package", ".", "json", "from", "our", "template", "into", "the", "one", "provided", "from", "react", "-", "native", "init", "." ]
301c3aa9e4286715b0f5ad6f32f516672ea8d09d
https://github.com/ruddell/ignite-jhipster/blob/301c3aa9e4286715b0f5ad6f32f516672ea8d09d/src/boilerplate/index.js#L144-L175