Socket
Socket
Sign inDemoInstall

@js-bits/typedef-utils

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@js-bits/typedef-utils - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "@js-bits/typedef-utils",
"version": "1.0.0",
"version": "1.0.1",
"description": "Utility types for TypeScript",

@@ -5,0 +5,0 @@ "keywords": [

@@ -5,13 +5,2 @@ # Utility types for TypeScript

```typescript
const parse: MathUtils.Parse<'-56.78'> = -56.78;
const add: MathUtils.Add<9999999, 9999999> = 19999998;
const multiply: MathUtils.Multiply<78, 63> = 4914;
const trim: StringUtils.Trim<' abc '> = 'abc';
const split: StringUtils.Split<'a b c', ' '> = ['a', 'b', 'c'];
const length: TupleUtils.Length<[1, 2, 3, 4, 5]> = 5;
const longest: TupleUtils.Longest<[1], [1, 2, 3]> = [1, 2, 3];
const append: TupleUtils.Append<[1, 2, 3, 4], 5> = [1, 2, 3, 4, 5];
```
## Installation

@@ -31,4 +20,33 @@

Add `"./node_modules/@js-bits"` to `"typeRoots"` of your _tsconfig.json_, add `"typedef-utils"` to `"types"` array.
## Examples
String utilities:
```typescript
import type { Split, Trim } from '@js-bits/typedef-utils/string';
const trim: Trim<' abc '> = 'abc';
const split: Split<'a b c', ' '> = ['a', 'b', 'c'];
```
Math utilities:
```typescript
import type { Add, Multiply, Parse } from '@js-bits/typedef-utils/math';
const parse: Parse<'-56.78'> = -56.78;
const add: Add<9999999, 9999999> = 19999998;
const multiply: Multiply<78, 63> = 4914;
```
Tuple utilities:
```typescript
import type { Append, Length, Longest } from '@js-bits/typedef-utils/tuple';
const length: Length<[1, 2, 3, 4, 5]> = 5;
const longest: Longest<[1], [1, 2, 3]> = [1, 2, 3];
const append: Append<[1, 2, 3, 4], 5> = [1, 2, 3, 4, 5];
```
## Documentation

@@ -38,4 +56,4 @@

- [String utilities](docs/modules/string.StringUtils.md)
- [Math utilities](docs/modules/math.MathUtils.md)
- [Tuple utilities](docs/modules/tuple.TupleUtils.md)
- [String utilities](docs/modules/string.md)
- [Math utilities](docs/modules/math.md)
- [Tuple utilities](docs/modules/tuple.md)
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