@hypernym/utils 2.2.0 → 3.0.0

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/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Ivo Dolenc, Hypernym Studio
3
+ Copyright (c) 2024 Ivo Dolenc, Hypernym Studio
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -26,11 +26,13 @@ import type { IsAny, RequiredDeep, ... } from '@hypernym/utils'
26
26
 
27
27
  ## Community
28
28
 
29
- Feel free to use the official [discussions](https://github.com/hypernym-studio/utils/discussions) for any additional questions.
29
+ Feel free to ask questions or share new ideas.
30
+
31
+ Use the official [discussions](https://github.com/hypernym-studio/utils/discussions) to get involved.
30
32
 
31
33
  ## License
32
34
 
33
- Developed in 🇭🇷 Croatia
35
+ Developed in 🇭🇷 Croatia.
34
36
 
35
37
  Released under the [MIT](LICENSE.txt) license.
36
38
 
package/dist/index.mjs CHANGED
@@ -8,8 +8,8 @@ const isUndefined = (v) => typeof v === "undefined";
8
8
  const isString = (v) => typeof v === "string";
9
9
  const isStringEmpty = (v) => isString(v) && v.trim().length === 0;
10
10
  const isBoolean = (v) => typeof v === "boolean";
11
- const isFalse = (v) => v === false;
12
11
  const isTrue = (v) => v === true;
12
+ const isFalse = (v) => v === false;
13
13
  const isNumber = (v) => typeof v === "number" && !isNaN(v);
14
14
  const isArray = (v) => Array.isArray(v);
15
15
  const isArrayEmpty = (v) => isArray(v) && v.length === 0;
@@ -19,7 +19,9 @@ const isFunction = (v) => v instanceof Function;
19
19
  const isNaNValue = (v) => typeof v === "number" && isNaN(v);
20
20
  const isRegExp = (v) => v instanceof RegExp;
21
21
  const isMap = (v) => v instanceof Map;
22
+ const isWeakMap = (v) => v instanceof WeakMap;
22
23
  const isSet = (v) => v instanceof Set;
24
+ const isWeakSet = (v) => v instanceof WeakSet;
23
25
  const isSymbol = (v) => toString(v) === "Symbol";
24
26
  const isDate = (v) => v instanceof Date && !isNaN(v.valueOf());
25
27
  const isBigint = (v) => typeof v === "bigint";
@@ -35,4 +37,4 @@ const isNodeListEmpty = (v) => isNodeList(v) && v.length === 0;
35
37
  const isHtmlCollection = (v) => v instanceof HTMLCollection;
36
38
  const isHtmlCollectionEmpty = (v) => isHtmlCollection(v) && v.length === 0;
37
39
 
38
- export { isArray, isArrayEmpty, isBigint, isBoolean, isBrowser, isDate, isElement, isError, isFalse, isFunction, isHtmlCollection, isHtmlCollectionEmpty, isHtmlElement, isInfinity, isMap, isNaNValue, isNodeList, isNodeListEmpty, isNull, isNumber, isObject, isObjectEmpty, isPrimitive, isRegExp, isSet, isString, isStringEmpty, isSvgElement, isSymbol, isTrue, isURL, isUndefined, noop, toString };
40
+ export { isArray, isArrayEmpty, isBigint, isBoolean, isBrowser, isDate, isElement, isError, isFalse, isFunction, isHtmlCollection, isHtmlCollectionEmpty, isHtmlElement, isInfinity, isMap, isNaNValue, isNodeList, isNodeListEmpty, isNull, isNumber, isObject, isObjectEmpty, isPrimitive, isRegExp, isSet, isString, isStringEmpty, isSvgElement, isSymbol, isTrue, isURL, isUndefined, isWeakMap, isWeakSet, noop, toString };
@@ -6,14 +6,8 @@ import { writeFile as writeFile$1 } from 'node:fs/promises';
6
6
  * @example
7
7
  *
8
8
  * ```ts
9
- * // New import
10
9
  * import { exists } from '@hypernym/utils/fs'
11
10
  * ```
12
- *
13
- * ```ts
14
- * // Deprecated import
15
- * import { exists } from '@hypernym/utils/node'
16
- * ```
17
11
  */
18
12
  declare function exists(path: string): Promise<boolean>;
19
13
 
@@ -40,14 +40,14 @@ declare const isStringEmpty: (v: any) => v is string;
40
40
  * Returns a boolean if the given value is a `boolean`.
41
41
  */
42
42
  declare const isBoolean: (v: any) => v is boolean;
43
- /**
44
- * Returns a boolean if the given value is a `false`.
45
- */
46
- declare const isFalse: (v: any) => v is false;
47
43
  /**
48
44
  * Returns a boolean if the given value is a `true`.
49
45
  */
50
46
  declare const isTrue: (v: any) => v is true;
47
+ /**
48
+ * Returns a boolean if the given value is a `false`.
49
+ */
50
+ declare const isFalse: (v: any) => v is false;
51
51
  /**
52
52
  * Returns a boolean if the given value is a `number`.
53
53
  */
@@ -81,13 +81,21 @@ declare const isNaNValue: (v: any) => v is number;
81
81
  */
82
82
  declare const isRegExp: (v: any) => v is RegExp;
83
83
  /**
84
- * Returns a boolean if the given value is a `map`.
84
+ * Returns a boolean if the given value is a `Map`.
85
85
  */
86
86
  declare const isMap: (v: any) => v is Map<any, any>;
87
87
  /**
88
- * Returns a boolean if the given value is a `set`.
88
+ * Returns a boolean if the given value is a `WeakMap`.
89
+ */
90
+ declare const isWeakMap: (v: any) => v is WeakMap<any, any>;
91
+ /**
92
+ * Returns a boolean if the given value is a `Set`.
89
93
  */
90
94
  declare const isSet: (v: any) => v is Set<any>;
95
+ /**
96
+ * Returns a boolean if the given value is a `WeakSet`.
97
+ */
98
+ declare const isWeakSet: (v: any) => v is WeakSet<any>;
91
99
  /**
92
100
  * Returns a boolean if the given value is a `symbol`.
93
101
  */
@@ -202,4 +210,4 @@ type RequiredObjectDeep<T extends object, Options extends RequiredOptions = {
202
210
  [K in keyof T]-?: RequiredDeep<T[K], Options>;
203
211
  };
204
212
 
205
- export { type BuiltIn, type IsAny, type IsNever, type IsNull, type PartialDeep, type Primitive, type RequiredDeep, isArray, isArrayEmpty, isBigint, isBoolean, isBrowser, isDate, isElement, isError, isFalse, isFunction, isHtmlCollection, isHtmlCollectionEmpty, isHtmlElement, isInfinity, isMap, isNaNValue, isNodeList, isNodeListEmpty, isNull, isNumber, isObject, isObjectEmpty, isPrimitive, isRegExp, isSet, isString, isStringEmpty, isSvgElement, isSymbol, isTrue, isURL, isUndefined, noop, toString };
213
+ export { type BuiltIn, type IsAny, type IsNever, type IsNull, type PartialDeep, type Primitive, type RequiredDeep, isArray, isArrayEmpty, isBigint, isBoolean, isBrowser, isDate, isElement, isError, isFalse, isFunction, isHtmlCollection, isHtmlCollectionEmpty, isHtmlElement, isInfinity, isMap, isNaNValue, isNodeList, isNodeListEmpty, isNull, isNumber, isObject, isObjectEmpty, isPrimitive, isRegExp, isSet, isString, isStringEmpty, isSvgElement, isSymbol, isTrue, isURL, isUndefined, isWeakMap, isWeakSet, noop, toString };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypernym/utils",
3
- "version": "2.2.0",
3
+ "version": "3.0.0",
4
4
  "author": "Hypernym Studio",
5
5
  "description": "A collection of reusable utilities.",
6
6
  "license": "MIT",
@@ -16,10 +16,6 @@
16
16
  "./fs": {
17
17
  "types": "./dist/types/fs/index.d.ts",
18
18
  "import": "./dist/fs/index.mjs"
19
- },
20
- "./node": {
21
- "types": "./dist/types/fs/index.d.ts",
22
- "import": "./dist/fs/index.mjs"
23
19
  }
24
20
  },
25
21
  "files": [
@@ -31,6 +27,7 @@
31
27
  "collection",
32
28
  "utilities",
33
29
  "helpers",
30
+ "shared",
34
31
  "utils",
35
32
  "types",
36
33
  "kit",
@@ -38,24 +35,40 @@
38
35
  "ts"
39
36
  ],
40
37
  "scripts": {
41
- "dev": "vite playgrounds/client",
38
+ "dev:browser": "vite playgrounds/browser",
42
39
  "dev:node": "vite-node -w playgrounds/node/main.ts",
43
40
  "build": "hyperbundler",
44
41
  "test:types": "vitest -c .config/vitest.config.ts --typecheck.only",
45
- "lint": "ESLINT_USE_FLAT_CONFIG=true eslint -c .config/eslint.config.js .",
46
- "lint:fix": "ESLINT_USE_FLAT_CONFIG=true eslint -c .config/eslint.config.js --fix .",
42
+ "lint": "eslint -c .config/eslint.config.js .",
43
+ "lint:fix": "eslint -c .config/eslint.config.js --fix .",
47
44
  "format": "prettier --config .config/prettier.config.js --write .",
48
45
  "prepublishOnly": "npm run build"
49
46
  },
47
+ "sideEffects": false,
48
+ "engines": {
49
+ "node": ">=20.0.0"
50
+ },
51
+ "peerDependencies": {
52
+ "@types/node": ">=20.0.0",
53
+ "typescript": ">=5.0.0"
54
+ },
55
+ "peerDependenciesMeta": {
56
+ "@types/node": {
57
+ "optional": true
58
+ },
59
+ "typescript": {
60
+ "optional": true
61
+ }
62
+ },
50
63
  "devDependencies": {
51
- "@hypernym/bundler": "^0.6.3",
52
- "@hypernym/eslint-config": "^2.0.3",
53
- "@hypernym/prettier-config": "^2.0.3",
54
- "@hypernym/tsconfig": "^1.1.0",
55
- "@types/node": "^20.10.5",
56
- "eslint": "^8.56.0",
57
- "prettier": "^3.1.1",
58
- "typescript": "^5.3.3",
59
- "vitest": "^1.1.0"
64
+ "@hypernym/bundler": "^0.8.1",
65
+ "@hypernym/eslint-config": "^3.0.0",
66
+ "@hypernym/prettier-config": "^3.0.0",
67
+ "@hypernym/tsconfig": "^2.0.0",
68
+ "@types/node": "^20.12.7",
69
+ "eslint": "^9.0.0",
70
+ "prettier": "^3.2.5",
71
+ "typescript": "^5.4.4",
72
+ "vitest": "^1.4.0"
60
73
  }
61
74
  }