UNPKG

locutus

Version:

Locutus other languages' standard libraries to JavaScript for fun and educational purposes

61 lines (60 loc) 4.2 kB
export type PhpNullish = null | undefined; export type PhpInput = {} | PhpNullish; export type PhpScalar = string | number | boolean; export type PhpLiteral = PhpScalar | null; export type PhpPrimitive = PhpScalar | bigint; export type PhpKey = string | number; export type NumericLike = number | bigint | string; export type StringLike = string | number | boolean | bigint; export type PhpStringish = StringLike | PhpNullish; export type PhpList<T = PhpInput> = T[]; export type PhpAssoc<T = PhpInput> = { [key: string]: T; }; export type PhpContainer<T = PhpInput> = PhpList<T> | PhpAssoc<T>; export type PhpArrayLike<T = PhpInput> = PhpList<T> | PhpAssoc<T>; export interface PhpRecursiveAssoc { [key: string]: PhpRecursiveValue; } export interface PhpRecursiveList extends Array<PhpRecursiveValue> { } export type PhpRecursiveValue = PhpPrimitive | PhpNullish | PhpRecursiveList | PhpRecursiveAssoc; export type PhpFunctionValue = (...args: PhpInput[]) => PhpInput; export interface PhpRuntimeAssoc { [key: string]: PhpRuntimeValue; } export interface PhpRuntimeList extends Array<PhpRuntimeValue> { } export type PhpRuntimeValue = PhpPrimitive | PhpNullish | PhpRuntimeList | PhpRuntimeAssoc | PhpFunctionValue; export type PhpReadonlyList<T = PhpInput> = readonly T[]; export type PhpReadonlyAssoc<T = PhpInput> = Readonly<PhpAssoc<T>>; export type PhpReadonlyArrayLike<T = PhpInput> = PhpReadonlyList<T> | PhpReadonlyAssoc<T>; export declare const entriesOfPhpAssoc: <T>(value: PhpAssoc<T>) => Array<[string, T]>; export declare function normalizeArrayKey(key: string): string | number; export type PhpCallableArgs = PhpInput[]; export type PhpCallable<TArgs extends PhpCallableArgs = PhpCallableArgs, TResult = PhpInput> = (...args: TArgs) => TResult; export type PhpCallableScope = PhpInput; export type PhpCallableTuple<TArgs extends PhpCallableArgs = PhpCallableArgs, TResult = PhpInput> = readonly [ PhpCallableScope, string | PhpCallable<TArgs, TResult> ]; export type PhpCallableDescriptor<TArgs extends PhpCallableArgs = PhpCallableArgs, TResult = PhpInput> = string | PhpCallable<TArgs, TResult> | PhpCallableTuple<TArgs, TResult>; export type PhpComparatorDescriptor<T> = PhpCallableDescriptor<[T, T], NumericLike>; export type PhpKeyComparatorDescriptor = PhpCallableDescriptor<[string, string], NumericLike>; export declare function isPhpNullish(value: PhpInput): value is PhpNullish; export declare function isPhpList<T = PhpInput>(value: PhpInput): value is PhpList<T>; export declare function isObjectLike(value: PhpInput): value is PhpArrayLike<PhpInput>; export declare function isPhpAssocObject<T = PhpInput>(value: PhpInput): value is PhpAssoc<T>; export declare function isPhpScalar(value: PhpInput): value is PhpScalar; export declare function isPhpKey(value: PhpInput): value is PhpKey; export declare function isNumericLike(value: PhpInput): value is NumericLike; export declare function isPhpCallable<TArgs extends PhpCallableArgs = PhpCallableArgs, TResult = PhpInput>(value: PhpInput): value is PhpCallable<TArgs, TResult>; export declare function isPhpCallableDescriptor<TArgs extends PhpCallableArgs = PhpCallableArgs, TResult = PhpInput>(value: PhpInput): value is PhpCallableDescriptor<TArgs, TResult>; export declare function assertIsObjectLike(value: PhpInput, message?: string): asserts value is PhpArrayLike<PhpInput>; export declare function assertIsPhpAssocObject(value: PhpInput, message?: string): asserts value is PhpAssoc<PhpInput>; export declare function assertIsPhpList(value: PhpInput, message?: string): asserts value is PhpList<PhpInput>; export declare function assertIsPhpKey(value: PhpInput, message?: string): asserts value is PhpKey; export declare function assertIsNumericLike(value: PhpInput, message?: string): asserts value is NumericLike; export declare function assertIsPhpCallable<TArgs extends PhpCallableArgs = PhpCallableArgs, TResult = PhpInput>(value: PhpInput, message?: string): asserts value is PhpCallable<TArgs, TResult>; export declare function isPhpArrayObject<T = PhpInput>(value: PhpInput): value is PhpAssoc<T>; export declare function toPhpArrayObject<T = PhpInput>(value: PhpInput): PhpAssoc<T>;