Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaciras/utilities
A set of commonly used JS functions implemented with best practices.
https://github.com/kaciras/utilities
Last synced: 5 days ago
JSON representation
A set of commonly used JS functions implemented with best practices.
- Host: GitHub
- URL: https://github.com/kaciras/utilities
- Owner: Kaciras
- License: mit
- Created: 2022-03-13T08:05:52.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-12-24T00:44:58.000Z (13 days ago)
- Last Synced: 2024-12-31T22:02:26.080Z (6 days ago)
- Language: TypeScript
- Homepage:
- Size: 3.28 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Utilities
[![npm](https://img.shields.io/npm/v/@kaciras/utilities)](https://www.npmjs.com/package/@kaciras/utilities)
![npm type definitions](https://img.shields.io/npm/types/%40kaciras%2Futilities)
[![Test](https://github.com/Kaciras/utilities/actions/workflows/test.yml/badge.svg)](https://github.com/Kaciras/utilities/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/Kaciras/utilities/branch/master/graph/badge.svg?token=LVN4Y86T39)](https://codecov.io/gh/Kaciras/utilities)A set of common JS functions implemented with best practices.
Goals:
* Just work for most cases, not a general framework.
* No dependencies.
* High performance & less code.
* Targets the latest ECMAScript.
* Tree-shakeable.
* No duplicated with FP libraries (lodash, underscore, etc.)
* Type-first, We don't check for parameters that don't match the type.## Install
This package is pure ESM, it cannot be `require()`'d from CommonJS.
```
pnpm i @kaciras/utilities
```The package has 2 entry points. Most functions work for both, but there are still some differences:
* `@kaciras/utilities/browser` can be imported from any environment, also have functions work with DOM.
* `@kaciras/utilities/node` have no browser-specific functions, but add utilities for Node, it can only be used in NodeJS.```javascript
// Use in Node.
import { /* ... */ } from "@kaciras/utilities/node";// Use in browser.
import { /* ... */ } from "@kaciras/utilities/browser";
```# Develop
Build the project:
```shell
pnpm build
```Run tests. Some tests are for generated bundles, you should build them first.
```shell
pnpm run test:unit
pnpm run test:browser
pnpm run test:types
```Run benchmark (file in the benchmark folder):
```shell
pnpm exec esbench --file
```