inferred-types 0.45.0 → 0.45.2
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/constants/Characters.d.ts +2 -0
- package/dist/constants/Characters.d.ts.map +1 -0
- package/dist/constants/Characters.js +5 -0
- package/dist/constants/NetworkConstants.d.ts.map +1 -1
- package/dist/constants/Phone.d.ts +8 -0
- package/dist/constants/Phone.d.ts.map +1 -0
- package/dist/constants/Phone.js +262 -0
- package/dist/constants/ProxmoxConstants.d.ts +2 -0
- package/dist/constants/ProxmoxConstants.d.ts.map +1 -0
- package/dist/constants/ProxmoxConstants.js +3 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +3 -0
- package/dist/constants/tsconfig.tsbuildinfo +1 -1
- package/dist/inferred-types/index.cjs +1091 -733
- package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/api/defineApi.d.ts +56 -0
- package/dist/runtime/api/defineApi.d.ts.map +1 -0
- package/dist/runtime/api/defineApi.js +97 -0
- package/dist/runtime/api/handleDoneFn.d.ts.map +1 -0
- package/dist/runtime/api/index.d.ts +3 -0
- package/dist/runtime/api/index.d.ts.map +1 -0
- package/dist/runtime/api/index.js +2 -0
- package/dist/runtime/boolean-logic/ifArrayPartial.d.ts +1 -1
- package/dist/runtime/boolean-logic/ifArrayPartial.d.ts.map +1 -1
- package/dist/runtime/boolean-logic/ifArrayPartial.js +1 -1
- package/dist/runtime/boolean-logic/ifLength.d.ts.map +1 -1
- package/dist/runtime/boolean-logic/ifScalar.d.ts.map +1 -1
- package/dist/runtime/boolean-logic/ifScalar.js +1 -1
- package/dist/runtime/boolean-logic/index.d.ts +0 -1
- package/dist/runtime/boolean-logic/index.d.ts.map +1 -1
- package/dist/runtime/boolean-logic/index.js +0 -1
- package/dist/runtime/dictionary/defineOptions.d.ts +26 -0
- package/dist/runtime/dictionary/defineOptions.d.ts.map +1 -0
- package/dist/runtime/dictionary/defineOptions.js +30 -0
- package/dist/runtime/dictionary/keysOf.d.ts +1 -1
- package/dist/runtime/dictionary/keysOf.d.ts.map +1 -1
- package/dist/runtime/errors/KindError.d.ts +2 -2
- package/dist/runtime/errors/KindError.d.ts.map +1 -1
- package/dist/runtime/functions/index.d.ts +1 -0
- package/dist/runtime/functions/index.d.ts.map +1 -1
- package/dist/runtime/functions/index.js +1 -0
- package/dist/runtime/functions/wrapFn.d.ts +2 -0
- package/dist/runtime/functions/wrapFn.d.ts.map +1 -0
- package/dist/runtime/functions/wrapFn.js +24 -0
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -10
- package/dist/runtime/lists/find.d.ts +1 -1
- package/dist/runtime/lists/find.d.ts.map +1 -1
- package/dist/runtime/lists/intersection.d.ts.map +1 -1
- package/dist/runtime/lists/intersection.js +2 -1
- package/dist/runtime/literals/asPhoneNumber.d.ts +10 -0
- package/dist/runtime/literals/asPhoneNumber.d.ts.map +1 -0
- package/dist/runtime/literals/asPhoneNumber.js +62 -0
- package/dist/runtime/literals/index.d.ts +4 -0
- package/dist/runtime/literals/index.d.ts.map +1 -1
- package/dist/runtime/literals/index.js +4 -0
- package/dist/runtime/literals/retainChars.d.ts +16 -0
- package/dist/runtime/literals/retainChars.d.ts.map +1 -0
- package/dist/runtime/literals/retainChars.js +17 -0
- package/dist/runtime/literals/retainWhile.d.ts +11 -0
- package/dist/runtime/literals/retainWhile.d.ts.map +1 -0
- package/dist/runtime/literals/retainWhile.js +12 -0
- package/dist/runtime/literals/stripChars.d.ts +10 -0
- package/dist/runtime/literals/stripChars.d.ts.map +1 -0
- package/dist/runtime/literals/stripChars.js +11 -0
- package/dist/runtime/literals/stripLeading.d.ts +3 -3
- package/dist/runtime/literals/stripLeading.d.ts.map +1 -1
- package/dist/runtime/literals/stripLeading.js +5 -5
- package/dist/runtime/literals/unset.d.ts +8 -0
- package/dist/runtime/literals/unset.d.ts.map +1 -0
- package/dist/runtime/literals/unset.js +14 -0
- package/dist/runtime/meta/youtube-meta.d.ts +8 -1
- package/dist/runtime/meta/youtube-meta.d.ts.map +1 -1
- package/dist/runtime/meta/youtube-meta.js +50 -2
- package/dist/runtime/runtime-types/dict.d.ts +2 -2
- package/dist/runtime/runtime-types/dict.d.ts.map +1 -1
- package/dist/runtime/runtime-types/ip6Prefix.d.ts +1 -1
- package/dist/runtime/runtime-types/parse.d.ts +1 -1
- package/dist/runtime/runtime-types/shape-helpers/getTokenData.d.ts +1 -1
- package/dist/runtime/runtime-types/shape-helpers/getTokenName.d.ts +1 -1
- package/dist/runtime/runtime-types/shape.d.ts +1 -1
- package/dist/runtime/runtime-types/shape.js +1 -1
- package/dist/runtime/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/type-guards/api-tg.d.ts +33 -0
- package/dist/runtime/type-guards/api-tg.d.ts.map +1 -0
- package/dist/runtime/type-guards/api-tg.js +38 -0
- package/dist/runtime/type-guards/hasWhitespace.d.ts +7 -0
- package/dist/runtime/type-guards/hasWhitespace.d.ts.map +1 -0
- package/dist/runtime/type-guards/hasWhitespace.js +11 -0
- package/dist/runtime/type-guards/index.d.ts +7 -0
- package/dist/runtime/type-guards/index.d.ts.map +1 -1
- package/dist/runtime/type-guards/index.js +7 -0
- package/dist/runtime/type-guards/isConstant.d.ts +6 -0
- package/dist/runtime/type-guards/isConstant.d.ts.map +1 -1
- package/dist/runtime/type-guards/isConstant.js +12 -2
- package/dist/runtime/type-guards/isEmail.d.ts +7 -0
- package/dist/runtime/type-guards/isEmail.d.ts.map +1 -0
- package/dist/runtime/type-guards/isEmail.js +11 -0
- package/dist/runtime/type-guards/isPhoneNumber.d.ts +14 -0
- package/dist/runtime/type-guards/isPhoneNumber.d.ts.map +1 -0
- package/dist/runtime/type-guards/isPhoneNumber.js +26 -0
- package/dist/runtime/type-guards/isSpecificConstant.js +2 -3
- package/dist/runtime/type-guards/isTrimmable.d.ts +7 -0
- package/dist/runtime/type-guards/isTrimmable.d.ts.map +1 -0
- package/dist/runtime/type-guards/isTrimmable.js +9 -0
- package/dist/runtime/type-guards/isUnset.d.ts +18 -0
- package/dist/runtime/type-guards/isUnset.d.ts.map +1 -0
- package/dist/runtime/type-guards/isUnset.js +23 -0
- package/dist/runtime/type-guards/isUrl.d.ts +1 -1
- package/dist/runtime/type-guards/network-tg.d.ts +9 -3
- package/dist/runtime/type-guards/network-tg.d.ts.map +1 -1
- package/dist/runtime/type-guards/network-tg.js +10 -1
- package/dist/runtime/type-guards/repos.d.ts +2 -2
- package/dist/runtime/type-guards/youtube.d.ts +4 -2
- package/dist/runtime/type-guards/youtube.d.ts.map +1 -1
- package/dist/runtime/type-guards/youtube.js +13 -3
- package/dist/types/api/api.d.ts +96 -37
- package/dist/types/api/api.d.ts.map +1 -1
- package/dist/types/base-types/fns/EscapeFunction.d.ts +22 -0
- package/dist/types/base-types/fns/EscapeFunction.d.ts.map +1 -0
- package/dist/types/base-types/fns/OptionalParamFn.d.ts +30 -0
- package/dist/types/base-types/fns/OptionalParamFn.d.ts.map +1 -0
- package/dist/types/base-types/fns/index.d.ts +2 -0
- package/dist/types/base-types/fns/index.d.ts.map +1 -1
- package/dist/types/base-types/fns/index.js +2 -0
- package/dist/types/boolean-logic/branching/If.d.ts +2 -3
- package/dist/types/boolean-logic/branching/If.d.ts.map +1 -1
- package/dist/types/boolean-logic/branching/IfUnset.d.ts +12 -0
- package/dist/types/boolean-logic/branching/IfUnset.d.ts.map +1 -0
- package/dist/types/boolean-logic/branching/OnPass.d.ts +4 -3
- package/dist/types/boolean-logic/branching/OnPass.d.ts.map +1 -1
- package/dist/types/boolean-logic/branching/WhenNever.d.ts +11 -0
- package/dist/types/boolean-logic/branching/WhenNever.d.ts.map +1 -0
- package/dist/types/boolean-logic/branching/WhenNever.js +1 -0
- package/dist/types/boolean-logic/branching/index.d.ts +2 -0
- package/dist/types/boolean-logic/branching/index.d.ts.map +1 -1
- package/dist/types/boolean-logic/branching/index.js +2 -0
- package/dist/types/boolean-logic/combinators/Compare.d.ts +3 -3
- package/dist/types/boolean-logic/combinators/Compare.d.ts.map +1 -1
- package/dist/types/boolean-logic/combinators/Some.d.ts +8 -0
- package/dist/types/boolean-logic/combinators/Some.d.ts.map +1 -0
- package/dist/types/boolean-logic/combinators/Some.js +1 -0
- package/dist/types/boolean-logic/combinators/index.d.ts +1 -0
- package/dist/types/boolean-logic/combinators/index.d.ts.map +1 -1
- package/dist/types/boolean-logic/combinators/index.js +1 -0
- package/dist/types/boolean-logic/narrowing/AsDoneFn.d.ts +2 -2
- package/dist/types/boolean-logic/narrowing/AsDoneFn.d.ts.map +1 -1
- package/dist/types/boolean-logic/operators/ApiOperators.d.ts +11 -0
- package/dist/types/boolean-logic/operators/ApiOperators.d.ts.map +1 -0
- package/dist/types/boolean-logic/operators/ApiOperators.js +1 -0
- package/dist/types/boolean-logic/operators/HasSameValues.d.ts +4 -3
- package/dist/types/boolean-logic/operators/HasSameValues.d.ts.map +1 -1
- package/dist/types/boolean-logic/operators/IsGreaterThan.d.ts +2 -2
- package/dist/types/boolean-logic/operators/IsGreaterThan.d.ts.map +1 -1
- package/dist/types/boolean-logic/operators/IsUnset.d.ts +9 -0
- package/dist/types/boolean-logic/operators/IsUnset.d.ts.map +1 -0
- package/dist/types/boolean-logic/operators/IsUnset.js +1 -0
- package/dist/types/boolean-logic/operators/PhoneOperators.d.ts +33 -0
- package/dist/types/boolean-logic/operators/PhoneOperators.d.ts.map +1 -0
- package/dist/types/boolean-logic/operators/PhoneOperators.js +1 -0
- package/dist/types/boolean-logic/operators/index.d.ts +3 -0
- package/dist/types/boolean-logic/operators/index.d.ts.map +1 -1
- package/dist/types/boolean-logic/operators/index.js +3 -0
- package/dist/types/dictionary/Keys.d.ts +58 -4
- package/dist/types/dictionary/Keys.d.ts.map +1 -1
- package/dist/types/dictionary/KvFn.d.ts +2 -2
- package/dist/types/dictionary/KvFn.d.ts.map +1 -1
- package/dist/types/dictionary/MakeKeysOptional.d.ts +12 -3
- package/dist/types/dictionary/MakeKeysOptional.d.ts.map +1 -1
- package/dist/types/dictionary/MakeKeysRequired.d.ts +14 -0
- package/dist/types/dictionary/MakeKeysRequired.d.ts.map +1 -0
- package/dist/types/dictionary/MakeKeysRequired.js +1 -0
- package/dist/types/dictionary/OptionalKeys.d.ts +19 -4
- package/dist/types/dictionary/OptionalKeys.d.ts.map +1 -1
- package/dist/types/dictionary/OptionalKeys.js +1 -0
- package/dist/types/dictionary/RequiredKeys.d.ts +14 -6
- package/dist/types/dictionary/RequiredKeys.d.ts.map +1 -1
- package/dist/types/dictionary/Values.d.ts +2 -2
- package/dist/types/dictionary/Values.d.ts.map +1 -1
- package/dist/types/dictionary/index.d.ts +1 -2
- package/dist/types/dictionary/index.d.ts.map +1 -1
- package/dist/types/dictionary/index.js +1 -2
- package/dist/types/errors/KindError.d.ts +1 -1
- package/dist/types/errors/KindError.d.ts.map +1 -1
- package/dist/types/functions/FnFrom.d.ts +5 -0
- package/dist/types/functions/FnFrom.d.ts.map +1 -1
- package/dist/types/functions/{Fn.d.ts → FnWithDescription.d.ts} +2 -2
- package/dist/types/functions/FnWithDescription.d.ts.map +1 -0
- package/dist/types/functions/FnWithDescription.js +1 -0
- package/dist/types/functions/WrapperFn.d.ts +23 -0
- package/dist/types/functions/WrapperFn.d.ts.map +1 -0
- package/dist/types/functions/WrapperFn.js +1 -0
- package/dist/types/functions/index.d.ts +2 -1
- package/dist/types/functions/index.d.ts.map +1 -1
- package/dist/types/functions/index.js +2 -1
- package/dist/types/lists/ConvertSet.d.ts +2 -2
- package/dist/types/lists/ConvertSet.d.ts.map +1 -1
- package/dist/types/lists/Find.d.ts +7 -18
- package/dist/types/lists/Find.d.ts.map +1 -1
- package/dist/types/literals/DoneFnTuple.d.ts +3 -3
- package/dist/types/literals/DoneFnTuple.d.ts.map +1 -1
- package/dist/types/literals/Unset.d.ts +13 -0
- package/dist/types/literals/Unset.d.ts.map +1 -0
- package/dist/types/literals/Unset.js +1 -0
- package/dist/types/literals/index.d.ts +1 -0
- package/dist/types/literals/index.d.ts.map +1 -1
- package/dist/types/literals/index.js +1 -0
- package/dist/types/numeric-literals/NumberLike.d.ts +1 -1
- package/dist/types/numeric-literals/NumberLike.d.ts.map +1 -1
- package/dist/types/string-literals/Proxmox.d.ts +7 -0
- package/dist/types/string-literals/Proxmox.d.ts.map +1 -0
- package/dist/types/string-literals/Proxmox.js +1 -0
- package/dist/types/string-literals/StripLeading.d.ts +2 -2
- package/dist/types/string-literals/StripLeading.d.ts.map +1 -1
- package/dist/types/string-literals/StripUntil.d.ts +12 -0
- package/dist/types/string-literals/StripUntil.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/Whitespace.d.ts +3 -1
- package/dist/types/string-literals/character-sets/Whitespace.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/index.d.ts +1 -0
- package/dist/types/string-literals/character-sets/index.d.ts.map +1 -1
- package/dist/types/string-literals/character-sets/index.js +1 -0
- package/dist/types/string-literals/character-sets/phone.d.ts +192 -0
- package/dist/types/string-literals/character-sets/phone.d.ts.map +1 -0
- package/dist/types/string-literals/character-sets/phone.js +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/type-conversion/ReduceValues.d.ts +19 -0
- package/dist/types/type-conversion/ReduceValues.d.ts.map +1 -0
- package/dist/types/type-conversion/ReduceValues.js +1 -0
- package/dist/types/type-conversion/ReturnValues.d.ts +10 -6
- package/dist/types/type-conversion/ReturnValues.d.ts.map +1 -1
- package/dist/types/type-conversion/Trim.d.ts +3 -1
- package/dist/types/type-conversion/Trim.d.ts.map +1 -1
- package/dist/types/type-conversion/UnionFilter.d.ts +2 -2
- package/dist/types/type-conversion/UnionFilter.d.ts.map +1 -1
- package/dist/types/type-conversion/form-fields.d.ts +5 -1
- package/dist/types/type-conversion/form-fields.d.ts.map +1 -1
- package/dist/types/type-conversion/index.d.ts +1 -0
- package/dist/types/type-conversion/index.d.ts.map +1 -1
- package/dist/types/type-conversion/index.js +1 -0
- package/package.json +17 -11
- package/dist/runtime/boolean-logic/handleDoneFn.d.ts.map +0 -1
- package/dist/types/dictionary/PrivateKeys.d.ts +0 -17
- package/dist/types/dictionary/PrivateKeys.d.ts.map +0 -1
- package/dist/types/dictionary/PublicKeys.d.ts +0 -10
- package/dist/types/dictionary/PublicKeys.d.ts.map +0 -1
- package/dist/types/functions/Fn.d.ts.map +0 -1
- /package/dist/runtime/{boolean-logic → api}/handleDoneFn.d.ts +0 -0
- /package/dist/runtime/{boolean-logic → api}/handleDoneFn.js +0 -0
- /package/dist/types/{dictionary/PrivateKeys.js → base-types/fns/EscapeFunction.js} +0 -0
- /package/dist/types/{dictionary/PublicKeys.js → base-types/fns/OptionalParamFn.js} +0 -0
- /package/dist/types/{functions/Fn.js → boolean-logic/branching/IfUnset.js} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Dictionary, Narrowable, OptionalParamFn, TypedFunction } from "../../types/index";
|
|
2
|
+
export declare const isEscapeFunction: <T>(val: T) => val is T & (() => unknown);
|
|
3
|
+
/**
|
|
4
|
+
* **isOptionalParamFunction**`(val)`
|
|
5
|
+
*
|
|
6
|
+
* A type guard which ensures that the value passed in is not only a _function_
|
|
7
|
+
* but also has the `optionalParam` value set to **true** indicating that it
|
|
8
|
+
* is safe to be called _without_ parameters.
|
|
9
|
+
*
|
|
10
|
+
* **Note:** this is similar to an "escape function" but whereas an API can
|
|
11
|
+
* only have one escape function, an API may have as many ze
|
|
12
|
+
*/
|
|
13
|
+
export declare const isOptionalParamFunction: <T>(val: T) => val is T & OptionalParamFn;
|
|
14
|
+
/**
|
|
15
|
+
* **isApi**`(val)`
|
|
16
|
+
*
|
|
17
|
+
* Type guard which validates that the value passed in is an `Api` type
|
|
18
|
+
* with "surface" and "_kind" property.
|
|
19
|
+
*
|
|
20
|
+
* **Related:** `isFluentApi()`
|
|
21
|
+
*/
|
|
22
|
+
export declare const isApi: <T extends Narrowable>(api: T) => api is T & {
|
|
23
|
+
__kind: "api";
|
|
24
|
+
surface: Dictionary | TypedFunction;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* **isApiSurface**`(val)`
|
|
28
|
+
*
|
|
29
|
+
* A type guard which tests whether the value passed in is the SurfaceArea
|
|
30
|
+
* of an API (or could be).
|
|
31
|
+
*/
|
|
32
|
+
export declare const isApiSurface: <T>(val: T) => val is T & (Dictionary | TypedFunction);
|
|
33
|
+
//# sourceMappingURL=api-tg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-tg.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/api-tg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAG,UAAU,EAAG,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,0BAAwB;AAK3F,eAAO,MAAM,gBAAgB,WAAY,CAAC,uBAAqB,OAAO,CAErE,CAAA;AAGD;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,WAAY,CAAC,+BAEhD,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,8BAA+B,CAAC;YAAwB,KAAK;aAAW,UAAU,GAAG,aAAa;CAEnH,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,4CAErC,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { isFunction } from "./isFunction.js";
|
|
2
|
+
import { isObject } from "./isObject.js";
|
|
3
|
+
export const isEscapeFunction = (val) => {
|
|
4
|
+
return isFunction(val) && "escape" in val && val.escape === true;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* **isOptionalParamFunction**`(val)`
|
|
8
|
+
*
|
|
9
|
+
* A type guard which ensures that the value passed in is not only a _function_
|
|
10
|
+
* but also has the `optionalParam` value set to **true** indicating that it
|
|
11
|
+
* is safe to be called _without_ parameters.
|
|
12
|
+
*
|
|
13
|
+
* **Note:** this is similar to an "escape function" but whereas an API can
|
|
14
|
+
* only have one escape function, an API may have as many ze
|
|
15
|
+
*/
|
|
16
|
+
export const isOptionalParamFunction = (val) => {
|
|
17
|
+
return isFunction(val) && "optionalParams" in val && val.optionalParams === true;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* **isApi**`(val)`
|
|
21
|
+
*
|
|
22
|
+
* Type guard which validates that the value passed in is an `Api` type
|
|
23
|
+
* with "surface" and "_kind" property.
|
|
24
|
+
*
|
|
25
|
+
* **Related:** `isFluentApi()`
|
|
26
|
+
*/
|
|
27
|
+
export const isApi = (api) => {
|
|
28
|
+
return isObject(api) && "surface" in api && "_kind" in api && api._kind === "api";
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* **isApiSurface**`(val)`
|
|
32
|
+
*
|
|
33
|
+
* A type guard which tests whether the value passed in is the SurfaceArea
|
|
34
|
+
* of an API (or could be).
|
|
35
|
+
*/
|
|
36
|
+
export const isApiSurface = (val) => {
|
|
37
|
+
return isObject(val) && Object.keys(val).some(k => isEscapeFunction(val[k]));
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasWhitespace.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/hasWhitespace.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,aAAa,WAAY,CAAC,aAEtC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WHITESPACE_CHARS } from "../../constants/Characters.js";
|
|
2
|
+
import { asChars } from "../type-conversion/index.js";
|
|
3
|
+
import { isString } from "./isString.js";
|
|
4
|
+
/**
|
|
5
|
+
* **hasWhiteSpace**`(val)`
|
|
6
|
+
*
|
|
7
|
+
* Type guard which checks whether a string has a any whitespace characters in it
|
|
8
|
+
*/
|
|
9
|
+
export const hasWhiteSpace = (val) => {
|
|
10
|
+
return isString(val) && asChars(val).some(c => WHITESPACE_CHARS.includes(c));
|
|
11
|
+
};
|
|
@@ -39,5 +39,12 @@ export * from "./youtube";
|
|
|
39
39
|
export * from "./repos";
|
|
40
40
|
export * from "./network-tg";
|
|
41
41
|
export * from "./isHexadecimal";
|
|
42
|
+
export * from "./isTrimmable";
|
|
43
|
+
export * from "./hasWhitespace";
|
|
44
|
+
export * from "./isEmail";
|
|
45
|
+
export * from "./isPhoneNumber";
|
|
46
|
+
export * from "./isUnset";
|
|
47
|
+
export * from "./api-tg";
|
|
48
|
+
export * from "./isFunction";
|
|
42
49
|
export * from "./higher-order/index";
|
|
43
50
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAE7B,cAAc,sBAAsB,CAAC"}
|
|
@@ -39,4 +39,11 @@ export * from "./youtube.js";
|
|
|
39
39
|
export * from "./repos.js";
|
|
40
40
|
export * from "./network-tg.js";
|
|
41
41
|
export * from "./isHexadecimal.js";
|
|
42
|
+
export * from "./isTrimmable.js";
|
|
43
|
+
export * from "./hasWhitespace.js";
|
|
44
|
+
export * from "./isEmail.js";
|
|
45
|
+
export * from "./isPhoneNumber.js";
|
|
46
|
+
export * from "./isUnset.js";
|
|
47
|
+
export * from "./api-tg.js";
|
|
48
|
+
export * from "./isFunction.js";
|
|
42
49
|
export * from "./higher-order/index.js";
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { Constant } from "../../constants/index";
|
|
2
|
+
/**
|
|
3
|
+
* **isConstant**`(val)`
|
|
4
|
+
*
|
|
5
|
+
* Type guard which checks to see if it is of type
|
|
6
|
+
* `Constant<T>`.
|
|
7
|
+
*/
|
|
2
8
|
export declare function isConstant<K extends string>(value: unknown): value is Constant<K>;
|
|
3
9
|
//# sourceMappingURL=isConstant.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isConstant.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isConstant.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"isConstant.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isConstant.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAG,8BAA4B;AAGhD;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,CAAC,SAAS,MAAM,EAChB,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,CAMtC"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { isObject
|
|
1
|
+
import { isObject } from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* **isConstant**`(val)`
|
|
4
|
+
*
|
|
5
|
+
* Type guard which checks to see if it is of type
|
|
6
|
+
* `Constant<T>`.
|
|
7
|
+
*/
|
|
2
8
|
export function isConstant(value) {
|
|
3
|
-
return isObject(value) &&
|
|
9
|
+
return isObject(value) &&
|
|
10
|
+
"_type" in value &&
|
|
11
|
+
"kind" in value &&
|
|
12
|
+
value._type === "Constant"
|
|
13
|
+
? true : false;
|
|
4
14
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEmail.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isEmail.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,OAAO,WAAY,CAAC,+CAMhC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { asChars, isString, last } from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* **isEmail**`(val)`
|
|
4
|
+
*
|
|
5
|
+
* Tests to see if a string is shaped as an email address.
|
|
6
|
+
*/
|
|
7
|
+
export const isEmail = (val) => {
|
|
8
|
+
return isString(val) && (val.split("@").length === 2 &&
|
|
9
|
+
val.split("@")[1].split(".").length > 1 &&
|
|
10
|
+
asChars(last(val.split("@")[1].split("."))).length > 1);
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **isPhoneNumber**`(val)`
|
|
3
|
+
*
|
|
4
|
+
* Type guard which validates that a string is in the shape of a phone
|
|
5
|
+
* number.
|
|
6
|
+
*
|
|
7
|
+
* - Only valid characters (numeric, whitespace, `+`, `-`, `.`, and parenthesis)
|
|
8
|
+
* - at least 7 numeric characters, 8 if `+` character used
|
|
9
|
+
* - leading character (after whitespace) must be numeric, `(` or `+`
|
|
10
|
+
*
|
|
11
|
+
* **Related:** `asPhoneNumber()`, `PhoneNumber`
|
|
12
|
+
*/
|
|
13
|
+
export declare const isPhoneNumber: <T>(val: T) => val is T;
|
|
14
|
+
//# sourceMappingURL=isPhoneNumber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPhoneNumber.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isPhoneNumber.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,WAAY,CAAC,aAoBtC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { WHITESPACE_CHARS } from "../../constants/Characters.js";
|
|
2
|
+
import { NUMERIC_CHAR } from "../../constants/NumericChar.js";
|
|
3
|
+
import { isString, asChars, retainChars, stripChars } from "../index.js";
|
|
4
|
+
/**
|
|
5
|
+
* **isPhoneNumber**`(val)`
|
|
6
|
+
*
|
|
7
|
+
* Type guard which validates that a string is in the shape of a phone
|
|
8
|
+
* number.
|
|
9
|
+
*
|
|
10
|
+
* - Only valid characters (numeric, whitespace, `+`, `-`, `.`, and parenthesis)
|
|
11
|
+
* - at least 7 numeric characters, 8 if `+` character used
|
|
12
|
+
* - leading character (after whitespace) must be numeric, `(` or `+`
|
|
13
|
+
*
|
|
14
|
+
* **Related:** `asPhoneNumber()`, `PhoneNumber`
|
|
15
|
+
*/
|
|
16
|
+
export const isPhoneNumber = (val) => {
|
|
17
|
+
return (isString(val) &&
|
|
18
|
+
["+", "(", ...NUMERIC_CHAR].includes(asChars(val.trim())[0]) &&
|
|
19
|
+
[...NUMERIC_CHAR].includes([...asChars(val.trim())].pop()) &&
|
|
20
|
+
(val.trim().startsWith(`+`)
|
|
21
|
+
? asChars(retainChars(val, ...NUMERIC_CHAR)).length >= 8
|
|
22
|
+
: val.trim().startsWith("00")
|
|
23
|
+
? asChars(retainChars(val, ...NUMERIC_CHAR)).length >= 10
|
|
24
|
+
: asChars(retainChars(val, ...NUMERIC_CHAR)).length >= 7) &&
|
|
25
|
+
stripChars(val, ...NUMERIC_CHAR, ...WHITESPACE_CHARS, "(", ")", "+", ".", "-") === "");
|
|
26
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { isConstant } from "
|
|
2
|
-
import { isEqual } from "./higher-order/isEqual.js";
|
|
1
|
+
import { isConstant } from "../index.js";
|
|
3
2
|
/**
|
|
4
3
|
* **isSpecificConstant**(kind)
|
|
5
4
|
*
|
|
@@ -7,6 +6,6 @@ import { isEqual } from "./higher-order/isEqual.js";
|
|
|
7
6
|
*/
|
|
8
7
|
export function isSpecificConstant(kind) {
|
|
9
8
|
return (value) => {
|
|
10
|
-
return isConstant(value) &&
|
|
9
|
+
return isConstant(value) && value.kind === kind ? true : false;
|
|
11
10
|
};
|
|
12
11
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isTrimmable.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isTrimmable.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,UAAU,WAAY,CAAC,aAEnC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Unset } from "../../types/index";
|
|
2
|
+
/**
|
|
3
|
+
* **isUnset**`(val)`
|
|
4
|
+
*
|
|
5
|
+
* Type guard which validates that the value passed in `Unset`.
|
|
6
|
+
*
|
|
7
|
+
* **Related:** `isSet()`
|
|
8
|
+
*/
|
|
9
|
+
export declare const isUnset: (val: unknown) => val is Unset;
|
|
10
|
+
/**
|
|
11
|
+
* **isSet**`(val)`
|
|
12
|
+
*
|
|
13
|
+
* Type guard which validates that the value passed in is **not** `Unset`.
|
|
14
|
+
*
|
|
15
|
+
* **Related:** `isUnset()`
|
|
16
|
+
*/
|
|
17
|
+
export declare const isSet: <T>(val: T) => val is Exclude<T, Unset>;
|
|
18
|
+
//# sourceMappingURL=isUnset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUnset.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isUnset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,0BAAwB;AAGxC;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,QAAS,OAAO,iBAEnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,WAAY,CAAC,6BAI9B,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isObject } from "./isObject.js";
|
|
2
|
+
/**
|
|
3
|
+
* **isUnset**`(val)`
|
|
4
|
+
*
|
|
5
|
+
* Type guard which validates that the value passed in `Unset`.
|
|
6
|
+
*
|
|
7
|
+
* **Related:** `isSet()`
|
|
8
|
+
*/
|
|
9
|
+
export const isUnset = (val) => {
|
|
10
|
+
return isObject(val) && val.kind === "Unset";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* **isSet**`(val)`
|
|
14
|
+
*
|
|
15
|
+
* Type guard which validates that the value passed in is **not** `Unset`.
|
|
16
|
+
*
|
|
17
|
+
* **Related:** `isUnset()`
|
|
18
|
+
*/
|
|
19
|
+
export const isSet = (val) => {
|
|
20
|
+
return isObject(val)
|
|
21
|
+
? val.kind !== "Unset" ? true : false
|
|
22
|
+
: true;
|
|
23
|
+
};
|
|
@@ -21,5 +21,5 @@ export declare const isUri: <T, P extends readonly NetworkProtocol[]>(val: T, ..
|
|
|
21
21
|
*
|
|
22
22
|
* **Related:** `isUri`
|
|
23
23
|
*/
|
|
24
|
-
export declare const isUrl: <T, P extends readonly NetworkProtocol[]>(val: T, ...protocols: P) => val is T & `${Keys<P>["length"] extends 0 ? "
|
|
24
|
+
export declare const isUrl: <T, P extends readonly NetworkProtocol[]>(val: T, ...protocols: P) => val is T & `${Keys<P>["length"] extends 0 ? "https" | "http" : TupleToUnion<P>}://${string}`;
|
|
25
25
|
//# sourceMappingURL=isUrl.d.ts.map
|
|
@@ -11,13 +11,13 @@ export declare const isIp4Address: <T>(val: T) => val is T & `${number}.${number
|
|
|
11
11
|
*
|
|
12
12
|
* Type guard which checks whether the value is a valid IPv6 address.
|
|
13
13
|
*/
|
|
14
|
-
export declare const isIp6Address: <T>(val: T) => val is T & (`0${string}:${string}` | `1${string}:${string}` | `2${string}:${string}` | `3${string}:${string}` | `4${string}:${string}` | `5${string}:${string}` | `6${string}:${string}` | `7${string}:${string}` | `8${string}:${string}` | `9${string}:${string}` | `
|
|
14
|
+
export declare const isIp6Address: <T>(val: T) => val is T & (`0${string}:${string}` | `1${string}:${string}` | `2${string}:${string}` | `3${string}:${string}` | `4${string}:${string}` | `5${string}:${string}` | `6${string}:${string}` | `7${string}:${string}` | `8${string}:${string}` | `9${string}:${string}` | `A${string}:${string}` | `B${string}:${string}` | `C${string}:${string}` | `D${string}:${string}` | `E${string}:${string}` | `F${string}:${string}` | `a${string}:${string}` | `b${string}:${string}` | `c${string}:${string}` | `d${string}:${string}` | `e${string}:${string}` | `f${string}:${string}`);
|
|
15
15
|
/**
|
|
16
16
|
* **isIpAddress**`(val)`
|
|
17
17
|
*
|
|
18
18
|
* Type guard which checks whether the value is a valid IP address (v4 or v6).
|
|
19
19
|
*/
|
|
20
|
-
export declare const isIpAddress: <T>(val: T) => val is T & (`${number}.${number}.${number}.${number}` | `0${string}:${string}` | `1${string}:${string}` | `2${string}:${string}` | `3${string}:${string}` | `4${string}:${string}` | `5${string}:${string}` | `6${string}:${string}` | `7${string}:${string}` | `8${string}:${string}` | `9${string}:${string}` | `
|
|
20
|
+
export declare const isIpAddress: <T>(val: T) => val is T & (`${number}.${number}.${number}.${number}` | `0${string}:${string}` | `1${string}:${string}` | `2${string}:${string}` | `3${string}:${string}` | `4${string}:${string}` | `5${string}:${string}` | `6${string}:${string}` | `7${string}:${string}` | `8${string}:${string}` | `9${string}:${string}` | `A${string}:${string}` | `B${string}:${string}` | `C${string}:${string}` | `D${string}:${string}` | `E${string}:${string}` | `F${string}:${string}` | `a${string}:${string}` | `b${string}:${string}` | `c${string}:${string}` | `d${string}:${string}` | `e${string}:${string}` | `f${string}:${string}`);
|
|
21
21
|
/**
|
|
22
22
|
* **hasUrlPort**`(val)`
|
|
23
23
|
*
|
|
@@ -31,7 +31,7 @@ export declare const hasUrlPort: <T>(val: T) => val is T & `${GetUrlProtocolPref
|
|
|
31
31
|
*
|
|
32
32
|
* Type guard which checks whether the value is a valid `UrlPath`
|
|
33
33
|
*/
|
|
34
|
-
export declare const isUrlPath: <T>(val: T) => val is T & ("" | `/-${string}` | `/0${string}` | `/1${string}` | `/2${string}` | `/3${string}` | `/4${string}` | `/5${string}` | `/6${string}` | `/7${string}` | `/8${string}` | `/9${string}` | `/
|
|
34
|
+
export declare const isUrlPath: <T>(val: T) => val is T & ("" | `/.${string}` | `/-${string}` | `/_${string}` | `/0${string}` | `/1${string}` | `/2${string}` | `/3${string}` | `/4${string}` | `/5${string}` | `/6${string}` | `/7${string}` | `/8${string}` | `/9${string}` | `/A${string}` | `/B${string}` | `/C${string}` | `/D${string}` | `/E${string}` | `/F${string}` | `/G${string}` | `/H${string}` | `/I${string}` | `/J${string}` | `/K${string}` | `/L${string}` | `/M${string}` | `/N${string}` | `/O${string}` | `/P${string}` | `/Q${string}` | `/R${string}` | `/S${string}` | `/T${string}` | `/U${string}` | `/V${string}` | `/W${string}` | `/X${string}` | `/Y${string}` | `/Z${string}` | `/a${string}` | `/b${string}` | `/c${string}` | `/d${string}` | `/e${string}` | `/f${string}` | `/g${string}` | `/h${string}` | `/i${string}` | `/j${string}` | `/k${string}` | `/l${string}` | `/m${string}` | `/n${string}` | `/o${string}` | `/p${string}` | `/q${string}` | `/r${string}` | `/s${string}` | `/t${string}` | `/u${string}` | `/v${string}` | `/w${string}` | `/x${string}` | `/y${string}` | `/z${string}` | `/@${string}`);
|
|
35
35
|
/**
|
|
36
36
|
* **isDomainName**`(val)`
|
|
37
37
|
*
|
|
@@ -45,4 +45,10 @@ export declare const isDomainName: <T>(val: T) => val is T & DomainName<AsString
|
|
|
45
45
|
* (aka, an IP address or a Domain Name)
|
|
46
46
|
*/
|
|
47
47
|
export declare const isUrlSource: <T>(val: T) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* **hasUrlQueryParameter**`(val,prop)`
|
|
50
|
+
*
|
|
51
|
+
* Tests whether the valued in has a query parameter specified by `prop`.
|
|
52
|
+
*/
|
|
53
|
+
export declare const hasUrlQueryParameter: <T, P extends string>(val: T, prop: P) => boolean;
|
|
48
54
|
//# sourceMappingURL=network-tg.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-tg.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/network-tg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,YAAY,EAAwC,0BAAuB;AAKtH,OAAO,EAAE,QAAQ,EAAE,6CAA0C;AAQ7D;;;;GAIG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,yDAKrC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,qjBAOrC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,WAAY,CAAC,imBAEpC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,WAAY,CAAC,2FAEnC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,WAAY,CAAC,ojCAalC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,uCAQrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,WAAY,CAAC,YAEpC,CAAA"}
|
|
1
|
+
{"version":3,"file":"network-tg.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/network-tg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,YAAY,EAAwC,0BAAuB;AAKtH,OAAO,EAAE,QAAQ,EAAE,6CAA0C;AAQ7D;;;;GAIG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,yDAKrC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,qjBAOrC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,WAAY,CAAC,imBAEpC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,WAAY,CAAC,2FAEnC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,WAAY,CAAC,ojCAalC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,uCAQrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,WAAY,CAAC,YAEpC,CAAA;AAGD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,6BAA6B,CAAC,QAAQ,CAAC,YAGvE,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { isNumericString } from "./isNumericString.js";
|
|
|
4
4
|
import { isString } from "./isString.js";
|
|
5
5
|
import { ip6GroupExpansion } from "../type-conversion/index.js";
|
|
6
6
|
import { isHexadecimal } from "./isHexadecimal.js";
|
|
7
|
-
import { removeUrlProtocol } from "../meta/index.js";
|
|
7
|
+
import { getUrlQueryParams, removeUrlProtocol } from "../meta/index.js";
|
|
8
8
|
/**
|
|
9
9
|
* **isIp4Address**`(val)`
|
|
10
10
|
*
|
|
@@ -83,3 +83,12 @@ export const isDomainName = (val) => {
|
|
|
83
83
|
export const isUrlSource = (val) => {
|
|
84
84
|
return isDomainName(val) || isIpAddress(val);
|
|
85
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* **hasUrlQueryParameter**`(val,prop)`
|
|
88
|
+
*
|
|
89
|
+
* Tests whether the valued in has a query parameter specified by `prop`.
|
|
90
|
+
*/
|
|
91
|
+
export const hasUrlQueryParameter = (val, prop) => {
|
|
92
|
+
const re = new RegExp(`${prop}=`);
|
|
93
|
+
return isString(val) && re.test(getUrlQueryParams(val));
|
|
94
|
+
};
|
|
@@ -16,7 +16,7 @@ export declare const isRepoSource: <T>(v: T) => v is T & ("github" | "bitbucket"
|
|
|
16
16
|
* `v 1.0.12` are allowed.
|
|
17
17
|
* - by default the `allowPrefix` option is set to false
|
|
18
18
|
*/
|
|
19
|
-
export declare const isSemanticVersion: <T, P extends boolean>(v: T, allowPrefix?: P) => v is T & `${[P] extends [true] ? import("../../types/index").OptionalSpace | "v
|
|
19
|
+
export declare const isSemanticVersion: <T, P extends boolean>(v: T, allowPrefix?: P) => v is T & `${[P] extends [true] ? "v" | import("../../types/index").OptionalSpace | "v " : ""}${number}.${number}.${number}`;
|
|
20
20
|
/**
|
|
21
21
|
* **isRepoUrl**`(val)`
|
|
22
22
|
*
|
|
@@ -29,7 +29,7 @@ export declare const isRepoUrl: <T>(val: T) => val is T & (`https://github.com/$
|
|
|
29
29
|
* Type guard which validates that the value passed in is a valid Github URL
|
|
30
30
|
*/
|
|
31
31
|
export declare const isGithubUrl: <T>(val: T) => val is T & (`https://github.com/${string}` | "https://github.com" | `https://github.com?${string}` | `https://github.io/${string}` | "https://github.io" | `https://github.io?${string}`);
|
|
32
|
-
export declare const isGithubRepoUrl: <T>(val: T) => val is T & (`https://github.com/${string}/0${string}` | `https://github.com/${string}/1${string}` | `https://github.com/${string}/2${string}` | `https://github.com/${string}/3${string}` | `https://github.com/${string}/4${string}` | `https://github.com/${string}/5${string}` | `https://github.com/${string}/6${string}` | `https://github.com/${string}/7${string}` | `https://github.com/${string}/8${string}` | `https://github.com/${string}/9${string}` | `https://github.com/${string}/
|
|
32
|
+
export declare const isGithubRepoUrl: <T>(val: T) => val is T & (`https://github.com/${string}/0${string}` | `https://github.com/${string}/1${string}` | `https://github.com/${string}/2${string}` | `https://github.com/${string}/3${string}` | `https://github.com/${string}/4${string}` | `https://github.com/${string}/5${string}` | `https://github.com/${string}/6${string}` | `https://github.com/${string}/7${string}` | `https://github.com/${string}/8${string}` | `https://github.com/${string}/9${string}` | `https://github.com/${string}/A${string}` | `https://github.com/${string}/B${string}` | `https://github.com/${string}/C${string}` | `https://github.com/${string}/D${string}` | `https://github.com/${string}/E${string}` | `https://github.com/${string}/F${string}` | `https://github.com/${string}/G${string}` | `https://github.com/${string}/H${string}` | `https://github.com/${string}/I${string}` | `https://github.com/${string}/J${string}` | `https://github.com/${string}/K${string}` | `https://github.com/${string}/L${string}` | `https://github.com/${string}/M${string}` | `https://github.com/${string}/N${string}` | `https://github.com/${string}/O${string}` | `https://github.com/${string}/P${string}` | `https://github.com/${string}/Q${string}` | `https://github.com/${string}/R${string}` | `https://github.com/${string}/S${string}` | `https://github.com/${string}/T${string}` | `https://github.com/${string}/U${string}` | `https://github.com/${string}/V${string}` | `https://github.com/${string}/W${string}` | `https://github.com/${string}/X${string}` | `https://github.com/${string}/Y${string}` | `https://github.com/${string}/Z${string}` | `https://github.com/${string}/a${string}` | `https://github.com/${string}/b${string}` | `https://github.com/${string}/c${string}` | `https://github.com/${string}/d${string}` | `https://github.com/${string}/e${string}` | `https://github.com/${string}/f${string}` | `https://github.com/${string}/g${string}` | `https://github.com/${string}/h${string}` | `https://github.com/${string}/i${string}` | `https://github.com/${string}/j${string}` | `https://github.com/${string}/k${string}` | `https://github.com/${string}/l${string}` | `https://github.com/${string}/m${string}` | `https://github.com/${string}/n${string}` | `https://github.com/${string}/o${string}` | `https://github.com/${string}/p${string}` | `https://github.com/${string}/q${string}` | `https://github.com/${string}/r${string}` | `https://github.com/${string}/s${string}` | `https://github.com/${string}/t${string}` | `https://github.com/${string}/u${string}` | `https://github.com/${string}/v${string}` | `https://github.com/${string}/w${string}` | `https://github.com/${string}/x${string}` | `https://github.com/${string}/y${string}` | `https://github.com/${string}/z${string}`);
|
|
33
33
|
/**
|
|
34
34
|
* **isBitbucketUrl**`(val)`
|
|
35
35
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { YouTubeFeedType, YouTubeFeedUrl, YouTubePlaylistUrl } from "../../types/index";
|
|
1
|
+
import { YouTubeCreatorUrl, YouTubeFeedType, YouTubeFeedUrl, YouTubePlaylistUrl } from "../../types/index";
|
|
2
2
|
/**
|
|
3
3
|
* **isYouTubeUrl**`(val)`
|
|
4
4
|
*
|
|
@@ -38,5 +38,7 @@ export declare const isYouTubePlaylistUrl: <T>(val: T) => val is T & YouTubePlay
|
|
|
38
38
|
* By default any "feed" URL is matched but you can narrow that down
|
|
39
39
|
* to a specific feed type by specifying the `kind` variable.
|
|
40
40
|
*/
|
|
41
|
-
export declare const isYouTubeFeedUrl: <T, U extends YouTubeFeedType = YouTubeFeedType>(val: T,
|
|
41
|
+
export declare const isYouTubeFeedUrl: <T, U extends YouTubeFeedType = YouTubeFeedType>(val: T, type?: U) => val is T & YouTubeFeedUrl<U>;
|
|
42
|
+
export declare const isYouTubeCreatorUrl: <T extends string>(url: T) => url is T & YouTubeCreatorUrl;
|
|
43
|
+
export declare const isYouTubeVideosInPlaylist: <T>(val: T) => val is T & `https://www.youtube.com/playlist?${string}list=${string}`;
|
|
42
44
|
//# sourceMappingURL=youtube.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"youtube.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/youtube.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"youtube.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/youtube.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,kBAAkB,EAInB,0BAAwB;AAKzB;;;;;GAKG;AACH,eAAO,MAAM,YAAY,WAAY,CAAC,sSAMrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAW,CAAC,kGAEzC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAY,CAAC,sSAM1C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,WAAY,CAAC,kCAS7C,CAAA;AAeD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,wDAIvB,CAAC,SACC,CAAC,iCAMR,CAAA;AAED,eAAO,MAAM,mBAAmB,0BACzB,CAAC,iCAOP,CAAA;AAED,eAAO,MAAM,yBAAyB,WAAY,CAAC,0EAKlD,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isString } from "./isString.js";
|
|
2
2
|
import { isUndefined } from "./isUndefined.js";
|
|
3
|
+
import { hasUrlQueryParameter } from "./network-tg.js";
|
|
3
4
|
/**
|
|
4
5
|
* **isYouTubeUrl**`(val)`
|
|
5
6
|
*
|
|
@@ -68,7 +69,16 @@ const feed_map = (type) => {
|
|
|
68
69
|
* By default any "feed" URL is matched but you can narrow that down
|
|
69
70
|
* to a specific feed type by specifying the `kind` variable.
|
|
70
71
|
*/
|
|
71
|
-
export const isYouTubeFeedUrl = (val,
|
|
72
|
-
return isString(val) && (val.startsWith(`https://www.youtube.com
|
|
73
|
-
val.startsWith(`https://youtube.com
|
|
72
|
+
export const isYouTubeFeedUrl = (val, type = undefined) => {
|
|
73
|
+
return isString(val) && (val.startsWith(`https://www.youtube.com${feed_map(type)}`) ||
|
|
74
|
+
val.startsWith(`https://youtube.com${feed_map(type)}`));
|
|
75
|
+
};
|
|
76
|
+
export const isYouTubeCreatorUrl = (url) => {
|
|
77
|
+
return isString(url) && (url.startsWith(`https://www.youtube.com/@`) ||
|
|
78
|
+
url.startsWith(`https://youtube.com/@`) ||
|
|
79
|
+
url.startsWith(`https://www.youtube.com/channel/`));
|
|
80
|
+
};
|
|
81
|
+
export const isYouTubeVideosInPlaylist = (val) => {
|
|
82
|
+
return isString(val) && (val.startsWith(`https://www.youtube.com/playlist?`) ||
|
|
83
|
+
val.startsWith(`https://youtube.com/playlist?`)) && hasUrlQueryParameter(val, "list");
|
|
74
84
|
};
|