From 81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Wed, 18 Nov 2020 23:26:45 +0100 Subject: rm node_modules --- .../lib/helpers/projection/isDefiningProjection.js | 18 ----------- .../mongoose/lib/helpers/projection/isExclusive.js | 28 ----------------- .../mongoose/lib/helpers/projection/isInclusive.js | 34 --------------------- .../lib/helpers/projection/isPathExcluded.js | 35 ---------------------- .../helpers/projection/isPathSelectedInclusive.js | 28 ----------------- .../lib/helpers/projection/parseProjection.js | 33 -------------------- 6 files changed, 176 deletions(-) delete mode 100644 node_modules/mongoose/lib/helpers/projection/isDefiningProjection.js delete mode 100644 node_modules/mongoose/lib/helpers/projection/isExclusive.js delete mode 100644 node_modules/mongoose/lib/helpers/projection/isInclusive.js delete mode 100644 node_modules/mongoose/lib/helpers/projection/isPathExcluded.js delete mode 100644 node_modules/mongoose/lib/helpers/projection/isPathSelectedInclusive.js delete mode 100644 node_modules/mongoose/lib/helpers/projection/parseProjection.js (limited to 'node_modules/mongoose/lib/helpers/projection') diff --git a/node_modules/mongoose/lib/helpers/projection/isDefiningProjection.js b/node_modules/mongoose/lib/helpers/projection/isDefiningProjection.js deleted file mode 100644 index 67dfb39..0000000 --- a/node_modules/mongoose/lib/helpers/projection/isDefiningProjection.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -/*! - * ignore - */ - -module.exports = function isDefiningProjection(val) { - if (val == null) { - // `undefined` or `null` become exclusive projections - return true; - } - if (typeof val === 'object') { - // Only cases where a value does **not** define whether the whole projection - // is inclusive or exclusive are `$meta` and `$slice`. - return !('$meta' in val) && !('$slice' in val); - } - return true; -}; diff --git a/node_modules/mongoose/lib/helpers/projection/isExclusive.js b/node_modules/mongoose/lib/helpers/projection/isExclusive.js deleted file mode 100644 index 8c64bc5..0000000 --- a/node_modules/mongoose/lib/helpers/projection/isExclusive.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -const isDefiningProjection = require('./isDefiningProjection'); - -/*! - * ignore - */ - -module.exports = function isExclusive(projection) { - const keys = Object.keys(projection); - let ki = keys.length; - let exclude = null; - - if (ki === 1 && keys[0] === '_id') { - exclude = !!projection[keys[ki]]; - } else { - while (ki--) { - // Does this projection explicitly define inclusion/exclusion? - // Explicitly avoid `$meta` and `$slice` - if (keys[ki] !== '_id' && isDefiningProjection(projection[keys[ki]])) { - exclude = !projection[keys[ki]]; - break; - } - } - } - - return exclude; -}; diff --git a/node_modules/mongoose/lib/helpers/projection/isInclusive.js b/node_modules/mongoose/lib/helpers/projection/isInclusive.js deleted file mode 100644 index 098309f..0000000 --- a/node_modules/mongoose/lib/helpers/projection/isInclusive.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -const isDefiningProjection = require('./isDefiningProjection'); - -/*! - * ignore - */ - -module.exports = function isInclusive(projection) { - if (projection == null) { - return false; - } - - const props = Object.keys(projection); - const numProps = props.length; - if (numProps === 0) { - return false; - } - - for (let i = 0; i < numProps; ++i) { - const prop = props[i]; - // Plus paths can't define the projection (see gh-7050) - if (prop.startsWith('+')) { - continue; - } - // If field is truthy (1, true, etc.) and not an object, then this - // projection must be inclusive. If object, assume its $meta, $slice, etc. - if (isDefiningProjection(projection[prop]) && !!projection[prop]) { - return true; - } - } - - return false; -}; diff --git a/node_modules/mongoose/lib/helpers/projection/isPathExcluded.js b/node_modules/mongoose/lib/helpers/projection/isPathExcluded.js deleted file mode 100644 index fc2592c..0000000 --- a/node_modules/mongoose/lib/helpers/projection/isPathExcluded.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -const isDefiningProjection = require('./isDefiningProjection'); - -/*! - * Determines if `path` is excluded by `projection` - * - * @param {Object} projection - * @param {string} path - * @return {Boolean} - */ - -module.exports = function isPathExcluded(projection, path) { - if (path === '_id') { - return projection._id === 0; - } - - const paths = Object.keys(projection); - let type = null; - - for (const _path of paths) { - if (isDefiningProjection(projection[_path])) { - type = projection[path] === 1 ? 'inclusive' : 'exclusive'; - break; - } - } - - if (type === 'inclusive') { - return projection[path] !== 1; - } - if (type === 'exclusive') { - return projection[path] === 0; - } - return false; -}; diff --git a/node_modules/mongoose/lib/helpers/projection/isPathSelectedInclusive.js b/node_modules/mongoose/lib/helpers/projection/isPathSelectedInclusive.js deleted file mode 100644 index 8a05fc9..0000000 --- a/node_modules/mongoose/lib/helpers/projection/isPathSelectedInclusive.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -/*! - * ignore - */ - -module.exports = function isPathSelectedInclusive(fields, path) { - const chunks = path.split('.'); - let cur = ''; - let j; - let keys; - let numKeys; - for (let i = 0; i < chunks.length; ++i) { - cur += cur.length ? '.' : '' + chunks[i]; - if (fields[cur]) { - keys = Object.keys(fields); - numKeys = keys.length; - for (j = 0; j < numKeys; ++j) { - if (keys[i].indexOf(cur + '.') === 0 && keys[i].indexOf(path) !== 0) { - continue; - } - } - return true; - } - } - - return false; -}; diff --git a/node_modules/mongoose/lib/helpers/projection/parseProjection.js b/node_modules/mongoose/lib/helpers/projection/parseProjection.js deleted file mode 100644 index d2a44b1..0000000 --- a/node_modules/mongoose/lib/helpers/projection/parseProjection.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -/** - * Convert a string or array into a projection object, retaining all - * `-` and `+` paths. - */ - -module.exports = function parseProjection(v, retainMinusPaths) { - const type = typeof v; - - if (type === 'string') { - v = v.split(/\s+/); - } - if (!Array.isArray(v) && Object.prototype.toString.call(v) !== '[object Arguments]') { - return v; - } - - const len = v.length; - const ret = {}; - for (let i = 0; i < len; ++i) { - let field = v[i]; - if (!field) { - continue; - } - const include = '-' == field[0] ? 0 : 1; - if (!retainMinusPaths && include === 0) { - field = field.substring(1); - } - ret[field] = include; - } - - return ret; -}; \ No newline at end of file -- cgit v1.2.3