@hypernym/utils 3.4.1 → 3.4.3
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 +1 -1
- package/README.md +31 -17
- package/dist/index.iife.js +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +24 -23
- /package/dist/{types/fs → fs}/index.d.mts +0 -0
- /package/dist/{types/index.d.mts → index.d.mts} +0 -0
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<h1 align="center">
|
|
1
|
+
<h1 align="center">Utils</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">A collection of reusable utilities.</p>
|
|
4
4
|
|
|
@@ -24,28 +24,27 @@
|
|
|
24
24
|
- Fully tree-shakeable
|
|
25
25
|
- No dependencies
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Installation
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
Install `@hypernym/utils` package:
|
|
30
30
|
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// ESM & TS
|
|
36
|
-
import { exists, copy, ... } from '@hypernym/utils/fs'
|
|
31
|
+
```sh
|
|
32
|
+
# via pnpm
|
|
33
|
+
pnpm add @hypernym/utils
|
|
34
|
+
```
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
```sh
|
|
37
|
+
# via npm
|
|
38
|
+
npm install @hypernym/utils
|
|
40
39
|
```
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
### CDN
|
|
43
42
|
|
|
44
43
|
Here are some examples of how to integrate **Hyperutils** from a CDN via a script tag.
|
|
45
44
|
|
|
46
45
|
Also, it is possible to download files manually and serve them accordingly.
|
|
47
46
|
|
|
48
|
-
#### minified
|
|
47
|
+
#### ESM (minified)
|
|
49
48
|
|
|
50
49
|
```html
|
|
51
50
|
<script type="module">
|
|
@@ -53,24 +52,39 @@ Also, it is possible to download files manually and serve them accordingly.
|
|
|
53
52
|
</script>
|
|
54
53
|
```
|
|
55
54
|
|
|
56
|
-
#### minified
|
|
55
|
+
#### IIFE (minified)
|
|
57
56
|
|
|
58
57
|
```html
|
|
59
|
-
<script src="https://unpkg.com/@hypernym/utils/dist/index.
|
|
58
|
+
<script src="https://unpkg.com/@hypernym/utils/dist/index.iife.js"></script>
|
|
60
59
|
<script>
|
|
61
60
|
const { isNull, isString, ... } = Hyperutils
|
|
62
61
|
</script>
|
|
63
62
|
```
|
|
64
63
|
|
|
65
|
-
#### minified
|
|
64
|
+
#### UMD (minified)
|
|
66
65
|
|
|
67
66
|
```html
|
|
68
|
-
<script src="https://unpkg.com/@hypernym/utils/dist/index.umd.
|
|
67
|
+
<script src="https://unpkg.com/@hypernym/utils/dist/index.umd.js"></script>
|
|
69
68
|
<script>
|
|
70
69
|
const { isNull, isString, ... } = Hyperutils
|
|
71
70
|
</script>
|
|
72
71
|
```
|
|
73
72
|
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
After installation, import `Hyperutils` into your project:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
// ESM & TS
|
|
79
|
+
import { isNull, isString, ... } from '@hypernym/utils'
|
|
80
|
+
|
|
81
|
+
// ESM & TS
|
|
82
|
+
import { exists, copy, ... } from '@hypernym/utils/fs'
|
|
83
|
+
|
|
84
|
+
// Types
|
|
85
|
+
import type { IsAny, RequiredDeep, ... } from '@hypernym/utils'
|
|
86
|
+
```
|
|
87
|
+
|
|
74
88
|
## is
|
|
75
89
|
|
|
76
90
|
### isBrowser
|
package/dist/index.iife.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Hyperutils=function(
|
|
1
|
+
var Hyperutils=function(e){"use strict";const g=()=>{},t=i=>Object.prototype.toString.call(i).slice(8,-1),N=typeof window<"u",s=i=>i===null,l=i=>typeof i>"u",n=i=>typeof i=="string",S=i=>n(i)&&i.trim().length===0,a=i=>typeof i=="boolean",b=i=>i===!0,r=i=>i===!1,c=i=>typeof i=="number"&&!isNaN(i),m=i=>Array.isArray(i),d=i=>m(i)&&i.length===0,y=i=>t(i)==="Object",L=i=>y(i)&&Object.keys(i).length===0,H=i=>i instanceof Function,M=i=>typeof i=="number"&&isNaN(i),O=i=>i instanceof RegExp,j=i=>i instanceof Map,k=i=>i instanceof WeakMap,v=i=>i instanceof Set,A=i=>i instanceof WeakSet,o=i=>t(i)==="Symbol",B=i=>i instanceof Date&&!isNaN(i.valueOf()),f=i=>typeof i=="bigint",R=i=>i===1/0||i===-1/0,W=i=>i instanceof URL,h=i=>i instanceof Error,C=i=>n(i)||c(i)||f(i)||a(i)||o(i)||s(i)||l(i),F=i=>i instanceof Element,U=i=>i instanceof HTMLElement,w=i=>i instanceof SVGElement,E=i=>i instanceof NodeList,I=i=>E(i)&&i.length===0,u=i=>i instanceof HTMLCollection,T=i=>u(i)&&i.length===0;return e.isArray=m,e.isArrayEmpty=d,e.isBigInt=f,e.isBoolean=a,e.isBrowser=N,e.isDate=B,e.isElement=F,e.isError=h,e.isFalse=r,e.isFunction=H,e.isHtmlCollection=u,e.isHtmlCollectionEmpty=T,e.isHtmlElement=U,e.isInfinity=R,e.isMap=j,e.isNaNValue=M,e.isNodeList=E,e.isNodeListEmpty=I,e.isNull=s,e.isNumber=c,e.isObject=y,e.isObjectEmpty=L,e.isPrimitive=C,e.isRegExp=O,e.isSet=v,e.isString=n,e.isStringEmpty=S,e.isSvgElement=w,e.isSymbol=o,e.isTrue=b,e.isURL=W,e.isUndefined=l,e.isWeakMap=k,e.isWeakSet=A,e.noop=g,e.toString=t,e}({});
|
package/dist/index.min.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const y=()=>{},i=e=>Object.prototype.toString.call(e).slice(8,-1),g=typeof window<"u",s=e=>e===null,n=e=>typeof e>"u",t=e=>typeof e=="string",E=e=>t(e)&&e.trim().length===0,o=e=>typeof e=="boolean",
|
|
1
|
+
const y=()=>{},i=e=>Object.prototype.toString.call(e).slice(8,-1),g=typeof window<"u",s=e=>e===null,n=e=>typeof e>"u",t=e=>typeof e=="string",E=e=>t(e)&&e.trim().length===0,o=e=>typeof e=="boolean",u=e=>e===!0,N=e=>e===!1,a=e=>typeof e=="number"&&!isNaN(e),l=e=>Array.isArray(e),b=e=>l(e)&&e.length===0,r=e=>i(e)==="Object",S=e=>r(e)&&Object.keys(e).length===0,L=e=>e instanceof Function,d=e=>typeof e=="number"&&isNaN(e),M=e=>e instanceof RegExp,O=e=>e instanceof Map,h=e=>e instanceof WeakMap,j=e=>e instanceof Set,k=e=>e instanceof WeakSet,c=e=>i(e)==="Symbol",H=e=>e instanceof Date&&!isNaN(e.valueOf()),f=e=>typeof e=="bigint",A=e=>e===1/0||e===-1/0,R=e=>e instanceof URL,W=e=>e instanceof Error,v=e=>t(e)||a(e)||f(e)||o(e)||c(e)||s(e)||n(e),w=e=>e instanceof Element,x=e=>e instanceof HTMLElement,B=e=>e instanceof SVGElement,p=e=>e instanceof NodeList,C=e=>p(e)&&e.length===0,m=e=>e instanceof HTMLCollection,F=e=>m(e)&&e.length===0;export{l as isArray,b as isArrayEmpty,f as isBigInt,o as isBoolean,g as isBrowser,H as isDate,w as isElement,W as isError,N as isFalse,L as isFunction,m as isHtmlCollection,F as isHtmlCollectionEmpty,x as isHtmlElement,A as isInfinity,O as isMap,d as isNaNValue,p as isNodeList,C as isNodeListEmpty,s as isNull,a as isNumber,r as isObject,S as isObjectEmpty,v as isPrimitive,M as isRegExp,j as isSet,t as isString,E as isStringEmpty,B as isSvgElement,c as isSymbol,u as isTrue,R as isURL,n as isUndefined,h as isWeakMap,k as isWeakSet,y as noop,i as toString};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.Hyperutils={}))})(this,function(e){"use strict";const t=()=>{},n=i=>Object.prototype.toString.call(i).slice(8,-1),d=typeof window<"u",l=i=>i===null,a=i=>typeof i>"u",s=i=>typeof i=="string",N=i=>s(i)&&i.trim().length===0,o=i=>typeof i=="boolean",S=i=>i===!0,b=i=>i===!1,f=i=>typeof i=="number"&&!isNaN(i),m=i=>Array.isArray(i),r=i=>m(i)&&i.length===0,c=i=>n(i)==="Object",L=i=>c(i)&&Object.keys(i).length===0,H=i=>i instanceof Function,h=i=>typeof i=="number"&&isNaN(i),j=i=>i instanceof RegExp,M=i=>i instanceof Map,O=i=>i instanceof WeakMap,k=i=>i instanceof Set,A=i=>i instanceof WeakSet,y=i=>n(i)==="Symbol",B=i=>i instanceof Date&&!isNaN(i.valueOf()),u=i=>typeof i=="bigint",R=i=>i===1/0||i===-1/0,T=i=>i instanceof URL,W=i=>i instanceof Error,v=i=>s(i)||f(i)||u(i)||o(i)||y(i)||l(i)||a(i),C=i=>i instanceof Element,F=i=>i instanceof HTMLElement,U=i=>i instanceof SVGElement,E=i=>i instanceof NodeList,w=i=>E(i)&&i.length===0,g=i=>i instanceof HTMLCollection,I=i=>g(i)&&i.length===0;e.isArray=m,e.isArrayEmpty=r,e.isBigInt=u,e.isBoolean=o,e.isBrowser=d,e.isDate=B,e.isElement=C,e.isError=W,e.isFalse=b,e.isFunction=H,e.isHtmlCollection=g,e.isHtmlCollectionEmpty=I,e.isHtmlElement=F,e.isInfinity=R,e.isMap=M,e.isNaNValue=h,e.isNodeList=E,e.isNodeListEmpty=w,e.isNull=l,e.isNumber=f,e.isObject=c,e.isObjectEmpty=L,e.isPrimitive=v,e.isRegExp=j,e.isSet=k,e.isString=s,e.isStringEmpty=N,e.isSvgElement=U,e.isSymbol=y,e.isTrue=S,e.isURL=T,e.isUndefined=a,e.isWeakMap=O,e.isWeakSet=A,e.noop=t,e.toString=n});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypernym/utils",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.3",
|
|
4
4
|
"author": "Hypernym Studio",
|
|
5
5
|
"description": "A collection of reusable utilities.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"types": "./dist/
|
|
13
|
+
"types": "./dist/index.d.mts",
|
|
14
14
|
"import": "./dist/index.mjs"
|
|
15
15
|
},
|
|
16
16
|
"./fs": {
|
|
17
|
-
"types": "./dist/
|
|
17
|
+
"types": "./dist/fs/index.d.mts",
|
|
18
18
|
"import": "./dist/fs/index.mjs"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
@@ -34,7 +34,17 @@
|
|
|
34
34
|
"js",
|
|
35
35
|
"ts"
|
|
36
36
|
],
|
|
37
|
-
"
|
|
37
|
+
"scripts": {
|
|
38
|
+
"dev:browser": "vite playgrounds/browser",
|
|
39
|
+
"dev:server": "bun --watch playgrounds/server/main.ts",
|
|
40
|
+
"build": "hyperbundler",
|
|
41
|
+
"test": "vitest -c test/vitest.config.ts",
|
|
42
|
+
"lint": "eslint .",
|
|
43
|
+
"lint:fix": "eslint --fix .",
|
|
44
|
+
"format": "prettier --write .",
|
|
45
|
+
"prepublishOnly": "npm run build"
|
|
46
|
+
},
|
|
47
|
+
"packageManager": "pnpm@10.5.0",
|
|
38
48
|
"engines": {
|
|
39
49
|
"node": ">=20.0.0",
|
|
40
50
|
"pnpm": ">=9.0.0"
|
|
@@ -52,23 +62,14 @@
|
|
|
52
62
|
}
|
|
53
63
|
},
|
|
54
64
|
"devDependencies": {
|
|
55
|
-
"@hypernym/bundler": "^0.14.
|
|
56
|
-
"@hypernym/eslint-config": "^3.5.
|
|
57
|
-
"@hypernym/prettier-config": "^3.2.
|
|
58
|
-
"@hypernym/tsconfig": "^2.
|
|
59
|
-
"@types/node": "^22.
|
|
60
|
-
"eslint": "^9.
|
|
61
|
-
"prettier": "^3.
|
|
62
|
-
"typescript": "^5.
|
|
63
|
-
"vitest": "^
|
|
64
|
-
},
|
|
65
|
-
"scripts": {
|
|
66
|
-
"dev:browser": "vite playgrounds/browser",
|
|
67
|
-
"dev:server": "bun --watch playgrounds/server/main.ts",
|
|
68
|
-
"build": "hyperbundler",
|
|
69
|
-
"test:types": "vitest --typecheck.only",
|
|
70
|
-
"lint": "eslint .",
|
|
71
|
-
"lint:fix": "eslint --fix .",
|
|
72
|
-
"format": "prettier --write ."
|
|
65
|
+
"@hypernym/bundler": "^0.14.3",
|
|
66
|
+
"@hypernym/eslint-config": "^3.5.7",
|
|
67
|
+
"@hypernym/prettier-config": "^3.2.3",
|
|
68
|
+
"@hypernym/tsconfig": "^2.6.0",
|
|
69
|
+
"@types/node": "^22.13.5",
|
|
70
|
+
"eslint": "^9.21.0",
|
|
71
|
+
"prettier": "^3.5.2",
|
|
72
|
+
"typescript": "^5.7.3",
|
|
73
|
+
"vitest": "^3.0.7"
|
|
73
74
|
}
|
|
74
|
-
}
|
|
75
|
+
}
|
|
File without changes
|
|
File without changes
|