Socket
Socket
Sign inDemoInstall

@ark/util

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ark/util - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

3

out/describe.d.ts

@@ -12,3 +12,4 @@ import type { array } from "./arrays.js";

t
] extends [anyOrNever] ? unknown extends t ? "any" : "never" : unknown extends t ? "unknown" : boolean extends t ? "boolean" | ([t] extends [boolean] ? never : typeToString<Exclude<t, boolean>, opts>) : t extends array ? arrayTypeToString<t, opts> : t extends object ? describeObject<t, opts> : t extends Stringifiable ? inferDomain<domainOf<t>> extends t ? describeDomainOf<t, opts> : `${t}` : describeDomainOf<t, opts>, opts["branchDelimiter"] extends string ? opts["branchDelimiter"] : describeDefaults["branchDelimiter"]>;
] extends [anyOrNever] ? unknown extends t ? "any" : "never" : unknown extends t ? "unknown" : boolean extends t ? "boolean" | ([t] extends [boolean] ? never : typeToString<Exclude<t, boolean>, opts>) : t extends array ? arrayTypeToString<t, opts> : t extends object ? describeObject<t, opts> : t extends Stringifiable ? stringifiableToString<t, opts> : describeDomainOf<t, opts>, opts["branchDelimiter"] extends string ? opts["branchDelimiter"] : describeDefaults["branchDelimiter"]>;
type stringifiableToString<t extends Stringifiable, opts extends DescribeOptions> = inferDomain<domainOf<t>> extends t ? describeDomainOf<t, opts> : `${t}`;
export type describe<t> = typeToString<t, {

@@ -15,0 +16,0 @@ includeArticles: true;

@@ -23,3 +23,7 @@ import type { describeDefaults, DescribeOptions } from "./describe.js";

export declare const domainOf: <data>(data: data) => domainOf<data>;
declare const nonEnumerableDomainDescriptions: {
/** Each domain's completion for the phrase "must be _____" */
export declare const domainDescriptions: {
readonly boolean: "boolean";
readonly null: "null";
readonly undefined: "undefined";
readonly bigint: "a bigint";

@@ -31,16 +35,4 @@ readonly number: "a number";

};
export type NonEnumerableDomain = keyof typeof nonEnumerableDomainDescriptions;
/** Each domain's completion for the phrase "must be _____" */
export declare const domainDescriptions: {
boolean: "boolean";
null: "null";
undefined: "undefined";
bigint: "a bigint";
number: "a number";
object: "an object";
string: "a string";
symbol: "a symbol";
};
export type domainDescriptions = typeof domainDescriptions;
export type describeDomainOf<t, opts extends DescribeOptions = {}> = stringifyUnion<opts["includeArticles"] extends true ? domainDescriptions[domainOf<t>] : domainOf<t>, opts["branchDelimiter"] extends string ? opts["branchDelimiter"] : describeDefaults["branchDelimiter"]>;
export {};

@@ -11,8 +11,7 @@ export const hasDomain = (data, kind) => domainOf(data) === kind;

};
const enumerableDomainDescriptions = {
/** Each domain's completion for the phrase "must be _____" */
export const domainDescriptions = {
boolean: "boolean",
null: "null",
undefined: "undefined"
};
const nonEnumerableDomainDescriptions = {
undefined: "undefined",
bigint: "a bigint",

@@ -24,6 +23,1 @@ number: "a number",

};
/** Each domain's completion for the phrase "must be _____" */
export const domainDescriptions = {
...nonEnumerableDomainDescriptions,
...enumerableDomainDescriptions
};

@@ -23,2 +23,3 @@ import { NoopBase } from "./records.js";

export type Guardable<input = unknown, narrowed extends input = input> = ((In: input) => In is narrowed) | ((In: input) => boolean);
export type TypeGuard<input = unknown, narrowed extends input = input> = (In: input) => In is narrowed;
/**

@@ -25,0 +26,0 @@ * Checks if the environment has Content Security Policy (CSP) enabled,

@@ -1,39 +0,25 @@

import type { conform } from "./generics.js";
export type instantiate<hkt extends Hkt.Instantiable, args extends Parameters<hkt[Hkt.instantiate]>[0]> = ReturnType<(hkt & {
readonly [Hkt.args]: args;
})[Hkt.instantiate]>;
/** A small set of HKT utility types based on https://github.com/poteat/hkt-toolbelt */
declare const args = "~args";
type args = typeof args;
export declare abstract class Hkt<constraints extends unknown[] = any> {
[args]: unknown[];
constraints: constraints;
args: this[args] extends infer args extends unknown[] ? args : never;
0: this[args] extends [infer arg, ...any] ? arg : never;
1: this[args] extends [any, infer arg, ...any] ? arg : never;
2: this[args] extends [any, any, infer arg, ...any] ? arg : never;
3: this[args] extends [any, any, any, infer arg, ...any] ? arg : never;
abstract body: unknown;
}
/** A small set of HKT utility types based on https://github.com/gvergnaud/hotscript
* See https://github.com/gvergnaud/hotscript/blob/main/src/internals/core/Core.ts
*/
export declare namespace Hkt {
export const args: unique symbol;
export type args = typeof args;
export const instantiate: unique symbol;
export type instantiate = typeof instantiate;
export abstract class Kind<hkt extends (...args: any[]) => unknown = (...args: any[]) => unknown> {
readonly [args]: unknown;
abstract readonly hkt: hkt;
}
export abstract class Instantiable {
readonly [args]: unknown;
abstract readonly [instantiate]: (...args: never[]) => Instantiable;
}
export type apply<hkt extends Kind, args extends Parameters<hkt["hkt"]>[0]> = ReturnType<(hkt & {
readonly [args]: args;
})["hkt"]>;
export interface Reify extends Kind {
hkt(In: conform<this[args], Kind>): reify<typeof In>;
}
export const reify: <def extends Kind>(def: def) => reify<def>;
export type reify<hkt extends Kind> = <const In extends Parameters<hkt["hkt"]>[0]>(In: In) => Hkt.apply<hkt, In>;
export abstract class UnaryKind<hkt extends (In: never) => unknown = (In: any) => unknown> {
readonly [args]: unknown;
abstract readonly hkt: hkt;
}
type validatePipedKinds<kinds extends UnaryKind[], Out = Parameters<kinds[0]["hkt"]>[0]> = kinds extends (readonly [infer head extends UnaryKind, ...infer tail extends UnaryKind[]]) ? Out extends Parameters<head["hkt"]>[0] ? [
kinds[0],
...validatePipedKinds<tail, Hkt.apply<head, Out>>
] : [Kind<(In: Out) => unknown>, ...tail] : [];
type inferPipedReturn<kinds extends UnaryKind[], Out> = kinds extends (readonly [infer head extends UnaryKind, ...infer tail extends UnaryKind[]]) ? inferPipedReturn<tail, Hkt.apply<head, Out>> : Out;
export type pipe<kinds extends UnaryKind[]> = <In extends Parameters<kinds[0]["hkt"]>[0]>(In: In) => inferPipedReturn<kinds, In>;
export const pipe: <kinds extends UnaryKind[], validatedKinds extends UnaryKind[] = validatePipedKinds<kinds, Parameters<kinds[0]["hkt"]>[0]>>(...kinds: { [i in keyof kinds]: conform<kinds[i], validatedKinds[i & keyof validatedKinds]>; }) => pipe<kinds>;
export {};
type constructor<constraints extends unknown[] = any> = new () => Hkt<constraints>;
type args = typeof args;
type apply<hkt extends Hkt, args extends {
[i in keyof args]: hkt["constraints"][i];
}> = (hkt & {
[args]: args;
})["body"];
}
export {};

@@ -1,15 +0,3 @@

/** A small set of HKT utility types based on https://github.com/poteat/hkt-toolbelt */
export var Hkt;
(function (Hkt) {
class Kind {
}
Hkt.Kind = Kind;
class Instantiable {
}
Hkt.Instantiable = Instantiable;
Hkt.reify = (def) => def.hkt;
class UnaryKind {
}
Hkt.UnaryKind = UnaryKind;
Hkt.pipe = (...kinds) => In => kinds.reduce((out, kind) => kind.hkt(out), In);
})(Hkt || (Hkt = {}));
const args = "~args";
export class Hkt {
}
import type { array } from "./arrays.js";
import type { domainOf } from "./domain.js";
import type { andPreserveUnknown, conform } from "./generics.js";
import type { andPreserveUnknown } from "./generics.js";
import type { Hkt } from "./hkt.js";
import type { propValueOf, requiredKeyOf } from "./records.js";
export interface AndPreserveUnknown extends Hkt.Kind {
hkt: (args: conform<this[Hkt.args], [unknown, unknown]>) => andPreserveUnknown<(typeof args)[0], (typeof args)[1]>;
export interface AndPreserveUnknown extends Hkt<[unknown, unknown]> {
body: andPreserveUnknown<this[0], this[1]>;
}
type SequenceIntersectionKind = "array" | "parameters";
export type intersectArrays<l extends array, r extends array, operator extends Hkt.Kind = AndPreserveUnknown> = intersectSequences<l, r, [], [], operator, "array">;
export type intersectParameters<l extends array, r extends array, operator extends Hkt.Kind = AndPreserveUnknown> = intersectSequences<l, r, [], [], operator, "parameters">;
type intersectSequences<l extends array, r extends array, acc extends array, postfix extends array, operation extends Hkt.Kind, kind extends SequenceIntersectionKind> = l extends readonly [] ? kind extends "array" ? [
export type intersectArrays<l extends array, r extends array, operator extends Hkt = AndPreserveUnknown> = intersectSequences<l, r, [], [], operator, "array">;
export type intersectParameters<l extends array, r extends array, operator extends Hkt = AndPreserveUnknown> = intersectSequences<l, r, [], [], operator, "parameters">;
type intersectSequences<l extends array, r extends array, acc extends array, postfix extends array, operation extends Hkt, kind extends SequenceIntersectionKind> = l extends readonly [] ? kind extends "array" ? [
] extends r ? [

@@ -14,0 +14,0 @@ ...acc,

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

import type { PartialRecord } from "./records.js";
export declare const arkUtilVersion = "0.1.2";
export declare const arkUtilVersion = "0.2.1";
export declare const initialRegistryContents: {

@@ -8,10 +7,11 @@ version: string;

export type InitialRegistryContents = typeof initialRegistryContents;
export declare const $ark: ArkEnv.registry;
export interface ArkRegistry extends InitialRegistryContents {
[k: string]: unknown;
}
export declare const registry: ArkRegistry;
declare global {
export interface ArkEnv {
registry(): {};
prototypes(): never;
}
export namespace ArkEnv {
type registry = PartialRecord<string, object | symbol> & InitialRegistryContents & ReturnType<ArkEnv["registry"]>;
type prototypes = ReturnType<ArkEnv["prototypes"]>;

@@ -18,0 +18,0 @@ }

@@ -8,3 +8,3 @@ import { domainOf } from "./domain.js";

// For now, we assert this matches the package.json version via a unit test.
export const arkUtilVersion = "0.1.2";
export const arkUtilVersion = "0.2.1";
export const initialRegistryContents = {

@@ -14,3 +14,3 @@ version: arkUtilVersion,

};
export const $ark = initialRegistryContents;
export const registry = initialRegistryContents;
const namesByResolution = new WeakMap();

@@ -27,3 +27,3 @@ const nameCounts = {};

nameCounts[name] = 1;
$ark[name] = value;
registry[name] = value;
namesByResolution.set(value, name);

@@ -30,0 +30,0 @@ return name;

{
"name": "@ark/util",
"version": "0.2.0",
"version": "0.2.1",
"author": {

@@ -5,0 +5,0 @@ "name": "David Blass",

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