inferred-types 0.50.27 → 0.50.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/boolean-logic/ifChar.js +1 -1
- package/dist/runtime/dictionary/get.d.ts +1 -1
- package/dist/runtime/dictionary/get.d.ts.map +1 -1
- package/dist/runtime/dictionary/get.js +1 -1
- package/dist/runtime/functional/result.js +43 -43
- package/dist/runtime/lists/createConverter.js +1 -1
- package/dist/runtime/lists/filter.js +1 -1
- package/dist/runtime/lists/getEach.js +1 -1
- package/dist/runtime/literals/color/twColor.d.ts +3 -1
- package/dist/runtime/literals/color/twColor.d.ts.map +1 -1
- package/dist/runtime/literals/color/twColor.js +1 -1
- package/dist/runtime/literals/ifLowercase.js +1 -1
- package/dist/runtime/literals/ifUppercase.js +1 -1
- package/dist/runtime/literals/pluralize.js +1 -1
- package/dist/runtime/meta/urlMeta.js +1 -1
- package/dist/runtime/runtime-types/choices.js +1 -1
- package/dist/runtime/runtime-types/shape.js +1 -1
- package/dist/runtime/runtime-types/tokens/simpleToken.js +1 -1
- package/dist/runtime/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/type-conversion/lookupCountry.js +1 -1
- package/dist/runtime/type-guards/geo/isUsState.js +1 -1
- package/dist/runtime/type-guards/geo/isZipCode.js +1 -1
- package/dist/runtime/type-guards/hasDefaultValue.d.ts +1 -1
- package/dist/runtime/type-guards/hasDefaultValue.d.ts.map +1 -1
- package/dist/runtime/type-guards/hasWhitespace.js +1 -1
- package/dist/runtime/type-guards/isAlpha.js +1 -1
- package/dist/runtime/type-guards/isConstant.d.ts +1 -1
- package/dist/runtime/type-guards/isConstant.d.ts.map +1 -1
- package/dist/runtime/type-guards/isFalsy.js +1 -1
- package/dist/runtime/type-guards/isNumericString.js +1 -1
- package/dist/runtime/type-guards/isPhoneNumber.js +1 -1
- package/dist/runtime/type-guards/isSpecificConstant.d.ts +1 -1
- package/dist/runtime/type-guards/isSpecificConstant.d.ts.map +1 -1
- package/dist/runtime/type-guards/isTruthy.js +1 -1
- package/dist/runtime/type-guards/isUrl.js +1 -1
- package/dist/runtime/type-guards/metrics/isMetric.js +1 -1
- package/dist/runtime/type-guards/metrics/isUom.js +1 -1
- package/dist/runtime/type-guards/tokens/isAtomicToken.js +1 -1
- package/dist/runtime/type-guards/tokens/isShapeToken.js +1 -1
- package/dist/runtime/type-guards/tokens/isSimpleToken.js +1 -1
- package/dist/runtime/type-guards/tokens/isSingletonToken.js +1 -1
- package/dist/runtime/type-guards/urls/news/australian.js +1 -1
- package/dist/runtime/type-guards/urls/news/belgium.js +1 -1
- package/dist/runtime/type-guards/urls/news/canadian.js +1 -1
- package/dist/runtime/type-guards/urls/news/chinese.js +1 -1
- package/dist/runtime/type-guards/urls/news/danish.js +1 -1
- package/dist/runtime/type-guards/urls/news/dutch.js +1 -1
- package/dist/runtime/type-guards/urls/news/french.js +1 -1
- package/dist/runtime/type-guards/urls/news/german.js +1 -1
- package/dist/runtime/type-guards/urls/news/indian.js +1 -1
- package/dist/runtime/type-guards/urls/news/italian.js +1 -1
- package/dist/runtime/type-guards/urls/news/japanese.js +1 -1
- package/dist/runtime/type-guards/urls/news/mexican.js +1 -1
- package/dist/runtime/type-guards/urls/news/norwegian.js +1 -1
- package/dist/runtime/type-guards/urls/news/south-korean.js +1 -1
- package/dist/runtime/type-guards/urls/news/spanish.js +1 -1
- package/dist/runtime/type-guards/urls/news/swiss.js +1 -1
- package/dist/runtime/type-guards/urls/news/turkish.js +1 -1
- package/dist/runtime/type-guards/urls/news/uk.js +1 -1
- package/dist/runtime/type-guards/urls/news/us.js +1 -1
- package/dist/runtime/type-guards/urls/repos/bitbucket.d.ts +1 -1
- package/dist/runtime/type-guards/urls/repos/bitbucket.d.ts.map +1 -1
- package/dist/runtime/type-guards/urls/repos/bitbucket.js +1 -1
- package/dist/runtime/type-guards/urls/repos/codeCommit.d.ts +1 -1
- package/dist/runtime/type-guards/urls/repos/codeCommit.d.ts.map +1 -1
- package/dist/runtime/type-guards/urls/repos/codeCommit.js +1 -1
- package/dist/runtime/type-guards/urls/repos/isSemanticVersion.js +1 -1
- package/dist/runtime/type-guards/urls/retail.js +1 -1
- package/dist/types/boolean-logic/branching/OnPass.d.ts +1 -1
- package/dist/types/boolean-logic/branching/OnPass.d.ts.map +1 -1
- package/dist/types/boolean-logic/narrowing/AsIndexOf.d.ts +1 -1
- package/dist/types/boolean-logic/narrowing/AsIndexOf.d.ts.map +1 -1
- package/dist/types/boolean-logic/narrowing/AsSomething.d.ts +1 -1
- package/dist/types/boolean-logic/narrowing/AsSomething.d.ts.map +1 -1
- package/dist/types/containers/RemoveEmpty.d.ts +1 -1
- package/dist/types/containers/RemoveEmpty.d.ts.map +1 -1
- package/dist/types/containers/RemoveMarked.d.ts +1 -1
- package/dist/types/containers/RemoveMarked.d.ts.map +1 -1
- package/dist/types/dictionary/WithValue.d.ts +1 -1
- package/dist/types/dictionary/WithValue.d.ts.map +1 -1
- package/dist/types/functional/Result.d.ts +1 -1
- package/dist/types/functional/Result.d.ts.map +1 -1
- package/dist/types/lists/FilterLiterals.d.ts +1 -1
- package/dist/types/lists/FilterLiterals.d.ts.map +1 -1
- package/dist/types/lists/IndexOf.d.ts +1 -1
- package/dist/types/lists/IndexOf.d.ts.map +1 -1
- package/dist/types/literals/FromDefn.d.ts +1 -1
- package/dist/types/literals/FromDefn.d.ts.map +1 -1
- package/dist/types/numeric-literals/Digit.d.ts +1 -1
- package/dist/types/numeric-literals/Digit.d.ts.map +1 -1
- package/dist/types/runtime-types/Dict.d.ts +1 -1
- package/dist/types/runtime-types/Dict.d.ts.map +1 -1
- package/dist/types/runtime-types/SimpleType.d.ts +1 -1
- package/dist/types/runtime-types/SimpleType.d.ts.map +1 -1
- package/dist/types/runtime-types/Type.d.ts +1 -1
- package/dist/types/runtime-types/Type.d.ts.map +1 -1
- package/dist/types/runtime-types/TypeOf.d.ts +1 -1
- package/dist/types/runtime-types/TypeOf.d.ts.map +1 -1
- package/dist/types/runtime-types/TypeToken.d.ts +1 -1
- package/dist/types/runtime-types/TypeToken.d.ts.map +1 -1
- package/dist/types/sets/Intersection.d.ts +1 -1
- package/dist/types/sets/Intersection.d.ts.map +1 -1
- package/dist/types/string-literals/Pluralize.d.ts +1 -1
- package/dist/types/string-literals/Pluralize.d.ts.map +1 -1
- package/dist/types/string-literals/Proxmox.d.ts +1 -1
- package/dist/types/string-literals/Proxmox.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/Consonants.d.ts +1 -1
- package/dist/types/string-literals/character-sets/Consonants.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/Country.d.ts +1 -1
- package/dist/types/string-literals/character-sets/Country.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/DomainName.d.ts +1 -1
- package/dist/types/string-literals/character-sets/DomainName.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/IpAddress.d.ts +1 -1
- package/dist/types/string-literals/character-sets/IpAddress.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/LowerAlphaChar.d.ts +1 -1
- package/dist/types/string-literals/character-sets/LowerAlphaChar.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/NumericChar.d.ts +1 -1
- package/dist/types/string-literals/character-sets/NumericChar.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/Repos.d.ts +1 -1
- package/dist/types/string-literals/character-sets/Repos.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/SingularNoun.d.ts +1 -1
- package/dist/types/string-literals/character-sets/SingularNoun.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/UpperAlphaChar.d.ts +1 -1
- package/dist/types/string-literals/character-sets/UpperAlphaChar.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/images/ImgFormat.d.ts +1 -1
- package/dist/types/string-literals/character-sets/images/ImgFormat.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/phone/PhoneCountryCode.d.ts +1 -1
- package/dist/types/string-literals/character-sets/phone/PhoneCountryCode.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/phone/ToPhoneFormat.d.ts +1 -1
- package/dist/types/string-literals/character-sets/phone/ToPhoneFormat.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/tw/TwColor.d.ts +1 -1
- package/dist/types/string-literals/character-sets/tw/TwColor.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/Github.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/Github.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/Social.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/Social.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/Url.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/Url.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/bitbucket.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/bitbucket.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/book-urls.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/book-urls.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/australian.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/australian.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/belgian.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/belgian.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/canadian.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/canadian.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/chinese.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/chinese.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/danish.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/danish.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/dutch.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/dutch.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/french.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/french.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/german.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/german.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/indian.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/indian.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/italian.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/italian.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/japanese.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/japanese.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/mexican.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/mexican.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/norwegian.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/norwegian.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/south-korean.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/south-korean.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/spanish.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/spanish.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/swiss.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/swiss.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/turkish.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/turkish.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/uk.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/uk.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/news/us.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/news/us.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/urls/retail.d.ts +1 -1
- package/dist/types/string-literals/character-sets/urls/retail.d.ts.map +1 -1
- package/dist/types/string-literals/geo/state.d.ts +1 -1
- package/dist/types/string-literals/geo/state.d.ts.map +1 -1
- package/dist/types/string-literals/geo/zip.d.ts +1 -1
- package/dist/types/string-literals/geo/zip.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/acceleration.d.ts +1 -1
- package/dist/types/string-literals/metrics/acceleration.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/area.d.ts +1 -1
- package/dist/types/string-literals/metrics/area.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/current.d.ts +1 -1
- package/dist/types/string-literals/metrics/current.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/distance.d.ts +1 -1
- package/dist/types/string-literals/metrics/distance.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/energy.d.ts +1 -1
- package/dist/types/string-literals/metrics/energy.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/frequency.d.ts +1 -1
- package/dist/types/string-literals/metrics/frequency.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/luminosity.d.ts +1 -1
- package/dist/types/string-literals/metrics/luminosity.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/mass.d.ts +1 -1
- package/dist/types/string-literals/metrics/mass.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/power.d.ts +1 -1
- package/dist/types/string-literals/metrics/power.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/pressure.d.ts +1 -1
- package/dist/types/string-literals/metrics/pressure.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/resistance.d.ts +1 -1
- package/dist/types/string-literals/metrics/resistance.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/speed.d.ts +1 -1
- package/dist/types/string-literals/metrics/speed.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/temperature.d.ts +1 -1
- package/dist/types/string-literals/metrics/temperature.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/time.d.ts +1 -1
- package/dist/types/string-literals/metrics/time.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/voltage.d.ts +1 -1
- package/dist/types/string-literals/metrics/voltage.d.ts.map +1 -1
- package/dist/types/string-literals/metrics/volume.d.ts +1 -1
- package/dist/types/string-literals/metrics/volume.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/type-conversion/RetainChars.d.ts +1 -1
- package/dist/types/type-conversion/RetainChars.d.ts.map +1 -1
- package/dist/types/type-conversion/StripChars.d.ts +1 -1
- package/dist/types/type-conversion/StripChars.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Narrowable, DotPathFor, Get, Suggest } from "src/types/index";
|
|
2
|
-
import { NoDefaultValue, NotDefined } from "
|
|
2
|
+
import { NoDefaultValue, NotDefined } from "inferred-types";
|
|
3
3
|
export interface GetOptions<TDefVal extends Narrowable, TInvalid extends Narrowable> {
|
|
4
4
|
/**
|
|
5
5
|
* Typically when getting a valid dotpath and the value evaluates to _undefined_
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/runtime/dictionary/get.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,GAAG,EACH,OAAO,EAGR,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,cAAc,EACd,UAAU,EAEX,MAAM,
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/runtime/dictionary/get.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,GAAG,EACH,OAAO,EAGR,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,cAAc,EACd,UAAU,EAEX,MAAM,gBAAgB,CAAC;AA0FxB,MAAM,WAAW,UAAU,CACzB,OAAO,SAAS,UAAU,EAC1B,QAAQ,SAAS,UAAU;IAE3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,QAAQ,CAAC;CACjC;AAGD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,GAAG,CACjB,MAAM,SAAS,UAAU,GAAG,SAAS,OAAO,EAAE,EAC9C,QAAQ,SAAS,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAC5C,OAAO,SAAS,UAAU,GAAG,cAAc,EAC3C,QAAQ,SAAS,UAAU,GAAG,UAAU,EAEtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,GAAG,IAAI,EACxB,OAAO,GAAE,UAAU,CAAC,OAAO,EAAE,QAAQ,CAGH,GAcP,GAAG,CAAC,MAAM,EAAC,QAAQ,CAAC,CAClD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NO_DEFAULT_VALUE, NOT_DEFINED } from "
|
|
1
|
+
import { NO_DEFAULT_VALUE, NOT_DEFINED } from "inferred-types";
|
|
2
2
|
import { createErrorCondition, isTruthy, hasIndexOf, isSpecificConstant, hasDefaultValue, isContainer, isRef, indexOf } from "src/runtime/index";
|
|
3
3
|
/** updates based on whether segment is a Ref or not */
|
|
4
4
|
function updatedDotPath(value, dotpath, segment) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// /* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
// /* eslint-disable no-use-before-define */
|
|
3
3
|
// import { RESULT } from "src/constants/Functional"
|
|
4
|
-
// import {
|
|
5
|
-
// Ok,
|
|
6
|
-
// Result,
|
|
7
|
-
// AsFunction,
|
|
8
|
-
// Narrowable,
|
|
4
|
+
// import {
|
|
5
|
+
// Ok,
|
|
6
|
+
// Result,
|
|
7
|
+
// AsFunction,
|
|
8
|
+
// Narrowable,
|
|
9
9
|
// Err,
|
|
10
10
|
// ResultErr,
|
|
11
11
|
// ObjectKey,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// IsFunction,
|
|
20
20
|
// If,
|
|
21
21
|
// } from "src/types/index"
|
|
22
|
-
// import { Never } from "
|
|
22
|
+
// import { Never } from "inferred-types";
|
|
23
23
|
// import { isFunction, isObject, isString } from "../type-guards/index";
|
|
24
24
|
// import { toKebabCase } from "../literals/toKebabCase";
|
|
25
25
|
// import { asUnion } from "../type-conversion/asUnion";
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
// import { toPascalCase } from "../literals";
|
|
30
30
|
// const errInputs: ErrInput = "undefined" as const;
|
|
31
31
|
// export const isResult = (val: unknown): val is Result => {
|
|
32
|
-
// return typeof val === "object" &&
|
|
33
|
-
// "__kind" in (val as object) &&
|
|
32
|
+
// return typeof val === "object" &&
|
|
33
|
+
// "__kind" in (val as object) &&
|
|
34
34
|
// "state" in (val as object) &&
|
|
35
35
|
// [RESULT.Err, RESULT.Ok].includes((val as any).state)
|
|
36
36
|
// }
|
|
37
37
|
// function resultTuple<
|
|
38
|
-
// T,
|
|
38
|
+
// T,
|
|
39
39
|
// E extends ErrInput
|
|
40
40
|
// >(val: T, err: E) {
|
|
41
41
|
// return {
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
// result: null as unknown as Result<T,E>,
|
|
51
51
|
// ok: (v) => {
|
|
52
52
|
// return {
|
|
53
|
-
// ...resultTuple(val,err), state: RESULT.Ok, val: v
|
|
53
|
+
// ...resultTuple(val,err), state: RESULT.Ok, val: v
|
|
54
54
|
// } as Ok<T>
|
|
55
55
|
// },
|
|
56
56
|
// err: (e) => {
|
|
57
57
|
// return {
|
|
58
|
-
// ...resultTuple(val,err),
|
|
59
|
-
// state: RESULT.Err,
|
|
58
|
+
// ...resultTuple(val,err),
|
|
59
|
+
// state: RESULT.Err,
|
|
60
60
|
// err: transformErrInput(e)
|
|
61
61
|
// } as unknown as Err<E>
|
|
62
62
|
// },
|
|
@@ -82,13 +82,13 @@
|
|
|
82
82
|
// }) as ResultApi<T,E>;
|
|
83
83
|
// /**
|
|
84
84
|
// * **ok**(val)
|
|
85
|
-
// *
|
|
85
|
+
// *
|
|
86
86
|
// * Places a value into the `Ok` state of a `Result` structure.
|
|
87
|
-
// *
|
|
87
|
+
// *
|
|
88
88
|
// * Note: if you need/want the value to be narrowly typed then use `okN()` instead.
|
|
89
89
|
// */
|
|
90
90
|
// export function ok<
|
|
91
|
-
// T,
|
|
91
|
+
// T,
|
|
92
92
|
// E extends ErrInput
|
|
93
93
|
// >(val: T, _err: E = errInputs as E): IfEqual<E, ErrInput, Ok<T>, Ok<T,E>> {
|
|
94
94
|
// const tuple = resultTuple(val, _err) as unknown as ResultTuple<T,E>;
|
|
@@ -96,15 +96,15 @@
|
|
|
96
96
|
// }
|
|
97
97
|
// /**
|
|
98
98
|
// * **ok**(val)
|
|
99
|
-
// *
|
|
99
|
+
// *
|
|
100
100
|
// * Places a value into the `Ok` state of a `Result` structure.
|
|
101
|
-
// *
|
|
101
|
+
// *
|
|
102
102
|
// * Note: this can only receive _narrowable_ types in order to provide the
|
|
103
103
|
// * narrowest type possible for `T` but if you don't need this then use the
|
|
104
104
|
// * `ok(val)` function instead.
|
|
105
105
|
// */
|
|
106
106
|
// export function okN<
|
|
107
|
-
// T extends Narrowable,
|
|
107
|
+
// T extends Narrowable,
|
|
108
108
|
// E extends ErrInput
|
|
109
109
|
// >(val: T, _err: E = errInputs as E): Ok<T> {
|
|
110
110
|
// const tuple = resultTuple(val, "unknown") as unknown as ResultTuple<T,E>;
|
|
@@ -122,11 +122,11 @@
|
|
|
122
122
|
// : typeof input === "string"
|
|
123
123
|
// ? [{ msg: input, kind: toKebabCase(input as string), context: {} }]
|
|
124
124
|
// : typeof input === "object"
|
|
125
|
-
// ? [{
|
|
126
|
-
// msg: takeProp((input as Record<ObjectKey, unknown>), "msg", "" as string),
|
|
125
|
+
// ? [{
|
|
126
|
+
// msg: takeProp((input as Record<ObjectKey, unknown>), "msg", "" as string),
|
|
127
127
|
// kind: toKebabCase(takeProp((input as Record<ObjectKey, unknown>), "kind", "unspecified-kind") as string),
|
|
128
|
-
// context: takeProp((input as Record<ObjectKey, unknown>), "context", {} as NonNullable<unknown>),
|
|
129
|
-
// trace: takeProp((input as Record<ObjectKey, unknown>), "trace", false),
|
|
128
|
+
// context: takeProp((input as Record<ObjectKey, unknown>), "context", {} as NonNullable<unknown>),
|
|
129
|
+
// trace: takeProp((input as Record<ObjectKey, unknown>), "trace", false),
|
|
130
130
|
// }]
|
|
131
131
|
// : Array.isArray(input)
|
|
132
132
|
// ? input
|
|
@@ -137,13 +137,13 @@
|
|
|
137
137
|
// }
|
|
138
138
|
// /**
|
|
139
139
|
// * **createErr**(e) → `<ResultErr>`
|
|
140
|
-
// *
|
|
140
|
+
// *
|
|
141
141
|
// * Creates a reusable error template which will allow for:
|
|
142
|
-
// *
|
|
142
|
+
// *
|
|
143
143
|
// * - a strict `kind` definition
|
|
144
144
|
// * - a _shape_ and default values for the `context` property
|
|
145
145
|
// * - a strict `stack` definition (default is false)
|
|
146
|
-
// *
|
|
146
|
+
// *
|
|
147
147
|
// * The `msg` property will be left as `string` allowing each variant of
|
|
148
148
|
// * this type of error to add their own.
|
|
149
149
|
// */
|
|
@@ -159,14 +159,14 @@
|
|
|
159
159
|
// }
|
|
160
160
|
// /**
|
|
161
161
|
// * **err**(input) -> Err`<E>`
|
|
162
|
-
// *
|
|
162
|
+
// *
|
|
163
163
|
// * Creates a `Err` error for use inside a `Result<T,E>` block.
|
|
164
164
|
// */
|
|
165
165
|
// export function err<
|
|
166
166
|
// TErr extends string | ResultErr<any, any>,
|
|
167
167
|
// TVal = unknown
|
|
168
168
|
// >(
|
|
169
|
-
// err: TErr,
|
|
169
|
+
// err: TErr,
|
|
170
170
|
// _val: TVal = null as unknown as ErrInput as TVal
|
|
171
171
|
// ): IfEqual<TVal, unknown, Err<TErr>, Err<TErr,TVal>> {
|
|
172
172
|
// return {
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
// }
|
|
178
178
|
// /**
|
|
179
179
|
// * **isOk**(result)
|
|
180
|
-
// *
|
|
180
|
+
// *
|
|
181
181
|
// * Type guard which tests whether the `Result<T,E>` is in the **Ok** state.
|
|
182
182
|
// */
|
|
183
183
|
// export const isOk = <
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
// }
|
|
188
188
|
// /**
|
|
189
189
|
// * **okOrThrow**(result)
|
|
190
|
-
// *
|
|
190
|
+
// *
|
|
191
191
|
// * Returns the Ok _value_ if it's in the Ok status; otherwise throws
|
|
192
192
|
// * an error.
|
|
193
193
|
// */
|
|
@@ -213,10 +213,10 @@
|
|
|
213
213
|
// }
|
|
214
214
|
// /**
|
|
215
215
|
// * **okOrElse**(result, els)
|
|
216
|
-
// *
|
|
216
|
+
// *
|
|
217
217
|
// * Returns the _value_ of the `Result<T,E>` if in the **Ok** state, otherwise
|
|
218
218
|
// * returns `els`.
|
|
219
|
-
// *
|
|
219
|
+
// *
|
|
220
220
|
// * - **Note:** if `els` is a function it will be called while passing the error
|
|
221
221
|
// * object to the function.
|
|
222
222
|
// */
|
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
// E extends ResultErr,
|
|
227
227
|
// Els
|
|
228
228
|
// >(
|
|
229
|
-
// result: R,
|
|
229
|
+
// result: R,
|
|
230
230
|
// els: Els
|
|
231
231
|
// ): IsOk<R> extends true ? T : If<IsFunction<Els>, ReturnType<AsFunction<Els>>, Els> {
|
|
232
232
|
// return result.state === RESULT.Err
|
|
@@ -241,14 +241,14 @@
|
|
|
241
241
|
// >(result: Result<T,E>): result is Err<E,T> {
|
|
242
242
|
// return (
|
|
243
243
|
// isString(result)
|
|
244
|
-
// ? {
|
|
245
|
-
// state: RESULT.Err,
|
|
246
|
-
// err:{
|
|
247
|
-
// msg: result,
|
|
248
|
-
// kind: toPascalCase(result),
|
|
249
|
-
// context: {},
|
|
250
|
-
// stack: false
|
|
251
|
-
// }
|
|
244
|
+
// ? {
|
|
245
|
+
// state: RESULT.Err,
|
|
246
|
+
// err:{
|
|
247
|
+
// msg: result,
|
|
248
|
+
// kind: toPascalCase(result),
|
|
249
|
+
// context: {},
|
|
250
|
+
// stack: false
|
|
251
|
+
// }
|
|
252
252
|
// }
|
|
253
253
|
// : isObject(result)
|
|
254
254
|
// ? {
|
|
@@ -262,12 +262,12 @@
|
|
|
262
262
|
// }
|
|
263
263
|
// : false
|
|
264
264
|
// )
|
|
265
|
-
// ? true
|
|
265
|
+
// ? true
|
|
266
266
|
// : false
|
|
267
267
|
// }
|
|
268
268
|
// /**
|
|
269
269
|
// * **assertErr**(result)
|
|
270
|
-
// *
|
|
270
|
+
// *
|
|
271
271
|
// * Asserts that a _result_ is of the `Err` type.
|
|
272
272
|
// */
|
|
273
273
|
// export function assertErr<
|
|
@@ -279,7 +279,7 @@
|
|
|
279
279
|
// typeof (result as any).err === "string" ||
|
|
280
280
|
// typeof (result as any).err === "object"
|
|
281
281
|
// )
|
|
282
|
-
// ? true
|
|
282
|
+
// ? true
|
|
283
283
|
// : false
|
|
284
284
|
// ) as IsErr<typeof result>;
|
|
285
285
|
// }
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// import { isSameTypeOf } from "../type-guards/higher-order/isSameTypeOf";
|
|
3
3
|
// import { endsWith,startsWith } from "../type-guards";
|
|
4
4
|
// import { asArray } from "./asArray";
|
|
5
|
-
// import { Never } from "
|
|
5
|
+
// import { Never } from "inferred-types";
|
|
6
6
|
// /**
|
|
7
7
|
// * **createFilter**(op,comparator) → (list) → _filtered results_
|
|
8
8
|
// *
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { TwColor, TwLuminosity, TwLuminosityLookup, TwChromaLookup, TwHue } from "src/types/index";
|
|
2
|
+
type Rtn<TColor extends TwColor, TLum extends TwLuminosity> = TLum extends keyof TwLuminosityLookup ? TLum extends keyof TwChromaLookup ? TColor extends keyof TwHue ? `oklch(${TwLuminosityLookup[TLum]} ${TwChromaLookup[TLum]} ${TwHue[TColor]}) ` : never : never : never;
|
|
2
3
|
/**
|
|
3
4
|
* Provides a Tailwind Color using the `oklch` color
|
|
4
5
|
* specification. The output is intended to put into
|
|
5
6
|
* a CSS property.
|
|
6
7
|
*/
|
|
7
|
-
export declare const twColor: <TColor extends TwColor, TLum extends TwLuminosity>(color: TColor, luminosity: TLum) =>
|
|
8
|
+
export declare const twColor: <TColor extends TwColor, TLum extends TwLuminosity>(color: TColor, luminosity: TLum) => Rtn<TColor, TLum>;
|
|
9
|
+
export {};
|
|
8
10
|
//# sourceMappingURL=twColor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twColor.d.ts","sourceRoot":"","sources":["../../../../src/runtime/literals/color/twColor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,KAAK,EACN,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"twColor.d.ts","sourceRoot":"","sources":["../../../../src/runtime/literals/color/twColor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,KAAK,EACN,MAAM,iBAAiB,CAAC;AAKzB,KAAK,GAAG,CACN,MAAM,SAAS,OAAO,EACtB,IAAI,SAAS,YAAY,IAE3B,IAAI,SAAS,MAAM,kBAAkB,GACnC,IAAI,SAAS,MAAM,cAAc,GAC/B,MAAM,SAAS,MAAM,KAAK,GACxB,SAAS,kBAAkB,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,GAC9E,KAAK,GACP,KAAK,GACP,KAAK,CAAC;AAER;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,MAAM,SAAS,OAAO,EACtB,IAAI,SAAS,YAAY,SAElB,MAAM,cACD,IAAI,KAKsC,GAAG,CAAC,MAAM,EAAC,IAAI,CACtE,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ALPHA_CHARS, PLURAL_EXCEPTIONS, SINGULAR_NOUN_ENDINGS } from "
|
|
1
|
+
import { ALPHA_CHARS, PLURAL_EXCEPTIONS, SINGULAR_NOUN_ENDINGS } from "inferred-types";
|
|
2
2
|
import { stripTrailing, split, rightWhitespace } from "src/runtime/index";
|
|
3
3
|
const isException = (word) => Object.keys(PLURAL_EXCEPTIONS).includes(word);
|
|
4
4
|
const _END_IN = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isUrl, isIp4Address, isIp6Address, isIpAddress, stripAfter, stripBefore, ensureLeading, stripTrailing, isDomainName, takeNumericCharacters, } from "src/runtime/index";
|
|
2
2
|
import { NETWORK_PROTOCOL_LOOKUP } from "src/constants/NetworkConstants";
|
|
3
|
-
import { Never } from "
|
|
3
|
+
import { Never } from "inferred-types";
|
|
4
4
|
const PROTOCOLS = Object.values(NETWORK_PROTOCOL_LOOKUP).flat().filter(i => i !== "");
|
|
5
5
|
export const getUrlProtocol = (url) => {
|
|
6
6
|
const proto = PROTOCOLS.find(p => url.startsWith(`${p}://`));
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// } from "src/types/index";
|
|
14
14
|
// import { isDoneFn, isFunction, isString, isTuple, isUndefined } from "../type-guards/index";
|
|
15
15
|
// import { shape } from "./shape";
|
|
16
|
-
// import { Never } from "
|
|
16
|
+
// import { Never } from "inferred-types";
|
|
17
17
|
// export const createChoice: CreateChoice = <
|
|
18
18
|
// TName extends string,
|
|
19
19
|
// TValue extends ChoiceValue
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SHAPE_PREFIXES } from "
|
|
1
|
+
import { SHAPE_PREFIXES } from "inferred-types";
|
|
2
2
|
import { isString, hasKeys, isObject, handleDoneFn, } from "src/runtime/index";
|
|
3
3
|
import { boolean, nullType, undefinedType, unknown } from "./shape-helpers/atomics";
|
|
4
4
|
import { number, string } from "./shape-helpers/singletons";
|