Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@acrool/js-utils

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@acrool/js-utils - npm Package Compare versions

Comparing version 3.2.10 to 3.2.11-alpha.0

10

array/array.d.ts

@@ -119,5 +119,11 @@ import { SortOrder, TSortByFn, TGroupTreeBy, TGroupByFn, TArrayOrEmpty } from './types';

/**
* 取得陣列第一筆資料
* arraySplit(['a','b','c']);
* > a
*/
export declare function arrayFirst<T>(array?: T[]): T | undefined;
/**
* 分割陣列
*
* splitArray([1,2,3,4,5], 2)
* arraySplit([1,2,3,4,5], 2)
* > [[1,2], [3,4], [5]]

@@ -128,3 +134,3 @@ *

*/
export declare function splitArray<T, A extends TArrayOrEmpty<T>>(arrayData: A, splitCount: number): A | T[][];
export declare function arraySplit<T, A extends TArrayOrEmpty<T>>(arrayData: A, splitCount: number): A | T[][];
/**

@@ -131,0 +137,0 @@ * GroupBy

2

array/index.cjs.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function s(n,e){return n?[e].concat(n.slice(0)):[e]}function p(n,e){return n?n.slice(0).concat(e):[e]}function l(n,e,r){return n?[...n.slice(0,e),r,...n.slice(e)]:[r]}function g(n,e,r){if(!n||e===r)return n;const t=[...n],u=t[e];return t.splice(e,1),t.splice(r,0,u),t}function d(n,e){if(!n)return n;const r=n.findIndex(e);return r===-1?n:i(n,r)}function h(n,e){if(!n)return n;const r=n.findIndex(e.finder);return r===-1?n:c(n,r,e.updater)}function i(n,e){return!n||e===-1||e>n.length-1?n:[...n.slice(0,e),...n.slice(e+1)]}function c(n,e,r){if(e===-1||!n||e>n.length-1)return n;const t={...n[e]};r(t);const u=[...n];return u[e]=t,u}function m(n,e){if(!n)return n;const r=new Set,t=new Array;for(const u of n){const o=e?e(u):u;r.has(o)||(r.add(o),t.push(u))}return t}function A(n,e){return n?n.join(e):""}function B(n,e){if(!n)return n;const r=Math.ceil(n.length/e);return new Array(r).fill([]).map((u,o)=>n.slice(o*e,o*e+e))}function w(n,e){return n.reduce((r,t)=>{const u=e(t);return r[u]||(r[u]=[]),r[u].push(t),r},{})}function S(n,e){const r={};return n.forEach(t=>{const{groupKey:u,groupData:o,child:f}=e(t);r[u]||(r[u]={...o,children:[]}),r[u].children.push(f)}),Object.keys(r).map(t=>r[t])}function v(n,e){const r=[...n];return r.sort(e),r}function I(n,e="ASC"){return function(r,t){const u=n(r),o=n(t);return u<o?e==="ASC"?-1:1:u>o?e==="ASC"?1:-1:0}}const b=(n,e="skeleton_")=>Array.from({length:n}).map((r,t)=>`${e}${t}`);exports.arrayJoin=A;exports.generateSortByProperty=I;exports.generatorArray=b;exports.groupBy=w;exports.groupTreeBy=S;exports.insert=l;exports.move=g;exports.pull=s;exports.push=p;exports.removeByIndex=i;exports.removeFind=d;exports.sort=v;exports.splitArray=B;exports.unique=m;exports.updateByIndex=c;exports.updateFind=h;
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function s(n,e){return n?[e].concat(n.slice(0)):[e]}function p(n,e){return n?n.slice(0).concat(e):[e]}function l(n,e,t){return n?[...n.slice(0,e),t,...n.slice(e)]:[t]}function g(n,e,t){if(!n||e===t)return n;const u=[...n],r=u[e];return u.splice(e,1),u.splice(t,0,r),u}function d(n,e){if(!n)return n;const t=n.findIndex(e);return t===-1?n:i(n,t)}function h(n,e){if(!n)return n;const t=n.findIndex(e.finder);return t===-1?n:c(n,t,e.updater)}function i(n,e){return!n||e===-1||e>n.length-1?n:[...n.slice(0,e),...n.slice(e+1)]}function c(n,e,t){if(e===-1||!n||e>n.length-1)return n;const u={...n[e]};t(u);const r=[...n];return r[e]=u,r}function m(n,e){if(!n)return n;const t=new Set,u=new Array;for(const r of n){const o=e?e(r):r;t.has(o)||(t.add(o),u.push(r))}return u}function A(n,e){return n?n.join(e):""}function B(n){return n==null?void 0:n[0]}function S(n,e){if(!n)return n;const t=Math.ceil(n.length/e);return new Array(t).fill([]).map((r,o)=>n.slice(o*e,o*e+e))}function w(n,e){return n.reduce((t,u)=>{const r=e(u);return t[r]||(t[r]=[]),t[r].push(u),t},{})}function v(n,e){const t={};return n.forEach(u=>{const{groupKey:r,groupData:o,child:f}=e(u);t[r]||(t[r]={...o,children:[]}),t[r].children.push(f)}),Object.keys(t).map(u=>t[u])}function F(n,e){const t=[...n];return t.sort(e),t}function I(n,e="ASC"){return function(t,u){const r=n(t),o=n(u);return r<o?e==="ASC"?-1:1:r>o?e==="ASC"?1:-1:0}}const b=(n,e="skeleton_")=>Array.from({length:n}).map((t,u)=>`${e}${u}`);exports.arrayFirst=B;exports.arrayJoin=A;exports.arraySplit=S;exports.generateSortByProperty=I;exports.generatorArray=b;exports.groupBy=w;exports.groupTreeBy=v;exports.insert=l;exports.move=g;exports.pull=s;exports.push=p;exports.removeByIndex=i;exports.removeFind=d;exports.sort=F;exports.unique=m;exports.updateByIndex=c;exports.updateFind=h;

@@ -20,3 +20,3 @@ function s(n, e) {

const u = n.findIndex(e);
return u === -1 ? n : i(n, u);
return u === -1 ? n : r(n, u);
}

@@ -29,3 +29,3 @@ function m(n, e) {

}
function i(n, e) {
function r(n, e) {
return !n || e === -1 || e > n.length - 1 ? n : [...n.slice(0, e), ...n.slice(e + 1)];

@@ -46,4 +46,4 @@ }

for (const o of n) {
const r = e ? e(o) : o;
u.has(r) || (u.add(r), t.push(o));
const c = e ? e(o) : o;
u.has(c) || (u.add(c), t.push(o));
}

@@ -55,7 +55,10 @@ return t;

}
function d(n, e) {
function d(n) {
return n == null ? void 0 : n[0];
}
function S(n, e) {
if (!n)
return n;
const u = Math.ceil(n.length / e);
return new Array(u).fill([]).map((o, r) => n.slice(r * e, r * e + e));
return new Array(u).fill([]).map((o, c) => n.slice(c * e, c * e + e));
}

@@ -68,29 +71,31 @@ function B(n, e) {

}
function S(n, e) {
function k(n, e) {
const u = {};
return n.forEach((t) => {
const { groupKey: o, groupData: r, child: c } = e(t);
const { groupKey: o, groupData: c, child: i } = e(t);
u[o] || (u[o] = {
...r,
...c,
children: []
}), u[o].children.push(c);
}), u[o].children.push(i);
}), Object.keys(u).map((t) => u[t]);
}
function k(n, e) {
function I(n, e) {
const u = [...n];
return u.sort(e), u;
}
function I(n, e = "ASC") {
function v(n, e = "ASC") {
return function(u, t) {
const o = n(u), r = n(t);
return o < r ? e === "ASC" ? -1 : 1 : o > r ? e === "ASC" ? 1 : -1 : 0;
const o = n(u), c = n(t);
return o < c ? e === "ASC" ? -1 : 1 : o > c ? e === "ASC" ? 1 : -1 : 0;
};
}
const v = (n, e = "skeleton_") => Array.from({ length: n }).map((u, t) => `${e}${t}`);
const F = (n, e = "skeleton_") => Array.from({ length: n }).map((u, t) => `${e}${t}`);
export {
d as arrayFirst,
w as arrayJoin,
I as generateSortByProperty,
v as generatorArray,
S as arraySplit,
v as generateSortByProperty,
F as generatorArray,
B as groupBy,
S as groupTreeBy,
k as groupTreeBy,
p as insert,

@@ -100,6 +105,5 @@ g as move,

l as push,
i as removeByIndex,
r as removeByIndex,
h as removeFind,
k as sort,
d as splitArray,
I as sort,
A as unique,

@@ -106,0 +110,0 @@ f as updateByIndex,

/**
* @Deprecated 計畫與
* 需加上 model-open 樣式
*
* body.modal-open{
* position: fixed;
* top: 0;
* right: 0;
* bottom: 0;
* left: 0;
* overflow: hidden;
* overscroll-behavior-x: contain; // chrome 滑動上一頁下一頁
* overflow: hidden;
* overscroll-behavior-x: contain;
* max-width: 100vw;
* }

@@ -13,0 +9,0 @@ */

{
"name": "@acrool/js-utils",
"version": "3.2.10",
"version": "3.2.11-alpha.0",
"description": "Common javascript utils methods for project development",

@@ -19,4 +19,4 @@ "keywords": [

"dependencies": {
"dayjs": "^1.11.12"
"dayjs": "^1.x"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc