tinyexpect 0.6.2 → 0.7.1

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 (3) hide show
  1. package/index.js +5 -0
  2. package/index.ts +5 -0
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -84,6 +84,11 @@ function expect(v) {
84
84
  if (!vKeys.every(key => JSON.stringify(v[key]) === JSON.stringify(obj[key]))) {
85
85
  throw new Error(`Object values do not match`);
86
86
  }
87
+ },
88
+ toBeInstanceOf(constructor) {
89
+ if (!(v instanceof constructor)) {
90
+ throw new Error(`${v} is not an instance of ${constructor.name}`);
91
+ }
87
92
  }
88
93
  };
89
94
  }
package/index.ts CHANGED
@@ -84,6 +84,11 @@ export function expect(v: any) {
84
84
  if (!vKeys.every(key => JSON.stringify(v[key]) === JSON.stringify(obj[key]))) {
85
85
  throw new Error(`Object values do not match`);
86
86
  }
87
+ },
88
+ toBeInstanceOf(constructor: Function){
89
+ if (!(v instanceof constructor)){
90
+ throw new Error(`${v} is not an instance of ${constructor.name}`)
91
+ }
87
92
  }
88
93
  }
89
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinyexpect",
3
- "version": "0.6.2",
3
+ "version": "0.7.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {