UNPKG

1.67 kBMarkdownView Raw
1## @0x/utils
2
3Utils to be shared across 0x projects and packages
4
5## Installation
6
7```bash
8yarn add @0x/utils
9```
10
11If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
12
13```json
14"compilerOptions": {
15 "typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
16}
17```
18
19## Usage
20
21```javascript
22import { addressUtils, bigNumberConfigs, classUtils, intervalUtils, promisify } from '@0x/utils';
23```
24
25## Troubleshooting
26
27If you are still seeing TS type errors complaining about missing DOM types such as `Response`:
28
29```
30error TS2304: Cannot find name 'Response'.
31```
32
33Then you need to explicitly add the `dom` lib to your compiler options in `tsconfig.json`. The `dom` library is included by default, but customizing the `lib` option can cause it to be dropped.
34
35```
36"compilerOptions": {
37 "lib": [..., "dom"],
38```
39
40## Contributing
41
42We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
43
44Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
45
46### Install dependencies
47
48If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
49
50```bash
51yarn config set workspaces-experimental true
52```
53
54Then install dependencies
55
56```bash
57yarn install
58```
59
60### Build
61
62To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
63
64```bash
65PKG=@0x/utils yarn build
66```
67
68Or continuously rebuild on change:
69
70```bash
71PKG=@0x/utils yarn watch
72```
73
74### Clean
75
76```bash
77yarn clean
78```
79
80### Lint
81
82```bash
83yarn lint
84```
85
\No newline at end of file