This is a commonly used JS toolbox, designed to facilitate rapid daily development.
type use strictNullChecks
and strictNullChecks
- Array - Methods related to handling arrays, such as groupBy, unique, deleting arrays, and immutable methods for adding to arrays.
- Browser - Queries related to browser functionalities, such as console.log, scroll height, window clientHeight.
- Convert - Type conversion, color code format conversion, file to base64, base64 to blob.
- Date - Handling date ranges, simplifying date display, converting total seconds into hours, minutes, and seconds, etc.
- Dom - Handling functions related to the DOM, such as manipulating Class, inserting iFrame, inserting Script, copying to clipboard, downloading blob.
- Equal - Determining if it's empty (including 0, empty array, blank string, null, empty object), whether it's JSON, and Compose matching.
- Number - Handling currency formatting, decimal point retention, and obtaining the difference between two ranges.
- Object - Handling enhanced type support for Object.keys, retaining true properties in an Object, inverting objects, and so on.
- String - Processing of strings, such as case conversion to camel case, enhanced string splitting, and so on.
- Uri - Handling URL-related tasks, such as encoding & decoding QueryString, obtaining the main domain, subdomain, and so on.
date dependencies dayjs library
yarn add @acrool/js-utils
These are examples of imports for various types. Refer to the documentation inside each library for other methods.
import {groupBy} from '@acrool/js-utils/array';
import {getScrollHeight} from '@acrool/js-utils/browser';
import {emptyToNull} from '@acrool/js-utils/convert';
import {simpleDate} from '@acrool/js-utils/date';
import {copyToClipboard} from '@acrool/js-utils/dom';
import {isEmpty, isNotEmpty} from '@acrool/js-utils/equal';
import {formatCurrency} from '@acrool/js-utils/number';
import {objectKeys} from '@acrool/js-utils/object';
import {removeHtmlTag} from '@acrool/js-utils/string';
import {decodeQueryString} from '@acrool/js-utils/uri';
import {delay} from '@acrool/js-utils/prmoise';
./build-post-processors.js
$ yarn build && npm publish ./dist --access=public