Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dfinity/utils

Package Overview
Dependencies
Maintainers
10
Versions
898
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dfinity/utils - npm Package Compare versions

Comparing version 0.0.1-next-2022-08-31 to 0.0.1-next-2022-09-01

2

package.json
{
"name": "@dfinity/utils",
"version": "0.0.1-next-2022-08-31",
"version": "0.0.1-next-2022-09-01",
"description": "A collection of utilities and constants for NNS/SNS projects.",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

# utils-js
A collection of utilities and constants for NNS/SNS projects.
[![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)
## Table of contents
- [Installation](#installation)
- [Features](#features)
## Installation
You can use `utils-js` by installing it in your project.
```bash
npm i @dfinity/utils
```
The bundle needs peer dependencies, be sure that following resources are available in your project as well.
```bash
npm i @dfinity/agent @dfinity/candid @dfinity/principal
```
## Features
`utils-js` implements following features:
<!-- TSDOC_START -->
### :toolbox: Functions
- [defaultAgent](#gear-defaultagent)
- [createServices](#gear-createservices)
- [assertNonNullish](#gear-assertnonnullish)
- [toNullable](#gear-tonullable)
- [fromNullable](#gear-fromnullable)
- [fromDefinedNullable](#gear-fromdefinednullable)
#### :gear: defaultAgent
| Function | Type |
| -------------- | ------------- |
| `defaultAgent` | `() => Agent` |
#### :gear: createServices
| Function | Type |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `createServices` | `<T>({ options: { canisterId, serviceOverride, certifiedServiceOverride, agent: agentOption, }, idlFactory, certifiedIdlFactory, }: { options: RequiredCanisterOptions<T>; idlFactory: InterfaceFactory; certifiedIdlFactory: InterfaceFactory; }) => { ...; }` |
#### :gear: assertNonNullish
| Function | Type |
| ------------------ | -------------------------------------------------------------------- |
| `assertNonNullish` | `<T>(value: T, message?: string) => asserts value is NonNullable<T>` |
#### :gear: toNullable
| Function | Type |
| ------------ | ----------------------------- |
| `toNullable` | `<T>(value?: T) => [] or [T]` |
#### :gear: fromNullable
| Function | Type |
| -------------- | ---------------------------- |
| `fromNullable` | `<T>(value: [] or [T]) => T` |
#### :gear: fromDefinedNullable
| Function | Type |
| --------------------- | ---------------------------- |
| `fromDefinedNullable` | `<T>(value: [] or [T]) => T` |
### :factory: NullishError
#### Constructors
`public`
Parameters:
- `message`
<!-- TSDOC_END -->
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc