New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

object-shape-tester

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-shape-tester - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

11

dist/types/define-shape/shape-specifiers.d.ts

@@ -35,5 +35,6 @@ import { ArrayElement, AtLeastTuple, PropertyValueType } from '@augment-vir/common';

export type ShapeUnknown<Parts extends Readonly<[]>> = ShapeSpecifier<Parts, typeof unknownSymbol>;
type ExpandParts<Parts extends BaseParts> = Exclude<ArrayElement<Parts>, ShapeDefinition<any>> | ShapeToRunTimeType<Extract<ArrayElement<Parts>, ShapeDefinition<any>>['shape']>;
type ExpandPart<Part> = Part extends ShapeDefinition<infer Shape> ? ShapeToRunTimeType<Shape> : Part;
export type SpecifierToRunTimeType<PossiblySpecifier, IsExact extends boolean = false> = PossiblySpecifier extends ShapeSpecifier<infer Parts, infer Type> ? Type extends typeof andSymbol ? UnionToIntersection<ExpandParts<Parts>> : Type extends typeof orSymbol ? ExpandParts<Parts> : Type extends typeof exactSymbol ? WritableDeep<ExpandParts<Parts>> : Type extends typeof enumSymbol ? WritableDeep<PropertyValueType<ExpandPart<Parts[0]>>> : Type extends typeof unknownSymbol ? unknown : 'TypeError: found not match for shape specifier type.' : PossiblySpecifier extends Primitive ? IsExact extends true ? PossiblySpecifier : LiteralToPrimitive<PossiblySpecifier> : PossiblySpecifier;
type ExpandParts<Parts extends BaseParts, IsExact extends boolean> = Extract<ArrayElement<Parts>, ShapeDefinition<any>> extends never ? SpecifierToRunTimeType<ArrayElement<Parts>, IsExact> : Exclude<ArrayElement<Parts>, ShapeDefinition<any>> | ShapeToRunTimeType<Extract<ArrayElement<Parts>, ShapeDefinition<any>>['shape']>;
export type SpecifierToRunTimeType<PossiblySpecifier, IsExact extends boolean = false> = PossiblySpecifier extends ShapeSpecifier<infer Parts, infer Type> ? Type extends typeof andSymbol ? UnionToIntersection<ExpandParts<Parts, IsExact>> : Type extends typeof orSymbol ? ExpandParts<Parts, IsExact> : Type extends typeof exactSymbol ? WritableDeep<ExpandParts<Parts, true>> : Type extends typeof enumSymbol ? WritableDeep<PropertyValueType<Parts[0]>> : Type extends typeof unknownSymbol ? unknown : 'TypeError: found not match for shape specifier type.' : PossiblySpecifier extends Primitive ? IsExact extends true ? PossiblySpecifier : LiteralToPrimitive<PossiblySpecifier> : PossiblySpecifier extends object ? {
[Prop in keyof PossiblySpecifier]: SpecifierToRunTimeType<PossiblySpecifier[Prop], IsExact>;
} : PossiblySpecifier;
export declare function or<Parts extends AtLeastTuple<unknown, 1>>(...parts: Parts): ShapeOr<Parts>;

@@ -51,4 +52,4 @@ export declare function and<Parts extends AtLeastTuple<unknown, 1>>(...parts: Parts): ShapeAnd<Parts>;

export declare function specifier<Parts extends BaseParts, Type extends ShapeSpecifierType>(parts: Parts, specifierType: Type): ShapeSpecifier<Parts, Type>;
export type ShapeToRunTimeType<Shape, IsExact extends boolean = false> = Shape extends object ? {
[PropName in keyof Shape]: Shape[PropName] extends ShapeSpecifier<any, typeof exactSymbol> ? ShapeToRunTimeType<SpecifierToRunTimeType<Shape[PropName], true>, true> : ShapeToRunTimeType<SpecifierToRunTimeType<Shape[PropName], IsExact>, IsExact>;
export type ShapeToRunTimeType<Shape, IsExact extends boolean = false> = Shape extends object ? Shape extends ShapeDefinition<infer InnerShape> ? ShapeToRunTimeType<InnerShape, IsExact> : Shape extends ShapeSpecifier<any, any> ? Shape extends ShapeSpecifier<any, typeof exactSymbol> ? SpecifierToRunTimeType<Shape, true> : SpecifierToRunTimeType<Shape, IsExact> : {
[PropName in keyof Shape]: Shape[PropName] extends ShapeSpecifier<any, typeof exactSymbol> ? ShapeToRunTimeType<Shape[PropName], true> : ShapeToRunTimeType<Shape[PropName], IsExact>;
} : Shape;

@@ -55,0 +56,0 @@ export declare function matchesSpecifier(subject: unknown, shape: unknown): boolean;

{
"name": "object-shape-tester",
"version": "0.2.1",
"version": "0.2.2",
"description": "Test object properties and value types.",

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

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