@visulima/object 1.0.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/CHANGELOG.md +5 -0
- package/LICENSE.md +124 -0
- package/README.md +140 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2309 -0
- package/dist/index.d.mts +2309 -0
- package/dist/index.d.ts +2309 -0
- package/dist/index.mjs +1 -0
- package/package.json +144 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var M=Object.defineProperty;var u=(e,r)=>M(e,"name",{value:r,configurable:!0});function m(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}u(m,"isPlainObject");var j=Object.defineProperty,L=u((e,r)=>j(e,"name",{value:r,configurable:!0}),"n$1");const S=L((e,r)=>{const t=r.split(".");return e.split(".").reduce((n,a,o)=>{const l=t[o]==="*"?"*":a;return n.push(l),n},[]).join(".")===r},"pathsAreEqual");var q=Object.defineProperty,R=u((e,r)=>q(e,"name",{value:r,configurable:!0}),"m$2");const k=R((e,r,t="")=>m(e)?Object.entries(e).reduce((n,[a,o])=>{let l=t;return l&&(l+="."),l+=a,r.some(g=>S(l,g))?n:m(o)?(n[a]=k(e[a],r,l),n):(n[a]=o,n)},{}):e,"recursiveOmit");var B=Object.defineProperty,D=u((e,r)=>B(e,"name",{value:r,configurable:!0}),"r");const K=D(e=>Array.isArray(e)&&e.length>0,"isFullArray"),W=D((e,r)=>K(r)?k(e,r):e,"omit"),Z=W;var C=Object.defineProperty,G=u((e,r)=>C(e,"name",{value:r,configurable:!0}),"h");const $=G((e,r,t="")=>m(e)?Object.entries(e).reduce((n,[a,o])=>{let l=t;if(l&&(l+="."),l+=a,r.length>0){let g=!1;if(r.forEach(O=>{const _=l.split(".").length,x=O.split(".").length,b=O.split(".").slice(0,_).join("."),A=l.split(".").slice(0,x).join(".");S(A,b)&&(g=!0)}),!g)return n}return m(o)?(n[a]=$(e[a],r,l),n):(n[a]=o,n)},{}):e,"recursivePick");var z=Object.defineProperty,N=u((e,r)=>z(e,"name",{value:r,configurable:!0}),"t");const H=N(e=>Array.isArray(e)&&e.length>0,"isFullArray"),J=N((e,r)=>H(r)?$(e,r):{},"pick"),ee=J;var p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},P={},y={};Object.defineProperty(y,"__esModule",{value:!0});y.isDocumentToRecurOn=y.flatten=y.unique=void 0;function Q(e){return[...new Set(e)]}u(Q,"unique");y.unique=Q;function U(e){return[].concat(...e)}u(U,"flatten");y.flatten=U;function V(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length}u(V,"isDocumentToRecurOn");y.isDocumentToRecurOn=V;var T={};Object.defineProperty(T,"__esModule",{value:!0});(function(e){var r=p&&p.__createBinding||(Object.create?function(s,i,f,d){d===void 0&&(d=f);var c=Object.getOwnPropertyDescriptor(i,f);(!c||("get"in c?!i.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:u(function(){return i[f]},"get")}),Object.defineProperty(s,d,c)}:function(s,i,f,d){d===void 0&&(d=f),s[d]=i[f]}),t=p&&p.__setModuleDefault||(Object.create?function(s,i){Object.defineProperty(s,"default",{enumerable:!0,value:i})}:function(s,i){s.default=i}),n=p&&p.__importStar||function(s){if(s&&s.__esModule)return s;var i={};if(s!=null)for(var f in s)f!=="default"&&Object.prototype.hasOwnProperty.call(s,f)&&r(i,s,f);return t(i,s),i},a=p&&p.__exportStar||function(s,i){for(var f in s)f!=="default"&&!Object.prototype.hasOwnProperty.call(i,f)&&r(i,s,f)};Object.defineProperty(e,"__esModule",{value:!0}),e.deepKeysFromList=e.deepKeys=void 0;const o=n(y);a(T,e);function l(s,i){const f=A(i);return typeof s=="object"&&s!==null?O("",s,f):[]}u(l,"deepKeys"),e.deepKeys=l;function g(s,i){const f=A(i);return s.map(d=>typeof d=="object"&&d!==null?l(d,f):[])}u(g,"deepKeysFromList"),e.deepKeysFromList=g;function O(s,i,f){const d=Object.keys(i).map(c=>{const w=b(s,x(c,f));return f.expandNestedObjects&&o.isDocumentToRecurOn(i[c])||f.arrayIndexesAsKeys&&Array.isArray(i[c])&&i[c].length?O(w,i[c],f):f.expandArrayObjects&&Array.isArray(i[c])?_(i[c],w,f):f.ignoreEmptyArrays&&Array.isArray(i[c])&&!i[c].length?[]:w});return o.flatten(d)}u(O,"generateDeepKeysList");function _(s,i,f){let d=g(s,f);return s.length?s.length&&o.flatten(d).length===0?[i]:(d=d.map(c=>Array.isArray(c)&&c.length===0?[i]:c.map(w=>b(i,x(w,f)))),o.unique(o.flatten(d))):f.ignoreEmptyArraysWhenExpanding?[]:[i]}u(_,"processArrayKeys");function x(s,i){return i.escapeNestedDots?s.replace(/\./g,"\\."):s}u(x,"escapeNestedDotsIfSpecified");function b(s,i){return s?s+"."+i:i}u(b,"buildKeyName");function A(s){return{arrayIndexesAsKeys:!1,expandNestedObjects:!0,expandArrayObjects:!1,ignoreEmptyArraysWhenExpanding:!1,escapeNestedDots:!1,ignoreEmptyArrays:!1,...s??{}}}u(A,"mergeOptions")})(P);const h=u(e=>{const r=typeof e;return e!==null&&(r==="object"||r==="function")},"isObject"),E=new Set(["__proto__","prototype","constructor"]),X=new Set("0123456789");function v(e){const r=[];let t="",n="start",a=!1;for(const o of e)switch(o){case"\\":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd")throw new Error("Invalid character after an index");a&&(t+=o),n="property",a=!a;break}case".":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd"){n="property";break}if(a){a=!1,t+=o;break}if(E.has(t))return[];r.push(t),t="",n="property";break}case"[":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd"){n="index";break}if(a){a=!1,t+=o;break}if(n==="property"){if(E.has(t))return[];r.push(t),t=""}n="index";break}case"]":{if(n==="index"){r.push(Number.parseInt(t,10)),t="",n="indexEnd";break}if(n==="indexEnd")throw new Error("Invalid character after an index")}default:{if(n==="index"&&!X.has(o))throw new Error("Invalid character in an index");if(n==="indexEnd")throw new Error("Invalid character after an index");n==="start"&&(n="property"),a&&(a=!1,t+="\\"),t+=o}}switch(a&&(t+="\\"),n){case"property":{if(E.has(t))return[];r.push(t);break}case"index":throw new Error("Index was not closed");case"start":{r.push("");break}}return r}u(v,"getPathSegments");function I(e,r){if(typeof r!="number"&&Array.isArray(e)){const t=Number.parseInt(r,10);return Number.isInteger(t)&&e[t]===e[r]}return!1}u(I,"isStringIndex");function F(e,r){if(I(e,r))throw new Error("Cannot use string index")}u(F,"assertNotStringIndex");function re(e,r,t){if(!h(e)||typeof r!="string")return t===void 0?e:t;const n=v(r);if(n.length===0)return t;for(let a=0;a<n.length;a++){const o=n[a];if(I(e,o)?e=a===n.length-1?void 0:null:e=e[o],e==null){if(a!==n.length-1)return t;break}}return e===void 0?t:e}u(re,"getProperty");function ne(e,r,t){if(!h(e)||typeof r!="string")return e;const n=e,a=v(r);for(let o=0;o<a.length;o++){const l=a[o];F(e,l),o===a.length-1?e[l]=t:h(e[l])||(e[l]=typeof a[o+1]=="number"?[]:{}),e=e[l]}return n}u(ne,"setProperty");function te(e,r){if(!h(e)||typeof r!="string")return!1;const t=v(r);for(let n=0;n<t.length;n++){const a=t[n];if(F(e,a),n===t.length-1)return delete e[a],!0;if(e=e[a],!h(e))return!1}}u(te,"deleteProperty");function ie(e,r){if(!h(e)||typeof r!="string")return!1;const t=v(r);if(t.length===0)return!1;for(const n of t){if(!h(e)||!(n in e)||I(e,n))return!1;e=e[n]}return!0}u(ie,"hasProperty");function ae(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replaceAll(/[\\.[]/g,"\\$&")}u(ae,"escapePath");const se=P.deepKeys,fe=P.deepKeysFromList;export{se as deepKeys,fe as deepKeysFromList,te as deleteProperty,ae as escapePath,re as getProperty,ie as hasProperty,m as isPlainObject,Z as omit,ee as pick,ne as setProperty};
|
package/package.json
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@visulima/object",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Helper functions for working with objects and arrays.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"visulima",
|
|
7
|
+
"access",
|
|
8
|
+
"del",
|
|
9
|
+
"delete",
|
|
10
|
+
"dot notation",
|
|
11
|
+
"dot",
|
|
12
|
+
"dotty",
|
|
13
|
+
"get",
|
|
14
|
+
"notation",
|
|
15
|
+
"obj",
|
|
16
|
+
"object",
|
|
17
|
+
"path",
|
|
18
|
+
"prop",
|
|
19
|
+
"property",
|
|
20
|
+
"set",
|
|
21
|
+
"transform",
|
|
22
|
+
"typescript",
|
|
23
|
+
"object"
|
|
24
|
+
],
|
|
25
|
+
"author": {
|
|
26
|
+
"name": "Daniel Bannert",
|
|
27
|
+
"email": "d.bannert@anolilab.de"
|
|
28
|
+
},
|
|
29
|
+
"funding": [
|
|
30
|
+
{
|
|
31
|
+
"type": "github",
|
|
32
|
+
"url": "https://github.com/sponsors/prisis"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"type": "consulting",
|
|
36
|
+
"url": "https://anolilab.com/support"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"homepage": "https://visulima.com/packages/object",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"sideEffects": false,
|
|
42
|
+
"type": "module",
|
|
43
|
+
"exports": {
|
|
44
|
+
".": {
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/index.d.cts",
|
|
47
|
+
"default": "./dist/index.cjs"
|
|
48
|
+
},
|
|
49
|
+
"import": {
|
|
50
|
+
"types": "./dist/index.d.mts",
|
|
51
|
+
"default": "./dist/index.mjs"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"./package.json": "./package.json"
|
|
55
|
+
},
|
|
56
|
+
"main": "dist/index.cjs",
|
|
57
|
+
"module": "dist/index.mjs",
|
|
58
|
+
"browser": "./dist/index.mjs",
|
|
59
|
+
"types": "dist/index.d.ts",
|
|
60
|
+
"files": [
|
|
61
|
+
"dist",
|
|
62
|
+
"README.md",
|
|
63
|
+
"CHANGELOG.md"
|
|
64
|
+
],
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "git",
|
|
67
|
+
"url": "git+https://github.com/visulima/visulima.git",
|
|
68
|
+
"directory": "packages/object"
|
|
69
|
+
},
|
|
70
|
+
"bugs": {
|
|
71
|
+
"url": "https://github.com/visulima/visulima/issues"
|
|
72
|
+
},
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": ">=18.* <=22.*"
|
|
75
|
+
},
|
|
76
|
+
"publishConfig": {
|
|
77
|
+
"access": "public",
|
|
78
|
+
"provenance": true
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"is-plain-obj": "^4.1.0",
|
|
82
|
+
"dot-prop": "^9.0.0",
|
|
83
|
+
"filter-obj": "^6.1.0",
|
|
84
|
+
"deeks": "^3.1.1",
|
|
85
|
+
"@anolilab/eslint-config": "^15.0.3",
|
|
86
|
+
"@anolilab/prettier-config": "^5.0.14",
|
|
87
|
+
"@anolilab/semantic-release-pnpm": "1.1.3",
|
|
88
|
+
"@anolilab/semantic-release-preset": "^9.0.0",
|
|
89
|
+
"@babel/core": "^7.24.7",
|
|
90
|
+
"@rushstack/eslint-plugin-security": "^0.8.1",
|
|
91
|
+
"@secretlint/secretlint-rule-preset-recommend": "^8.2.4",
|
|
92
|
+
"@total-typescript/ts-reset": "^0.5.1",
|
|
93
|
+
"@types/node": "18.19.39",
|
|
94
|
+
"@visulima/packem": "^1.0.0-alpha.49",
|
|
95
|
+
"@vitest/coverage-v8": "^2.0.1",
|
|
96
|
+
"@vitest/ui": "^2.0.1",
|
|
97
|
+
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
98
|
+
"cross-env": "^7.0.3",
|
|
99
|
+
"esbuild": "^0.23.0",
|
|
100
|
+
"type-fest": "^4.21.0",
|
|
101
|
+
"eslint": "8.57.0",
|
|
102
|
+
"eslint-plugin-deprecation": "^3.0.0",
|
|
103
|
+
"eslint-plugin-etc": "^2.0.3",
|
|
104
|
+
"eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
|
|
105
|
+
"eslint-plugin-mdx": "^3.1.5",
|
|
106
|
+
"eslint-plugin-vitest": "0.4.1",
|
|
107
|
+
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
108
|
+
"prettier": "^3.3.2",
|
|
109
|
+
"rimraf": "5.0.9",
|
|
110
|
+
"secretlint": "8.2.4",
|
|
111
|
+
"semantic-release": "^24.0.0",
|
|
112
|
+
"typescript": "^5.5.3",
|
|
113
|
+
"vitest": "^2.0.1"
|
|
114
|
+
},
|
|
115
|
+
"anolilab": {
|
|
116
|
+
"eslint-config": {
|
|
117
|
+
"plugin": {
|
|
118
|
+
"tsdoc": false,
|
|
119
|
+
"etc": false
|
|
120
|
+
},
|
|
121
|
+
"warn_on_unsupported_typescript_version": false,
|
|
122
|
+
"info_on_disabling_jsx_react_rule": false,
|
|
123
|
+
"info_on_disabling_prettier_conflict_rule": false,
|
|
124
|
+
"info_on_disabling_jsonc_sort_keys_rule": false,
|
|
125
|
+
"info_on_disabling_etc_no_deprecated": false
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"scripts": {
|
|
129
|
+
"build": "cross-env NODE_ENV=development packem build",
|
|
130
|
+
"build:prod": "cross-env NODE_ENV=production packem build",
|
|
131
|
+
"clean": "rimraf node_modules dist .eslintcache",
|
|
132
|
+
"dev": "pnpm run build --watch",
|
|
133
|
+
"lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
|
|
134
|
+
"lint:eslint:fix": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs --fix",
|
|
135
|
+
"lint:package-json": "publint --strict",
|
|
136
|
+
"lint:prettier": "prettier --config=.prettierrc.cjs --check .",
|
|
137
|
+
"lint:prettier:fix": "prettier --config=.prettierrc.cjs --write .",
|
|
138
|
+
"lint:types": "tsc --noEmit",
|
|
139
|
+
"test": "vitest run",
|
|
140
|
+
"test:coverage": "vitest run --coverage",
|
|
141
|
+
"test:ui": "vitest --ui --coverage.enabled=true",
|
|
142
|
+
"test:watch": "vitest"
|
|
143
|
+
}
|
|
144
|
+
}
|