@lucania/schema 3.1.3 → 3.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/index.js +4 -1
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -262,6 +262,9 @@
262
262
  }
263
263
  const type = typeof value;
264
264
  if (type === "object") {
265
+ if (value.constructor === undefined) {
266
+ return type;
267
+ }
265
268
  const constructor = value.constructor.name;
266
269
  if (constructor === "Object") {
267
270
  return type;
@@ -707,7 +710,7 @@
707
710
  return output;
708
711
  }
709
712
  convert(value, pass) {
710
- pass.assert(typeof value === "object", `Unable to convert ${ObjectSchema.getType(value)} to object.`);
713
+ pass.assert(typeof value === "object" && value !== null, `Unable to convert ${ObjectSchema.getType(value)} to object.`);
711
714
  const model = {};
712
715
  for (const key in this.subschema) {
713
716
  const nestedSchema = this.subschema[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucania/schema",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "A schema module for compile-time and runtime type checking.",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",