bson
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -24,3 +24,4 @@ { | ||
"tools" | ||
] | ||
], | ||
"version": "1.1.5" | ||
} |
@@ -0,1 +1,12 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. | ||
### [1.1.5](https://github.com/mongodb/js-bson/compare/v1.1.4...v1.1.5) (2020-08-10) | ||
### Bug Fixes | ||
* **object-id:** harden the duck-typing ([b526145](https://github.com/mongodb/js-bson/commit/b5261450c3bc4abb2e2fb19b5b1a7aba27982d44)) | ||
<a name="1.1.3"></a> | ||
@@ -2,0 +13,0 @@ ## [1.1.3](https://github.com/mongodb/js-bson/compare/v1.1.2...v1.1.3) (2019-11-09) |
@@ -69,3 +69,3 @@ // Custom inspect property name / symbol. | ||
this.id = id; | ||
} else if (id != null && id.toHexString) { | ||
} else if (id != null && typeof id.toHexString === 'function') { | ||
// Duck-typing to support ObjectId from different npm packages | ||
@@ -361,3 +361,6 @@ return id; | ||
// Duck-Typing detection of ObjectId like objects | ||
if (id.toHexString) { | ||
if ( | ||
typeof id.toHexString === 'function' && | ||
(id.id instanceof _Buffer || typeof id.id === 'string') | ||
) { | ||
return id.id.length === 12 || (id.id.length === 24 && checkForHexRegExp.test(id.id)); | ||
@@ -364,0 +367,0 @@ } |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"author": "Christian Amor Kvalheim <christkv@gmail.com>", | ||
@@ -35,2 +35,3 @@ "contributors": [], | ||
"conventional-changelog-cli": "^1.3.5", | ||
"standard-version": "^7.1.0", | ||
"webpack": "^1.13.2", | ||
@@ -54,3 +55,4 @@ "webpack-polyfills-plugin": "0.0.9" | ||
"lint": "eslint lib test", | ||
"format": "prettier --print-width 100 --tab-width 2 --single-quote --write 'test/**/*.js' 'lib/**/*.js'" | ||
"format": "prettier --print-width 100 --tab-width 2 --single-quote --write 'test/**/*.js' 'lib/**/*.js'", | ||
"release": "standard-version -i HISTORY.md" | ||
}, | ||
@@ -57,0 +59,0 @@ "browser": "lib/bson/bson.js", |
773490
21517
13