@dfinity/utils 0.0.1-nightly-2022-08-08.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +84 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,3 +1,87 @@
1
1
  # utils-js
2
2
 
3
3
  A collection of utilities and constants for NNS/SNS projects.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@dfinity/utils.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/utils) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6
+
7
+ ## Table of contents
8
+
9
+ - [Installation](#installation)
10
+ - [Features](#features)
11
+
12
+ ## Installation
13
+
14
+ You can use `utils-js` by installing it in your project.
15
+
16
+ ```bash
17
+ npm i @dfinity/utils
18
+ ```
19
+
20
+ The bundle needs peer dependencies, be sure that following resources are available in your project as well.
21
+
22
+ ```bash
23
+ npm i @dfinity/agent @dfinity/candid @dfinity/principal
24
+ ```
25
+
26
+ ## Features
27
+
28
+ `utils-js` implements following features:
29
+
30
+ <!-- TSDOC_START -->
31
+
32
+ ### :toolbox: Functions
33
+
34
+ - [defaultAgent](#gear-defaultagent)
35
+ - [createServices](#gear-createservices)
36
+ - [assertNonNullish](#gear-assertnonnullish)
37
+ - [toNullable](#gear-tonullable)
38
+ - [fromNullable](#gear-fromnullable)
39
+ - [fromDefinedNullable](#gear-fromdefinednullable)
40
+
41
+ #### :gear: defaultAgent
42
+
43
+ | Function | Type |
44
+ | -------------- | ------------- |
45
+ | `defaultAgent` | `() => Agent` |
46
+
47
+ #### :gear: createServices
48
+
49
+ | Function | Type |
50
+ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
51
+ | `createServices` | `<T>({ options: { canisterId, serviceOverride, certifiedServiceOverride, agent: agentOption, }, idlFactory, certifiedIdlFactory, }: { options: RequiredCanisterOptions<T>; idlFactory: InterfaceFactory; certifiedIdlFactory: InterfaceFactory; }) => { ...; }` |
52
+
53
+ #### :gear: assertNonNullish
54
+
55
+ | Function | Type |
56
+ | ------------------ | -------------------------------------------------------------------- |
57
+ | `assertNonNullish` | `<T>(value: T, message?: string) => asserts value is NonNullable<T>` |
58
+
59
+ #### :gear: toNullable
60
+
61
+ | Function | Type |
62
+ | ------------ | ----------------------------- |
63
+ | `toNullable` | `<T>(value?: T) => [] or [T]` |
64
+
65
+ #### :gear: fromNullable
66
+
67
+ | Function | Type |
68
+ | -------------- | ---------------------------- |
69
+ | `fromNullable` | `<T>(value: [] or [T]) => T` |
70
+
71
+ #### :gear: fromDefinedNullable
72
+
73
+ | Function | Type |
74
+ | --------------------- | ---------------------------- |
75
+ | `fromDefinedNullable` | `<T>(value: [] or [T]) => T` |
76
+
77
+ ### :factory: NullishError
78
+
79
+ #### Constructors
80
+
81
+ `public`
82
+
83
+ Parameters:
84
+
85
+ - `message`
86
+
87
+ <!-- TSDOC_END -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfinity/utils",
3
- "version": "0.0.1-nightly-2022-08-08.1",
3
+ "version": "0.0.2",
4
4
  "description": "A collection of utilities and constants for NNS/SNS projects.",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/cjs/index.cjs.js",
@@ -48,4 +48,4 @@
48
48
  "service nervous system",
49
49
  "service-nervous-system"
50
50
  ]
51
- }
51
+ }