Skip to content

COMPASS-3933: Update dependencies #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
sudo: false
dist: trusty
language: node_js
node_js:
- "0.10"
- 6
- 7

- 12.4.0
before_install:
- npm install -g npm@latest
install:
- npm ci
script:
- npm run check
- npm test
cache: npm
46 changes: 22 additions & 24 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
var types = [
'Command',
'Special',
'System',
'Oplog',
'Normal',
'Conf'
];
var types = ['Command', 'Special', 'System', 'Oplog', 'Normal', 'Conf'];

// eslint-disable-next-line complexity
function NS(ns) {
if (!(this instanceof NS)) {
return new NS(ns);
Expand All @@ -25,33 +19,38 @@ function NS(ns) {
this.system = /^system\./.test(this.collection);
this.oplog = /local\.oplog\.(\$main|rs)/.test(ns);

this.command =
this.collection === '$cmd' || this.collection.indexOf('$cmd.sys') === 0;
this.special =
this.oplog || this.command || this.system || this.database === 'config';

this.command = this.collection === '$cmd' ||
this.collection.indexOf('$cmd.sys') === 0;
this.special = this.oplog || this.command || this.system || this.database === 'config';

this.specialish = this.special || ['local', 'admin'].indexOf(this.database) > -1;
this.specialish =
this.special || ['local', 'admin'].indexOf(this.database) > -1;

this.normal = this.oplog || this.ns.indexOf('$') === -1;

/**
* @note (imlucas) The following are not valid on windows:
* `*<>:|?`
*/
this.validDatabaseName = new RegExp('^[^\\\\\/". ]*$').test(this.database) &&
this.validDatabaseName =
new RegExp('^[^\\\\/". ]*$').test(this.database) &&
this.database.length <= NS.MAX_DATABASE_NAME_LENGTH;
this.validCollectionName = this.collection.length > 0 &&
this.validCollectionName =
this.collection.length > 0 &&
(this.oplog || /^[^\0\$]*$/.test(this.collection));

this.databaseHash = 7;
this.ns.split('').every(function(c, i) {
if (c === '.') {
return false;
}
this.databaseHash += 11 * this.ns.charCodeAt(i);
this.databaseHash *= 3;
return true;
}.bind(this));
this.ns.split('').every(
function(c, i) {
if (c === '.') {
return false;
}
this.databaseHash += 11 * this.ns.charCodeAt(i);
this.databaseHash *= 3;
return true;
}.bind(this)
);
}

NS.prototype.database = '';
Expand All @@ -65,7 +64,6 @@ NS.prototype.oplog = false;
NS.prototype.normal = false;
NS.prototype.specialish = false;


types.forEach(function(type) {
NS.prototype['is' + type] = function() {
return this[type.toLowerCase()];
Expand Down
Loading