Skip to content

Commit

Permalink
fix: added ObjectID support
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed May 31, 2020
1 parent 2511dba commit 7378d32
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const _ = require('lodash');
const dotify = require('node-dotify');
const dotify = require('@ladjs/node-dotify');

const pickOriginal = function(transformed, original) {
const obj = {};
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
"Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)"
],
"dependencies": {
"lodash": "^4.17.15",
"node-dotify": "^1.0.1"
"@ladjs/node-dotify": "^1.0.2",
"lodash": "^4.17.15"
},
"devDependencies": {
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"ava": "latest",
"bson-objectid": "^1.3.0",
"codecov": "latest",
"cross-env": "latest",
"eslint": "6.x",
Expand Down
18 changes: 18 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const ObjectID = require('bson-objectid');
const test = require('ava');

const pickOriginal = require('..');
Expand Down Expand Up @@ -65,3 +66,20 @@ test('picks original', t => {
}
);
});

test('works with mongodb objectid', t => {
const _id = new ObjectID();
t.deepEqual(
pickOriginal(
{
_id
},
{
_id
}
),
{
_id
}
);
});
23 changes: 15 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,13 @@
resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd"
integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==

"@ladjs/node-dotify@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@ladjs/node-dotify/-/node-dotify-1.0.2.tgz#4b83595528e58224374820a346e1ab84492648b8"
integrity sha512-6uAJllEitRqZPj4gBvmz3VkPgMfrukeBZJz0sjdVAQbwRHJR3i1CmM48LUMRlNKpuRV2EEw+ufkdKUda+kHE5g==
dependencies:
bson-objectid "^1.3.0"

"@marionebl/sander@^0.6.0":
version "0.6.1"
resolved "https://registry.yarnpkg.com/@marionebl/sander/-/sander-0.6.1.tgz#1958965874f24bc51be48875feb50d642fc41f7b"
Expand Down Expand Up @@ -889,6 +896,11 @@ braces@^3.0.1, braces@~3.0.2:
dependencies:
fill-range "^7.0.1"

bson-objectid@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/bson-objectid/-/bson-objectid-1.3.0.tgz#f0f4c7c949fece975f12790510d75d7fe39fb456"
integrity sha512-YcB+lRJEEEIcHNLKyhmHujW7OCVE3+xr9IpEhlprBZnXgF3hqeePeexIsAaOtu1SbkgZRlJVUxvYZ3ngUOyIew==

buf-compare@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/buf-compare/-/buf-compare-1.0.1.tgz#fef28da8b8113a0a0db4430b0b6467b69730b34a"
Expand Down Expand Up @@ -1922,9 +1934,9 @@ eslint-plugin-unicorn@^12.0.0:
semver "^6.3.0"

eslint-rule-docs@^1.1.5:
version "1.1.192"
resolved "https://registry.yarnpkg.com/eslint-rule-docs/-/eslint-rule-docs-1.1.192.tgz#ab231913923a508eaa65d24e17ba08ab3bc3f935"
integrity sha512-6l6y5X7foq4tkTv9JEGRezAcajiw3pfBUkNt2rEEXnM7D+US3TkbQ4C7F41zaMbf7wkGBOlscdAkNj8zQz/wFA==
version "1.1.193"
resolved "https://registry.yarnpkg.com/eslint-rule-docs/-/eslint-rule-docs-1.1.193.tgz#caaf47dd39663ef4ecd5347465a9b274e9f37be9"
integrity sha512-LhMUMMEPK3X/gTyU3wrpeVoc479n7gOPn1oaIhX1mxdZW6MIfFqB84we+bVivKk1Q9Z00tlD72KMEwzazz/ivQ==

eslint-scope@^5.0.0:
version "5.0.0"
Expand Down Expand Up @@ -4078,11 +4090,6 @@ nlcst-to-string@^2.0.0:
resolved "https://registry.yarnpkg.com/nlcst-to-string/-/nlcst-to-string-2.0.4.tgz#9315dfab80882bbfd86ddf1b706f53622dc400cc"
integrity sha512-3x3jwTd6UPG7vi5k4GEzvxJ5rDA7hVUIRNHPblKuMVP9Z3xmlsd9cgLcpAMkc5uPOBna82EeshROFhsPkbnTZg==

node-dotify@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/node-dotify/-/node-dotify-1.0.1.tgz#ab2eab6d4a01ce37c61a04983c763ed07c29fe46"
integrity sha1-qy6rbUoBzjfGGgSYPHY+0Hwp/kY=

node-fetch@^2.2.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
Expand Down

0 comments on commit 7378d32

Please sign in to comment.