@x-oasis/omit 0.0.8
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.d.ts +5 -0
- package/dist/index.js +8 -0
- package/dist/omit.cjs.development.js +17 -0
- package/dist/omit.cjs.development.js.map +1 -0
- package/dist/omit.cjs.production.min.js +2 -0
- package/dist/omit.cjs.production.min.js.map +1 -0
- package/dist/omit.esm.js +13 -0
- package/dist/omit.esm.js.map +1 -0
- package/package.json +24 -0
- package/src/index.ts +16 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function omit(obj, keys) {
|
|
6
|
+
if (Object.prototype.toString.call(obj) === '[object Object]') {
|
|
7
|
+
return Object.keys(obj).reduce(function (acc, cur) {
|
|
8
|
+
if (keys.indexOf(cur) !== -1) return acc;
|
|
9
|
+
acc[cur] = obj[cur];
|
|
10
|
+
return acc;
|
|
11
|
+
}, {});
|
|
12
|
+
}
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.default = omit;
|
|
17
|
+
//# sourceMappingURL=omit.cjs.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omit.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["export default function omit (\n obj: {\n [key: string]: any;\n },\n keys: Array<string>\n) {\n if (Object.prototype.toString.call(obj) === '[object Object]') {\n return Object.keys(obj).reduce((acc, cur) => {\n if (keys.indexOf(cur) !== -1) return acc;\n acc[cur] = obj[cur];\n return acc;\n }, {});\n }\n\n return obj;\n};"],"names":["omit","obj","keys","Object","prototype","toString","call","reduce","acc","cur","indexOf"],"mappings":";;;;SAAwBA,IAAIA,CAC1BC,GAEC,EACDC,IAAmB;EAEnB,IAAIC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACL,GAAG,CAAC,KAAK,iBAAiB,EAAE;IAC7D,OAAOE,MAAM,CAACD,IAAI,CAACD,GAAG,CAAC,CAACM,MAAM,CAAC,UAACC,GAAG,EAAEC,GAAG;MACtC,IAAIP,IAAI,CAACQ,OAAO,CAACD,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,OAAOD,GAAG;MACxCA,GAAG,CAACC,GAAG,CAAC,GAAGR,GAAG,CAACQ,GAAG,CAAC;MACnB,OAAOD,GAAG;KACX,EAAE,EAAE,CAAC;;EAGR,OAAOP,GAAG;AACZ;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,t){return"[object Object]"===Object.prototype.toString.call(e)?Object.keys(e).reduce((function(r,c){return-1!==t.indexOf(c)||(r[c]=e[c]),r}),{}):e};
|
|
2
|
+
//# sourceMappingURL=omit.cjs.production.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omit.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["export default function omit (\n obj: {\n [key: string]: any;\n },\n keys: Array<string>\n) {\n if (Object.prototype.toString.call(obj) === '[object Object]') {\n return Object.keys(obj).reduce((acc, cur) => {\n if (keys.indexOf(cur) !== -1) return acc;\n acc[cur] = obj[cur];\n return acc;\n }, {});\n }\n\n return obj;\n};"],"names":["obj","keys","Object","prototype","toString","call","reduce","acc","cur","indexOf"],"mappings":"6FACEA,EAGAC,GAEA,MAA4C,oBAAxCC,OAAOC,UAAUC,SAASC,KAAKL,GAC1BE,OAAOD,KAAKD,GAAKM,QAAO,SAACC,EAAKC,GACnC,OAA2B,IAAvBP,EAAKQ,QAAQD,KACjBD,EAAIC,GAAOR,EAAIQ,IADsBD,IAGpC,IAGEP"}
|
package/dist/omit.esm.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function omit(obj, keys) {
|
|
2
|
+
if (Object.prototype.toString.call(obj) === '[object Object]') {
|
|
3
|
+
return Object.keys(obj).reduce(function (acc, cur) {
|
|
4
|
+
if (keys.indexOf(cur) !== -1) return acc;
|
|
5
|
+
acc[cur] = obj[cur];
|
|
6
|
+
return acc;
|
|
7
|
+
}, {});
|
|
8
|
+
}
|
|
9
|
+
return obj;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default omit;
|
|
13
|
+
//# sourceMappingURL=omit.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omit.esm.js","sources":["../src/index.ts"],"sourcesContent":["export default function omit (\n obj: {\n [key: string]: any;\n },\n keys: Array<string>\n) {\n if (Object.prototype.toString.call(obj) === '[object Object]') {\n return Object.keys(obj).reduce((acc, cur) => {\n if (keys.indexOf(cur) !== -1) return acc;\n acc[cur] = obj[cur];\n return acc;\n }, {});\n }\n\n return obj;\n};"],"names":["omit","obj","keys","Object","prototype","toString","call","reduce","acc","cur","indexOf"],"mappings":"SAAwBA,IAAIA,CAC1BC,GAEC,EACDC,IAAmB;EAEnB,IAAIC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACL,GAAG,CAAC,KAAK,iBAAiB,EAAE;IAC7D,OAAOE,MAAM,CAACD,IAAI,CAACD,GAAG,CAAC,CAACM,MAAM,CAAC,UAACC,GAAG,EAAEC,GAAG;MACtC,IAAIP,IAAI,CAACQ,OAAO,CAACD,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,OAAOD,GAAG;MACxCA,GAAG,CAACC,GAAG,CAAC,GAAGR,GAAG,CAACQ,GAAG,CAAC;MACnB,OAAOD,GAAG;KACX,EAAE,EAAE,CAAC;;EAGR,OAAOP,GAAG;AACZ;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@x-oasis/omit",
|
|
3
|
+
"version": "0.0.8",
|
|
4
|
+
"description": "omit function",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"typings": "dist/index.d.ts",
|
|
7
|
+
"module": "dist/omit.esm.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"index.ts",
|
|
11
|
+
"src"
|
|
12
|
+
],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"tsdx": "^0.14.1"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsdx build --tsconfig tsconfig.build.json",
|
|
20
|
+
"clean": "rimraf ./dist",
|
|
21
|
+
"test": "vitest",
|
|
22
|
+
"compile": "tsc -p tsconfig.build.json"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default function omit (
|
|
2
|
+
obj: {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
},
|
|
5
|
+
keys: Array<string>
|
|
6
|
+
) {
|
|
7
|
+
if (Object.prototype.toString.call(obj) === '[object Object]') {
|
|
8
|
+
return Object.keys(obj).reduce((acc, cur) => {
|
|
9
|
+
if (keys.indexOf(cur) !== -1) return acc;
|
|
10
|
+
acc[cur] = obj[cur];
|
|
11
|
+
return acc;
|
|
12
|
+
}, {});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return obj;
|
|
16
|
+
};
|