Comparing version 1.1.0 to 2.0.0
@@ -1,2 +0,66 @@ | ||
function t(t){return void 0===t}function e(t){return null===t}function r(t){return"Boolean"===Object.prototype.toString.call(t).slice(8,-1)}function n(t){return"Number"===Object.prototype.toString.call(t).slice(8,-1)&&!isNaN(t)}function c(t){return"String"===Object.prototype.toString.call(t).slice(8,-1)}function i(t){return Array.isArray(t)&&t.every(u)}function o(t){return"Object"===Object.prototype.toString.call(t).slice(8,-1)&&Object.keys(t).every(function(e){return u(t[e])})}function u(u){return[t,e,r,n,c,i,o].some(function(t){return t(u)})}module.exports=function u(l,a){void 0===a&&(a={});for(var s=Object.prototype.toString.call(l).slice(8,-1),f=Math.abs(a.min||5),g=a.char&&a.char.length?a.char[0]:"*",p=a.includeType?" ["+s+"]":"",b="";b.length<7;)b+=g;for(var y="";y.length<f;)y+=g;if(!t(l)){if(e(l))return null;if(r(l))return(f<8?b:y)+p;if(n(l)){var h=l<0,j=Math.abs(l).toString();return j.length<f?(h?"-"+y.slice(1):y)+p:(h?"-":"")+j[0]+j.slice(1,-1).replace(/[^\.]/g,g)+j.slice(-1)+p}return o(l)?Object.keys(l).reduce(function(t,e){var r;return Object.assign(t,((r={})[e]=u(l[e],a),r))},{}):i(l)?l.map(function(t){return u(t,a)}):c(l)?l.length<f?y+p:l[0]+l.slice(1,-1).replace(/./g,g)+l.slice(-1)+p:void 0}}; | ||
//# sourceMappingURL=rdct.js.map | ||
function f(e) { | ||
return e === void 0; | ||
} | ||
function g(e) { | ||
return e === null; | ||
} | ||
function y(e) { | ||
return Object.prototype.toString.call(e).slice(8, -1) === "Boolean"; | ||
} | ||
function d(e) { | ||
return Object.prototype.toString.call(e).slice(8, -1) === "Number" && !isNaN(e); | ||
} | ||
function h(e) { | ||
return Object.prototype.toString.call(e).slice(8, -1) === "String"; | ||
} | ||
function p(e) { | ||
return Array.isArray(e) && e.every(o); | ||
} | ||
function O(e) { | ||
return Object.prototype.toString.call(e).slice(8, -1) === "Object" && Object.keys(e).every((t) => o(e[t])); | ||
} | ||
function o(e) { | ||
return [ | ||
f, | ||
g, | ||
y, | ||
d, | ||
h, | ||
p, | ||
O | ||
].some((t) => t(e)); | ||
} | ||
const a = (e, t = {}) => { | ||
const S = Object.prototype.toString.call(e).slice(8, -1), l = Math.abs(t.min || 5), u = t.char && t.char.length ? t.char[0] : "*", c = t.includeType ? ` [${S}]` : ""; | ||
let s = ""; | ||
for (; s.length < 7; ) | ||
s += u; | ||
let n = ""; | ||
for (; n.length < l; ) | ||
n += u; | ||
if (!f(e)) { | ||
if (g(e)) | ||
return null; | ||
if (y(e)) | ||
return (l < 8 ? s : n) + c; | ||
if (d(e)) { | ||
const i = e < 0; | ||
let r = Math.abs(e).toString(); | ||
return r.length < l ? (i ? "-" + n.slice(1) : n) + c : (i ? "-" : "") + r[0] + r.slice(1, -1).replace(/[^\.]/g, u) + r.slice(-1) + c; | ||
} | ||
if (O(e)) | ||
return Object.keys(e).reduce( | ||
(i, r) => Object.assign(i, { | ||
[r]: a(e[r], t) | ||
}), | ||
{} | ||
); | ||
if (p(e)) | ||
return e.map((i) => a(i, t)); | ||
if (h(e)) | ||
return e.length < l ? n + c : e[0] + e.slice(1, -1).replace(/./g, u) + e.slice(-1) + c; | ||
} | ||
}; | ||
export { | ||
a as default | ||
}; |
{ | ||
"name": "rdct", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Deeply redact all the things", | ||
"type": "module", | ||
"main": "dist/rdct.js", | ||
"browser": "dist/rdct.umd.js", | ||
"module": "dist/rdct.es.js", | ||
"source": "src/index.ts", | ||
"types": "dist/rdct.d.ts", | ||
"scripts": { | ||
"dev": "microbundle watch", | ||
"build": "microbundle", | ||
"build": "rimraf dist && tsc && vite build", | ||
"test": "vitest", | ||
"precommit": "lint-staged", | ||
"prepare": "microbundle", | ||
"test": "jest" | ||
"prepublishOnly": "pnpm run build" | ||
}, | ||
@@ -32,22 +30,14 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/jest": "^26.0.23", | ||
"husky": "^4.2.3", | ||
"jest": "^26.6.3", | ||
"lint-staged": "^10.0.8", | ||
"microbundle": "^0.13.0", | ||
"prettier": "^1.19.1", | ||
"ts-jest": "^26.5.5", | ||
"typescript": "^4.2.4" | ||
"@types/node": "^20.12.6", | ||
"glob": "^10.3.12", | ||
"husky": "^9.0.11", | ||
"lint-staged": "^15.2.2", | ||
"prettier": "^3.2.5", | ||
"rimraf": "^5.0.5", | ||
"typescript": "^5.4.4", | ||
"vite-plugin-dts": "^3.8.1", | ||
"vite": "^5.2.0", | ||
"vitest": "^1.4.0" | ||
}, | ||
"eslintConfig": { | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"env": { | ||
"browser": true, | ||
"es6": true | ||
}, | ||
"extends": [ | ||
@@ -54,0 +44,0 @@ "prettier" |
@@ -1,2 +0,2 @@ | ||
# redact( obj [, options] ) [![NPM](https://img.shields.io/npm/v/rdct.svg)](https://npmjs.com/package/rdct) [![Build](https://travis-ci.org/whiskeredwonder/rdct.svg?branch=master)](https://travis-ci.org/whiskeredwonder/rdct) | ||
# redact( obj [, options] ) [![NPM](https://img.shields.io/npm/v/rdct.svg)](https://npmjs.com/package/rdct) | ||
@@ -3,0 +3,0 @@ Deeply redact all the things |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78
Yes
6001
10
5