@blake.regalia/belt
Advanced tools
Comparing version 0.22.1 to 0.23.0
@@ -1,2 +0,2 @@ | ||
import type { A } from 'ts-toolbelt'; | ||
import type { Subtype } from './types'; | ||
/** | ||
@@ -9,15 +9,15 @@ * An integer string | ||
*/ | ||
export type NaiveBase58 = A.Type<string, 'base58'>; | ||
export type NaiveBase58 = Subtype<string, 'base58'>; | ||
/** | ||
* Base64 string | ||
*/ | ||
export type NaiveBase64 = A.Type<string, 'base64'>; | ||
export type NaiveBase64 = Subtype<string, 'base64'>; | ||
/** | ||
* Base93 string | ||
*/ | ||
export type NaiveBase93 = A.Type<string, 'base93'>; | ||
export type NaiveBase93 = Subtype<string, 'base93'>; | ||
/** | ||
* Base222 string | ||
*/ | ||
export type NaiveBase222 = A.Type<string, 'base222'>; | ||
export type NaiveBase222 = Subtype<string, 'base222'>; | ||
interface HexMethods { | ||
@@ -38,11 +38,11 @@ toLowerCase(): NaiveHexLower; | ||
*/ | ||
export type NaiveHexLower<s_subtype extends string = string> = A.Type<HexLowerMethods & s_subtype, 'hex-lower'>; | ||
export type NaiveHexLower<s_subtype extends string = string> = Subtype<HexLowerMethods & s_subtype, 'hex-lower'>; | ||
/** | ||
* Hexadecimal-encoded bytes in uppercase | ||
*/ | ||
export type NaiveHexUpper<s_subtype extends string = string> = A.Type<HexUpperMethods & s_subtype, 'hex-upper'>; | ||
export type NaiveHexUpper<s_subtype extends string = string> = Subtype<HexUpperMethods & s_subtype, 'hex-upper'>; | ||
/** | ||
* Hexadecimal-encoded bytes in mixed case | ||
*/ | ||
export type NaiveHexMixed<s_subtype extends string = string> = A.Type<HexMethods & s_subtype, 'hex-lower' | 'hex-upper'>; | ||
export type NaiveHexMixed<s_subtype extends string = string> = Subtype<HexMethods & s_subtype, 'hex-lower' | 'hex-upper'>; | ||
export {}; |
import type { A } from 'ts-toolbelt'; | ||
export declare const TYPE_ID: unique symbol; | ||
export declare const ES_TYPE: unique symbol; | ||
/** | ||
* Create subtype on any type using intersection. Can be removed later using {@link Unsubtype} | ||
*/ | ||
export type Subtype<w_type, w_id> = { | ||
[TYPE_ID]: w_id; | ||
[ES_TYPE]: w_type; | ||
} & w_type; | ||
/** | ||
* Removes subtype | ||
*/ | ||
export type Unsubtype<w_type> = w_type extends { | ||
[ES_TYPE]: infer w_actual; | ||
} ? w_actual : never; | ||
/** | ||
* Shortcut for a very common type pattern | ||
@@ -29,3 +44,3 @@ */ | ||
*/ | ||
export type NaiveJsonString<s_subtype extends string = string> = A.Type<s_subtype, 'json'>; | ||
export type NaiveJsonString<s_subtype extends string = string> = Subtype<s_subtype, 'json'>; | ||
/** | ||
@@ -32,0 +47,0 @@ * Root type for all objects considered to be parsed JSON objects |
@@ -1,2 +0,2 @@ | ||
import type { A } from 'ts-toolbelt'; | ||
import type { Subtype } from './types'; | ||
/** | ||
@@ -9,15 +9,15 @@ * An integer string | ||
*/ | ||
export type NaiveBase58 = A.Type<string, 'base58'>; | ||
export type NaiveBase58 = Subtype<string, 'base58'>; | ||
/** | ||
* Base64 string | ||
*/ | ||
export type NaiveBase64 = A.Type<string, 'base64'>; | ||
export type NaiveBase64 = Subtype<string, 'base64'>; | ||
/** | ||
* Base93 string | ||
*/ | ||
export type NaiveBase93 = A.Type<string, 'base93'>; | ||
export type NaiveBase93 = Subtype<string, 'base93'>; | ||
/** | ||
* Base222 string | ||
*/ | ||
export type NaiveBase222 = A.Type<string, 'base222'>; | ||
export type NaiveBase222 = Subtype<string, 'base222'>; | ||
interface HexMethods { | ||
@@ -38,11 +38,11 @@ toLowerCase(): NaiveHexLower; | ||
*/ | ||
export type NaiveHexLower<s_subtype extends string = string> = A.Type<HexLowerMethods & s_subtype, 'hex-lower'>; | ||
export type NaiveHexLower<s_subtype extends string = string> = Subtype<HexLowerMethods & s_subtype, 'hex-lower'>; | ||
/** | ||
* Hexadecimal-encoded bytes in uppercase | ||
*/ | ||
export type NaiveHexUpper<s_subtype extends string = string> = A.Type<HexUpperMethods & s_subtype, 'hex-upper'>; | ||
export type NaiveHexUpper<s_subtype extends string = string> = Subtype<HexUpperMethods & s_subtype, 'hex-upper'>; | ||
/** | ||
* Hexadecimal-encoded bytes in mixed case | ||
*/ | ||
export type NaiveHexMixed<s_subtype extends string = string> = A.Type<HexMethods & s_subtype, 'hex-lower' | 'hex-upper'>; | ||
export type NaiveHexMixed<s_subtype extends string = string> = Subtype<HexMethods & s_subtype, 'hex-lower' | 'hex-upper'>; | ||
export {}; |
import type { A } from 'ts-toolbelt'; | ||
export declare const TYPE_ID: unique symbol; | ||
export declare const ES_TYPE: unique symbol; | ||
/** | ||
* Create subtype on any type using intersection. Can be removed later using {@link Unsubtype} | ||
*/ | ||
export type Subtype<w_type, w_id> = { | ||
[TYPE_ID]: w_id; | ||
[ES_TYPE]: w_type; | ||
} & w_type; | ||
/** | ||
* Removes subtype | ||
*/ | ||
export type Unsubtype<w_type> = w_type extends { | ||
[ES_TYPE]: infer w_actual; | ||
} ? w_actual : never; | ||
/** | ||
* Shortcut for a very common type pattern | ||
@@ -29,3 +44,3 @@ */ | ||
*/ | ||
export type NaiveJsonString<s_subtype extends string = string> = A.Type<s_subtype, 'json'>; | ||
export type NaiveJsonString<s_subtype extends string = string> = Subtype<s_subtype, 'json'>; | ||
/** | ||
@@ -32,0 +47,0 @@ * Root type for all objects considered to be parsed JSON objects |
{ | ||
"name": "@blake.regalia/belt", | ||
"version": "0.22.1", | ||
"version": "0.23.0", | ||
"repository": "github:blake-regalia/belt", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
204977
3982