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

@rimbu/deep

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rimbu/deep - npm Package Compare versions

Comparing version 0.8.2 to 0.9.0

7

dist/main/index.js
"use strict";
/**
* @packageDocumentation
*
* The `@rimbu/deep` package provides utilities to patch and match plain JavaScript objects..<br/>
* <br/>
* See the [Rimbu docs Deep overview page](/docs/deep/overview) for more information.
*/
Object.defineProperty(exports, "__esModule", { value: true });

@@ -3,0 +10,0 @@ var tslib_1 = require("tslib");

@@ -15,4 +15,6 @@ "use strict";

* @example
* ```ts
* matchAll({ g: { h: 'abc' }})({ g: { h: 'a' }}) => false
* matchAll({ g: { h: 'abc' }})({ g: { h: v => v.length > 1 }}) => true
* ```
*/

@@ -51,4 +53,6 @@ function all(value) {

* @example
* ```ts
* matchAny({ g: { h: 'abc' }})({ g: { h: 'a' }}, { g: { h: v => v.length < 2 }}) => false
* matchAny({ g: { h: 'abc' }})({ g: { h: 'a' }}, { g: { h: v => v.length > 1 }}) => true
* ```
*/

@@ -88,2 +92,3 @@ function any(value) {

* @example
* ```ts
* type Person = { name: string, age: number }

@@ -98,2 +103,3 @@ * const m = Match.createAll<Person>({ age: v => v > 20 }, { name: v => v.length > 2 })

* // => false
* ```
*/

@@ -115,2 +121,3 @@ function createAll() {

* @example
* ```ts
* type Person = { name: string, age: number }

@@ -127,2 +134,3 @@ * const m = Match.createAny<Person>({ age: v => v > 20 }, { name: v => v.length > 2 })

* // => false
* ```
*/

@@ -129,0 +137,0 @@ function createAny() {

4

dist/main/patch.js

@@ -14,2 +14,3 @@ "use strict";

* @example
* ```ts
* patch({ g: { h: 5 }})({ g: { h: 6 }}) // => { g: { h: 6 }}

@@ -21,2 +22,3 @@ * patch({ g: { h: 5 }})({ g: { h: v => v + 1 }}) // => { g: { h: 6 }}

* // => { a: 3, b: 4 }
* ```
*/

@@ -58,5 +60,7 @@ function patch(value) {

* @example
* ```ts
* const r = Patch.create<{ a: number, b: number }>({ b: v => v + 1 })({ a: 1, b: 2})
* console.log(r)
* // => { a: 1, b: 3 }
* ```
*/

@@ -63,0 +67,0 @@ function create() {

@@ -15,2 +15,3 @@ "use strict";

* @example
* ```ts
* console.log(Path.getValue({ a: { b: { c: 5 } } }), 'a.b')

@@ -20,2 +21,3 @@ * // => { c: 5 }

* // => 5
* ```
*/

@@ -48,3 +50,5 @@ function getValue(source, path) {

* @example
* ```ts
* console.log(Path.setValue({ a: { b: { c: 5 } } }))
* ```
*/

@@ -85,4 +89,6 @@ function setValue(source, path, value) {

* @example
* ```ts
* console.log(Path.setValue({ a: { b: { c: 5 } } }, 'a.b.c', 8)
* // => { a: { b: { c: 8 } } }
* ```
*/

@@ -89,0 +95,0 @@ function patchValue(source, path) {

@@ -12,4 +12,6 @@ "use strict";

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* // type of t => Tuple<[number, string, boolean]>
* ```
*/

@@ -29,5 +31,7 @@ function of() {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.getIndex(t, 1))
* // => 'a'
* ```
*/

@@ -42,5 +46,7 @@ function getIndex(tuple, index) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.first(t))
* // => 1
* ```
*/

@@ -55,5 +61,7 @@ function first(tuple) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.second(t))
* // => 'a'
* ```
*/

@@ -68,5 +76,7 @@ function second(tuple) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.last(t))
* // => true
* ```
*/

@@ -84,5 +94,7 @@ function last(tuple) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.updateAt(t, 1, 'b'))
* // => [1, 'b', true]
* ```
*/

@@ -98,5 +110,7 @@ function updateAt(tuple, index, updater) {

* @example
* ```ts
* const t = Tuple.of(1, 'a')
* console.log(Tuple.append(t, true, 5))
* // => [1, 'a', true, 5]
* ```
*/

@@ -117,2 +131,3 @@ function append(tuple) {

* @example
* ```ts
* const t1 = Tuple.of(1, 'a')

@@ -122,2 +137,3 @@ * const t2 = Tuple.of(true, 5)

* // => [1, 'a', true, 5]
* ```
*/

@@ -132,5 +148,7 @@ function concat(tuple1, tuple2) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.init(t))
* // => [1, 'a']
* ```
*/

@@ -145,5 +163,7 @@ function init(tuple) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.tail(t))
* // => ['a', true]
* ```
*/

@@ -150,0 +170,0 @@ function tail(tuple) {

@@ -0,2 +1,9 @@

/**
* @packageDocumentation
*
* The `@rimbu/deep` package provides utilities to patch and match plain JavaScript objects..<br/>
* <br/>
* See the [Rimbu docs Deep overview page](/docs/deep/overview) for more information.
*/
export * from './internal';
//# sourceMappingURL=index.js.map

@@ -11,4 +11,6 @@ import { RimbuError } from '@rimbu/base';

* @example
* ```ts
* matchAll({ g: { h: 'abc' }})({ g: { h: 'a' }}) => false
* matchAll({ g: { h: 'abc' }})({ g: { h: v => v.length > 1 }}) => true
* ```
*/

@@ -32,4 +34,6 @@ function all(value) {

* @example
* ```ts
* matchAny({ g: { h: 'abc' }})({ g: { h: 'a' }}, { g: { h: v => v.length < 2 }}) => false
* matchAny({ g: { h: 'abc' }})({ g: { h: 'a' }}, { g: { h: v => v.length > 1 }}) => true
* ```
*/

@@ -54,2 +58,3 @@ function any(value) {

* @example
* ```ts
* type Person = { name: string, age: number }

@@ -64,2 +69,3 @@ * const m = Match.createAll<Person>({ age: v => v > 20 }, { name: v => v.length > 2 })

* // => false
* ```
*/

@@ -77,2 +83,3 @@ function createAll(...matches) {

* @example
* ```ts
* type Person = { name: string, age: number }

@@ -89,2 +96,3 @@ * const m = Match.createAny<Person>({ age: v => v > 20 }, { name: v => v.length > 2 })

* // => false
* ```
*/

@@ -91,0 +99,0 @@ function createAny(...matches) {

@@ -10,2 +10,3 @@ import { RimbuError } from '@rimbu/base';

* @example
* ```ts
* patch({ g: { h: 5 }})({ g: { h: 6 }}) // => { g: { h: 6 }}

@@ -17,2 +18,3 @@ * patch({ g: { h: 5 }})({ g: { h: v => v + 1 }}) // => { g: { h: 6 }}

* // => { a: 3, b: 4 }
* ```
*/

@@ -38,5 +40,7 @@ export function patch(value) {

* @example
* ```ts
* const r = Patch.create<{ a: number, b: number }>({ b: v => v + 1 })({ a: 1, b: 2})
* console.log(r)
* // => { a: 1, b: 3 }
* ```
*/

@@ -43,0 +47,0 @@ function create(...patches) {

@@ -11,2 +11,3 @@ import { patch } from './internal';

* @example
* ```ts
* console.log(Path.getValue({ a: { b: { c: 5 } } }), 'a.b')

@@ -16,2 +17,3 @@ * // => { c: 5 }

* // => 5
* ```
*/

@@ -33,3 +35,5 @@ function getValue(source, path) {

* @example
* ```ts
* console.log(Path.setValue({ a: { b: { c: 5 } } }))
* ```
*/

@@ -59,4 +63,6 @@ function setValue(source, path, value) {

* @example
* ```ts
* console.log(Path.setValue({ a: { b: { c: 5 } } }, 'a.b.c', 8)
* // => { a: { b: { c: 8 } } }
* ```
*/

@@ -63,0 +69,0 @@ function patchValue(source, path, ...patches) {

@@ -8,4 +8,6 @@ import { Arr } from '@rimbu/base';

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* // type of t => Tuple<[number, string, boolean]>
* ```
*/

@@ -21,5 +23,7 @@ function of(...values) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.getIndex(t, 1))
* // => 'a'
* ```
*/

@@ -34,5 +38,7 @@ function getIndex(tuple, index) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.first(t))
* // => 1
* ```
*/

@@ -47,5 +53,7 @@ function first(tuple) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.second(t))
* // => 'a'
* ```
*/

@@ -60,5 +68,7 @@ function second(tuple) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.last(t))
* // => true
* ```
*/

@@ -76,5 +86,7 @@ function last(tuple) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.updateAt(t, 1, 'b'))
* // => [1, 'b', true]
* ```
*/

@@ -90,5 +102,7 @@ function updateAt(tuple, index, updater) {

* @example
* ```ts
* const t = Tuple.of(1, 'a')
* console.log(Tuple.append(t, true, 5))
* // => [1, 'a', true, 5]
* ```
*/

@@ -105,2 +119,3 @@ function append(tuple, ...values) {

* @example
* ```ts
* const t1 = Tuple.of(1, 'a')

@@ -110,2 +125,3 @@ * const t2 = Tuple.of(true, 5)

* // => [1, 'a', true, 5]
* ```
*/

@@ -120,5 +136,7 @@ function concat(tuple1, tuple2) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.init(t))
* // => [1, 'a']
* ```
*/

@@ -133,5 +151,7 @@ function init(tuple) {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.tail(t))
* // => ['a', true]
* ```
*/

@@ -138,0 +158,0 @@ function tail(tuple) {

@@ -0,1 +1,8 @@

/**
* @packageDocumentation
*
* The `@rimbu/deep` package provides utilities to patch and match plain JavaScript objects..<br/>
* <br/>
* See the [Rimbu docs Deep overview page](/docs/deep/overview) for more information.
*/
export * from './internal';

@@ -50,4 +50,6 @@ import type { ArrayNonEmpty } from '@rimbu/common';

* @example
* ```ts
* matchAll({ g: { h: 'abc' }})({ g: { h: 'a' }}) => false
* matchAll({ g: { h: 'abc' }})({ g: { h: v => v.length > 1 }}) => true
* ```
*/

@@ -61,4 +63,6 @@ function all<T>(value: T): (...matchers: Match.Multi<T>) => boolean;

* @example
* ```ts
* matchAny({ g: { h: 'abc' }})({ g: { h: 'a' }}, { g: { h: v => v.length < 2 }}) => false
* matchAny({ g: { h: 'abc' }})({ g: { h: 'a' }}, { g: { h: v => v.length > 1 }}) => true
* ```
*/

@@ -73,2 +77,3 @@ function any<T>(value: T): (...matchers: Match.Multi<T>) => boolean;

* @example
* ```ts
* type Person = { name: string, age: number }

@@ -83,2 +88,3 @@ * const m = Match.createAll<Person>({ age: v => v > 20 }, { name: v => v.length > 2 })

* // => false
* ```
*/

@@ -93,2 +99,3 @@ function createAll<T, T2 extends T = T>(...matches: Match.Multi<T2>): (value: T) => boolean;

* @example
* ```ts
* type Person = { name: string, age: number }

@@ -105,2 +112,3 @@ * const m = Match.createAny<Person>({ age: v => v > 20 }, { name: v => v.length > 2 })

* // => false
* ```
*/

@@ -107,0 +115,0 @@ function createAny<T, T2 extends T = T>(...matches: Match.Multi<T2>): (value: T) => boolean;

@@ -18,2 +18,3 @@ import type { ArrayNonEmpty } from '@rimbu/common';

* @example
* ```ts
* patch({ g: { h: 5 }})({ g: { h: 6 }}) // => { g: { h: 6 }}

@@ -25,2 +26,3 @@ * patch({ g: { h: 5 }})({ g: { h: v => v + 1 }}) // => { g: { h: 6 }}

* // => { a: 3, b: 4 }
* ```
*/

@@ -71,5 +73,7 @@ export declare function patch<T>(value: T): (...patches: Patch.Multi<T>) => T;

* @example
* ```ts
* const r = Patch.create<{ a: number, b: number }>({ b: v => v + 1 })({ a: 1, b: 2})
* console.log(r)
* // => { a: 1, b: 3 }
* ```
*/

@@ -76,0 +80,0 @@ function create<T, T2 extends T = T>(...patches: Patch.Multi<T2>): (value: T) => T;

@@ -6,3 +6,5 @@ import { Literal, Patch } from './internal';

* @example
* ```ts
* const p: Path<{ a: { b: { c : 5 }}}> = 'a.b'
* ```
*/

@@ -18,4 +20,6 @@ export declare type Path<T> = T extends Literal.Obj ? {

* @example
* ```ts
* let r!: Path.Result<{ a: { b: { c: number } } }, 'a.b'>;
* // => type of r: { c: number }
* ```
*/

@@ -30,2 +34,3 @@ type Result<T, P extends Path<T> = Path<T>> = T extends Record<string, unknown> ? P extends `${infer Head}.${infer Rest}` ? Head extends keyof T ? Path.Result<T[Head], Rest & Path<T[Head]>> : never : P extends `${infer K}` ? T[K] : never : never;

* @example
* ```ts
* console.log(Path.getValue({ a: { b: { c: 5 } } }), 'a.b')

@@ -35,2 +40,3 @@ * // => { c: 5 }

* // => 5
* ```
*/

@@ -44,3 +50,5 @@ function getValue<T, P extends Path<T> = Path<T>>(source: T, path: P): Path.Result<T, P>;

* @example
* ```ts
* console.log(Path.setValue({ a: { b: { c: 5 } } }))
* ```
*/

@@ -55,6 +63,8 @@ function setValue<T, P extends Path<T> = Path<T>>(source: T, path: P, value: Path.Result<T, P>): T;

* @example
* ```ts
* console.log(Path.setValue({ a: { b: { c: 5 } } }, 'a.b.c', 8)
* // => { a: { b: { c: 8 } } }
* ```
*/
function patchValue<T, P extends Path<T> = Path<T>>(source: T, path: P, ...patches: Patch.Multi<Path.Result<T, P>>): T;
}

@@ -19,4 +19,6 @@ import type { Update } from '@rimbu/common';

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* // type of t => Tuple<[number, string, boolean]>
* ```
*/

@@ -29,5 +31,7 @@ function of<T extends Tuple.NonEmptySource>(...values: T): Tuple<T>;

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.getIndex(t, 1))
* // => 'a'
* ```
*/

@@ -39,5 +43,7 @@ function getIndex<T extends Tuple.Source, K extends keyof T = keyof T>(tuple: T, index: K): T[K];

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.first(t))
* // => 1
* ```
*/

@@ -49,5 +55,7 @@ function first<T extends Tuple.Source>(tuple: T): T[0];

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.second(t))
* // => 'a'
* ```
*/

@@ -59,5 +67,7 @@ function second<T extends Tuple.Source>(tuple: T): T[1];

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.last(t))
* // => true
* ```
*/

@@ -72,5 +82,7 @@ function last<T extends readonly unknown[], R>(tuple: readonly [...T, R]): R;

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.updateAt(t, 1, 'b'))
* // => [1, 'b', true]
* ```
*/

@@ -83,5 +95,7 @@ function updateAt<T extends Tuple.Source, K extends keyof T = keyof T>(tuple: T, index: K, updater: Update<T[K]>): T;

* @example
* ```ts
* const t = Tuple.of(1, 'a')
* console.log(Tuple.append(t, true, 5))
* // => [1, 'a', true, 5]
* ```
*/

@@ -95,2 +109,3 @@ function append<T extends Tuple.Source, V extends readonly [unknown, ...unknown[]]>(tuple: T, ...values: V): readonly [...T, ...V];

* @example
* ```ts
* const t1 = Tuple.of(1, 'a')

@@ -100,2 +115,3 @@ * const t2 = Tuple.of(true, 5)

* // => [1, 'a', true, 5]
* ```
*/

@@ -107,5 +123,7 @@ function concat<T1 extends Tuple.Source, T2 extends Tuple.Source>(tuple1: T1, tuple2: T2): readonly [...T1, ...T2];

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.init(t))
* // => [1, 'a']
* ```
*/

@@ -117,7 +135,9 @@ function init<T extends readonly unknown[]>(tuple: readonly [...T, unknown]): Readonly<T>;

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.tail(t))
* // => ['a', true]
* ```
*/
function tail<T extends readonly [...unknown[]]>(tuple: readonly [unknown, ...T]): Readonly<T>;
}

12

package.json
{
"name": "@rimbu/deep",
"version": "0.8.2",
"version": "0.9.0",
"description": "Tools to use handle plain JS objects as immutable objects",

@@ -43,3 +43,3 @@ "keywords": [

"build": "yarn clean && yarn bundle",
"build:deno": "rimraf deno_dist ../../deno_dist/deep && denoify && cp ../../config/mod_ts_template deno_dist/mod.ts && mv deno_dist ../../deno_dist/deep",
"build:deno": "rimraf deno_dist ../../deno_dist/deep && denoify && mv deno_dist ../../deno_dist/deep",
"bundle": "yarn bundle:main && yarn bundle:module && yarn bundle:types",

@@ -50,2 +50,3 @@ "bundle:main": "tsc --p tsconfig.main.json",

"clean": "rimraf dist",
"extract-api": "api-extractor run --local --verbose --config config/api-extractor.main.json",
"format": "yarn format:base --write",

@@ -61,4 +62,4 @@ "format:base": "prettier \"{!CHANGELOG.md}|**/**/*.{ts,tsx,js,json,md}\"",

"dependencies": {
"@rimbu/base": "^0.7.2",
"@rimbu/common": "^0.8.2",
"@rimbu/base": "^0.8.0",
"@rimbu/common": "^0.9.0",
"tslib": "^2.3.1"

@@ -70,5 +71,6 @@ },

"denoify": {
"index": "src/index.ts",
"replacer": "../../config/denoify-rimbu-replacer.js"
},
"gitHead": "1594b907f4dbbd994a52f0e2e94ffd9217420ff5"
"gitHead": "7c60bf40f3479524fa9d603a75b33f914d2feb28"
}

@@ -0,1 +1,9 @@

/**
* @packageDocumentation
*
* The `@rimbu/deep` package provides utilities to patch and match plain JavaScript objects..<br/>
* <br/>
* See the [Rimbu docs Deep overview page](/docs/deep/overview) for more information.
*/
export * from './internal';

@@ -72,4 +72,6 @@ import { RimbuError } from '@rimbu/base';

* @example
* ```ts
* matchAll({ g: { h: 'abc' }})({ g: { h: 'a' }}) => false
* matchAll({ g: { h: 'abc' }})({ g: { h: v => v.length > 1 }}) => true
* ```
*/

@@ -94,4 +96,6 @@ export function all<T>(value: T): (...matchers: Match.Multi<T>) => boolean {

* @example
* ```ts
* matchAny({ g: { h: 'abc' }})({ g: { h: 'a' }}, { g: { h: v => v.length < 2 }}) => false
* matchAny({ g: { h: 'abc' }})({ g: { h: 'a' }}, { g: { h: v => v.length > 1 }}) => true
* ```
*/

@@ -117,2 +121,3 @@ export function any<T>(value: T): (...matchers: Match.Multi<T>) => boolean {

* @example
* ```ts
* type Person = { name: string, age: number }

@@ -127,2 +132,3 @@ * const m = Match.createAll<Person>({ age: v => v > 20 }, { name: v => v.length > 2 })

* // => false
* ```
*/

@@ -142,2 +148,3 @@ export function createAll<T, T2 extends T = T>(

* @example
* ```ts
* type Person = { name: string, age: number }

@@ -154,2 +161,3 @@ * const m = Match.createAny<Person>({ age: v => v > 20 }, { name: v => v.length > 2 })

* // => false
* ```
*/

@@ -156,0 +164,0 @@ export function createAny<T, T2 extends T = T>(

@@ -26,2 +26,3 @@ import { RimbuError } from '@rimbu/base';

* @example
* ```ts
* patch({ g: { h: 5 }})({ g: { h: 6 }}) // => { g: { h: 6 }}

@@ -33,2 +34,3 @@ * patch({ g: { h: 5 }})({ g: { h: v => v + 1 }}) // => { g: { h: 6 }}

* // => { a: 3, b: 4 }
* ```
*/

@@ -105,5 +107,7 @@ export function patch<T>(value: T): (...patches: Patch.Multi<T>) => T {

* @example
* ```ts
* const r = Patch.create<{ a: number, b: number }>({ b: v => v + 1 })({ a: 1, b: 2})
* console.log(r)
* // => { a: 1, b: 3 }
* ```
*/

@@ -110,0 +114,0 @@ export function create<T, T2 extends T = T>(

@@ -7,3 +7,5 @@ import { Literal, patch, Patch } from './internal';

* @example
* ```ts
* const p: Path<{ a: { b: { c : 5 }}}> = 'a.b'
* ```
*/

@@ -20,4 +22,6 @@ export type Path<T> = T extends Literal.Obj

* @example
* ```ts
* let r!: Path.Result<{ a: { b: { c: number } } }, 'a.b'>;
* // => type of r: { c: number }
* ```
*/

@@ -44,2 +48,3 @@ export type Result<T, P extends Path<T> = Path<T>> = T extends Record<

* @example
* ```ts
* console.log(Path.getValue({ a: { b: { c: 5 } } }), 'a.b')

@@ -49,2 +54,3 @@ * // => { c: 5 }

* // => 5
* ```
*/

@@ -72,3 +78,5 @@ export function getValue<T, P extends Path<T> = Path<T>>(

* @example
* ```ts
* console.log(Path.setValue({ a: { b: { c: 5 } } }))
* ```
*/

@@ -108,4 +116,6 @@ export function setValue<T, P extends Path<T> = Path<T>>(

* @example
* ```ts
* console.log(Path.setValue({ a: { b: { c: 5 } } }, 'a.b.c', 8)
* // => { a: { b: { c: 8 } } }
* ```
*/

@@ -112,0 +122,0 @@ export function patchValue<T, P extends Path<T> = Path<T>>(

@@ -24,4 +24,6 @@ import { Arr } from '@rimbu/base';

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* // type of t => Tuple<[number, string, boolean]>
* ```
*/

@@ -37,5 +39,7 @@ export function of<T extends Tuple.NonEmptySource>(...values: T): Tuple<T> {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.getIndex(t, 1))
* // => 'a'
* ```
*/

@@ -53,5 +57,7 @@ export function getIndex<T extends Tuple.Source, K extends keyof T = keyof T>(

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.first(t))
* // => 1
* ```
*/

@@ -66,5 +72,7 @@ export function first<T extends Tuple.Source>(tuple: T): T[0] {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.second(t))
* // => 'a'
* ```
*/

@@ -79,5 +87,7 @@ export function second<T extends Tuple.Source>(tuple: T): T[1] {

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.last(t))
* // => true
* ```
*/

@@ -97,5 +107,7 @@ export function last<T extends readonly unknown[], R>(

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.updateAt(t, 1, 'b'))
* // => [1, 'b', true]
* ```
*/

@@ -115,5 +127,7 @@ export function updateAt<T extends Tuple.Source, K extends keyof T = keyof T>(

* @example
* ```ts
* const t = Tuple.of(1, 'a')
* console.log(Tuple.append(t, true, 5))
* // => [1, 'a', true, 5]
* ```
*/

@@ -133,2 +147,3 @@ export function append<

* @example
* ```ts
* const t1 = Tuple.of(1, 'a')

@@ -138,2 +153,3 @@ * const t2 = Tuple.of(true, 5)

* // => [1, 'a', true, 5]
* ```
*/

@@ -151,5 +167,7 @@ export function concat<T1 extends Tuple.Source, T2 extends Tuple.Source>(

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.init(t))
* // => [1, 'a']
* ```
*/

@@ -166,5 +184,7 @@ export function init<T extends readonly unknown[]>(

* @example
* ```ts
* const t = Tuple.of(1, 'a', true)
* console.log(Tuple.tail(t))
* // => ['a', true]
* ```
*/

@@ -171,0 +191,0 @@ export function tail<T extends readonly [...unknown[]]>(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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