@neodx/log
Version:
A lightweight universal logging framework
1 lines • 20 kB
Source Map (JSON)
{"version":3,"file":"read-arguments-BBlq0hOP.cjs","sources":["../../../std/src/shared.ts","../../../std/src/guards.ts","../../../std/src/object/map.ts","../../../std/src/to-case.ts","../../src/utils/create-auto-logger-factory.ts","../../src/utils/read-arguments.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport type Falsy = false | null | undefined | void | 0 | '';\nexport type Truthy = Exclude<any, Falsy>;\nexport type AnyFn = (...args: any[]) => any;\nexport type AnyKey = keyof any;\nexport type AnyRecord<T = any> = Record<AnyKey, T>;\nexport type Awaitable<T> = Awaited<T> | PromiseLike<Awaited<T>>;\nexport type FirstArg<Fn extends AnyFn> = Parameters<Fn>[0];\nexport type MapLike<Key, Value> = Pick<Map<Key, Value>, 'has' | 'get' | 'set'>;\n\nexport const toArray = <T>(value: T | T[]) => (Array.isArray(value) ? value : [value]);\nexport const toInt = (value: string) => Number.parseInt(value, 10);\nexport const is =\n <Target>(target: Target) =>\n (value: unknown): value is Target =>\n target === (value as any);\n\nexport const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));\nexport const forEach = <T>(iterable: Iterable<T>, fn: (value: T) => void) => {\n for (const value of iterable) fn(value);\n};\n\nexport const identity = <T>(value: T): T => value;\nexport const isTruthy = Boolean as unknown as <T>(value: T | Falsy) => value is T;\n\nexport const True = (): true => true;\nexport const False = (): false => false;\n\nexport const test = (re: RegExp) => (value: string) => re.test(value);\n\nexport const setMapValue = <Key, Value>(map: MapLike<Key, Value>, key: Key, value: Value) => {\n map.set(key, value);\n return value;\n};\nexport const getOrCreateMapValue = <Key, Value>(\n map: MapLike<Key, Value>,\n key: Key,\n create: () => Value\n) => (map.has(key) ? map.get(key)! : setMapValue(map, key, create()));\n\nexport const rethrow = (error: unknown): never => {\n throw error;\n};\nexport function tryCatch<T>(fn: () => T): T | undefined;\nexport function tryCatch<T>(fn: () => T, fallback: (error: unknown) => T): T;\nexport function tryCatch<T, F>(fn: () => T, fallback: (error: unknown) => F): T | F;\nexport function tryCatch<T, F>(fn: () => T, fallback?: (error: unknown) => F): T | F {\n try {\n return fn();\n } catch (error) {\n return fallback?.(error) as T | F;\n }\n}\n\nexport const once = <T>(fn: () => T) => {\n let value: T | undefined;\n\n return Object.assign(() => (value ??= fn()), {\n get called() {\n return Boolean(value);\n }\n });\n};\n\nexport const redefineName = <T>(target: T, name: string) =>\n Object.defineProperty(target, 'name', {\n value: name\n });\n\n//#region Object\n\nexport const values = Object.values;\nexport const fromEntries = Object.fromEntries as {\n <T>(entries: Iterable<ObjectEntry<T>>): T;\n <T>(entries: Iterable<readonly [PropertyKey, T]>): Record<string, T>;\n};\nexport const entries = Object.entries as ObjectEntries;\nexport const hasOwn = Object.hasOwn as ObjectHasOwn;\nexport const keys = Object.keys as ObjectKeys;\n\nexport type ObjectEntry<T> = {\n [Key in Extract<keyof T, string>]: [Key, Exclude<T[Key], undefined>];\n}[Extract<keyof T, string>];\n\nexport interface ObjectEntries {\n <T>(target: T): ObjectEntry<T>[];\n}\n\nexport interface ObjectKeys {\n <T>(target: T): Array<Extract<keyof T, string>>;\n}\n\nexport interface ObjectHasOwn {\n <Key extends keyof any, T extends AnyRecord>(target: T, key: Key | keyof T): key is keyof T;\n <Key extends keyof T, T extends AnyRecord>(\n target: T,\n key: Key\n ): target is T & {\n [K in Key]-?: Exclude<T[K], undefined | void | never>;\n };\n}\n\n//#endregion\n","import { type AnyFn, type AnyRecord, keys } from './shared';\n\nconst toString = Object.prototype.toString;\nconst getPrototypeOf = Object.getPrototypeOf;\nconst objectString = '[object Object]';\n\nexport type Nil = null | undefined;\nexport type AnyFunction = (...args: any[]) => any;\nexport type IsTypeOfFn<Type> = <T>(value: T | Type) => value is Type;\n\nexport const isEmpty = (target: unknown[]): target is [] => target.length === 0;\nexport const isError = (target: unknown): target is Error => target instanceof Error;\nexport const isEmptyObject = (target: AnyRecord): target is Record<never, never> =>\n isEmpty(keys(target));\n\nexport const not = ((fn: AnyFn) => (value: any) => !fn(value)) as {\n <CheckedValue>(\n fn: (value: any) => value is CheckedValue\n ): <Value>(value: Value) => value is Exclude<Value, CheckedValue>;\n (fn: (value: any) => boolean): (value: any) => boolean;\n};\nexport const some =\n <Args extends [...unknown[]]>(...predicates: [...((...args: Args) => boolean)[]]) =>\n (...args: Args): boolean =>\n predicates.some(predicate => predicate(...args));\nexport const every =\n <Args extends [...unknown[]]>(...predicates: [...((...args: Args) => boolean)[]]) =>\n (...args: Args): boolean =>\n predicates.every(predicate => predicate(...args));\n\nconst createTypeof =\n <T>(type: string) =>\n (value: unknown): value is T =>\n typeof value === type;\n\nexport const isTypeOfString = createTypeof<string>('string');\nexport const isTypeOfBoolean = createTypeof<boolean>('boolean');\nexport const isTypeOfFunction = createTypeof<AnyFunction>('function');\n\nexport const isNull = (value: unknown): value is null => value === null;\nexport const isUndefined = (value: unknown): value is undefined => value === undefined;\nexport const isPrimitive = (value: unknown) =>\n value === null || (typeof value !== 'function' && typeof value !== 'object');\nexport const isArray = Array.isArray;\nexport const isObject = (target: unknown): target is AnyRecord => {\n if (isNil(target) || !isObjectLike(target) || toString.call(target) !== objectString) {\n return false;\n }\n const proto = getPrototypeOf(target);\n\n return proto === null || proto === getLastPrototypeOf(target);\n};\n\nexport const isNil = (target: unknown): target is Nil => target == null;\nexport const isObjectLike = (target: unknown): target is object =>\n typeof target === 'object' && target !== null;\n\nconst getLastPrototypeOf = (target: unknown): unknown => {\n const proto = getPrototypeOf(target);\n\n return proto === null ? target : getLastPrototypeOf(proto);\n};\n\nexport const isDefined = not(isUndefined);\nexport const isNotNull = not(isNull);\nexport const isNotNil = not(isNil);\n","import {\n type AnyKey,\n type AnyRecord,\n entries,\n fromEntries,\n identity,\n type ObjectEntry\n} from '../shared.ts';\n\nexport function mapValues<Input extends AnyRecord, ResultValue>(\n target: Input,\n fn: (value: Input[keyof Input], key: keyof Input) => ResultValue\n): { [Key in keyof Input]: ResultValue };\nexport function mapValues<Input extends AnyRecord, ResultValue>(\n target: Input,\n fn: <Key extends keyof Input>(value: Input[Key], key: Key) => ResultValue\n): { [Key in keyof Input]: ResultValue };\nexport function mapValues<Input extends AnyRecord, ResultValue>(\n target: Input,\n fn: (value: Input[keyof Input], key: keyof Input) => ResultValue\n) {\n return mapEntries(target, ([key, value]) => [key, fn(value, key)]);\n}\n\nexport function mapEntries<Input extends AnyRecord, Result extends AnyRecord>(\n target: Input,\n fn: <Key extends keyof Input>(entry: [Key, Input[Key]]) => ObjectEntry<Result>\n): Result;\nexport function mapEntries<Input extends AnyRecord, ResultValue>(\n target: Input,\n fn: <Key extends keyof Input>(entry: [Key, Input[Key]]) => [PropertyKey, ResultValue]\n): Record<string, ResultValue>;\nexport function mapEntries<Input extends AnyRecord, OutputValue>(\n target: Input,\n fn: <Key extends keyof Input>(entry: [Key, Input[Key]]) => [PropertyKey, OutputValue]\n) {\n return fromEntries(entries(target).map(fn));\n}\n\nexport function mapToObject<Value, Result extends AnyRecord>(\n target: Iterable<Value>,\n fn: (value: Value, index: number) => ObjectEntry<Result>\n): Result;\nexport function mapToObject<Value, ResultValue>(\n target: Iterable<Value>,\n fn: (value: Value, index: number) => [PropertyKey, ResultValue]\n): Record<string, ResultValue>;\nexport function mapToObject<Value, OutputValue>(\n target: Iterable<Value>,\n fn: (value: Value, index: number) => [PropertyKey, OutputValue]\n) {\n return fromEntries(Array.from(target, fn));\n}\n\nexport function mapKeysToObject<const Key extends AnyKey, Value>(\n target: Iterable<Key>,\n fn: (key: Key, index: number) => Value\n): Record<Key, Value>;\nexport function mapKeysToObject<const Key extends AnyKey>(\n target: Iterable<Key>\n): {\n [K in Key]: K;\n};\nexport function mapKeysToObject<const Key extends AnyKey, Value>(\n target: Iterable<Key>,\n fn: (key: Key, index: number) => Value = identity as any\n) {\n return mapToObject(target, (key, index) => [key, fn(key, index)] as any);\n}\n","import { mapValues } from './object';\n\nconst createCase =\n (pattern: string) =>\n (input: string, delimiters = DEFAULT_DELIMITERS) =>\n toCase(input, pattern, delimiters);\n\n/**\n * Converts a string to a specified case pattern.\n * @param input The string to convert.\n * @param pattern The pattern to convert to.\n * @param delimiters The delimiters to use when splitting the string.\n * @example toCase('foo-bar baz', 'CaSe') // PascalCase 'FooBarBaz'\n * @example toCase('foo_bar baz', 'caSe') // camelCase 'fooBarBaz'\n * @example toCase('foo_bar baz', 'CASE') // upper case 'FOOBARBAZ'\n * @example toCase('foo_bar baz', 'case') // lower case 'foobarbaz'\n * @example toCase('foo_bar baz', 'CA_SE') // screaming snake case 'FOO_BAR_BAZ'\n * @example toCase('foo_bar baz', 'ca-se') // kebab case 'foo-bar-baz'\n * @example toCase('foo_bar baz', 'ca_se') // snake case 'foo_bar_baz'\n * @example toCase('foo_bar baz', 'Case') // capitalised 'Foobarbaz'\n */\nexport function toCase(input: string, pattern: string, delimiters = DEFAULT_DELIMITERS) {\n const end = pattern.slice(Math.max(0, pattern.length - 2));\n const sep = pattern.slice(2, -2);\n const start = pattern.slice(0, 2);\n\n return matches(input, delimiters)\n .map((match, index) => applyPattern(match, index === 0 ? start : end))\n .join(sep);\n}\n\n/**\n * Presets for common cases.\n */\nexport const cases = mapValues(\n {\n camel: 'caSe',\n kebab: 'ca-se',\n snake: 'ca_se',\n upper: 'CASE',\n lower: 'case',\n pascal: 'CaSe',\n capital: 'Case',\n screamingSnake: 'CA_SE'\n },\n createCase\n);\n\nconst applyPattern = (str: string, pattern: string) =>\n apply(pattern[0]!, str[0]!) + apply(pattern[1]!, str.slice(1));\n\nfunction matches(str: string, delimiters: string): string[] {\n const regex = new RegExp('([A-Z]?)([^' + delimiters + ']*)', 'g');\n\n return str.match(regex)?.filter(Boolean) ?? [];\n}\n\nfunction apply(letter: string, str: string): string {\n if (letter === '-') return '';\n if (letter === '*') return str;\n const isUpperCase = letter === letter.toUpperCase();\n\n return isUpperCase ? str.toUpperCase() : str.toLowerCase();\n}\n\nconst DEFAULT_DELIMITERS = 'A-Z\\\\s_-';\n","import { isTypeOfString } from '@neodx/std';\nimport type { CreateLogger, Logger, LoggerParams } from '../core/types.ts';\n\nexport const createLoggerAutoFactory =\n (factory: CreateLogger<any>) =>\n <const Level extends string>(\n log: AutoLoggerInput<Level>,\n defaultParams?: Partial<LoggerParams<Level>>\n ): Logger<Level> => {\n const params = isTypeOfString(log) ? { level: log } : log;\n\n return 'level' in params\n ? factory({ ...defaultParams, ...params } as Partial<LoggerParams<Level>>)\n : params;\n };\n\nexport type AutoLoggerInput<Level extends string> =\n | Level\n | (Partial<LoggerParams<Level>> & Pick<LoggerParams<Level>, 'level'>)\n | 'silent'\n | Logger<Level>;\n","import { type AnyRecord, isEmpty, isError, isObjectLike } from '@neodx/std';\n\nexport type LogArguments = [messageFragments: unknown[], meta: AnyRecord, error?: Error];\n\n/**\n * Reads arguments array and extract fields, error and message arguments.\n * @return [messageFragments, fields, error]\n *\n * Strings\n * @example readArguments('hello') -> [ ['hello'], {} ]\n * @example readArguments('hello %s', 'world') -> [ ['hello %s', 'world'], {} ]\n * @example readArguments('hello %s %d %j', 'world', 1, { id: 2 }) -> [ ['hello %s %d %j', 'world', 1, { id: 2 }], {} ]\n *\n * Additional fields\n * @example readArguments({ id: 2 }) -> [ [], { id: 2 } ]\n * @example readArguments({ id: 2 }, 'hello') -> [ ['hello'], { id: 2 } ]\n * @example readArguments({ id: 2 }, 'hello %s', 'world') -> [ ['hello %s', 'world'], { id: 2 } ]\n *\n * Errors\n * @example readArguments(myError) -> [ ['my error'], {}, myError ]\n * @example readArguments({ err: myError }) -> [ ['my error'], {}, myError ]\n * @example readArguments({ err: myError, id: 2 }) -> [ ['my error'], { id: 2 }, myError ]\n * @example readArguments({ err: myError, id: 2 }, 'hello') -> [ ['hello'], { id: 2 }, myError ]\n * @example readArguments({ err: myError, id: 2 }, 'hello %s', 'world') -> [ ['hello %s', 'world'], { id: 2 }, myError ]\n */\nexport function readArguments(args: unknown[]): LogArguments {\n const [firstArg, ...otherArgs] = args;\n\n if (isError(firstArg)) {\n return [isEmpty(otherArgs) ? [firstArg.message] : otherArgs, {}, firstArg];\n }\n\n if (isObjectLike(firstArg)) {\n if ('err' in firstArg && isError(firstArg.err)) {\n const { err, ...fields } = firstArg;\n\n return [isEmpty(otherArgs) ? [err.message] : otherArgs, fields, err];\n }\n\n return [otherArgs, firstArg as any];\n }\n\n return [args, {}];\n}\n"],"names":["toArray","value","Array","isArray","toInt","Number","parseInt","is","target","identity","isTruthy","Boolean","True","setMapValue","map","key","set","getOrCreateMapValue","create","has","get","values","Object","fromEntries","entries","hasOwn","keys","toString","prototype","getPrototypeOf","objectString","isEmpty","length","isError","Error","isEmptyObject","createTypeof","type","isTypeOfString","isTypeOfFunction","isPrimitive","isObject","isNil","isObjectLike","call","proto","getLastPrototypeOf","mapValues","fn","mapEntries","createCase","pattern","input","delimiters","DEFAULT_DELIMITERS","toCase","end","slice","Math","max","sep","start","matches","match","index","applyPattern","join","camel","kebab","snake","upper","lower","pascal","capital","screamingSnake","str","apply","regex","RegExp","filter","letter","isUpperCase","toUpperCase","toLowerCase","createLoggerAutoFactory","factory","log","defaultParams","params","level","readArguments","args","firstArg","otherArgs","message","err","fields"],"mappings":";;AAAA,wDAWO,MAAMA,OAAU,GAAA,CAAIC,QAAoBC,KAAMC,CAAAA,OAAO,CAACF,KAAAA,CAAAA,GAASA,KAAQ,GAAA;AAACA,QAAAA,KAAAA;MAAQ;AAChF,MAAMG,QAAQ,CAACH,KAAAA,GAAkBI,OAAOC,QAAQ,CAACL,OAAO,EAAI,EAAA;MACtDM,EACX,GAAA,CAASC,SACT,CAACP,KAAAA,GACCO,WAAYP,MAAc;AAOjBQ,MAAAA,QAAAA,GAAW,CAAIR,KAAAA,GAAgBA,MAAM;AAC3C,MAAMS,WAAWC,QAA0D;AAE3E,MAAMC,IAAO,GAAA,IAAY,KAAK;AAK9B,MAAMC,WAAAA,GAAc,CAAaC,GAAAA,EAA0BC,GAAUd,EAAAA,KAAAA,GAAAA;IAC1Ea,GAAIE,CAAAA,GAAG,CAACD,GA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