Skip to content

Commit 7378d32

Browse files
committed
fix: added ObjectID support
1 parent 2511dba commit 7378d32

File tree

4 files changed

+37
-11
lines changed

4 files changed

+37
-11
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const _ = require('lodash');
2-
const dotify = require('node-dotify');
2+
const dotify = require('@ladjs/node-dotify');
33

44
const pickOriginal = function(transformed, original) {
55
const obj = {};

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
"Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)"
1717
],
1818
"dependencies": {
19-
"lodash": "^4.17.15",
20-
"node-dotify": "^1.0.1"
19+
"@ladjs/node-dotify": "^1.0.2",
20+
"lodash": "^4.17.15"
2121
},
2222
"devDependencies": {
2323
"@commitlint/cli": "latest",
2424
"@commitlint/config-conventional": "latest",
2525
"ava": "latest",
26+
"bson-objectid": "^1.3.0",
2627
"codecov": "latest",
2728
"cross-env": "latest",
2829
"eslint": "6.x",

test/test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const ObjectID = require('bson-objectid');
12
const test = require('ava');
23

34
const pickOriginal = require('..');
@@ -65,3 +66,20 @@ test('picks original', t => {
6566
}
6667
);
6768
});
69+
70+
test('works with mongodb objectid', t => {
71+
const _id = new ObjectID();
72+
t.deepEqual(
73+
pickOriginal(
74+
{
75+
_id
76+
},
77+
{
78+
_id
79+
}
80+
),
81+
{
82+
_id
83+
}
84+
);
85+
});

yarn.lock

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,13 @@
330330
resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd"
331331
integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==
332332

333+
"@ladjs/node-dotify@^1.0.2":
334+
version "1.0.2"
335+
resolved "https://registry.yarnpkg.com/@ladjs/node-dotify/-/node-dotify-1.0.2.tgz#4b83595528e58224374820a346e1ab84492648b8"
336+
integrity sha512-6uAJllEitRqZPj4gBvmz3VkPgMfrukeBZJz0sjdVAQbwRHJR3i1CmM48LUMRlNKpuRV2EEw+ufkdKUda+kHE5g==
337+
dependencies:
338+
bson-objectid "^1.3.0"
339+
333340
"@marionebl/sander@^0.6.0":
334341
version "0.6.1"
335342
resolved "https://registry.yarnpkg.com/@marionebl/sander/-/sander-0.6.1.tgz#1958965874f24bc51be48875feb50d642fc41f7b"
@@ -889,6 +896,11 @@ braces@^3.0.1, braces@~3.0.2:
889896
dependencies:
890897
fill-range "^7.0.1"
891898

899+
bson-objectid@^1.3.0:
900+
version "1.3.0"
901+
resolved "https://registry.yarnpkg.com/bson-objectid/-/bson-objectid-1.3.0.tgz#f0f4c7c949fece975f12790510d75d7fe39fb456"
902+
integrity sha512-YcB+lRJEEEIcHNLKyhmHujW7OCVE3+xr9IpEhlprBZnXgF3hqeePeexIsAaOtu1SbkgZRlJVUxvYZ3ngUOyIew==
903+
892904
buf-compare@^1.0.0:
893905
version "1.0.1"
894906
resolved "https://registry.yarnpkg.com/buf-compare/-/buf-compare-1.0.1.tgz#fef28da8b8113a0a0db4430b0b6467b69730b34a"
@@ -1922,9 +1934,9 @@ eslint-plugin-unicorn@^12.0.0:
19221934
semver "^6.3.0"
19231935

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

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

4081-
node-dotify@^1.0.1:
4082-
version "1.0.1"
4083-
resolved "https://registry.yarnpkg.com/node-dotify/-/node-dotify-1.0.1.tgz#ab2eab6d4a01ce37c61a04983c763ed07c29fe46"
4084-
integrity sha1-qy6rbUoBzjfGGgSYPHY+0Hwp/kY=
4085-
40864093
node-fetch@^2.2.0:
40874094
version "2.6.0"
40884095
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"

0 commit comments

Comments
 (0)