is-what 4.1.6 → 4.1.8

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.
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,7 +2,7 @@
2
2
  "name": "is-what",
3
3
  "sideEffects": false,
4
4
  "type": "module",
5
- "version": "4.1.6",
5
+ "version": "4.1.8",
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",
@@ -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.45.0",
63
+ "@typescript-eslint/parser": "^5.45.0",
64
+ "del-cli": "^5.0.0",
65
+ "eslint": "^8.28.0",
66
+ "eslint-config-prettier": "^8.5.0",
67
67
  "eslint-plugin-tree-shaking": "^1.10.0",
68
- "np": "^7.6.0",
69
- "prettier": "^2.5.1",
70
- "rollup": "^2.66.0",
71
- "rollup-plugin-typescript2": "^0.31.1",
72
- "typescript": "^4.5.5",
73
- "vitest": "^0.2.1"
68
+ "np": "^7.6.2",
69
+ "prettier": "^2.8.0",
70
+ "rollup": "^3.5.0",
71
+ "rollup-plugin-typescript2": "^0.34.1",
72
+ "typescript": "^4.9.3",
73
+ "vitest": "^0.25.3"
74
74
  },
75
75
  "ava": {
76
76
  "extensions": {