Comparing version 3.1.0 to 3.2.0
@@ -79,1 +79,2 @@ // Primatives. | ||
exports["regex"] = exports["regexp"] = v => v instanceof RegExp || "Must be a regular expression"; | ||
exports["any"] = exports["mixed"] = () => true; |
{ | ||
"name": "blork", | ||
"description": "Blork! Mini runtime type checking in Javascript", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"license": "0BSD", | ||
@@ -6,0 +6,0 @@ "author": "Dave Houlbrooke <dave@shax.com>", |
@@ -251,3 +251,4 @@ # Blork! Mini runtime type checking in Javascript | ||
| `array+`, `arr+` | Plain instances of **Array** with one or more items | ||
| `arraylike` | Any object inheriting **Array** | ||
| `arraylike` | Any object, not just arrays, with numeric **.length** property | ||
| `arguments`, `args` | Arguments objects (any object, not just arrays, with numeric **.length** property) | ||
| `map` | Instances of **Map** | ||
@@ -263,3 +264,4 @@ | `map+` | Instances of **Map** with one or more items | ||
| `date-`, `past` | Instances of **Date** with a value in the past | ||
| `arguments`, `args` | Arguments (any object, not just arrays, with numeric **.length** property) | ||
| `regex`, `regexp` | Instances of **RegExp** (regular expressions) | ||
| `any`, `mixed` | Allow any value (transparently passes through with no error) | ||
@@ -266,0 +268,0 @@ ```js |
@@ -90,2 +90,4 @@ const BlorkError = require("../lib/BlorkError"); | ||
expect(check(/[abc]+/g, "regex")).toBe(1); | ||
expect(check(false, "any")).toBe(1); | ||
expect(check("abc", "mixed")).toBe(1); | ||
}); | ||
@@ -175,2 +177,4 @@ test("Throw TypeError when checks fail (string format)", () => { | ||
expect(() => check("/[abc]+/g", "regex")).toThrow(TypeError); | ||
expect(check(false, "any")).toBe(1); | ||
expect(check("abc", "mixed")).toBe(1); | ||
}); | ||
@@ -177,0 +181,0 @@ test("Return correctly when checks pass (optional string format)", () => { |
61107
888
370