@emohk/utils 1.0.0 → 1.0.2
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 +21 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -10,6 +10,27 @@ npm install @emohk/utils
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
+
ESM
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { checkStringPresent, checkObject, hasValues, chunk } from '@emohk/utils'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
CommonJS
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
const { checkStringPresent, checkObject, hasValues, chunk } = require('@emohk/utils')
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Example
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
checkStringPresent('hello world') // true
|
|
29
|
+
checkObject({}) // true
|
|
30
|
+
hasValues([1, 2, 3]) // true
|
|
31
|
+
chunk([1, 2, 3, 4, 5, 6], 2) // [[1, 2], [3, 4], [5, 6]]
|
|
32
|
+
```
|
|
33
|
+
|
|
13
34
|
Go to the [API documentation](https://github.com/emocreation/js-utils/blob/main/docs/API.md) for more information.
|
|
14
35
|
|
|
15
36
|
## Development
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var{defineProperty:E,getOwnPropertyNames:G,getOwnPropertyDescriptor:H}=Object,I=Object.prototype.hasOwnProperty;var
|
|
1
|
+
var{defineProperty:E,getOwnPropertyNames:G,getOwnPropertyDescriptor:H}=Object,I=Object.prototype.hasOwnProperty;function J(q){return this[q]}var K=(q)=>{var B=(F??=new WeakMap).get(q),C;if(B)return B;if(B=E({},"__esModule",{value:!0}),q&&typeof q==="object"||typeof q==="function"){for(var D of G(q))if(!I.call(B,D))E(B,D,{get:J.bind(q,D),enumerable:!(C=H(q,D))||C.enumerable})}return F.set(q,B),B},F;var L=(q)=>q;function M(q,B){this[q]=L.bind(null,B)}var N=(q,B)=>{for(var C in B)E(q,C,{get:B[C],enumerable:!0,configurable:!0,set:M.bind(B,C)})};var U={};N(U,{hasValues:()=>Q,chunk:()=>R,checkStringPresent:()=>O,checkObject:()=>P});module.exports=K(U);var O=(q)=>typeof q==="string"&&q.trim().length>0,P=(q)=>typeof q==="object"&&q!==null&&!Array.isArray(q),Q=(q)=>Array.isArray(q)&&q.length>0,R=(q,B)=>Array.from({length:Math.ceil(q.length/B)},(C,D)=>q.slice(D*B,D*B+B));
|
package/dist/index.d.ts
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const checkStringPresent: (value: any) => value is string;
|
|
15
15
|
/**
|
|
16
|
-
* Checks if a value is
|
|
16
|
+
* Checks if a value is an object (not null, not array).
|
|
17
17
|
* @param object - The value to check
|
|
18
|
-
* @returns True if the value is
|
|
18
|
+
* @returns True if the value is an object, false otherwise
|
|
19
19
|
* @example
|
|
20
20
|
* ```ts
|
|
21
21
|
* checkObject({}) // true
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var E=(q)=>typeof q==="string"&&q.trim().length>0,F=(q)=>typeof q==="object"&&q!==null&&!Array.isArray(q)
|
|
1
|
+
var E=(q)=>typeof q==="string"&&q.trim().length>0,F=(q)=>typeof q==="object"&&q!==null&&!Array.isArray(q),G=(q)=>Array.isArray(q)&&q.length>0,H=(q,B)=>Array.from({length:Math.ceil(q.length/B)},(D,C)=>q.slice(C*B,C*B+B));export{G as hasValues,H as chunk,E as checkStringPresent,F as checkObject};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emohk/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A collection of utility functions for various projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -20,12 +20,13 @@
|
|
|
20
20
|
],
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "https://github.com/emocreation/js-utils.git"
|
|
23
|
+
"url": "git+https://github.com/emocreation/js-utils.git"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/bun": "latest",
|
|
27
|
-
"
|
|
28
|
-
"typedoc
|
|
27
|
+
"prettier": "^3.8.1",
|
|
28
|
+
"typedoc": "^0.28.17",
|
|
29
|
+
"typedoc-plugin-markdown": "^4.10.0"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"typescript": "^5.9.3"
|