is-what 4.1.7 → 4.1.9

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -11,6 +11,8 @@ npm i is-what
11
11
 
12
12
  Or for deno available at: `"deno.land/x/is_what"`
13
13
 
14
+ > Also check out [is-where 🙈](https://github.com/mesqueeb/is-where)
15
+
14
16
  ## Motivation
15
17
 
16
18
  I built is-what because the existing solutions were all too complex or too poorly built.
@@ -241,16 +243,20 @@ function isObjectLike<T extends object>(payload: any): payload is T {
241
243
  return isAnyObject(payload)
242
244
  }
243
245
  ```
244
-
245
- ## Meet the family
246
+ ## Meet the family (more tiny utils with TS support)
246
247
 
247
248
  - [is-what 🙉](https://github.com/mesqueeb/is-what)
249
+ - [is-where 🙈](https://github.com/mesqueeb/is-where)
248
250
  - [merge-anything 🥡](https://github.com/mesqueeb/merge-anything)
251
+ - [check-anything 👁](https://github.com/mesqueeb/check-anything)
252
+ - [remove-anything ✂️](https://github.com/mesqueeb/remove-anything)
253
+ - [getorset-anything 🐊](https://github.com/mesqueeb/getorset-anything)
254
+ - [map-anything 🗺](https://github.com/mesqueeb/map-anything)
249
255
  - [filter-anything ⚔️](https://github.com/mesqueeb/filter-anything)
250
- - [find-and-replace-anything 🎣](https://github.com/mesqueeb/find-and-replace-anything)
251
- - [compare-anything 🛰](https://github.com/mesqueeb/compare-anything)
252
256
  - [copy-anything 🎭](https://github.com/mesqueeb/copy-anything)
257
+ - [case-anything 🐫](https://github.com/mesqueeb/case-anything)
253
258
  - [flatten-anything 🏏](https://github.com/mesqueeb/flatten-anything)
259
+ - [nestify-anything 🧅](https://github.com/mesqueeb/nestify-anything)
254
260
 
255
261
  ## Source code
256
262
 
@@ -272,4 +278,4 @@ function isAnyObject(payload) {
272
278
  // etc...
273
279
  ```
274
280
 
275
- See the full source code [here](https://github.com/mesqueeb/is-what/blob/master/src/index.ts).
281
+ See the full source code [here](https://github.com/mesqueeb/is-what/blob/production/src/index.ts).
package/dist/index.cjs CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  /**
6
4
  * Returns the object type of the given payload
7
5
  *
@@ -38,7 +36,8 @@ function isNull(payload) {
38
36
  function isPlainObject(payload) {
39
37
  if (getType(payload) !== 'Object')
40
38
  return false;
41
- return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;
39
+ const prototype = Object.getPrototypeOf(payload);
40
+ return prototype.constructor === Object && prototype === Object.prototype;
42
41
  }
43
42
  /**
44
43
  * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
package/dist/index.es.js CHANGED
@@ -34,7 +34,8 @@ function isNull(payload) {
34
34
  function isPlainObject(payload) {
35
35
  if (getType(payload) !== 'Object')
36
36
  return false;
37
- return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;
37
+ const prototype = Object.getPrototypeOf(payload);
38
+ return prototype.constructor === Object && prototype === Object.prototype;
38
39
  }
39
40
  /**
40
41
  * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
@@ -1,8 +1,8 @@
1
- export declare type AnyFunction = (...args: any[]) => any;
2
- export declare type AnyAsyncFunction = (...args: any[]) => Promise<any>;
3
- export declare type AnyClass = new (...args: any[]) => any;
4
- export declare type PlainObject = Record<string | number | symbol, any>;
5
- declare type TypeGuard<A, B extends A> = (payload: A) => payload is B;
1
+ export type AnyFunction = (...args: any[]) => any;
2
+ export type AnyAsyncFunction = (...args: any[]) => Promise<any>;
3
+ export type AnyClass = new (...args: any[]) => any;
4
+ export type PlainObject = Record<string | number | symbol, any>;
5
+ type TypeGuard<A, B extends A> = (payload: A) => payload is B;
6
6
  /**
7
7
  * Returns the object type of the given payload
8
8
  *
package/package.json CHANGED
@@ -2,16 +2,16 @@
2
2
  "name": "is-what",
3
3
  "sideEffects": false,
4
4
  "type": "module",
5
- "version": "4.1.7",
5
+ "version": "4.1.9",
6
6
  "description": "JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.",
7
7
  "module": "./dist/index.es.js",
8
8
  "main": "./dist/index.cjs",
9
9
  "types": "./dist/types/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
+ "types": "./dist/types/index.d.ts",
12
13
  "import": "./dist/index.es.js",
13
- "require": "./dist/index.cjs",
14
- "types": "./dist/types/index.d.ts"
14
+ "require": "./dist/index.cjs"
15
15
  }
16
16
  },
17
17
  "files": [
@@ -23,7 +23,7 @@
23
23
  "scripts": {
24
24
  "test": "vitest run",
25
25
  "lint": "tsc --noEmit && eslint ./src --ext .ts",
26
- "build": "rollup -c ./scripts/build.js",
26
+ "build": "rollup --bundleConfigAsCjs -c ./scripts/build.js",
27
27
  "release": "npm run lint && del dist && npm run build && np"
28
28
  },
29
29
  "repository": {
@@ -59,18 +59,18 @@
59
59
  },
60
60
  "homepage": "https://github.com/mesqueeb/is-what#readme",
61
61
  "devDependencies": {
62
- "@typescript-eslint/eslint-plugin": "^5.10.1",
63
- "@typescript-eslint/parser": "^5.10.1",
64
- "del-cli": "^4.0.1",
65
- "eslint": "^8.7.0",
66
- "eslint-config-prettier": "^8.3.0",
62
+ "@typescript-eslint/eslint-plugin": "^5.59.2",
63
+ "@typescript-eslint/parser": "^5.59.2",
64
+ "del-cli": "^5.0.0",
65
+ "eslint": "^8.40.0",
66
+ "eslint-config-prettier": "^8.8.0",
67
67
  "eslint-plugin-tree-shaking": "^1.10.0",
68
- "np": "^7.6.0",
69
- "prettier": "^2.5.1",
70
- "rollup": "^2.66.1",
71
- "rollup-plugin-typescript2": "^0.31.1",
72
- "typescript": "^4.5.5",
73
- "vitest": "^0.2.3"
68
+ "np": "^7.7.0",
69
+ "prettier": "^2.8.8",
70
+ "rollup": "^3.21.5",
71
+ "rollup-plugin-typescript2": "^0.34.1",
72
+ "typescript": "^4.9.5",
73
+ "vitest": "^0.31.0"
74
74
  },
75
75
  "ava": {
76
76
  "extensions": {