Comparing version 0.2.2 to 0.3.0
import type { describeDefaults, DescribeOptions } from "./describe.ts"; | ||
import type { show } from "./generics.ts"; | ||
import type { stringifyUnion } from "./unionToTuple.ts"; | ||
export type JsTypeOf = "object" | "function" | "number" | "bigint" | "boolean" | "string" | "symbol" | "undefined" | "null"; | ||
export declare const domainToJsTypesOf: (domain: Domain) => JsTypeOf[]; | ||
export declare const hasDomain: <data, domain extends Domain>(data: data, kind: domain) => data is data & inferDomain<domain>; | ||
@@ -34,4 +36,15 @@ type TypesByDomain = { | ||
}; | ||
export declare const jsTypeOfDescriptions: { | ||
readonly function: "a function"; | ||
readonly boolean: "boolean"; | ||
readonly null: "null"; | ||
readonly undefined: "undefined"; | ||
readonly bigint: "a bigint"; | ||
readonly number: "a number"; | ||
readonly object: "an object"; | ||
readonly string: "a string"; | ||
readonly 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 {}; |
@@ -0,1 +1,4 @@ | ||
export const domainToJsTypesOf = (domain) => domain === "null" ? ["object"] | ||
: domain === "object" ? ["object", "function"] | ||
: [domain]; | ||
export const hasDomain = (data, kind) => domainOf(data) === kind; | ||
@@ -22,1 +25,5 @@ export const domainOf = (data) => { | ||
}; | ||
export const jsTypeOfDescriptions = { | ||
...domainDescriptions, | ||
function: "a function" | ||
}; |
@@ -32,3 +32,2 @@ import { throwInternalError } from "./errors.js"; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging | ||
export class Callable { | ||
@@ -35,0 +34,0 @@ constructor(fn, ...[opts]) { |
@@ -88,3 +88,3 @@ import type { array } from "./arrays.ts"; | ||
export declare class DynamicBase<t extends object> { | ||
constructor(properties: object); | ||
constructor(properties: t); | ||
} | ||
@@ -91,0 +91,0 @@ export declare const NoopBase: new <t extends object>() => t; |
@@ -11,3 +11,2 @@ import { flatMorph } from "./flatMorph.js"; | ||
}; | ||
// eslint-disable-next-line | ||
export class DynamicBase { | ||
@@ -14,0 +13,0 @@ constructor(properties) { |
@@ -1,5 +0,7 @@ | ||
export declare const arkUtilVersion = "0.2.2"; | ||
export declare const arkUtilVersion = "0.3.0"; | ||
export declare const initialRegistryContents: { | ||
version: string; | ||
filename: string; | ||
/** Node18 */ | ||
FileConstructor: typeof import("buffer").File; | ||
}; | ||
@@ -6,0 +8,0 @@ export type InitialRegistryContents = typeof initialRegistryContents; |
@@ -8,6 +8,8 @@ import { domainOf } from "./domain.js"; | ||
// For now, we assert this matches the package.json version via a unit test. | ||
export const arkUtilVersion = "0.2.2"; | ||
export const arkUtilVersion = "0.3.0"; | ||
export const initialRegistryContents = { | ||
version: arkUtilVersion, | ||
filename: import.meta.filename | ||
filename: import.meta.filename, | ||
/** Node18 */ | ||
FileConstructor: globalThis.File ?? Blob | ||
}; | ||
@@ -14,0 +16,0 @@ export const registry = initialRegistryContents; |
@@ -10,5 +10,5 @@ import type { array } from "./arrays.ts"; | ||
export type Json = JsonObject | JsonArray; | ||
export type JsonObject = { | ||
export interface JsonObject { | ||
[k: string]: JsonData; | ||
}; | ||
} | ||
export type JsonArray = JsonData[]; | ||
@@ -15,0 +15,0 @@ export type JsonPrimitive = string | boolean | number | null; |
export declare const capitalize: <s extends string>(s: s) => Capitalize<s>; | ||
export declare const uncapitalize: <s extends string>(s: s) => Uncapitalize<s>; | ||
export type firstChar<s extends string> = s extends `${infer head}${string}` ? head : ""; | ||
@@ -3,0 +4,0 @@ export type charsAfterFirst<s extends string> = s extends `${string}${infer tail}` ? tail : ""; |
export const capitalize = (s) => (s[0].toUpperCase() + s.slice(1)); | ||
export const uncapitalize = (s) => (s[0].toLowerCase() + s.slice(1)); | ||
export const anchoredRegex = (regex) => new RegExp(anchoredSource(regex), typeof regex === "string" ? "" : regex.flags); | ||
@@ -3,0 +4,0 @@ export const deanchoredRegex = (regex) => new RegExp(deanchoredSource(regex), typeof regex === "string" ? "" : regex.flags); |
{ | ||
"name": "@ark/util", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "David Blass", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82573
1722