@carry0987/utils
v3.8.3
Published
A library for using common tools and alias methods
Downloads
471
Readme
Utils-JS
A library for using common tools and alias methods
Installation
pnpm add @carry0987/utils -D
Usage
Importing Entire Modules
You can import the entire set of utilities if you prefer, like this:
import { storageUtils } from '@carry0987/utils';
// Usage
storageUtils.setLocalValue('key', 'value');
const value = storageUtils.getLocalValue('key');
Importing Specific Functions (Tree Shaking)
To help with optimizing your bundle size, you can import only the functions you need from @carry0987/utils
. This helps to reduce the size of your final bundle because unused code will not be included if your bundler supports tree shaking.
// Import specific utilities
import { setLocalValue, getLocalValue, removeLocalValue } from '@carry0987/utils';
// Usage
setLocalValue('key', 'value');
const value = getLocalValue('key');
removeLocalValue('key');
By using specific imports, you can take advantage of tree shaking in bundlers like Webpack or Rollup, which can statically analyze the imports and remove unused code.
License
This project is licensed under the MIT License. See the LICENSE file for details.