Socket
Socket
Sign inDemoInstall

@arktype/attest

Package Overview
Dependencies
Maintainers
0
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arktype/attest - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

2

out/assert/attest.d.ts
import { type SourcePosition } from "@arktype/fs";
import type { inferTypeRoot, validateTypeRoot } from "arktype";
import type { Measure } from "../bench/measure.js";

@@ -9,3 +8,2 @@ import { type VersionedTypeAssertion } from "../cache/getCachedAssertions.js";

<expected, actual extends expected = never>(...args: [actual] extends [never] ? [value: expected] : []): [expected] extends [never] ? rootAssertions<unknown, AssertionKind> : rootAssertions<expected, AssertionKind>;
<actual, def>(actual: actual, def: validateTypeRoot<def>): asserts actual is unknown extends actual ? inferTypeRoot<def> & actual : Extract<actual, inferTypeRoot<def>>;
instantiations: (count?: Measure<"instantiations"> | undefined) => void;

@@ -12,0 +10,0 @@ };

3

out/assert/chainableAssertions.d.ts
import { snapshot, type Constructor } from "@arktype/util";
import { type validateTypeRoot } from "arktype";
import type { Completions } from "../cache/writeAssertionCache.js";

@@ -19,2 +20,3 @@ import type { AssertionContext } from "./attest.js";

equals(expected: unknown): this;
satisfies(def: unknown): this;
instanceOf(expected: Constructor): this;

@@ -53,2 +55,3 @@ get snap(): snapProperty<unknown, AssertionKind>;

completions: (value?: Completions) => void;
satisfies: <def>(def: validateTypeRoot<def>) => nextAssertions<kind>;
unknown: Omit<comparableValueAssertion<unknown, kind>, "unknown">;

@@ -55,0 +58,0 @@ };

import { caller } from "@arktype/fs";
import { printable, snapshot } from "@arktype/util";
import { type } from "arktype";
import * as assert from "node:assert/strict";

@@ -42,2 +43,6 @@ import { isDeepStrictEqual } from "node:util";

}
satisfies(def) {
type(def).assert(def);
return this;
}
instanceOf(expected) {

@@ -44,0 +49,0 @@ if (!(this.ctx.actual instanceof expected)) {

@@ -12,3 +12,3 @@ import type { StatName } from "./bench.js";

export type MarkMeasure = Partial<Record<StatName, Measure>>;
export declare const stringifyMeasure: ([value, units]: Measure<MeasureUnit>) => string;
export declare const stringifyMeasure: ([value, units]: Measure) => string;
export declare const TYPE_UNITS: readonly ["instantiations"];

@@ -24,8 +24,8 @@ export type TypeUnit = (typeof TYPE_UNITS)[number];

export type TimeUnit = keyof typeof timeUnitRatios;
export declare const stringifyTimeMeasure: ([value, unit]: Measure<"ns" | "us" | "ms" | "s">) => string;
export declare const stringifyTimeMeasure: ([value, unit]: Measure<TimeUnit>) => string;
/**
* Establish a new baseline using the most appropriate time unit
*/
export declare const createTimeMeasure: (ms: number) => Measure<"ns" | "us" | "ms" | "s">;
export declare const createTimeMeasure: (ms: number) => Measure<TimeUnit>;
export declare const createTimeComparison: (ms: number, baseline: Measure<TimeUnit> | undefined) => MeasureComparison<TimeUnit>;
export {};

@@ -11,13 +11,15 @@ import { caller } from "@arktype/fs";

export const contextualize = (...args) => {
if (globalThis.describe) {
const fileName = basename(caller().file);
if (typeof args[0] === "function")
globalThis.describe(fileName, args[0]);
else {
globalThis.describe(fileName, () => {
for (let i = 0; i < args.length; i = i + 2)
globalThis.describe(args[i], args[i + 1]);
});
}
const describe = globalThis.describe;
if (!describe) {
throw new Error(`contextualize cannot be used without a global 'describe' function.`);
}
const fileName = basename(caller().file);
if (typeof args[0] === "function")
describe(fileName, args[0]);
else {
describe(fileName, () => {
for (let i = 0; i < args.length; i = i + 2)
describe(args[i], args[i + 1]);
});
}
};
{
"name": "@arktype/attest",
"version": "0.8.0",
"version": "0.8.1",
"author": {

@@ -27,6 +27,6 @@ "name": "David Blass",

"@arktype/fs": "0.0.20",
"@arktype/util": "0.0.49"
"@arktype/util": "0.0.50"
},
"devDependencies": {
"typescript": "5.4.5"
"typescript": "5.5.2"
},

@@ -33,0 +33,0 @@ "peerDependencies": {

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