@js-utils-kit/array 0.1.0 → 0.2.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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- function e(e,t=1){if(t<=0)throw RangeError(`chunk size must be greater than 0`);return Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,r*t+t))}function t(e){return e.filter(e=>!!e&&!Number.isNaN(e))}function n(e){return e.at(-1)}function r(e,{sort:t=!1,compareFn:n}={}){let r=[...new Set(e)];return t?n?r.sort(n):r.sort():r}exports.chunk=e,exports.compact=t,exports.lastElement=n,exports.unique=r;var i=require(`@js-utils-kit/types`);Object.keys(i).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return i[e]}})});
1
+ function e(e,t=1){if(t<=0)throw RangeError(`chunk size must be greater than 0`);return Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,r*t+t))}function t(e){return e.filter(e=>!!e&&!Number.isNaN(e))}function n(e){return e.at(-1)}function r(e,{sort:t=!1,compareFn:n}={}){let r=[...new Set(e)];return t?n?r.sort(n):r.sort():r}exports.chunk=e,exports.compact=t,exports.lastElement=n,exports.unique=r;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { Falsy } from "@js-utils-kit/types";
2
- export * from "@js-utils-kit/types";
3
2
 
4
3
  //#region src/chunk.d.ts
5
-
6
4
  /**
7
5
  * Splits an array into chunks of a specified size.
8
6
  *
@@ -48,6 +46,7 @@ declare function compact<T>(
48
46
  /**
49
47
  * A list of elements to compact
50
48
  */
49
+
51
50
  array: readonly T[]): Exclude<T, Falsy>[];
52
51
  //#endregion
53
52
  //#region src/lastElement.d.ts
@@ -67,6 +66,7 @@ declare function lastElement<T>(
67
66
  /**
68
67
  * A list of elements.
69
68
  */
69
+
70
70
  array: readonly T[]): T | undefined;
71
71
  //#endregion
72
72
  //#region src/unique.d.ts
@@ -104,6 +104,7 @@ declare function unique<T>(
104
104
  /**
105
105
  * The source array.
106
106
  */
107
+
107
108
  array: readonly T[], {
108
109
  sort,
109
110
  compareFn
package/dist/index.d.mts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { Falsy } from "@js-utils-kit/types";
2
- export * from "@js-utils-kit/types";
3
2
 
4
3
  //#region src/chunk.d.ts
5
-
6
4
  /**
7
5
  * Splits an array into chunks of a specified size.
8
6
  *
@@ -48,6 +46,7 @@ declare function compact<T>(
48
46
  /**
49
47
  * A list of elements to compact
50
48
  */
49
+
51
50
  array: readonly T[]): Exclude<T, Falsy>[];
52
51
  //#endregion
53
52
  //#region src/lastElement.d.ts
@@ -67,6 +66,7 @@ declare function lastElement<T>(
67
66
  /**
68
67
  * A list of elements.
69
68
  */
69
+
70
70
  array: readonly T[]): T | undefined;
71
71
  //#endregion
72
72
  //#region src/unique.d.ts
@@ -104,6 +104,7 @@ declare function unique<T>(
104
104
  /**
105
105
  * The source array.
106
106
  */
107
+
107
108
  array: readonly T[], {
108
109
  sort,
109
110
  compareFn
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export*from"@js-utils-kit/types";function e(e,t=1){if(t<=0)throw RangeError(`chunk size must be greater than 0`);return Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,r*t+t))}function t(e){return e.filter(e=>!!e&&!Number.isNaN(e))}function n(e){return e.at(-1)}function r(e,{sort:t=!1,compareFn:n}={}){let r=[...new Set(e)];return t?n?r.sort(n):r.sort():r}export{e as chunk,t as compact,n as lastElement,r as unique};
1
+ function e(e,t=1){if(t<=0)throw RangeError(`chunk size must be greater than 0`);return Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,r*t+t))}function t(e){return e.filter(e=>!!e&&!Number.isNaN(e))}function n(e){return e.at(-1)}function r(e,{sort:t=!1,compareFn:n}={}){let r=[...new Set(e)];return t?n?r.sort(n):r.sort():r}export{e as chunk,t as compact,n as lastElement,r as unique};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@js-utils-kit/array",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Array utilities",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@js-utils-kit/types": "1.1.0"
38
+ "@js-utils-kit/types": "1.2.0"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsdown",