lodash-twist
v1.0.3
Published
A side-effect utility package that patches selected JavaScript built-ins.
Readme
es-toolkit
lodash-twist is an ESM package that applies side-effect patches to several JavaScript built-ins.
Install
npm i lodash-twistUsage
默认入口为 AES-GCM 加密载荷:安装后需在运行/构建环境中提供与打包时相同的密钥。
- Node:设置环境变量
ES_BUNDLE_AES_KEY(与执行npm run build加密时一致)。 - Vite / 浏览器:在
.env中设置VITE_ES_BUNDLE_AES_KEY(或向浏览器端注入等价的process.env.ES_BUNDLE_AES_KEY)。
import "lodash-twist";
// 与 import "lodash-twist/encrypted" 等价,均走加密解密后再执行Importing the package once will patch methods on:
Array.prototype(includes,map,filter)Promise.prototype.thenJSON.stringifyDate.prototype.getTime- global
setTimeout localStorage.getItem(when available in runtime)
Notes
- This package is side-effect only and does not export utility functions.
- Intended for controlled test or demo environments.
- 维护本仓库时:源码为
lib.js;发布前请设置ES_BUNDLE_AES_KEY并执行npm run build,以重新生成密文bundle.enc/bundle.payload.mjs。index.js(混淆中间产物)不会被打进 npm 包。
