repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
Templarian/ui.bootstrap.contextMenu
contextMenu.js
processItem
function processItem(params) { var nestedMenu = extractNestedMenu(params); // if html property is not defined, fallback to text, otherwise use default text // if first item in the item array is a function then invoke .call() // if first item is a string, then text should be the ...
javascript
function processItem(params) { var nestedMenu = extractNestedMenu(params); // if html property is not defined, fallback to text, otherwise use default text // if first item in the item array is a function then invoke .call() // if first item is a string, then text should be the ...
[ "function", "processItem", "(", "params", ")", "{", "var", "nestedMenu", "=", "extractNestedMenu", "(", "params", ")", ";", "// if html property is not defined, fallback to text, otherwise use default text", "// if first item in the item array is a function then invoke .call()", "// ...
Process each individual item Properties of params: - $scope - event - modelValue - level - item - $ul - $li - $promises
[ "Process", "each", "individual", "item" ]
08b66bc3854ffe874b50fedd1597587059edc687
https://github.com/Templarian/ui.bootstrap.contextMenu/blob/08b66bc3854ffe874b50fedd1597587059edc687/contextMenu.js#L134-L152
train
Templarian/ui.bootstrap.contextMenu
contextMenu.js
renderContextMenu
function renderContextMenu (params) { /// <summary>Render context menu recursively.</summary> // Destructuring: var $scope = params.$scope; var event = params.event; var options = params.options; var modelValue = params.modelValue; var level = param...
javascript
function renderContextMenu (params) { /// <summary>Render context menu recursively.</summary> // Destructuring: var $scope = params.$scope; var event = params.event; var options = params.options; var modelValue = params.modelValue; var level = param...
[ "function", "renderContextMenu", "(", "params", ")", "{", "/// <summary>Render context menu recursively.</summary>", "// Destructuring:", "var", "$scope", "=", "params", ".", "$scope", ";", "var", "event", "=", "params", ".", "event", ";", "var", "options", "=", "pa...
Responsible for the actual rendering of the context menu. The parameters in params are: - $scope = the scope of this context menu - event = the event that triggered this context menu - options = the options for this context menu - modelValue = the value of the model attached to this context menu - level = the current ...
[ "Responsible", "for", "the", "actual", "rendering", "of", "the", "context", "menu", "." ]
08b66bc3854ffe874b50fedd1597587059edc687
https://github.com/Templarian/ui.bootstrap.contextMenu/blob/08b66bc3854ffe874b50fedd1597587059edc687/contextMenu.js#L298-L370
train
Templarian/ui.bootstrap.contextMenu
contextMenu.js
removeContextMenus
function removeContextMenus (level) { while (_contextMenus.length && (!level || _contextMenus.length > level)) { var cm = _contextMenus.pop(); $rootScope.$broadcast(ContextMenuEvents.ContextMenuClosed, { context: _clickedElement, contextMenu: cm }); cm.remove(); }...
javascript
function removeContextMenus (level) { while (_contextMenus.length && (!level || _contextMenus.length > level)) { var cm = _contextMenus.pop(); $rootScope.$broadcast(ContextMenuEvents.ContextMenuClosed, { context: _clickedElement, contextMenu: cm }); cm.remove(); }...
[ "function", "removeContextMenus", "(", "level", ")", "{", "while", "(", "_contextMenus", ".", "length", "&&", "(", "!", "level", "||", "_contextMenus", ".", "length", ">", "level", ")", ")", "{", "var", "cm", "=", "_contextMenus", ".", "pop", "(", ")", ...
Removes the context menus with level greater than or equal to the value passed. If undefined, null or 0, all context menus are removed.
[ "Removes", "the", "context", "menus", "with", "level", "greater", "than", "or", "equal", "to", "the", "value", "passed", ".", "If", "undefined", "null", "or", "0", "all", "context", "menus", "are", "removed", "." ]
08b66bc3854ffe874b50fedd1597587059edc687
https://github.com/Templarian/ui.bootstrap.contextMenu/blob/08b66bc3854ffe874b50fedd1597587059edc687/contextMenu.js#L485-L494
train
Templarian/ui.bootstrap.contextMenu
contextMenu.js
resolveBoolOrFunc
function resolveBoolOrFunc(a, params, defaultValue) { var item = params.item; var $scope = params.$scope; var event = params.event; var modelValue = params.modelValue; defaultValue = isBoolean(defaultValue) ? defaultValue : true; if (isBoolean(a)) { ...
javascript
function resolveBoolOrFunc(a, params, defaultValue) { var item = params.item; var $scope = params.$scope; var event = params.event; var modelValue = params.modelValue; defaultValue = isBoolean(defaultValue) ? defaultValue : true; if (isBoolean(a)) { ...
[ "function", "resolveBoolOrFunc", "(", "a", ",", "params", ",", "defaultValue", ")", "{", "var", "item", "=", "params", ".", "item", ";", "var", "$scope", "=", "params", ".", "$scope", ";", "var", "event", "=", "params", ".", "event", ";", "var", "model...
Resolves a boolean or a function that returns a boolean Returns true by default if the param is null or undefined @param a - the parameter to be checked @param params - the object for the item's parameters @param defaultValue - the default boolean value to use if the parameter is neither a boolean nor function. True by...
[ "Resolves", "a", "boolean", "or", "a", "function", "that", "returns", "a", "boolean", "Returns", "true", "by", "default", "if", "the", "param", "is", "null", "or", "undefined" ]
08b66bc3854ffe874b50fedd1597587059edc687
https://github.com/Templarian/ui.bootstrap.contextMenu/blob/08b66bc3854ffe874b50fedd1597587059edc687/contextMenu.js#L537-L552
train
gameclosure/js.io
packages/jsio.js
ModuleDef
function ModuleDef (path) { this.path = path; this.friendlyPath = path; util.splitPath(path, this); this.directory = util.resolve(ENV.getCwd(), this.directory); }
javascript
function ModuleDef (path) { this.path = path; this.friendlyPath = path; util.splitPath(path, this); this.directory = util.resolve(ENV.getCwd(), this.directory); }
[ "function", "ModuleDef", "(", "path", ")", "{", "this", ".", "path", "=", "path", ";", "this", ".", "friendlyPath", "=", "path", ";", "util", ".", "splitPath", "(", "path", ",", "this", ")", ";", "this", ".", "directory", "=", "util", ".", "resolve",...
Creates an object containing metadata about a module.
[ "Creates", "an", "object", "containing", "metadata", "about", "a", "module", "." ]
369377ea92b4c9b41e6e646c1afaa785b598a753
https://github.com/gameclosure/js.io/blob/369377ea92b4c9b41e6e646c1afaa785b598a753/packages/jsio.js#L61-L67
train
gameclosure/js.io
packages/jsio.js
loadModule
function loadModule (baseLoader, fromDir, fromFile, item, opts) { var modulePath = item.from; var possibilities = util.resolveModulePath(modulePath, fromDir); for (var i = 0, p; p = possibilities[i]; ++i) { var path = possibilities[i].path; if (!opts.reload && (path in jsio.__modules))...
javascript
function loadModule (baseLoader, fromDir, fromFile, item, opts) { var modulePath = item.from; var possibilities = util.resolveModulePath(modulePath, fromDir); for (var i = 0, p; p = possibilities[i]; ++i) { var path = possibilities[i].path; if (!opts.reload && (path in jsio.__modules))...
[ "function", "loadModule", "(", "baseLoader", ",", "fromDir", ",", "fromFile", ",", "item", ",", "opts", ")", "{", "var", "modulePath", "=", "item", ".", "from", ";", "var", "possibilities", "=", "util", ".", "resolveModulePath", "(", "modulePath", ",", "fr...
load a module from a file
[ "load", "a", "module", "from", "a", "file" ]
369377ea92b4c9b41e6e646c1afaa785b598a753
https://github.com/gameclosure/js.io/blob/369377ea92b4c9b41e6e646c1afaa785b598a753/packages/jsio.js#L672-L733
train
sourcejs/Source
Gruntfile.js
function() { var packageName; var parentFolderName = path.basename(path.resolve('..')); var isSubPackage = parentFolderName === 'node_modules'; var isLocalDepsAvailable = fs.existsSync('node_modules/grunt-autoprefixer') && fs.existsSync('node_modules/grunt-contrib-cssmin'); if (isSubPackage && !isL...
javascript
function() { var packageName; var parentFolderName = path.basename(path.resolve('..')); var isSubPackage = parentFolderName === 'node_modules'; var isLocalDepsAvailable = fs.existsSync('node_modules/grunt-autoprefixer') && fs.existsSync('node_modules/grunt-contrib-cssmin'); if (isSubPackage && !isL...
[ "function", "(", ")", "{", "var", "packageName", ";", "var", "parentFolderName", "=", "path", ".", "basename", "(", "path", ".", "resolve", "(", "'..'", ")", ")", ";", "var", "isSubPackage", "=", "parentFolderName", "===", "'node_modules'", ";", "var", "is...
NPM 3 compatibility fix
[ "NPM", "3", "compatibility", "fix" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/Gruntfile.js#L11-L24
train
sourcejs/Source
core/api/index.js
function (req, res, parseObj) { var data = {}; var body = req.body; var reqID = body.id || req.query.id; var cats = body.cats || req.query.cats; var reqFilter = body.filter || req.query.filter; var reqFilterOut = body.filterOut || req.query.filterOut; var parsedData = parseObj; var msgD...
javascript
function (req, res, parseObj) { var data = {}; var body = req.body; var reqID = body.id || req.query.id; var cats = body.cats || req.query.cats; var reqFilter = body.filter || req.query.filter; var reqFilterOut = body.filterOut || req.query.filterOut; var parsedData = parseObj; var msgD...
[ "function", "(", "req", ",", "res", ",", "parseObj", ")", "{", "var", "data", "=", "{", "}", ";", "var", "body", "=", "req", ".", "body", ";", "var", "reqID", "=", "body", ".", "id", "||", "req", ".", "query", ".", "id", ";", "var", "cats", "...
getSpecs REST api processor @param {Object} req - express request @param {Object} res - express response @param {Object} parseObj - initiated parseData instance Writes result to res object
[ "getSpecs", "REST", "api", "processor" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/core/api/index.js#L33-L85
train
sourcejs/Source
core/api/index.js
function (req, res, parseObj) { var data = {}; var body = req.body; var reqID = body.id || req.query.id; var reqSections = body.sections || req.query.sections; var sections = reqSections ? reqSections.split(',') : undefined; var parsedData = parseObj; var msgDataNotFound = 'API: HTML data n...
javascript
function (req, res, parseObj) { var data = {}; var body = req.body; var reqID = body.id || req.query.id; var reqSections = body.sections || req.query.sections; var sections = reqSections ? reqSections.split(',') : undefined; var parsedData = parseObj; var msgDataNotFound = 'API: HTML data n...
[ "function", "(", "req", ",", "res", ",", "parseObj", ")", "{", "var", "data", "=", "{", "}", ";", "var", "body", "=", "req", ".", "body", ";", "var", "reqID", "=", "body", ".", "id", "||", "req", ".", "query", ".", "id", ";", "var", "reqSection...
getHTML REST api processor @param {Object} req - express request @param {Object} res - express response @param {Object} parseObj - initiated parseData instance Writes result to res object
[ "getHTML", "REST", "api", "processor" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/core/api/index.js#L96-L137
train
sourcejs/Source
core/api/index.js
function (req, res, dataPath) { var body = req.body; var data = body.data; var dataUnflatten = body.unflatten; if (dataUnflatten) { data = unflatten(data, { delimiter: '/', overwrite: 'root' }); } htmlTree.writeDataFile(data, true, dataPath, function(err, finalData){ if (err ||...
javascript
function (req, res, dataPath) { var body = req.body; var data = body.data; var dataUnflatten = body.unflatten; if (dataUnflatten) { data = unflatten(data, { delimiter: '/', overwrite: 'root' }); } htmlTree.writeDataFile(data, true, dataPath, function(err, finalData){ if (err ||...
[ "function", "(", "req", ",", "res", ",", "dataPath", ")", "{", "var", "body", "=", "req", ".", "body", ";", "var", "data", "=", "body", ".", "data", ";", "var", "dataUnflatten", "=", "body", ".", "unflatten", ";", "if", "(", "dataUnflatten", ")", "...
postHTML REST api processor @param {Object} req - express request @param {Object} req.body.data - data to write @param {Boolean} req.body.unflatten - set true, to unflat tree from 'base/spec' @param {Object} res - express response @param {String} dataPath - custom data storage path Writes result to res object
[ "postHTML", "REST", "api", "processor" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/core/api/index.js#L151-L169
train
sourcejs/Source
core/api/index.js
function (req, res, dataPath) { var body = req.body; var reqID = body.id || req.query.id; htmlTree.deleteFromDataFile(dataPath, reqID, function(err, finalData){ if (err || !finalData) { res.status(config.statusCodes.error).json({ message: err }); } el...
javascript
function (req, res, dataPath) { var body = req.body; var reqID = body.id || req.query.id; htmlTree.deleteFromDataFile(dataPath, reqID, function(err, finalData){ if (err || !finalData) { res.status(config.statusCodes.error).json({ message: err }); } el...
[ "function", "(", "req", ",", "res", ",", "dataPath", ")", "{", "var", "body", "=", "req", ".", "body", ";", "var", "reqID", "=", "body", ".", "id", "||", "req", ".", "query", ".", "id", ";", "htmlTree", ".", "deleteFromDataFile", "(", "dataPath", "...
postHTML DELETE api processor @param {Object} req - express request @param {Object} req.body.path - data path for deletion @param {Object} res - express response @param {String} dataPath - custom data storage path Writes result to res object
[ "postHTML", "DELETE", "api", "processor" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/core/api/index.js#L182-L195
train
sourcejs/Source
assets/js/modules/sectionFolding.js
function() { var navHash = utils.parseNavHash(); openSpoiler($(navHash)); //Close other closed by default sections for (var i = 0; i < sectionsOnPage.length; i++) { var t = $(sectionsOnPage[i]); var tID = t.attr('id'); if...
javascript
function() { var navHash = utils.parseNavHash(); openSpoiler($(navHash)); //Close other closed by default sections for (var i = 0; i < sectionsOnPage.length; i++) { var t = $(sectionsOnPage[i]); var tID = t.attr('id'); if...
[ "function", "(", ")", "{", "var", "navHash", "=", "utils", ".", "parseNavHash", "(", ")", ";", "openSpoiler", "(", "$", "(", "navHash", ")", ")", ";", "//Close other closed by default sections", "for", "(", "var", "i", "=", "0", ";", "i", "<", "sectionsO...
To open sections on from inner navigation
[ "To", "open", "sections", "on", "from", "inner", "navigation" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/modules/sectionFolding.js#L171-L189
train
sourcejs/Source
assets/js/lib/modalbox.js
function(config, data) { var isNewInstance = !context; context = context || this; context.data = data ? data : initialBlocksData; if (!isNewInstance) { context.render(); return context; } var modulesOptions = context.options.modulesOptions; modulesOptions.modalBox = $.e...
javascript
function(config, data) { var isNewInstance = !context; context = context || this; context.data = data ? data : initialBlocksData; if (!isNewInstance) { context.render(); return context; } var modulesOptions = context.options.modulesOptions; modulesOptions.modalBox = $.e...
[ "function", "(", "config", ",", "data", ")", "{", "var", "isNewInstance", "=", "!", "context", ";", "context", "=", "context", "||", "this", ";", "context", ".", "data", "=", "data", "?", "data", ":", "initialBlocksData", ";", "if", "(", "!", "isNewIns...
instance of box
[ "instance", "of", "box" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/modalbox.js#L10-L35
train
sourcejs/Source
assets/js/modules/codeSource.js
function() { new Css('/source/assets/js/lib/prism/prism.css', 'core'); var selection = onlyStatic ? $('.source_section pre[class*="src-"].source_visible > code') : $('.source_section pre[class*="src-"] > code'); selection.each(function () { var _this =...
javascript
function() { new Css('/source/assets/js/lib/prism/prism.css', 'core'); var selection = onlyStatic ? $('.source_section pre[class*="src-"].source_visible > code') : $('.source_section pre[class*="src-"] > code'); selection.each(function () { var _this =...
[ "function", "(", ")", "{", "new", "Css", "(", "'/source/assets/js/lib/prism/prism.css'", ",", "'core'", ")", ";", "var", "selection", "=", "onlyStatic", "?", "$", "(", "'.source_section pre[class*=\"src-\"].source_visible > code'", ")", ":", "$", "(", "'.source_sectio...
Code show toggle on each code block
[ "Code", "show", "toggle", "on", "each", "code", "block" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/modules/codeSource.js#L116-L143
train
sourcejs/Source
assets/js/modules/codeSource.js
function() { $('.source_container').on('click', '.' + SourceCodeToggle, function (e) { e.preventDefault(); var codeCnt = $(this).closest('.' + SourceCode); codeCnt.toggleClass(SourceCodeMin); }); }
javascript
function() { $('.source_container').on('click', '.' + SourceCodeToggle, function (e) { e.preventDefault(); var codeCnt = $(this).closest('.' + SourceCode); codeCnt.toggleClass(SourceCodeMin); }); }
[ "function", "(", ")", "{", "$", "(", "'.source_container'", ")", ".", "on", "(", "'click'", ",", "'.'", "+", "SourceCodeToggle", ",", "function", "(", "e", ")", "{", "e", ".", "preventDefault", "(", ")", ";", "var", "codeCnt", "=", "$", "(", "this", ...
Toggle show source sections
[ "Toggle", "show", "source", "sections" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/modules/codeSource.js#L182-L188
train
sourcejs/Source
assets/js/modules/navHighlight.js
function () { var headersLength = sourceHeaders.length; var minDistance = Number.MAX_VALUE; var closestHeader = -1; var fileNameInUrl = filename === '' ? '' : filename + '.' + extension; if ((document.body.scrollTop || document.documentElement.scrollTop) < hashThreshold) { if (!!window.location.h...
javascript
function () { var headersLength = sourceHeaders.length; var minDistance = Number.MAX_VALUE; var closestHeader = -1; var fileNameInUrl = filename === '' ? '' : filename + '.' + extension; if ((document.body.scrollTop || document.documentElement.scrollTop) < hashThreshold) { if (!!window.location.h...
[ "function", "(", ")", "{", "var", "headersLength", "=", "sourceHeaders", ".", "length", ";", "var", "minDistance", "=", "Number", ".", "MAX_VALUE", ";", "var", "closestHeader", "=", "-", "1", ";", "var", "fileNameInUrl", "=", "filename", "===", "''", "?", ...
watch headers position
[ "watch", "headers", "position" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/modules/navHighlight.js#L92-L151
train
sourcejs/Source
assets/js/lib/jquery.couch.js
function(options, section, option, value) { var req = {url: this.urlPrefix + "/_config/"}; if (section) { req.url += encodeURIComponent(section) + "/"; if (option) { req.url += encodeURIComponent(option); } } if (value === null) { req.type = "DELETE"; ...
javascript
function(options, section, option, value) { var req = {url: this.urlPrefix + "/_config/"}; if (section) { req.url += encodeURIComponent(section) + "/"; if (option) { req.url += encodeURIComponent(option); } } if (value === null) { req.type = "DELETE"; ...
[ "function", "(", "options", ",", "section", ",", "option", ",", "value", ")", "{", "var", "req", "=", "{", "url", ":", "this", ".", "urlPrefix", "+", "\"/_config/\"", "}", ";", "if", "(", "section", ")", "{", "req", ".", "url", "+=", "encodeURICompon...
View and edit the CouchDB configuration, called with just the options parameter the entire config is returned, you can be more specific by passing the section and option parameters, if you specify a value that value will be stored in the configuration. @see <a href="http://techzone.couchbase.com/sites/default/files/upl...
[ "View", "and", "edit", "the", "CouchDB", "configuration", "called", "with", "just", "the", "options", "parameter", "the", "entire", "config", "is", "returned", "you", "can", "be", "more", "specific", "by", "passing", "the", "section", "and", "option", "paramet...
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/jquery.couch.js#L112-L132
train
sourcejs/Source
assets/js/lib/jquery.couch.js
function(options) { $.extend(options, {successStatus: 202}); ajax({ type: "POST", url: this.uri + "_compact", data: "", processData: false }, options, "The database could not be compacted" ); }
javascript
function(options) { $.extend(options, {successStatus: 202}); ajax({ type: "POST", url: this.uri + "_compact", data: "", processData: false }, options, "The database could not be compacted" ); }
[ "function", "(", "options", ")", "{", "$", ".", "extend", "(", "options", ",", "{", "successStatus", ":", "202", "}", ")", ";", "ajax", "(", "{", "type", ":", "\"POST\"", ",", "url", ":", "this", ".", "uri", "+", "\"_compact\"", ",", "data", ":", ...
Request compaction of the specified database. @see <a href="http://techzone.couchbase.com/sites/default/files/ uploads/all/documentation/couchbase-api-db.html#couchbase-api-db_ db-compact_post">docs for /db/_compact</a> @param {ajaxSettings} options <a href="http://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings"> jQu...
[ "Request", "compaction", "of", "the", "specified", "database", "." ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/jquery.couch.js#L295-L304
train
sourcejs/Source
assets/js/lib/jquery.couch.js
getChangesSince
function getChangesSince() { var opts = $.extend({heartbeat : 10 * 1000}, options, { feed : "longpoll", since : since }); ajax( {url: db.uri + "_changes"+encodeOptions(opts)}, options, "Error connecting to "+db.uri...
javascript
function getChangesSince() { var opts = $.extend({heartbeat : 10 * 1000}, options, { feed : "longpoll", since : since }); ajax( {url: db.uri + "_changes"+encodeOptions(opts)}, options, "Error connecting to "+db.uri...
[ "function", "getChangesSince", "(", ")", "{", "var", "opts", "=", "$", ".", "extend", "(", "{", "heartbeat", ":", "10", "*", "1000", "}", ",", "options", ",", "{", "feed", ":", "\"longpoll\"", ",", "since", ":", "since", "}", ")", ";", "ajax", "(",...
actually make the changes request
[ "actually", "make", "the", "changes", "request" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/jquery.couch.js#L459-L469
train
sourcejs/Source
assets/js/lib/jquery.couch.js
function(docId, options, ajaxOptions) { options = options || {}; if (db_opts.attachPrevRev || options.attachPrevRev) { $.extend(options, { beforeSuccess : function(req, doc) { rawDocs[doc._id] = { rev : doc._rev, raw : req...
javascript
function(docId, options, ajaxOptions) { options = options || {}; if (db_opts.attachPrevRev || options.attachPrevRev) { $.extend(options, { beforeSuccess : function(req, doc) { rawDocs[doc._id] = { rev : doc._rev, raw : req...
[ "function", "(", "docId", ",", "options", ",", "ajaxOptions", ")", "{", "options", "=", "options", "||", "{", "}", ";", "if", "(", "db_opts", ".", "attachPrevRev", "||", "options", ".", "attachPrevRev", ")", "{", "$", ".", "extend", "(", "options", ","...
Returns the specified doc from the specified db. @see <a href="http://techzone.couchbase.com/sites/default/files/ uploads/all/documentation/couchbase-api-dbdoc.html#couchbase-api- dbdoc_db-doc_get">docs for GET /db/doc</a> @param {String} docId id of document to fetch @param {ajaxSettings} options <a href="http://api.j...
[ "Returns", "the", "specified", "doc", "from", "the", "specified", "db", "." ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/jquery.couch.js#L572-L600
train
sourcejs/Source
assets/js/lib/jquery.couch.js
function(doc, options) { options = options || {}; var db = this; var beforeSend = fullCommit(options); if (doc._id === undefined) { var method = "POST"; var uri = this.uri; } else { var method = "PUT"; var uri = this.uri +...
javascript
function(doc, options) { options = options || {}; var db = this; var beforeSend = fullCommit(options); if (doc._id === undefined) { var method = "POST"; var uri = this.uri; } else { var method = "PUT"; var uri = this.uri +...
[ "function", "(", "doc", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "db", "=", "this", ";", "var", "beforeSend", "=", "fullCommit", "(", "options", ")", ";", "if", "(", "doc", ".", "_id", "===", "undefined", ")"...
Create a new document in the specified database, using the supplied JSON document structure. If the JSON structure includes the _id field, then the document will be created with the specified document ID. If the _id field is not specified, a new unique ID will be generated. @see <a href="http://techzone.couchbase.com/s...
[ "Create", "a", "new", "document", "in", "the", "specified", "database", "using", "the", "supplied", "JSON", "document", "structure", ".", "If", "the", "JSON", "structure", "includes", "the", "_id", "field", "then", "the", "document", "will", "be", "created", ...
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/jquery.couch.js#L615-L655
train
sourcejs/Source
assets/js/lib/jquery.couch.js
function(docs, options) { var beforeSend = fullCommit(options); $.extend(options, {successStatus: 201, beforeSend : beforeSend}); ajax({ type: "POST", url: this.uri + "_bulk_docs" + encodeOptions(options), contentType: "application/json", data: toJ...
javascript
function(docs, options) { var beforeSend = fullCommit(options); $.extend(options, {successStatus: 201, beforeSend : beforeSend}); ajax({ type: "POST", url: this.uri + "_bulk_docs" + encodeOptions(options), contentType: "application/json", data: toJ...
[ "function", "(", "docs", ",", "options", ")", "{", "var", "beforeSend", "=", "fullCommit", "(", "options", ")", ";", "$", ".", "extend", "(", "options", ",", "{", "successStatus", ":", "201", ",", "beforeSend", ":", "beforeSend", "}", ")", ";", "ajax",...
Save a list of documents @see <a href="http://techzone.couchbase.com/sites/default/files/ uploads/all/documentation/couchbase-api-db.html#couchbase-api-db_ db-bulk-docs_post">docs for /db/_bulk_docs</a> @param {Object[]} docs List of documents to save @param {ajaxSettings} options <a href="http://api.jquery.com/ jQuery...
[ "Save", "a", "list", "of", "documents" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/jquery.couch.js#L666-L677
train
sourcejs/Source
assets/js/lib/jquery.couch.js
function(docs, options){ docs.docs = $.each( docs.docs, function(i, doc){ doc._deleted = true; } ); $.extend(options, {successStatus: 201}); ajax({ type: "POST", url: this.uri + "_bulk_docs" + encodeOptions(options...
javascript
function(docs, options){ docs.docs = $.each( docs.docs, function(i, doc){ doc._deleted = true; } ); $.extend(options, {successStatus: 201}); ajax({ type: "POST", url: this.uri + "_bulk_docs" + encodeOptions(options...
[ "function", "(", "docs", ",", "options", ")", "{", "docs", ".", "docs", "=", "$", ".", "each", "(", "docs", ".", "docs", ",", "function", "(", "i", ",", "doc", ")", "{", "doc", ".", "_deleted", "=", "true", ";", "}", ")", ";", "$", ".", "exte...
Remove a set of documents @see <a href="http://techzone.couchbase.com/sites/default/files/ uploads/all/documentation/couchbase-api-db.html#couchbase-api-db_ db-bulk-docs_post">docs for /db/_bulk_docs</a> @param {String[]} docs List of document id's to remove @param {ajaxSettings} options <a href="http://api.jquery.com/...
[ "Remove", "a", "set", "of", "documents" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/jquery.couch.js#L711-L726
train
sourcejs/Source
assets/js/lib/jquery.couch.js
function(propName, options, ajaxOptions) { ajax({url: this.uri + propName + encodeOptions(options)}, options, "The property could not be retrieved", ajaxOptions ); }
javascript
function(propName, options, ajaxOptions) { ajax({url: this.uri + propName + encodeOptions(options)}, options, "The property could not be retrieved", ajaxOptions ); }
[ "function", "(", "propName", ",", "options", ",", "ajaxOptions", ")", "{", "ajax", "(", "{", "url", ":", "this", ".", "uri", "+", "propName", "+", "encodeOptions", "(", "options", ")", "}", ",", "options", ",", "\"The property could not be retrieved\"", ",",...
Fetch an arbitrary CouchDB database property @see <a href="http://techzone.couchbase.com/sites/default/files/ uploads/all/documentation/couchbase-api.html">docs for /db/_prop</a> @param {String} propName Propery name to fetch @param {ajaxSettings} options <a href="http://api.jquery.com/ jQuery.ajax/#jQuery-ajax-setting...
[ "Fetch", "an", "arbitrary", "CouchDB", "database", "property" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/jquery.couch.js#L878-L884
train
sourcejs/Source
assets/js/lib/jquery.couch.js
function(propName, propValue, options, ajaxOptions) { ajax({ type: "PUT", url: this.uri + propName + encodeOptions(options), data : JSON.stringify(propValue) }, options, "The property could not be updated", ajaxOptions ...
javascript
function(propName, propValue, options, ajaxOptions) { ajax({ type: "PUT", url: this.uri + propName + encodeOptions(options), data : JSON.stringify(propValue) }, options, "The property could not be updated", ajaxOptions ...
[ "function", "(", "propName", ",", "propValue", ",", "options", ",", "ajaxOptions", ")", "{", "ajax", "(", "{", "type", ":", "\"PUT\"", ",", "url", ":", "this", ".", "uri", "+", "propName", "+", "encodeOptions", "(", "options", ")", ",", "data", ":", ...
Set an arbitrary CouchDB database property @see <a href="http://techzone.couchbase.com/sites/default/files/ uploads/all/documentation/couchbase-api.html">docs for /db/_prop</a> @param {String} propName Propery name to fetch @param {String} propValue Propery value to set @param {ajaxSettings} options <a href="http://api...
[ "Set", "an", "arbitrary", "CouchDB", "database", "property" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/jquery.couch.js#L897-L907
train
sourcejs/Source
assets/js/lib/jquery.couch.js
function(source, target, ajaxOptions, repOpts) { repOpts = $.extend({source: source, target: target}, repOpts); if (repOpts.continuous && !repOpts.cancel) { ajaxOptions.successStatus = 202; } ajax({ type: "POST", url: this.urlPrefix + "/_replicate", data: JSON.stringi...
javascript
function(source, target, ajaxOptions, repOpts) { repOpts = $.extend({source: source, target: target}, repOpts); if (repOpts.continuous && !repOpts.cancel) { ajaxOptions.successStatus = 202; } ajax({ type: "POST", url: this.urlPrefix + "/_replicate", data: JSON.stringi...
[ "function", "(", "source", ",", "target", ",", "ajaxOptions", ",", "repOpts", ")", "{", "repOpts", "=", "$", ".", "extend", "(", "{", "source", ":", "source", ",", "target", ":", "target", "}", ",", "repOpts", ")", ";", "if", "(", "repOpts", ".", "...
Request, configure, or stop, a replication operation. @see <a href="http://techzone.couchbase.com/sites/default/files/ uploads/all/documentation/couchbase-api-misc.html#couchbase-api- misc_replicate_post">docs for POST /_replicate</a> @param {String} source Path or url to source database @param {String} target Path or ...
[ "Request", "configure", "or", "stop", "a", "replication", "operation", "." ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/jquery.couch.js#L943-L956
train
sourcejs/Source
assets/js/lib/jquery.couch.js
function(cacheNum) { if (cacheNum === undefined) { cacheNum = 1; } if (!uuidCache.length) { ajax({url: this.urlPrefix + "/_uuids", data: {count: cacheNum}, async: false}, { success: function(resp) { uuidCache = resp.uuids; } ...
javascript
function(cacheNum) { if (cacheNum === undefined) { cacheNum = 1; } if (!uuidCache.length) { ajax({url: this.urlPrefix + "/_uuids", data: {count: cacheNum}, async: false}, { success: function(resp) { uuidCache = resp.uuids; } ...
[ "function", "(", "cacheNum", ")", "{", "if", "(", "cacheNum", "===", "undefined", ")", "{", "cacheNum", "=", "1", ";", "}", "if", "(", "!", "uuidCache", ".", "length", ")", "{", "ajax", "(", "{", "url", ":", "this", ".", "urlPrefix", "+", "\"/_uuid...
Fetch a new UUID @see <a href="http://techzone.couchbase.com/sites/default/files/ uploads/all/documentation/couchbase-api-misc.html#couchbase-api- misc_uuids_get">docs for /_uuids</a> @param {Int} cacheNum Number of uuids to keep cached for future use
[ "Fetch", "a", "new", "UUID" ]
e6461409302486c5db1085bb44a81f310403eb90
https://github.com/sourcejs/Source/blob/e6461409302486c5db1085bb44a81f310403eb90/assets/js/lib/jquery.couch.js#L965-L980
train
TobiasHennig/nativescript-toast
publish/scripts/postinstall.js
askAndroidPrompt
function askAndroidPrompt() { prompt.get({ name: 'using_android', description: 'Are you using Android (y/n)', default: 'y' }, function(err, result) { if (err) { return console.log(err); } mergeConfig(result); askAndroidPromptResult(result); ...
javascript
function askAndroidPrompt() { prompt.get({ name: 'using_android', description: 'Are you using Android (y/n)', default: 'y' }, function(err, result) { if (err) { return console.log(err); } mergeConfig(result); askAndroidPromptResult(result); ...
[ "function", "askAndroidPrompt", "(", ")", "{", "prompt", ".", "get", "(", "{", "name", ":", "'using_android'", ",", "description", ":", "'Are you using Android (y/n)'", ",", "default", ":", "'y'", "}", ",", "function", "(", "err", ",", "result", ")", "{", ...
Prompt the user if they are integrating Fabric with Android
[ "Prompt", "the", "user", "if", "they", "are", "integrating", "Fabric", "with", "Android" ]
5de877615a94125bb677fa8a68646146285828dd
https://github.com/TobiasHennig/nativescript-toast/blob/5de877615a94125bb677fa8a68646146285828dd/publish/scripts/postinstall.js#L128-L145
train
TobiasHennig/nativescript-toast
publish/scripts/postinstall.js
promptQuestions
function promptQuestions() { prompt.get([{ name: 'api_key', description: 'Your Fabric API Key', default: '' }, { name: 'api_secret', description: 'Your Fabric API Secret', default: '' }], function(err, result) { if (err) { return console.lo...
javascript
function promptQuestions() { prompt.get([{ name: 'api_key', description: 'Your Fabric API Key', default: '' }, { name: 'api_secret', description: 'Your Fabric API Secret', default: '' }], function(err, result) { if (err) { return console.lo...
[ "function", "promptQuestions", "(", ")", "{", "prompt", ".", "get", "(", "[", "{", "name", ":", "'api_key'", ",", "description", ":", "'Your Fabric API Key'", ",", "default", ":", "''", "}", ",", "{", "name", ":", "'api_secret'", ",", "description", ":", ...
Prompt the user through the configurable Fabric add-on services
[ "Prompt", "the", "user", "through", "the", "configurable", "Fabric", "add", "-", "on", "services" ]
5de877615a94125bb677fa8a68646146285828dd
https://github.com/TobiasHennig/nativescript-toast/blob/5de877615a94125bb677fa8a68646146285828dd/publish/scripts/postinstall.js#L156-L173
train
TobiasHennig/nativescript-toast
publish/scripts/postinstall.js
writePodFile
function writePodFile(result) { if (!fs.existsSync(directories.ios)) { fs.mkdirSync(directories.ios); } try { fs.writeFileSync(directories.ios + '/Podfile', `use_frameworks! pod 'Fabric', '${FABRIC_IOS_FABRIC}' pod 'Crashlytics', '${FABRIC_IOS_CRASHLYTICS}' # Crashlytics works be...
javascript
function writePodFile(result) { if (!fs.existsSync(directories.ios)) { fs.mkdirSync(directories.ios); } try { fs.writeFileSync(directories.ios + '/Podfile', `use_frameworks! pod 'Fabric', '${FABRIC_IOS_FABRIC}' pod 'Crashlytics', '${FABRIC_IOS_CRASHLYTICS}' # Crashlytics works be...
[ "function", "writePodFile", "(", "result", ")", "{", "if", "(", "!", "fs", ".", "existsSync", "(", "directories", ".", "ios", ")", ")", "{", "fs", ".", "mkdirSync", "(", "directories", ".", "ios", ")", ";", "}", "try", "{", "fs", ".", "writeFileSync"...
Create the iOS PodFile for installing the Fabric iOS dependencies and service dependencies @param {any} result The answers to the micro-service prompts
[ "Create", "the", "iOS", "PodFile", "for", "installing", "the", "Fabric", "iOS", "dependencies", "and", "service", "dependencies" ]
5de877615a94125bb677fa8a68646146285828dd
https://github.com/TobiasHennig/nativescript-toast/blob/5de877615a94125bb677fa8a68646146285828dd/publish/scripts/postinstall.js#L291-L315
train
TobiasHennig/nativescript-toast
publish/scripts/postinstall.js
writeGradleFile
function writeGradleFile() { if (!fs.existsSync(directories.android)) { fs.mkdirSync(directories.android); } try { fs.writeFileSync(directories.android + '/include.gradle', ` android { } buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } } re...
javascript
function writeGradleFile() { if (!fs.existsSync(directories.android)) { fs.mkdirSync(directories.android); } try { fs.writeFileSync(directories.android + '/include.gradle', ` android { } buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } } re...
[ "function", "writeGradleFile", "(", ")", "{", "if", "(", "!", "fs", ".", "existsSync", "(", "directories", ".", "android", ")", ")", "{", "fs", ".", "mkdirSync", "(", "directories", ".", "android", ")", ";", "}", "try", "{", "fs", ".", "writeFileSync",...
Create the Android Gradle for installing the Fabric Android dependencies and service dependencies @param {any} result The answers to the micro-service prompts
[ "Create", "the", "Android", "Gradle", "for", "installing", "the", "Fabric", "Android", "dependencies", "and", "service", "dependencies" ]
5de877615a94125bb677fa8a68646146285828dd
https://github.com/TobiasHennig/nativescript-toast/blob/5de877615a94125bb677fa8a68646146285828dd/publish/scripts/postinstall.js#L322-L360
train
TobiasHennig/nativescript-toast
publish/scripts/postinstall.js
writeFabricServiceGradleHook
function writeFabricServiceGradleHook(config) { console.log("Install Fabric-build-gradle hook."); try { if (!fs.existsSync(path.join(appRoot, "hooks"))) { fs.mkdirSync(path.join(appRoot, "hooks")); } if (!fs.existsSync(path.join(appRoot, "hooks", "after-prepare"))) { ...
javascript
function writeFabricServiceGradleHook(config) { console.log("Install Fabric-build-gradle hook."); try { if (!fs.existsSync(path.join(appRoot, "hooks"))) { fs.mkdirSync(path.join(appRoot, "hooks")); } if (!fs.existsSync(path.join(appRoot, "hooks", "after-prepare"))) { ...
[ "function", "writeFabricServiceGradleHook", "(", "config", ")", "{", "console", ".", "log", "(", "\"Install Fabric-build-gradle hook.\"", ")", ";", "try", "{", "if", "(", "!", "fs", ".", "existsSync", "(", "path", ".", "join", "(", "appRoot", ",", "\"hooks\"",...
Create dev tools gradle runtime entry
[ "Create", "dev", "tools", "gradle", "runtime", "entry" ]
5de877615a94125bb677fa8a68646146285828dd
https://github.com/TobiasHennig/nativescript-toast/blob/5de877615a94125bb677fa8a68646146285828dd/publish/scripts/postinstall.js#L365-L493
train
felixge/node-combined-stream
lib/defer.js
defer
function defer(fn) { var nextTick = typeof setImmediate == 'function' ? setImmediate : ( typeof process == 'object' && typeof process.nextTick == 'function' ? process.nextTick : null ); if (nextTick) { nextTick(fn); } else { setTimeout(fn, 0); } }
javascript
function defer(fn) { var nextTick = typeof setImmediate == 'function' ? setImmediate : ( typeof process == 'object' && typeof process.nextTick == 'function' ? process.nextTick : null ); if (nextTick) { nextTick(fn); } else { setTimeout(fn, 0); } }
[ "function", "defer", "(", "fn", ")", "{", "var", "nextTick", "=", "typeof", "setImmediate", "==", "'function'", "?", "setImmediate", ":", "(", "typeof", "process", "==", "'object'", "&&", "typeof", "process", ".", "nextTick", "==", "'function'", "?", "proces...
Runs provided function on next iteration of the event loop @param {function} fn - function to run
[ "Runs", "provided", "function", "on", "next", "iteration", "of", "the", "event", "loop" ]
3593923e4126da3e00ca6c40b2d0636de7a66579
https://github.com/felixge/node-combined-stream/blob/3593923e4126da3e00ca6c40b2d0636de7a66579/lib/defer.js#L8-L26
train
beakerbrowser/pauls-dat-api
lib/read.js
readFile
function readFile (archive, name, opts, cb) { if (typeof opts === 'function') { cb = opts opts = {} } return maybe(cb, async function () { opts = opts || {} if (typeof opts === 'string') { opts = { encoding: opts } } opts.encoding = toValidEncoding(opts.encoding) // check that ...
javascript
function readFile (archive, name, opts, cb) { if (typeof opts === 'function') { cb = opts opts = {} } return maybe(cb, async function () { opts = opts || {} if (typeof opts === 'string') { opts = { encoding: opts } } opts.encoding = toValidEncoding(opts.encoding) // check that ...
[ "function", "readFile", "(", "archive", ",", "name", ",", "opts", ",", "cb", ")", "{", "if", "(", "typeof", "opts", "===", "'function'", ")", "{", "cb", "=", "opts", "opts", "=", "{", "}", "}", "return", "maybe", "(", "cb", ",", "async", "function"...
helper to pull file data from an archive
[ "helper", "to", "pull", "file", "data", "from", "an", "archive" ]
70eda444a1b55c58fda21a4a005a9ef096e068f0
https://github.com/beakerbrowser/pauls-dat-api/blob/70eda444a1b55c58fda21a4a005a9ef096e068f0/lib/read.js#L7-L34
train
beakerbrowser/pauls-dat-api
lib/read.js
readdir
function readdir (archive, name, opts, cb) { if (typeof opts === 'function') { cb = opts opts = {} } opts = opts || {} return maybe(cb, async function () { // options var recursive = (opts && !!opts.recursive) // run first readdir var promise = new Promise((resolve, reject) => { ...
javascript
function readdir (archive, name, opts, cb) { if (typeof opts === 'function') { cb = opts opts = {} } opts = opts || {} return maybe(cb, async function () { // options var recursive = (opts && !!opts.recursive) // run first readdir var promise = new Promise((resolve, reject) => { ...
[ "function", "readdir", "(", "archive", ",", "name", ",", "opts", ",", "cb", ")", "{", "if", "(", "typeof", "opts", "===", "'function'", ")", "{", "cb", "=", "opts", "opts", "=", "{", "}", "}", "opts", "=", "opts", "||", "{", "}", "return", "maybe...
helper to list the files in a directory
[ "helper", "to", "list", "the", "files", "in", "a", "directory" ]
70eda444a1b55c58fda21a4a005a9ef096e068f0
https://github.com/beakerbrowser/pauls-dat-api/blob/70eda444a1b55c58fda21a4a005a9ef096e068f0/lib/read.js#L37-L75
train
beakerbrowser/pauls-dat-api
lib/export.js
exportArchiveToFilesystem
function exportArchiveToFilesystem (opts, cb) { return maybe(cb, async function () { assert(opts && typeof opts === 'object', 'opts object is required') // core arguments, dstPath and srcArchive var srcArchive = opts.srcArchive var dstPath = opts.dstPath assert(srcArchive && typeof srcArchive ===...
javascript
function exportArchiveToFilesystem (opts, cb) { return maybe(cb, async function () { assert(opts && typeof opts === 'object', 'opts object is required') // core arguments, dstPath and srcArchive var srcArchive = opts.srcArchive var dstPath = opts.dstPath assert(srcArchive && typeof srcArchive ===...
[ "function", "exportArchiveToFilesystem", "(", "opts", ",", "cb", ")", "{", "return", "maybe", "(", "cb", ",", "async", "function", "(", ")", "{", "assert", "(", "opts", "&&", "typeof", "opts", "===", "'object'", ",", "'opts object is required'", ")", "// cor...
copy files from an archive into the filesystem
[ "copy", "files", "from", "an", "archive", "into", "the", "filesystem" ]
70eda444a1b55c58fda21a4a005a9ef096e068f0
https://github.com/beakerbrowser/pauls-dat-api/blob/70eda444a1b55c58fda21a4a005a9ef096e068f0/lib/export.js#L172-L275
train
beakerbrowser/pauls-dat-api
lib/manifest.js
readManifest
function readManifest (archive, cb) { return maybe(cb, async function () { var data = await readFile(archive, DAT_MANIFEST_FILENAME) data = JSON.parse(data.toString()) if (data.links) data.links = massageLinks(data.links) return data }) }
javascript
function readManifest (archive, cb) { return maybe(cb, async function () { var data = await readFile(archive, DAT_MANIFEST_FILENAME) data = JSON.parse(data.toString()) if (data.links) data.links = massageLinks(data.links) return data }) }
[ "function", "readManifest", "(", "archive", ",", "cb", ")", "{", "return", "maybe", "(", "cb", ",", "async", "function", "(", ")", "{", "var", "data", "=", "await", "readFile", "(", "archive", ",", "DAT_MANIFEST_FILENAME", ")", "data", "=", "JSON", ".", ...
helper to read the manifest into an object
[ "helper", "to", "read", "the", "manifest", "into", "an", "object" ]
70eda444a1b55c58fda21a4a005a9ef096e068f0
https://github.com/beakerbrowser/pauls-dat-api/blob/70eda444a1b55c58fda21a4a005a9ef096e068f0/lib/manifest.js#L7-L14
train
beakerbrowser/pauls-dat-api
lib/manifest.js
writeManifest
function writeManifest (archive, manifest, cb) { manifest = generateManifest(manifest) return writeFile(archive, DAT_MANIFEST_FILENAME, JSON.stringify(manifest, null, 2), cb) }
javascript
function writeManifest (archive, manifest, cb) { manifest = generateManifest(manifest) return writeFile(archive, DAT_MANIFEST_FILENAME, JSON.stringify(manifest, null, 2), cb) }
[ "function", "writeManifest", "(", "archive", ",", "manifest", ",", "cb", ")", "{", "manifest", "=", "generateManifest", "(", "manifest", ")", "return", "writeFile", "(", "archive", ",", "DAT_MANIFEST_FILENAME", ",", "JSON", ".", "stringify", "(", "manifest", "...
helper to write a manifest object
[ "helper", "to", "write", "a", "manifest", "object" ]
70eda444a1b55c58fda21a4a005a9ef096e068f0
https://github.com/beakerbrowser/pauls-dat-api/blob/70eda444a1b55c58fda21a4a005a9ef096e068f0/lib/manifest.js#L17-L20
train
beakerbrowser/pauls-dat-api
lib/manifest.js
updateManifest
function updateManifest (archive, updates, cb) { return maybe(cb, async function () { var manifest try { manifest = await readManifest(archive) } catch (e) { manifest = {} } Object.assign(manifest, generateManifest(updates)) return writeManifest(archive, manifest) }) }
javascript
function updateManifest (archive, updates, cb) { return maybe(cb, async function () { var manifest try { manifest = await readManifest(archive) } catch (e) { manifest = {} } Object.assign(manifest, generateManifest(updates)) return writeManifest(archive, manifest) }) }
[ "function", "updateManifest", "(", "archive", ",", "updates", ",", "cb", ")", "{", "return", "maybe", "(", "cb", ",", "async", "function", "(", ")", "{", "var", "manifest", "try", "{", "manifest", "=", "await", "readManifest", "(", "archive", ")", "}", ...
helper to write updates to a manifest object
[ "helper", "to", "write", "updates", "to", "a", "manifest", "object" ]
70eda444a1b55c58fda21a4a005a9ef096e068f0
https://github.com/beakerbrowser/pauls-dat-api/blob/70eda444a1b55c58fda21a4a005a9ef096e068f0/lib/manifest.js#L23-L34
train
beakerbrowser/pauls-dat-api
lib/manifest.js
generateManifest
function generateManifest (manifest = {}) { var { url, title, description, type, author, links, web_root, fallback_page } = manifest if (isString(url)) manifest.url = url else delete manifest.url if (isString(title)) manifest.title = title else delete manifest.title if (isString(description)) manifest.descr...
javascript
function generateManifest (manifest = {}) { var { url, title, description, type, author, links, web_root, fallback_page } = manifest if (isString(url)) manifest.url = url else delete manifest.url if (isString(title)) manifest.title = title else delete manifest.title if (isString(description)) manifest.descr...
[ "function", "generateManifest", "(", "manifest", "=", "{", "}", ")", "{", "var", "{", "url", ",", "title", ",", "description", ",", "type", ",", "author", ",", "links", ",", "web_root", ",", "fallback_page", "}", "=", "manifest", "if", "(", "isString", ...
helper to generate a new dat.json object
[ "helper", "to", "generate", "a", "new", "dat", ".", "json", "object" ]
70eda444a1b55c58fda21a4a005a9ef096e068f0
https://github.com/beakerbrowser/pauls-dat-api/blob/70eda444a1b55c58fda21a4a005a9ef096e068f0/lib/manifest.js#L37-L71
train
beakerbrowser/pauls-dat-api
lib/lookup.js
stat
function stat (archive, name, cb) { return maybe(cb, new Promise((resolve, reject) => { // run stat operation archive.stat(name, (err, st) => { if (err) reject(toBeakerError(err, 'stat')) else { // read download status st.downloaded = 0 if (!archive.key) { // fs, ...
javascript
function stat (archive, name, cb) { return maybe(cb, new Promise((resolve, reject) => { // run stat operation archive.stat(name, (err, st) => { if (err) reject(toBeakerError(err, 'stat')) else { // read download status st.downloaded = 0 if (!archive.key) { // fs, ...
[ "function", "stat", "(", "archive", ",", "name", ",", "cb", ")", "{", "return", "maybe", "(", "cb", ",", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "// run stat operation", "archive", ".", "stat", "(", "name", ",", "(", "er...
lookup information about a file
[ "lookup", "information", "about", "a", "file" ]
70eda444a1b55c58fda21a4a005a9ef096e068f0
https://github.com/beakerbrowser/pauls-dat-api/blob/70eda444a1b55c58fda21a4a005a9ef096e068f0/lib/lookup.js#L4-L24
train
crosswalk-project/crosswalk-app-tools
src/util/Version.js
Version
function Version(major, minor, micro, build) { if (typeof major === "number" && major % 1 === 0) this._major = major; else throw new Error("Invalid major version number '" + major + "'"); if (typeof minor === "number" && minor % 1 === 0) this._minor = minor; else throw ...
javascript
function Version(major, minor, micro, build) { if (typeof major === "number" && major % 1 === 0) this._major = major; else throw new Error("Invalid major version number '" + major + "'"); if (typeof minor === "number" && minor % 1 === 0) this._minor = minor; else throw ...
[ "function", "Version", "(", "major", ",", "minor", ",", "micro", ",", "build", ")", "{", "if", "(", "typeof", "major", "===", "\"number\"", "&&", "major", "%", "1", "===", "0", ")", "this", ".", "_major", "=", "major", ";", "else", "throw", "new", ...
Representation of a four part Crosswalk version number. @param {Number} major @param {Number} minor @param {Number} micro @param {Number} build @constructor
[ "Representation", "of", "a", "four", "part", "Crosswalk", "version", "number", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/src/util/Version.js#L16-L37
train
crosswalk-project/crosswalk-app-tools
src/Application.js
initMembers
function initMembers(rootPath) { this._rootPath = rootPath; ShellJS.mkdir(this._rootPath); this._appPath = this._rootPath + Path.sep + "app"; ShellJS.mkdir(this._appPath); this._logPath = Path.join(OS.tmpdir(), "crosswalk-app-tools-" + this._packageId); ShellJS.mkdir(this._logPath); // P...
javascript
function initMembers(rootPath) { this._rootPath = rootPath; ShellJS.mkdir(this._rootPath); this._appPath = this._rootPath + Path.sep + "app"; ShellJS.mkdir(this._appPath); this._logPath = Path.join(OS.tmpdir(), "crosswalk-app-tools-" + this._packageId); ShellJS.mkdir(this._logPath); // P...
[ "function", "initMembers", "(", "rootPath", ")", "{", "this", ".", "_rootPath", "=", "rootPath", ";", "ShellJS", ".", "mkdir", "(", "this", ".", "_rootPath", ")", ";", "this", ".", "_appPath", "=", "this", ".", "_rootPath", "+", "Path", ".", "sep", "+"...
Initialize paths. @param {String} rootPath Root path inside the project
[ "Initialize", "paths", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/src/Application.js#L112-L128
train
crosswalk-project/crosswalk-app-tools
src/util/TemplateFile.js
TemplateFile
function TemplateFile(path) { this._buffer = FS.readFileSync(path, {"encoding": "utf8"}); if (!this._buffer || this._buffer.length === 0) { throw new Error("Could not read " + path); } }
javascript
function TemplateFile(path) { this._buffer = FS.readFileSync(path, {"encoding": "utf8"}); if (!this._buffer || this._buffer.length === 0) { throw new Error("Could not read " + path); } }
[ "function", "TemplateFile", "(", "path", ")", "{", "this", ".", "_buffer", "=", "FS", ".", "readFileSync", "(", "path", ",", "{", "\"encoding\"", ":", "\"utf8\"", "}", ")", ";", "if", "(", "!", "this", ".", "_buffer", "||", "this", ".", "_buffer", "....
Class to handle reading and writing template files. @constructor @param {String} path Path to template file @throws {Error} If file could not be read.
[ "Class", "to", "handle", "reading", "and", "writing", "template", "files", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/src/util/TemplateFile.js#L14-L20
train
crosswalk-project/crosswalk-app-tools
src/OutputTee.js
OutputTee
function OutputTee(logfileOutput, terminalOutput) { this._outputs = []; this._outputs[_OUTPUT_TEE_LOGFILE] = logfileOutput; this._outputs[_OUTPUT_TEE_TERMINAL] = terminalOutput; }
javascript
function OutputTee(logfileOutput, terminalOutput) { this._outputs = []; this._outputs[_OUTPUT_TEE_LOGFILE] = logfileOutput; this._outputs[_OUTPUT_TEE_TERMINAL] = terminalOutput; }
[ "function", "OutputTee", "(", "logfileOutput", ",", "terminalOutput", ")", "{", "this", ".", "_outputs", "=", "[", "]", ";", "this", ".", "_outputs", "[", "_OUTPUT_TEE_LOGFILE", "]", "=", "logfileOutput", ";", "this", ".", "_outputs", "[", "_OUTPUT_TEE_TERMINA...
Console output interface. @constructor @param {OutputIface} logfileOutput @extends OutputIface
[ "Console", "output", "interface", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/src/OutputTee.js#L16-L21
train
crosswalk-project/crosswalk-app-tools
windows/lib/WinPlatform.js
WinPlatform
function WinPlatform(PlatformBase, baseData) { // Create base instance. var instance = new PlatformBase(baseData); // Override manually, because Object.extend() is not yet available on node. var names = Object.getOwnPropertyNames(WinPlatform.prototype); for (var i = 0; i < names.length; i++) { ...
javascript
function WinPlatform(PlatformBase, baseData) { // Create base instance. var instance = new PlatformBase(baseData); // Override manually, because Object.extend() is not yet available on node. var names = Object.getOwnPropertyNames(WinPlatform.prototype); for (var i = 0; i < names.length; i++) { ...
[ "function", "WinPlatform", "(", "PlatformBase", ",", "baseData", ")", "{", "// Create base instance.", "var", "instance", "=", "new", "PlatformBase", "(", "baseData", ")", ";", "// Override manually, because Object.extend() is not yet available on node.", "var", "names", "=...
Interface for project implementations. @constructor @param {Function} PlatformBase Base class constructor {@link PlatformBase} @param {PlatformData} platformData Init data passed to the platform @protected
[ "Interface", "for", "project", "implementations", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/windows/lib/WinPlatform.js#L18-L33
train
crosswalk-project/crosswalk-app-tools
src/util/CrosswalkZip.js
CrosswalkZip
function CrosswalkZip(path) { this._adm = new AdmZip(path); // Derive root entry name from the filename var base = Path.basename(path, ".zip"); this._root = base + "/"; // Extract version var version = base.split("-")[1]; var numbers = version.split("."); this._version = new Version(+...
javascript
function CrosswalkZip(path) { this._adm = new AdmZip(path); // Derive root entry name from the filename var base = Path.basename(path, ".zip"); this._root = base + "/"; // Extract version var version = base.split("-")[1]; var numbers = version.split("."); this._version = new Version(+...
[ "function", "CrosswalkZip", "(", "path", ")", "{", "this", ".", "_adm", "=", "new", "AdmZip", "(", "path", ")", ";", "// Derive root entry name from the filename", "var", "base", "=", "Path", ".", "basename", "(", "path", ",", "\".zip\"", ")", ";", "this", ...
Creates a CrosswalkZip object. @param {String} path Path to downloaded release @constructor
[ "Creates", "a", "CrosswalkZip", "object", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/src/util/CrosswalkZip.js#L19-L31
train
crosswalk-project/crosswalk-app-tools
android/lib/AndroidPlatform.js
AndroidPlatform
function AndroidPlatform(PlatformBase, baseData) { // Create base instance. var instance = new PlatformBase(baseData); var o = instance.output; // Override manually, because Object.extend() is not yet available on node. var names = Object.getOwnPropertyNames(AndroidPlatform.prototype); for (va...
javascript
function AndroidPlatform(PlatformBase, baseData) { // Create base instance. var instance = new PlatformBase(baseData); var o = instance.output; // Override manually, because Object.extend() is not yet available on node. var names = Object.getOwnPropertyNames(AndroidPlatform.prototype); for (va...
[ "function", "AndroidPlatform", "(", "PlatformBase", ",", "baseData", ")", "{", "// Create base instance.", "var", "instance", "=", "new", "PlatformBase", "(", "baseData", ")", ";", "var", "o", "=", "instance", ".", "output", ";", "// Override manually, because Objec...
Android project class. @extends PlatformBase @constructor @param {Function} PlatformBase Base class constructor {@link PlatformBase} @param {PlatformData} baseData Init data passed to the platform @throws {@link AndroidSDK~SDKNotFoundError} If the Android SDK was not found in the environment.
[ "Android", "project", "class", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/android/lib/AndroidPlatform.js#L27-L49
train
crosswalk-project/crosswalk-app-tools
src/util/CrosswalkDir.js
CrosswalkDir
function CrosswalkDir(path) { this._path = path; this._root = "./"; var versionFilePath = Path.join(path, "VERSION"); if (ShellJS.test("-f", versionFilePath)) { this._version = Version.createFromFile(versionFilePath); } else { this._version = Version.createFromPath(path); } ...
javascript
function CrosswalkDir(path) { this._path = path; this._root = "./"; var versionFilePath = Path.join(path, "VERSION"); if (ShellJS.test("-f", versionFilePath)) { this._version = Version.createFromFile(versionFilePath); } else { this._version = Version.createFromPath(path); } ...
[ "function", "CrosswalkDir", "(", "path", ")", "{", "this", ".", "_path", "=", "path", ";", "this", ".", "_root", "=", "\"./\"", ";", "var", "versionFilePath", "=", "Path", ".", "join", "(", "path", ",", "\"VERSION\"", ")", ";", "if", "(", "ShellJS", ...
Creates a CrosswalkDir object. @param {String} path Path to crosswalk build xwalk_app_template @constructor
[ "Creates", "a", "CrosswalkDir", "object", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/src/util/CrosswalkDir.js#L59-L74
train
crosswalk-project/crosswalk-app-tools
src/util/Download01Org.js
Download01Org
function Download01Org(application, platform, channel) { this._application = application; if (Download01Org.PLATFORMS.indexOf(platform) == -1) { throw new Error("Unknown platform " + platform); } this._platform = platform; if (Download01Org.CHANNELS.indexOf(channel) == -1) { throw...
javascript
function Download01Org(application, platform, channel) { this._application = application; if (Download01Org.PLATFORMS.indexOf(platform) == -1) { throw new Error("Unknown platform " + platform); } this._platform = platform; if (Download01Org.CHANNELS.indexOf(channel) == -1) { throw...
[ "function", "Download01Org", "(", "application", ",", "platform", ",", "channel", ")", "{", "this", ".", "_application", "=", "application", ";", "if", "(", "Download01Org", ".", "PLATFORMS", ".", "indexOf", "(", "platform", ")", "==", "-", "1", ")", "{", ...
Crosswalk release lookup and download. @constructor @param {Application} application application instance @param {String} platform Crosswalk release platform android/windows @param {String} channel Crosswalk channel beta/canary/stable @throws {Error} If no valid channel was specified.
[ "Crosswalk", "release", "lookup", "and", "download", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/src/util/Download01Org.js#L43-L60
train
crosswalk-project/crosswalk-app-tools
src/LogfileOutput.js
LogfileOutput
function LogfileOutput(path) { this._path = path; var options = { flags: "w", mode: 0600 }; FS.writeFileSync(this._path, ""); /* TODO if (!this._fp) { throw new FileCreationFailed("Could not open file " + path); } */ }
javascript
function LogfileOutput(path) { this._path = path; var options = { flags: "w", mode: 0600 }; FS.writeFileSync(this._path, ""); /* TODO if (!this._fp) { throw new FileCreationFailed("Could not open file " + path); } */ }
[ "function", "LogfileOutput", "(", "path", ")", "{", "this", ".", "_path", "=", "path", ";", "var", "options", "=", "{", "flags", ":", "\"w\"", ",", "mode", ":", "0600", "}", ";", "FS", ".", "writeFileSync", "(", "this", ".", "_path", ",", "\"\"", "...
Creates an output writing to a file. @extends OutputIface @constructor @param {String} path Path to logfile. Existing content will be overwritten. @throws {exceptions.FileCreationFailed} If file at path could not be opened for writing.
[ "Creates", "an", "output", "writing", "to", "a", "file", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/src/LogfileOutput.js#L19-L35
train
crosswalk-project/crosswalk-app-tools
src/PlatformInfo.js
PlatformInfo
function PlatformInfo(PlatformCtor, platformId) { this._Ctor = PlatformCtor; this._platformId = platformId; // Prefix all platform-specific args with the platform name var argSpec = PlatformCtor.getArgs ? PlatformCtor.getArgs() : {}; this._argSpec = {}; for (var cmd in argSpec) { var c...
javascript
function PlatformInfo(PlatformCtor, platformId) { this._Ctor = PlatformCtor; this._platformId = platformId; // Prefix all platform-specific args with the platform name var argSpec = PlatformCtor.getArgs ? PlatformCtor.getArgs() : {}; this._argSpec = {}; for (var cmd in argSpec) { var c...
[ "function", "PlatformInfo", "(", "PlatformCtor", ",", "platformId", ")", "{", "this", ".", "_Ctor", "=", "PlatformCtor", ";", "this", ".", "_platformId", "=", "platformId", ";", "// Prefix all platform-specific args with the platform name", "var", "argSpec", "=", "Pla...
Encapsulates static backend information, does not depend on an instance. @param {Function} PlatformCtor Constructor function for the platform @param {String} platformId Name for the platform, "android", "ios", ... @constructor
[ "Encapsulates", "static", "backend", "information", "does", "not", "depend", "on", "an", "instance", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/src/PlatformInfo.js#L13-L32
train
crosswalk-project/crosswalk-app-tools
src/CommandParser.js
CommandParser
function CommandParser(output, argv) { this._output = output; if (!(argv instanceof Array)) { throw new TypeError("CommandParser(argv) must be of type Array."); } this._argv = argv; }
javascript
function CommandParser(output, argv) { this._output = output; if (!(argv instanceof Array)) { throw new TypeError("CommandParser(argv) must be of type Array."); } this._argv = argv; }
[ "function", "CommandParser", "(", "output", ",", "argv", ")", "{", "this", ".", "_output", "=", "output", ";", "if", "(", "!", "(", "argv", "instanceof", "Array", ")", ")", "{", "throw", "new", "TypeError", "(", "\"CommandParser(argv) must be of type Array.\""...
Parsing and validation of command-line arguments. @constructor @param {OutputIface} output Output implementation @param {String[]} argv Command-line arguments @throws {TypeError} If argv is not an array.
[ "Parsing", "and", "validation", "of", "command", "-", "line", "arguments", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/src/CommandParser.js#L17-L26
train
crosswalk-project/crosswalk-app-tools
android/lib/AndroidManifest.js
AndroidManifest
function AndroidManifest(output, path) { this._output = output; this._path = path; var doc = this.read(); this._package = doc.documentElement.getAttribute("package"); this._versionCode = doc.documentElement.getAttribute("android:versionCode"); this._versionName = doc.documentElement.getAttribu...
javascript
function AndroidManifest(output, path) { this._output = output; this._path = path; var doc = this.read(); this._package = doc.documentElement.getAttribute("package"); this._versionCode = doc.documentElement.getAttribute("android:versionCode"); this._versionName = doc.documentElement.getAttribu...
[ "function", "AndroidManifest", "(", "output", ",", "path", ")", "{", "this", ".", "_output", "=", "output", ";", "this", ".", "_path", "=", "path", ";", "var", "doc", "=", "this", ".", "read", "(", ")", ";", "this", ".", "_package", "=", "doc", "."...
AndroidManifest wrapper. @param {OutputIface} output Output implementation @param {String} path Path to manifest.json @constructor
[ "AndroidManifest", "wrapper", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/android/lib/AndroidManifest.js#L15-L43
train
crosswalk-project/crosswalk-app-tools
windows/lib/WixSDK.js
WixSDK
function WixSDK(rootPath, manifest, output) { this._rootPath = rootPath; this._manifest = manifest; this._output = output; this._existing_ids = {}; }
javascript
function WixSDK(rootPath, manifest, output) { this._rootPath = rootPath; this._manifest = manifest; this._output = output; this._existing_ids = {}; }
[ "function", "WixSDK", "(", "rootPath", ",", "manifest", ",", "output", ")", "{", "this", ".", "_rootPath", "=", "rootPath", ";", "this", ".", "_manifest", "=", "manifest", ";", "this", ".", "_output", "=", "output", ";", "this", ".", "_existing_ids", "="...
Creates WixSDK object. @param {String} rootPath Root path for project @param {Manifest} manifest Web manifest @param {OutputIface} output Output @constructor
[ "Creates", "WixSDK", "object", "." ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/windows/lib/WixSDK.js#L20-L27
train
crosswalk-project/crosswalk-app-tools
windows/lib/WixSDK.js
installExtensionDlls
function installExtensionDlls(source_dir_path, dest_folder_object) { var app_files = readDir.readSync(source_dir_path); app_files.forEach(function (name) { var suffix = name.substring(name.length - ".dll".length); if (suffix && suffix.toLowerCase() === ".dll") { ...
javascript
function installExtensionDlls(source_dir_path, dest_folder_object) { var app_files = readDir.readSync(source_dir_path); app_files.forEach(function (name) { var suffix = name.substring(name.length - ".dll".length); if (suffix && suffix.toLowerCase() === ".dll") { ...
[ "function", "installExtensionDlls", "(", "source_dir_path", ",", "dest_folder_object", ")", "{", "var", "app_files", "=", "readDir", ".", "readSync", "(", "source_dir_path", ")", ";", "app_files", ".", "forEach", "(", "function", "(", "name", ")", "{", "var", ...
Install all files with suffix .dll from @source_dir_path
[ "Install", "all", "files", "with", "suffix", ".", "dll", "from" ]
2771b2fa4326c2453b41de393284de68a2fe7eac
https://github.com/crosswalk-project/crosswalk-app-tools/blob/2771b2fa4326c2453b41de393284de68a2fe7eac/windows/lib/WixSDK.js#L259-L267
train
raml-org/ramldt2jsonschema
src/utils.js
updateObjWith
function updateObjWith (obj, upd) { for (const key in upd) { obj[key] = upd[key] } return obj }
javascript
function updateObjWith (obj, upd) { for (const key in upd) { obj[key] = upd[key] } return obj }
[ "function", "updateObjWith", "(", "obj", ",", "upd", ")", "{", "for", "(", "const", "key", "in", "upd", ")", "{", "obj", "[", "key", "]", "=", "upd", "[", "key", "]", "}", "return", "obj", "}" ]
Merge second object into first one. @param {Object} obj @param {Object} upd @returns {Object}
[ "Merge", "second", "object", "into", "first", "one", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/utils.js#L10-L15
train
raml-org/ramldt2jsonschema
src/utils.js
inferRAMLTypeName
function inferRAMLTypeName (fileName) { const cleanName = fileName.replace(/^.*[\\/]/, '') const filename = cleanName.split('.')[0] return capitalize(filename) }
javascript
function inferRAMLTypeName (fileName) { const cleanName = fileName.replace(/^.*[\\/]/, '') const filename = cleanName.split('.')[0] return capitalize(filename) }
[ "function", "inferRAMLTypeName", "(", "fileName", ")", "{", "const", "cleanName", "=", "fileName", ".", "replace", "(", "/", "^.*[\\\\/]", "/", ",", "''", ")", "const", "filename", "=", "cleanName", ".", "split", "(", "'.'", ")", "[", "0", "]", "return",...
Infer RAML type name from file name @param {string} fileName - File in which type is located. @returns {string}
[ "Infer", "RAML", "type", "name", "from", "file", "name" ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/utils.js#L44-L48
train
raml-org/ramldt2jsonschema
src/dt2js_cli.js
dt2jsCLI
function dt2jsCLI (ramlFile, ramlTypeName) { const rootFileDir = ramlFile.split(path.sep).slice(0, -1).join(path.sep) const ramlData = fs.readFileSync(ramlFile).toString() dt2js.setBasePath(rootFileDir) return dt2js.dt2js(ramlData, ramlTypeName) }
javascript
function dt2jsCLI (ramlFile, ramlTypeName) { const rootFileDir = ramlFile.split(path.sep).slice(0, -1).join(path.sep) const ramlData = fs.readFileSync(ramlFile).toString() dt2js.setBasePath(rootFileDir) return dt2js.dt2js(ramlData, ramlTypeName) }
[ "function", "dt2jsCLI", "(", "ramlFile", ",", "ramlTypeName", ")", "{", "const", "rootFileDir", "=", "ramlFile", ".", "split", "(", "path", ".", "sep", ")", ".", "slice", "(", "0", ",", "-", "1", ")", ".", "join", "(", "path", ".", "sep", ")", "con...
Just call dt2js. @param {string} ramlFile @param {string} ramlTypeName
[ "Just", "call", "dt2js", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js_cli.js#L13-L18
train
raml-org/ramldt2jsonschema
src/js2dt_cli.js
js2dtCLI
function js2dtCLI (jsonFile, ramlTypeName) { const jsonData = fs.readFileSync(jsonFile).toString() if (ramlTypeName != null) { const raml = js2dt.js2dt(jsonData, ramlTypeName) return `#%RAML 1.0 Library\n${yaml.safeDump({ types: raml }, { 'noRefs': true })}` } else { const typeName = 'this__should__b...
javascript
function js2dtCLI (jsonFile, ramlTypeName) { const jsonData = fs.readFileSync(jsonFile).toString() if (ramlTypeName != null) { const raml = js2dt.js2dt(jsonData, ramlTypeName) return `#%RAML 1.0 Library\n${yaml.safeDump({ types: raml }, { 'noRefs': true })}` } else { const typeName = 'this__should__b...
[ "function", "js2dtCLI", "(", "jsonFile", ",", "ramlTypeName", ")", "{", "const", "jsonData", "=", "fs", ".", "readFileSync", "(", "jsonFile", ")", ".", "toString", "(", ")", "if", "(", "ramlTypeName", "!=", "null", ")", "{", "const", "raml", "=", "js2dt"...
Just call js2dt. @param {string} jsonFile @param {string} ramlTypeName
[ "Just", "call", "js2dt", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/js2dt_cli.js#L13-L30
train
raml-org/ramldt2jsonschema
src/dt2js.js
getRAMLContext
function getRAMLContext (ramlData, rootFileDir) { rootFileDir = rootFileDir || '.' const ast = yap.load(ramlData) const libraries = extractLibraries(ast, rootFileDir) const jsContent = {} traverse(jsContent, ast, rootFileDir, libraries) return jsContent.types }
javascript
function getRAMLContext (ramlData, rootFileDir) { rootFileDir = rootFileDir || '.' const ast = yap.load(ramlData) const libraries = extractLibraries(ast, rootFileDir) const jsContent = {} traverse(jsContent, ast, rootFileDir, libraries) return jsContent.types }
[ "function", "getRAMLContext", "(", "ramlData", ",", "rootFileDir", ")", "{", "rootFileDir", "=", "rootFileDir", "||", "'.'", "const", "ast", "=", "yap", ".", "load", "(", "ramlData", ")", "const", "libraries", "=", "extractLibraries", "(", "ast", ",", "rootF...
Get RAML Data Types context. @param {string} ramlData - RAML file content. @param {string} rootFileDir - RAML file directory. @returns {Object} - RAML data types context.
[ "Get", "RAML", "Data", "Types", "context", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js.js#L22-L29
train
raml-org/ramldt2jsonschema
src/dt2js.js
destringify
function destringify (val) { if (!isNaN(Number(val))) return Number(val) if (val === 'true') return true if (val === 'false') return false return val }
javascript
function destringify (val) { if (!isNaN(Number(val))) return Number(val) if (val === 'true') return true if (val === 'false') return false return val }
[ "function", "destringify", "(", "val", ")", "{", "if", "(", "!", "isNaN", "(", "Number", "(", "val", ")", ")", ")", "return", "Number", "(", "val", ")", "if", "(", "val", "===", "'true'", ")", "return", "true", "if", "(", "val", "===", "'false'", ...
restore ints and booleans stored as strings @param {String} val - the value to be tested and possibly converted @returns {Mixed} - either a string, int or boolean.
[ "restore", "ints", "and", "booleans", "stored", "as", "strings" ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js.js#L37-L42
train
raml-org/ramldt2jsonschema
src/dt2js.js
traverse
function traverse (obj, ast, rootFileDir, libraries) { function recurse (keys, currentNode, nodeFileDir) { if (currentNode.key) { keys = keys.concat([currentNode.key.value]) } // kind 5 is an include if (currentNode.value && currentNode.value.kind === 5) { const location = currentNode.valu...
javascript
function traverse (obj, ast, rootFileDir, libraries) { function recurse (keys, currentNode, nodeFileDir) { if (currentNode.key) { keys = keys.concat([currentNode.key.value]) } // kind 5 is an include if (currentNode.value && currentNode.value.kind === 5) { const location = currentNode.valu...
[ "function", "traverse", "(", "obj", ",", "ast", ",", "rootFileDir", ",", "libraries", ")", "{", "function", "recurse", "(", "keys", ",", "currentNode", ",", "nodeFileDir", ")", "{", "if", "(", "currentNode", ".", "key", ")", "{", "keys", "=", "keys", "...
traverses AST generated by yaml-ast-parser and create json object.. @param {Object} obj - The object to hold the parsed raml @param {Object} ast - The ast from yaml-ast-parser @param {String} rootFileDir - a directory to be used as cwd while resolving includes @param {Object} libraries - an object holding librarie...
[ "traverses", "AST", "generated", "by", "yaml", "-", "ast", "-", "parser", "and", "create", "json", "object", ".." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js.js#L127-L187
train
raml-org/ramldt2jsonschema
src/dt2js.js
dt2js
function dt2js (ramlData, typeName) { const ctx = getRAMLContext(ramlData, basePath) if (!(ctx instanceof Object)) throw new Error('Invalid RAML data') if (ctx[typeName] === undefined) throw new Error('type ' + typeName + ' does not exist') const expanded = expandedForm(ctx[typeName], ctx) const canonical =...
javascript
function dt2js (ramlData, typeName) { const ctx = getRAMLContext(ramlData, basePath) if (!(ctx instanceof Object)) throw new Error('Invalid RAML data') if (ctx[typeName] === undefined) throw new Error('type ' + typeName + ' does not exist') const expanded = expandedForm(ctx[typeName], ctx) const canonical =...
[ "function", "dt2js", "(", "ramlData", ",", "typeName", ")", "{", "const", "ctx", "=", "getRAMLContext", "(", "ramlData", ",", "basePath", ")", "if", "(", "!", "(", "ctx", "instanceof", "Object", ")", ")", "throw", "new", "Error", "(", "'Invalid RAML data'"...
Convert RAML data type to JSON schema. @param {string} ramlData - RAML file content. @param {string} typeName - Name of the type to be converted.
[ "Convert", "RAML", "data", "type", "to", "JSON", "schema", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js.js#L212-L225
train
raml-org/ramldt2jsonschema
src/dt2js.js
processArray
function processArray (arr, reqStack) { const accum = [] arr.forEach(function (el) { accum.push(schemaForm(el, reqStack)) }) return accum }
javascript
function processArray (arr, reqStack) { const accum = [] arr.forEach(function (el) { accum.push(schemaForm(el, reqStack)) }) return accum }
[ "function", "processArray", "(", "arr", ",", "reqStack", ")", "{", "const", "accum", "=", "[", "]", "arr", ".", "forEach", "(", "function", "(", "el", ")", "{", "accum", ".", "push", "(", "schemaForm", "(", "el", ",", "reqStack", ")", ")", "}", ")"...
Call `schemaForm` for each element of array. @param {Array} arr @param {Array} reqStack - Stack of required properties. @returns {Array}
[ "Call", "schemaForm", "for", "each", "element", "of", "array", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js.js#L245-L251
train
raml-org/ramldt2jsonschema
src/dt2js.js
convertType
function convertType (data) { switch (data.type) { case 'union': // If union of arrays if (Array.isArray(data.anyOf) && data.anyOf[0].type === 'array') { const items = data.anyOf.map(function (e) { return e.items }) data.items = { anyOf: [] } data.items.anyOf = items da...
javascript
function convertType (data) { switch (data.type) { case 'union': // If union of arrays if (Array.isArray(data.anyOf) && data.anyOf[0].type === 'array') { const items = data.anyOf.map(function (e) { return e.items }) data.items = { anyOf: [] } data.items.anyOf = items da...
[ "function", "convertType", "(", "data", ")", "{", "switch", "(", "data", ".", "type", ")", "{", "case", "'union'", ":", "// If union of arrays", "if", "(", "Array", ".", "isArray", "(", "data", ".", "anyOf", ")", "&&", "data", ".", "anyOf", "[", "0", ...
Change RAML type of data to valid JSON schema type. @param {Object} data @returns {Object}
[ "Change", "RAML", "type", "of", "data", "to", "valid", "JSON", "schema", "type", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js.js#L259-L281
train
raml-org/ramldt2jsonschema
src/dt2js.js
convertFileType
function convertFileType (data) { data['type'] = 'string' data['media'] = { 'binaryEncoding': 'binary' } if (data.fileTypes) { data['media']['anyOf'] = [] data.fileTypes.forEach(function (el) { data['media']['anyOf'].push({ 'mediaType': el }) }) delete data.fileTypes } return data }
javascript
function convertFileType (data) { data['type'] = 'string' data['media'] = { 'binaryEncoding': 'binary' } if (data.fileTypes) { data['media']['anyOf'] = [] data.fileTypes.forEach(function (el) { data['media']['anyOf'].push({ 'mediaType': el }) }) delete data.fileTypes } return data }
[ "function", "convertFileType", "(", "data", ")", "{", "data", "[", "'type'", "]", "=", "'string'", "data", "[", "'media'", "]", "=", "{", "'binaryEncoding'", ":", "'binary'", "}", "if", "(", "data", ".", "fileTypes", ")", "{", "data", "[", "'media'", "...
Change RAML `file` type to proper JSON type. @param {Object} data @returns {Object}
[ "Change", "RAML", "file", "type", "to", "proper", "JSON", "type", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js.js#L289-L300
train
raml-org/ramldt2jsonschema
src/dt2js.js
convertDateType
function convertDateType (data) { switch (data.type) { case 'date-only': data['type'] = 'string' data['pattern'] = constants.dateOnlyPattern break case 'time-only': data['type'] = 'string' data['pattern'] = constants.timeOnlyPattern break case 'datetime-only': dat...
javascript
function convertDateType (data) { switch (data.type) { case 'date-only': data['type'] = 'string' data['pattern'] = constants.dateOnlyPattern break case 'time-only': data['type'] = 'string' data['pattern'] = constants.timeOnlyPattern break case 'datetime-only': dat...
[ "function", "convertDateType", "(", "data", ")", "{", "switch", "(", "data", ".", "type", ")", "{", "case", "'date-only'", ":", "data", "[", "'type'", "]", "=", "'string'", "data", "[", "'pattern'", "]", "=", "constants", ".", "dateOnlyPattern", "break", ...
Change RAML date type of data to valid JSON schema type. @param {Object} data @returns {Object}
[ "Change", "RAML", "date", "type", "of", "data", "to", "valid", "JSON", "schema", "type", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js.js#L308-L333
train
raml-org/ramldt2jsonschema
src/dt2js.js
convertPatternProperties
function convertPatternProperties (data) { Object.keys(data.properties).map(function (key) { if (/^\/.*\/$/.test(key)) { data.patternProperties = data.patternProperties || {} const stringRegex = key.slice(1, -1) data.patternProperties[stringRegex] = data.properties[key] delete data.propert...
javascript
function convertPatternProperties (data) { Object.keys(data.properties).map(function (key) { if (/^\/.*\/$/.test(key)) { data.patternProperties = data.patternProperties || {} const stringRegex = key.slice(1, -1) data.patternProperties[stringRegex] = data.properties[key] delete data.propert...
[ "function", "convertPatternProperties", "(", "data", ")", "{", "Object", ".", "keys", "(", "data", ".", "properties", ")", ".", "map", "(", "function", "(", "key", ")", "{", "if", "(", "/", "^\\/.*\\/$", "/", ".", "test", "(", "key", ")", ")", "{", ...
Change RAML pattern properties to JSON patternProperties. @param {Object} data - the library fragment to convert @returns {Object}
[ "Change", "RAML", "pattern", "properties", "to", "JSON", "patternProperties", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js.js#L341-L351
train
raml-org/ramldt2jsonschema
src/dt2js.js
processNested
function processNested (data, reqStack) { const updateWith = {} for (const key in data) { const val = data[key] if (val instanceof Array) { updateWith[key] = processArray(val, reqStack) continue } if (val instanceof Object) { updateWith[key] = schemaForm(val, reqStack, key) ...
javascript
function processNested (data, reqStack) { const updateWith = {} for (const key in data) { const val = data[key] if (val instanceof Array) { updateWith[key] = processArray(val, reqStack) continue } if (val instanceof Object) { updateWith[key] = schemaForm(val, reqStack, key) ...
[ "function", "processNested", "(", "data", ",", "reqStack", ")", "{", "const", "updateWith", "=", "{", "}", "for", "(", "const", "key", "in", "data", ")", "{", "const", "val", "=", "data", "[", "key", "]", "if", "(", "val", "instanceof", "Array", ")",...
Call `schemaForm` for all nested objects. @param {Object} data @param {Array} reqStack - Stack of required properties. @returns {Object}
[ "Call", "schemaForm", "for", "all", "nested", "objects", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js.js#L372-L388
train
raml-org/ramldt2jsonschema
src/dt2js.js
schemaForm
function schemaForm (data, reqStack = [], prop) { if (!(data instanceof Object)) { return data } const lastEl = reqStack[reqStack.length - 1] if (data.type && data.required !== false && lastEl && prop) { if (lastEl.props.indexOf(prop) > -1 && (prop[0] + prop[prop.length - 1]) !== '//') { lastEl.re...
javascript
function schemaForm (data, reqStack = [], prop) { if (!(data instanceof Object)) { return data } const lastEl = reqStack[reqStack.length - 1] if (data.type && data.required !== false && lastEl && prop) { if (lastEl.props.indexOf(prop) > -1 && (prop[0] + prop[prop.length - 1]) !== '//') { lastEl.re...
[ "function", "schemaForm", "(", "data", ",", "reqStack", "=", "[", "]", ",", "prop", ")", "{", "if", "(", "!", "(", "data", "instanceof", "Object", ")", ")", "{", "return", "data", "}", "const", "lastEl", "=", "reqStack", "[", "reqStack", ".", "length...
Convert canonical form of RAML type to valid JSON schema. @param {Object} data - Data to be converted. @param {Array} reqStack - Stack of required properties. @param {string} [prop] - Property name nested objects of which are processed. @returns {Object}
[ "Convert", "canonical", "form", "of", "RAML", "type", "to", "valid", "JSON", "schema", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/dt2js.js#L398-L442
train
raml-org/ramldt2jsonschema
src/js2dt.js
js2dt
function js2dt (jsonData, typeName) { const data = JSON.parse(jsonData) const raml = new RamlConverter(data, typeName).toRaml() return raml }
javascript
function js2dt (jsonData, typeName) { const data = JSON.parse(jsonData) const raml = new RamlConverter(data, typeName).toRaml() return raml }
[ "function", "js2dt", "(", "jsonData", ",", "typeName", ")", "{", "const", "data", "=", "JSON", ".", "parse", "(", "jsonData", ")", "const", "raml", "=", "new", "RamlConverter", "(", "data", ",", "typeName", ")", ".", "toRaml", "(", ")", "return", "raml...
Convert JSON schema to RAML data type. @param {string} jsonData - JSON file content. @param {string} typeName - Name of RAML data type to hold converted data.
[ "Convert", "JSON", "schema", "to", "RAML", "data", "type", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/js2dt.js#L27-L33
train
raml-org/ramldt2jsonschema
src/js2dt.js
convertAdditionalProperties
function convertAdditionalProperties (data, additionalProperties) { if (additionalProperties !== undefined) { let val = data if (typeof additionalProperties === 'boolean') val = additionalProperties if (typeof additionalProperties === 'object' && Object.keys(additionalProperties).length === 0) val = true ...
javascript
function convertAdditionalProperties (data, additionalProperties) { if (additionalProperties !== undefined) { let val = data if (typeof additionalProperties === 'boolean') val = additionalProperties if (typeof additionalProperties === 'object' && Object.keys(additionalProperties).length === 0) val = true ...
[ "function", "convertAdditionalProperties", "(", "data", ",", "additionalProperties", ")", "{", "if", "(", "additionalProperties", "!==", "undefined", ")", "{", "let", "val", "=", "data", "if", "(", "typeof", "additionalProperties", "===", "'boolean'", ")", "val", ...
convert additionalProperties from jsonSchema to raml form @param {Object} data - current data @param {*} additionalProperties - potential additional properties @returns {Object} raml form
[ "convert", "additionalProperties", "from", "jsonSchema", "to", "raml", "form" ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/js2dt.js#L239-L252
train
raml-org/ramldt2jsonschema
src/js2dt.js
convertFileType
function convertFileType (data) { data['type'] = 'file' const anyOf = data.media.anyOf if (anyOf && anyOf.length > 0) { data['fileTypes'] = [] anyOf.forEach(function (el) { if (el.mediaType) { data.fileTypes.push(el.mediaType) } }) if (data.fileTypes.length < 1) { delete ...
javascript
function convertFileType (data) { data['type'] = 'file' const anyOf = data.media.anyOf if (anyOf && anyOf.length > 0) { data['fileTypes'] = [] anyOf.forEach(function (el) { if (el.mediaType) { data.fileTypes.push(el.mediaType) } }) if (data.fileTypes.length < 1) { delete ...
[ "function", "convertFileType", "(", "data", ")", "{", "data", "[", "'type'", "]", "=", "'file'", "const", "anyOf", "=", "data", ".", "media", ".", "anyOf", "if", "(", "anyOf", "&&", "anyOf", ".", "length", ">", "0", ")", "{", "data", "[", "'fileTypes...
Change JSON type to RAML file type. @param {Object} data @returns {Object}
[ "Change", "JSON", "type", "to", "RAML", "file", "type", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/js2dt.js#L286-L302
train
raml-org/ramldt2jsonschema
src/js2dt.js
convertDateType
function convertDateType (data) { if (!(data.type === 'string' && data.pattern)) { return data } const pattern = data.pattern delete data.pattern switch (pattern) { case constants.dateOnlyPattern: data['type'] = 'date-only' break case constants.timeOnlyPattern: data['type'] = 'ti...
javascript
function convertDateType (data) { if (!(data.type === 'string' && data.pattern)) { return data } const pattern = data.pattern delete data.pattern switch (pattern) { case constants.dateOnlyPattern: data['type'] = 'date-only' break case constants.timeOnlyPattern: data['type'] = 'ti...
[ "function", "convertDateType", "(", "data", ")", "{", "if", "(", "!", "(", "data", ".", "type", "===", "'string'", "&&", "data", ".", "pattern", ")", ")", "{", "return", "data", "}", "const", "pattern", "=", "data", ".", "pattern", "delete", "data", ...
Change JSON date type of data to valid RAML date type. @param {Object} data @returns {Object}
[ "Change", "JSON", "date", "type", "of", "data", "to", "valid", "RAML", "date", "type", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/js2dt.js#L310-L338
train
raml-org/ramldt2jsonschema
src/js2dt.js
convertDefinedFormat
function convertDefinedFormat (data) { if (!(data.type === 'string' && data.format)) { return data } const format = data.format delete data.format switch (format) { case 'date-time': data['pattern'] = constants.FORMAT_REGEXPS['date-time'] break case 'email': data['pattern'] = con...
javascript
function convertDefinedFormat (data) { if (!(data.type === 'string' && data.format)) { return data } const format = data.format delete data.format switch (format) { case 'date-time': data['pattern'] = constants.FORMAT_REGEXPS['date-time'] break case 'email': data['pattern'] = con...
[ "function", "convertDefinedFormat", "(", "data", ")", "{", "if", "(", "!", "(", "data", ".", "type", "===", "'string'", "&&", "data", ".", "format", ")", ")", "{", "return", "data", "}", "const", "format", "=", "data", ".", "format", "delete", "data", ...
Change JSON defined formats to RAML regex. @param {Object} data @returns {Object}
[ "Change", "JSON", "defined", "formats", "to", "RAML", "regex", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/js2dt.js#L346-L384
train
raml-org/ramldt2jsonschema
src/js2dt.js
convertPatternProperties
function convertPatternProperties (data) { if (!data.patternProperties) { return data } data.properties = data.properties || {} const patternProperties = data.patternProperties delete data.patternProperties Object.keys(patternProperties).map(function (pattern) { data.properties['/' + pattern + '/'] ...
javascript
function convertPatternProperties (data) { if (!data.patternProperties) { return data } data.properties = data.properties || {} const patternProperties = data.patternProperties delete data.patternProperties Object.keys(patternProperties).map(function (pattern) { data.properties['/' + pattern + '/'] ...
[ "function", "convertPatternProperties", "(", "data", ")", "{", "if", "(", "!", "data", ".", "patternProperties", ")", "{", "return", "data", "}", "data", ".", "properties", "=", "data", ".", "properties", "||", "{", "}", "const", "patternProperties", "=", ...
Change JSON patternProperties to RAML pattern properties. @param {Object} data @returns {Object}
[ "Change", "JSON", "patternProperties", "to", "RAML", "pattern", "properties", "." ]
1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7
https://github.com/raml-org/ramldt2jsonschema/blob/1e7a507bbf12e17a6ff6058d26ce3ba47cadd1a7/src/js2dt.js#L392-L404
train
VoliJS/NestedLink
linked-controls/js/hooks.js
useThrottle
function useThrottle(fun, timeout, changes) { if (changes === void 0) { changes = []; } // Create the ref to store timer. var timer = react_1.useRef(null); function cancel() { if (timer.current) { clearTimeout(timer.current); timer.current = null; } } // R...
javascript
function useThrottle(fun, timeout, changes) { if (changes === void 0) { changes = []; } // Create the ref to store timer. var timer = react_1.useRef(null); function cancel() { if (timer.current) { clearTimeout(timer.current); timer.current = null; } } // R...
[ "function", "useThrottle", "(", "fun", ",", "timeout", ",", "changes", ")", "{", "if", "(", "changes", "===", "void", "0", ")", "{", "changes", "=", "[", "]", ";", "}", "// Create the ref to store timer.", "var", "timer", "=", "react_1", ".", "useRef", "...
Delays function calls for a given timeout.
[ "Delays", "function", "calls", "for", "a", "given", "timeout", "." ]
0105d461d33108d2ab2d97b8f8da6967878844d6
https://github.com/VoliJS/NestedLink/blob/0105d461d33108d2ab2d97b8f8da6967878844d6/linked-controls/js/hooks.js#L5-L29
train
johannesjo/angular-promise-buttons
dist/angular-promise-buttons.js
initLoadingState
function initLoadingState(btnEl) { if (cfg.btnLoadingClass && !cfg.addClassToCurrentBtnOnly) { btnEl.addClass(cfg.btnLoadingClass); } if (cfg.disableBtn && !cfg.disableCurrentBtnOnly) { btnEl.attr('disabled', 'disabled'); } }
javascript
function initLoadingState(btnEl) { if (cfg.btnLoadingClass && !cfg.addClassToCurrentBtnOnly) { btnEl.addClass(cfg.btnLoadingClass); } if (cfg.disableBtn && !cfg.disableCurrentBtnOnly) { btnEl.attr('disabled', 'disabled'); } }
[ "function", "initLoadingState", "(", "btnEl", ")", "{", "if", "(", "cfg", ".", "btnLoadingClass", "&&", "!", "cfg", ".", "addClassToCurrentBtnOnly", ")", "{", "btnEl", ".", "addClass", "(", "cfg", ".", "btnLoadingClass", ")", ";", "}", "if", "(", "cfg", ...
Handles everything to be triggered when the button is set to loading state. @param {Object}btnEl
[ "Handles", "everything", "to", "be", "triggered", "when", "the", "button", "is", "set", "to", "loading", "state", "." ]
969197cfe8cbaea055b8d620016deb0c88dce7e4
https://github.com/johannesjo/angular-promise-buttons/blob/969197cfe8cbaea055b8d620016deb0c88dce7e4/dist/angular-promise-buttons.js#L32-L39
train
johannesjo/angular-promise-buttons
dist/angular-promise-buttons.js
handleLoadingFinished
function handleLoadingFinished(btnEl) { if ((!cfg.minDuration || minDurationTimeoutDone) && promiseDone) { if (cfg.btnLoadingClass) { btnEl.removeClass(cfg.btnLoadingClass); } if (cfg.disableBtn && !scope.ngDisabled) { btnEl.removeAttr('disabled'...
javascript
function handleLoadingFinished(btnEl) { if ((!cfg.minDuration || minDurationTimeoutDone) && promiseDone) { if (cfg.btnLoadingClass) { btnEl.removeClass(cfg.btnLoadingClass); } if (cfg.disableBtn && !scope.ngDisabled) { btnEl.removeAttr('disabled'...
[ "function", "handleLoadingFinished", "(", "btnEl", ")", "{", "if", "(", "(", "!", "cfg", ".", "minDuration", "||", "minDurationTimeoutDone", ")", "&&", "promiseDone", ")", "{", "if", "(", "cfg", ".", "btnLoadingClass", ")", "{", "btnEl", ".", "removeClass", ...
Handles everything to be triggered when loading is finished @param {Object}btnEl
[ "Handles", "everything", "to", "be", "triggered", "when", "loading", "is", "finished" ]
969197cfe8cbaea055b8d620016deb0c88dce7e4
https://github.com/johannesjo/angular-promise-buttons/blob/969197cfe8cbaea055b8d620016deb0c88dce7e4/dist/angular-promise-buttons.js#L45-L54
train
johannesjo/angular-promise-buttons
dist/angular-promise-buttons.js
initPromiseWatcher
function initPromiseWatcher(watchExpressionForPromise, btnEl) { // watch promise to resolve or fail scope.$watch(watchExpressionForPromise, function (mVal) { minDurationTimeoutDone = false; promiseDone = false; // create timeout if option is set if (c...
javascript
function initPromiseWatcher(watchExpressionForPromise, btnEl) { // watch promise to resolve or fail scope.$watch(watchExpressionForPromise, function (mVal) { minDurationTimeoutDone = false; promiseDone = false; // create timeout if option is set if (c...
[ "function", "initPromiseWatcher", "(", "watchExpressionForPromise", ",", "btnEl", ")", "{", "// watch promise to resolve or fail", "scope", ".", "$watch", "(", "watchExpressionForPromise", ",", "function", "(", "mVal", ")", "{", "minDurationTimeoutDone", "=", "false", "...
Initializes a watcher for the promise. Also takes cfg.minDuration into account if given. @param {Function}watchExpressionForPromise @param {Object}btnEl
[ "Initializes", "a", "watcher", "for", "the", "promise", ".", "Also", "takes", "cfg", ".", "minDuration", "into", "account", "if", "given", "." ]
969197cfe8cbaea055b8d620016deb0c88dce7e4
https://github.com/johannesjo/angular-promise-buttons/blob/969197cfe8cbaea055b8d620016deb0c88dce7e4/dist/angular-promise-buttons.js#L62-L109
train
johannesjo/angular-promise-buttons
dist/angular-promise-buttons.js
addHandlersForCurrentBtnOnly
function addHandlersForCurrentBtnOnly(btnEl) { // handle current button only options via click if (cfg.addClassToCurrentBtnOnly) { btnEl.on(cfg.CLICK_EVENT, function () { btnEl.addClass(cfg.btnLoadingClass); }); } if (cfg.disableCurrentBtnOn...
javascript
function addHandlersForCurrentBtnOnly(btnEl) { // handle current button only options via click if (cfg.addClassToCurrentBtnOnly) { btnEl.on(cfg.CLICK_EVENT, function () { btnEl.addClass(cfg.btnLoadingClass); }); } if (cfg.disableCurrentBtnOn...
[ "function", "addHandlersForCurrentBtnOnly", "(", "btnEl", ")", "{", "// handle current button only options via click", "if", "(", "cfg", ".", "addClassToCurrentBtnOnly", ")", "{", "btnEl", ".", "on", "(", "cfg", ".", "CLICK_EVENT", ",", "function", "(", ")", "{", ...
Used to limit loading state to show only for the currently clicked button. @param {Object}btnEl
[ "Used", "to", "limit", "loading", "state", "to", "show", "only", "for", "the", "currently", "clicked", "button", "." ]
969197cfe8cbaea055b8d620016deb0c88dce7e4
https://github.com/johannesjo/angular-promise-buttons/blob/969197cfe8cbaea055b8d620016deb0c88dce7e4/dist/angular-promise-buttons.js#L139-L152
train
johannesjo/angular-promise-buttons
dist/angular-promise-buttons.js
getSubmitBtnChildren
function getSubmitBtnChildren(formEl) { var submitBtnEls = []; var allButtonEls = formEl.find(angularPromiseButtons.config.BTN_SELECTOR); for (var i = 0; i < allButtonEls.length; i++) { var btnEl = allButtonEls[i]; if (angular.element(btnEl) .attr('ty...
javascript
function getSubmitBtnChildren(formEl) { var submitBtnEls = []; var allButtonEls = formEl.find(angularPromiseButtons.config.BTN_SELECTOR); for (var i = 0; i < allButtonEls.length; i++) { var btnEl = allButtonEls[i]; if (angular.element(btnEl) .attr('ty...
[ "function", "getSubmitBtnChildren", "(", "formEl", ")", "{", "var", "submitBtnEls", "=", "[", "]", ";", "var", "allButtonEls", "=", "formEl", ".", "find", "(", "angularPromiseButtons", ".", "config", ".", "BTN_SELECTOR", ")", ";", "for", "(", "var", "i", "...
Get's all submit button children of the given element @param {Object}formEl @returns {Object}
[ "Get", "s", "all", "submit", "button", "children", "of", "the", "given", "element" ]
969197cfe8cbaea055b8d620016deb0c88dce7e4
https://github.com/johannesjo/angular-promise-buttons/blob/969197cfe8cbaea055b8d620016deb0c88dce7e4/dist/angular-promise-buttons.js#L221-L233
train
tkoenig89/express-static-gzip
util/options.js
sanitizeOptions
function sanitizeOptions(userOptions) { userOptions = userOptions || {}; let options = { index: getIndexValue(userOptions) } if(userOptions.index){ // required to not interfere with serve-static delete userOptions.index; } if (typeof (userOptions.enableBrotli) !== "und...
javascript
function sanitizeOptions(userOptions) { userOptions = userOptions || {}; let options = { index: getIndexValue(userOptions) } if(userOptions.index){ // required to not interfere with serve-static delete userOptions.index; } if (typeof (userOptions.enableBrotli) !== "und...
[ "function", "sanitizeOptions", "(", "userOptions", ")", "{", "userOptions", "=", "userOptions", "||", "{", "}", ";", "let", "options", "=", "{", "index", ":", "getIndexValue", "(", "userOptions", ")", "}", "if", "(", "userOptions", ".", "index", ")", "{", ...
Prepares the options object for later use. Strips away any options used for serve-static. Removes problematic options from the input options object. @param {{enableBrotli?:boolean, customCompressions?:[{encodingName:string,fileExtension:string}], indexFromEmptyFile?:boolean, index?: boolean}} userOptions
[ "Prepares", "the", "options", "object", "for", "later", "use", ".", "Strips", "away", "any", "options", "used", "for", "serve", "-", "static", ".", "Removes", "problematic", "options", "from", "the", "input", "options", "object", "." ]
a08cffaa47632d3b94a48508fc97104de72f93e1
https://github.com/tkoenig89/express-static-gzip/blob/a08cffaa47632d3b94a48508fc97104de72f93e1/util/options.js#L7-L32
train
tkoenig89/express-static-gzip
index.js
setupCompressions
function setupCompressions() { //register all provided compressions if (opts.customCompressions && opts.customCompressions.length > 0) { for (var i = 0; i < opts.customCompressions.length; i++) { var customCompression = opts.customCompressions[i]; registerComp...
javascript
function setupCompressions() { //register all provided compressions if (opts.customCompressions && opts.customCompressions.length > 0) { for (var i = 0; i < opts.customCompressions.length; i++) { var customCompression = opts.customCompressions[i]; registerComp...
[ "function", "setupCompressions", "(", ")", "{", "//register all provided compressions", "if", "(", "opts", ".", "customCompressions", "&&", "opts", ".", "customCompressions", ".", "length", ">", "0", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<",...
Reads the options into a list of available compressions.
[ "Reads", "the", "options", "into", "a", "list", "of", "available", "compressions", "." ]
a08cffaa47632d3b94a48508fc97104de72f93e1
https://github.com/tkoenig89/express-static-gzip/blob/a08cffaa47632d3b94a48508fc97104de72f93e1/index.js#L59-L75
train
tkoenig89/express-static-gzip
index.js
convertToCompressedRequest
function convertToCompressedRequest(req, res, compression) { var type = mime.lookup(req.path); var charset = mime.charsets.lookup(type); var search = req.url.split('?').splice(1).join('?'); if (search !== "") { search = "?" + search; } req.url = req.path + c...
javascript
function convertToCompressedRequest(req, res, compression) { var type = mime.lookup(req.path); var charset = mime.charsets.lookup(type); var search = req.url.split('?').splice(1).join('?'); if (search !== "") { search = "?" + search; } req.url = req.path + c...
[ "function", "convertToCompressedRequest", "(", "req", ",", "res", ",", "compression", ")", "{", "var", "type", "=", "mime", ".", "lookup", "(", "req", ".", "path", ")", ";", "var", "charset", "=", "mime", ".", "charsets", ".", "lookup", "(", "type", ")...
Changes the url and adds required headers to serve a compressed file. @param {Object} req @param {Object} res
[ "Changes", "the", "url", "and", "adds", "required", "headers", "to", "serve", "a", "compressed", "file", "." ]
a08cffaa47632d3b94a48508fc97104de72f93e1
https://github.com/tkoenig89/express-static-gzip/blob/a08cffaa47632d3b94a48508fc97104de72f93e1/index.js#L82-L94
train
tkoenig89/express-static-gzip
index.js
findAvailableCompressionForFile
function findAvailableCompressionForFile(compressionList, acceptedEncoding) { if (acceptedEncoding) { for (var i = 0; i < compressionList.length; i++) { if (acceptedEncoding.indexOf(compressionList[i].encodingName) >= 0) { return compressionList[i]; ...
javascript
function findAvailableCompressionForFile(compressionList, acceptedEncoding) { if (acceptedEncoding) { for (var i = 0; i < compressionList.length; i++) { if (acceptedEncoding.indexOf(compressionList[i].encodingName) >= 0) { return compressionList[i]; ...
[ "function", "findAvailableCompressionForFile", "(", "compressionList", ",", "acceptedEncoding", ")", "{", "if", "(", "acceptedEncoding", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "compressionList", ".", "length", ";", "i", "++", ")", "{", ...
Searches for the first matching compression available from the given compressions. @param {[Compression]} compressionList @param {string} acceptedEncoding @returns
[ "Searches", "for", "the", "first", "matching", "compression", "available", "from", "the", "given", "compressions", "." ]
a08cffaa47632d3b94a48508fc97104de72f93e1
https://github.com/tkoenig89/express-static-gzip/blob/a08cffaa47632d3b94a48508fc97104de72f93e1/index.js#L112-L121
train
tkoenig89/express-static-gzip
index.js
findAllCompressionFiles
function findAllCompressionFiles(fs, folderPath) { // check if folder exists if (!fs.existsSync(folderPath)) return; var files = fs.readdirSync(folderPath); //iterate all files in the current folder for (var i = 0; i < files.length; i++) { var filePath = fo...
javascript
function findAllCompressionFiles(fs, folderPath) { // check if folder exists if (!fs.existsSync(folderPath)) return; var files = fs.readdirSync(folderPath); //iterate all files in the current folder for (var i = 0; i < files.length; i++) { var filePath = fo...
[ "function", "findAllCompressionFiles", "(", "fs", ",", "folderPath", ")", "{", "// check if folder exists", "if", "(", "!", "fs", ".", "existsSync", "(", "folderPath", ")", ")", "return", ";", "var", "files", "=", "fs", ".", "readdirSync", "(", "folderPath", ...
Picks all files into the matching compression's file list. Search is done recursively! @param {Object} fs: node.fs @param {string} folderPath
[ "Picks", "all", "files", "into", "the", "matching", "compression", "s", "file", "list", ".", "Search", "is", "done", "recursively!" ]
a08cffaa47632d3b94a48508fc97104de72f93e1
https://github.com/tkoenig89/express-static-gzip/blob/a08cffaa47632d3b94a48508fc97104de72f93e1/index.js#L128-L144
train
tkoenig89/express-static-gzip
index.js
addAllMatchingCompressionsToFile
function addAllMatchingCompressionsToFile(fileName, fullFilePath) { for (var i = 0; i < compressions.length; i++) { if (fileName.endsWith(compressions[i].fileExtension)) { addCompressionToFile(fullFilePath, compressions[i]); return; } } }
javascript
function addAllMatchingCompressionsToFile(fileName, fullFilePath) { for (var i = 0; i < compressions.length; i++) { if (fileName.endsWith(compressions[i].fileExtension)) { addCompressionToFile(fullFilePath, compressions[i]); return; } } }
[ "function", "addAllMatchingCompressionsToFile", "(", "fileName", ",", "fullFilePath", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "compressions", ".", "length", ";", "i", "++", ")", "{", "if", "(", "fileName", ".", "endsWith", "(", "compre...
Takes a filename and checks if there is any compression type matching the file extension. Adds all matching compressions to the file. @param {string} fileName @param {string} fillFilePath
[ "Takes", "a", "filename", "and", "checks", "if", "there", "is", "any", "compression", "type", "matching", "the", "file", "extension", ".", "Adds", "all", "matching", "compressions", "to", "the", "file", "." ]
a08cffaa47632d3b94a48508fc97104de72f93e1
https://github.com/tkoenig89/express-static-gzip/blob/a08cffaa47632d3b94a48508fc97104de72f93e1/index.js#L152-L159
train
tkoenig89/express-static-gzip
index.js
addCompressionToFile
function addCompressionToFile(filePath, compression) { var srcFilePath = filePath.replace(rootFolder, "").replace(compression.fileExtension, ""); var existingFile = files[srcFilePath]; if (!existingFile) { files[srcFilePath] = { compressions: [compression] }; } else { ...
javascript
function addCompressionToFile(filePath, compression) { var srcFilePath = filePath.replace(rootFolder, "").replace(compression.fileExtension, ""); var existingFile = files[srcFilePath]; if (!existingFile) { files[srcFilePath] = { compressions: [compression] }; } else { ...
[ "function", "addCompressionToFile", "(", "filePath", ",", "compression", ")", "{", "var", "srcFilePath", "=", "filePath", ".", "replace", "(", "rootFolder", ",", "\"\"", ")", ".", "replace", "(", "compression", ".", "fileExtension", ",", "\"\"", ")", ";", "v...
Adds the compression to the file's list of available compressions @param {string} filePath @param {Compression} compression
[ "Adds", "the", "compression", "to", "the", "file", "s", "list", "of", "available", "compressions" ]
a08cffaa47632d3b94a48508fc97104de72f93e1
https://github.com/tkoenig89/express-static-gzip/blob/a08cffaa47632d3b94a48508fc97104de72f93e1/index.js#L166-L174
train
tkoenig89/express-static-gzip
index.js
registerCompression
function registerCompression(encodingName, fileExtension) { if (!findCompressionByName(encodingName)) compressions.push(new Compression(encodingName, fileExtension)); }
javascript
function registerCompression(encodingName, fileExtension) { if (!findCompressionByName(encodingName)) compressions.push(new Compression(encodingName, fileExtension)); }
[ "function", "registerCompression", "(", "encodingName", ",", "fileExtension", ")", "{", "if", "(", "!", "findCompressionByName", "(", "encodingName", ")", ")", "compressions", ".", "push", "(", "new", "Compression", "(", "encodingName", ",", "fileExtension", ")", ...
Registers a new compression to the module. @param {string} encodingName @param {string} fileExtension
[ "Registers", "a", "new", "compression", "to", "the", "module", "." ]
a08cffaa47632d3b94a48508fc97104de72f93e1
https://github.com/tkoenig89/express-static-gzip/blob/a08cffaa47632d3b94a48508fc97104de72f93e1/index.js#L181-L184
train
tkoenig89/express-static-gzip
index.js
findCompressionByName
function findCompressionByName(encodingName) { for (var i = 0; i < compressions.length; i++) { if (compressions[i].encodingName === encodingName) return compressions[i]; } return null; }
javascript
function findCompressionByName(encodingName) { for (var i = 0; i < compressions.length; i++) { if (compressions[i].encodingName === encodingName) return compressions[i]; } return null; }
[ "function", "findCompressionByName", "(", "encodingName", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "compressions", ".", "length", ";", "i", "++", ")", "{", "if", "(", "compressions", "[", "i", "]", ".", "encodingName", "===", "encodin...
Compression lookup by name. @param {string} encodingName @returns {Compression}
[ "Compression", "lookup", "by", "name", "." ]
a08cffaa47632d3b94a48508fc97104de72f93e1
https://github.com/tkoenig89/express-static-gzip/blob/a08cffaa47632d3b94a48508fc97104de72f93e1/index.js#L202-L208
train
marko-js/marko-widgets
lib/init-widgets-browser.js
initClientRendered
function initClientRendered(widgetDefs, document) { // Ensure that event handlers to handle delegating events are // always attached before initializing any widgets eventDelegation.init(); document = document || window.document; for (var i=0,len=widgetDefs.length; i<len; i++) { var widgetDe...
javascript
function initClientRendered(widgetDefs, document) { // Ensure that event handlers to handle delegating events are // always attached before initializing any widgets eventDelegation.init(); document = document || window.document; for (var i=0,len=widgetDefs.length; i<len; i++) { var widgetDe...
[ "function", "initClientRendered", "(", "widgetDefs", ",", "document", ")", "{", "// Ensure that event handlers to handle delegating events are", "// always attached before initializing any widgets", "eventDelegation", ".", "init", "(", ")", ";", "document", "=", "document", "||...
Create a helper function handle recursion
[ "Create", "a", "helper", "function", "handle", "recursion" ]
e97a7f73343101ff11f4e73bf6edfb5e1544c1f9
https://github.com/marko-js/marko-widgets/blob/e97a7f73343101ff11f4e73bf6edfb5e1544c1f9/lib/init-widgets-browser.js#L272-L301
train
marko-js/marko-widgets
lib/WidgetDef.js
function(type, targetMethod, elId) { if (!targetMethod) { // The event handler method is allowed to be conditional. At render time if the target // method is null then we do not attach any direct event listeners. return; } if (!this.domEvents) { ...
javascript
function(type, targetMethod, elId) { if (!targetMethod) { // The event handler method is allowed to be conditional. At render time if the target // method is null then we do not attach any direct event listeners. return; } if (!this.domEvents) { ...
[ "function", "(", "type", ",", "targetMethod", ",", "elId", ")", "{", "if", "(", "!", "targetMethod", ")", "{", "// The event handler method is allowed to be conditional. At render time if the target", "// method is null then we do not attach any direct event listeners.", "return", ...
Registers a DOM event for a nested HTML element associated with the widget. This is only done for non-bubbling events that require direct event listeners to be added. @param {String} type The DOM event type ("mouseover", "mousemove", etc.) @param {String} targetMethod The name of the method to invoke on the scoped wi...
[ "Registers", "a", "DOM", "event", "for", "a", "nested", "HTML", "element", "associated", "with", "the", "widget", ".", "This", "is", "only", "done", "for", "non", "-", "bubbling", "events", "that", "require", "direct", "event", "listeners", "to", "be", "ad...
e97a7f73343101ff11f4e73bf6edfb5e1544c1f9
https://github.com/marko-js/marko-widgets/blob/e97a7f73343101ff11f4e73bf6edfb5e1544c1f9/lib/WidgetDef.js#L79-L93
train
marko-js/marko-widgets
lib/Widget.js
Widget
function Widget(id, document) { EventEmitter.call(this); this.id = id; this.el = null; this.bodyEl = null; this.state = null; this.__subscriptions = null; this.__evHandles = null; this.__lifecycleState = null; this.__customEvents = null; this.__scope = null; this.__dirty = fa...
javascript
function Widget(id, document) { EventEmitter.call(this); this.id = id; this.el = null; this.bodyEl = null; this.state = null; this.__subscriptions = null; this.__evHandles = null; this.__lifecycleState = null; this.__customEvents = null; this.__scope = null; this.__dirty = fa...
[ "function", "Widget", "(", "id", ",", "document", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "id", "=", "id", ";", "this", ".", "el", "=", "null", ";", "this", ".", "bodyEl", "=", "null", ";", "this", ".", "state",...
Base widget type. NOTE: Any methods that are prefixed with an underscore should be considered private!
[ "Base", "widget", "type", "." ]
e97a7f73343101ff11f4e73bf6edfb5e1544c1f9
https://github.com/marko-js/marko-widgets/blob/e97a7f73343101ff11f4e73bf6edfb5e1544c1f9/lib/Widget.js#L216-L233
train
marko-js/marko-widgets
taglib/widget-tag.js
getExistingWidget
function getExistingWidget(id, type) { var existingEl = document.getElementById(id); var existingWidget; if (existingEl && (existingWidget = existingEl.__widget) && existingWidget.__type === type) { return existingWidget; } return null; }
javascript
function getExistingWidget(id, type) { var existingEl = document.getElementById(id); var existingWidget; if (existingEl && (existingWidget = existingEl.__widget) && existingWidget.__type === type) { return existingWidget; } return null; }
[ "function", "getExistingWidget", "(", "id", ",", "type", ")", "{", "var", "existingEl", "=", "document", ".", "getElementById", "(", "id", ")", ";", "var", "existingWidget", ";", "if", "(", "existingEl", "&&", "(", "existingWidget", "=", "existingEl", ".", ...
Look in in the DOM to see if a widget with the same ID and type already exists.
[ "Look", "in", "in", "the", "DOM", "to", "see", "if", "a", "widget", "with", "the", "same", "ID", "and", "type", "already", "exists", "." ]
e97a7f73343101ff11f4e73bf6edfb5e1544c1f9
https://github.com/marko-js/marko-widgets/blob/e97a7f73343101ff11f4e73bf6edfb5e1544c1f9/taglib/widget-tag.js#L31-L40
train
marko-js/marko-widgets
lib/addEventListener.js
getIEEvent
function getIEEvent() { var event = window.event; // add event.target event.target = event.target || event.srcElement; event.preventDefault = event.preventDefault || function() { event.returnValue = false; }; event.stopPropagation = event.stopPropagation || function() { event.c...
javascript
function getIEEvent() { var event = window.event; // add event.target event.target = event.target || event.srcElement; event.preventDefault = event.preventDefault || function() { event.returnValue = false; }; event.stopPropagation = event.stopPropagation || function() { event.c...
[ "function", "getIEEvent", "(", ")", "{", "var", "event", "=", "window", ".", "event", ";", "// add event.target", "event", ".", "target", "=", "event", ".", "target", "||", "event", ".", "srcElement", ";", "event", ".", "preventDefault", "=", "event", ".",...
Adapt an native IE event to a new event by monkey patching it
[ "Adapt", "an", "native", "IE", "event", "to", "a", "new", "event", "by", "monkey", "patching", "it" ]
e97a7f73343101ff11f4e73bf6edfb5e1544c1f9
https://github.com/marko-js/marko-widgets/blob/e97a7f73343101ff11f4e73bf6edfb5e1544c1f9/lib/addEventListener.js#L57-L73
train
mad-gooze/Leaflet.Arc
src/leaflet-arc.js
_createLatLngs
function _createLatLngs(line, from) { if (line.geometries[0] && line.geometries[0].coords[0]) { /** * stores how many times arc is broken over 180 longitude * @type {number} */ let wrap = from.lng - line.geometries[0].coords[0][0] - 360; return line.geometries ...
javascript
function _createLatLngs(line, from) { if (line.geometries[0] && line.geometries[0].coords[0]) { /** * stores how many times arc is broken over 180 longitude * @type {number} */ let wrap = from.lng - line.geometries[0].coords[0][0] - 360; return line.geometries ...
[ "function", "_createLatLngs", "(", "line", ",", "from", ")", "{", "if", "(", "line", ".", "geometries", "[", "0", "]", "&&", "line", ".", "geometries", "[", "0", "]", ".", "coords", "[", "0", "]", ")", "{", "/**\n * stores how many times arc is bro...
Create array of L.LatLng objects from line produced by arc.js @param {object} line @param {L.LatLng} from @private @returns {Array}
[ "Create", "array", "of", "L", ".", "LatLng", "objects", "from", "line", "produced", "by", "arc", ".", "js" ]
edaef40860b32ca22dfed8abd8c96d504d190d19
https://github.com/mad-gooze/Leaflet.Arc/blob/edaef40860b32ca22dfed8abd8c96d504d190d19/src/leaflet-arc.js#L20-L37
train
DynamoMTL/shopify-pipeline
lib/prompt-if-main-theme.js
promptIfMainTheme
function promptIfMainTheme(env) { return new Promise((resolve, reject) => { const c = config.shopify[env] if (!c.api_key) { console.log(chalk.yellow(`The "${env}" environment in config/shopify.yml does not specify an "api_key". Skipping check for if is main theme.`)) resolve() return } ...
javascript
function promptIfMainTheme(env) { return new Promise((resolve, reject) => { const c = config.shopify[env] if (!c.api_key) { console.log(chalk.yellow(`The "${env}" environment in config/shopify.yml does not specify an "api_key". Skipping check for if is main theme.`)) resolve() return } ...
[ "function", "promptIfMainTheme", "(", "env", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "const", "c", "=", "config", ".", "shopify", "[", "env", "]", "if", "(", "!", "c", ".", "api_key", ")", "{", "con...
Prompt the user to confirm if they are about to deploy to the main theme @param env String The environment to check against @return Promise Reason for abort or empty resolve
[ "Prompt", "the", "user", "to", "confirm", "if", "they", "are", "about", "to", "deploy", "to", "the", "main", "theme" ]
ca686c029dba787c48a664ff51d6de806697f98a
https://github.com/DynamoMTL/shopify-pipeline/blob/ca686c029dba787c48a664ff51d6de806697f98a/lib/prompt-if-main-theme.js#L68-L107
train
Multicolour/multicolour
lib/utils.js
hash_password
function hash_password(plain_text, salt, callback) { // Get the crypto library. const crypto = require("crypto") // These should be a *slow* as possible, higher = slower. // Slow it down until you tweak a bounce change. const password_iterations = process.env.PW_GEN_PW_ITERS || 4096 // Password length and...
javascript
function hash_password(plain_text, salt, callback) { // Get the crypto library. const crypto = require("crypto") // These should be a *slow* as possible, higher = slower. // Slow it down until you tweak a bounce change. const password_iterations = process.env.PW_GEN_PW_ITERS || 4096 // Password length and...
[ "function", "hash_password", "(", "plain_text", ",", "salt", ",", "callback", ")", "{", "// Get the crypto library.", "const", "crypto", "=", "require", "(", "\"crypto\"", ")", "// These should be a *slow* as possible, higher = slower.", "// Slow it down until you tweak a bounc...
Hash a plain string with the salt and call the callback. @param {String} plain_text to hash. @param {String} salt to use during hash process. @param {Function} callback to execute with the new password. @return {void}
[ "Hash", "a", "plain", "string", "with", "the", "salt", "and", "call", "the", "callback", "." ]
fd4fb3454a928ab9829617be49ff341367252272
https://github.com/Multicolour/multicolour/blob/fd4fb3454a928ab9829617be49ff341367252272/lib/utils.js#L21-L40
train