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
30,900
cloudmine/CloudMineSDK-JavaScript
js/cloudmine.js
function() { if (this.xhr) { this.xhr.abort(); } else if (this.config) { this.config.complete.call(this, this.xhr, 'abort'); } // Cleanup leftover state. if (this.xhr) { this.xhr = undefined; delete this.xhr; } if (this.config) { this.co...
javascript
function() { if (this.xhr) { this.xhr.abort(); } else if (this.config) { this.config.complete.call(this, this.xhr, 'abort'); } // Cleanup leftover state. if (this.xhr) { this.xhr = undefined; delete this.xhr; } if (this.config) { this.co...
[ "function", "(", ")", "{", "if", "(", "this", ".", "xhr", ")", "{", "this", ".", "xhr", ".", "abort", "(", ")", ";", "}", "else", "if", "(", "this", ".", "config", ")", "{", "this", ".", "config", ".", "complete", ".", "call", "(", "this", ",...
Aborts the current connection. This is ineffective for running synchronous calls or completed calls. Synchronous calls can be achieved by setting async to false in WebService. @return {APICall} The current APICall object
[ "Aborts", "the", "current", "connection", ".", "This", "is", "ineffective", "for", "running", "synchronous", "calls", "or", "completed", "calls", ".", "Synchronous", "calls", "can", "be", "achieved", "by", "setting", "async", "to", "false", "in", "WebService", ...
647a84cd3631e7399d0802cdf069d7104a4b2192
https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L1679-L1697
30,901
back4app/back4app-entity
src/back/utils/objects.js
copy
function copy(o) { expect(arguments).to.have.length( 1, 'Invalid argument length when copying an object (it has to be passed ' + '1 argument)' ); expect(o).to.be.an( 'object', 'Invalid argument "o" when copying an object (it has to be an object)' ); var oCopy = {}; for (var property i...
javascript
function copy(o) { expect(arguments).to.have.length( 1, 'Invalid argument length when copying an object (it has to be passed ' + '1 argument)' ); expect(o).to.be.an( 'object', 'Invalid argument "o" when copying an object (it has to be an object)' ); var oCopy = {}; for (var property i...
[ "function", "copy", "(", "o", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "1", ",", "'Invalid argument length when copying an object (it has to be passed '", "+", "'1 argument)'", ")", ";", "expect", "(", "o", ")", "....
Makes a copy of a given object. @param {!Object} o The object to be copied. @returns {Object} The new copy of the given object. @example var copy = objects.copy(myObject);
[ "Makes", "a", "copy", "of", "a", "given", "object", "." ]
16a15284d2e119508fcb4e0c88f647ffb285d2e9
https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/utils/objects.js#L24-L43
30,902
taskworld/legendary-pancake
examples/homepage/src/documentationPages.js
rerouteLinks
function rerouteLinks (html) { return html.replace(/href="(\.\/[a-z0-9\-]+\.md)"/g, (all, key) => { const found = documentationPages.filter((page) => page.key === key)[0] if (!found) return all /* global __legendary_pancake_base_pathname__ */ const base = __legendary_pancake_base_pathname__ // eslint-...
javascript
function rerouteLinks (html) { return html.replace(/href="(\.\/[a-z0-9\-]+\.md)"/g, (all, key) => { const found = documentationPages.filter((page) => page.key === key)[0] if (!found) return all /* global __legendary_pancake_base_pathname__ */ const base = __legendary_pancake_base_pathname__ // eslint-...
[ "function", "rerouteLinks", "(", "html", ")", "{", "return", "html", ".", "replace", "(", "/", "href=\"(\\.\\/[a-z0-9\\-]+\\.md)\"", "/", "g", ",", "(", "all", ",", "key", ")", "=>", "{", "const", "found", "=", "documentationPages", ".", "filter", "(", "("...
Rewrite links to direct to the correct page.
[ "Rewrite", "links", "to", "direct", "to", "the", "correct", "page", "." ]
5e3a3ff81f7a65808a3bfe945767368db0d46e8c
https://github.com/taskworld/legendary-pancake/blob/5e3a3ff81f7a65808a3bfe945767368db0d46e8c/examples/homepage/src/documentationPages.js#L53-L62
30,903
feedhenry/fh-forms
lib/impl/dataSources/updateCache.js
updateValidAndInvalidDataSources
function updateValidAndInvalidDataSources(dataSourcesToSplit, currentInvalidDataSources) { logger.debug("dataSourcesToSplit", dataSourcesToSplit); currentInvalidDataSources = currentInvalidDataSources || []; var validInvalid = _.partition(dataSourcesToSplit, function(dataSourceUpdateData) { if (dataSourceUpda...
javascript
function updateValidAndInvalidDataSources(dataSourcesToSplit, currentInvalidDataSources) { logger.debug("dataSourcesToSplit", dataSourcesToSplit); currentInvalidDataSources = currentInvalidDataSources || []; var validInvalid = _.partition(dataSourcesToSplit, function(dataSourceUpdateData) { if (dataSourceUpda...
[ "function", "updateValidAndInvalidDataSources", "(", "dataSourcesToSplit", ",", "currentInvalidDataSources", ")", "{", "logger", ".", "debug", "(", "\"dataSourcesToSplit\"", ",", "dataSourcesToSplit", ")", ";", "currentInvalidDataSources", "=", "currentInvalidDataSources", "|...
Splitting Data Sources Into Invalid And Valid Data Sources. @param dataSourcesToSplit @param currentInvalidDataSources @returns {{valid, invalid: Array}}
[ "Splitting", "Data", "Sources", "Into", "Invalid", "And", "Valid", "Data", "Sources", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L20-L39
30,904
feedhenry/fh-forms
lib/impl/dataSources/updateCache.js
findDataSources
function findDataSources(connections, dataSources, cb) { //Just Want The Data Source IDs. logger.debug("findDataSources", {dataSources: dataSources}); var dataSourceIDsToUpdate = _.map(dataSources, function(dataSourceUpdateData) { return dataSourceUpdateData.error ? null : dataSourceUpdateData._id; }); d...
javascript
function findDataSources(connections, dataSources, cb) { //Just Want The Data Source IDs. logger.debug("findDataSources", {dataSources: dataSources}); var dataSourceIDsToUpdate = _.map(dataSources, function(dataSourceUpdateData) { return dataSourceUpdateData.error ? null : dataSourceUpdateData._id; }); d...
[ "function", "findDataSources", "(", "connections", ",", "dataSources", ",", "cb", ")", "{", "//Just Want The Data Source IDs.", "logger", ".", "debug", "(", "\"findDataSources\"", ",", "{", "dataSources", ":", "dataSources", "}", ")", ";", "var", "dataSourceIDsToUpd...
Finding All Data Sources That Need To Be Updated @param dataSources @param connections @param cb @returns {*}
[ "Finding", "All", "Data", "Sources", "That", "Need", "To", "Be", "Updated" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L48-L109
30,905
feedhenry/fh-forms
lib/impl/dataSources/updateCache.js
validateParams
function validateParams(dataSources, cb) { dataSources = _.map(dataSources, function(dataSourceUpdateData) { var failed = validate(dataSourceUpdateData).has(CONSTANTS.DATA_SOURCE_ID); if (failed) { dataSourceUpdateData.error = buildErrorResponse({error: new Error("Invalid Parameters For Updating Data S...
javascript
function validateParams(dataSources, cb) { dataSources = _.map(dataSources, function(dataSourceUpdateData) { var failed = validate(dataSourceUpdateData).has(CONSTANTS.DATA_SOURCE_ID); if (failed) { dataSourceUpdateData.error = buildErrorResponse({error: new Error("Invalid Parameters For Updating Data S...
[ "function", "validateParams", "(", "dataSources", ",", "cb", ")", "{", "dataSources", "=", "_", ".", "map", "(", "dataSources", ",", "function", "(", "dataSourceUpdateData", ")", "{", "var", "failed", "=", "validate", "(", "dataSourceUpdateData", ")", ".", "...
Validating Data Source Parameters @param dataSources @param cb
[ "Validating", "Data", "Source", "Parameters" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L116-L134
30,906
feedhenry/fh-forms
lib/impl/dataSources/updateCache.js
updateDataSourceCaches
function updateDataSourceCaches(params, dsWithDocuments, dsWithNoDocuments, cb) { //Updating All Of The Data Sources //Generating Hashes For The Incoming Data Set. Useful for determining if the stored data set has changed. dsWithDocuments = _.map(dsWithDocuments, function(dataSourceData) { dataSourceData.data...
javascript
function updateDataSourceCaches(params, dsWithDocuments, dsWithNoDocuments, cb) { //Updating All Of The Data Sources //Generating Hashes For The Incoming Data Set. Useful for determining if the stored data set has changed. dsWithDocuments = _.map(dsWithDocuments, function(dataSourceData) { dataSourceData.data...
[ "function", "updateDataSourceCaches", "(", "params", ",", "dsWithDocuments", ",", "dsWithNoDocuments", ",", "cb", ")", "{", "//Updating All Of The Data Sources", "//Generating Hashes For The Incoming Data Set. Useful for determining if the stored data set has changed.", "dsWithDocuments"...
Updating All Data Source Caches With New Data Sets Or Errors @param params - currentTime @param dsWithDocuments @param dsWithNoDocuments @param cb
[ "Updating", "All", "Data", "Source", "Caches", "With", "New", "Data", "Sets", "Or", "Errors" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L144-L162
30,907
feedhenry/fh-forms
lib/impl/dataSources/updateCache.js
updateForms
function updateForms(params, validDataSources, invalidDataSources, cb) { //Only interested In Data Sources Where Data Was Actually Updated. If the data set is still the same, then no need to mark the form as updated the form. var dataSoucesUpdated = _.filter(validDataSources, function(dataSourceData) { return d...
javascript
function updateForms(params, validDataSources, invalidDataSources, cb) { //Only interested In Data Sources Where Data Was Actually Updated. If the data set is still the same, then no need to mark the form as updated the form. var dataSoucesUpdated = _.filter(validDataSources, function(dataSourceData) { return d...
[ "function", "updateForms", "(", "params", ",", "validDataSources", ",", "invalidDataSources", ",", "cb", ")", "{", "//Only interested In Data Sources Where Data Was Actually Updated. If the data set is still the same, then no need to mark the form as updated the form.", "var", "dataSouce...
Updating All Forms Associated With Valid Data Source Updates @param params - currentTime - connections @param validDataSources @param invalidDataSources @param cb
[ "Updating", "All", "Forms", "Associated", "With", "Valid", "Data", "Source", "Updates" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L173-L205
30,908
feedhenry/fh-forms
lib/impl/dataSources/updateCache.js
saveAuditLogEntryAndUpdateDataSource
function saveAuditLogEntryAndUpdateDataSource(params, callback) { var cacheElement = params.cacheElement; var dataSourceDocument = params.dataSourceDocument; var dataSourceData = params.dataSourceData; async.waterfall([ function saveAuditLog(cb) { //An Audit Log Entry Is Based On The Cache Update Ent...
javascript
function saveAuditLogEntryAndUpdateDataSource(params, callback) { var cacheElement = params.cacheElement; var dataSourceDocument = params.dataSourceDocument; var dataSourceData = params.dataSourceData; async.waterfall([ function saveAuditLog(cb) { //An Audit Log Entry Is Based On The Cache Update Ent...
[ "function", "saveAuditLogEntryAndUpdateDataSource", "(", "params", ",", "callback", ")", "{", "var", "cacheElement", "=", "params", ".", "cacheElement", ";", "var", "dataSourceDocument", "=", "params", ".", "dataSourceDocument", ";", "var", "dataSourceData", "=", "p...
Saving The Updated Data Source and Updating The Audit Log. @param params @param params.cacheElement - Cache Element Being Updated @param params.dataSourceDocument - The Mongoose Data Source Document @param params.dataSourceData - The Data Source Data To Be Updated @param params.connections.mongooseConnection - The Mong...
[ "Saving", "The", "Updated", "Data", "Source", "and", "Updating", "The", "Audit", "Log", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L216-L274
30,909
feedhenry/fh-forms
lib/impl/dataSources/updateCache.js
updateDataSourceEntry
function updateDataSourceEntry(params, dataSourceData, callback) { var dataToUpdate = dataSourceData.data; var dataSourceDocument = dataSourceData.document; logger.debug("updateDataSourceEntry ", params, dataSourceData); //If there is no cache entry, create a new one to validate. var cacheElement = dataSour...
javascript
function updateDataSourceEntry(params, dataSourceData, callback) { var dataToUpdate = dataSourceData.data; var dataSourceDocument = dataSourceData.document; logger.debug("updateDataSourceEntry ", params, dataSourceData); //If there is no cache entry, create a new one to validate. var cacheElement = dataSour...
[ "function", "updateDataSourceEntry", "(", "params", ",", "dataSourceData", ",", "callback", ")", "{", "var", "dataToUpdate", "=", "dataSourceData", ".", "data", ";", "var", "dataSourceDocument", "=", "dataSourceData", ".", "document", ";", "logger", ".", "debug", ...
Update A Single Data Source Data Entry. @param params - currentTime @param dataSourceData @param callback
[ "Update", "A", "Single", "Data", "Source", "Data", "Entry", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L284-L372
30,910
feedhenry/fh-forms
lib/impl/dataSources/updateCache.js
prepareResponse
function prepareResponse(validDataSources, invalidDataSources, cb) { //There Were Errors Updating Data Sources, should return an error logger.debug("prepareResponse Before", validDataSources); //For The Valid Data Sources, Just want the updated Document JSON validDataSources = _.map(validDataSources, function(...
javascript
function prepareResponse(validDataSources, invalidDataSources, cb) { //There Were Errors Updating Data Sources, should return an error logger.debug("prepareResponse Before", validDataSources); //For The Valid Data Sources, Just want the updated Document JSON validDataSources = _.map(validDataSources, function(...
[ "function", "prepareResponse", "(", "validDataSources", ",", "invalidDataSources", ",", "cb", ")", "{", "//There Were Errors Updating Data Sources, should return an error", "logger", ".", "debug", "(", "\"prepareResponse Before\"", ",", "validDataSources", ")", ";", "//For Th...
Preparing The JSON Response For The Data Source Cache Update. @param validDataSources @param invalidDataSources @param cb @returns {*}
[ "Preparing", "The", "JSON", "Response", "For", "The", "Data", "Source", "Cache", "Update", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L381-L404
30,911
feedhenry/fh-forms
lib/impl/getForms.js
getSubmissionStorage
function getSubmissionStorage(cb) { //If no stats are required, don't try and do the map-reduce operation. if (options.notStats) { return cb(); } // NOTE: this function executes in MongoDB rather than Node.js //Need a map-reduce operation to count the files, otherwise would have t...
javascript
function getSubmissionStorage(cb) { //If no stats are required, don't try and do the map-reduce operation. if (options.notStats) { return cb(); } // NOTE: this function executes in MongoDB rather than Node.js //Need a map-reduce operation to count the files, otherwise would have t...
[ "function", "getSubmissionStorage", "(", "cb", ")", "{", "//If no stats are required, don't try and do the map-reduce operation.", "if", "(", "options", ".", "notStats", ")", "{", "return", "cb", "(", ")", ";", "}", "// NOTE: this function executes in MongoDB rather than Node...
Function for getting the current submission storage. Submission Storage = formsubmissions + fileStorage.chunks + fileStorage.files
[ "Function", "for", "getting", "the", "current", "submission", "storage", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/getForms.js#L57-L126
30,912
cloudfour/drizzle-builder
src/utils/object.js
deepObj
function deepObj(pathKeys, obj, createEntries = true) { return pathKeys.reduce((prev, curr) => { if (typeof prev[curr] === 'undefined') { if (createEntries) { prev[curr] = {}; } else { DrizzleError.error( new DrizzleError( `Property ${curr} not found on supplied o...
javascript
function deepObj(pathKeys, obj, createEntries = true) { return pathKeys.reduce((prev, curr) => { if (typeof prev[curr] === 'undefined') { if (createEntries) { prev[curr] = {}; } else { DrizzleError.error( new DrizzleError( `Property ${curr} not found on supplied o...
[ "function", "deepObj", "(", "pathKeys", ",", "obj", ",", "createEntries", "=", "true", ")", "{", "return", "pathKeys", ".", "reduce", "(", "(", "prev", ",", "curr", ")", "=>", "{", "if", "(", "typeof", "prev", "[", "curr", "]", "===", "'undefined'", ...
Return a reference to the deeply-nested object indicated by the items in `pathKeys`. If `createEntries`, entry levels will be created as needed if they don't yet exist on `obj`. @param {Array} pathKeys Elements making up the "path" to the reference @param {Object} Object to add needed references to @exa...
[ "Return", "a", "reference", "to", "the", "deeply", "-", "nested", "object", "indicated", "by", "the", "items", "in", "pathKeys", ".", "If", "createEntries", "entry", "levels", "will", "be", "created", "as", "needed", "if", "they", "don", "t", "yet", "exist...
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/object.js#L16-L32
30,913
cloudfour/drizzle-builder
src/utils/object.js
deepCollection
function deepCollection(collectionId, obj) { const pathBits = idKeys(collectionId); pathBits.pop(); pathBits.push('collection'); pathBits.shift(); return deepObj(pathBits, obj, false); }
javascript
function deepCollection(collectionId, obj) { const pathBits = idKeys(collectionId); pathBits.pop(); pathBits.push('collection'); pathBits.shift(); return deepObj(pathBits, obj, false); }
[ "function", "deepCollection", "(", "collectionId", ",", "obj", ")", "{", "const", "pathBits", "=", "idKeys", "(", "collectionId", ")", ";", "pathBits", ".", "pop", "(", ")", ";", "pathBits", ".", "push", "(", "'collection'", ")", ";", "pathBits", ".", "s...
Given a nested pattern `obj` and a `patternId`, find its collection in the object `obj`. @see deepPattern
[ "Given", "a", "nested", "pattern", "obj", "and", "a", "patternId", "find", "its", "collection", "in", "the", "object", "obj", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/object.js#L57-L63
30,914
cloudfour/drizzle-builder
src/utils/object.js
isObject
function isObject(obj) { const objType = typeof obj; return objType === 'object' && Boolean(obj) && !Array.isArray(obj); }
javascript
function isObject(obj) { const objType = typeof obj; return objType === 'object' && Boolean(obj) && !Array.isArray(obj); }
[ "function", "isObject", "(", "obj", ")", "{", "const", "objType", "=", "typeof", "obj", ";", "return", "objType", "===", "'object'", "&&", "Boolean", "(", "obj", ")", "&&", "!", "Array", ".", "isArray", "(", "obj", ")", ";", "}" ]
IsObject function opinionated against Arrays @param {Obj} @return {Boolean}
[ "IsObject", "function", "opinionated", "against", "Arrays" ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/object.js#L70-L73
30,915
cloudfour/drizzle-builder
src/utils/object.js
flattenById
function flattenById(obj, keyedObj = {}) { if (obj.hasOwnProperty('id')) { keyedObj[obj.id] = obj; } for (var key in obj) { if (isObject(obj[key])) { flattenById(obj[key], keyedObj); } } return keyedObj; }
javascript
function flattenById(obj, keyedObj = {}) { if (obj.hasOwnProperty('id')) { keyedObj[obj.id] = obj; } for (var key in obj) { if (isObject(obj[key])) { flattenById(obj[key], keyedObj); } } return keyedObj; }
[ "function", "flattenById", "(", "obj", ",", "keyedObj", "=", "{", "}", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "'id'", ")", ")", "{", "keyedObj", "[", "obj", ".", "id", "]", "=", "obj", ";", "}", "for", "(", "var", "key", "in", ...
Take a deeply-nested object and return a single-level object keyed by the `id` property of original object entries. @param {Obj} obj @param {Obj} keyedObj For recursion; not strictly necessary but... @return {Obj} keyed by ids
[ "Take", "a", "deeply", "-", "nested", "object", "and", "return", "a", "single", "-", "level", "object", "keyed", "by", "the", "id", "property", "of", "original", "object", "entries", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/object.js#L83-L93
30,916
cloudfour/drizzle-builder
src/utils/object.js
resourceId
function resourceId(resourceFile, relativeTo, resourceCollection = '') { const pathKeys = relativePathArray(resourceFile.path, relativeTo).map( keyname ); const resourceBits = []; if (resourceCollection && resourceCollection.length !== 0) { resourceBits.push(resourceCollection); } return resourceBit...
javascript
function resourceId(resourceFile, relativeTo, resourceCollection = '') { const pathKeys = relativePathArray(resourceFile.path, relativeTo).map( keyname ); const resourceBits = []; if (resourceCollection && resourceCollection.length !== 0) { resourceBits.push(resourceCollection); } return resourceBit...
[ "function", "resourceId", "(", "resourceFile", ",", "relativeTo", ",", "resourceCollection", "=", "''", ")", "{", "const", "pathKeys", "=", "relativePathArray", "(", "resourceFile", ".", "path", ",", "relativeTo", ")", ".", "map", "(", "keyname", ")", ";", "...
Generate a resourceId for a file. Use file.path and base the ID elements on the path elements between relativeTo and file. Path elements will have special characters removed. @example resourceId( '/foo/bar/baz/ole/01-fun-times.hbs', '/foo/bar/baz/', 'patterns' ); // -> patterns.ole.fun-times @param {Object} Object r...
[ "Generate", "a", "resourceId", "for", "a", "file", ".", "Use", "file", ".", "path", "and", "base", "the", "ID", "elements", "on", "the", "path", "elements", "between", "relativeTo", "and", "file", ".", "Path", "elements", "will", "have", "special", "charac...
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/object.js#L108-L120
30,917
cloudfour/drizzle-builder
src/utils/object.js
isPathChild
function isPathChild(pathA, pathB) { const relPath = relative(normalizePath(pathA), normalizePath(pathB)); return relPath === '..'; }
javascript
function isPathChild(pathA, pathB) { const relPath = relative(normalizePath(pathA), normalizePath(pathB)); return relPath === '..'; }
[ "function", "isPathChild", "(", "pathA", ",", "pathB", ")", "{", "const", "relPath", "=", "relative", "(", "normalizePath", "(", "pathA", ")", ",", "normalizePath", "(", "pathB", ")", ")", ";", "return", "relPath", "===", "'..'", ";", "}" ]
Check if one path is a direct child of another. @param {String} pathA @param {String} pathB @return {Boolean} @example isPathChild('components/button', 'components'); // true
[ "Check", "if", "one", "path", "is", "a", "direct", "child", "of", "another", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/object.js#L183-L186
30,918
crispy1989/node-zstreams
lib/readable.js
ZReadable
function ZReadable(options) { if(options) { if(options.readableObjectMode) { options.objectMode = true; } //Add support for iojs simplified stream constructor if(typeof options.read === 'function') { this._read = options.read; } } Readable.call(this, options); streamMixins.call(this, Readable.protot...
javascript
function ZReadable(options) { if(options) { if(options.readableObjectMode) { options.objectMode = true; } //Add support for iojs simplified stream constructor if(typeof options.read === 'function') { this._read = options.read; } } Readable.call(this, options); streamMixins.call(this, Readable.protot...
[ "function", "ZReadable", "(", "options", ")", "{", "if", "(", "options", ")", "{", "if", "(", "options", ".", "readableObjectMode", ")", "{", "options", ".", "objectMode", "=", "true", ";", "}", "//Add support for iojs simplified stream constructor", "if", "(", ...
ZReadable implements the Readable streams interface @class ZReadable @constructor @extends Readable @uses _Stream @uses _Readable @param {Object} [options] - Stream options
[ "ZReadable", "implements", "the", "Readable", "streams", "interface" ]
4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd
https://github.com/crispy1989/node-zstreams/blob/4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd/lib/readable.js#L17-L30
30,919
feedhenry/fh-forms
lib/impl/getSubmissions/index.js
paginateList
function paginateList(formSubmissionModel, params, callback) { logger.debug("paginateList", params); var query = params.query || {}; var paginate = params.paginate || {}; var fieldModel = params.fieldModel; //Sorting can be defined by the user var sortBy = params.sortBy || { submissionCompletedTimestam...
javascript
function paginateList(formSubmissionModel, params, callback) { logger.debug("paginateList", params); var query = params.query || {}; var paginate = params.paginate || {}; var fieldModel = params.fieldModel; //Sorting can be defined by the user var sortBy = params.sortBy || { submissionCompletedTimestam...
[ "function", "paginateList", "(", "formSubmissionModel", ",", "params", ",", "callback", ")", "{", "logger", ".", "debug", "(", "\"paginateList\"", ",", "params", ")", ";", "var", "query", "=", "params", ".", "query", "||", "{", "}", ";", "var", "paginate",...
paginateList - Returning a paginated list of submissions. @param {object} formSubmissionModel Submission Mongoose Model @param {object} params @param {object} params.query Query to filter by. @param {object} params.paginate Pagination parameters @param {number} params.paginate.page Pagination page...
[ "paginateList", "-", "Returning", "a", "paginated", "list", "of", "submissions", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/getSubmissions/index.js#L21-L49
30,920
feedhenry/fh-forms
lib/impl/getSubmissions/index.js
nonPaginateList
function nonPaginateList(formSubmissionModel, params, callback) { logger.debug("nonPaginateList", params); var submissionQuery = formSubmissionModel.find(params.query || {}); var fieldModel = params.fieldModel; //Sorting can be defined by the user var sortBy = params.sortBy || { submissionCompletedTimest...
javascript
function nonPaginateList(formSubmissionModel, params, callback) { logger.debug("nonPaginateList", params); var submissionQuery = formSubmissionModel.find(params.query || {}); var fieldModel = params.fieldModel; //Sorting can be defined by the user var sortBy = params.sortBy || { submissionCompletedTimest...
[ "function", "nonPaginateList", "(", "formSubmissionModel", ",", "params", ",", "callback", ")", "{", "logger", ".", "debug", "(", "\"nonPaginateList\"", ",", "params", ")", ";", "var", "submissionQuery", "=", "formSubmissionModel", ".", "find", "(", "params", "....
nonPaginateList - Listing submissions without pagination @param {object} formSubmissionModel Submission Mongoose Model @param {object} params @param {object} params.query Query to filter by. @param {function} callback
[ "nonPaginateList", "-", "Listing", "submissions", "without", "pagination" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/getSubmissions/index.js#L59-L81
30,921
feedhenry/fh-forms
lib/impl/exportForms.js
updateMetadata
function updateMetadata(metadata, form) { metadata.files[form.id] = { name: form.name, path: path.join(ZIP_SUBFOLDER_NAME, form.id + '.json') }; }
javascript
function updateMetadata(metadata, form) { metadata.files[form.id] = { name: form.name, path: path.join(ZIP_SUBFOLDER_NAME, form.id + '.json') }; }
[ "function", "updateMetadata", "(", "metadata", ",", "form", ")", "{", "metadata", ".", "files", "[", "form", ".", "id", "]", "=", "{", "name", ":", "form", ".", "name", ",", "path", ":", "path", ".", "join", "(", "ZIP_SUBFOLDER_NAME", ",", "form", "....
Push a new entry into the metadata `files` list
[ "Push", "a", "new", "entry", "into", "the", "metadata", "files", "list" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/exportForms.js#L13-L18
30,922
feedhenry/fh-forms
lib/impl/exportForms.js
writeFormsToZip
function writeFormsToZip(forms, callback) { var zip = archiver('zip') , metadata = {}; metadata.exportCreated = new Date(); metadata.files = {}; function processForms() { // Process all forms _.each(forms, function(form) { // Update metadata on the fly updateMetadata(metadata, form); ...
javascript
function writeFormsToZip(forms, callback) { var zip = archiver('zip') , metadata = {}; metadata.exportCreated = new Date(); metadata.files = {}; function processForms() { // Process all forms _.each(forms, function(form) { // Update metadata on the fly updateMetadata(metadata, form); ...
[ "function", "writeFormsToZip", "(", "forms", ",", "callback", ")", "{", "var", "zip", "=", "archiver", "(", "'zip'", ")", ",", "metadata", "=", "{", "}", ";", "metadata", ".", "exportCreated", "=", "new", "Date", "(", ")", ";", "metadata", ".", "files"...
Creates a zip stream and returns it in the callback. The zip archive that is created will contain a metadata.json file and a subfolder `ZIP_SUBFOLDER_NAME` where all the forms will be written to. @param forms A collection of fully populated form objects @param callback Invoked with the zip stream
[ "Creates", "a", "zip", "stream", "and", "returns", "it", "in", "the", "callback", ".", "The", "zip", "archive", "that", "is", "created", "will", "contain", "a", "metadata", ".", "json", "file", "and", "a", "subfolder", "ZIP_SUBFOLDER_NAME", "where", "all", ...
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/exportForms.js#L28-L55
30,923
cloudfour/drizzle-builder
src/prepare/partials.js
registerPartials
function registerPartials(src, options, prefix = '') { return readFiles(src.glob, options).then(partialFiles => { partialFiles.forEach(partialFile => { const partialKey = resourceId(partialFile, src.basedir, prefix); if (options.handlebars.partials.hasOwnProperty(partialKey)) { DrizzleError.er...
javascript
function registerPartials(src, options, prefix = '') { return readFiles(src.glob, options).then(partialFiles => { partialFiles.forEach(partialFile => { const partialKey = resourceId(partialFile, src.basedir, prefix); if (options.handlebars.partials.hasOwnProperty(partialKey)) { DrizzleError.er...
[ "function", "registerPartials", "(", "src", ",", "options", ",", "prefix", "=", "''", ")", "{", "return", "readFiles", "(", "src", ".", "glob", ",", "options", ")", ".", "then", "(", "partialFiles", "=>", "{", "partialFiles", ".", "forEach", "(", "partia...
Register the files matching `src.glob` as partials. Keys are generated by using path relative to `src.basedir` separated by `.` @param {Object} src Object with `path` and `basedir` props @see defaults @param {Object} options @param {String} prefix Gets passed to `resourceId` as the `resourceCollection` argument. @se...
[ "Register", "the", "files", "matching", "src", ".", "glob", "as", "partials", ".", "Keys", "are", "generated", "by", "using", "path", "relative", "to", "src", ".", "basedir", "separated", "by", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/prepare/partials.js#L19-L36
30,924
cloudfour/drizzle-builder
src/prepare/partials.js
preparePartials
function preparePartials(options) { return Promise.all([ registerPartials(options.src.templates, options), // Partials as partials registerPartials(options.src.patterns, options, 'patterns') // Patterns ]).then(() => options, error => DrizzleError.error(error, options.debug)); }
javascript
function preparePartials(options) { return Promise.all([ registerPartials(options.src.templates, options), // Partials as partials registerPartials(options.src.patterns, options, 'patterns') // Patterns ]).then(() => options, error => DrizzleError.error(error, options.debug)); }
[ "function", "preparePartials", "(", "options", ")", "{", "return", "Promise", ".", "all", "(", "[", "registerPartials", "(", "options", ".", "src", ".", "templates", ",", "options", ")", ",", "// Partials as partials", "registerPartials", "(", "options", ".", ...
Register a glob of partials. @param {Object} Handlebars instance @param {String|Array} glob
[ "Register", "a", "glob", "of", "partials", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/prepare/partials.js#L43-L48
30,925
feedhenry/fh-forms
lib/impl/pdfGeneration/renderPDF.js
submissionToPDF
function submissionToPDF(params, cb) { logger.debug("renderPDF submissionToPDF", params); params = params || {}; var maxConcurrentPhantomPerWorker = params.maxConcurrentPhantomPerWorker || config.get().maxConcurrentPhantomPerWorker; if (!params.submission || !params.submission.formSubmittedAgainst || !params....
javascript
function submissionToPDF(params, cb) { logger.debug("renderPDF submissionToPDF", params); params = params || {}; var maxConcurrentPhantomPerWorker = params.maxConcurrentPhantomPerWorker || config.get().maxConcurrentPhantomPerWorker; if (!params.submission || !params.submission.formSubmittedAgainst || !params....
[ "function", "submissionToPDF", "(", "params", ",", "cb", ")", "{", "logger", ".", "debug", "(", "\"renderPDF submissionToPDF\"", ",", "params", ")", ";", "params", "=", "params", "||", "{", "}", ";", "var", "maxConcurrentPhantomPerWorker", "=", "params", ".", ...
Converting A Submission To A PDF Document In this implementation, the generation function is added to a concurrent queue. The maxConcurrentPhantomPerWorker parameter controls the number of concurrent PDF generation processes per worker. This is to limit the amount of memory the phantomjs processes consume. @param par...
[ "Converting", "A", "Submission", "To", "A", "PDF", "Document" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/pdfGeneration/renderPDF.js#L42-L56
30,926
cloudfour/drizzle-builder
src/utils/write.js
write
function write(filepath, contents) { return mkdirp(path.dirname(filepath)).then(() => { return writeFile(filepath, contents); }); }
javascript
function write(filepath, contents) { return mkdirp(path.dirname(filepath)).then(() => { return writeFile(filepath, contents); }); }
[ "function", "write", "(", "filepath", ",", "contents", ")", "{", "return", "mkdirp", "(", "path", ".", "dirname", "(", "filepath", ")", ")", ".", "then", "(", "(", ")", "=>", "{", "return", "writeFile", "(", "filepath", ",", "contents", ")", ";", "}"...
Write `contents` to path at `filepath` @param {String} filepath @param {String} contents @return {Promise}
[ "Write", "contents", "to", "path", "at", "filepath" ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/write.js#L15-L19
30,927
cloudfour/drizzle-builder
src/utils/write.js
writePage
function writePage(resourceId, resourceObj, pathPrefix) { const outputPath = resourcePath(resourceId, pathPrefix); resourceObj.outputPath = outputPath; return write(outputPath, resourceObj.contents); }
javascript
function writePage(resourceId, resourceObj, pathPrefix) { const outputPath = resourcePath(resourceId, pathPrefix); resourceObj.outputPath = outputPath; return write(outputPath, resourceObj.contents); }
[ "function", "writePage", "(", "resourceId", ",", "resourceObj", ",", "pathPrefix", ")", "{", "const", "outputPath", "=", "resourcePath", "(", "resourceId", ",", "pathPrefix", ")", ";", "resourceObj", ".", "outputPath", "=", "outputPath", ";", "return", "write", ...
Take an object's contents and write them to an HTML file on the filesystem. @param {String} resourceId e.g. pages.follow-me.down `.`-separated ID representing the hierarchical position of the resource in its object structure. Will be used to derive output path. @param {Object} resourceObj The object to output. Must ...
[ "Take", "an", "object", "s", "contents", "and", "write", "them", "to", "an", "HTML", "file", "on", "the", "filesystem", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/write.js#L32-L36
30,928
back4app/back4app-entity
src/back/adapters/Adapter.js
Adapter
function Adapter() { expect(this).to.be.an( 'object', 'The Adapter\'s constructor can be only invoked from specialized' + 'classes\' constructors' ); expect(this.constructor).to.be.a( 'function', 'The Adapter\'s constructor can be only invoked from specialized' + 'classes\' constructors' ...
javascript
function Adapter() { expect(this).to.be.an( 'object', 'The Adapter\'s constructor can be only invoked from specialized' + 'classes\' constructors' ); expect(this.constructor).to.be.a( 'function', 'The Adapter\'s constructor can be only invoked from specialized' + 'classes\' constructors' ...
[ "function", "Adapter", "(", ")", "{", "expect", "(", "this", ")", ".", "to", ".", "be", ".", "an", "(", "'object'", ",", "'The Adapter\\'s constructor can be only invoked from specialized'", "+", "'classes\\' constructors'", ")", ";", "expect", "(", "this", ".", ...
Base class for database adapters. It cannot be directly initialized. @constructor @memberof module:back4app-entity/adapters @example var myAdapter = new MyAdapter(myConfig);
[ "Base", "class", "for", "database", "adapters", ".", "It", "cannot", "be", "directly", "initialized", "." ]
16a15284d2e119508fcb4e0c88f647ffb285d2e9
https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/adapters/Adapter.js#L15-L38
30,929
feedhenry/fh-forms
lib/impl/updateTheme.js
validateDuplicateName
function validateDuplicateName(cb) { var themeId = themeData._id; var themeName = themeData.name; if (!themeName) { return cb(new Error("No theme name passed.")); } var query = {}; //If there is a theme id, then the query to the theme model must exclude the current theme id that is bein...
javascript
function validateDuplicateName(cb) { var themeId = themeData._id; var themeName = themeData.name; if (!themeName) { return cb(new Error("No theme name passed.")); } var query = {}; //If there is a theme id, then the query to the theme model must exclude the current theme id that is bein...
[ "function", "validateDuplicateName", "(", "cb", ")", "{", "var", "themeId", "=", "themeData", ".", "_id", ";", "var", "themeName", "=", "themeData", ".", "name", ";", "if", "(", "!", "themeName", ")", "{", "return", "cb", "(", "new", "Error", "(", "\"N...
Validating theme duplicate names.
[ "Validating", "theme", "duplicate", "names", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/updateTheme.js#L34-L65
30,930
back4app/back4app-entity
src/back/models/methods.js
MethodDictionary
function MethodDictionary(methods) { expect(arguments).to.have.length.below( 2, 'Invalid arguments length when creating a new MethodDictionary (it has ' + 'to be passed less than 2 arguments)' ); if (methods) { expect(methods).to.be.an( 'object', 'Invalid argument type when creating a...
javascript
function MethodDictionary(methods) { expect(arguments).to.have.length.below( 2, 'Invalid arguments length when creating a new MethodDictionary (it has ' + 'to be passed less than 2 arguments)' ); if (methods) { expect(methods).to.be.an( 'object', 'Invalid argument type when creating a...
[ "function", "MethodDictionary", "(", "methods", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", ".", "below", "(", "2", ",", "'Invalid arguments length when creating a new MethodDictionary (it has '", "+", "'to be passed less than 2 arg...
Dictionary of Entity Methods. An instance of MethodDictionary is not extensible. @constructor @memberof module:back4app-entity/models/methods @param {?Object.<!string, !function>} [methods] The methods to be added in the dictionary. They have to be given as a dictionary of functions. @example var methodDictionary = new...
[ "Dictionary", "of", "Entity", "Methods", ".", "An", "instance", "of", "MethodDictionary", "is", "not", "extensible", "." ]
16a15284d2e119508fcb4e0c88f647ffb285d2e9
https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/models/methods.js#L36-L57
30,931
back4app/back4app-entity
src/back/models/methods.js
_addMethod
function _addMethod(methodDictionary, func, name) { expect(func).to.be.a( 'function', 'Invalid argument "func" when adding a method called "' + name + '" in a ' + 'MethodDictionary (it has to be a function)' ); Object.defineProperty(methodDictionary, name, { value: func, enumerable: true, ...
javascript
function _addMethod(methodDictionary, func, name) { expect(func).to.be.a( 'function', 'Invalid argument "func" when adding a method called "' + name + '" in a ' + 'MethodDictionary (it has to be a function)' ); Object.defineProperty(methodDictionary, name, { value: func, enumerable: true, ...
[ "function", "_addMethod", "(", "methodDictionary", ",", "func", ",", "name", ")", "{", "expect", "(", "func", ")", ".", "to", ".", "be", ".", "a", "(", "'function'", ",", "'Invalid argument \"func\" when adding a method called \"'", "+", "name", "+", "'\" in a '...
Adds a new method to the dictionary. @name module:back4app-entity/models/methods~_addMethod @function @param {!module:back4app-entity/models/methods.MethodDictionary} methodDictionary This is the MethodDictionary instance to which the method will be added. @param {!function} func This is the method's function to be add...
[ "Adds", "a", "new", "method", "to", "the", "dictionary", "." ]
16a15284d2e119508fcb4e0c88f647ffb285d2e9
https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/models/methods.js#L78-L91
30,932
back4app/back4app-entity
src/back/models/methods.js
concat
function concat(methodDictionary, func, name) { expect(arguments).to.have.length( 3, 'Invalid arguments length when concatenating a MethodDictionary (it has ' + 'to be passed 3 arguments)' ); expect(methodDictionary).to.be.instanceof( MethodDictionary, 'Invalid argument "methodDictionary" whe...
javascript
function concat(methodDictionary, func, name) { expect(arguments).to.have.length( 3, 'Invalid arguments length when concatenating a MethodDictionary (it has ' + 'to be passed 3 arguments)' ); expect(methodDictionary).to.be.instanceof( MethodDictionary, 'Invalid argument "methodDictionary" whe...
[ "function", "concat", "(", "methodDictionary", ",", "func", ",", "name", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "3", ",", "'Invalid arguments length when concatenating a MethodDictionary (it has '", "+", "'to be passed...
Concatenates a MethodDictionary instance with a new method and returns a new MethodDictionary. @name module:back4app-entity/models/methods.MethodDictionary.concat @function @param {!module:back4app-entity/models/methods.MethodDictionary} methodDictionary The MethodDictionary to be concatenated. @param {!function} func ...
[ "Concatenates", "a", "MethodDictionary", "instance", "with", "a", "new", "method", "and", "returns", "a", "new", "MethodDictionary", "." ]
16a15284d2e119508fcb4e0c88f647ffb285d2e9
https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/models/methods.js#L111-L150
30,933
cloudfour/drizzle-builder
src/render/collections.js
renderCollection
function renderCollection(patterns, drizzleData, collectionKey) { const layoutKey = drizzleData.options.layouts.collection; let layoutObj; try { // DeepObj will throw if it fails, which is good and fine... layoutObj = deepObj(idKeys(layoutKey), drizzleData.templates, false); } catch (e) { // But Mak...
javascript
function renderCollection(patterns, drizzleData, collectionKey) { const layoutKey = drizzleData.options.layouts.collection; let layoutObj; try { // DeepObj will throw if it fails, which is good and fine... layoutObj = deepObj(idKeys(layoutKey), drizzleData.templates, false); } catch (e) { // But Mak...
[ "function", "renderCollection", "(", "patterns", ",", "drizzleData", ",", "collectionKey", ")", "{", "const", "layoutKey", "=", "drizzleData", ".", "options", ".", "layouts", ".", "collection", ";", "let", "layoutObj", ";", "try", "{", "// DeepObj will throw if it...
For any given `patterns` entry, render a pattern-collection page for its `items`. Also, remove the `contents` property for individual patterns. Patterns will not render individual pages. This function mutates `patterns`. @param {Object} patterns The current level of the patterns tree we're rendering @param {Objec...
[ "For", "any", "given", "patterns", "entry", "render", "a", "pattern", "-", "collection", "page", "for", "its", "items", ".", "Also", "remove", "the", "contents", "property", "for", "individual", "patterns", ".", "Patterns", "will", "not", "render", "individual...
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/render/collections.js#L19-L43
30,934
feedhenry/fh-forms
lib/utils/setup_connections.js
getDbName
function getDbName(uri) { var parsedMongooseUri = mongoUriParser.parse(uri); var dbName = parsedMongooseUri.database; return dbName; }
javascript
function getDbName(uri) { var parsedMongooseUri = mongoUriParser.parse(uri); var dbName = parsedMongooseUri.database; return dbName; }
[ "function", "getDbName", "(", "uri", ")", "{", "var", "parsedMongooseUri", "=", "mongoUriParser", ".", "parse", "(", "uri", ")", ";", "var", "dbName", "=", "parsedMongooseUri", ".", "database", ";", "return", "dbName", ";", "}" ]
Get the database name from the given mongodb uri. @param {string} uri the mongodb uri @returns {string} the name of the mongodb database
[ "Get", "the", "database", "name", "from", "the", "given", "mongodb", "uri", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/utils/setup_connections.js#L12-L16
30,935
ForstaLabs/librelay-node
src/crypto.js
function(message, signaling_key) { if (signaling_key.byteLength != 52) { throw new Error("Got invalid length signaling_key"); } if (message.byteLength < 1 + 16 + 10) { throw new Error("Got invalid length message"); } if (message[0] != 1) { thro...
javascript
function(message, signaling_key) { if (signaling_key.byteLength != 52) { throw new Error("Got invalid length signaling_key"); } if (message.byteLength < 1 + 16 + 10) { throw new Error("Got invalid length message"); } if (message[0] != 1) { thro...
[ "function", "(", "message", ",", "signaling_key", ")", "{", "if", "(", "signaling_key", ".", "byteLength", "!=", "52", ")", "{", "throw", "new", "Error", "(", "\"Got invalid length signaling_key\"", ")", ";", "}", "if", "(", "message", ".", "byteLength", "<"...
Decrypts message into a raw string
[ "Decrypts", "message", "into", "a", "raw", "string" ]
f411c6585772ac67b842767bc7ce23edcbfae4ae
https://github.com/ForstaLabs/librelay-node/blob/f411c6585772ac67b842767bc7ce23edcbfae4ae/src/crypto.js#L9-L27
30,936
terkelg/globalyzer
src/index.js
isglob
function isglob(str, { strict = true } = {}) { if (str === '') return false; let match, rgx = strict ? STRICT : RELAXED; while ((match = rgx.exec(str))) { if (match[2]) return true; let idx = match.index + match[0].length; // if an open bracket/brace/paren is escaped, // set the index to the nex...
javascript
function isglob(str, { strict = true } = {}) { if (str === '') return false; let match, rgx = strict ? STRICT : RELAXED; while ((match = rgx.exec(str))) { if (match[2]) return true; let idx = match.index + match[0].length; // if an open bracket/brace/paren is escaped, // set the index to the nex...
[ "function", "isglob", "(", "str", ",", "{", "strict", "=", "true", "}", "=", "{", "}", ")", "{", "if", "(", "str", "===", "''", ")", "return", "false", ";", "let", "match", ",", "rgx", "=", "strict", "?", "STRICT", ":", "RELAXED", ";", "while", ...
Detect if a string cointains glob @param {String} str Input string @param {Object} [options] Configuration object @param {Boolean} [options.strict=true] Use relaxed regex if true @returns {Boolean} true if string contains glob
[ "Detect", "if", "a", "string", "cointains", "glob" ]
c4f91bea1d168ecf39c52fe1a70b122f67b7d688
https://github.com/terkelg/globalyzer/blob/c4f91bea1d168ecf39c52fe1a70b122f67b7d688/src/index.js#L13-L33
30,937
terkelg/globalyzer
src/index.js
parent
function parent(str, { strict = false } = {}) { str = path.normalize(str).replace(/\/|\\/, '/'); // special case for strings ending in enclosure containing path separator if (/[\{\[].*[\/]*.*[\}\]]$/.test(str)) str += '/'; // preserves full path in case of trailing path separator str += 'a'; do {str = pa...
javascript
function parent(str, { strict = false } = {}) { str = path.normalize(str).replace(/\/|\\/, '/'); // special case for strings ending in enclosure containing path separator if (/[\{\[].*[\/]*.*[\}\]]$/.test(str)) str += '/'; // preserves full path in case of trailing path separator str += 'a'; do {str = pa...
[ "function", "parent", "(", "str", ",", "{", "strict", "=", "false", "}", "=", "{", "}", ")", "{", "str", "=", "path", ".", "normalize", "(", "str", ")", ".", "replace", "(", "/", "\\/|\\\\", "/", ",", "'/'", ")", ";", "// special case for strings end...
Find the static part of a glob-path, split path and return path part @param {String} str Path/glob string @returns {String} static path section of glob
[ "Find", "the", "static", "part", "of", "a", "glob", "-", "path", "split", "path", "and", "return", "path", "part" ]
c4f91bea1d168ecf39c52fe1a70b122f67b7d688
https://github.com/terkelg/globalyzer/blob/c4f91bea1d168ecf39c52fe1a70b122f67b7d688/src/index.js#L42-L56
30,938
crispy1989/node-zstreams
lib/streams/classic-writable.js
ClassicWritable
function ClassicWritable(stream, options) { var self = this; PassThrough.call(this, options); classicMixins.call(this, stream, options); stream.on('error', function(error) { self.emit('error', error); }); self._isClosed = false; stream.on('close', function() { self._isClosed = true; }); if (!stream.end)...
javascript
function ClassicWritable(stream, options) { var self = this; PassThrough.call(this, options); classicMixins.call(this, stream, options); stream.on('error', function(error) { self.emit('error', error); }); self._isClosed = false; stream.on('close', function() { self._isClosed = true; }); if (!stream.end)...
[ "function", "ClassicWritable", "(", "stream", ",", "options", ")", "{", "var", "self", "=", "this", ";", "PassThrough", ".", "call", "(", "this", ",", "options", ")", ";", "classicMixins", ".", "call", "(", "this", ",", "stream", ",", "options", ")", "...
ClassicWritable wraps a "classic" writable stream. @class ClassicWritable @constructor @extends ZPassThrough @uses _Classic @param {Stream} stream - The classic stream being wrapped @param {Object} [options] - Stream options
[ "ClassicWritable", "wraps", "a", "classic", "writable", "stream", "." ]
4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd
https://github.com/crispy1989/node-zstreams/blob/4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd/lib/streams/classic-writable.js#L16-L32
30,939
feedhenry/fh-forms
lib/impl/getSubmissions/buildQuery.js
buildSingleFilterQueryObject
function buildSingleFilterQueryObject(paginationFilter) { return function(submissionQueryField) { var fieldQuery = { }; //formId and _id fields are ObjectIds. They must be valid in order to search for them. if (submissionQueryField === 'formId' || submissionQueryField === '_id') { if (mongoose....
javascript
function buildSingleFilterQueryObject(paginationFilter) { return function(submissionQueryField) { var fieldQuery = { }; //formId and _id fields are ObjectIds. They must be valid in order to search for them. if (submissionQueryField === 'formId' || submissionQueryField === '_id') { if (mongoose....
[ "function", "buildSingleFilterQueryObject", "(", "paginationFilter", ")", "{", "return", "function", "(", "submissionQueryField", ")", "{", "var", "fieldQuery", "=", "{", "}", ";", "//formId and _id fields are ObjectIds. They must be valid in order to search for them.", "if", ...
buildSingleFilterQueryObject - Building a query object based on the field to be queried @param {string} paginationFilter Filter value @return {object} Generated Query for the field
[ "buildSingleFilterQueryObject", "-", "Building", "a", "query", "object", "based", "on", "the", "field", "to", "be", "queried" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/getSubmissions/buildQuery.js#L12-L32
30,940
feedhenry/fh-forms
lib/impl/dataSources/update.js
validateParams
function validateParams(dataSource, cb) { var dataSourceValidator = validate(dataSource); //The data source parameter should have an ID property. dataSourceValidator.has(CONSTANTS.DATA_SOURCE_ID, function(err) { if (err) { return cb(buildErrorResponse({error: new Error("An ID Parameter Is Required To Up...
javascript
function validateParams(dataSource, cb) { var dataSourceValidator = validate(dataSource); //The data source parameter should have an ID property. dataSourceValidator.has(CONSTANTS.DATA_SOURCE_ID, function(err) { if (err) { return cb(buildErrorResponse({error: new Error("An ID Parameter Is Required To Up...
[ "function", "validateParams", "(", "dataSource", ",", "cb", ")", "{", "var", "dataSourceValidator", "=", "validate", "(", "dataSource", ")", ";", "//The data source parameter should have an ID property.", "dataSourceValidator", ".", "has", "(", "CONSTANTS", ".", "DATA_S...
validateParams - Validating A Data Source For Update. Should Have A _id parameter and no Data Set. @param {object} dataSource Data Source To Update @param {function} cb Callback @return {undefined}
[ "validateParams", "-", "Validating", "A", "Data", "Source", "For", "Update", ".", "Should", "Have", "A", "_id", "parameter", "and", "no", "Data", "Set", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/update.js#L20-L37
30,941
feedhenry/fh-forms
lib/impl/dataSources/update.js
findDataSource
function findDataSource(connections, dataSource, cb) { var query = { }; //Searching By ID. query[CONSTANTS.DATA_SOURCE_ID] = dataSource[CONSTANTS.DATA_SOURCE_ID]; //Looking up a full data source document as we are updating lookUpDataSources(connections, { query: query, lean: false }, function(e...
javascript
function findDataSource(connections, dataSource, cb) { var query = { }; //Searching By ID. query[CONSTANTS.DATA_SOURCE_ID] = dataSource[CONSTANTS.DATA_SOURCE_ID]; //Looking up a full data source document as we are updating lookUpDataSources(connections, { query: query, lean: false }, function(e...
[ "function", "findDataSource", "(", "connections", ",", "dataSource", ",", "cb", ")", "{", "var", "query", "=", "{", "}", ";", "//Searching By ID.", "query", "[", "CONSTANTS", ".", "DATA_SOURCE_ID", "]", "=", "dataSource", "[", "CONSTANTS", ".", "DATA_SOURCE_ID...
findDataSource - Finding A Data Source @param {object} connections Mongoose And Mongo Connections @param {object} dataSource Data Source To Update @param {function} cb Callback @return {undefined}
[ "findDataSource", "-", "Finding", "A", "Data", "Source" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/update.js#L48-L80
30,942
DennisSchulmeister/lecture-slides.js
src/core/utils.js
shiftLinesLeft
function shiftLinesLeft(text) { // Determine type of linebreak let linebreak = determineLinebreaks(text); if (linebreak === "") return text; let lines = []; lines = text.split(linebreak); // Find amount to shift lines let commonPrefix = null; for (let i = 0; i < lines.length; i++) { ...
javascript
function shiftLinesLeft(text) { // Determine type of linebreak let linebreak = determineLinebreaks(text); if (linebreak === "") return text; let lines = []; lines = text.split(linebreak); // Find amount to shift lines let commonPrefix = null; for (let i = 0; i < lines.length; i++) { ...
[ "function", "shiftLinesLeft", "(", "text", ")", "{", "// Determine type of linebreak", "let", "linebreak", "=", "determineLinebreaks", "(", "text", ")", ";", "if", "(", "linebreak", "===", "\"\"", ")", "return", "text", ";", "let", "lines", "=", "[", "]", ";...
This function takes a text string and shifts all lines to the left so that as most leading spaces are removed as possible. All lines are shifted by the same amount which is determined as the minimum amount of white space at the beginning of all lines. @param {String} text Original text @return {String} Shifted text
[ "This", "function", "takes", "a", "text", "string", "and", "shifts", "all", "lines", "to", "the", "left", "so", "that", "as", "most", "leading", "spaces", "are", "removed", "as", "possible", ".", "All", "lines", "are", "shifted", "by", "the", "same", "am...
67a29d7fd2ae062a5853bb5067c0e5821b93695d
https://github.com/DennisSchulmeister/lecture-slides.js/blob/67a29d7fd2ae062a5853bb5067c0e5821b93695d/src/core/utils.js#L50-L84
30,943
DennisSchulmeister/lecture-slides.js
src/core/utils.js
removeLeadingLinebreaks
function removeLeadingLinebreaks(text) { let linebreak = determineLinebreaks(text); if (linebreak === "") return text; while (text.startsWith(linebreak)) { text = text.slice(linebreak.length); } return text; }
javascript
function removeLeadingLinebreaks(text) { let linebreak = determineLinebreaks(text); if (linebreak === "") return text; while (text.startsWith(linebreak)) { text = text.slice(linebreak.length); } return text; }
[ "function", "removeLeadingLinebreaks", "(", "text", ")", "{", "let", "linebreak", "=", "determineLinebreaks", "(", "text", ")", ";", "if", "(", "linebreak", "===", "\"\"", ")", "return", "text", ";", "while", "(", "text", ".", "startsWith", "(", "linebreak",...
Remove any leading empty lines found inside the given text. @param {String} text Original text @return {String} Trimmed text
[ "Remove", "any", "leading", "empty", "lines", "found", "inside", "the", "given", "text", "." ]
67a29d7fd2ae062a5853bb5067c0e5821b93695d
https://github.com/DennisSchulmeister/lecture-slides.js/blob/67a29d7fd2ae062a5853bb5067c0e5821b93695d/src/core/utils.js#L92-L101
30,944
DennisSchulmeister/lecture-slides.js
src/core/utils.js
removeTrailingLinebreaks
function removeTrailingLinebreaks(text) { let linebreak = determineLinebreaks(text); if (linebreak === "") return text; while (text.endsWith(linebreak)) { text = text.slice(0, 0 - linebreak.length); } return text; }
javascript
function removeTrailingLinebreaks(text) { let linebreak = determineLinebreaks(text); if (linebreak === "") return text; while (text.endsWith(linebreak)) { text = text.slice(0, 0 - linebreak.length); } return text; }
[ "function", "removeTrailingLinebreaks", "(", "text", ")", "{", "let", "linebreak", "=", "determineLinebreaks", "(", "text", ")", ";", "if", "(", "linebreak", "===", "\"\"", ")", "return", "text", ";", "while", "(", "text", ".", "endsWith", "(", "linebreak", ...
Remove any trailing empty lines found inside the given text. @param {String} text Original text @return {String} Trimed text
[ "Remove", "any", "trailing", "empty", "lines", "found", "inside", "the", "given", "text", "." ]
67a29d7fd2ae062a5853bb5067c0e5821b93695d
https://github.com/DennisSchulmeister/lecture-slides.js/blob/67a29d7fd2ae062a5853bb5067c0e5821b93695d/src/core/utils.js#L109-L118
30,945
DennisSchulmeister/lecture-slides.js
src/core/utils.js
trimLines
function trimLines(text) { let linebreak = determineLinebreaks(text); if (linebreak === "") return text; let lines = []; lines = text.split(linebreak); text = ""; for (let i = 0; i < lines.length; i++) { let line = lines[i]; while (true) { let lastChar = line.slice...
javascript
function trimLines(text) { let linebreak = determineLinebreaks(text); if (linebreak === "") return text; let lines = []; lines = text.split(linebreak); text = ""; for (let i = 0; i < lines.length; i++) { let line = lines[i]; while (true) { let lastChar = line.slice...
[ "function", "trimLines", "(", "text", ")", "{", "let", "linebreak", "=", "determineLinebreaks", "(", "text", ")", ";", "if", "(", "linebreak", "===", "\"\"", ")", "return", "text", ";", "let", "lines", "=", "[", "]", ";", "lines", "=", "text", ".", "...
Remove any trailing spaces or tabs at the end of each line of a given text. @param {String} text Original text @return {String} Trimed text
[ "Remove", "any", "trailing", "spaces", "or", "tabs", "at", "the", "end", "of", "each", "line", "of", "a", "given", "text", "." ]
67a29d7fd2ae062a5853bb5067c0e5821b93695d
https://github.com/DennisSchulmeister/lecture-slides.js/blob/67a29d7fd2ae062a5853bb5067c0e5821b93695d/src/core/utils.js#L126-L155
30,946
clavery/grunt-generator
tasks/lib/generator.js
promiseWrap
function promiseWrap(x) { if(x.then && typeof x.then === "function") { return x; } var deferred = q.defer(); deferred.resolve(x); return deferred.promise; }
javascript
function promiseWrap(x) { if(x.then && typeof x.then === "function") { return x; } var deferred = q.defer(); deferred.resolve(x); return deferred.promise; }
[ "function", "promiseWrap", "(", "x", ")", "{", "if", "(", "x", ".", "then", "&&", "typeof", "x", ".", "then", "===", "\"function\"", ")", "{", "return", "x", ";", "}", "var", "deferred", "=", "q", ".", "defer", "(", ")", ";", "deferred", ".", "re...
wrap non-promises in a promise for api simplicity
[ "wrap", "non", "-", "promises", "in", "a", "promise", "for", "api", "simplicity" ]
5b5e29798f04bfcac7c6ff46a146c0088eb79f94
https://github.com/clavery/grunt-generator/blob/5b5e29798f04bfcac7c6ff46a146c0088eb79f94/tasks/lib/generator.js#L39-L46
30,947
feedhenry/fh-forms
lib/impl/pdfGeneration/cacheFiles.js
cacheSubmissionFile
function cacheSubmissionFile(params, fileToStreamTo, cb) { //If the files are remote, use the mbaas client logger.debug("cacheFiles: cacheSubmissionFile submission", {params: params, fileToStreamTo: fileToStreamTo}); if (params.options.filesAreRemote) { return downloadFileFromMbaas(params, fileToStreamTo, cb)...
javascript
function cacheSubmissionFile(params, fileToStreamTo, cb) { //If the files are remote, use the mbaas client logger.debug("cacheFiles: cacheSubmissionFile submission", {params: params, fileToStreamTo: fileToStreamTo}); if (params.options.filesAreRemote) { return downloadFileFromMbaas(params, fileToStreamTo, cb)...
[ "function", "cacheSubmissionFile", "(", "params", ",", "fileToStreamTo", ",", "cb", ")", "{", "//If the files are remote, use the mbaas client", "logger", ".", "debug", "(", "\"cacheFiles: cacheSubmissionFile submission\"", ",", "{", "params", ":", "params", ",", "fileToS...
Streaming The File From The Database. @param params - options - fileId - connections @param fileToStreamTo @param cb
[ "Streaming", "The", "File", "From", "The", "Database", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/pdfGeneration/cacheFiles.js#L99-L129
30,948
feedhenry/fh-forms
lib/impl/pdfGeneration/cacheFiles.js
mergeSubmissionFiles
function mergeSubmissionFiles(params, cb) { logger.debug("cacheFiles: mergeSubmissionFiles", params); var submission = params.submission; //No submission, cannot continue. if (!_.isObject(submission)) { return cb(buildErrorResponse({ err: new Error("Expected Submission Object To Cache Files For"), ...
javascript
function mergeSubmissionFiles(params, cb) { logger.debug("cacheFiles: mergeSubmissionFiles", params); var submission = params.submission; //No submission, cannot continue. if (!_.isObject(submission)) { return cb(buildErrorResponse({ err: new Error("Expected Submission Object To Cache Files For"), ...
[ "function", "mergeSubmissionFiles", "(", "params", ",", "cb", ")", "{", "logger", ".", "debug", "(", "\"cacheFiles: mergeSubmissionFiles\"", ",", "params", ")", ";", "var", "submission", "=", "params", ".", "submission", ";", "//No submission, cannot continue.", "if...
Caching any files needed for a submission to the file system. @param params - submission - connections - options @param cb @returns {*} @private
[ "Caching", "any", "files", "needed", "for", "a", "submission", "to", "the", "file", "system", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/pdfGeneration/cacheFiles.js#L152-L243
30,949
feedhenry/fh-forms
lib/impl/pdfGeneration/cacheFiles.js
removeCachedFiles
function removeCachedFiles(params, cb) { //Cleaning Up Any Files Cached To Render The Submission. logger.debug("cacheFiles: mergeSubmissionFiles Removing Cached Files For PDF Generation: ", params.submissionFiles); async.eachSeries(params.submissionFiles || [], function(submissionFileDetails, cb) { logger.deb...
javascript
function removeCachedFiles(params, cb) { //Cleaning Up Any Files Cached To Render The Submission. logger.debug("cacheFiles: mergeSubmissionFiles Removing Cached Files For PDF Generation: ", params.submissionFiles); async.eachSeries(params.submissionFiles || [], function(submissionFileDetails, cb) { logger.deb...
[ "function", "removeCachedFiles", "(", "params", ",", "cb", ")", "{", "//Cleaning Up Any Files Cached To Render The Submission.", "logger", ".", "debug", "(", "\"cacheFiles: mergeSubmissionFiles Removing Cached Files For PDF Generation: \"", ",", "params", ".", "submissionFiles", ...
Removing Any Cached Files Needed For Rendering The PDF @param params @param cb @private
[ "Removing", "Any", "Cached", "Files", "Needed", "For", "Rendering", "The", "PDF" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/pdfGeneration/cacheFiles.js#L251-L264
30,950
cloudfour/drizzle-builder
src/write/pages.js
walkPages
function walkPages(pages, drizzleData, writePromises = []) { if (isPage(pages)) { return writePage( pages.id, pages, drizzleData.options.dest.pages, drizzleData.options.keys.pages.plural ); } for (var pageKey in pages) { writePromises = writePromises.concat( walkPages(pag...
javascript
function walkPages(pages, drizzleData, writePromises = []) { if (isPage(pages)) { return writePage( pages.id, pages, drizzleData.options.dest.pages, drizzleData.options.keys.pages.plural ); } for (var pageKey in pages) { writePromises = writePromises.concat( walkPages(pag...
[ "function", "walkPages", "(", "pages", ",", "drizzleData", ",", "writePromises", "=", "[", "]", ")", "{", "if", "(", "isPage", "(", "pages", ")", ")", "{", "return", "writePage", "(", "pages", ".", "id", ",", "pages", ",", "drizzleData", ".", "options"...
Traverse pages object and write out any page objects to files. An object is considered a page if it has a `contents` property. @param {Object} pages current level of pages tree @param {Object} drizzleData @param {Array} writePromises All write promises so far @return {Array} of Promises
[ "Traverse", "pages", "object", "and", "write", "out", "any", "page", "objects", "to", "files", ".", "An", "object", "is", "considered", "a", "page", "if", "it", "has", "a", "contents", "property", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/write/pages.js#L15-L30
30,951
cloudfour/drizzle-builder
src/write/pages.js
writePages
function writePages(drizzleData) { return Promise.all(walkPages(drizzleData.pages, drizzleData)).then( () => drizzleData, error => DrizzleError.error(error, drizzleData.options.debug) ); }
javascript
function writePages(drizzleData) { return Promise.all(walkPages(drizzleData.pages, drizzleData)).then( () => drizzleData, error => DrizzleError.error(error, drizzleData.options.debug) ); }
[ "function", "writePages", "(", "drizzleData", ")", "{", "return", "Promise", ".", "all", "(", "walkPages", "(", "drizzleData", ".", "pages", ",", "drizzleData", ")", ")", ".", "then", "(", "(", ")", "=>", "drizzleData", ",", "error", "=>", "DrizzleError", ...
Write out HTML pages for pages data. @param {Object} drizzleData @return {Promise} resolving to drizzleData
[ "Write", "out", "HTML", "pages", "for", "pages", "data", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/write/pages.js#L38-L43
30,952
feedhenry/fh-forms
lib/impl/deleteAppRefrences.js
deleteAppForms
function deleteAppForms(cb) { var appId = params.appId; async.series([ function(cb) { // first remove the form itself var appFormsModel = models.get(connections.mongooseConnection, models.MODELNAMES.APP_FORMS); appFormsModel.find({appId: appId}).remove().exec(cb); ...
javascript
function deleteAppForms(cb) { var appId = params.appId; async.series([ function(cb) { // first remove the form itself var appFormsModel = models.get(connections.mongooseConnection, models.MODELNAMES.APP_FORMS); appFormsModel.find({appId: appId}).remove().exec(cb); ...
[ "function", "deleteAppForms", "(", "cb", ")", "{", "var", "appId", "=", "params", ".", "appId", ";", "async", ".", "series", "(", "[", "function", "(", "cb", ")", "{", "// first remove the form itself", "var", "appFormsModel", "=", "models", ".", "get", "(...
updates to AppForms sub collection
[ "updates", "to", "AppForms", "sub", "collection" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/deleteAppRefrences.js#L28-L53
30,953
feedhenry/fh-forms
lib/impl/pdfGeneration/renderSinglePDF.js
renderPDF
function renderPDF(params, cb) { var template = params.template; var session = params.session; var form = params.form; var submission = params.submission; submission.formName = form.name; var studioLocation = params.location; var generationTimestamp = params.generationTimestamp || Date.now(); var page;...
javascript
function renderPDF(params, cb) { var template = params.template; var session = params.session; var form = params.form; var submission = params.submission; submission.formName = form.name; var studioLocation = params.location; var generationTimestamp = params.generationTimestamp || Date.now(); var page;...
[ "function", "renderPDF", "(", "params", ",", "cb", ")", "{", "var", "template", "=", "params", ".", "template", ";", "var", "session", "=", "params", ".", "session", ";", "var", "form", "=", "params", ".", "form", ";", "var", "submission", "=", "params...
Rendering The HTML Template To A PDF Document @param params - template - session - form - submission - location - generationTimestamp @param cb @returns {*} @private
[ "Rendering", "The", "HTML", "Template", "To", "A", "PDF", "Document" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/pdfGeneration/renderSinglePDF.js#L22-L86
30,954
crispy1989/node-zstreams
lib/duplex.js
ZDuplex
function ZDuplex(options) { if(options) { if(options.objectMode) { options.readableObjectMode = true; options.writableObjectMode = true; } if(options.readableObjectMode && options.writableObjectMode) { options.objectMode = true; } //Add support for iojs simplified stream constructor if(typeof opti...
javascript
function ZDuplex(options) { if(options) { if(options.objectMode) { options.readableObjectMode = true; options.writableObjectMode = true; } if(options.readableObjectMode && options.writableObjectMode) { options.objectMode = true; } //Add support for iojs simplified stream constructor if(typeof opti...
[ "function", "ZDuplex", "(", "options", ")", "{", "if", "(", "options", ")", "{", "if", "(", "options", ".", "objectMode", ")", "{", "options", ".", "readableObjectMode", "=", "true", ";", "options", ".", "writableObjectMode", "=", "true", ";", "}", "if",...
ZDuplex implements the Duplex stream interface. ZDuplex also allows for a `_flush` function to facilitate cleanup. @class ZDuplex @constructor @extends Duplex @uses _Stream @uses _Readable @uses _Writable @param {Object} [options] - Stream options
[ "ZDuplex", "implements", "the", "Duplex", "stream", "interface", ".", "ZDuplex", "also", "allows", "for", "a", "_flush", "function", "to", "facilitate", "cleanup", "." ]
4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd
https://github.com/crispy1989/node-zstreams/blob/4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd/lib/duplex.js#L20-L61
30,955
cloudfour/drizzle-builder
src/init.js
normalizePaths
function normalizePaths(opts) { for (var srcKey in opts.src) { if (!path.isAbsolute(opts.src[srcKey].glob)) { opts.src[srcKey].glob = path.resolve(opts.src[srcKey].glob); } if (!path.isAbsolute(opts.src[srcKey].basedir)) { opts.src[srcKey].basedir = path.resolve(opts.src[srcKey].basedir); ...
javascript
function normalizePaths(opts) { for (var srcKey in opts.src) { if (!path.isAbsolute(opts.src[srcKey].glob)) { opts.src[srcKey].glob = path.resolve(opts.src[srcKey].glob); } if (!path.isAbsolute(opts.src[srcKey].basedir)) { opts.src[srcKey].basedir = path.resolve(opts.src[srcKey].basedir); ...
[ "function", "normalizePaths", "(", "opts", ")", "{", "for", "(", "var", "srcKey", "in", "opts", ".", "src", ")", "{", "if", "(", "!", "path", ".", "isAbsolute", "(", "opts", ".", "src", "[", "srcKey", "]", ".", "glob", ")", ")", "{", "opts", ".",...
For relative pathing to work, let's convert all paths in src options to absolute paths, if they are not already. @param {Object} opts Mutated in place.
[ "For", "relative", "pathing", "to", "work", "let", "s", "convert", "all", "paths", "in", "src", "options", "to", "absolute", "paths", "if", "they", "are", "not", "already", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/init.js#L12-L21
30,956
cloudfour/drizzle-builder
src/init.js
init
function init(options = {}, handlebars) { const opts = deepExtend({}, defaults, options); normalizePaths(opts); opts.handlebars = handlebars || Handlebars.create(); return Promise.resolve(opts); }
javascript
function init(options = {}, handlebars) { const opts = deepExtend({}, defaults, options); normalizePaths(opts); opts.handlebars = handlebars || Handlebars.create(); return Promise.resolve(opts); }
[ "function", "init", "(", "options", "=", "{", "}", ",", "handlebars", ")", "{", "const", "opts", "=", "deepExtend", "(", "{", "}", ",", "defaults", ",", "options", ")", ";", "normalizePaths", "(", "opts", ")", ";", "opts", ".", "handlebars", "=", "ha...
Merge defaults into passed options. @param {Object} options @param {Object} handlebars Handlebars instance—it can be passed explicitly, primarily for testing purposes. @return {Promise} resolving to merged options
[ "Merge", "defaults", "into", "passed", "options", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/init.js#L31-L36
30,957
feedhenry/fh-forms
lib/impl/notification.js
buildSubmissionReceivedMessage
function buildSubmissionReceivedMessage(subscribers, formName, formSubmission) { var msg = {}; msg.subscribers = subscribers; msg.formId = formSubmission.formId; msg.appId = formSubmission.appId; msg.attachmentUrl = getAttachmentUrl(formSubmission); msg.formName = formName || "UNKNOWN FORM NAME"; msg.subm...
javascript
function buildSubmissionReceivedMessage(subscribers, formName, formSubmission) { var msg = {}; msg.subscribers = subscribers; msg.formId = formSubmission.formId; msg.appId = formSubmission.appId; msg.attachmentUrl = getAttachmentUrl(formSubmission); msg.formName = formName || "UNKNOWN FORM NAME"; msg.subm...
[ "function", "buildSubmissionReceivedMessage", "(", "subscribers", ",", "formName", ",", "formSubmission", ")", "{", "var", "msg", "=", "{", "}", ";", "msg", ".", "subscribers", "=", "subscribers", ";", "msg", ".", "formId", "=", "formSubmission", ".", "formId"...
export for tests
[ "export", "for", "tests" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/notification.js#L73-L138
30,958
back4app/back4app-entity
src/back/models/errors.js
EntityNotFoundError
function EntityNotFoundError(entity, innerError) { /** * The name of the entity that was not found. * @type {?string} */ this.entity = entity; /** * The inner error that generated the current error. * @type {?Error} */ this.innerError = innerError; expect(arguments).to.have.length.below( ...
javascript
function EntityNotFoundError(entity, innerError) { /** * The name of the entity that was not found. * @type {?string} */ this.entity = entity; /** * The inner error that generated the current error. * @type {?Error} */ this.innerError = innerError; expect(arguments).to.have.length.below( ...
[ "function", "EntityNotFoundError", "(", "entity", ",", "innerError", ")", "{", "/**\n * The name of the entity that was not found.\n * @type {?string}\n */", "this", ".", "entity", "=", "entity", ";", "/**\n * The inner error that generated the current error.\n * @type {?Erro...
Error class to be used when an Entity was referenced and the platform was not able to find it. @constructor @extends Error @param {?string} [entity] The entity name to be displayed. @param {?Error} [innerError] The inner error. @memberof module:back4app-entity/models/errors @example try { var myEntity = require('./MyEn...
[ "Error", "class", "to", "be", "used", "when", "an", "Entity", "was", "referenced", "and", "the", "platform", "was", "not", "able", "to", "find", "it", "." ]
16a15284d2e119508fcb4e0c88f647ffb285d2e9
https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/models/errors.js#L39-L78
30,959
back4app/back4app-entity
src/back/models/errors.js
AttributeTypeNotFoundError
function AttributeTypeNotFoundError(type, innerError) { /** * The attribute type that was not found. * @type {?string} */ this.type = type; /** * The inner error that generated the current error. * @type {?Error} */ this.innerError = innerError; expect(arguments).to.have.length.below( 3...
javascript
function AttributeTypeNotFoundError(type, innerError) { /** * The attribute type that was not found. * @type {?string} */ this.type = type; /** * The inner error that generated the current error. * @type {?Error} */ this.innerError = innerError; expect(arguments).to.have.length.below( 3...
[ "function", "AttributeTypeNotFoundError", "(", "type", ",", "innerError", ")", "{", "/**\n * The attribute type that was not found.\n * @type {?string}\n */", "this", ".", "type", "=", "type", ";", "/**\n * The inner error that generated the current error.\n * @type {?Error}\...
Error class to be used when an Attribute type was referenced and the platform was not able to find it. @constructor @extends Error @param {?string} [type] The attribute type name to be displayed. @param {?Error} [innerError] The inner error. @memberof module:back4app-entity/models/errors @example try { var TypedAttribu...
[ "Error", "class", "to", "be", "used", "when", "an", "Attribute", "type", "was", "referenced", "and", "the", "platform", "was", "not", "able", "to", "find", "it", "." ]
16a15284d2e119508fcb4e0c88f647ffb285d2e9
https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/models/errors.js#L98-L137
30,960
back4app/back4app-entity
src/back/models/errors.js
ValidationError
function ValidationError( validationMessage, entity, attribute, position, innerError ) { /** * The validation message to be included in the error. * @type {?string} */ this.validationMessage = validationMessage; /** * The name of the entity that was not validated. * @type {?string} */ ...
javascript
function ValidationError( validationMessage, entity, attribute, position, innerError ) { /** * The validation message to be included in the error. * @type {?string} */ this.validationMessage = validationMessage; /** * The name of the entity that was not validated. * @type {?string} */ ...
[ "function", "ValidationError", "(", "validationMessage", ",", "entity", ",", "attribute", ",", "position", ",", "innerError", ")", "{", "/**\n * The validation message to be included in the error.\n * @type {?string}\n */", "this", ".", "validationMessage", "=", "validati...
Error class to be used when an attribute value is not valid for the attribute specification. @constructor @extends Error @param {?string} [validationMessage] The message explaining the validation error. @param {?string} [entity] The entity whose attribute is not valid. @param {?string} [attribute] The attribute that is...
[ "Error", "class", "to", "be", "used", "when", "an", "attribute", "value", "is", "not", "valid", "for", "the", "attribute", "specification", "." ]
16a15284d2e119508fcb4e0c88f647ffb285d2e9
https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/models/errors.js#L257-L345
30,961
back4app/back4app-entity
src/back/models/errors.js
AdapterNotFoundError
function AdapterNotFoundError(adapterName, innerError) { /** * The name of the adapter that was not found. * @type {?string} */ this.adapterName = adapterName; /** * The inner error that generated the current error. * @type {?Error} */ this.innerError = innerError; expect(arguments).to.have...
javascript
function AdapterNotFoundError(adapterName, innerError) { /** * The name of the adapter that was not found. * @type {?string} */ this.adapterName = adapterName; /** * The inner error that generated the current error. * @type {?Error} */ this.innerError = innerError; expect(arguments).to.have...
[ "function", "AdapterNotFoundError", "(", "adapterName", ",", "innerError", ")", "{", "/**\n * The name of the adapter that was not found.\n * @type {?string}\n */", "this", ".", "adapterName", "=", "adapterName", ";", "/**\n * The inner error that generated the current error.\n...
Error class to be used when an Adapter was referenced and the platform was not able to find it. @constructor @extends Error @param {?string} [adapterName] The adapter name to be displayed. @param {?Error} [innerError] The inner error. @memberof module:back4app-entity/models/errors @example if (settings.ADAPTERS.default...
[ "Error", "class", "to", "be", "used", "when", "an", "Adapter", "was", "referenced", "and", "the", "platform", "was", "not", "able", "to", "find", "it", "." ]
16a15284d2e119508fcb4e0c88f647ffb285d2e9
https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/models/errors.js#L364-L403
30,962
back4app/back4app-entity
src/back/models/attributes/types/AssociationAttribute.js
AssociationAttribute
function AssociationAttribute() { /** * It is a readonly property with the Entity that is associated with the * current AssociationAttribute. * @name * module:back4app-entity/models/attributes/types.AssociationAttribute#Entity * @type {!Class} * @readonly * @throws {module:back4app-entity/models/...
javascript
function AssociationAttribute() { /** * It is a readonly property with the Entity that is associated with the * current AssociationAttribute. * @name * module:back4app-entity/models/attributes/types.AssociationAttribute#Entity * @type {!Class} * @readonly * @throws {module:back4app-entity/models/...
[ "function", "AssociationAttribute", "(", ")", "{", "/**\n * It is a readonly property with the Entity that is associated with the\n * current AssociationAttribute.\n * @name\n * module:back4app-entity/models/attributes/types.AssociationAttribute#Entity\n * @type {!Class}\n * @readonly\n * @t...
Implementation of an Entity Attribute to store association data. @memberof module:back4app-entity/models/attributes/types @name AssociationAttribute @constructor @extends module:back4app-entity/models/attributes.Attribute @param {!Object} attribute This is the attribute to be added. It can be passed as an Object. @para...
[ "Implementation", "of", "an", "Entity", "Attribute", "to", "store", "association", "data", "." ]
16a15284d2e119508fcb4e0c88f647ffb285d2e9
https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/models/attributes/types/AssociationAttribute.js#L77-L167
30,963
crispy1989/node-zstreams
lib/streams/intersperse-stream.js
IntersperseStream
function IntersperseStream(seperator, options) { if(typeof seperator === 'object') { options = seperator; seperator = null; } options = !options ? {} : options; Transform.call(this, options); this._intersperseBuffer = null; this._intersperseSeperator = (seperator === null || seperator === undefined) ? '\n' ...
javascript
function IntersperseStream(seperator, options) { if(typeof seperator === 'object') { options = seperator; seperator = null; } options = !options ? {} : options; Transform.call(this, options); this._intersperseBuffer = null; this._intersperseSeperator = (seperator === null || seperator === undefined) ? '\n' ...
[ "function", "IntersperseStream", "(", "seperator", ",", "options", ")", "{", "if", "(", "typeof", "seperator", "===", "'object'", ")", "{", "options", "=", "seperator", ";", "seperator", "=", "null", ";", "}", "options", "=", "!", "options", "?", "{", "}...
IntersperseStream intersperses a seperator between chunks in the stream @class IntersperseStream @constructor @extends Transform @param {String|Object|Number} [seperator='\n'] - Seperator to push between chunks @param {Object} [options] - Stream options object
[ "IntersperseStream", "intersperses", "a", "seperator", "between", "chunks", "in", "the", "stream" ]
4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd
https://github.com/crispy1989/node-zstreams/blob/4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd/lib/streams/intersperse-stream.js#L13-L24
30,964
cloudfour/drizzle-builder
src/parse/index.js
parseAll
function parseAll(options) { return Promise.all([ parseData(options), parsePages(options), parsePatterns(options), parseTemplates(options) ]).then( allData => parseTree(allData, options), error => DrizzleError.error(error, options.debug) ); }
javascript
function parseAll(options) { return Promise.all([ parseData(options), parsePages(options), parsePatterns(options), parseTemplates(options) ]).then( allData => parseTree(allData, options), error => DrizzleError.error(error, options.debug) ); }
[ "function", "parseAll", "(", "options", ")", "{", "return", "Promise", ".", "all", "(", "[", "parseData", "(", "options", ")", ",", "parsePages", "(", "options", ")", ",", "parsePatterns", "(", "options", ")", ",", "parseTemplates", "(", "options", ")", ...
Parse files with data from src and build a drizzleData object @param {Object} options @return {Promise} resolving to Drizzle data object
[ "Parse", "files", "with", "data", "from", "src", "and", "build", "a", "drizzleData", "object" ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/parse/index.js#L17-L27
30,965
ForstaLabs/librelay-node
src/hub/registration.js
registerAccount
async function registerAccount(options) { options = options || {}; const atlasClient = options.atlasClient || await AtlasClient.factory(); const name = options.name || defaultName; const registrationId = libsignal.keyhelper.generateRegistrationId(); const password = generatePassword(); const sig...
javascript
async function registerAccount(options) { options = options || {}; const atlasClient = options.atlasClient || await AtlasClient.factory(); const name = options.name || defaultName; const registrationId = libsignal.keyhelper.generateRegistrationId(); const password = generatePassword(); const sig...
[ "async", "function", "registerAccount", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "const", "atlasClient", "=", "options", ".", "atlasClient", "||", "await", "AtlasClient", ".", "factory", "(", ")", ";", "const", "name", "=",...
Create a new identity key and create or replace the signal account. Note that any existing devices asssociated with your account will be purged as a result of this action. This should only be used for new accounts or when you need to start over. @param {Object} [options] @param {string} [options.name] - The public na...
[ "Create", "a", "new", "identity", "key", "and", "create", "or", "replace", "the", "signal", "account", ".", "Note", "that", "any", "existing", "devices", "asssociated", "with", "your", "account", "will", "be", "purged", "as", "a", "result", "of", "this", "...
f411c6585772ac67b842767bc7ce23edcbfae4ae
https://github.com/ForstaLabs/librelay-node/blob/f411c6585772ac67b842767bc7ce23edcbfae4ae/src/hub/registration.js#L41-L77
30,966
feedhenry/fh-forms
lib/common/forms-rule-engine.js
checkValueSubmitted
function checkValueSubmitted(submittedField, fieldDefinition, visible, cb) { if (!fieldDefinition.required) { return cb(undefined, null); } var valueSubmitted = submittedField && submittedField.fieldValues && (submittedField.fieldValues.length > 0); //No value submitted is onl...
javascript
function checkValueSubmitted(submittedField, fieldDefinition, visible, cb) { if (!fieldDefinition.required) { return cb(undefined, null); } var valueSubmitted = submittedField && submittedField.fieldValues && (submittedField.fieldValues.length > 0); //No value submitted is onl...
[ "function", "checkValueSubmitted", "(", "submittedField", ",", "fieldDefinition", ",", "visible", ",", "cb", ")", "{", "if", "(", "!", "fieldDefinition", ".", "required", ")", "{", "return", "cb", "(", "undefined", ",", "null", ")", ";", "}", "var", "value...
just functions below this
[ "just", "functions", "below", "this" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/common/forms-rule-engine.js#L1042-L1058
30,967
feedhenry/fh-forms
lib/common/forms-rule-engine.js
isSafeString
function isSafeString(str) { var escape = ['&amp;', '&lt;', '&gt;', '&quot;', '&#x27;', '&#96;']; if (typeof str !== "string" || (escape.some(function(specialChar) { return str.indexOf(specialChar) >= 0; }))) { return true; } }
javascript
function isSafeString(str) { var escape = ['&amp;', '&lt;', '&gt;', '&quot;', '&#x27;', '&#96;']; if (typeof str !== "string" || (escape.some(function(specialChar) { return str.indexOf(specialChar) >= 0; }))) { return true; } }
[ "function", "isSafeString", "(", "str", ")", "{", "var", "escape", "=", "[", "'&amp;'", ",", "'&lt;'", ",", "'&gt;'", ",", "'&quot;'", ",", "'&#x27;'", ",", "'&#96;'", "]", ";", "if", "(", "typeof", "str", "!==", "\"string\"", "||", "(", "escape", ".",...
isSafeString - Checks if special characters in strings have already been escaped. @param {string} str The string to check. @return {boolean}
[ "isSafeString", "-", "Checks", "if", "special", "characters", "in", "strings", "have", "already", "been", "escaped", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/common/forms-rule-engine.js#L1271-L1278
30,968
feedhenry/fh-forms
lib/common/forms-rule-engine.js
validatorDropDown
function validatorDropDown(fieldValue, fieldDefinition, previousFieldValues, cb) { if (typeof(fieldValue) !== "string") { return cb(new Error("Expected submission to be string but got " + typeof(fieldValue))); } fieldDefinition.fieldOptions = fieldDefinition.fieldOptions || {}; fieldDef...
javascript
function validatorDropDown(fieldValue, fieldDefinition, previousFieldValues, cb) { if (typeof(fieldValue) !== "string") { return cb(new Error("Expected submission to be string but got " + typeof(fieldValue))); } fieldDefinition.fieldOptions = fieldDefinition.fieldOptions || {}; fieldDef...
[ "function", "validatorDropDown", "(", "fieldValue", ",", "fieldDefinition", ",", "previousFieldValues", ",", "cb", ")", "{", "if", "(", "typeof", "(", "fieldValue", ")", "!==", "\"string\"", ")", "{", "return", "cb", "(", "new", "Error", "(", "\"Expected submi...
validatorDropDown - Validator function for dropdown fields. @param {string} fieldValue The value to validate @param {object} fieldDefinition Full JSON definition of the field @param {array} previousFieldValues Any values previously stored with the fields @param {function} cb Callback functio...
[ "validatorDropDown", "-", "Validator", "function", "for", "dropdown", "fields", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/common/forms-rule-engine.js#L1288-L1322
30,969
feedhenry/fh-forms
lib/common/forms-rule-engine.js
validatorRadio
function validatorRadio(fieldValue, fieldDefinition, previousFieldValues, cb) { if (typeof(fieldValue) !== "string") { return cb(new Error("Expected submission to be string but got " + typeof(fieldValue))); } //Check value exists in the field definition if (!fieldDefinition.fieldOptions...
javascript
function validatorRadio(fieldValue, fieldDefinition, previousFieldValues, cb) { if (typeof(fieldValue) !== "string") { return cb(new Error("Expected submission to be string but got " + typeof(fieldValue))); } //Check value exists in the field definition if (!fieldDefinition.fieldOptions...
[ "function", "validatorRadio", "(", "fieldValue", ",", "fieldDefinition", ",", "previousFieldValues", ",", "cb", ")", "{", "if", "(", "typeof", "(", "fieldValue", ")", "!==", "\"string\"", ")", "{", "return", "cb", "(", "new", "Error", "(", "\"Expected submissi...
validatorRadio - Validator function for radio fields. @param {string} fieldValue The value to validate @param {object} fieldDefinition Full JSON definition of the field @param {array} previousFieldValues Any values previously stored with the fields @param {function} cb Callback function
[ "validatorRadio", "-", "Validator", "function", "for", "radio", "fields", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/common/forms-rule-engine.js#L1332-L1354
30,970
feedhenry/fh-forms
lib/common/forms-rule-engine.js
validatorBarcode
function validatorBarcode(fieldValue, fieldDefinition, previousFieldValues, cb) { if (typeof(fieldValue) !== "object" || fieldValue === null) { return cb(new Error("Expected object but got " + typeof(fieldValue))); } if (typeof(fieldValue.text) !== "string" || fieldValue.text.length === 0) { ...
javascript
function validatorBarcode(fieldValue, fieldDefinition, previousFieldValues, cb) { if (typeof(fieldValue) !== "object" || fieldValue === null) { return cb(new Error("Expected object but got " + typeof(fieldValue))); } if (typeof(fieldValue.text) !== "string" || fieldValue.text.length === 0) { ...
[ "function", "validatorBarcode", "(", "fieldValue", ",", "fieldDefinition", ",", "previousFieldValues", ",", "cb", ")", "{", "if", "(", "typeof", "(", "fieldValue", ")", "!==", "\"object\"", "||", "fieldValue", "===", "null", ")", "{", "return", "cb", "(", "n...
Function to validate a barcode submission Must be an object with the following contents { text: "<<content of barcode>>", format: "<<barcode content format>>" } @param fieldValue @param fieldDefinition @param previousFieldValues @param cb
[ "Function", "to", "validate", "a", "barcode", "submission" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/common/forms-rule-engine.js#L1497-L1511
30,971
feedhenry/fh-forms
lib/common/schemas/dataSourceCache.js
convertDSCacheToFieldOptions
function convertDSCacheToFieldOptions(fieldType, cacheEntries) { //Radio and Dropdown only allow the first option to be selected //Checkboxes can have multiple options selected. var alreadySelected = false; return _.map(cacheEntries, function(cacheEntry, index) { var valToReturn = { key: cacheEntry.k...
javascript
function convertDSCacheToFieldOptions(fieldType, cacheEntries) { //Radio and Dropdown only allow the first option to be selected //Checkboxes can have multiple options selected. var alreadySelected = false; return _.map(cacheEntries, function(cacheEntry, index) { var valToReturn = { key: cacheEntry.k...
[ "function", "convertDSCacheToFieldOptions", "(", "fieldType", ",", "cacheEntries", ")", "{", "//Radio and Dropdown only allow the first option to be selected", "//Checkboxes can have multiple options selected.", "var", "alreadySelected", "=", "false", ";", "return", "_", ".", "ma...
Converting DS Cache Entries To Field Format @param fieldType @param cacheEntries @returns {Array} @private
[ "Converting", "DS", "Cache", "Entries", "To", "Field", "Format" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/common/schemas/dataSourceCache.js#L21-L37
30,972
cloudfour/drizzle-builder
src/utils/parse.js
isGlob
function isGlob(candidate) { if (typeof candidate === 'string' && candidate.length > 0) { return true; } if (Array.isArray(candidate) && candidate.length > 0) { return candidate.every(candidateEl => typeof candidateEl === 'string'); } return false; }
javascript
function isGlob(candidate) { if (typeof candidate === 'string' && candidate.length > 0) { return true; } if (Array.isArray(candidate) && candidate.length > 0) { return candidate.every(candidateEl => typeof candidateEl === 'string'); } return false; }
[ "function", "isGlob", "(", "candidate", ")", "{", "if", "(", "typeof", "candidate", "===", "'string'", "&&", "candidate", ".", "length", ">", "0", ")", "{", "return", "true", ";", "}", "if", "(", "Array", ".", "isArray", "(", "candidate", ")", "&&", ...
Utility function to test if a value COULD be a glob. A single string or an Array of strings counts. Just because this returns true, however, doesn't mean it is a glob that makes sense, just that it looks like one. @param {String|Array} candidate @return Boolean
[ "Utility", "function", "to", "test", "if", "a", "value", "COULD", "be", "a", "glob", ".", "A", "single", "string", "or", "an", "Array", "of", "strings", "counts", ".", "Just", "because", "this", "returns", "true", "however", "doesn", "t", "mean", "it", ...
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/parse.js#L31-L39
30,973
cloudfour/drizzle-builder
src/utils/parse.js
parseField
function parseField(fieldKey, fieldData, options) { let parseFn = contents => ({ contents: contents }); let contents = fieldData; // Check to see if options.fieldParsers contains this key if (options.fieldParsers.hasOwnProperty(fieldKey)) { const parserKey = options.fieldParsers[fieldKey]; parseFn = opt...
javascript
function parseField(fieldKey, fieldData, options) { let parseFn = contents => ({ contents: contents }); let contents = fieldData; // Check to see if options.fieldParsers contains this key if (options.fieldParsers.hasOwnProperty(fieldKey)) { const parserKey = options.fieldParsers[fieldKey]; parseFn = opt...
[ "function", "parseField", "(", "fieldKey", ",", "fieldData", ",", "options", ")", "{", "let", "parseFn", "=", "contents", "=>", "(", "{", "contents", ":", "contents", "}", ")", ";", "let", "contents", "=", "fieldData", ";", "// Check to see if options.fieldPar...
Evaluate a single field of data and see if it should be run through a parser. @param {String} fieldKey @param {Object|String} fieldData @param {Object} options @return {Object} parsed data; contains `contents` property. @see parse/parsers
[ "Evaluate", "a", "single", "field", "of", "data", "and", "see", "if", "it", "should", "be", "run", "through", "a", "parser", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/parse.js#L77-L105
30,974
cloudfour/drizzle-builder
src/utils/parse.js
readFiles
function readFiles( glob, { parsers = {}, encoding = 'utf-8', globOpts = {} } = {} ) { return getFiles(glob, globOpts).then(paths => { return Promise.all( paths.map(filepath => { return readFile(filepath, encoding).then(fileData => { const parser = matchParser(filepath, parsers); ...
javascript
function readFiles( glob, { parsers = {}, encoding = 'utf-8', globOpts = {} } = {} ) { return getFiles(glob, globOpts).then(paths => { return Promise.all( paths.map(filepath => { return readFile(filepath, encoding).then(fileData => { const parser = matchParser(filepath, parsers); ...
[ "function", "readFiles", "(", "glob", ",", "{", "parsers", "=", "{", "}", ",", "encoding", "=", "'utf-8'", ",", "globOpts", "=", "{", "}", "}", "=", "{", "}", ")", "{", "return", "getFiles", "(", "glob", ",", "globOpts", ")", ".", "then", "(", "p...
Take a glob; read the files, optionally running a `contentFn` over the contents of the file. @param {glob} glob of files to read @param {Object} Options: - {Object} available parsers - {String} encoding - {Object} globOpts gets passed to getFiles @return {Promise} resolving to Array of Objects: - {String} path - {Stri...
[ "Take", "a", "glob", ";", "read", "the", "files", "optionally", "running", "a", "contentFn", "over", "the", "contents", "of", "the", "file", "." ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/parse.js#L137-L155
30,975
feedhenry/fh-forms
lib/middleware/themes.js
importTheme
function importTheme(req, res, next) { req.appformsResultPayload = req.appformsResultPayload || {}; var themeData = (req.appformsResultPayload.data && req.appformsResultPayload.type === constants.resultTypes.themeTemplate) ? req.appformsResultPayload.data : undefined ; var importThemeParams = { theme: themeD...
javascript
function importTheme(req, res, next) { req.appformsResultPayload = req.appformsResultPayload || {}; var themeData = (req.appformsResultPayload.data && req.appformsResultPayload.type === constants.resultTypes.themeTemplate) ? req.appformsResultPayload.data : undefined ; var importThemeParams = { theme: themeD...
[ "function", "importTheme", "(", "req", ",", "res", ",", "next", ")", "{", "req", ".", "appformsResultPayload", "=", "req", ".", "appformsResultPayload", "||", "{", "}", ";", "var", "themeData", "=", "(", "req", ".", "appformsResultPayload", ".", "data", "&...
Importing A Theme From A Template
[ "Importing", "A", "Theme", "From", "A", "Template" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/themes.js#L59-L71
30,976
feedhenry/fh-forms
lib/middleware/themes.js
exportThemes
function exportThemes(req, res, next) { var options = req.connectionOptions; forms.exportThemes(options, resultHandler(constants.resultTypes.themes, req, next)); }
javascript
function exportThemes(req, res, next) { var options = req.connectionOptions; forms.exportThemes(options, resultHandler(constants.resultTypes.themes, req, next)); }
[ "function", "exportThemes", "(", "req", ",", "res", ",", "next", ")", "{", "var", "options", "=", "req", ".", "connectionOptions", ";", "forms", ".", "exportThemes", "(", "options", ",", "resultHandler", "(", "constants", ".", "resultTypes", ".", "themes", ...
Exporting All Themes. @param req @param res @param next
[ "Exporting", "All", "Themes", "." ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/themes.js#L95-L99
30,977
feedhenry/fh-forms
lib/middleware/themes.js
importThemes
function importThemes(req, res, next) { var options = req.connectionOptions; var themesToImport = req.body || []; if (!_.isArray(req.body)) { return next("Expected An Array Of Themes"); } forms.importThemes(options, themesToImport, resultHandler(constants.resultTypes.themes, req, next)); }
javascript
function importThemes(req, res, next) { var options = req.connectionOptions; var themesToImport = req.body || []; if (!_.isArray(req.body)) { return next("Expected An Array Of Themes"); } forms.importThemes(options, themesToImport, resultHandler(constants.resultTypes.themes, req, next)); }
[ "function", "importThemes", "(", "req", ",", "res", ",", "next", ")", "{", "var", "options", "=", "req", ".", "connectionOptions", ";", "var", "themesToImport", "=", "req", ".", "body", "||", "[", "]", ";", "if", "(", "!", "_", ".", "isArray", "(", ...
Importing Bulk Themes @param req @param res @param next
[ "Importing", "Bulk", "Themes" ]
87df586b9589e3c636e1e607163862cfb64872dd
https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/themes.js#L107-L117
30,978
yibn2008/dependency-analyze
lib/index.js
getDepInfo
function getDepInfo (dep, currFile, customDepResolve) { let depResolve if (!customDepResolve) { depResolve = defaultDepResolve } else { depResolve = (dep, currFile) => { // parse defaultResolve as third param return customDepResolve(dep, currFile, defaultDepResolve) } } let currType ...
javascript
function getDepInfo (dep, currFile, customDepResolve) { let depResolve if (!customDepResolve) { depResolve = defaultDepResolve } else { depResolve = (dep, currFile) => { // parse defaultResolve as third param return customDepResolve(dep, currFile, defaultDepResolve) } } let currType ...
[ "function", "getDepInfo", "(", "dep", ",", "currFile", ",", "customDepResolve", ")", "{", "let", "depResolve", "if", "(", "!", "customDepResolve", ")", "{", "depResolve", "=", "defaultDepResolve", "}", "else", "{", "depResolve", "=", "(", "dep", ",", "currFi...
get dependency info @param {String} dep dependency @param {String} currFile current file @param {Function} customDepResolve custom dep resolve function @return {Object}
[ "get", "dependency", "info" ]
b600dfd7545785861ef46c203f508824505d8862
https://github.com/yibn2008/dependency-analyze/blob/b600dfd7545785861ef46c203f508824505d8862/lib/index.js#L105-L145
30,979
yibn2008/dependency-analyze
lib/index.js
analyzeFile
function analyzeFile (file, content, filter, depResolve, depth, result) { depth = typeof depth === 'number' ? depth : Infinity result = result || {} if (depth < 1) { return } if (file in result) { return } debug('analyze file: file = %s, depth = %s', file, depth) let deps = parseFile(file, c...
javascript
function analyzeFile (file, content, filter, depResolve, depth, result) { depth = typeof depth === 'number' ? depth : Infinity result = result || {} if (depth < 1) { return } if (file in result) { return } debug('analyze file: file = %s, depth = %s', file, depth) let deps = parseFile(file, c...
[ "function", "analyzeFile", "(", "file", ",", "content", ",", "filter", ",", "depResolve", ",", "depth", ",", "result", ")", "{", "depth", "=", "typeof", "depth", "===", "'number'", "?", "depth", ":", "Infinity", "result", "=", "result", "||", "{", "}", ...
recursively analyze single file @param {String} file file path @param {String} content file content @param {Function} filter filter function @param {Function} depResolve resolve dep to normal dep format @param {Number} depth max analyze depth @param {Object} result the analyed result @return {Objec...
[ "recursively", "analyze", "single", "file" ]
b600dfd7545785861ef46c203f508824505d8862
https://github.com/yibn2008/dependency-analyze/blob/b600dfd7545785861ef46c203f508824505d8862/lib/index.js#L157-L200
30,980
yibn2008/dependency-analyze
lib/index.js
analyze
function analyze (entry, options) { options = options || {} let result = {} // support array if (!Array.isArray(entry)) { entry = [entry] } entry.forEach(file => { let content // normalize file if (typeof file === 'string') { content = fs.readFileSync(file, 'utf8') } else { ...
javascript
function analyze (entry, options) { options = options || {} let result = {} // support array if (!Array.isArray(entry)) { entry = [entry] } entry.forEach(file => { let content // normalize file if (typeof file === 'string') { content = fs.readFileSync(file, 'utf8') } else { ...
[ "function", "analyze", "(", "entry", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", "let", "result", "=", "{", "}", "// support array", "if", "(", "!", "Array", ".", "isArray", "(", "entry", ")", ")", "{", "entry", "=", "[", "...
analyze dependencies of a file ``` return { <file>: { deps: [{ // all deps parent: currFile, // parent file path type: type, // current file type (js/css) raw: dep, // raw dependency name (require('./xxx') => './xxx') name: null, // formated dependency name ('~@alife/xxx' ...
[ "analyze", "dependencies", "of", "a", "file" ]
b600dfd7545785861ef46c203f508824505d8862
https://github.com/yibn2008/dependency-analyze/blob/b600dfd7545785861ef46c203f508824505d8862/lib/index.js#L235-L264
30,981
yibn2008/dependency-analyze
lib/index.js
getParseType
function getParseType (file) { let ext = path.extname(file) for (let type in FILE_TYPE_MAP) { let exts = FILE_TYPE_MAP[type] if (exts.indexOf(ext) >= 0) { return type } } }
javascript
function getParseType (file) { let ext = path.extname(file) for (let type in FILE_TYPE_MAP) { let exts = FILE_TYPE_MAP[type] if (exts.indexOf(ext) >= 0) { return type } } }
[ "function", "getParseType", "(", "file", ")", "{", "let", "ext", "=", "path", ".", "extname", "(", "file", ")", "for", "(", "let", "type", "in", "FILE_TYPE_MAP", ")", "{", "let", "exts", "=", "FILE_TYPE_MAP", "[", "type", "]", "if", "(", "exts", ".",...
get parser type of file @param {String} file @return {String}
[ "get", "parser", "type", "of", "file" ]
b600dfd7545785861ef46c203f508824505d8862
https://github.com/yibn2008/dependency-analyze/blob/b600dfd7545785861ef46c203f508824505d8862/lib/index.js#L271-L281
30,982
cloudfour/drizzle-builder
src/parse/data.js
parseData
function parseData(options) { return readFileTree(options.src.data, options.keys.data, options); }
javascript
function parseData(options) { return readFileTree(options.src.data, options.keys.data, options); }
[ "function", "parseData", "(", "options", ")", "{", "return", "readFileTree", "(", "options", ".", "src", ".", "data", ",", "options", ".", "keys", ".", "data", ",", "options", ")", ";", "}" ]
Parse data from data files @param {Object} options Options object with `src.data` property @return {Promise} resolving to parsed file data
[ "Parse", "data", "from", "data", "files" ]
1c320cb059c749c28339a661d1768d3a643e5f1c
https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/parse/data.js#L11-L13
30,983
davidemiceli/gender-detection
index.js
function(firstName, lang) { if (lang && male[firstName] && male[firstName][lang] && female[firstName] && female[firstName][lang]) { return 'unisex'; } else if (lang && male[firstName] && male[firstName][lang]) { return 'male'; } else if (lang && female[firstName] && female[firstName][lang]) { return '...
javascript
function(firstName, lang) { if (lang && male[firstName] && male[firstName][lang] && female[firstName] && female[firstName][lang]) { return 'unisex'; } else if (lang && male[firstName] && male[firstName][lang]) { return 'male'; } else if (lang && female[firstName] && female[firstName][lang]) { return '...
[ "function", "(", "firstName", ",", "lang", ")", "{", "if", "(", "lang", "&&", "male", "[", "firstName", "]", "&&", "male", "[", "firstName", "]", "[", "lang", "]", "&&", "female", "[", "firstName", "]", "&&", "female", "[", "firstName", "]", "[", "...
Match gender type from the first name
[ "Match", "gender", "type", "from", "the", "first", "name" ]
d78ae93d72541125b5d2effe3f49e007cd76a8bc
https://github.com/davidemiceli/gender-detection/blob/d78ae93d72541125b5d2effe3f49e007cd76a8bc/index.js#L8-L23
30,984
shamil/node-zabbix-sender
index.js
prepareData
function prepareData(items, with_timestamps, with_ns) { var data = { request: 'sender data', data: items }; if (with_timestamps) { var ts = Date.now() / 1000; data.clock = ts | 0; if (with_ns) { data.ns = (ts % 1) * 1000 * 1000000 | 0; } } ...
javascript
function prepareData(items, with_timestamps, with_ns) { var data = { request: 'sender data', data: items }; if (with_timestamps) { var ts = Date.now() / 1000; data.clock = ts | 0; if (with_ns) { data.ns = (ts % 1) * 1000 * 1000000 | 0; } } ...
[ "function", "prepareData", "(", "items", ",", "with_timestamps", ",", "with_ns", ")", "{", "var", "data", "=", "{", "request", ":", "'sender data'", ",", "data", ":", "items", "}", ";", "if", "(", "with_timestamps", ")", "{", "var", "ts", "=", "Date", ...
takes items array and prepares payload for sending
[ "takes", "items", "array", "and", "prepares", "payload", "for", "sending" ]
39b588e178fd3a0428918fdab382fd6bfc8473ba
https://github.com/shamil/node-zabbix-sender/blob/39b588e178fd3a0428918fdab382fd6bfc8473ba/index.js#L115-L136
30,985
maierfelix/glmw
dist/glmw-node.js
function(module, memory) { // @str module.str = function(address) { let view = memory.F32.subarray(address >> 2, (address >> 2) + 16); let out = ""; for (let ii = 0; ii < 16; ++ii) { if (ii + 1 < 16) out += view[ii] + ", "; else out += view[ii]; } return "mat4(" + out + ")"; }; /...
javascript
function(module, memory) { // @str module.str = function(address) { let view = memory.F32.subarray(address >> 2, (address >> 2) + 16); let out = ""; for (let ii = 0; ii < 16; ++ii) { if (ii + 1 < 16) out += view[ii] + ", "; else out += view[ii]; } return "mat4(" + out + ")"; }; /...
[ "function", "(", "module", ",", "memory", ")", "{", "// @str", "module", ".", "str", "=", "function", "(", "address", ")", "{", "let", "view", "=", "memory", ".", "F32", ".", "subarray", "(", "address", ">>", "2", ",", "(", "address", ">>", "2", ")...
The following methods need to be bridged within js which results in some overhead
[ "The", "following", "methods", "need", "to", "be", "bridged", "within", "js", "which", "results", "in", "some", "overhead" ]
4b1b39868f1038ded299f4a983adf8882104124d
https://github.com/maierfelix/glmw/blob/4b1b39868f1038ded299f4a983adf8882104124d/dist/glmw-node.js#L122-L149
30,986
uphold/eslint-plugin-sql-template
rules/no-unsafe-query.js
isSqlQuery
function isSqlQuery(literal) { if (!literal) { return false; } try { parser.parse(literal); } catch (error) { return false; } return true; }
javascript
function isSqlQuery(literal) { if (!literal) { return false; } try { parser.parse(literal); } catch (error) { return false; } return true; }
[ "function", "isSqlQuery", "(", "literal", ")", "{", "if", "(", "!", "literal", ")", "{", "return", "false", ";", "}", "try", "{", "parser", ".", "parse", "(", "literal", ")", ";", "}", "catch", "(", "error", ")", "{", "return", "false", ";", "}", ...
Check if `literal` is an SQL query.
[ "Check", "if", "literal", "is", "an", "SQL", "query", "." ]
9200864402bab77a88b8a827f61c17148751fd24
https://github.com/uphold/eslint-plugin-sql-template/blob/9200864402bab77a88b8a827f61c17148751fd24/rules/no-unsafe-query.js#L13-L25
30,987
uphold/eslint-plugin-sql-template
rules/no-unsafe-query.js
validate
function validate(node, context) { if (!node) { return; } if (node.type === 'TaggedTemplateExpression' && node.tag.name !== 'sql') { node = node.quasi; } if (node.type === 'TemplateLiteral' && node.expressions.length) { const literal = node.quasis.map(quasi => quasi.value.raw).join('x'); if...
javascript
function validate(node, context) { if (!node) { return; } if (node.type === 'TaggedTemplateExpression' && node.tag.name !== 'sql') { node = node.quasi; } if (node.type === 'TemplateLiteral' && node.expressions.length) { const literal = node.quasis.map(quasi => quasi.value.raw).join('x'); if...
[ "function", "validate", "(", "node", ",", "context", ")", "{", "if", "(", "!", "node", ")", "{", "return", ";", "}", "if", "(", "node", ".", "type", "===", "'TaggedTemplateExpression'", "&&", "node", ".", "tag", ".", "name", "!==", "'sql'", ")", "{",...
Validate node.
[ "Validate", "node", "." ]
9200864402bab77a88b8a827f61c17148751fd24
https://github.com/uphold/eslint-plugin-sql-template/blob/9200864402bab77a88b8a827f61c17148751fd24/rules/no-unsafe-query.js#L31-L47
30,988
observing/square
lib/square.js
yep
function yep(data) { var err; if (data instanceof Error) err = data; if (!err && data) backup = collection.content = data; else collection.content = backup; self.logger.debug( 'Received a'+ (err ? 'n error' : ' processed') + ' response from t...
javascript
function yep(data) { var err; if (data instanceof Error) err = data; if (!err && data) backup = collection.content = data; else collection.content = backup; self.logger.debug( 'Received a'+ (err ? 'n error' : ' processed') + ' response from t...
[ "function", "yep", "(", "data", ")", "{", "var", "err", ";", "if", "(", "data", "instanceof", "Error", ")", "err", "=", "data", ";", "if", "(", "!", "err", "&&", "data", ")", "backup", "=", "collection", ".", "content", "=", "data", ";", "else", ...
Handle plugin responses from either a data, error or disregard emit. @param {String|Error} data @api private
[ "Handle", "plugin", "responses", "from", "either", "a", "data", "error", "or", "disregard", "emit", "." ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/square.js#L446-L469
30,989
observing/square
lib/square.js
find
function find(deleted, file) { var meta = bundle[file].meta , match = files.some(function some (file) { return file === meta.location || ~meta.location.indexOf(file) || (meta.compiler && ~meta.compiler.imported.join(',').indexOf(file)); }); if (!match) return; // If we ...
javascript
function find(deleted, file) { var meta = bundle[file].meta , match = files.some(function some (file) { return file === meta.location || ~meta.location.indexOf(file) || (meta.compiler && ~meta.compiler.imported.join(',').indexOf(file)); }); if (!match) return; // If we ...
[ "function", "find", "(", "deleted", ",", "file", ")", "{", "var", "meta", "=", "bundle", "[", "file", "]", ".", "meta", ",", "match", "=", "files", ".", "some", "(", "function", "some", "(", "file", ")", "{", "return", "file", "===", "meta", ".", ...
Find file in the bundle. @param {Boolean} deleted are we checking for deleted files @param {String} file @api private
[ "Find", "file", "in", "the", "bundle", "." ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/square.js#L1271-L1290
30,990
observing/square
lib/square.js
insert
function insert(match, commenttype, statement, file) { var location = path.resolve(reference, file) , data = ''; // // If it's not an absolute path, try to require.resolve the file. // if (!fs.existsSync(location)) try { location = require.resolve(file); } catch (e) { } if (!fs...
javascript
function insert(match, commenttype, statement, file) { var location = path.resolve(reference, file) , data = ''; // // If it's not an absolute path, try to require.resolve the file. // if (!fs.existsSync(location)) try { location = require.resolve(file); } catch (e) { } if (!fs...
[ "function", "insert", "(", "match", ",", "commenttype", ",", "statement", ",", "file", ")", "{", "var", "location", "=", "path", ".", "resolve", "(", "reference", ",", "file", ")", ",", "data", "=", "''", ";", "//", "// If it's not an absolute path, try to r...
Process the directive. @param {String} match complete matched result @param {String} commenttype type of comment @param {String} statement import statement name @param {String} file the file that needs to be inlined @returns {String} @api private
[ "Process", "the", "directive", "." ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/square.js#L1336-L1370
30,991
observing/square
lib/square.js
prev
function prev(index, lines) { while (index--) { var line = lines[index].trim(); if (line && !/^(\/\/|\/\*)/.test(line)) { return { line: line, index: index }; } } return {}; }
javascript
function prev(index, lines) { while (index--) { var line = lines[index].trim(); if (line && !/^(\/\/|\/\*)/.test(line)) { return { line: line, index: index }; } } return {}; }
[ "function", "prev", "(", "index", ",", "lines", ")", "{", "while", "(", "index", "--", ")", "{", "var", "line", "=", "lines", "[", "index", "]", ".", "trim", "(", ")", ";", "if", "(", "line", "&&", "!", "/", "^(\\/\\/|\\/\\*)", "/", ".", "test", ...
Find the previous line that contains content, ignoring whitespace and newlines. @param {Number} index @param {Array} lines @returns {Object} @api private
[ "Find", "the", "previous", "line", "that", "contains", "content", "ignoring", "whitespace", "and", "newlines", "." ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/square.js#L1381-L1391
30,992
observing/square
lib/square.js
writer
function writer(err, collections) { if (err) return done(err); // @TODO make sure that self.write only accepts 2 arguments and reads the // type from the supplied collection object. self.logger.debug('Writing files'); async.map(collections, self.write.bind(self), done); }
javascript
function writer(err, collections) { if (err) return done(err); // @TODO make sure that self.write only accepts 2 arguments and reads the // type from the supplied collection object. self.logger.debug('Writing files'); async.map(collections, self.write.bind(self), done); }
[ "function", "writer", "(", "err", ",", "collections", ")", "{", "if", "(", "err", ")", "return", "done", "(", "err", ")", ";", "// @TODO make sure that self.write only accepts 2 arguments and reads the", "// type from the supplied collection object.", "self", ".", "logger...
Write the processed collections to disk. @param {Error} err @param {Array} collections
[ "Write", "the", "processed", "collections", "to", "disk", "." ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/square.js#L1517-L1524
30,993
observing/square
lib/square.js
done
function done(err, files) { // On processing errors notify the watcher (if listening) that square is idle. if (err && self.writable) { self.logger.error(err); return fn(err); } // Stop our cache, it will be activated again when we need it self.cache.stop(); // Merge the results arr...
javascript
function done(err, files) { // On processing errors notify the watcher (if listening) that square is idle. if (err && self.writable) { self.logger.error(err); return fn(err); } // Stop our cache, it will be activated again when we need it self.cache.stop(); // Merge the results arr...
[ "function", "done", "(", "err", ",", "files", ")", "{", "// On processing errors notify the watcher (if listening) that square is idle.", "if", "(", "err", "&&", "self", ".", "writable", ")", "{", "self", ".", "logger", ".", "error", "(", "err", ")", ";", "retur...
Callback function for when the build is finished. @param {Error} err
[ "Callback", "function", "for", "when", "the", "build", "is", "finished", "." ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/square.js#L1531-L1551
30,994
observing/square
lib/square.js
getObjectByKey
function getObjectByKey(data, prop) { if (!prop || !~prop.indexOf('.')) return data[prop]; var result = prop , structure = data; for (var paths = prop.split('.'), i = 0, length = paths.length; i < length; i++) { result = structure[+paths[i] || paths[i]]; structure = result; } re...
javascript
function getObjectByKey(data, prop) { if (!prop || !~prop.indexOf('.')) return data[prop]; var result = prop , structure = data; for (var paths = prop.split('.'), i = 0, length = paths.length; i < length; i++) { result = structure[+paths[i] || paths[i]]; structure = result; } re...
[ "function", "getObjectByKey", "(", "data", ",", "prop", ")", "{", "if", "(", "!", "prop", "||", "!", "~", "prop", ".", "indexOf", "(", "'.'", ")", ")", "return", "data", "[", "prop", "]", ";", "var", "result", "=", "prop", ",", "structure", "=", ...
Small helper function that allows you get a key from an object by specifying it's depth using dot notations. Example: - path.to.0.keys - key.depth @param {Ojbect|Array} data @param {String} prop @returns {Mixed} @api private
[ "Small", "helper", "function", "that", "allows", "you", "get", "a", "key", "from", "an", "object", "by", "specifying", "it", "s", "depth", "using", "dot", "notations", "." ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/square.js#L1642-L1654
30,995
observing/square
lib/square.js
finished
function finished(err) { if (err) self.critical('Failed to store %s. %s.', base, err.message); if (fn) fn(err, collection); }
javascript
function finished(err) { if (err) self.critical('Failed to store %s. %s.', base, err.message); if (fn) fn(err, collection); }
[ "function", "finished", "(", "err", ")", "{", "if", "(", "err", ")", "self", ".", "critical", "(", "'Failed to store %s. %s.'", ",", "base", ",", "err", ".", "message", ")", ";", "if", "(", "fn", ")", "fn", "(", "err", ",", "collection", ")", ";", ...
Simple finish function to ensure that we always call our callback when it's supplied. No matter what kind of write we need to perform. @param {Error} err optional error
[ "Simple", "finish", "function", "to", "ensure", "that", "we", "always", "call", "our", "callback", "when", "it", "s", "supplied", ".", "No", "matter", "what", "kind", "of", "write", "we", "need", "to", "perform", "." ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/square.js#L1749-L1752
30,996
observing/square
lib/cli.js
spinner
function spinner(silent) { var interval = 100 , frames = spinner.frames , len = frames.length , i = 0; if (silent) return; spinner.interval = setInterval(function tick() { process.stdout.write( '\r' + frames[i++ % len] + 'Waiting for fi...
javascript
function spinner(silent) { var interval = 100 , frames = spinner.frames , len = frames.length , i = 0; if (silent) return; spinner.interval = setInterval(function tick() { process.stdout.write( '\r' + frames[i++ % len] + 'Waiting for fi...
[ "function", "spinner", "(", "silent", ")", "{", "var", "interval", "=", "100", ",", "frames", "=", "spinner", ".", "frames", ",", "len", "=", "frames", ".", "length", ",", "i", "=", "0", ";", "if", "(", "silent", ")", "return", ";", "spinner", ".",...
Display a spinner in the terminal the the users receive feedback and know that we are watching their files for changes. @param {Boolean} silent no logging output @api private
[ "Display", "a", "spinner", "in", "the", "terminal", "the", "the", "users", "receive", "feedback", "and", "know", "that", "we", "are", "watching", "their", "files", "for", "changes", "." ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/cli.js#L208-L223
30,997
observing/square
plugins/minify.js
full
function full(source) { for (var i = 0, item; i < source.length; i++) { item = source.splice(i, 1)[0]; seen.push(item); if (source.length === 0) permutations.push(seen.slice()); full(source); source.splice(i, 0, item); seen.pop(); } ...
javascript
function full(source) { for (var i = 0, item; i < source.length; i++) { item = source.splice(i, 1)[0]; seen.push(item); if (source.length === 0) permutations.push(seen.slice()); full(source); source.splice(i, 0, item); seen.pop(); } ...
[ "function", "full", "(", "source", ")", "{", "for", "(", "var", "i", "=", "0", ",", "item", ";", "i", "<", "source", ".", "length", ";", "i", "++", ")", "{", "item", "=", "source", ".", "splice", "(", "i", ",", "1", ")", "[", "0", "]", ";",...
Full iterator for the permutations @param {Array} source @returns {Array} permutations @api private
[ "Full", "iterator", "for", "the", "permutations" ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/plugins/minify.js#L278-L291
30,998
observing/square
plugins/minify.js
fast
function fast(source) { var i = source.length; while (i--) { combinations.push(source.slice(0, i + 1)); if (i === 1) fast(source.slice(i)); } return combinations; }
javascript
function fast(source) { var i = source.length; while (i--) { combinations.push(source.slice(0, i + 1)); if (i === 1) fast(source.slice(i)); } return combinations; }
[ "function", "fast", "(", "source", ")", "{", "var", "i", "=", "source", ".", "length", ";", "while", "(", "i", "--", ")", "{", "combinations", ".", "push", "(", "source", ".", "slice", "(", "0", ",", "i", "+", "1", ")", ")", ";", "if", "(", "...
Fast iterator for the combinations @param {Array} source @returns {Array} combinations @api private
[ "Fast", "iterator", "for", "the", "combinations" ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/plugins/minify.js#L300-L309
30,999
observing/square
lib/watch.js
Watcher
function Watcher(square, port, silent) { var self = this; this.square = square; this.silent = silent || false; this.socket = this.live.call(this, port); this.config = path.resolve(process.env.PWD, this.square.package.location); // Initialize the live reload, also trigger watching and process the file list...
javascript
function Watcher(square, port, silent) { var self = this; this.square = square; this.silent = silent || false; this.socket = this.live.call(this, port); this.config = path.resolve(process.env.PWD, this.square.package.location); // Initialize the live reload, also trigger watching and process the file list...
[ "function", "Watcher", "(", "square", ",", "port", ",", "silent", ")", "{", "var", "self", "=", "this", ";", "this", ".", "square", "=", "square", ";", "this", ".", "silent", "=", "silent", "||", "false", ";", "this", ".", "socket", "=", "this", "....
Constructor for a watcher. @constructor @param {object} square instance @param {Number} port socket.io reload port @param {Boolean} silent no logging at all @api public
[ "Constructor", "for", "a", "watcher", "." ]
0a801de3815526d0d5231976f666e97674312de2
https://github.com/observing/square/blob/0a801de3815526d0d5231976f666e97674312de2/lib/watch.js#L24-L39