hadron-type-checker
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -132,2 +132,9 @@ 'use strict'; | ||
function toObjectID(object) { | ||
if (object === '') { | ||
return new bson.ObjectID(); | ||
} | ||
return bson.ObjectID.createFromHexString(object); | ||
} | ||
/** | ||
@@ -149,3 +156,4 @@ * The functions to cast to a type. | ||
'Object': toObject, | ||
'Array': toArray | ||
'Array': toArray, | ||
'ObjectID': toObjectID | ||
}; | ||
@@ -263,3 +271,3 @@ | ||
const STRING_TESTS = [ | ||
new Test(/^$/, [ 'String', 'Null', 'MinKey', 'MaxKey', 'Object', 'Array' ]), | ||
new Test(/^$/, [ 'String', 'Null', 'MinKey', 'MaxKey', 'Object', 'Array', 'ObjectID']), | ||
new Test(INT32_CHECK, [ 'Int32', 'Int64', 'Double', 'String', 'Object', 'Array' ]), | ||
@@ -273,3 +281,4 @@ new Test(INT_DBL_CHECK, [ 'Int64', 'Double', 'String', 'Object', 'Array' ]), | ||
new Test(/^\/(.*)\/$/, [ 'BSONRegExp', 'String', 'Object', 'Array' ]), | ||
new Test(DATE_CHECK, [ 'Date', 'String', 'Object', 'Array' ]) | ||
new Test(DATE_CHECK, [ 'Date', 'String', 'Object', 'Array' ]), | ||
new Test(/(^$)|^[A-Fa-f0-9]{24}$/, [ 'String', 'Object', 'Array', 'ObjectID' ]) | ||
]; | ||
@@ -281,3 +290,3 @@ | ||
const HP_STRING_TESTS = [ | ||
new Test(/^$/, [ 'String', 'Null', 'MinKey', 'MaxKey', 'Object', 'Array' ]), | ||
new Test(/^$/, [ 'String', 'Null', 'MinKey', 'MaxKey', 'Object', 'Array', 'ObjectID' ]), | ||
new Test(INT32_CHECK, [ 'Int32', 'Int64', 'Double', 'Decimal128', 'String', 'Object', 'Array' ]), | ||
@@ -292,3 +301,4 @@ new Test(INT_DBL_CHECK, [ 'Int64', 'Double', 'Decimal128', 'String', 'Object', 'Array' ]), | ||
new Test(/^\/(.*)\/$/, [ 'BSONRegExp', 'String', 'Object', 'Array' ]), | ||
new Test(DATE_CHECK, [ 'Date', 'String', 'Object', 'Array' ]) | ||
new Test(DATE_CHECK, [ 'Date', 'String', 'Object', 'Array' ]), | ||
new Test(/(^$)|^[A-Fa-f0-9]{24}$/, [ 'String', 'Object', 'Array', 'ObjectID' ]) | ||
]; | ||
@@ -364,3 +374,4 @@ | ||
* | ||
* @param {Object} - The object. | ||
* @param {Object} object - The object. | ||
* @param {Boolean} highPrecisionSupport - If high precision is supported or not. | ||
* | ||
@@ -367,0 +378,0 @@ * @returns {Array} The available types. |
@@ -7,3 +7,3 @@ { | ||
"homepage": "https://github.com/mongodb-js/hadron-type-checker", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"repository": { | ||
@@ -10,0 +10,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22242
362