qsu 1.6.2 → 1.6.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 +1 -1
- package/README.md +14 -5
- package/dist/object.d.ts +3 -1
- package/dist/object.js +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2021-
|
|
3
|
+
Copyright (c) 2021-2025 CDGet <jooy2.contact@gmail.com> (https://cdget.com).
|
|
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,8 +1,8 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
# Qsu: Quick & Simple Utility for Node.js
|
|
4
4
|
|
|
5
|
-
[](https://github.com/jooy2/qsu/blob/
|
|
5
|
+
[](https://github.com/jooy2/qsu/blob/main/LICENSE)   [](https://www.npmjs.com/package/qsu) [](https://www.npmjs.com/package/qsu)    [](https://github.com/jooy2) 
|
|
6
6
|
|
|
7
7
|
**Qsu** is an underscore-based utility library optimized for the **[Node.js](https://nodejs.org)** development environment. It is supported in one module without the need to separately write frequently used methods for each project.
|
|
8
8
|
|
|
@@ -15,10 +15,19 @@
|
|
|
15
15
|
|
|
16
16
|
Installing and using the package and defining all the utility methods can be found on the documentation page below: https://qsu.cdget.com/getting-started/installation-javascript
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Family Packages
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
As a family package of `qsu`, it can be installed and used independently of the `qsu` package.
|
|
21
|
+
|
|
22
|
+
- **[qsu-fs](https://github.com/jooy2/qsu-fs)**: File listing and management utilities
|
|
23
|
+
- **[qsu-web](https://github.com/jooy2/qsu-web)**: Utilities for website front-end & back-end services
|
|
24
|
+
|
|
25
|
+
In addition, `qsu` is also available for the Dart language: https://github.com/jooy2/qsu-dart
|
|
26
|
+
|
|
27
|
+
## Contributing
|
|
28
|
+
|
|
29
|
+
Anyone can contribute to the project by reporting new issues or submitting a pull request. For more information, please see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
21
30
|
|
|
22
31
|
## License
|
|
23
32
|
|
|
24
|
-
|
|
33
|
+
Please see the [LICENSE](LICENSE) file for more information about project owners, usage rights, and more.
|
package/dist/object.d.ts
CHANGED
|
@@ -6,4 +6,6 @@ export declare function objToArray(obj: AnyValueObject, recursive?: boolean): an
|
|
|
6
6
|
export declare function objTo1d(obj: AnyValueObject, separator?: string): AnyValueObject;
|
|
7
7
|
export declare function objDeleteKeyByValue(obj: AnyValueObject, searchValue: string | number | null | undefined, recursive?: boolean): AnyValueObject | null;
|
|
8
8
|
export declare function objUpdate(obj: AnyValueObject, key: string, value: any, recursive?: boolean, upsert?: boolean): AnyValueObject | null;
|
|
9
|
-
export declare function objMergeNewKey(obj: AnyValueObject, obj2: AnyValueObject
|
|
9
|
+
export declare function objMergeNewKey(obj: AnyValueObject, obj2: AnyValueObject, options?: {
|
|
10
|
+
arrayAction?: 'original' | 'replace' | 'append';
|
|
11
|
+
}): AnyValueObject | null;
|
package/dist/object.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isEmpty as e,isObject as t}from"./verify.js";export function objToQueryString(e){return Object.keys(e).map((t=>{let r=e[t];return"object"==typeof r&&(r=JSON.stringify(r)),`${encodeURIComponent(t)}=${encodeURIComponent(r)}`})).join("&")}export function objFindItemRecursiveByKey(t,r,n,o){const c=t=>{let s;s="object"==typeof t&&Array.isArray(t)?t:[t];for(let t=0,l=s.length;t<l;t+=1){if(s[t][r]===n)return s[t];if(!e(s[t][o])){const e=c(s[t][o]);if(e)return e}}return null};return c(t)}export function objToPrettyStr(e){return JSON.stringify(e,null,"\t")}export function objToArray(e,r=!1){const n=e=>{const o=[],c=Object.keys(e).length;for(let s=0;s<c;s+=1){const c=Object.keys(e)[s];r&&t(e[c])?o.push([c,n(e[c])]):o.push([c,e[c]])}return o};return n(e)}export function objTo1d(e,r="."){if(!r||r.length<1)throw new Error("`separator` must have value at least 1 character.");const n=(e,o="")=>{let c={};const s=Object.keys(e).length,l=o.length<1;for(let u=0;u<s;u+=1){const s=Object.keys(e)[u],y=e[s],
|
|
1
|
+
import{isEmpty as e,isObject as t}from"./verify.js";export function objToQueryString(e){return Object.keys(e).map((t=>{let r=e[t];return"object"==typeof r&&(r=JSON.stringify(r)),`${encodeURIComponent(t)}=${encodeURIComponent(r)}`})).join("&")}export function objFindItemRecursiveByKey(t,r,n,o){const c=t=>{let s;s="object"==typeof t&&Array.isArray(t)?t:[t];for(let t=0,l=s.length;t<l;t+=1){if(s[t][r]===n)return s[t];if(!e(s[t][o])){const e=c(s[t][o]);if(e)return e}}return null};return c(t)}export function objToPrettyStr(e){return JSON.stringify(e,null,"\t")}export function objToArray(e,r=!1){const n=e=>{const o=[],c=Object.keys(e).length;for(let s=0;s<c;s+=1){const c=Object.keys(e)[s];r&&t(e[c])?o.push([c,n(e[c])]):o.push([c,e[c]])}return o};return n(e)}export function objTo1d(e,r="."){if(!r||r.length<1)throw new Error("`separator` must have value at least 1 character.");const n=(e,o="")=>{let c={};const s=Object.keys(e).length,l=o.length<1;for(let u=0;u<s;u+=1){const s=Object.keys(e)[u],y=e[s],i=`${o}${l?"":r}${s}`;t(y)?(c=Object.assign(c,n(y,i)),delete c[s]):c[i]=y}return c};return n(e)}export function objDeleteKeyByValue(e,r,n=!1){if(!e||"object"!=typeof e)return null;const o=Object.assign(e,{});for(let e=Object.keys(o).length;e>=0;e-=1){const c=Object.keys(o)[e];n&&o[c]&&t(o[c])?objDeleteKeyByValue(o[c],r,n):o[c]===r&&delete o[c]}return o}export function objUpdate(e,r,n,o=!1,c=!1){if(!e||"object"!=typeof e)return null;const s=Object.assign(e,{});let l=!1;const u=e=>{for(let c=0;c<Object.keys(e).length;c+=1){const s=Object.keys(e)[c];o&&e[s]&&t(e[s])&&u(e[s]),Object.hasOwn(e,r)&&(e[r]=n,l=!0)}};return u(s),!l&&c&&(s[r]=n),s}export function objMergeNewKey(e,r,n){if(!e||"object"!=typeof e||!r||"object"!=typeof r)return null;const o={...e};return Object.keys(r).forEach((e=>{const c=r[e];if(Object.hasOwn(o,e))if(Array.isArray(o[e])&&Array.isArray(c)){if("append"===n?.arrayAction)o[e].push(...c);else if("replace"===n?.arrayAction)o[e]=c;else if(o[e].length===c.length)for(let r=0;r<o[e].length;r+=1){const s=c[r];t(s)&&(o[e][r]=objMergeNewKey(o[e][r],s,n))}}else t(o[e])&&t(c)?o[e]=objMergeNewKey(o[e],c,n):o[e]=c;else o[e]=c})),o}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qsu",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "QSU is a lightweight and simple module with a variety of built-in utility functions that you can utilize in your NodeJS projects.",
|
|
5
|
-
"author": "
|
|
5
|
+
"author": "CDGet <jooy2.contact@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://qsu.cdget.com",
|
|
8
8
|
"repository": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"file"
|
|
66
66
|
],
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@types/node": "22.10.
|
|
68
|
+
"@types/node": "22.10.2",
|
|
69
69
|
"@typescript-eslint/eslint-plugin": "7.14.1",
|
|
70
70
|
"@typescript-eslint/parser": "7.14.1",
|
|
71
71
|
"dayjs": "^1.11.13",
|