@vope/utils 1.4.6 → 1.4.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/cjs/index.js CHANGED
@@ -42,6 +42,7 @@ __export(src_exports, {
42
42
  inputRegex: () => inputRegex,
43
43
  isClass: () => isClass,
44
44
  isEmpty: () => isEmpty,
45
+ isKey: () => isKey,
45
46
  isNull: () => isNull,
46
47
  joinPaths: () => joinPaths,
47
48
  loadImage: () => loadImage,
@@ -288,6 +289,9 @@ var isNull = (value) => value === void 0 || value === null;
288
289
  // src/is/empty.ts
289
290
  var isEmpty = (value) => isNull(value) || value === "";
290
291
 
292
+ // src/is/key.ts
293
+ var isKey = (key, data) => key in data;
294
+
291
295
  // src/load/image.ts
292
296
  var loadImage = (src) => {
293
297
  return new Promise((resolve) => {
package/lib/index.js CHANGED
@@ -10,6 +10,7 @@ import { getEncoding } from "./encoding";
10
10
  import { inputRegex } from "./input-regex";
11
11
  import { isClass } from "./is/class";
12
12
  import { isEmpty } from "./is/empty";
13
+ import { isKey } from "./is/key";
13
14
  import { isNull } from "./is/null";
14
15
  import { loadImage } from "./load/image";
15
16
  import { MemoryBasic } from "./memory/basic";
@@ -48,6 +49,7 @@ export {
48
49
  inputRegex,
49
50
  isClass,
50
51
  isEmpty,
52
+ isKey,
51
53
  isNull,
52
54
  joinPaths,
53
55
  loadImage,
package/lib/is/key.js ADDED
@@ -0,0 +1,4 @@
1
+ const isKey = (key, data) => key in data;
2
+ export {
3
+ isKey
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vope/utils",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -8,6 +8,7 @@
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "types": "./types/index.d.ts",
11
+ "typings": "./types/index.d.ts",
11
12
  "module": "./lib/index.js",
12
13
  "main": "./cjs/index.js",
13
14
  "scripts": {
package/types/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export { getEncoding } from './encoding';
10
10
  export { inputRegex } from './input-regex';
11
11
  export { isClass } from './is/class';
12
12
  export { isEmpty } from './is/empty';
13
+ export { isKey } from './is/key';
13
14
  export { isNull } from './is/null';
14
15
  export { loadImage } from './load/image';
15
16
  export { MemoryBasic } from './memory/basic';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 检测key是否为对象的属性
3
+ */
4
+ export declare const isKey: <T extends object>(key: string, data: T) => key is Extract<keyof T, string>;