id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
41,700
bootprint/customize-write-files
lib/changed.js
compareBuffer
async function compareBuffer (filename, expectedContents) { try { const actualContents = await fs.readFile(filename) return !expectedContents.equals(actualContents) } catch (err) { return handleError(err) } }
javascript
async function compareBuffer (filename, expectedContents) { try { const actualContents = await fs.readFile(filename) return !expectedContents.equals(actualContents) } catch (err) { return handleError(err) } }
[ "async", "function", "compareBuffer", "(", "filename", ",", "expectedContents", ")", "{", "try", "{", "const", "actualContents", "=", "await", "fs", ".", "readFile", "(", "filename", ")", "return", "!", "expectedContents", ".", "equals", "(", "actualContents", ...
Compares a buffer with a file contents. Returns true, if they differ or the file does not exist. @param {string} filename the file name @param {Buffer} expectedContents the file contents @returns {Promise<boolean>|boolean} @private
[ "Compares", "a", "buffer", "with", "a", "file", "contents", ".", "Returns", "true", "if", "they", "differ", "or", "the", "file", "does", "not", "exist", "." ]
af77ce78b5196f40ce90670bfdb6e1e7e496a415
https://github.com/bootprint/customize-write-files/blob/af77ce78b5196f40ce90670bfdb6e1e7e496a415/lib/changed.js#L68-L75
41,701
bootprint/customize-write-files
lib/changed.js
compareStream
async function compareStream (filename, expectedContents) { try { const actualStream = fs.createReadStream(filename) const result = await streamCompare(expectedContents, actualStream, { abortOnError: true, compare: (a, b) => { return Buffer.compare(a.data, b.data) !== 0 } }) ...
javascript
async function compareStream (filename, expectedContents) { try { const actualStream = fs.createReadStream(filename) const result = await streamCompare(expectedContents, actualStream, { abortOnError: true, compare: (a, b) => { return Buffer.compare(a.data, b.data) !== 0 } }) ...
[ "async", "function", "compareStream", "(", "filename", ",", "expectedContents", ")", "{", "try", "{", "const", "actualStream", "=", "fs", ".", "createReadStream", "(", "filename", ")", "const", "result", "=", "await", "streamCompare", "(", "expectedContents", ",...
Compares a readable stream with a file contents. Returns true, if they differ or the file does not exist. @param {string} filename the file name @param {Stream} expectedContents the file contents @returns {Promise<boolean>|boolean} @private
[ "Compares", "a", "readable", "stream", "with", "a", "file", "contents", ".", "Returns", "true", "if", "they", "differ", "or", "the", "file", "does", "not", "exist", "." ]
af77ce78b5196f40ce90670bfdb6e1e7e496a415
https://github.com/bootprint/customize-write-files/blob/af77ce78b5196f40ce90670bfdb6e1e7e496a415/lib/changed.js#L84-L97
41,702
unfoldingWord-dev/node-door43-client
lib/main.js
function(project) { if(project.slug.toLowerCase() === 'obs' || project.slug.toLowerCase() === 'bible-obs' || project.slug.toLowerCase() === 'bible' || !project.chunks_url) return Promise.resolve(); return request.read(project.chunks_url) .then(function(r...
javascript
function(project) { if(project.slug.toLowerCase() === 'obs' || project.slug.toLowerCase() === 'bible-obs' || project.slug.toLowerCase() === 'bible' || !project.chunks_url) return Promise.resolve(); return request.read(project.chunks_url) .then(function(r...
[ "function", "(", "project", ")", "{", "if", "(", "project", ".", "slug", ".", "toLowerCase", "(", ")", "===", "'obs'", "||", "project", ".", "slug", ".", "toLowerCase", "(", ")", "===", "'bible-obs'", "||", "project", ".", "slug", ".", "toLowerCase", "...
Downloads the chunks for a project @param project {{}}
[ "Downloads", "the", "chunks", "for", "a", "project" ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L59-L105
41,703
unfoldingWord-dev/node-door43-client
lib/main.js
function(project) { return request.read(project.lang_catalog) .then(function(response) { // consume language data if(response.status !== 200) return Promise.reject(response); let data; try { data = JSON.parse(respon...
javascript
function(project) { return request.read(project.lang_catalog) .then(function(response) { // consume language data if(response.status !== 200) return Promise.reject(response); let data; try { data = JSON.parse(respon...
[ "function", "(", "project", ")", "{", "return", "request", ".", "read", "(", "project", ".", "lang_catalog", ")", ".", "then", "(", "function", "(", "response", ")", "{", "// consume language data", "if", "(", "response", ".", "status", "!==", "200", ")", ...
Downloads the source languages for a project @param project {{}} @returns {Promise}
[ "Downloads", "the", "source", "languages", "for", "a", "project" ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L112-L168
41,704
unfoldingWord-dev/node-door43-client
lib/main.js
function() { library.addCatalog({ slug: 'langnames', url: 'https://td.unfoldingword.org/exports/langnames.json', modified_at: 0 }); library.addCatalog({ slug: 'new-language-questions', url: 'https://td.unfoldingword.org/api/questionnair...
javascript
function() { library.addCatalog({ slug: 'langnames', url: 'https://td.unfoldingword.org/exports/langnames.json', modified_at: 0 }); library.addCatalog({ slug: 'new-language-questions', url: 'https://td.unfoldingword.org/api/questionnair...
[ "function", "(", ")", "{", "library", ".", "addCatalog", "(", "{", "slug", ":", "'langnames'", ",", "url", ":", "'https://td.unfoldingword.org/exports/langnames.json'", ",", "modified_at", ":", "0", "}", ")", ";", "library", ".", "addCatalog", "(", "{", "slug"...
Injects the global catalogs since they are missing from api v2. @returns {Promise}
[ "Injects", "the", "global", "catalogs", "since", "they", "are", "missing", "from", "api", "v2", "." ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L300-L323
41,705
unfoldingWord-dev/node-door43-client
lib/main.js
function(url, onProgress) { onProgress = onProgress || function(){}; return injectGlobalCatalogs() .then(function() { library.commit(); return request.read(url); }) .then(function(response) { // disable saves for better p...
javascript
function(url, onProgress) { onProgress = onProgress || function(){}; return injectGlobalCatalogs() .then(function() { library.commit(); return request.read(url); }) .then(function(response) { // disable saves for better p...
[ "function", "(", "url", ",", "onProgress", ")", "{", "onProgress", "=", "onProgress", "||", "function", "(", ")", "{", "}", ";", "return", "injectGlobalCatalogs", "(", ")", ".", "then", "(", "function", "(", ")", "{", "library", ".", "commit", "(", ")"...
Indexes the languages, projects, and resources from the api @param url {string} the entry resource api catalog @param onProgress {function} an optional progress listener. This should receive progress id, total, completed @returns {Promise}
[ "Indexes", "the", "languages", "projects", "and", "resources", "from", "the", "api" ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L346-L402
41,706
unfoldingWord-dev/node-door43-client
lib/main.js
function(onProgress) { onProgress = onProgress || function() {}; let projects = library.public_getters.getProjects(); library.autosave(false); return promiseUtils.chain(downloadChunks, function(err, data) { if(err instanceof Error) return Promise.reject(err); cons...
javascript
function(onProgress) { onProgress = onProgress || function() {}; let projects = library.public_getters.getProjects(); library.autosave(false); return promiseUtils.chain(downloadChunks, function(err, data) { if(err instanceof Error) return Promise.reject(err); cons...
[ "function", "(", "onProgress", ")", "{", "onProgress", "=", "onProgress", "||", "function", "(", ")", "{", "}", ";", "let", "projects", "=", "library", ".", "public_getters", ".", "getProjects", "(", ")", ";", "library", ".", "autosave", "(", "false", ")...
Downloads the chunks for all projects @param onProgress @returns {Promise.<>}
[ "Downloads", "the", "chunks", "for", "all", "projects" ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L409-L427
41,707
unfoldingWord-dev/node-door43-client
lib/main.js
function(onProgress) { onProgress = onProgress || function() {}; library.autosave(false); let modules_urls = [ 'https://api.unfoldingword.org/ta/txt/1/en/audio_2.json', 'https://api.unfoldingword.org/ta/txt/1/en/checking_1.json', 'https://api.unfoldingword.org...
javascript
function(onProgress) { onProgress = onProgress || function() {}; library.autosave(false); let modules_urls = [ 'https://api.unfoldingword.org/ta/txt/1/en/audio_2.json', 'https://api.unfoldingword.org/ta/txt/1/en/checking_1.json', 'https://api.unfoldingword.org...
[ "function", "(", "onProgress", ")", "{", "onProgress", "=", "onProgress", "||", "function", "(", ")", "{", "}", ";", "library", ".", "autosave", "(", "false", ")", ";", "let", "modules_urls", "=", "[", "'https://api.unfoldingword.org/ta/txt/1/en/audio_2.json'", ...
Downloads the tA projects @param onProgress @returns {Promise.<>}
[ "Downloads", "the", "tA", "projects" ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L434-L461
41,708
unfoldingWord-dev/node-door43-client
lib/main.js
function(onProgress) { const errorHandler = function(err) { if(err instanceof Error) { return Promise.reject(err); } else { return Promise.resolve(); } }; // TRICKY: the language catalogs are dependent so we must run them in or...
javascript
function(onProgress) { const errorHandler = function(err) { if(err instanceof Error) { return Promise.reject(err); } else { return Promise.resolve(); } }; // TRICKY: the language catalogs are dependent so we must run them in or...
[ "function", "(", "onProgress", ")", "{", "const", "errorHandler", "=", "function", "(", "err", ")", "{", "if", "(", "err", "instanceof", "Error", ")", "{", "return", "Promise", ".", "reject", "(", "err", ")", ";", "}", "else", "{", "return", "Promise",...
Updates all of the global catalogs @param onProgress @returns {Promise.<>}
[ "Updates", "all", "of", "the", "global", "catalogs" ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L521-L548
41,709
unfoldingWord-dev/node-door43-client
lib/main.js
function(data, onProgress) { onProgress = onProgress || function() {}; return new Promise(function(resolve, reject) { try { let languages = JSON.parse(data); _.forEach(languages, function (language, index) { language.slug = language.lc; ...
javascript
function(data, onProgress) { onProgress = onProgress || function() {}; return new Promise(function(resolve, reject) { try { let languages = JSON.parse(data); _.forEach(languages, function (language, index) { language.slug = language.lc; ...
[ "function", "(", "data", ",", "onProgress", ")", "{", "onProgress", "=", "onProgress", "||", "function", "(", ")", "{", "}", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "try", "{", "let", "languages", "=",...
Parses the target language catalog and indexes it. @param data {string} @param onProgress {function} an optional progress listener. This should receive progress id, total, completed @returns {Promise}
[ "Parses", "the", "target", "language", "catalog", "and", "indexes", "it", "." ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L622-L651
41,710
unfoldingWord-dev/node-door43-client
lib/main.js
function(data, onProgress) { onProgress = onProgress || function() {}; return new Promise(function(resolve, reject) { try { let obj = JSON.parse(data); _.forEach(obj.languages, function (questionnaire, index) { // format ...
javascript
function(data, onProgress) { onProgress = onProgress || function() {}; return new Promise(function(resolve, reject) { try { let obj = JSON.parse(data); _.forEach(obj.languages, function (questionnaire, index) { // format ...
[ "function", "(", "data", ",", "onProgress", ")", "{", "onProgress", "=", "onProgress", "||", "function", "(", ")", "{", "}", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "try", "{", "let", "obj", "=", "JS...
Parses the new language questions catalog and indexes it. @param data {string} @param onProgress {function} an optional progress listener. This should receive progress id, total, completed @returns {Promise}
[ "Parses", "the", "new", "language", "questions", "catalog", "and", "indexes", "it", "." ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L660-L712
41,711
unfoldingWord-dev/node-door43-client
lib/main.js
function(formats) { for(let format of formats) { // TODO: rather than hard coding the mime type use library.spec.base_mime_type if(format.mime_type.match(/application\/tsrc\+.+/)) { return format; } } return null; }
javascript
function(formats) { for(let format of formats) { // TODO: rather than hard coding the mime type use library.spec.base_mime_type if(format.mime_type.match(/application\/tsrc\+.+/)) { return format; } } return null; }
[ "function", "(", "formats", ")", "{", "for", "(", "let", "format", "of", "formats", ")", "{", "// TODO: rather than hard coding the mime type use library.spec.base_mime_type", "if", "(", "format", ".", "mime_type", ".", "match", "(", "/", "application\\/tsrc\\+.+", "/...
Returns the first resource container format found in the list. E.g. the array may contain binary formats such as pdf, mp3, etc. This basically filters those. @param formats {[]} an array of resource formats @returns {{}} the resource container format
[ "Returns", "the", "first", "resource", "container", "format", "found", "in", "the", "list", ".", "E", ".", "g", ".", "the", "array", "may", "contain", "binary", "formats", "such", "as", "pdf", "mp3", "etc", ".", "This", "basically", "filters", "those", "...
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L788-L796
41,712
unfoldingWord-dev/node-door43-client
lib/main.js
function(languageSlug, projectSlug, resourceSlug, progressCallback) { // support passing args as an object if(languageSlug != null && typeof languageSlug == 'object') { resourceSlug = languageSlug.resourceSlug; projectSlug = languageSlug.projectSlug; languageSlug = la...
javascript
function(languageSlug, projectSlug, resourceSlug, progressCallback) { // support passing args as an object if(languageSlug != null && typeof languageSlug == 'object') { resourceSlug = languageSlug.resourceSlug; projectSlug = languageSlug.projectSlug; languageSlug = la...
[ "function", "(", "languageSlug", ",", "projectSlug", ",", "resourceSlug", ",", "progressCallback", ")", "{", "// support passing args as an object", "if", "(", "languageSlug", "!=", "null", "&&", "typeof", "languageSlug", "==", "'object'", ")", "{", "resourceSlug", ...
Downloads a resource container. This expects a correctly formatted resource container and will download it directly to the disk Note: You may provide a single object parameter if you prefer once the api can deliver proper resource containers this method should be renamed to downloadContainer @param languageSlug {str...
[ "Downloads", "a", "resource", "container", ".", "This", "expects", "a", "correctly", "formatted", "resource", "container", "and", "will", "download", "it", "directly", "to", "the", "disk" ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L871-L921
41,713
unfoldingWord-dev/node-door43-client
lib/main.js
function(languageSlug, projectSlug, resourceSlug) { return new Promise(function(resolve, reject) { try { resolve(library.public_getters.getResource(languageSlug, projectSlug, resourceSlug)); } catch(err) { reject(err); } ...
javascript
function(languageSlug, projectSlug, resourceSlug) { return new Promise(function(resolve, reject) { try { resolve(library.public_getters.getResource(languageSlug, projectSlug, resourceSlug)); } catch(err) { reject(err); } ...
[ "function", "(", "languageSlug", ",", "projectSlug", ",", "resourceSlug", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "try", "{", "resolve", "(", "library", ".", "public_getters", ".", "getResource", "(", ...
Opens a resource container archive so it's contents can be read. The index will be referenced to validate the resource and retrieve the container type. @param languageSlug {string} @param projectSlug {string} @param resourceSlug {string} @returns {Promise.<Container>}
[ "Opens", "a", "resource", "container", "archive", "so", "it", "s", "contents", "can", "be", "read", ".", "The", "index", "will", "be", "referenced", "to", "validate", "the", "resource", "and", "retrieve", "the", "container", "type", "." ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L1114-L1129
41,714
unfoldingWord-dev/node-door43-client
lib/main.js
function(languageSlug, projectSlug, resourceSlug) { return new Promise(function(resolve, reject) { try { resolve(library.public_getters.getResource(languageSlug, projectSlug, resourceSlug)); } catch(err) { reject(err); } ...
javascript
function(languageSlug, projectSlug, resourceSlug) { return new Promise(function(resolve, reject) { try { resolve(library.public_getters.getResource(languageSlug, projectSlug, resourceSlug)); } catch(err) { reject(err); } ...
[ "function", "(", "languageSlug", ",", "projectSlug", ",", "resourceSlug", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "try", "{", "resolve", "(", "library", ".", "public_getters", ".", "getResource", "(", ...
Closes a resource container archive. @param languageSlug {string} @param projectSlug {string} @param resourceSlug {string} @returns {Promise.<string>} the path to the closed container
[ "Closes", "a", "resource", "container", "archive", "." ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L1139-L1154
41,715
unfoldingWord-dev/node-door43-client
lib/main.js
function() { return new Promise(function(resolve, reject) { try { let files; if(fileUtils.fileExists(resourceDir)) { files = fs.readdirSync(resourceDir); files = _.uniqBy(files, function (f) { return path...
javascript
function() { return new Promise(function(resolve, reject) { try { let files; if(fileUtils.fileExists(resourceDir)) { files = fs.readdirSync(resourceDir); files = _.uniqBy(files, function (f) { return path...
[ "function", "(", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "try", "{", "let", "files", ";", "if", "(", "fileUtils", ".", "fileExists", "(", "resourceDir", ")", ")", "{", "files", "=", "fs", ".", ...
Returns a list of resource containers that have been downloaded @returns {Promise.<[{}]>} an array of resource container info objects (package.json).
[ "Returns", "a", "list", "of", "resource", "containers", "that", "have", "been", "downloaded" ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L1160-L1181
41,716
unfoldingWord-dev/node-door43-client
lib/main.js
function() { return new Promise(function(resolve, reject) { try{ resolve(library.listSourceLanguagesLastModified()); } catch (err) { reject(err); } }).then(function(languages) { return listResourceContainers() ...
javascript
function() { return new Promise(function(resolve, reject) { try{ resolve(library.listSourceLanguagesLastModified()); } catch (err) { reject(err); } }).then(function(languages) { return listResourceContainers() ...
[ "function", "(", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "try", "{", "resolve", "(", "library", ".", "listSourceLanguagesLastModified", "(", ")", ")", ";", "}", "catch", "(", "err", ")", "{", "rej...
Returns a list of source languages that are eligible for updates. @returns {Promise.<Array>} An array of slugs
[ "Returns", "a", "list", "of", "source", "languages", "that", "are", "eligible", "for", "updates", "." ]
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L1213-L1237
41,717
unfoldingWord-dev/node-door43-client
lib/main.js
function(languageSlug) { return new Promise(function(resolve, reject) { try{ resolve(library.listProjectsLastModified(languageSlug)); } catch (err) { reject(err); } }).then(function(projects) { return listResourceContainers()...
javascript
function(languageSlug) { return new Promise(function(resolve, reject) { try{ resolve(library.listProjectsLastModified(languageSlug)); } catch (err) { reject(err); } }).then(function(projects) { return listResourceContainers()...
[ "function", "(", "languageSlug", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "try", "{", "resolve", "(", "library", ".", "listProjectsLastModified", "(", "languageSlug", ")", ")", ";", "}", "catch", "(", ...
Returns a list of projects that are eligible for updates. If no language is given the results will include all projects in all languages. This is helpful if you need to view updates based on project first rather than source language first. @param languageSlug {string|null} the slug of a source language who's projects ...
[ "Returns", "a", "list", "of", "projects", "that", "are", "eligible", "for", "updates", ".", "If", "no", "language", "is", "given", "the", "results", "will", "include", "all", "projects", "in", "all", "languages", ".", "This", "is", "helpful", "if", "you", ...
18f518368ee89f4baf8943500a1c53ef5efcfb3e
https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L1246-L1271
41,718
DFFR-NT/dffrnt.confs
lib/utils.js
FREEZE
function FREEZE(obj, all = false) { if (UoN(obj)) return obj; // ---------------------------------------------------------- let iss = ISS(obj), iEN = OoA.has(iss), dfl, res; // ---------------------------------------------------------- if (!iEN||iss=='function') return obj; if (!!obj.toJS) obj = obj.toJS(...
javascript
function FREEZE(obj, all = false) { if (UoN(obj)) return obj; // ---------------------------------------------------------- let iss = ISS(obj), iEN = OoA.has(iss), dfl, res; // ---------------------------------------------------------- if (!iEN||iss=='function') return obj; if (!!obj.toJS) obj = obj.toJS(...
[ "function", "FREEZE", "(", "obj", ",", "all", "=", "false", ")", "{", "if", "(", "UoN", "(", "obj", ")", ")", "return", "obj", ";", "// ----------------------------------------------------------", "let", "iss", "=", "ISS", "(", "obj", ")", ",", "iEN", "=",...
Freeze an Object, if needed. @param {*} obj The Object to Freeze @param {Boolean} [all=false] `true`, if Freezing should be recursive @returns {Object} The frozen Object @private
[ "Freeze", "an", "Object", "if", "needed", "." ]
2175e20c0ed3405e8956dd9b59cd71e79bef6d16
https://github.com/DFFR-NT/dffrnt.confs/blob/2175e20c0ed3405e8956dd9b59cd71e79bef6d16/lib/utils.js#L265-L282
41,719
DFFR-NT/dffrnt.confs
lib/utils.js
IDPTYPE
function IDPTYPE() { let make = ()=>(Math.random().toString(36).slice(2)), rslt = make(); while (global.__PTYPES__.has(rslt)) { rslt = make(); } return rslt; }
javascript
function IDPTYPE() { let make = ()=>(Math.random().toString(36).slice(2)), rslt = make(); while (global.__PTYPES__.has(rslt)) { rslt = make(); } return rslt; }
[ "function", "IDPTYPE", "(", ")", "{", "let", "make", "=", "(", ")", "=>", "(", "Math", ".", "random", "(", ")", ".", "toString", "(", "36", ")", ".", "slice", "(", "2", ")", ")", ",", "rslt", "=", "make", "(", ")", ";", "while", "(", "global"...
Creates a unique ID for `PTypes` @returns {string} A unique identifier @private
[ "Creates", "a", "unique", "ID", "for", "PTypes" ]
2175e20c0ed3405e8956dd9b59cd71e79bef6d16
https://github.com/DFFR-NT/dffrnt.confs/blob/2175e20c0ed3405e8956dd9b59cd71e79bef6d16/lib/utils.js#L312-L316
41,720
DFFR-NT/dffrnt.confs
lib/utils.js
GETCONFIG
function GETCONFIG(name) { return { GNConfig: GNConfig, RouteGN: RouteGN, RouteAU: RouteAU, RouteDB: RouteDB, GNHeaders: GNHeaders, GNParam: GNParam, GNDescr: GNDescr, }[name]; }
javascript
function GETCONFIG(name) { return { GNConfig: GNConfig, RouteGN: RouteGN, RouteAU: RouteAU, RouteDB: RouteDB, GNHeaders: GNHeaders, GNParam: GNParam, GNDescr: GNDescr, }[name]; }
[ "function", "GETCONFIG", "(", "name", ")", "{", "return", "{", "GNConfig", ":", "GNConfig", ",", "RouteGN", ":", "RouteGN", ",", "RouteAU", ":", "RouteAU", ",", "RouteDB", ":", "RouteDB", ",", "GNHeaders", ":", "GNHeaders", ",", "GNParam", ":", "GNParam", ...
Grabs a Config-Type Class @param {string} name The name of the Config-Type Class @returns {GNConfig|RouteGN|RouteAU|RouteDB|GNHeaders|GNParam|GNDescr} @private
[ "Grabs", "a", "Config", "-", "Type", "Class" ]
2175e20c0ed3405e8956dd9b59cd71e79bef6d16
https://github.com/DFFR-NT/dffrnt.confs/blob/2175e20c0ed3405e8956dd9b59cd71e79bef6d16/lib/utils.js#L325-L335
41,721
DFFR-NT/dffrnt.confs
lib/utils.js
MERGER
function MERGER(oldVal, newVal) { let onme = CNAME(oldVal), ocon = ISCONFIG(oldVal), otyp = ISPTYPE(oldVal), nnme = CNAME(newVal), ncon = ISCONFIG(newVal), ntyp = ISPTYPE(newVal); if (otyp || ntyp) { return newVal; }; if (ocon && ncon && onme==nnme) { return new GETCONFIG(onme)(Assign(oldVal, newVal)); };...
javascript
function MERGER(oldVal, newVal) { let onme = CNAME(oldVal), ocon = ISCONFIG(oldVal), otyp = ISPTYPE(oldVal), nnme = CNAME(newVal), ncon = ISCONFIG(newVal), ntyp = ISPTYPE(newVal); if (otyp || ntyp) { return newVal; }; if (ocon && ncon && onme==nnme) { return new GETCONFIG(onme)(Assign(oldVal, newVal)); };...
[ "function", "MERGER", "(", "oldVal", ",", "newVal", ")", "{", "let", "onme", "=", "CNAME", "(", "oldVal", ")", ",", "ocon", "=", "ISCONFIG", "(", "oldVal", ")", ",", "otyp", "=", "ISPTYPE", "(", "oldVal", ")", ",", "nnme", "=", "CNAME", "(", "newVa...
A `callback` used in `Immutable`.`mergeWith` @param {*} oldVal The value of the original Object @param {*} newVal The value of the merging Object @returns {*}
[ "A", "callback", "used", "in", "Immutable", ".", "mergeWith" ]
2175e20c0ed3405e8956dd9b59cd71e79bef6d16
https://github.com/DFFR-NT/dffrnt.confs/blob/2175e20c0ed3405e8956dd9b59cd71e79bef6d16/lib/utils.js#L344-L356
41,722
DFFR-NT/dffrnt.confs
lib/utils.js
ThrowType
function ThrowType(name, type, value, actual) { console.log('THIS:', this) let THS = this, pfx = (!!THS ? THS.Name||THS.Scheme : ''); throw new TypeError( `${pfx} property, [${name}], must be one of the following, <${ type.join('> or <').toTitleCase() }>. Got <${actual.toTitleCase()}> (${value}) instead...
javascript
function ThrowType(name, type, value, actual) { console.log('THIS:', this) let THS = this, pfx = (!!THS ? THS.Name||THS.Scheme : ''); throw new TypeError( `${pfx} property, [${name}], must be one of the following, <${ type.join('> or <').toTitleCase() }>. Got <${actual.toTitleCase()}> (${value}) instead...
[ "function", "ThrowType", "(", "name", ",", "type", ",", "value", ",", "actual", ")", "{", "console", ".", "log", "(", "'THIS:'", ",", "this", ")", "let", "THS", "=", "this", ",", "pfx", "=", "(", "!", "!", "THS", "?", "THS", ".", "Name", "||", ...
Throws a `TypeError` when a `type` requirement is not met @param {String} name The `name` of the Property @param {String} type The `type` the Property should have been @param {any} value The failed `value` @param {String} actual The `type` the Value actual is @private
[ "Throws", "a", "TypeError", "when", "a", "type", "requirement", "is", "not", "met" ]
2175e20c0ed3405e8956dd9b59cd71e79bef6d16
https://github.com/DFFR-NT/dffrnt.confs/blob/2175e20c0ed3405e8956dd9b59cd71e79bef6d16/lib/utils.js#L409-L417
41,723
bigpipe/predefine
index.js
descriptor
function descriptor(obj) { if (!obj || 'object' !== typeof obj || Array.isArray(obj)) return false; var keys = Object.keys(obj); // // A descriptor can only be a data or accessor descriptor, never both. // An data descriptor can only specify: // // - configurable // - enumerable // - (optional) valu...
javascript
function descriptor(obj) { if (!obj || 'object' !== typeof obj || Array.isArray(obj)) return false; var keys = Object.keys(obj); // // A descriptor can only be a data or accessor descriptor, never both. // An data descriptor can only specify: // // - configurable // - enumerable // - (optional) valu...
[ "function", "descriptor", "(", "obj", ")", "{", "if", "(", "!", "obj", "||", "'object'", "!==", "typeof", "obj", "||", "Array", ".", "isArray", "(", "obj", ")", ")", "return", "false", ";", "var", "keys", "=", "Object", ".", "keys", "(", "obj", ")"...
Check if a given object is valid as an descriptor. @param {Object} obj The object with a possible description. @returns {Boolean} @api public
[ "Check", "if", "a", "given", "object", "is", "valid", "as", "an", "descriptor", "." ]
238137e3d1b8288ff5d7529c3cbcdd371888c26b
https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L28-L60
41,724
bigpipe/predefine
index.js
predefine
function predefine(obj, pattern) { pattern = pattern || predefine.READABLE; return function predefined(method, description, clean) { // // If we are given a description compatible Object, use that instead of // setting it as value. This allows easy creation of getters and setters. // if ( ...
javascript
function predefine(obj, pattern) { pattern = pattern || predefine.READABLE; return function predefined(method, description, clean) { // // If we are given a description compatible Object, use that instead of // setting it as value. This allows easy creation of getters and setters. // if ( ...
[ "function", "predefine", "(", "obj", ",", "pattern", ")", "{", "pattern", "=", "pattern", "||", "predefine", ".", "READABLE", ";", "return", "function", "predefined", "(", "method", ",", "description", ",", "clean", ")", "{", "//", "// If we are given a descri...
Predefine, preconfigure an Object.defineProperty. @param {Object} obj The context, prototype or object we define on. @param {Object} pattern The default description. @param {Boolean} override Override the pattern. @returns {Function} The function definition. @api public
[ "Predefine", "preconfigure", "an", "Object", ".", "defineProperty", "." ]
238137e3d1b8288ff5d7529c3cbcdd371888c26b
https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L83-L117
41,725
bigpipe/predefine
index.js
lazy
function lazy(obj, prop, fn) { Object.defineProperty(obj, prop, { configurable: true, get: function get() { return Object.defineProperty(this, prop, { value: fn.call(this) })[prop]; }, set: function set(value) { return Object.defineProperty(this, prop, { value: valu...
javascript
function lazy(obj, prop, fn) { Object.defineProperty(obj, prop, { configurable: true, get: function get() { return Object.defineProperty(this, prop, { value: fn.call(this) })[prop]; }, set: function set(value) { return Object.defineProperty(this, prop, { value: valu...
[ "function", "lazy", "(", "obj", ",", "prop", ",", "fn", ")", "{", "Object", ".", "defineProperty", "(", "obj", ",", "prop", ",", "{", "configurable", ":", "true", ",", "get", ":", "function", "get", "(", ")", "{", "return", "Object", ".", "defineProp...
Lazy initialization pattern. @param {Object} obj The object where we need to add lazy loading prop. @param {String} prop The name of the property that should lazy load. @param {Function} fn The function that returns the lazy laoded value. @api public
[ "Lazy", "initialization", "pattern", "." ]
238137e3d1b8288ff5d7529c3cbcdd371888c26b
https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L127-L143
41,726
bigpipe/predefine
index.js
remove
function remove(obj, keep) { if (!obj) return false; keep = keep || []; for (var prop in obj) { if (has.call(obj, prop) && !~keep.indexOf(prop)) { delete obj[prop]; } } return true; }
javascript
function remove(obj, keep) { if (!obj) return false; keep = keep || []; for (var prop in obj) { if (has.call(obj, prop) && !~keep.indexOf(prop)) { delete obj[prop]; } } return true; }
[ "function", "remove", "(", "obj", ",", "keep", ")", "{", "if", "(", "!", "obj", ")", "return", "false", ";", "keep", "=", "keep", "||", "[", "]", ";", "for", "(", "var", "prop", "in", "obj", ")", "{", "if", "(", "has", ".", "call", "(", "obj"...
Remove all enumerable properties from an given object. @param {Object} obj The object that needs cleaning. @param {Array} keep Properties that should be kept. @api public
[ "Remove", "all", "enumerable", "properties", "from", "an", "given", "object", "." ]
238137e3d1b8288ff5d7529c3cbcdd371888c26b
https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L162-L173
41,727
bigpipe/predefine
index.js
mixin
function mixin(target) { Array.prototype.slice.call(arguments, 1).forEach(function forEach(o) { Object.getOwnPropertyNames(o).forEach(function eachAttr(attr) { Object.defineProperty(target, attr, Object.getOwnPropertyDescriptor(o, attr)); }); }); return target; }
javascript
function mixin(target) { Array.prototype.slice.call(arguments, 1).forEach(function forEach(o) { Object.getOwnPropertyNames(o).forEach(function eachAttr(attr) { Object.defineProperty(target, attr, Object.getOwnPropertyDescriptor(o, attr)); }); }); return target; }
[ "function", "mixin", "(", "target", ")", "{", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ".", "forEach", "(", "function", "forEach", "(", "o", ")", "{", "Object", ".", "getOwnPropertyNames", "(", "o", ")", ...
Mix multiple objects in to one single object that contains the properties of all given objects. This assumes objects that are not nested deeply and it correctly transfers objects that were created using `Object.defineProperty`. @returns {Object} target @api public
[ "Mix", "multiple", "objects", "in", "to", "one", "single", "object", "that", "contains", "the", "properties", "of", "all", "given", "objects", ".", "This", "assumes", "objects", "that", "are", "not", "nested", "deeply", "and", "it", "correctly", "transfers", ...
238137e3d1b8288ff5d7529c3cbcdd371888c26b
https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L206-L214
41,728
bigpipe/predefine
index.js
each
function each(collection, iterator, context) { if (arguments.length === 1) { iterator = collection; collection = this; } var isArray = Array.isArray(collection || this) , length = collection.length , i = 0 , value; if (context) { if (isArray) { for (; i < length; i++) { v...
javascript
function each(collection, iterator, context) { if (arguments.length === 1) { iterator = collection; collection = this; } var isArray = Array.isArray(collection || this) , length = collection.length , i = 0 , value; if (context) { if (isArray) { for (; i < length; i++) { v...
[ "function", "each", "(", "collection", ",", "iterator", ",", "context", ")", "{", "if", "(", "arguments", ".", "length", "===", "1", ")", "{", "iterator", "=", "collection", ";", "collection", "=", "this", ";", "}", "var", "isArray", "=", "Array", ".",...
Iterate over a collection. When you return false, it will stop the iteration. @param {Mixed} collection Either an Array or Object. @param {Function} iterator Function to be called for each item. @param {Mixed} context The context for the iterator. @api public
[ "Iterate", "over", "a", "collection", ".", "When", "you", "return", "false", "it", "will", "stop", "the", "iteration", "." ]
238137e3d1b8288ff5d7529c3cbcdd371888c26b
https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L223-L261
41,729
vigour-io/postcssify
lib/index.js
init
function init (file) { if (!postcssify.entry) { if (dest) { log.info('output: %s', dest) process.on('beforeExit', () => { if (!postcssify.complete) { postcssify.complete = true bundle() } }) postcssify.entry = file } else { return } } r...
javascript
function init (file) { if (!postcssify.entry) { if (dest) { log.info('output: %s', dest) process.on('beforeExit', () => { if (!postcssify.complete) { postcssify.complete = true bundle() } }) postcssify.entry = file } else { return } } r...
[ "function", "init", "(", "file", ")", "{", "if", "(", "!", "postcssify", ".", "entry", ")", "{", "if", "(", "dest", ")", "{", "log", ".", "info", "(", "'output: %s'", ",", "dest", ")", "process", ".", "on", "(", "'beforeExit'", ",", "(", ")", "=>...
init => returns false if no dest is defined
[ "init", "=", ">", "returns", "false", "if", "no", "dest", "is", "defined" ]
f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66
https://github.com/vigour-io/postcssify/blob/f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66/lib/index.js#L68-L84
41,730
vigour-io/postcssify
lib/index.js
bundle
function bundle () { const ordered = order(deps[postcssify.entry], [], {}) const l = ordered.length let ast for (let i = 0; i < l; i++) { const file = ordered[i] const style = styles[file] if (style === void 0) { return } else { if (!ast) { ast = style.clone() } else { ...
javascript
function bundle () { const ordered = order(deps[postcssify.entry], [], {}) const l = ordered.length let ast for (let i = 0; i < l; i++) { const file = ordered[i] const style = styles[file] if (style === void 0) { return } else { if (!ast) { ast = style.clone() } else { ...
[ "function", "bundle", "(", ")", "{", "const", "ordered", "=", "order", "(", "deps", "[", "postcssify", ".", "entry", "]", ",", "[", "]", ",", "{", "}", ")", "const", "l", "=", "ordered", ".", "length", "let", "ast", "for", "(", "let", "i", "=", ...
concat and bundle css
[ "concat", "and", "bundle", "css" ]
f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66
https://github.com/vigour-io/postcssify/blob/f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66/lib/index.js#L301-L329
41,731
vigour-io/postcssify
lib/index.js
order
function order (d, arr, visited) { for (let i in d) { if (!visited[i]) { let obj = d[i] visited[i] = true arr = arr.concat(order(obj, [], visited)) if (css(i)) { arr.push(i) } } } return arr }
javascript
function order (d, arr, visited) { for (let i in d) { if (!visited[i]) { let obj = d[i] visited[i] = true arr = arr.concat(order(obj, [], visited)) if (css(i)) { arr.push(i) } } } return arr }
[ "function", "order", "(", "d", ",", "arr", ",", "visited", ")", "{", "for", "(", "let", "i", "in", "d", ")", "{", "if", "(", "!", "visited", "[", "i", "]", ")", "{", "let", "obj", "=", "d", "[", "i", "]", "visited", "[", "i", "]", "=", "t...
walk deps and return ordered array
[ "walk", "deps", "and", "return", "ordered", "array" ]
f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66
https://github.com/vigour-io/postcssify/blob/f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66/lib/index.js#L352-L364
41,732
MarkGriffiths/string
src/index.js
pad
function pad(str, length, char) { return new BespokeString(str).pad(length, char).toString() }
javascript
function pad(str, length, char) { return new BespokeString(str).pad(length, char).toString() }
[ "function", "pad", "(", "str", ",", "length", ",", "char", ")", "{", "return", "new", "BespokeString", "(", "str", ")", ".", "pad", "(", "length", ",", "char", ")", ".", "toString", "(", ")", "}" ]
Helper method for padding a string. @param {String} str The string to pad. @param {Number} length Target length. @param {String} char Character to use for pad. @return {String} The padded string.
[ "Helper", "method", "for", "padding", "a", "string", "." ]
699a4404d53501c719c34e649a34376a66ff8c62
https://github.com/MarkGriffiths/string/blob/699a4404d53501c719c34e649a34376a66ff8c62/src/index.js#L133-L135
41,733
LeisureLink/magicbus
lib/queue-machine.js
function(callback, options) { return new Promise((resolve, reject) => { let op = () => { return this.channel.subscribe(callback, options) .then(resolve, reject); }; this.on('failed', function(err) { reject(err); }).once(); this.handle('subscr...
javascript
function(callback, options) { return new Promise((resolve, reject) => { let op = () => { return this.channel.subscribe(callback, options) .then(resolve, reject); }; this.on('failed', function(err) { reject(err); }).once(); this.handle('subscr...
[ "function", "(", "callback", ",", "options", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "let", "op", "=", "(", ")", "=>", "{", "return", "this", ".", "channel", ".", "subscribe", "(", "callback", ",", ...
Subscribe to the queue @public @memberOf QueueMachine.prototype @param {Function} callback - the function to be called with each message @param {Object} options - details in consuming from the queue @param {Number} options.limit - the channel prefetch limit @param {bool} options.noBatch - if true, ack/nack/reject oper...
[ "Subscribe", "to", "the", "queue" ]
0370c38ebb8c7917cfd3894263d734aefc2d3d29
https://github.com/LeisureLink/magicbus/blob/0370c38ebb8c7917cfd3894263d734aefc2d3d29/lib/queue-machine.js#L92-L103
41,734
cronvel/kung-fig-expression
lib/Expression.js
parseFnKeyConst
function parseFnKeyConst( str_ , runtime ) { var separatorIndex = nextSeparator( str_ , runtime ) ; var str = str_.slice( runtime.i , separatorIndex ) ; //console.log( 'str before:' , str_ ) ; //console.log( 'str after:' , str ) ; //var indexOf ; //str = str.slice( runtime.i , runtime.iEndOfLine ) ; //if ( ( i...
javascript
function parseFnKeyConst( str_ , runtime ) { var separatorIndex = nextSeparator( str_ , runtime ) ; var str = str_.slice( runtime.i , separatorIndex ) ; //console.log( 'str before:' , str_ ) ; //console.log( 'str after:' , str ) ; //var indexOf ; //str = str.slice( runtime.i , runtime.iEndOfLine ) ; //if ( ( i...
[ "function", "parseFnKeyConst", "(", "str_", ",", "runtime", ")", "{", "var", "separatorIndex", "=", "nextSeparator", "(", "str_", ",", "runtime", ")", ";", "var", "str", "=", "str_", ".", "slice", "(", "runtime", ".", "i", ",", "separatorIndex", ")", ";"...
An identifier that is a function, a key or a constant
[ "An", "identifier", "that", "is", "a", "function", "a", "key", "or", "a", "constant" ]
b9aae3aa2e3a5fdfc13fb6c76794526764485c5b
https://github.com/cronvel/kung-fig-expression/blob/b9aae3aa2e3a5fdfc13fb6c76794526764485c5b/lib/Expression.js#L668-L705
41,735
vamship/config
src/config.js
function(scope) { if (!_argValidator.checkString(scope)) { scope = _applicationScope; } let config = _configCache[scope]; if (!config) { const data = _deepDefaults( _deepDefaults({}, _config[scope]), _config.default ); ...
javascript
function(scope) { if (!_argValidator.checkString(scope)) { scope = _applicationScope; } let config = _configCache[scope]; if (!config) { const data = _deepDefaults( _deepDefaults({}, _config[scope]), _config.default ); ...
[ "function", "(", "scope", ")", "{", "if", "(", "!", "_argValidator", ".", "checkString", "(", "scope", ")", ")", "{", "scope", "=", "_applicationScope", ";", "}", "let", "config", "=", "_configCache", "[", "scope", "]", ";", "if", "(", "!", "config", ...
Returns a configuration object that is scoped to a specific environment. This configuration object will return default application configuration properties, overridden by environment speicific values. @param {String} [scope=<default scope>] The name of the environment for which the application configuration object wil...
[ "Returns", "a", "configuration", "object", "that", "is", "scoped", "to", "a", "specific", "environment", ".", "This", "configuration", "object", "will", "return", "default", "application", "configuration", "properties", "overridden", "by", "environment", "speicific", ...
4678290c4c272efcbc629c91031f867a85d92781
https://github.com/vamship/config/blob/4678290c4c272efcbc629c91031f867a85d92781/src/config.js#L155-L173
41,736
veo-labs/openveo-api
lib/multipart/MultipartParser.js
MultipartParser
function MultipartParser(request, fileFields, limits) { Object.defineProperties(this, { /** * The HTTP request containing a multipart body. * * @property request * @type Request * @final */ request: {value: request}, /** * The list of file field descriptors. * ...
javascript
function MultipartParser(request, fileFields, limits) { Object.defineProperties(this, { /** * The HTTP request containing a multipart body. * * @property request * @type Request * @final */ request: {value: request}, /** * The list of file field descriptors. * ...
[ "function", "MultipartParser", "(", "request", ",", "fileFields", ",", "limits", ")", "{", "Object", ".", "defineProperties", "(", "this", ",", "{", "/**\n * The HTTP request containing a multipart body.\n *\n * @property request\n * @type Request\n * @final\n ...
Defines a multipart parser to parse multipart requests. Use MultipartParser to get fields from multipart requests (including files). @example // Get multipart parser var MultipartParser = require('@openveo/api').multipart.MultipartParser; // Create a request parser expecting several files: files in photos "field" a...
[ "Defines", "a", "multipart", "parser", "to", "parse", "multipart", "requests", "." ]
493a811e9a5ba4d3e14910facaa7452caba1ab38
https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/multipart/MultipartParser.js#L67-L110
41,737
Bartvds/ministyle
lib/common.js
plain
function plain() { var mw = core.base(); mw.plain = function (str) { return String(str); }; mw.error = function (str) { return mw.plain(str); }; mw.warning = function (str) { return mw.plain(str); }; mw.success = function (str) { return mw.plain(str); }; mw.accent = function (str) { ...
javascript
function plain() { var mw = core.base(); mw.plain = function (str) { return String(str); }; mw.error = function (str) { return mw.plain(str); }; mw.warning = function (str) { return mw.plain(str); }; mw.success = function (str) { return mw.plain(str); }; mw.accent = function (str) { ...
[ "function", "plain", "(", ")", "{", "var", "mw", "=", "core", ".", "base", "(", ")", ";", "mw", ".", "plain", "=", "function", "(", "str", ")", "{", "return", "String", "(", "str", ")", ";", "}", ";", "mw", ".", "error", "=", "function", "(", ...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - plain text
[ "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "...
92681e81d4c93faddd4e5d1d6edf44990b3a9e68
https://github.com/Bartvds/ministyle/blob/92681e81d4c93faddd4e5d1d6edf44990b3a9e68/lib/common.js#L50-L75
41,738
Bartvds/ministyle
lib/common.js
empty
function empty() { var mw = plain(); mw.plain = function (str) { str = String(str); var ret = ''; for (var i = 0; i < str.length; i++) { ret += ' '; } return ret; }; mw.toString = function () { return '<ministyle-empty>'; }; return mw; }
javascript
function empty() { var mw = plain(); mw.plain = function (str) { str = String(str); var ret = ''; for (var i = 0; i < str.length; i++) { ret += ' '; } return ret; }; mw.toString = function () { return '<ministyle-empty>'; }; return mw; }
[ "function", "empty", "(", ")", "{", "var", "mw", "=", "plain", "(", ")", ";", "mw", ".", "plain", "=", "function", "(", "str", ")", "{", "str", "=", "String", "(", "str", ")", ";", "var", "ret", "=", "''", ";", "for", "(", "var", "i", "=", ...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - return empty spaces
[ "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "...
92681e81d4c93faddd4e5d1d6edf44990b3a9e68
https://github.com/Bartvds/ministyle/blob/92681e81d4c93faddd4e5d1d6edf44990b3a9e68/lib/common.js#L114-L129
41,739
feedhenry/fh-component-metrics
lib/clients/influxdb.js
influxUdp
function influxUdp(opts) { BaseClient.apply(this, arguments); opts = opts || {}; this.host = opts.host || '127.0.0.1'; this.port = opts.port || 4444; this.socket = dgram.createSocket('udp4'); }
javascript
function influxUdp(opts) { BaseClient.apply(this, arguments); opts = opts || {}; this.host = opts.host || '127.0.0.1'; this.port = opts.port || 4444; this.socket = dgram.createSocket('udp4'); }
[ "function", "influxUdp", "(", "opts", ")", "{", "BaseClient", ".", "apply", "(", "this", ",", "arguments", ")", ";", "opts", "=", "opts", "||", "{", "}", ";", "this", ".", "host", "=", "opts", ".", "host", "||", "'127.0.0.1'", ";", "this", ".", "po...
A client that can send data to Influxdb backend via UDP @param {Object} opts options about the influxdb backend @param {String} opts.host the host of the influxdb. Default is 127.0.0.1 @param {Number} opts.port the port of the UDP port of influxdb. Default is 4444. @param {Number} opts.sendQueueConcurrency specify the ...
[ "A", "client", "that", "can", "send", "data", "to", "Influxdb", "backend", "via", "UDP" ]
c97a1a82ff0144f2a7c2abecbc22084fade1cbc8
https://github.com/feedhenry/fh-component-metrics/blob/c97a1a82ff0144f2a7c2abecbc22084fade1cbc8/lib/clients/influxdb.js#L13-L19
41,740
Mammut-FE/nejm
src/util/dispatcher/dispatcher.js
function(_url,_href){ if (!_url) return; var _info = location.parse(_url); this._$dispatchEvent('onbeforechange',_info); var _umi = this.__doRewriteUMI( _info.path,_href||_info.href ); return this.__groups[this.__pbseed]._$hasUMI(_u...
javascript
function(_url,_href){ if (!_url) return; var _info = location.parse(_url); this._$dispatchEvent('onbeforechange',_info); var _umi = this.__doRewriteUMI( _info.path,_href||_info.href ); return this.__groups[this.__pbseed]._$hasUMI(_u...
[ "function", "(", "_url", ",", "_href", ")", "{", "if", "(", "!", "_url", ")", "return", ";", "var", "_info", "=", "location", ".", "parse", "(", "_url", ")", ";", "this", ".", "_$dispatchEvent", "(", "'onbeforechange'", ",", "_info", ")", ";", "var",...
check event need delegated
[ "check", "event", "need", "delegated" ]
dfc09ac66a8d67620a7aea65e34d8a179976b3fb
https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/dispatcher/dispatcher.js#L538-L546
41,741
Mammut-FE/nejm
src/util/dispatcher/dispatcher.js
function(_target,_message){ var _from = _message.from; while(!!_target){ if (_target._$getPath()!=_from){ _doSendMessage(_target,_message); } _target = _target._$getParent(); } ...
javascript
function(_target,_message){ var _from = _message.from; while(!!_target){ if (_target._$getPath()!=_from){ _doSendMessage(_target,_message); } _target = _target._$getParent(); } ...
[ "function", "(", "_target", ",", "_message", ")", "{", "var", "_from", "=", "_message", ".", "from", ";", "while", "(", "!", "!", "_target", ")", "{", "if", "(", "_target", ".", "_$getPath", "(", ")", "!=", "_from", ")", "{", "_doSendMessage", "(", ...
send message to every node in target path
[ "send", "message", "to", "every", "node", "in", "target", "path" ]
dfc09ac66a8d67620a7aea65e34d8a179976b3fb
https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/dispatcher/dispatcher.js#L983-L991
41,742
Mammut-FE/nejm
src/util/dispatcher/dispatcher.js
function(_target,_message){ var _from = _message.from; _t3._$breadthFirstSearch( _target,function(_node){ if (_node._$getPath()!=_from){ _doSendMessage(_node,_message); } }...
javascript
function(_target,_message){ var _from = _message.from; _t3._$breadthFirstSearch( _target,function(_node){ if (_node._$getPath()!=_from){ _doSendMessage(_node,_message); } }...
[ "function", "(", "_target", ",", "_message", ")", "{", "var", "_from", "=", "_message", ".", "from", ";", "_t3", ".", "_$breadthFirstSearch", "(", "_target", ",", "function", "(", "_node", ")", "{", "if", "(", "_node", ".", "_$getPath", "(", ")", "!=",...
broadcast to all target descendants
[ "broadcast", "to", "all", "target", "descendants" ]
dfc09ac66a8d67620a7aea65e34d8a179976b3fb
https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/dispatcher/dispatcher.js#L993-L1002
41,743
ibm-bluemix-mobile-services/bms-mca-token-validation-strategy
lib/util/token-decoder.js
doTokenValidation
function doTokenValidation(token,publicKey,appId) { var parts = token.split('.'); if (parts.length < 3) { ibmlogger.getLogger().debug("The token decode failure details:", token); return Q.reject(RejectionMessage("The token is malformed.", token,RejectionMessage.INVALID_TOKEN_ERROR)); } ...
javascript
function doTokenValidation(token,publicKey,appId) { var parts = token.split('.'); if (parts.length < 3) { ibmlogger.getLogger().debug("The token decode failure details:", token); return Q.reject(RejectionMessage("The token is malformed.", token,RejectionMessage.INVALID_TOKEN_ERROR)); } ...
[ "function", "doTokenValidation", "(", "token", ",", "publicKey", ",", "appId", ")", "{", "var", "parts", "=", "token", ".", "split", "(", "'.'", ")", ";", "if", "(", "parts", ".", "length", "<", "3", ")", "{", "ibmlogger", ".", "getLogger", "(", ")",...
Verify the token with the public key. And validate the exp, iss and aud with the decoded token.
[ "Verify", "the", "token", "with", "the", "public", "key", ".", "And", "validate", "the", "exp", "iss", "and", "aud", "with", "the", "decoded", "token", "." ]
56c2a7a6cb5a55b75eee3b4da6c5ac801b793a0f
https://github.com/ibm-bluemix-mobile-services/bms-mca-token-validation-strategy/blob/56c2a7a6cb5a55b75eee3b4da6c5ac801b793a0f/lib/util/token-decoder.js#L76-L132
41,744
Everyplay/serverbone
lib/errors/validation_error.js
getErrorMessage
function getErrorMessage(errors) { if (_.isArray(errors)) { return _.uniq(_.pluck(errors, 'stack')).join().replace(/instance./g, ''); } else if (errors) { return errors.message; } }
javascript
function getErrorMessage(errors) { if (_.isArray(errors)) { return _.uniq(_.pluck(errors, 'stack')).join().replace(/instance./g, ''); } else if (errors) { return errors.message; } }
[ "function", "getErrorMessage", "(", "errors", ")", "{", "if", "(", "_", ".", "isArray", "(", "errors", ")", ")", "{", "return", "_", ".", "uniq", "(", "_", ".", "pluck", "(", "errors", ",", "'stack'", ")", ")", ".", "join", "(", ")", ".", "replac...
convert errors given by jsonschema
[ "convert", "errors", "given", "by", "jsonschema" ]
214cf2a5b003c99d8c353f3a750f36309f0f19a2
https://github.com/Everyplay/serverbone/blob/214cf2a5b003c99d8c353f3a750f36309f0f19a2/lib/errors/validation_error.js#L6-L12
41,745
cronvel/logfella
lib/messageFormatter.js
message
function message( data , color ) { var k , messageString = '' ; if ( data.mon ) { messageString = '\n' ; if ( color ) { for ( k in data.mon ) { messageString += string.ansi.green + k + string.ansi.reset + ': ' + string.ansi.cyan + data.mon[ k ] + string.ansi.reset + '\n' ; } } else { for (...
javascript
function message( data , color ) { var k , messageString = '' ; if ( data.mon ) { messageString = '\n' ; if ( color ) { for ( k in data.mon ) { messageString += string.ansi.green + k + string.ansi.reset + ': ' + string.ansi.cyan + data.mon[ k ] + string.ansi.reset + '\n' ; } } else { for (...
[ "function", "message", "(", "data", ",", "color", ")", "{", "var", "k", ",", "messageString", "=", "''", ";", "if", "(", "data", ".", "mon", ")", "{", "messageString", "=", "'\\n'", ";", "if", "(", "color", ")", "{", "for", "(", "k", "in", "data"...
Turn style markup off
[ "Turn", "style", "markup", "off" ]
1b46d80a108d6ad51f9f1732619232de8ff0af53
https://github.com/cronvel/logfella/blob/1b46d80a108d6ad51f9f1732619232de8ff0af53/lib/messageFormatter.js#L43-L78
41,746
cronvel/logfella
lib/messageFormatter.js
hashSymbol
function hashSymbol( value ) { var i , iMax , hash = 0 , output , offset ; value = '' + value ; // At least 3 passes offset = 3 * 16 / value.length ; for ( i = 0 , iMax = value.length ; i < iMax ; i ++ ) { hash ^= value.charCodeAt( i ) << ( ( i * offset ) % 16 ) ; //hash += value.charCodeAt( i ) ; //hash ...
javascript
function hashSymbol( value ) { var i , iMax , hash = 0 , output , offset ; value = '' + value ; // At least 3 passes offset = 3 * 16 / value.length ; for ( i = 0 , iMax = value.length ; i < iMax ; i ++ ) { hash ^= value.charCodeAt( i ) << ( ( i * offset ) % 16 ) ; //hash += value.charCodeAt( i ) ; //hash ...
[ "function", "hashSymbol", "(", "value", ")", "{", "var", "i", ",", "iMax", ",", "hash", "=", "0", ",", "output", ",", "offset", ";", "value", "=", "''", "+", "value", ";", "// At least 3 passes", "offset", "=", "3", "*", "16", "/", "value", ".", "l...
Naive CRC-like algorithm
[ "Naive", "CRC", "-", "like", "algorithm" ]
1b46d80a108d6ad51f9f1732619232de8ff0af53
https://github.com/cronvel/logfella/blob/1b46d80a108d6ad51f9f1732619232de8ff0af53/lib/messageFormatter.js#L95-L121
41,747
andrewscwei/gulp-prismic-mpa-builder
helpers/task-helpers.js
globExts
function globExts() { let exts = _.flattenDeep(_.concat.apply(null, arguments)); return (exts.length <= 1) ? (exts[0] && `.${exts[0]}` || ``) : `.{${exts.join(`,`)}}`; }
javascript
function globExts() { let exts = _.flattenDeep(_.concat.apply(null, arguments)); return (exts.length <= 1) ? (exts[0] && `.${exts[0]}` || ``) : `.{${exts.join(`,`)}}`; }
[ "function", "globExts", "(", ")", "{", "let", "exts", "=", "_", ".", "flattenDeep", "(", "_", ".", "concat", ".", "apply", "(", "null", ",", "arguments", ")", ")", ";", "return", "(", "exts", ".", "length", "<=", "1", ")", "?", "(", "exts", "[", ...
Returns a wildcard glob pattern of the specified file extensions. @param {...(string|string[])} extensions - Extensions to be included in the wildcard pattern. @return {string} - Wildcard glob pattern consisting of all specified extensions.
[ "Returns", "a", "wildcard", "glob", "pattern", "of", "the", "specified", "file", "extensions", "." ]
c7fb9180de2aeca2657f0318c0befbd166a9bff5
https://github.com/andrewscwei/gulp-prismic-mpa-builder/blob/c7fb9180de2aeca2657f0318c0befbd166a9bff5/helpers/task-helpers.js#L121-L124
41,748
LeisureLink/magicbus
lib/amqp/machine-factory.js
function() { this.emit('acquiring'); const onAcquisitionError = (err) => { logger.debug('Resource acquisition failed with error', err); this.emit('failed', err); this.handle('failed'); }; const onAcquired = (o) => { this.item = o; this.waitInterval = 0; ...
javascript
function() { this.emit('acquiring'); const onAcquisitionError = (err) => { logger.debug('Resource acquisition failed with error', err); this.emit('failed', err); this.handle('failed'); }; const onAcquired = (o) => { this.item = o; this.waitInterval = 0; ...
[ "function", "(", ")", "{", "this", ".", "emit", "(", "'acquiring'", ")", ";", "const", "onAcquisitionError", "=", "(", "err", ")", "=>", "{", "logger", ".", "debug", "(", "'Resource acquisition failed with error'", ",", "err", ")", ";", "this", ".", "emit"...
Does the work in acquiring a resource and sets up events for state transitions. @private @memberOf PromiseMachine.prototype
[ "Does", "the", "work", "in", "acquiring", "a", "resource", "and", "sets", "up", "events", "for", "state", "transitions", "." ]
0370c38ebb8c7917cfd3894263d734aefc2d3d29
https://github.com/LeisureLink/magicbus/blob/0370c38ebb8c7917cfd3894263d734aefc2d3d29/lib/amqp/machine-factory.js#L40-L74
41,749
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (str) { var arr = str.split('.'); var obj = root[arr.shift()]; while (arr.length && obj) { obj = obj[arr.shift()]; } return obj; }
javascript
function (str) { var arr = str.split('.'); var obj = root[arr.shift()]; while (arr.length && obj) { obj = obj[arr.shift()]; } return obj; }
[ "function", "(", "str", ")", "{", "var", "arr", "=", "str", ".", "split", "(", "'.'", ")", ";", "var", "obj", "=", "root", "[", "arr", ".", "shift", "(", ")", "]", ";", "while", "(", "arr", ".", "length", "&&", "obj", ")", "{", "obj", "=", ...
Finds globally dot noted namespaced objects from a string
[ "Finds", "globally", "dot", "noted", "namespaced", "objects", "from", "a", "string" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L22-L30
41,750
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (name, instance, singleton) { var arr = (isArray(name)) ? name : (isArray(instance)) ? instance : undefined; // If its a simple array of subviews or configs var map = (!arr && isObject(name) && name instanceof View === false) ? name : undefined; // If its a mapping of subviews ...
javascript
function (name, instance, singleton) { var arr = (isArray(name)) ? name : (isArray(instance)) ? instance : undefined; // If its a simple array of subviews or configs var map = (!arr && isObject(name) && name instanceof View === false) ? name : undefined; // If its a mapping of subviews ...
[ "function", "(", "name", ",", "instance", ",", "singleton", ")", "{", "var", "arr", "=", "(", "isArray", "(", "name", ")", ")", "?", "name", ":", "(", "isArray", "(", "instance", ")", ")", "?", "instance", ":", "undefined", ";", "// If its a simple arr...
Adds a subView or subViews to the View's list of subViews. Calling function must provide instances of views or configurations. @memberOf SubViewManager# @class SubViewManager @type {SubViewManager} @method add @param {Object} map An object with key's to refer to subViews and values that are View instances, options to p...
[ "Adds", "a", "subView", "or", "subViews", "to", "the", "View", "s", "list", "of", "subViews", ".", "Calling", "function", "must", "provide", "instances", "of", "views", "or", "configurations", "." ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L162-L218
41,751
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (key, instance) { if (key instanceof View) { instance = key; key = undefined; } this._addInstance(key, instance); return this; }
javascript
function (key, instance) { if (key instanceof View) { instance = key; key = undefined; } this._addInstance(key, instance); return this; }
[ "function", "(", "key", ",", "instance", ")", "{", "if", "(", "key", "instanceof", "View", ")", "{", "instance", "=", "key", ";", "key", "=", "undefined", ";", "}", "this", ".", "_addInstance", "(", "key", ",", "instance", ")", ";", "return", "this",...
Add a subview instance. If is has a config, the instance will be associated with that config. If the config specifies that the view is a singleton an a view for that key already exists, it will not be added. @param {string|number} key @param {Backbone.View} instance Add a subview instance, without a key. Since it doe...
[ "Add", "a", "subview", "instance", ".", "If", "is", "has", "a", "config", "the", "instance", "will", "be", "associated", "with", "that", "config", ".", "If", "the", "config", "specifies", "that", "the", "view", "is", "a", "singleton", "an", "a", "view", ...
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L234-L241
41,752
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (key, instances) { if (isArray(key)) { instances = key; key = undefined; } var i = -1; var len = instances.length; while (++i < len) { this._addInstance(key, instances[i]); } retu...
javascript
function (key, instances) { if (isArray(key)) { instances = key; key = undefined; } var i = -1; var len = instances.length; while (++i < len) { this._addInstance(key, instances[i]); } retu...
[ "function", "(", "key", ",", "instances", ")", "{", "if", "(", "isArray", "(", "key", ")", ")", "{", "instances", "=", "key", ";", "key", "=", "undefined", ";", "}", "var", "i", "=", "-", "1", ";", "var", "len", "=", "instances", ".", "length", ...
Add a subview for each view instance in an array for a particular key @memberOf SubViewManager# @param {string} key @param {Backbone.View[]} instances @return {SubViewManager} Add a subview for each view instance in an array. They will not be associated with a key and will be only accessible through the subViews arra...
[ "Add", "a", "subview", "for", "each", "view", "instance", "in", "an", "array", "for", "a", "particular", "key" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L259-L270
41,753
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (map) { var key; for (key in map) { if (map.hasOwnProperty(key)) { this.addInstance(key, map[key]); } } return this; }
javascript
function (map) { var key; for (key in map) { if (map.hasOwnProperty(key)) { this.addInstance(key, map[key]); } } return this; }
[ "function", "(", "map", ")", "{", "var", "key", ";", "for", "(", "key", "in", "map", ")", "{", "if", "(", "map", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "this", ".", "addInstance", "(", "key", ",", "map", "[", "key", "]", ")", ";", ...
Add instances using an object that maps subview keys to the instances @param {object} map @return {SubViewManager}
[ "Add", "instances", "using", "an", "object", "that", "maps", "subview", "keys", "to", "the", "instances" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L277-L285
41,754
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (keys, options) { var views = []; var len = keys.length; var i = -1; while (++i < len) { views.push(this._init(keys[i], options)); } return views; }
javascript
function (keys, options) { var views = []; var len = keys.length; var i = -1; while (++i < len) { views.push(this._init(keys[i], options)); } return views; }
[ "function", "(", "keys", ",", "options", ")", "{", "var", "views", "=", "[", "]", ";", "var", "len", "=", "keys", ".", "length", ";", "var", "i", "=", "-", "1", ";", "while", "(", "++", "i", "<", "len", ")", "{", "views", ".", "push", "(", ...
Given an array of keys, a subview will be instantiated for each key based on the configuration for that key. The options param will be passed to each view on instantiation as additional options. @memberOf SubViewManager# @param {String[]} keys @param {Object} options Additional options to pass to each view on init @re...
[ "Given", "an", "array", "of", "keys", "a", "subview", "will", "be", "instantiated", "for", "each", "key", "based", "on", "the", "configuration", "for", "that", "key", ".", "The", "options", "param", "will", "be", "passed", "to", "each", "view", "on", "in...
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L314-L322
41,755
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (options) { var key; for (key in this.config) { if (this.config.hasOwnProperty(key) && this.config[key].singleton) { this._init(key, options); } } return this; }
javascript
function (options) { var key; for (key in this.config) { if (this.config.hasOwnProperty(key) && this.config[key].singleton) { this._init(key, options); } } return this; }
[ "function", "(", "options", ")", "{", "var", "key", ";", "for", "(", "key", "in", "this", ".", "config", ")", "{", "if", "(", "this", ".", "config", ".", "hasOwnProperty", "(", "key", ")", "&&", "this", ".", "config", "[", "key", "]", ".", "singl...
Instantiate all singletons defined in the config. @param {object} options Additional options @return {SubViewManager}
[ "Instantiate", "all", "singletons", "defined", "in", "the", "config", "." ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L329-L337
41,756
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (map) { var key; for (key in map) { if (map.hasOwnProperty(key)) { this._init(key, map[key]); } } return this; }
javascript
function (map) { var key; for (key in map) { if (map.hasOwnProperty(key)) { this._init(key, map[key]); } } return this; }
[ "function", "(", "map", ")", "{", "var", "key", ";", "for", "(", "key", "in", "map", ")", "{", "if", "(", "map", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "this", ".", "_init", "(", "key", ",", "map", "[", "key", "]", ")", ";", "}", ...
Create subviews with a map of configured subview keys to additional options. @param {object} map @return {SubViewManager}
[ "Create", "subviews", "with", "a", "map", "of", "configured", "subview", "keys", "to", "additional", "options", "." ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L344-L352
41,757
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (name, config) { var map = (isObject(name) && !isArray(name)) ? name : false; if (map) { each(map, this._addConfig, this); return this; } return this._addConfig(config, name); }
javascript
function (name, config) { var map = (isObject(name) && !isArray(name)) ? name : false; if (map) { each(map, this._addConfig, this); return this; } return this._addConfig(config, name); }
[ "function", "(", "name", ",", "config", ")", "{", "var", "map", "=", "(", "isObject", "(", "name", ")", "&&", "!", "isArray", "(", "name", ")", ")", "?", "name", ":", "false", ";", "if", "(", "map", ")", "{", "each", "(", "map", ",", "this", ...
Add an configuration for a subview to the SubViewManager. It can be instantiated later with the add function. @memberOf SubViewManager# @type {SubViewManager} @class @method addConfig @param {String} name The name or type that you would like use to refer to subViews created with this config @param {String|Function} con...
[ "Add", "an", "configuration", "for", "a", "subview", "to", "the", "SubViewManager", ".", "It", "can", "be", "instantiated", "later", "with", "the", "add", "function", "." ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L436-L444
41,758
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (key) { var i = -1; var len; var subViews; var subMgr = new SubViewManager(null, this.parent, this.options); subMgr.config = this.config; subViews = (isArray(key)) ? key : (isFunction(key)) ? this.filter(key) : this.getByType(key); ...
javascript
function (key) { var i = -1; var len; var subViews; var subMgr = new SubViewManager(null, this.parent, this.options); subMgr.config = this.config; subViews = (isArray(key)) ? key : (isFunction(key)) ? this.filter(key) : this.getByType(key); ...
[ "function", "(", "key", ")", "{", "var", "i", "=", "-", "1", ";", "var", "len", ";", "var", "subViews", ";", "var", "subMgr", "=", "new", "SubViewManager", "(", "null", ",", "this", ".", "parent", ",", "this", ".", "options", ")", ";", "subMgr", ...
Returns a new SubViewManager instance with filtered list of subviews. @memberOf SubViewManager# @type {SubViewManager} @param {string|Backbone.View[]|function} key The key or type used to refer to a subview or subviews, or a list of subViews with a type found in this SubViewManager config, or a function that will itera...
[ "Returns", "a", "new", "SubViewManager", "instance", "with", "filtered", "list", "of", "subviews", "." ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L521-L533
41,759
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (preserveElems, clearConfigs) { if (!preserveElems) { this.removeElems(); } this.subViews = []; if (this.parent && this.parent.subViews) { this.parent.subViews = this.subViews; } this._subViewsByType = {}; ...
javascript
function (preserveElems, clearConfigs) { if (!preserveElems) { this.removeElems(); } this.subViews = []; if (this.parent && this.parent.subViews) { this.parent.subViews = this.subViews; } this._subViewsByType = {}; ...
[ "function", "(", "preserveElems", ",", "clearConfigs", ")", "{", "if", "(", "!", "preserveElems", ")", "{", "this", ".", "removeElems", "(", ")", ";", "}", "this", ".", "subViews", "=", "[", "]", ";", "if", "(", "this", ".", "parent", "&&", "this", ...
Clears all subViews and subView data off of the SubViewManager instance @memberOf SubViewManager# @type {SubViewManager} @param {Boolean} [preserveElems] If true, view $els are left on the DOM @param {Boolean} [clearConfigs] If true, resets the subView configs as well @return {SubViewManager}
[ "Clears", "all", "subViews", "and", "subView", "data", "off", "of", "the", "SubViewManager", "instance" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L577-L593
41,760
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (key, preserveElems) { var subViews = (key && (typeof key === "string" || key.cid)) ? this.get(key) : key; var len; if (!subViews) { return this; } if (!isArray(subViews)) { subViews = [subViews]; } len = subViews ? subView...
javascript
function (key, preserveElems) { var subViews = (key && (typeof key === "string" || key.cid)) ? this.get(key) : key; var len; if (!subViews) { return this; } if (!isArray(subViews)) { subViews = [subViews]; } len = subViews ? subView...
[ "function", "(", "key", ",", "preserveElems", ")", "{", "var", "subViews", "=", "(", "key", "&&", "(", "typeof", "key", "===", "\"string\"", "||", "key", ".", "cid", ")", ")", "?", "this", ".", "get", "(", "key", ")", ":", "key", ";", "var", "len...
Remove a subView @memberOf SubViewManager# @type {SubViewManager} @param {String|Backbone.View|Backbone.Model} key @param {Boolean} [preserveElems] If true, the View's element will not be removed from the DOM @return {SubViewManager}
[ "Remove", "a", "subView" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L602-L620
41,761
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (keys, preserveElems) { var i = 0; var len = keys ? keys.length : 0; for (i; i < len; i++) { this.remove(keys[i], preserveElems); } return this; }
javascript
function (keys, preserveElems) { var i = 0; var len = keys ? keys.length : 0; for (i; i < len; i++) { this.remove(keys[i], preserveElems); } return this; }
[ "function", "(", "keys", ",", "preserveElems", ")", "{", "var", "i", "=", "0", ";", "var", "len", "=", "keys", "?", "keys", ".", "length", ":", "0", ";", "for", "(", "i", ";", "i", "<", "len", ";", "i", "++", ")", "{", "this", ".", "remove", ...
Remove's all subviews matching any key in a list of keys @memberOf SubViewManager# @param {String[]} keys @param {Boolean} [preserveElems=false] If true, the views' elements will not be removed from the DOM @return {SubViewManager}
[ "Remove", "s", "all", "subviews", "matching", "any", "key", "in", "a", "list", "of", "keys" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L631-L638
41,762
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (subViews) { subViews = subViews || this.subViews; var i = -1; var len = subViews.length; while (++i < len) { subViews[i].remove(); } return this; }
javascript
function (subViews) { subViews = subViews || this.subViews; var i = -1; var len = subViews.length; while (++i < len) { subViews[i].remove(); } return this; }
[ "function", "(", "subViews", ")", "{", "subViews", "=", "subViews", "||", "this", ".", "subViews", ";", "var", "i", "=", "-", "1", ";", "var", "len", "=", "subViews", ".", "length", ";", "while", "(", "++", "i", "<", "len", ")", "{", "subViews", ...
Removes all subView '.el' element from the dom, or if passed a list of subViews, removes only the elements in those. @memberOf SubViewManager# @type {SubViewManager} @param {Backbone.View[]} subViews @return {SubViewManager}
[ "Removes", "all", "subView", ".", "el", "element", "from", "the", "dom", "or", "if", "passed", "a", "list", "of", "subViews", "removes", "only", "the", "elements", "in", "those", "." ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L647-L656
41,763
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (key) { if (key.cid) { return this._subViewsByCid[key.cid] || this._subViewsByModelCid[key.cid]; } if (key.indexOf('.') > -1 && this.dotNotation) { var segs = key.split('.'); var view = this.parent; while (segs....
javascript
function (key) { if (key.cid) { return this._subViewsByCid[key.cid] || this._subViewsByModelCid[key.cid]; } if (key.indexOf('.') > -1 && this.dotNotation) { var segs = key.split('.'); var view = this.parent; while (segs....
[ "function", "(", "key", ")", "{", "if", "(", "key", ".", "cid", ")", "{", "return", "this", ".", "_subViewsByCid", "[", "key", ".", "cid", "]", "||", "this", ".", "_subViewsByModelCid", "[", "key", ".", "cid", "]", ";", "}", "if", "(", "key", "."...
Get a subView instance or an array if multiple instances match your key. @memberOf SubViewManager# @type {SubViewManager} @param {Object|String} [key] The key to a subView singleton, the view's cid the associated model cid, the associated model itself, or the associated view itself. If your key is a string, you can use...
[ "Get", "a", "subView", "instance", "or", "an", "array", "if", "multiple", "instances", "match", "your", "key", "." ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L692-L705
41,764
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (subview) { subview = (subview instanceof View === true) ? subview : this.get(subview); return subview._subviewtype; }
javascript
function (subview) { subview = (subview instanceof View === true) ? subview : this.get(subview); return subview._subviewtype; }
[ "function", "(", "subview", ")", "{", "subview", "=", "(", "subview", "instanceof", "View", "===", "true", ")", "?", "subview", ":", "this", ".", "get", "(", "subview", ")", ";", "return", "subview", ".", "_subviewtype", ";", "}" ]
Get the subviews type or key @memberOf SubViewManager# @type {SubViewManager} @param subview @return {String|Number}
[ "Get", "the", "subviews", "type", "or", "key" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L726-L729
41,765
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (type) { var confs = type ? _.pick(this.config, type) : this.config; each(confs, function (config) { this.parent.$(config.location).html(''); }, this); return this; }
javascript
function (type) { var confs = type ? _.pick(this.config, type) : this.config; each(confs, function (config) { this.parent.$(config.location).html(''); }, this); return this; }
[ "function", "(", "type", ")", "{", "var", "confs", "=", "type", "?", "_", ".", "pick", "(", "this", ".", "config", ",", "type", ")", ":", "this", ".", "config", ";", "each", "(", "confs", ",", "function", "(", "config", ")", "{", "this", ".", "...
Clears the html in all locations specified in the subview configs @memberOf SubViewManager# @type {SubViewManager} @return {SubViewManager}
[ "Clears", "the", "html", "in", "all", "locations", "specified", "in", "the", "subview", "configs" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L747-L753
41,766
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function () { var html = ''; var template = this.template; if (isFunction(template)) { html = template(result(this, 'templateVars')) || ''; } this.$el.html(html); this.subs.renderAppend(); return this; }
javascript
function () { var html = ''; var template = this.template; if (isFunction(template)) { html = template(result(this, 'templateVars')) || ''; } this.$el.html(html); this.subs.renderAppend(); return this; }
[ "function", "(", ")", "{", "var", "html", "=", "''", ";", "var", "template", "=", "this", ".", "template", ";", "if", "(", "isFunction", "(", "template", ")", ")", "{", "html", "=", "template", "(", "result", "(", "this", ",", "'templateVars'", ")", ...
A basic render function that looks for a template function, calls the template with the result of the 'templateVars' property, and then set the html to the result. Then, subviews are rendered and then appended to their locations. @memberOf Backbone.BaseView# @return {Backbone.BaseView}
[ "A", "basic", "render", "function", "that", "looks", "for", "a", "template", "function", "calls", "the", "template", "with", "the", "result", "of", "the", "templateVars", "property", "and", "then", "set", "the", "html", "to", "the", "result", ".", "Then", ...
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L1105-L1114
41,767
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (event) { var args = slice.call(arguments, 1); var stopPropogation; var anscestor; args.unshift(event); args.push(this); anscestor = this; while (anscestor) { anscestor.trigger.apply(anscestor, args); ...
javascript
function (event) { var args = slice.call(arguments, 1); var stopPropogation; var anscestor; args.unshift(event); args.push(this); anscestor = this; while (anscestor) { anscestor.trigger.apply(anscestor, args); ...
[ "function", "(", "event", ")", "{", "var", "args", "=", "slice", ".", "call", "(", "arguments", ",", "1", ")", ";", "var", "stopPropogation", ";", "var", "anscestor", ";", "args", ".", "unshift", "(", "event", ")", ";", "args", ".", "push", "(", "t...
Like Backbone.trigger, except that this will not only use trigger on the instance this method is invoked on, but also the instance's 'parentView', and the parentView's parentView, and so on. Additional arguments beyond the event name will be passed as arguments to the event handler functions. The view that originated t...
[ "Like", "Backbone", ".", "trigger", "except", "that", "this", "will", "not", "only", "use", "trigger", "on", "the", "instance", "this", "method", "is", "invoked", "on", "but", "also", "the", "instance", "s", "parentView", "and", "the", "parentView", "s", "...
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L1177-L1194
41,768
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (event) { var args = slice.call(arguments, 1); var _trigger = function (subViews) { var i = -1; var len = subViews.length; var subSubs; var stopPropogation; var descend; while (++i < len) { ...
javascript
function (event) { var args = slice.call(arguments, 1); var _trigger = function (subViews) { var i = -1; var len = subViews.length; var subSubs; var stopPropogation; var descend; while (++i < len) { ...
[ "function", "(", "event", ")", "{", "var", "args", "=", "slice", ".", "call", "(", "arguments", ",", "1", ")", ";", "var", "_trigger", "=", "function", "(", "subViews", ")", "{", "var", "i", "=", "-", "1", ";", "var", "len", "=", "subViews", ".",...
Triggers an event that will trigger on each of the instances subViews, and then if a subView has subViews, will trigger the event on that subViews' subViews, and so on. If a subView calls stopEvent and passes the event name, then the event will not trigger on that subViews' subViews. Arguments work in the same manner a...
[ "Triggers", "an", "event", "that", "will", "trigger", "on", "each", "of", "the", "instances", "subViews", "and", "then", "if", "a", "subView", "has", "subViews", "will", "trigger", "the", "event", "on", "that", "subViews", "subViews", "and", "so", "on", "....
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L1207-L1233
41,769
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (fnName, args) { var func; var ancestor = this; var isFunc = isFunction(fnName); while (ancestor.parentView) { ancestor = ancestor.parentView; if (ancestor) { func = isFunc ? fnName : ancestor[fnName]; ...
javascript
function (fnName, args) { var func; var ancestor = this; var isFunc = isFunction(fnName); while (ancestor.parentView) { ancestor = ancestor.parentView; if (ancestor) { func = isFunc ? fnName : ancestor[fnName]; ...
[ "function", "(", "fnName", ",", "args", ")", "{", "var", "func", ";", "var", "ancestor", "=", "this", ";", "var", "isFunc", "=", "isFunction", "(", "fnName", ")", ";", "while", "(", "ancestor", ".", "parentView", ")", "{", "ancestor", "=", "ancestor", ...
Invoke a function or method on ancestors @memberOf Backbone.BaseView# @param {Function|String} fnName @param {mixed[]} [args] An array of arguments to pass to the invocation @return {Backbone.BaseView}
[ "Invoke", "a", "function", "or", "method", "on", "ancestors" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L1243-L1255
41,770
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (testFn) { var ancestor = this; while (ancestor.parentView) { ancestor = ancestor.parentView; if (ancestor && testFn(ancestor)) { return ancestor; } } return null; }
javascript
function (testFn) { var ancestor = this; while (ancestor.parentView) { ancestor = ancestor.parentView; if (ancestor && testFn(ancestor)) { return ancestor; } } return null; }
[ "function", "(", "testFn", ")", "{", "var", "ancestor", "=", "this", ";", "while", "(", "ancestor", ".", "parentView", ")", "{", "ancestor", "=", "ancestor", ".", "parentView", ";", "if", "(", "ancestor", "&&", "testFn", "(", "ancestor", ")", ")", "{",...
Ascends up the ancestor line until an a test function returns true @param {Function} testFn A function that returns a truthy value if the current ancestor should be returned @return {Backbone.BaseView|null}
[ "Ascends", "up", "the", "ancestor", "line", "until", "an", "a", "test", "function", "returns", "true" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L1265-L1274
41,771
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (events) { events = events || result(this, 'viewEvents'); each(events, function (func, event) { var segs = event.split(' '); var listenTo = (segs.length > 1) ? this[segs[1]] : this; func = isFunction(func) ? func : this[func]; ...
javascript
function (events) { events = events || result(this, 'viewEvents'); each(events, function (func, event) { var segs = event.split(' '); var listenTo = (segs.length > 1) ? this[segs[1]] : this; func = isFunction(func) ? func : this[func]; ...
[ "function", "(", "events", ")", "{", "events", "=", "events", "||", "result", "(", "this", ",", "'viewEvents'", ")", ";", "each", "(", "events", ",", "function", "(", "func", ",", "event", ")", "{", "var", "segs", "=", "event", ".", "split", "(", "...
Like delegateEvents, except that instead of events being bound to el, the events are backbone events bound to the view object itself. You can create a 'viewEvents' object literal property on a View's prototype, and when it's instantiated, the view will listen for events on a Backone object based on the key. For exampl...
[ "Like", "delegateEvents", "except", "that", "instead", "of", "events", "being", "bound", "to", "el", "the", "events", "are", "backbone", "events", "bound", "to", "the", "view", "object", "itself", ".", "You", "can", "create", "a", "viewEvents", "object", "li...
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L1345-L1357
41,772
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (viewInstance) { console.assert(viewInstance instanceof Backbone.BaseView, 'viewInstance must be an instance of Backbone.BaseView'); var mixins = slice.call(arguments, 1); _marinate(viewInstance, mixins); }
javascript
function (viewInstance) { console.assert(viewInstance instanceof Backbone.BaseView, 'viewInstance must be an instance of Backbone.BaseView'); var mixins = slice.call(arguments, 1); _marinate(viewInstance, mixins); }
[ "function", "(", "viewInstance", ")", "{", "console", ".", "assert", "(", "viewInstance", "instanceof", "Backbone", ".", "BaseView", ",", "'viewInstance must be an instance of Backbone.BaseView'", ")", ";", "var", "mixins", "=", "slice", ".", "call", "(", "arguments...
Marinate only an instance of a view @memberOf module:marinate @param {Backbone.BaseView} viewInstance @param {...object} mixins
[ "Marinate", "only", "an", "instance", "of", "a", "view" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L1460-L1464
41,773
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (View, name, eventsObj) { //eslint-disable-line no-shadow console.assert(View.prototype instanceof Backbone.BaseView, 'View must a Backbone.BaseView constructor'); _addEvents(View.prototype, name, eventsObj); }
javascript
function (View, name, eventsObj) { //eslint-disable-line no-shadow console.assert(View.prototype instanceof Backbone.BaseView, 'View must a Backbone.BaseView constructor'); _addEvents(View.prototype, name, eventsObj); }
[ "function", "(", "View", ",", "name", ",", "eventsObj", ")", "{", "//eslint-disable-line no-shadow", "console", ".", "assert", "(", "View", ".", "prototype", "instanceof", "Backbone", ".", "BaseView", ",", "'View must a Backbone.BaseView constructor'", ")", ";", "_a...
Add DOM events to a BaseView pseudoclass @memberOf module:marinate @param {function} View Constructor for Backbone.BaseView @param {string} name Namespace for your added events @param {object} eventsObj Backbone DOM events hash
[ "Add", "DOM", "events", "to", "a", "BaseView", "pseudoclass" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L1472-L1475
41,774
1stdibs/backbone-base-and-form-view
backbone-baseview.js
function (viewInstance, name, eventsObj) { console.assert(viewInstance instanceof Backbone.BaseView, 'viewInstance must be an instance of Backbone.BaseView'); _addEvents(viewInstance, name, eventsObj); }
javascript
function (viewInstance, name, eventsObj) { console.assert(viewInstance instanceof Backbone.BaseView, 'viewInstance must be an instance of Backbone.BaseView'); _addEvents(viewInstance, name, eventsObj); }
[ "function", "(", "viewInstance", ",", "name", ",", "eventsObj", ")", "{", "console", ".", "assert", "(", "viewInstance", "instanceof", "Backbone", ".", "BaseView", ",", "'viewInstance must be an instance of Backbone.BaseView'", ")", ";", "_addEvents", "(", "viewInstan...
Add DOM events to a BaseView instance @memberOf module:marinate @param {Backbone.BaseView} viewInstance @param {string} name Namespace for your added events @param {object} eventsObj Backbone DOM events hash
[ "Add", "DOM", "events", "to", "a", "BaseView", "instance" ]
9c49f9ac059ba3177b61f7395151de78b506e8f7
https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L1483-L1486
41,775
chip-js/observations-js
src/observations.js
function(context, expression, onChange, callbackContext) { var observer = this.createObserver(expression, onChange, callbackContext || context); observer.bind(context); return observer; }
javascript
function(context, expression, onChange, callbackContext) { var observer = this.createObserver(expression, onChange, callbackContext || context); observer.bind(context); return observer; }
[ "function", "(", "context", ",", "expression", ",", "onChange", ",", "callbackContext", ")", "{", "var", "observer", "=", "this", ".", "createObserver", "(", "expression", ",", "onChange", ",", "callbackContext", "||", "context", ")", ";", "observer", ".", "...
Observes any changes to the result of the expression on the context object and calls the callback. @param {Object} context The context to bind the expression against @param {String} expression The expression to observe @param {Function} onChange The function which will be called when the expression value changes @retur...
[ "Observes", "any", "changes", "to", "the", "result", "of", "the", "expression", "on", "the", "context", "object", "and", "calls", "the", "callback", "." ]
a48b32a648089bc86b502712d78cd0b3f8317d50
https://github.com/chip-js/observations-js/blob/a48b32a648089bc86b502712d78cd0b3f8317d50/src/observations.js#L56-L60
41,776
chip-js/observations-js
src/observations.js
function(expression, options) { if (options && options.isSetter) { return expressions.parseSetter(expression, this.globals, this.formatters, options.extraArgs); } else if (options && options.extraArgs) { var allArgs = [expression, this.globals, this.formatters].concat(options.extraArgs); retur...
javascript
function(expression, options) { if (options && options.isSetter) { return expressions.parseSetter(expression, this.globals, this.formatters, options.extraArgs); } else if (options && options.extraArgs) { var allArgs = [expression, this.globals, this.formatters].concat(options.extraArgs); retur...
[ "function", "(", "expression", ",", "options", ")", "{", "if", "(", "options", "&&", "options", ".", "isSetter", ")", "{", "return", "expressions", ".", "parseSetter", "(", "expression", ",", "this", ".", "globals", ",", "this", ".", "formatters", ",", "...
Parses an expression into a function using the globals and formatters objects associated with this instance of observations. @param {String} expression The expression string to parse into a function @param {Object} options Additional options to pass to the parser. `{ isSetter: true }` will make this expression a setter...
[ "Parses", "an", "expression", "into", "a", "function", "using", "the", "globals", "and", "formatters", "objects", "associated", "with", "this", "instance", "of", "observations", "." ]
a48b32a648089bc86b502712d78cd0b3f8317d50
https://github.com/chip-js/observations-js/blob/a48b32a648089bc86b502712d78cd0b3f8317d50/src/observations.js#L181-L190
41,777
chip-js/observations-js
src/observations.js
function(source, expression, value) { return this.getExpression(expression, { isSetter: true }).call(source, value); }
javascript
function(source, expression, value) { return this.getExpression(expression, { isSetter: true }).call(source, value); }
[ "function", "(", "source", ",", "expression", ",", "value", ")", "{", "return", "this", ".", "getExpression", "(", "expression", ",", "{", "isSetter", ":", "true", "}", ")", ".", "call", "(", "source", ",", "value", ")", ";", "}" ]
Sets the value on the expression in the given context object @param {Object} context The context object the expression will be evaluated against @param {String} expression The expression to set a value with @param {mixed} value The value to set on the expression @return {mixed} The result of the expression against the ...
[ "Sets", "the", "value", "on", "the", "expression", "in", "the", "given", "context", "object" ]
a48b32a648089bc86b502712d78cd0b3f8317d50
https://github.com/chip-js/observations-js/blob/a48b32a648089bc86b502712d78cd0b3f8317d50/src/observations.js#L211-L213
41,778
chip-js/observations-js
src/observations.js
function(callback) { if (typeof callback === 'function') { this.afterSync(callback); } if (this.pendingSync) { return false; } var fallback = setTimeout(this.syncNow, 500); this.windows = this.windows.filter(this.removeClosed); this.pendingSync = this.windows.map(this.queueSync...
javascript
function(callback) { if (typeof callback === 'function') { this.afterSync(callback); } if (this.pendingSync) { return false; } var fallback = setTimeout(this.syncNow, 500); this.windows = this.windows.filter(this.removeClosed); this.pendingSync = this.windows.map(this.queueSync...
[ "function", "(", "callback", ")", "{", "if", "(", "typeof", "callback", "===", "'function'", ")", "{", "this", ".", "afterSync", "(", "callback", ")", ";", "}", "if", "(", "this", ".", "pendingSync", ")", "{", "return", "false", ";", "}", "var", "fal...
Schedules an observer sync cycle which checks all the observers to see if they've changed.
[ "Schedules", "an", "observer", "sync", "cycle", "which", "checks", "all", "the", "observers", "to", "see", "if", "they", "ve", "changed", "." ]
a48b32a648089bc86b502712d78cd0b3f8317d50
https://github.com/chip-js/observations-js/blob/a48b32a648089bc86b502712d78cd0b3f8317d50/src/observations.js#L217-L230
41,779
chip-js/observations-js
src/observations.js
function(callback) { if (typeof callback === 'function') { this.afterSync(callback); } if (this.pendingSync) { clearTimeout(this.pendingSync.pop()); this.pendingSync.forEach(this.cancelQueue); this.pendingSync = null; } if (this.syncing) { this.rerun = true; ret...
javascript
function(callback) { if (typeof callback === 'function') { this.afterSync(callback); } if (this.pendingSync) { clearTimeout(this.pendingSync.pop()); this.pendingSync.forEach(this.cancelQueue); this.pendingSync = null; } if (this.syncing) { this.rerun = true; ret...
[ "function", "(", "callback", ")", "{", "if", "(", "typeof", "callback", "===", "'function'", ")", "{", "this", ".", "afterSync", "(", "callback", ")", ";", "}", "if", "(", "this", ".", "pendingSync", ")", "{", "clearTimeout", "(", "this", ".", "pending...
Runs the observer sync cycle which checks all the observers to see if they've changed.
[ "Runs", "the", "observer", "sync", "cycle", "which", "checks", "all", "the", "observers", "to", "see", "if", "they", "ve", "changed", "." ]
a48b32a648089bc86b502712d78cd0b3f8317d50
https://github.com/chip-js/observations-js/blob/a48b32a648089bc86b502712d78cd0b3f8317d50/src/observations.js#L234-L252
41,780
chip-js/observations-js
src/observations.js
function(observer, skipUpdate) { this.observers.add(observer); if (!skipUpdate) { observer.forceUpdateNextSync = true; observer.sync(); } }
javascript
function(observer, skipUpdate) { this.observers.add(observer); if (!skipUpdate) { observer.forceUpdateNextSync = true; observer.sync(); } }
[ "function", "(", "observer", ",", "skipUpdate", ")", "{", "this", ".", "observers", ".", "add", "(", "observer", ")", ";", "if", "(", "!", "skipUpdate", ")", "{", "observer", ".", "forceUpdateNextSync", "=", "true", ";", "observer", ".", "sync", "(", "...
Adds a new observer to be synced with changes. If `skipUpdate` is true then the callback will only be called when a change is made, not initially.
[ "Adds", "a", "new", "observer", "to", "be", "synced", "with", "changes", ".", "If", "skipUpdate", "is", "true", "then", "the", "callback", "will", "only", "be", "called", "when", "a", "change", "is", "made", "not", "initially", "." ]
a48b32a648089bc86b502712d78cd0b3f8317d50
https://github.com/chip-js/observations-js/blob/a48b32a648089bc86b502712d78cd0b3f8317d50/src/observations.js#L329-L335
41,781
inadarei/nodebootstrap-server
app.js
configure_logging
function configure_logging() { if ('log' in CONF) { if ('plugin' in CONF.log) { process.env.NODE_LOGGER_PLUGIN = CONF.log.plugin; } if ('level' in CONF.log) { process.env.NODE_LOGGER_LEVEL = CONF.log.level; } if ('customlevels' in CONF.log) { for (var key in CONF.log.customlevels) { proc...
javascript
function configure_logging() { if ('log' in CONF) { if ('plugin' in CONF.log) { process.env.NODE_LOGGER_PLUGIN = CONF.log.plugin; } if ('level' in CONF.log) { process.env.NODE_LOGGER_LEVEL = CONF.log.level; } if ('customlevels' in CONF.log) { for (var key in CONF.log.customlevels) { proc...
[ "function", "configure_logging", "(", ")", "{", "if", "(", "'log'", "in", "CONF", ")", "{", "if", "(", "'plugin'", "in", "CONF", ".", "log", ")", "{", "process", ".", "env", ".", "NODE_LOGGER_PLUGIN", "=", "CONF", ".", "log", ".", "plugin", ";", "}",...
Default configuration of logging
[ "Default", "configuration", "of", "logging" ]
250b5affd440b6030e7fb7eb435c5d952abf91af
https://github.com/inadarei/nodebootstrap-server/blob/250b5affd440b6030e7fb7eb435c5d952abf91af/app.js#L117-L129
41,782
ofidj/fidj
.todo/miapp.tools.storage.js
errorMessage
function errorMessage(fileError) { var msg = ''; switch (fileError.code) { case FileError.NOT_FOUND_ERR: msg = 'File not found'; break; case FileError.SECURITY_ERR: // You may need the --allow-file-access-from-files flag ...
javascript
function errorMessage(fileError) { var msg = ''; switch (fileError.code) { case FileError.NOT_FOUND_ERR: msg = 'File not found'; break; case FileError.SECURITY_ERR: // You may need the --allow-file-access-from-files flag ...
[ "function", "errorMessage", "(", "fileError", ")", "{", "var", "msg", "=", "''", ";", "switch", "(", "fileError", ".", "code", ")", "{", "case", "FileError", ".", "NOT_FOUND_ERR", ":", "msg", "=", "'File not found'", ";", "break", ";", "case", "FileError",...
Private API helper functions and variables hidden within this function scope
[ "Private", "API", "helper", "functions", "and", "variables", "hidden", "within", "this", "function", "scope" ]
e57ebece54ee68211d43802a8e0feeef098d3e36
https://github.com/ofidj/fidj/blob/e57ebece54ee68211d43802a8e0feeef098d3e36/.todo/miapp.tools.storage.js#L1356-L1404
41,783
cafjs/caf_components
lib/templateUtils.js
function(template, delta) { assert.ok(Array.isArray(template), "'template' is not an array"); assert.ok(Array.isArray(delta), "'delta' is not an array"); /* * This merge step is inefficient O(n*m) but we are assuming small arrays * and 'delta' typically smaller than 'template'. * * ...
javascript
function(template, delta) { assert.ok(Array.isArray(template), "'template' is not an array"); assert.ok(Array.isArray(delta), "'delta' is not an array"); /* * This merge step is inefficient O(n*m) but we are assuming small arrays * and 'delta' typically smaller than 'template'. * * ...
[ "function", "(", "template", ",", "delta", ")", "{", "assert", ".", "ok", "(", "Array", ".", "isArray", "(", "template", ")", ",", "\"'template' is not an array\"", ")", ";", "assert", ".", "ok", "(", "Array", ".", "isArray", "(", "delta", ")", ",", "\...
Merge two component arrays of matching components. @param {Array.<specType>} template @param {Array.<specDeltaType>} delta @return {Array.<specType>} result
[ "Merge", "two", "component", "arrays", "of", "matching", "components", "." ]
dca28007d6618066df8ed058362f0d4a0745c2cf
https://github.com/cafjs/caf_components/blob/dca28007d6618066df8ed058362f0d4a0745c2cf/lib/templateUtils.js#L63-L126
41,784
cafjs/caf_components
lib/templateUtils.js
function(template, delta) { assert.equal(typeof(template), 'object', "'template' is not an object"); assert.equal(typeof(delta), 'object', "'delta' is not an object"); var result = myUtils.deepClone(template); Object.keys(delta).forEach(function(x) { result[x] = myUtils.deepClone(delta[x]); ...
javascript
function(template, delta) { assert.equal(typeof(template), 'object', "'template' is not an object"); assert.equal(typeof(delta), 'object', "'delta' is not an object"); var result = myUtils.deepClone(template); Object.keys(delta).forEach(function(x) { result[x] = myUtils.deepClone(delta[x]); ...
[ "function", "(", "template", ",", "delta", ")", "{", "assert", ".", "equal", "(", "typeof", "(", "template", ")", ",", "'object'", ",", "\"'template' is not an object\"", ")", ";", "assert", ".", "equal", "(", "typeof", "(", "delta", ")", ",", "'object'", ...
Merge two environments of matching components. @param {Object} template @param {Object} delta @return {Object} result
[ "Merge", "two", "environments", "of", "matching", "components", "." ]
dca28007d6618066df8ed058362f0d4a0745c2cf
https://github.com/cafjs/caf_components/blob/dca28007d6618066df8ed058362f0d4a0745c2cf/lib/templateUtils.js#L135-L144
41,785
cafjs/caf_components
lib/templateUtils.js
function(template, delta, overrideName) { if (template.name !== delta.name) { if (!overrideName) { var err = new Error('mergeObj: description names do not match'); err['template'] = template; err['delta'] = delta; throw err; } } /** @type spec...
javascript
function(template, delta, overrideName) { if (template.name !== delta.name) { if (!overrideName) { var err = new Error('mergeObj: description names do not match'); err['template'] = template; err['delta'] = delta; throw err; } } /** @type spec...
[ "function", "(", "template", ",", "delta", ",", "overrideName", ")", "{", "if", "(", "template", ".", "name", "!==", "delta", ".", "name", ")", "{", "if", "(", "!", "overrideName", ")", "{", "var", "err", "=", "new", "Error", "(", "'mergeObj: descripti...
Merge two descriptions with the same name. @param {specType} template @param {specDeltaType} delta @param {boolean} overrideName @return {specType} result
[ "Merge", "two", "descriptions", "with", "the", "same", "name", "." ]
dca28007d6618066df8ed058362f0d4a0745c2cf
https://github.com/cafjs/caf_components/blob/dca28007d6618066df8ed058362f0d4a0745c2cf/lib/templateUtils.js#L156-L180
41,786
cafjs/caf_components
lib/templateUtils.js
function(desc, f) { if (typeof desc === 'object') { f(desc.env); if (Array.isArray(desc.components)) { desc.components.forEach(function(x) { patchEnv(x, f);}); } } else { var err = new Error('patchEnv: not an object'); err['desc'] = desc; throw err; ...
javascript
function(desc, f) { if (typeof desc === 'object') { f(desc.env); if (Array.isArray(desc.components)) { desc.components.forEach(function(x) { patchEnv(x, f);}); } } else { var err = new Error('patchEnv: not an object'); err['desc'] = desc; throw err; ...
[ "function", "(", "desc", ",", "f", ")", "{", "if", "(", "typeof", "desc", "===", "'object'", ")", "{", "f", "(", "desc", ".", "env", ")", ";", "if", "(", "Array", ".", "isArray", "(", "desc", ".", "components", ")", ")", "{", "desc", ".", "comp...
Patches every environment in a description. @param {specType} desc A description to patch. @param {function(Object)} f A function to patch an environment.
[ "Patches", "every", "environment", "in", "a", "description", "." ]
dca28007d6618066df8ed058362f0d4a0745c2cf
https://github.com/cafjs/caf_components/blob/dca28007d6618066df8ed058362f0d4a0745c2cf/lib/templateUtils.js#L215-L226
41,787
cafjs/caf_components
lib/templateUtils.js
function(prefix, f) { var retF = function(env) { Object.keys(env) .forEach(function(x) { var val = env[x]; if ((typeof val === 'string') && (val.indexOf(prefix) === 0)) { var propName = val.substring(prefix.length, ...
javascript
function(prefix, f) { var retF = function(env) { Object.keys(env) .forEach(function(x) { var val = env[x]; if ((typeof val === 'string') && (val.indexOf(prefix) === 0)) { var propName = val.substring(prefix.length, ...
[ "function", "(", "prefix", ",", "f", ")", "{", "var", "retF", "=", "function", "(", "env", ")", "{", "Object", ".", "keys", "(", "env", ")", ".", "forEach", "(", "function", "(", "x", ")", "{", "var", "val", "=", "env", "[", "x", "]", ";", "i...
Returns a function that filters relevant values in an environment and applies a transform to them. @param {string} prefix A matching prefix for selected values. @param {function(string): Object} f A function that transforms matching values.
[ "Returns", "a", "function", "that", "filters", "relevant", "values", "in", "an", "environment", "and", "applies", "a", "transform", "to", "them", "." ]
dca28007d6618066df8ed058362f0d4a0745c2cf
https://github.com/cafjs/caf_components/blob/dca28007d6618066df8ed058362f0d4a0745c2cf/lib/templateUtils.js#L237-L255
41,788
repetere/periodicjs.core.mailer
lib/getTransport.js
getTransport
function getTransport(options = {}) { return new Promise((resolve, reject) => { try { const defaultTransport = { type: 'direct', transportOptions: { debug: true } }; const { transportObject = defaultTransport, } = options; const nodemailerTransporter = nodemailer.createTran...
javascript
function getTransport(options = {}) { return new Promise((resolve, reject) => { try { const defaultTransport = { type: 'direct', transportOptions: { debug: true } }; const { transportObject = defaultTransport, } = options; const nodemailerTransporter = nodemailer.createTran...
[ "function", "getTransport", "(", "options", "=", "{", "}", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "try", "{", "const", "defaultTransport", "=", "{", "type", ":", "'direct'", ",", "transportOptions", ":",...
returns a node mailer transport based off of a json configuration @param {any} [options={}] @param {object} options.transportObject the json configuration for a node mailer transport @param {string} options.transportObject.transportType [ses|direct|sendmail|smtp-pool|sendgrid|sendgridapi|mailgun|stub] @param {object} ...
[ "returns", "a", "node", "mailer", "transport", "based", "off", "of", "a", "json", "configuration" ]
f544584cb1520015adac0326f8b02c38fbbd3417
https://github.com/repetere/periodicjs.core.mailer/blob/f544584cb1520015adac0326f8b02c38fbbd3417/lib/getTransport.js#L38-L64
41,789
typhonjs-node-escomplex/escomplex-plugin-syntax-babylon
src/PluginSyntaxBabylon.js
s_SAFE_COMPUTED_OPERANDS
function s_SAFE_COMPUTED_OPERANDS(node) { const operands = []; if (typeof node.computed === 'boolean' && node.computed) { // The following will pick up a single literal computed value (string). if (node.key.type === 'StringLiteral') { operands.push(TraitUtil.safeValue(node.key)); ...
javascript
function s_SAFE_COMPUTED_OPERANDS(node) { const operands = []; if (typeof node.computed === 'boolean' && node.computed) { // The following will pick up a single literal computed value (string). if (node.key.type === 'StringLiteral') { operands.push(TraitUtil.safeValue(node.key)); ...
[ "function", "s_SAFE_COMPUTED_OPERANDS", "(", "node", ")", "{", "const", "operands", "=", "[", "]", ";", "if", "(", "typeof", "node", ".", "computed", "===", "'boolean'", "&&", "node", ".", "computed", ")", "{", "// The following will pick up a single literal compu...
Provides a utility method that determines the operands of a method for Babylon AST nodes. If the name is a computed value and not a string literal then `ASTGenerator` is invoked to determine the computed operands. @param {object} node - The current AST node. @returns {Array<*>}
[ "Provides", "a", "utility", "method", "that", "determines", "the", "operands", "of", "a", "method", "for", "Babylon", "AST", "nodes", ".", "If", "the", "name", "is", "a", "computed", "value", "and", "not", "a", "string", "literal", "then", "ASTGenerator", ...
d0ce535ccebb2f8afc4bc991db6611fcd7e01ce5
https://github.com/typhonjs-node-escomplex/escomplex-plugin-syntax-babylon/blob/d0ce535ccebb2f8afc4bc991db6611fcd7e01ce5/src/PluginSyntaxBabylon.js#L269-L291
41,790
Mammut-FE/nejm
src/base/element.js
function(_list){ var _result = 0; _u._$forEach( _list,function(_size){ if (!_size) return; if (!_result){ _result = _size; }else{ _result = Math.min(_result,_size); ...
javascript
function(_list){ var _result = 0; _u._$forEach( _list,function(_size){ if (!_size) return; if (!_result){ _result = _size; }else{ _result = Math.min(_result,_size); ...
[ "function", "(", "_list", ")", "{", "var", "_result", "=", "0", ";", "_u", ".", "_$forEach", "(", "_list", ",", "function", "(", "_size", ")", "{", "if", "(", "!", "_size", ")", "return", ";", "if", "(", "!", "_result", ")", "{", "_result", "=", ...
get min value but not zero
[ "get", "min", "value", "but", "not", "zero" ]
dfc09ac66a8d67620a7aea65e34d8a179976b3fb
https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/base/element.js#L463-L476
41,791
jldec/pub-resolve-opts
resolve-opts.js
injectPaths
function injectPaths(paths) { u.each(paths, function(path) { if (path.inject) { // injected css and js sources are always rooted paths var src = mkSrc(path); if (/\.css$/i.test(src.path)) return opts.injectCss.push(src); if (/\.js$|\.es6$|\.jsx$/i.test(src.path)) return opts.in...
javascript
function injectPaths(paths) { u.each(paths, function(path) { if (path.inject) { // injected css and js sources are always rooted paths var src = mkSrc(path); if (/\.css$/i.test(src.path)) return opts.injectCss.push(src); if (/\.js$|\.es6$|\.jsx$/i.test(src.path)) return opts.in...
[ "function", "injectPaths", "(", "paths", ")", "{", "u", ".", "each", "(", "paths", ",", "function", "(", "path", ")", "{", "if", "(", "path", ".", "inject", ")", "{", "// injected css and js sources are always rooted paths", "var", "src", "=", "mkSrc", "(", ...
add injectable staticPaths to opts.injectCss or opts.injectJs
[ "add", "injectable", "staticPaths", "to", "opts", ".", "injectCss", "or", "opts", ".", "injectJs" ]
432dce8a638e1a909256179957a4ec25ac9542b7
https://github.com/jldec/pub-resolve-opts/blob/432dce8a638e1a909256179957a4ec25ac9542b7/resolve-opts.js#L214-L224
41,792
jldec/pub-resolve-opts
resolve-opts.js
watchOpts
function watchOpts(src) { if ((src._pkg && !opts.watchPkgs) || ('watch' in src && !src.watch)) return false; return (typeof src.watch === 'object') ? src.watch : {}; }
javascript
function watchOpts(src) { if ((src._pkg && !opts.watchPkgs) || ('watch' in src && !src.watch)) return false; return (typeof src.watch === 'object') ? src.watch : {}; }
[ "function", "watchOpts", "(", "src", ")", "{", "if", "(", "(", "src", ".", "_pkg", "&&", "!", "opts", ".", "watchPkgs", ")", "||", "(", "'watch'", "in", "src", "&&", "!", "src", ".", "watch", ")", ")", "return", "false", ";", "return", "(", "type...
don't watch inside packages unless opts.watchPkgs don't watch if src.watch = falsy
[ "don", "t", "watch", "inside", "packages", "unless", "opts", ".", "watchPkgs", "don", "t", "watch", "if", "src", ".", "watch", "=", "falsy" ]
432dce8a638e1a909256179957a4ec25ac9542b7
https://github.com/jldec/pub-resolve-opts/blob/432dce8a638e1a909256179957a4ec25ac9542b7/resolve-opts.js#L334-L337
41,793
jldec/pub-resolve-opts
resolve-opts.js
normalizeOptsKey
function normalizeOptsKey(aval, basedir, pkg) { aval = aval || []; if (!u.isArray(aval)) { aval = [ aval ]; } return u.map(u.compact(aval), function(val) { return normalize(val, basedir, pkg); }); }
javascript
function normalizeOptsKey(aval, basedir, pkg) { aval = aval || []; if (!u.isArray(aval)) { aval = [ aval ]; } return u.map(u.compact(aval), function(val) { return normalize(val, basedir, pkg); }); }
[ "function", "normalizeOptsKey", "(", "aval", ",", "basedir", ",", "pkg", ")", "{", "aval", "=", "aval", "||", "[", "]", ";", "if", "(", "!", "u", ".", "isArray", "(", "aval", ")", ")", "{", "aval", "=", "[", "aval", "]", ";", "}", "return", "u"...
normalize a single opts key
[ "normalize", "a", "single", "opts", "key" ]
432dce8a638e1a909256179957a4ec25ac9542b7
https://github.com/jldec/pub-resolve-opts/blob/432dce8a638e1a909256179957a4ec25ac9542b7/resolve-opts.js#L362-L374
41,794
jldec/pub-resolve-opts
resolve-opts.js
normalize
function normalize(val, basedir, pkg) { if (typeof val === 'string') { val = { path: val }; } var originalPath = val.path; // npm3 treatment of sub-package paths starting with ./node_modules/ var subPkgName = val.path.replace(/^\.\/node_modules\/([^/]+).*/,'$1'); if (subPkgName != origi...
javascript
function normalize(val, basedir, pkg) { if (typeof val === 'string') { val = { path: val }; } var originalPath = val.path; // npm3 treatment of sub-package paths starting with ./node_modules/ var subPkgName = val.path.replace(/^\.\/node_modules\/([^/]+).*/,'$1'); if (subPkgName != origi...
[ "function", "normalize", "(", "val", ",", "basedir", ",", "pkg", ")", "{", "if", "(", "typeof", "val", "===", "'string'", ")", "{", "val", "=", "{", "path", ":", "val", "}", ";", "}", "var", "originalPath", "=", "val", ".", "path", ";", "// npm3 tr...
normalize a single opts key value
[ "normalize", "a", "single", "opts", "key", "value" ]
432dce8a638e1a909256179957a4ec25ac9542b7
https://github.com/jldec/pub-resolve-opts/blob/432dce8a638e1a909256179957a4ec25ac9542b7/resolve-opts.js#L377-L408
41,795
vesln/hydro
lib/timeout-error.js
TimeoutError
function TimeoutError(message) { this.message = message; this.timeout = true; Error.captureStackTrace(this, arguments.callee); }
javascript
function TimeoutError(message) { this.message = message; this.timeout = true; Error.captureStackTrace(this, arguments.callee); }
[ "function", "TimeoutError", "(", "message", ")", "{", "this", ".", "message", "=", "message", ";", "this", ".", "timeout", "=", "true", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "arguments", ".", "callee", ")", ";", "}" ]
Timeout Error. @param {String} message @constructor
[ "Timeout", "Error", "." ]
3f4d2e4926f913976187376e82f1496514c39890
https://github.com/vesln/hydro/blob/3f4d2e4926f913976187376e82f1496514c39890/lib/timeout-error.js#L8-L13
41,796
arokor/pararr.js
lib/paworker.js
onFunction
function onFunction(data, op, iterStr, context) { var iter, data; // Check task if(!op || !data || !iterStr || !context) { throw Error('Worker received invalid task'); } // parse the serialized function // eval() may be evil but here we don't have much choice eval('var iter = ' + iterStr); switch(op) ...
javascript
function onFunction(data, op, iterStr, context) { var iter, data; // Check task if(!op || !data || !iterStr || !context) { throw Error('Worker received invalid task'); } // parse the serialized function // eval() may be evil but here we don't have much choice eval('var iter = ' + iterStr); switch(op) ...
[ "function", "onFunction", "(", "data", ",", "op", ",", "iterStr", ",", "context", ")", "{", "var", "iter", ",", "data", ";", "// Check task", "if", "(", "!", "op", "||", "!", "data", "||", "!", "iterStr", "||", "!", "context", ")", "{", "throw", "E...
Handle functional requests
[ "Handle", "functional", "requests" ]
215ddc452e24fd239b42de3997738510d1888135
https://github.com/arokor/pararr.js/blob/215ddc452e24fd239b42de3997738510d1888135/lib/paworker.js#L2-L31
41,797
arokor/pararr.js
lib/paworker.js
onExec
function onExec(funcStr, parStr, context) { var func, par, data, err = null; try { // Check task if(!funcStr || !context) { throw Error('Worker received invalid task'); } par = parStr ? JSON.parse(parStr) : null; // parse the serialized function // eval() may be evil but here we don't have mu...
javascript
function onExec(funcStr, parStr, context) { var func, par, data, err = null; try { // Check task if(!funcStr || !context) { throw Error('Worker received invalid task'); } par = parStr ? JSON.parse(parStr) : null; // parse the serialized function // eval() may be evil but here we don't have mu...
[ "function", "onExec", "(", "funcStr", ",", "parStr", ",", "context", ")", "{", "var", "func", ",", "par", ",", "data", ",", "err", "=", "null", ";", "try", "{", "// Check task", "if", "(", "!", "funcStr", "||", "!", "context", ")", "{", "throw", "E...
Handle exec requests
[ "Handle", "exec", "requests" ]
215ddc452e24fd239b42de3997738510d1888135
https://github.com/arokor/pararr.js/blob/215ddc452e24fd239b42de3997738510d1888135/lib/paworker.js#L34-L62
41,798
veo-labs/openveo-api
lib/controllers/ContentController.js
getUserGroups
function getUserGroups(user) { var groups = {}; if (user && user.permissions) { user.permissions.forEach(function(permission) { var reg = new RegExp('^(get|update|delete)-group-(.+)$'); var permissionChunks = reg.exec(permission); if (permissionChunks) { var operation = permissionChun...
javascript
function getUserGroups(user) { var groups = {}; if (user && user.permissions) { user.permissions.forEach(function(permission) { var reg = new RegExp('^(get|update|delete)-group-(.+)$'); var permissionChunks = reg.exec(permission); if (permissionChunks) { var operation = permissionChun...
[ "function", "getUserGroups", "(", "user", ")", "{", "var", "groups", "=", "{", "}", ";", "if", "(", "user", "&&", "user", ".", "permissions", ")", "{", "user", ".", "permissions", ".", "forEach", "(", "function", "(", "permission", ")", "{", "var", "...
Gets user permissions by groups. @example // Example of user permissions ['get-group-Jekrn20Rl', 'update-group-Jekrn20Rl', 'delete-group-YldO3Jie3'] // Example of returned groups { 'Jekrn20Rl': ['get', 'update'], // User only has get / update permissions on group 'Jekrn20Rl' 'YldO3Jie3': ['delete'], // User only has...
[ "Gets", "user", "permissions", "by", "groups", "." ]
493a811e9a5ba4d3e14910facaa7452caba1ab38
https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/controllers/ContentController.js#L80-L100
41,799
veo-labs/openveo-api
lib/controllers/ContentController.js
getUserAuthorizedGroups
function getUserAuthorizedGroups(user, operation) { var userGroups = getUserGroups(user); var groups = []; for (var groupId in userGroups) { if (userGroups[groupId].indexOf(operation) >= 0) groups.push(groupId); } return groups; }
javascript
function getUserAuthorizedGroups(user, operation) { var userGroups = getUserGroups(user); var groups = []; for (var groupId in userGroups) { if (userGroups[groupId].indexOf(operation) >= 0) groups.push(groupId); } return groups; }
[ "function", "getUserAuthorizedGroups", "(", "user", ",", "operation", ")", "{", "var", "userGroups", "=", "getUserGroups", "(", "user", ")", ";", "var", "groups", "=", "[", "]", ";", "for", "(", "var", "groupId", "in", "userGroups", ")", "{", "if", "(", ...
Gets the list of groups of a user, with authorization on a certain operation. All user groups with authorization on the operation are returned. @method getUserAuthorizedGroups @private @param {Object} user The user @param {String} operation The operation (get, update or delete) @return {Array} The list of user groups...
[ "Gets", "the", "list", "of", "groups", "of", "a", "user", "with", "authorization", "on", "a", "certain", "operation", "." ]
493a811e9a5ba4d3e14910facaa7452caba1ab38
https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/controllers/ContentController.js#L113-L123