Whether in large or small projects, it is often necessary to write some tools/helper functions. These functions vary, and some of them can be shared among all projects, such as:
Cookie operations
Date parsing and formatting
Number formatting
Detect browser type
Base64 encoding
Commonly used regular rules
etc.
Now there is finally a library that contains these commonly used functions. This is Micell, a common function library focused on front-end development.
What is Micell?
Micell (pronounced /maɪˈsel/, similar to my-cell) is a collection of functions used in everyday web development. Micell only contains functions that are commonly used in most projects. Of course, for completeness, some less commonly used functions will also be included.
What is Micell not?
Not a replacement for lodash, momentjs or dayjs.
It will not contain all the utility functions in your application.
Why do you need Micell?
Community sharing: You no longer need to rewrite public tool functions, Micell enables reuse in all projects.
Typescript support: The source code is written in TypeScript, and the type declaration file is also included in the npm package.
High reliability: Tested on all modern browsers, test coverage reaches 96%.
Import on demand: Use babel-plugin-lodash to import modules on demand.
Install
Npm
npm i –save micell
Yarn
yarn add micell
CDN
If you want to use micell directly through the <script> tag, you can use jsDelivr.
The latest version of:
<script src=”https://cdn.jsdelivr.net/npm/micell”></script>
Specify version:
<script src=”https://cdn.jsdelivr.net/npm/micell@0.11.0/dist/micell.js”></script>
ES module version:
<script src=”https://cdn.jsdelivr.net/npm/micell@0.11.0/dist/micell.esm.browser.js”></script>
micell also exists on unpkg.
use
import micell from ‘micell’
// Generate a random string
micell.randomString(6);
// Get cookie value
micell.cookie.get(‘name’)
Please see the documentation for more functions.
Tip: You can try micell in the browser console, using the global object micell.
Reduce packaging volume
On-demand packaging can be achieved through babel-plugin-lodash.
.babelrc
{
“plugins”: [
[“lodash”, { “id”: [“micell”] }]
]
}
Summarize
Although micell has been developed intermittently for more than a year and contains more than 100 functions, it is definitely lacking and needs your help, such as:
Start using it in your projects
boost documentation
feedback bug
Request to add new methods
Or anything else you think micell should do
All types of contributions are welcome.