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

@kakasoo/proto-typescript

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kakasoo/proto-typescript - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

dist/prototypes/array.prototype.d.ts

9

dist/index.d.ts

@@ -1,7 +0,4 @@

export * from "./array.prototype";
export * from "./boolean.prototype";
export * from "./number.prototype";
export * from "./object.prototype";
export * from "./string.prototype";
export * from "./types";
export * from './prototypes';
export * from './types';
export * from './typed-array.class';
//# sourceMappingURL=index.d.ts.map

@@ -17,8 +17,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./array.prototype"), exports);
__exportStar(require("./boolean.prototype"), exports);
__exportStar(require("./number.prototype"), exports);
__exportStar(require("./object.prototype"), exports);
__exportStar(require("./string.prototype"), exports);
__exportStar(require("./prototypes"), exports);
__exportStar(require("./types"), exports);
__exportStar(require("./typed-array.class"), exports);
//# sourceMappingURL=index.js.map

@@ -1,13 +0,13 @@

import { Length } from "./array.type";
import { Split } from "./string.type";
import { Length } from './array.type';
import { Split } from './string.type';
export interface StringToNumberMap {
"0": 0;
"1": 1;
"2": 2;
"3": 3;
"5": 5;
"6": 6;
"7": 7;
"8": 8;
"9": 9;
'0': 0;
'1': 1;
'2': 2;
'3': 3;
'5': 5;
'6': 6;
'7': 7;
'8': 8;
'9': 9;
}

@@ -14,0 +14,0 @@ /**

@@ -1,4 +0,4 @@

import { Add, Divide, Multiply, NToNumber, Remainder, Sub } from "./number.type";
import { Equal, Merge } from "./object.type";
export type Length<T extends any[]> = T["length"];
import { Add, Divide, Multiply, NToNumber, Remainder, Sub } from './number.type';
import { Equal, Merge } from './object.type';
export type Length<T extends any[]> = T['length'];
/**

@@ -11,3 +11,3 @@ * ν˜„μž¬ νŠœν”Œ ν˜•νƒœμ— μƒˆλ‘œμš΄ νƒ€μž… ν•˜λ‚˜λ₯Ό μΆ”κ°€ν•˜λŠ” νƒ€μž…

export type Push<T extends any[], V> = [...T, V];
export type NTuple<N extends number, T extends any[] = []> = T["length"] extends N ? T : NTuple<N, Push<T, any>>;
export type NTuple<N extends number, T extends any[] = []> = T['length'] extends N ? T : NTuple<N, Push<T, any>>;
/**

@@ -19,5 +19,3 @@ * N1 * N2 크기의 NTuple을 λ°˜ν™˜ν•˜λŠ” νƒ€μž…μœΌλ‘œ, μ΅œμ ν™”λ₯Ό μœ„ν•΄ N1, N2 숫자λ₯Ό λΉ„κ΅ν•˜λŠ” 과정이 ν¬ν•¨λœ νƒ€μž…

*/
export type NNTuple<N1 extends number, N2 extends number> = [
Sub<N1, N2>
] extends [never] ? Sub<N1, 1> extends never ? [] : [...NNTuple<Sub<N1, 1>, N2>, ...NTuple<N2>] : Sub<N2, 1> extends never ? [] : [...NNTuple<Sub<N2, 1>, N1>, ...NTuple<N1>];
export type NNTuple<N1 extends number, N2 extends number> = [Sub<N1, N2>] extends [never] ? Sub<N1, 1> extends never ? [] : [...NNTuple<Sub<N1, 1>, N2>, ...NTuple<N2>] : Sub<N2, 1> extends never ? [] : [...NNTuple<Sub<N2, 1>, N1>, ...NTuple<N1>];
/**

@@ -27,13 +25,10 @@ * Returns matching A to matching B in tuple form.

*/
export type Slice<T extends any[], A extends any, B extends any, CONDITION extends boolean = false> = T extends [infer X, ...infer Rest] ? CONDITION extends true ? X extends B ? [X, ...Slice<Rest, A, B, false>] : [X, ...Slice<Rest, A, B, true>] : X extends A ? X extends B ? [X, ...Slice<Rest, A, B, false>] : [X, ...Slice<Rest, A, B, true>] : Slice<Rest, A, B, false> : CONDITION extends true ? never : [];
export type Slice<T extends any[], A extends any, B extends any, CONDITION extends boolean = false> = T extends [
infer X,
...infer Rest
] ? CONDITION extends true ? X extends B ? [X, ...Slice<Rest, A, B, false>] : [X, ...Slice<Rest, A, B, true>] : X extends A ? X extends B ? [X, ...Slice<Rest, A, B, false>] : [X, ...Slice<Rest, A, B, true>] : Slice<Rest, A, B, false> : CONDITION extends true ? never : [];
export type Take<T extends any[], P extends number, R extends any[] = []> = Length<R> extends P ? R : T extends [infer F, ...infer Rest] ? Take<Rest, P, Push<R, F>> : never;
export type TupleIncludes<T extends readonly any[], U> = T extends [
infer P,
...infer R
] ? Equal<U, P> extends true ? true : TupleIncludes<R, U> : false;
export type TupleIncludes<T extends readonly any[], U> = T extends [infer P, ...infer R] ? Equal<U, P> extends true ? true : TupleIncludes<R, U> : false;
export type TupleToUnion<T extends NTuple<number>> = T[number];
export type EntriesToObject<T extends Array<NTuple<2>>> = T extends [
infer F,
...infer Rest
] ? F extends [infer K extends string, infer V] ? Rest extends NTuple<2>[] ? Merge<Record<K, V>, EntriesToObject<Rest>> : never : never : {};
export type EntriesToObject<T extends Array<NTuple<2>>> = T extends [infer F, ...infer Rest] ? F extends [infer K extends string, infer V] ? Rest extends NTuple<2>[] ? Merge<Record<K, V>, EntriesToObject<Rest>> : never : never : {};
export type ArrayToUnion<T extends any[]> = T[number];

@@ -43,3 +38,7 @@ /**

*/
export type PartitionByTwo<T extends any[], L extends number = Length<T>> = T extends [infer First, infer Second, ...infer Rest] ? [[First, Second], ...PartitionByTwo<Rest, Sub<L, 2>>] : [];
export type PartitionByTwo<T extends any[], L extends number = Length<T>> = T extends [
infer First,
infer Second,
...infer Rest
] ? [[First, Second], ...PartitionByTwo<Rest, Sub<L, 2>>] : [];
/**

@@ -50,11 +49,6 @@ * Join<['a', 'b', 'c']> // 'abc'

*/
export type Join<T extends readonly (string | number)[] | (string | number)[], U extends string = ","> = T extends readonly [
infer F extends string | number,
...infer Rest extends (string | number)[]
] ? Rest extends [] ? `${F}` : `${F}${U}${Join<Rest, U>}` : string;
export type Join<T extends readonly (string | number)[] | (string | number)[], U extends string = ','> = T extends readonly [infer F extends string | number, ...infer Rest extends (string | number)[]] ? Rest extends [] ? `${F}` : `${F}${U}${Join<Rest, U>}` : string;
export type IsTuple<T extends readonly any[] | {
length: number;
}> = [
T
] extends [never] ? false : T extends readonly any[] ? number extends T["length"] ? false : true : false;
}> = [T] extends [never] ? false : T extends readonly any[] ? number extends T['length'] ? false : true : false;
/**

@@ -76,6 +70,3 @@ * Reverse<[1,2,3]> // [3,2,1]

export type Pop<T extends any[]> = T extends [...infer Rest, infer Last] ? Rest : [];
export type Includes<T extends readonly any[], U> = T extends [
infer P,
...infer R
] ? Equal<U, P> extends true ? true : Includes<R, U> : false;
export type Includes<T extends readonly any[], U> = T extends [infer P, ...infer R] ? Equal<U, P> extends true ? true : Includes<R, U> : false;
/**

@@ -86,6 +77,3 @@ * νŠœν”Œμ—μ„œ 쀑볡 μš”μ†Œλ₯Ό μ œκ±°ν•˜λŠ” νƒ€μž…

*/
export type Distinct<T extends any[], P extends any[] = []> = T extends [
infer F,
...infer Rest
] ? Includes<P, F> extends false ? Distinct<Rest, [...P, F]> : Distinct<Rest, P> : P;
export type Distinct<T extends any[], P extends any[] = []> = T extends [infer F, ...infer Rest] ? Includes<P, F> extends false ? Distinct<Rest, [...P, F]> : Distinct<Rest, P> : P;
export type Compare<N1 extends number, N2 extends number> = N1 extends N2 ? true : [Sub<N1, N2>] extends [never] ? false : true;

@@ -104,13 +92,13 @@ export type BubbleSort<T extends any[], L extends number = Length<T>, ASC extends boolean = false> = L extends 1 ? T : T extends [infer F, infer S, ...infer Rest] ? BubbleSort<[

*/
export type Map<T extends readonly number[], OP extends "Add" | "Multiply" | "Sub" | "Divide" | "Remainder", N extends number> = OP extends "Add" ? {
export type Map<T extends readonly number[], OP extends 'Add' | 'Multiply' | 'Sub' | 'Divide' | 'Remainder', N extends number> = OP extends 'Add' ? {
[K in keyof T]: Add<T[K], N>;
} : OP extends "Multiply" ? {
} : OP extends 'Multiply' ? {
[K in keyof T]: Multiply<T[K], N>;
} : OP extends "Sub" ? {
} : OP extends 'Sub' ? {
[K in keyof T]: Sub<T[K], N>;
} : OP extends "Divide" ? {
} : OP extends 'Divide' ? {
[K in keyof T]: Divide<T[K], N>;
} : OP extends "Remainder" ? {
} : OP extends 'Remainder' ? {
[K in keyof T]: Remainder<T[K], N>;
} : never;
//# sourceMappingURL=array.type.d.ts.map

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

export * from "./arithmetic.type";
export * from "./array.type";
export * from "./function.type";
export * from "./never.type";
export * from "./object.type";
export * from "./string.type";
export * from "./union.type";
export * from './arithmetic.type';
export * from './array.type';
export * from './function.type';
export * from './never.type';
export * from './object.type';
export * from './string.type';
export * from './union.type';
//# sourceMappingURL=index.d.ts.map

@@ -1,22 +0,19 @@

import { ArrayToUnion, Length, NNTuple, NTuple, Push, TupleIncludes } from "./array.type";
import { ArrayToUnion, Length, NNTuple, NTuple, Push, TupleIncludes } from './array.type';
export type NToNumber<N> = N extends number ? N : never;
export type NToNumberTuple<N> = N extends number[] ? N : never;
export type Digits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
export type Digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
export type ToNumber<T> = T extends number ? T : never;
export type Add<N1 extends number, N2 extends number> = [
...NTuple<N1>,
...NTuple<N2>
] extends [...infer U] ? Length<U> : never;
export type Sub<A extends number, B extends number> = NTuple<A> extends [
...infer U,
...NTuple<B>
] ? Length<U> : never;
export type Add<N1 extends number, N2 extends number> = [...NTuple<N1>, ...NTuple<N2>] extends [...infer U] ? Length<U> : never;
export type Sub<A extends number, B extends number> = NTuple<A> extends [...infer U, ...NTuple<B>] ? Length<U> : never;
export type IsDigit<T extends string> = TupleIncludes<Digits, T>;
export type NumberString<T extends number> = `${T}`;
export type ToNumberFromString<T extends string> = T extends NumberString<infer R> ? R : never;
export type LessThan<N extends number, T extends any[] = []> = T["length"] extends N ? T : LessThan<N, Push<T, T["length"]>>;
export type LessThan<N extends number, T extends any[] = []> = T['length'] extends N ? T : LessThan<N, Push<T, T['length']>>;
export type LessThanEqual<N extends number, T extends any[] = []> = LessThan<NToNumber<Add<N, 1>>>;
export type GaussSum<N1 extends number, K = ArrayToUnion<LessThanEqual<N1>>> = K extends number ? NTuple<K> : never;
export type Multiply<T1 extends number, T2 extends number> = Length<NNTuple<T1, T2>>;
export type Divide<T extends number, N extends number, Answer extends number = 0> = NTuple<T> extends [...NTuple<N>, ...infer Rest] ? Divide<Length<Rest>, N, NToNumber<Add<Answer, 1>>> : Answer;
export type Divide<T extends number, N extends number, Answer extends number = 0> = NTuple<T> extends [
...NTuple<N>,
...infer Rest
] ? Divide<Length<Rest>, N, NToNumber<Add<Answer, 1>>> : Answer;
export type Remainder<T extends number, N extends number> = Sub<T, NToNumber<Multiply<N, Divide<T, N>>>>;

@@ -23,0 +20,0 @@ /**

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

import { Sub } from "./number.type";
import { Sub } from './number.type';
export type ToStringTuple<T> = T extends string[] ? T : never;

@@ -10,4 +10,4 @@ export type ToString<T> = T extends string ? T : T extends number ? `${T}` : never;

*/
export type Repeat<T extends string, N extends number> = N extends 0 ? "" : `${T}${Repeat<T, Sub<N, 1>>}`;
export type ReplaceAll<S extends string, From extends string, To extends string> = From extends "" ? S : S extends From ? To : S extends `${From}${infer Rest}` ? `${To}${ReplaceAll<Rest, From, To>}` : S extends `${infer First}${From}${infer Last}` ? `${First}${To}${ReplaceAll<Last, From, To>}` : S extends `${infer First}${From}` ? `${First}${To}` : S;
export type Repeat<T extends string, N extends number> = N extends 0 ? '' : `${T}${Repeat<T, Sub<N, 1>>}`;
export type ReplaceAll<S extends string, From extends string, To extends string> = From extends '' ? S : S extends From ? To : S extends `${From}${infer Rest}` ? `${To}${ReplaceAll<Rest, From, To>}` : S extends `${infer First}${From}${infer Last}` ? `${First}${To}${ReplaceAll<Last, From, To>}` : S extends `${infer First}${From}` ? `${First}${To}` : S;
export type StringIncludes<T extends string, P extends string> = T extends `${string}${P}${string}` ? true : false;

@@ -14,0 +14,0 @@ /**

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

export type NotAUnion<T, U = T> = U extends any ? [T] extends [U] ? T : never : never;
export type NotAUnion<T, U = T> = U extends any ? ([T] extends [U] ? T : never) : never;
//# sourceMappingURL=union.type.d.ts.map
{
"name": "@kakasoo/proto-typescript",
"version": "1.0.3",
"publishConfig": {
"access": "public"
},
"description": "Utility types and implementations based on JavaScript prototypes.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"scripts": {
"build": "tsc",
"prepublish": "tsc",
"publish": "npm publish"
},
"keywords": [],
"author": "",
"license": "ISC"
"name": "@kakasoo/proto-typescript",
"version": "1.1.0",
"publishConfig": {
"access": "public"
},
"description": "Utility types and implementations based on JavaScript prototypes.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"scripts": {
"build": "tsc",
"prepublish": "tsc",
"publish": "npm publish",
"format": "prettier --write \"src/**/*.ts\""
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"prettier": "^3.1.0",
"typescript": "^5.3.3"
}
}

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