Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

chore: COMPASS-4063 update lodash #7

Merged
merged 6 commits into from
Jan 10, 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
1 change: 0 additions & 1 deletion .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
agg_pipeline_parser.js
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ coverage
*.iml
lib/
*.swp
agg_pipeline_parser.js
174 changes: 0 additions & 174 deletions .jsfmtrc

This file was deleted.

1 change: 0 additions & 1 deletion .jshintignore

This file was deleted.

8 changes: 1 addition & 7 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
.jshintrc
.jsfmtrc
.travis.yml
.zuul.yml
.babelrc
.eslintrc
.jshintignore
src/
.eslintignore
misc/
examples/
test/
.swp
29 changes: 9 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
sudo: required
sudo: false
dist: trusty
language: node_js
node_js:
- 10.2.1
env:
matrix:
- MONGODB_VERSION=3.4.x MONGODB_TOPOLOGY=standalone
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libkrb5-dev
- 12.4.0
before_install:
- echo "//registry.npmjs.org/:_authToken=9975e747-fa75-4ba3-8b08-b743680a36b8" >> .npmrc
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script: npm run ci
cache:
directories:
- $HOME/.electron
- node_modules
- npm install -g npm@latest
install:
- npm ci
script:
- npm run check
- npm test
cache: npm
12 changes: 0 additions & 12 deletions .zuul.yml

This file was deleted.

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@ assert.ok(accepts('{"match": {"x": 35}}'));

assert.equal(accepts('{"$invalid": "key"}'), false);
```

## Related

- [`mongodb-query-parser`](https://github.com/mongodb-js/query-parser) Validate and parse MongoDB queries and projections
- [`mongodb-language-model`](https://github.com/mongodb-js/mongodb-language-model) Work with rich AST's of MongoDB queries
- [`@mongodb-js/compass-aggregations`](https://github.com/mongodb-js/compass-aggregations) MongoDB Compass UI Plugin for building and debugging aggregation pipelines.

## License

Apache 2.0
File renamed without changes.
56 changes: 55 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
module.exports = require('./lib');
/* eslint-disable no-lonely-if, complexity */
const parser = require('./agg_pipeline_parser.js');

const cleanWhiteSpace = function(s) {
let ret = '';
let inDString = false;
let inSString = false;
for (let i = 0, len = s.length; i < len; i++) {
const ch = s.charAt(i);
if (ch === '\\') {
ret += ch;
i++;
ret += s.charAt(i);
continue;
}
if (inDString) {
if (ch === '"') {
inDString = false;
}
ret += ch;
} else if (inSString) {
if (ch === "'") {
inSString = false;
}
ret += ch;
} else {
if (ch === '"') {
inDString = true;
ret += ch;
} else if (ch === "'") {
inSString = true;
ret += ch;
} else if (ch === ' ' || ch === '\t' || ch === '\n' || ch === '\r') {
continue;
} else {
ret += ch;
}
}
}
return ret;
};

module.exports = {
parse: function(input) {
return parser.parse(cleanWhiteSpace(input));
},
accepts: function(input) {
try {
parser.parse(cleanWhiteSpace(input));
return true;
} catch (e) {
return false;
}
}
};
Loading