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

x-value

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

x-value - npm Package Compare versions

Comparing version 0.0.1-14 to 0.0.1-15

7

bld/library/@utils.d.ts

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

import type { ArrayType, AtomicType, IntersectionType, ObjectType, OptionalType, RecordType, RefinedType, TupleType, Type, UnionType } from './type';
import type { Denominalize, __nominalType } from './utils';
import type { ArrayType, AtomicType, Denominalize, IntersectionType, ObjectType, OptionalType, RecordType, RefinedType, TupleType, Type, UnionType, __nominal, __type } from './type';
export declare const hasOwnProperty: (v: PropertyKey) => boolean;

@@ -17,3 +16,3 @@ export declare const toString: () => string;

export declare type __RefinedMediumType<TType, TRefinement, TNominal, TMediumTypes> = __MediumTypeOf<TType, TMediumTypes> & TRefinement extends infer T ? unknown extends TNominal ? T : T & TNominal & {
[TNominalTypeSymbol in typeof __nominalType]: Denominalize<T>;
[TNominalTypeSymbol in typeof __type]: Denominalize<T>;
} : never;

@@ -36,4 +35,4 @@ export declare type __AtomicMediumType<TSymbol extends symbol, TMediumTypes> = TMediumTypes extends {

export declare type __NominalPartial = {
[TNominalTypeSymbol in typeof __nominalType]: unknown;
[TNominalSymbol in typeof __nominal]: unknown;
};
export declare function merge(partials: unknown[]): unknown;

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

import type { __ElementOrArray, __MediumTypeOf, __MediumTypesPackedType, __RefinedMediumType, __RefinedType } from '../@utils';
import type { __ElementOrArray, __MediumTypesPackedType, __RefinedMediumType, __RefinedType } from '../@utils';
import type { Medium } from '../medium';

@@ -7,5 +7,5 @@ import type { TypeConstraint } from './type';

refine<TNominalOrRefinement, TNominal = unknown>(constraints: __ElementOrArray<TypeConstraint<__RefinedMediumType<TType, TNominalOrRefinement, TNominal, XValue.Types>>>): __RefinedType<this, TNominalOrRefinement, TNominal>;
decode<TMediumTypes extends object>(medium: Medium<TMediumTypes>, value: __MediumTypesPackedType<TMediumTypes, __MediumTypeOf<TType, TMediumTypes> & TNominal>): __RefinedMediumType<TType, TRefinement, TNominal, XValue.Types>;
encode<TMediumTypes extends object>(medium: Medium<TMediumTypes>, value: __RefinedMediumType<TType, TRefinement, TNominal, XValue.Types>): __MediumTypesPackedType<TMediumTypes, __MediumTypeOf<TType, TMediumTypes> & TNominal>;
transform<TFromMediumTypes extends object, TToMediumTypes extends object>(from: Medium<TFromMediumTypes>, to: Medium<TToMediumTypes>, value: __MediumTypesPackedType<TFromMediumTypes, __MediumTypeOf<TType, TFromMediumTypes> & TNominal>): __MediumTypesPackedType<TToMediumTypes, __MediumTypeOf<TType, TToMediumTypes> & TNominal>;
decode<TMediumTypes extends object>(medium: Medium<TMediumTypes>, value: __MediumTypesPackedType<TMediumTypes, __RefinedMediumType<TType, TRefinement, TNominal, TMediumTypes>>): __RefinedMediumType<TType, TRefinement, TNominal, XValue.Types>;
encode<TMediumTypes extends object>(medium: Medium<TMediumTypes>, value: __RefinedMediumType<TType, TRefinement, TNominal, XValue.Types>): __MediumTypesPackedType<TMediumTypes, __RefinedMediumType<TType, TRefinement, TNominal, TMediumTypes>>;
transform<TFromMediumTypes extends object, TToMediumTypes extends object>(from: Medium<TFromMediumTypes>, to: Medium<TToMediumTypes>, value: __MediumTypesPackedType<TFromMediumTypes, __RefinedMediumType<TType, TRefinement, TNominal, TFromMediumTypes>>): __MediumTypesPackedType<TToMediumTypes, __RefinedMediumType<TType, TRefinement, TNominal, TToMediumTypes>>;
is(value: unknown): value is __RefinedMediumType<TType, TRefinement, TNominal, XValue.Types>;

@@ -21,1 +21,25 @@ }

}
/**
* DECLARATION ONLY.
*
* Exported to avoid TS4023 error:
* https://github.com/Microsoft/TypeScript/issues/5711
*/
export declare const __nominal: unique symbol;
/**
* DECLARATION ONLY.
*
* Exported to avoid TS4023 error:
* https://github.com/Microsoft/TypeScript/issues/5711
*/
export declare const __type: unique symbol;
export declare type Nominal<TNominalKey extends string | symbol, T = unknown> = T & (unknown extends T ? unknown : {
[TTypeSymbol in typeof __type]: T;
}) & {
[TNominalSymbol in typeof __nominal]: {
[TKey in TNominalKey]: true;
};
};
export declare type Denominalize<T> = T extends {
[TNominalTypeSymbol in typeof __type]: infer TDenominalized;
} ? TDenominalized : T;
import type { __MediumTypeOf } from '../@utils';
import type { Medium } from '../medium';
import type { Nominal } from '../utils';
export declare abstract class Type<TCategory extends string = string> {
protected __static_type_category: TCategory;
refine(constraints: TypeConstraint | TypeConstraint[]): RefinedType<Type, unknown, Nominal<string | symbol>>;
nominal<TNominalKey extends string | symbol>(): RefinedType<this, unknown, Nominal<TNominalKey>>;
optional(): OptionalType<this>;

@@ -31,2 +31,3 @@ decode(medium: Medium, packed: unknown): unknown;

import { OptionalType } from './optional-type';
import type { Nominal } from './refined-type';
import { RefinedType } from './refined-type';

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

}
nominal() {
return new refined_type_1.RefinedType(this, []);
}
optional() {

@@ -19,0 +22,0 @@ return new optional_type_1.OptionalType(this);

@@ -1,28 +0,5 @@

import type { Type, TypeOf } from './type';
import type { __NominalPartial } from './@utils';
import type { Type, TypeOf, __nominal, __type } from './type';
import { RefinedType } from './type';
import { boolean, number, string, unknown } from './types';
/**
* DECLARATION ONLY.
*
* Exported to avoid TS4023 error:
* https://github.com/Microsoft/TypeScript/issues/5711
*/
export declare const __nominal: unique symbol;
/**
* DECLARATION ONLY.
*
* Exported to avoid TS4023 error:
* https://github.com/Microsoft/TypeScript/issues/5711
*/
export declare const __nominalType: unique symbol;
export declare type Nominal<TNominal extends string | symbol, T = unknown> = T & {
[TNominalTypeSymbol in typeof __nominalType]: T;
} & {
[TNominalSymbol in typeof __nominal]: {
[TNominalKey in TNominal]: true;
};
};
export declare type Denominalize<T> = T extends {
[TNominalTypeSymbol in typeof __nominalType]: infer TDenominalized;
} ? TDenominalized : T;
export declare const UnknownRecord: import("./type").RecordType<import("./type").AtomicType<typeof import("./types").stringTypeSymbol>, import("./type").AtomicType<typeof import("./types").unknownTypeSymbol>>;

@@ -34,1 +11,6 @@ export declare function literal<T extends string>(literal: T): RefinedType<typeof string, T, unknown>;

export declare function equal<T extends TypeOf<TType>, TType extends Type>(comparison: T, Type: TType): RefinedType<TType, T, unknown>;
export declare type TransformNominal<TFrom, T> = TFrom extends __NominalPartial ? T & {
[TTypeSymbol in typeof __type]: T;
} & {
[TNominalSymbol in typeof __nominal]: TFrom[TNominalSymbol];
} : T;
{
"name": "x-value",
"version": "0.0.1-14",
"version": "0.0.1-15",
"repository": "https://github.com/vilic/x-value.git",

@@ -5,0 +5,0 @@ "license": "MIT",

import type {
ArrayType,
AtomicType,
Denominalize,
IntersectionType,

@@ -12,4 +13,5 @@ ObjectType,

UnionType,
__nominal,
__type,
} from './type';
import type {Denominalize, __nominalType} from './utils';

@@ -80,3 +82,3 @@ export const hasOwnProperty = Object.prototype.hasOwnProperty;

TNominal & {
[TNominalTypeSymbol in typeof __nominalType]: Denominalize<T>;
[TNominalTypeSymbol in typeof __type]: Denominalize<T>;
}

@@ -142,3 +144,3 @@ : never;

export type __NominalPartial = {
[TNominalTypeSymbol in typeof __nominalType]: unknown;
[TNominalSymbol in typeof __nominal]: unknown;
};

@@ -145,0 +147,0 @@

@@ -5,2 +5,3 @@ import type {

__MediumTypesPackedType,
__NominalPartial,
__RefinedMediumType,

@@ -10,3 +11,2 @@ __RefinedType,

import type {Medium} from '../medium';
import type {__nominalType} from '../utils';

@@ -29,3 +29,3 @@ import type {TypeConstraint, TypeIssue, TypePath} from './type';

TMediumTypes,
__MediumTypeOf<TType, TMediumTypes> & TNominal
__RefinedMediumType<TType, TRefinement, TNominal, TMediumTypes>
>,

@@ -39,3 +39,3 @@ ): __RefinedMediumType<TType, TRefinement, TNominal, XValue.Types>;

TMediumTypes,
__MediumTypeOf<TType, TMediumTypes> & TNominal
__RefinedMediumType<TType, TRefinement, TNominal, TMediumTypes>
>;

@@ -48,7 +48,7 @@

TFromMediumTypes,
__MediumTypeOf<TType, TFromMediumTypes> & TNominal
__RefinedMediumType<TType, TRefinement, TNominal, TFromMediumTypes>
>,
): __MediumTypesPackedType<
TToMediumTypes,
__MediumTypeOf<TType, TToMediumTypes> & TNominal
__RefinedMediumType<TType, TRefinement, TNominal, TToMediumTypes>
>;

@@ -154,1 +154,34 @@

}
/**
* DECLARATION ONLY.
*
* Exported to avoid TS4023 error:
* https://github.com/Microsoft/TypeScript/issues/5711
*/
export declare const __nominal: unique symbol;
/**
* DECLARATION ONLY.
*
* Exported to avoid TS4023 error:
* https://github.com/Microsoft/TypeScript/issues/5711
*/
export declare const __type: unique symbol;
export type Nominal<TNominalKey extends string | symbol, T = unknown> = T &
(unknown extends T
? unknown
: {
[TTypeSymbol in typeof __type]: T;
}) & {
[TNominalSymbol in typeof __nominal]: {
[TKey in TNominalKey]: true;
};
};
export type Denominalize<T> = T extends {
[TNominalTypeSymbol in typeof __type]: infer TDenominalized;
}
? TDenominalized
: T;
/* eslint-disable @mufan/import-groups */
import type {__MediumTypeOf} from '../@utils';
import type {__MediumTypeOf, __NominalPartial} from '../@utils';
import type {Medium} from '../medium';
import type {Nominal} from '../utils';

@@ -19,2 +18,10 @@ export abstract class Type<TCategory extends string = string> {

nominal<TNominalKey extends string | symbol>(): RefinedType<
this,
unknown,
Nominal<TNominalKey>
> {
return new RefinedType(this, []);
}
optional(): OptionalType<this> {

@@ -150,2 +157,3 @@ return new OptionalType(this);

import {OptionalType} from './optional-type';
import type {Nominal} from './refined-type';
import {RefinedType} from './refined-type';
import isEqual from 'lodash.isequal';
import type {Type, TypeOf} from './type';
import type {__NominalPartial} from './@utils';
import type {Type, TypeOf, __nominal, __type} from './type';
import {RefinedType, record} from './type';
import {boolean, number, string, unknown} from './types';
/**
* DECLARATION ONLY.
*
* Exported to avoid TS4023 error:
* https://github.com/Microsoft/TypeScript/issues/5711
*/
export declare const __nominal: unique symbol;
/**
* DECLARATION ONLY.
*
* Exported to avoid TS4023 error:
* https://github.com/Microsoft/TypeScript/issues/5711
*/
export declare const __nominalType: unique symbol;
export type Nominal<TNominal extends string | symbol, T = unknown> = T & {
[TNominalTypeSymbol in typeof __nominalType]: T;
} & {
[TNominalSymbol in typeof __nominal]: {
[TNominalKey in TNominal]: true;
};
};
export type Denominalize<T> = T extends {
[TNominalTypeSymbol in typeof __nominalType]: infer TDenominalized;
}
? TDenominalized
: T;
export const UnknownRecord = record(string, unknown);

@@ -74,1 +45,9 @@

}
export type TransformNominal<TFrom, T> = TFrom extends __NominalPartial
? T & {
[TTypeSymbol in typeof __type]: T;
} & {
[TNominalSymbol in typeof __nominal]: TFrom[TNominalSymbol];
}
: T;

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