inferred-types 0.55.4 → 0.55.6
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/modules/inferred-types/dist/index.cjs +315 -3
- package/modules/inferred-types/dist/index.cjs.map +1 -1
- package/modules/inferred-types/dist/index.d.ts +199 -5
- package/modules/inferred-types/dist/index.js +309 -3
- package/modules/inferred-types/dist/index.js.map +1 -1
- package/modules/runtime/dist/index.cjs +317 -3
- package/modules/runtime/dist/index.cjs.map +1 -1
- package/modules/runtime/dist/index.d.ts +145 -4
- package/modules/runtime/dist/index.js +311 -3
- package/modules/runtime/dist/index.js.map +1 -1
- package/modules/types/dist/index.d.ts +54 -1
- package/package.json +1 -1
|
@@ -2697,6 +2697,12 @@ declare const NORWEGIAN_NEWS: readonly [{
|
|
|
2697
2697
|
*/
|
|
2698
2698
|
declare const NUMERIC_CHAR: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
2699
2699
|
declare const NON_ZERO_NUMERIC_CHAR: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
2700
|
+
/**
|
|
2701
|
+
* **PHONE_COUNTRY_CODES**
|
|
2702
|
+
*
|
|
2703
|
+
* `[code, 3 letter country code, 2 letter country code]`
|
|
2704
|
+
*/
|
|
2705
|
+
declare const PHONE_COUNTRY_CODES: readonly [readonly ["886", "TWN", "TW"], readonly ["93", "AFG", "AF"], readonly ["355", "ALB", "AL"], readonly ["213", "DZA", "DZ"], readonly ["1-684", "ASM", "AS"], readonly ["376", "AND", "AD"], readonly ["244", "AGO", "AO"], readonly ["1-264", "AIA", "AI"], readonly ["672", "ATA", "AQ"], readonly ["1-268", "ATG", "AG"], readonly ["54", "ARG", "AR"], readonly ["374", "ARM", "AM"], readonly ["297", "ABW", "AW"], readonly ["61", "AUS", "AU"], readonly ["43", "AUT", "AT"], readonly ["994", "AZE", "AZ"], readonly ["1-242", "BHS", "BS"], readonly ["973", "BHR", "BH"], readonly ["880", "BGD", "BD"], readonly ["1-246", "BRB", "BB"], readonly ["375", "BLR", "BY"], readonly ["32", "BEL", "BE"], readonly ["501", "BLZ", "BZ"], readonly ["229", "BEN", "BJ"], readonly ["1-441", "BMU", "BM"], readonly ["975", "BTN", "BT"], readonly ["591", "BOL", "BO"], readonly ["599", "BES", "BQ"], readonly ["387", "BIH", "BA"], readonly ["267", "BWA", "BW"], readonly ["47", "BVT", "BV"], readonly ["55", "BRA", "BR"], readonly ["246", "IOT", "IO"], readonly ["1-284", "VGB", "VG"], readonly ["673", "BRN", "BN"], readonly ["359", "BGR", "BG"], readonly ["226", "BFA", "BF"], readonly ["257", "BDI", "BI"], readonly ["238", "CPV", "CV"], readonly ["855", "KHM", "KH"], readonly ["237", "CMR", "CM"], readonly ["1", "CAN", "CA"], readonly ["1-345", "CYM", "KY"], readonly ["236", "CAF", "CF"], readonly ["235", "TCD", "TD"], readonly ["56", "CHL", "CL"], readonly ["86", "CHN", "CN"], readonly ["852", "HKG", "HK"], readonly ["853", "MAC", "MO"], readonly ["61", "CXR", "CX"], readonly ["61", "CCK", "CC"], readonly ["57", "COL", "CO"], readonly ["269", "COM", "KM"], readonly ["242", "COG", "CG"], readonly ["682", "COK", "CK"], readonly ["506", "CRI", "CR"], readonly ["385", "HRV", "HR"], readonly ["53", "CUB", "CU"], readonly ["599", "CUW", "CW"], readonly ["357", "CYP", "CY"], readonly ["420", "CZE", "CZ"], readonly ["225", "CIV", "CI"], readonly ["850", "PRK", "KP"], readonly ["243", "COD", "CD"], readonly ["45", "DNK", "DK"], readonly ["253", "DJI", "DJ"], readonly ["1-767", "DMA", "DM"], readonly ["1-809", "DOM", "DO"], readonly ["1-829", "DOM", "DO"], readonly ["1-849", "DOM", "DO"], readonly ["593", "ECU", "EC"], readonly ["20", "EGY", "EG"], readonly ["503", "SLV", "SV"], readonly ["240", "GNQ", "GQ"], readonly ["291", "ERI", "ER"], readonly ["372", "EST", "EE"], readonly ["268", "SWZ", "SZ"], readonly ["251", "ETH", "ET"], readonly ["500", "FLK", "FK"], readonly ["298", "FRO", "FO"], readonly ["679", "FJI", "FJ"], readonly ["358", "FIN", "FI"], readonly ["33", "FRA", "FR"], readonly ["594", "GUF", "GF"], readonly ["689", "PYF", "PF"], readonly ["262", "ATF", "TF"], readonly ["241", "GAB", "GA"], readonly ["220", "GMB", "GM"], readonly ["995", "GEO", "GE"], readonly ["49", "DEU", "DE"], readonly ["233", "GHA", "GH"], readonly ["350", "GIB", "GI"], readonly ["30", "GRC", "GR"], readonly ["299", "GRL", "GL"], readonly ["1-473", "GRD", "GD"], readonly ["590", "GLP", "GP"], readonly ["1-671", "GUM", "GU"], readonly ["502", "GTM", "GT"], readonly ["44", "GGY", "GG"], readonly ["224", "GIN", "GN"], readonly ["245", "GNB", "GW"], readonly ["592", "GUY", "GY"], readonly ["509", "HTI", "HT"], readonly ["672", "HMD", "HM"], readonly ["39-06", "VAT", "VA"], readonly ["504", "HND", "HN"], readonly ["36", "HUN", "HU"], readonly ["354", "ISL", "IS"], readonly ["91", "IND", "IN"], readonly ["62", "IDN", "ID"], readonly ["98", "IRN", "IR"], readonly ["964", "IRQ", "IQ"], readonly ["353", "IRL", "IE"], readonly ["44", "IMN", "IM"], readonly ["972", "ISR", "IL"], readonly ["39", "ITA", "IT"], readonly ["1-876", "JAM", "JM"], readonly ["81", "JPN", "JP"], readonly ["44", "JEY", "JE"], readonly ["962", "JOR", "JO"], readonly ["7", "KAZ", "KZ"], readonly ["254", "KEN", "KE"], readonly ["686", "KIR", "KI"], readonly ["965", "KWT", "KW"], readonly ["996", "KGZ", "KG"], readonly ["856", "LAO", "LA"], readonly ["371", "LVA", "LV"], readonly ["961", "LBN", "LB"], readonly ["266", "LSO", "LS"], readonly ["231", "LBR", "LR"], readonly ["218", "LBY", "LY"], readonly ["423", "LIE", "LI"], readonly ["370", "LTU", "LT"], readonly ["352", "LUX", "LU"], readonly ["261", "MDG", "MG"], readonly ["265", "MWI", "MW"], readonly ["60", "MYS", "MY"], readonly ["960", "MDV", "MV"], readonly ["223", "MLI", "ML"], readonly ["356", "MLT", "MT"], readonly ["692", "MHL", "MH"], readonly ["596", "MTQ", "MQ"], readonly ["222", "MRT", "MR"], readonly ["230", "MUS", "MU"], readonly ["262", "MYT", "YT"], readonly ["52", "MEX", "MX"], readonly ["691", "FSM", "FM"], readonly ["377", "MCO", "MC"], readonly ["976", "MNG", "MN"], readonly ["382", "MNE", "ME"], readonly ["1-664", "MSR", "MS"], readonly ["212", "MAR", "MA"], readonly ["258", "MOZ", "MZ"], readonly ["95", "MMR", "MM"], readonly ["264", "NAM", "NA"], readonly ["674", "NRU", "NR"], readonly ["977", "NPL", "NP"], readonly ["31", "NLD", "NL"], readonly ["687", "NCL", "NC"], readonly ["64", "NZL", "NZ"], readonly ["505", "NIC", "NI"], readonly ["227", "NER", "NE"], readonly ["234", "NGA", "NG"], readonly ["683", "NIU", "NU"], readonly ["672", "NFK", "NF"], readonly ["1-670", "MNP", "MP"], readonly ["47", "NOR", "NO"], readonly ["968", "OMN", "OM"], readonly ["92", "PAK", "PK"], readonly ["680", "PLW", "PW"], readonly ["507", "PAN", "PA"], readonly ["675", "PNG", "PG"], readonly ["595", "PRY", "PY"], readonly ["51", "PER", "PE"], readonly ["63", "PHL", "PH"], readonly ["870", "PCN", "PN"], readonly ["48", "POL", "PL"], readonly ["351", "PRT", "PT"], readonly ["974", "QAT", "QA"], readonly ["82", "KOR", "KR"], readonly ["373", "MDA", "MD"], readonly ["40", "ROU", "RO"], readonly ["7", "RUS", "RU"], readonly ["250", "RWA", "RW"], readonly ["262", "REU", "RE"], readonly ["590", "BLM", "BL"], readonly ["290", "SHN", "SH"], readonly ["1-869", "KNA", "KN"], readonly ["1-758", "LCA", "LC"], readonly ["590", "MAF", "MF"], readonly ["508", "SPM", "PM"], readonly ["1-784", "VCT", "VC"], readonly ["685", "WSM", "WS"], readonly ["378", "SMR", "SM"], readonly ["239", "STP", "ST"], readonly ["966", "SAU", "SA"], readonly ["221", "SEN", "SN"], readonly ["381", "SRB", "RS"], readonly ["248", "SYC", "SC"], readonly ["232", "SLE", "SL"], readonly ["65", "SGP", "SG"], readonly ["1-721", "SXM", "SX"], readonly ["421", "SVK", "SK"], readonly ["386", "SVN", "SI"], readonly ["677", "SLB", "SB"], readonly ["252", "SOM", "SO"], readonly ["27", "ZAF", "ZA"], readonly ["500", "SGS", "GS"], readonly ["211", "SSD", "SS"], readonly ["34", "ESP", "ES"], readonly ["94", "LKA", "LK"], readonly ["970", "PSE", "PS"], readonly ["249", "SDN", "SD"], readonly ["597", "SUR", "SR"], readonly ["47", "SJM", "SJ"], readonly ["46", "SWE", "SE"], readonly ["41", "CHE", "CH"], readonly ["963", "SYR", "SY"], readonly ["992", "TJK", "TJ"], readonly ["66", "THA", "TH"], readonly ["389", "MKD", "MK"], readonly ["670", "TLS", "TL"], readonly ["228", "TGO", "TG"], readonly ["690", "TKL", "TK"], readonly ["676", "TON", "TO"], readonly ["1-868", "TTO", "TT"], readonly ["216", "TUN", "TN"], readonly ["90", "TUR", "TR"], readonly ["993", "TKM", "TM"], readonly ["1-649", "TCA", "TC"], readonly ["688", "TUV", "TV"], readonly ["256", "UGA", "UG"], readonly ["380", "UKR", "UA"], readonly ["971", "ARE", "AE"], readonly ["44", "GBR", "GB"], readonly ["255", "TZA", "TZ"], readonly ["1-340", "VIR", "VI"], readonly ["1", "USA", "US"], readonly ["598", "URY", "UY"], readonly ["998", "UZB", "UZ"], readonly ["678", "VUT", "VU"], readonly ["58", "VEN", "VE"], readonly ["84", "VNM", "VN"], readonly ["681", "WLF", "WF"], readonly ["212", "ESH", "EH"], readonly ["967", "YEM", "YE"], readonly ["260", "ZMB", "ZM"], readonly ["263", "ZWE", "ZW"], readonly ["358", "ALA", "AX"]];
|
|
2700
2706
|
|
|
2701
2707
|
/**
|
|
2702
2708
|
* **PLURAL_EXCEPTIONS**
|
|
@@ -6920,6 +6926,25 @@ type AsIp6Prefix<T extends readonly Ip6Group[]> = T extends [Ip6Group] ? `${T[0]
|
|
|
6920
6926
|
*/
|
|
6921
6927
|
type LowerAlphaChar = typeof LOWER_ALPHA_CHARS[number];
|
|
6922
6928
|
|
|
6929
|
+
/**
|
|
6930
|
+
* **CountryPhoneNumber**`<[TDelimiter]>`
|
|
6931
|
+
*
|
|
6932
|
+
* Provides a shape phone number meant for use within a country. It includes
|
|
6933
|
+
* the local number plus what would be referred to as the "area code" in the
|
|
6934
|
+
* USA.
|
|
6935
|
+
*
|
|
6936
|
+
* **Related:** `InternationalPhoneNumber`, `LocalPhoneNumber`, `PhoneNumber`
|
|
6937
|
+
*/
|
|
6938
|
+
type CountryPhoneNumber<TDelimiter extends PhoneNumberDelimiter = PhoneNumberDelimiter> = `${PhoneAreaCode}${TDelimiter}${LocalPhoneNumber<TDelimiter>}`;
|
|
6939
|
+
|
|
6940
|
+
/**
|
|
6941
|
+
* **DialCountryCode**
|
|
6942
|
+
*
|
|
6943
|
+
* A simplified representation of `PhoneCountryCode` so as to not make other
|
|
6944
|
+
* phone patterns too complex.
|
|
6945
|
+
*/
|
|
6946
|
+
type DialCountryCode = `${"+" | "00"}${`1-${number}` | `${Exclude<NumericChar, "0">}`}${Optional<`${number}`>}`;
|
|
6947
|
+
|
|
6923
6948
|
/**
|
|
6924
6949
|
* GetPhoneCountryCode`<T>`
|
|
6925
6950
|
*
|
|
@@ -6933,6 +6958,74 @@ type LowerAlphaChar = typeof LOWER_ALPHA_CHARS[number];
|
|
|
6933
6958
|
*/
|
|
6934
6959
|
type GetPhoneCountryCode<T> = T extends string ? [IsStringLiteral<T>] extends [true] ? StartsWith<Trim<T>, "+" | "00"> extends true ? [Trim<T>] extends [`${"+" | "00"}${infer CC}${PhoneNumberDelimiter}${string}`] ? RetainUntil<CC, " "> : "" : "" : string : never;
|
|
6935
6960
|
|
|
6961
|
+
/**
|
|
6962
|
+
* **InternationalPhoneNumber**`<[TDelimiter]>`
|
|
6963
|
+
*
|
|
6964
|
+
* A phone number which explicitly leads by expressing the _country_ that the number belongs to.
|
|
6965
|
+
*
|
|
6966
|
+
* - uses `+` or `00` prefix to mark as a country code
|
|
6967
|
+
*
|
|
6968
|
+
* **Related:** `CountryPhoneNumber`, `LocalPhoneNumber`, `PhoneNumber`
|
|
6969
|
+
*/
|
|
6970
|
+
type InternationalPhoneNumber<TDelimiter extends PhoneNumberDelimiter = PhoneNumberDelimiter> = `${DialCountryCode}${TDelimiter}${CountryPhoneNumber<TDelimiter>}`;
|
|
6971
|
+
|
|
6972
|
+
/**
|
|
6973
|
+
* **LocalPhoneNumber**`<[TDelimiter]>`
|
|
6974
|
+
*
|
|
6975
|
+
* Provides a shape for phone numbers local a region of country that do
|
|
6976
|
+
* not have a _country code_ designation nor what is referred to as the
|
|
6977
|
+
* "area code" in the USA.
|
|
6978
|
+
*
|
|
6979
|
+
* **Related:** `CountryPhoneNumber`, `InternationalPhoneNumber`, `PhoneNumber`
|
|
6980
|
+
*/
|
|
6981
|
+
type LocalPhoneNumber<TDelimiter extends PhoneNumberDelimiter = PhoneNumberDelimiter> = `${NumericChar}${number}${TDelimiter}${number}`;
|
|
6982
|
+
|
|
6983
|
+
/**
|
|
6984
|
+
* **PhoneAreaCode**
|
|
6985
|
+
*/
|
|
6986
|
+
type PhoneAreaCode = `(${number})` | `${NumericChar}${number}`;
|
|
6987
|
+
|
|
6988
|
+
type PhoneCountryLookup = Mutable<[...typeof PHONE_COUNTRY_CODES]>;
|
|
6989
|
+
/**
|
|
6990
|
+
* **PhoneCountryCode**
|
|
6991
|
+
*
|
|
6992
|
+
* The official list of _phone_ country codes
|
|
6993
|
+
*
|
|
6994
|
+
* **Related:** `DialCountryCode`
|
|
6995
|
+
*/
|
|
6996
|
+
type PhoneCountryCode = FirstOfEach<PhoneCountryLookup>;
|
|
6997
|
+
|
|
6998
|
+
type Process$14<T extends string, _TDelimiter extends PhoneNumberDelimiter = PhoneNumberDelimiter> = OnPass<[
|
|
6999
|
+
], T>;
|
|
7000
|
+
/**
|
|
7001
|
+
* **PhoneNumber**`<[T]>`
|
|
7002
|
+
*
|
|
7003
|
+
* Without use of the generic `T`, provides a basic shape for phone
|
|
7004
|
+
* numbers which should keep people on good behavior when
|
|
7005
|
+
* accepting phone numbers.
|
|
7006
|
+
*
|
|
7007
|
+
* When passing a string into `T`, this utility will do a lot more
|
|
7008
|
+
* validity checking on the value.
|
|
7009
|
+
*
|
|
7010
|
+
* - Only valid characters (numeric, whitespace, `+`, `-`, `.`, and parenthesis)
|
|
7011
|
+
* - all _leading_ and _trailing_ whitespace removed for remaining comparisons
|
|
7012
|
+
* - at least 7 numeric characters
|
|
7013
|
+
* - 8 if `+` character used as leading character (after whitespace)
|
|
7014
|
+
* - 10 if `00` are leading characters
|
|
7015
|
+
* - leading character (after whitespace) must be numeric, `(` or `+`
|
|
7016
|
+
*
|
|
7017
|
+
* - Related: `PhoneNumberWithCountryCode`, `UsPhoneNumber`
|
|
7018
|
+
*/
|
|
7019
|
+
type PhoneNumber<T extends number | string | null = null, TDelimiter extends PhoneNumberDelimiter = PhoneNumberDelimiter> = T extends null ? LocalPhoneNumber<TDelimiter> | CountryPhoneNumber<TDelimiter> | InternationalPhoneNumber<TDelimiter> : IsStringLiteral<T> extends true ? Process$14<As<T, string>, TDelimiter> : IsNumericLiteral<T> extends true ? Process$14<`${As<T, number>}`, TDelimiter> : T extends string ? string | ErrorCondition<"invalid-phone-number"> : T extends number ? number | ErrorCondition<"invalid-phone-number"> : never;
|
|
7020
|
+
type PhoneNumberWithCountryCode = `+${PhoneCountryCode} ${string}`;
|
|
7021
|
+
type Sep = "." | " " | "-";
|
|
7022
|
+
type AreaCode = `(${number}) ` | `${number}${Sep}`;
|
|
7023
|
+
type Local = `${number}${Sep}${number}`;
|
|
7024
|
+
/**
|
|
7025
|
+
* A US-only phone number which requires starting with the country code.
|
|
7026
|
+
*/
|
|
7027
|
+
type UsPhoneNumber = `+1 ${AreaCode}${Local}`;
|
|
7028
|
+
|
|
6936
7029
|
/**
|
|
6937
7030
|
* delimiter characters commonly used to separate digits in phone numbers
|
|
6938
7031
|
*/
|
|
@@ -7765,6 +7858,20 @@ type IterateOver<TContent extends readonly unknown[], TTrailing extends string>
|
|
|
7765
7858
|
*/
|
|
7766
7859
|
type EnsureTrailing<TContent extends string | number | readonly (string | number)[], TTrailing extends string | number> = IsWideType<TContent> extends true ? IsWideType<TTrailing> extends true ? TContent : `${string}${TTrailing}` : IsWideType<TTrailing> extends true ? IsString<TContent> extends true ? `${AsString<TContent>}${string}` : never : TContent extends number ? AsNumber<P<`${TContent}`, `${TTrailing}`>> : TContent extends string ? P<TContent, `${TTrailing}`> : TContent extends readonly unknown[] ? IterateOver<TContent, `${TTrailing}`> : never;
|
|
7767
7860
|
|
|
7861
|
+
/** the shae for an American Express long number */
|
|
7862
|
+
type AmericanExpress = `${number} ${number} ${number}`;
|
|
7863
|
+
/** the shape for a VISA/Mastercard long number */
|
|
7864
|
+
type VisaMastercard = `${number} ${number} ${number} ${number}`;
|
|
7865
|
+
/**
|
|
7866
|
+
* Represents the string literal type for either a Mastercard/VISA
|
|
7867
|
+
* format or an American Express card.
|
|
7868
|
+
*
|
|
7869
|
+
* **Related:**
|
|
7870
|
+
* - `IsVisaMastercard`, `IsAmericanExpress`, `IsCreditCard`
|
|
7871
|
+
* - `isVisaMastercard()`, `isAmericanExpress()`, `isCreditCard()`
|
|
7872
|
+
*/
|
|
7873
|
+
type CreditCard = VisaMastercard | AmericanExpress;
|
|
7874
|
+
|
|
7768
7875
|
type UsStateLookup = Mutable<typeof US_STATE_LOOKUP>;
|
|
7769
7876
|
type UsProvinceLookup = Mutable<typeof US_STATE_LOOKUP_PROVINCES>;
|
|
7770
7877
|
type _UsStateAbbrev = {
|
|
@@ -11534,6 +11641,19 @@ type Unique<TList extends readonly unknown[], TDeref extends string | number | n
|
|
|
11534
11641
|
*/
|
|
11535
11642
|
type UniqueKeys<L extends Container, R extends Container> = LeftRight<AsNumberWhenPossible<UnionToTuple$1<Exclude<keyof L, keyof R>>>, AsNumberWhenPossible<UnionToTuple$1<Exclude<keyof R, keyof L>>>>;
|
|
11536
11643
|
|
|
11644
|
+
/**
|
|
11645
|
+
* **FirstOfEach**`<TList>`
|
|
11646
|
+
*
|
|
11647
|
+
* Expects `TList` to consist of an array of arrays and then this utility will reduce
|
|
11648
|
+
* this to a _tuple_ of all the first elements in `TList`.
|
|
11649
|
+
*
|
|
11650
|
+
* ```ts
|
|
11651
|
+
* // ["foo", "bar"]
|
|
11652
|
+
* type A = FirstOfEach<[ ["foo", 1], ["bar", 2] ]>;
|
|
11653
|
+
* ```
|
|
11654
|
+
*/
|
|
11655
|
+
type FirstOfEach<T extends readonly unknown[][]> = T[number][0] extends T[number][number] ? T[number][0] : never;
|
|
11656
|
+
|
|
11537
11657
|
interface State {
|
|
11538
11658
|
base: Uri<"http" | "https">;
|
|
11539
11659
|
endpoints?: any[];
|
|
@@ -13921,6 +14041,10 @@ declare function isTomorrow(test: unknown): boolean;
|
|
|
13921
14041
|
*/
|
|
13922
14042
|
declare function isYesterday(test: unknown): boolean;
|
|
13923
14043
|
|
|
14044
|
+
declare function isVisaMastercard(val: unknown): val is VisaMastercard;
|
|
14045
|
+
declare function isAmericanExpress(val: unknown): val is AmericanExpress;
|
|
14046
|
+
declare function isCreditCard(val: unknown): val is CreditCard;
|
|
14047
|
+
|
|
13924
14048
|
/**
|
|
13925
14049
|
* Type guard which checks whether `val` is a 2 character country
|
|
13926
14050
|
* representation found in the ISO3166-1 standard.
|
|
@@ -14361,7 +14485,7 @@ declare function isObject(value: unknown): value is Dictionary;
|
|
|
14361
14485
|
declare function isNarrowableObject(value: unknown): value is Dictionary<ObjectKey, Narrowable>;
|
|
14362
14486
|
|
|
14363
14487
|
/**
|
|
14364
|
-
* **
|
|
14488
|
+
* **maybePhoneNumber**`(val)`
|
|
14365
14489
|
*
|
|
14366
14490
|
* Type guard which validates that a string is in the shape of a phone
|
|
14367
14491
|
* number.
|
|
@@ -14370,9 +14494,26 @@ declare function isNarrowableObject(value: unknown): value is Dictionary<ObjectK
|
|
|
14370
14494
|
* - at least 7 numeric characters, 8 if `+` character used
|
|
14371
14495
|
* - leading character (after whitespace) must be numeric, `(` or `+`
|
|
14372
14496
|
*
|
|
14373
|
-
* **Related:** `asPhoneNumber()`, `PhoneNumber`
|
|
14497
|
+
* **Related:** `asPhoneNumber()`, `PhoneNumber`, `isPhoneNumber`
|
|
14498
|
+
*/
|
|
14499
|
+
declare function maybePhoneNumber(val: unknown): val is PhoneNumber;
|
|
14500
|
+
/**
|
|
14501
|
+
* Type guard which validates that `val` starts with a valid
|
|
14502
|
+
* country code (although starting whitespace is also allowed).
|
|
14503
|
+
*/
|
|
14504
|
+
declare function hasCountryCode(val: unknown): val is PhoneNumberWithCountryCode;
|
|
14505
|
+
declare function isUsPhoneNumber(val: unknown): val is UsPhoneNumber;
|
|
14506
|
+
/**
|
|
14507
|
+
* **isPhoneNumber**`(val)`
|
|
14508
|
+
*
|
|
14509
|
+
* Type guard which validates that a string is in the shape of a phone
|
|
14510
|
+
* number. This is a MORE strict check than `maybePhoneNumber()` which
|
|
14511
|
+
* you may want to use if you're pretty sure numeric looking values
|
|
14512
|
+
* are meant to be phone numbers.
|
|
14513
|
+
*
|
|
14514
|
+
* **Related:** `asPhoneNumber()`, `PhoneNumber`, `maybePhoneNumber`
|
|
14374
14515
|
*/
|
|
14375
|
-
declare function isPhoneNumber(val: unknown):
|
|
14516
|
+
declare function isPhoneNumber(val: unknown): val is PhoneNumber;
|
|
14376
14517
|
|
|
14377
14518
|
/**
|
|
14378
14519
|
* **isReadonlyArray**(value)
|
|
@@ -15334,4 +15475,4 @@ declare function isVueRef(val: unknown): val is VueRef;
|
|
|
15334
15475
|
*/
|
|
15335
15476
|
declare function asVueRef<T extends Narrowable>(value: T): VueRef<T>;
|
|
15336
15477
|
|
|
15337
|
-
export { type AsClassSelector, type AsList, type BoxValue, type BoxedFnParams, type ConfigRestApi, type CssKeyframeCallback, type CssSelectorOptions, type CsvFormat, type DictionaryWithValueFilter, type DictionaryWithoutValueFilter, type DoesExtendTypeguard, type EndingWithTypeGuard, type EndpointGenerator, type EqualTo, type Finder, type FnParam, type FnParams, type GenParam, type GenParams, type GetEachOptions, type GetInference, type GetInferenceProps, type GetOptions, type Joiner, type KeyframeApi, type Mapper, type Rtn, ShapeApiImplementation, type SingletonClosure, type StartingWithTypeGuard, type StripSurroundConfigured, type SurroundWith, type ToKeyValueSort, type TokenContainerClosure, type TokenFunctionClosure, type TokenSetClosure, type TypeOfTypeGuard, type Unbox, type UndefinedArrayIsUnknown, type UnionClosure, type UrlMeta, type YouTubeMeta, addFnToProps, addPropsToFn, and, asApi, asArray, asChars, asDate, asEscapeFunction, asIsoDate, asOptionalParamFunction, asPhoneFormat, asRecord, asString, asStringLiteral, asType, asTypeToken, asVueRef, box, boxDictionaryValues, capitalize, choices, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFixedLengthArray, createFnWithProps, createFnWithPropsExplicit, createLifoQueue, createMapper, createObjectMap, createTypeToken, cssColor, csv, defineCss, defineObj, defineObject, defineObjectApi, defineTuple, doesExtend, endsWith, ensureLeading, ensureSurround, ensureTrailing, entries, errCondition, filter, find, fnMeta, fromDefineObject, fromKeyValue, get, getDaysBetween, getEach, getPhoneCountryCode, getTailwindModifiers, getToday, getTokenKind, getTomorrow, getTypeSubtype, getUrlBase, getUrlDefaultPort, getUrlDynamics, getUrlPath, getUrlPort, getUrlProtocol, getUrlQueryParams, getUrlSource, getWeekNumber, getYesterday, getYouTubePageType, handleDoneFn, hasDefaultValue, hasIndexOf, hasKeys, hasOverlappingKeys, hasProtocol, hasProtocolPrefix, hasUrlPort, hasUrlQueryParameter, hasWhiteSpace, idLiteral, idTypeGuard, identity, ifArray, ifArrayPartial, ifBoolean, ifChar, ifContainer, ifDefined, ifFalse, ifFunction, ifHasKey, ifLength, ifLowercaseChar, ifNotNull, ifNull, ifNumber, ifObject, ifSameType, ifScalar, ifString, ifTrue, ifUndefined, ifUppercaseChar, indexOf, infer, intersect, intersection, ip6GroupExpansion, ip6Prefix, isAccelerationMetric, isAccelerationUom, isAlpha, isAmazonUrl, isApi, isApiSurface, isAppleUrl, isAreaMetric, isAreaUom, isArray, isArrayToken, isAtomicKind, isAtomicToken, isAustralianNewsUrl, isBelgiumNewsUrl, isBestBuyUrl, isBitbucketUrl, isBoolean, isBooleanLike, isBox, isCanadianNewsUrl, isChineseNewsUrl, isCodeCommitUrl, isConstant, isContainer, isContainerToken, isCostCoUrl, isCountryAbbrev, isCountryCode2, isCountryCode3, isCountryName, isCssAspectRatio, isCsv, isCurrentMetric, isCurrentUom, isCvsUrl, isDanishNewsUrl, isDate, isDefineObject, isDefined, isDellUrl, isDistanceMetric, isDistanceUom, isDomainName, isDoneFn, isDutchNewsUrl, isEbayUrl, isEmail, isEmpty, isEnergyMetric, isEnergyUom, isEqual, isErrorCondition, isEscapeFunction, isEtsyUrl, isFalse, isFalsy, isFnBasedKind, isFnBasedToken, isFnWithParams, isFrenchNewsUrl, isFrequencyMetric, isFrequencyUom, isFunction, isGermanNewsUrl, isGithubIssueUrl, isGithubIssuesListUrl, isGithubOrgUrl, isGithubProjectUrl, isGithubProjectsListUrl, isGithubReleaseTagUrl, isGithubReleasesListUrl, isGithubRepoReleaseTagUrl, isGithubRepoReleasesUrl, isGithubRepoUrl, isGithubUrl, isHexadecimal, isHmUrl, isHomeDepotUrl, isHtmlElement, isIkeaUrl, isIndexable, isIndianNewsUrl, isInlineSvg, isIp4Address, isIp6Address, isIpAddress, isIso3166Alpha2, isIso3166Alpha3, isIso3166CountryCode, isIso3166CountryName, isIsoDate, isIsoDateTime, isIsoExplicitDate, isIsoExplicitTime, isIsoImplicitDate, isIsoImplicitTime, isIsoTime, isIsoYear, isItalianNewsUrl, isJapaneseNewsUrl, isKrogersUrl, isLeapYear, isLength, isLikeRegExp, isLowesUrl, isLuminosityMetric, isLuminosityUom, isLuxonDateTime, isMacysUrl, isMap, isMapToken, isMassMetric, isMassUom, isMetric, isMexicanNewsUrl, isMoment, isNarrowableObject, isNever, isNewsUrl, isNikeUrl, isNorwegianNewsUrl, isNotNull, isNothing, isNull, isNumber, isNumberLike, isNumericArray, isNumericString, isObject, isObjectToken, isOptionalParamFunction, isPhoneNumber, isPowerMetric, isPowerUom, isPressureMetric, isPressureUom, isProtocol, isProtocolPrefix, isReadonlyArray, isRecordToken, isRef, isRegExp, isRepoSource, isRepoUrl, isResistance, isResistanceUom, isRetailUrl, isSameTypeOf, isScalar, isSemanticVersion, isSet, isSetBasedKind, isSetBasedToken, isSetContainer, isSetToken, isShape, isShapeCallback, isSimpleContainerToken, isSimpleContainerTokenTuple, isSimpleScalarToken, isSimpleScalarTokenTuple, isSimpleToken, isSimpleTokenTuple, isSingletonKind, isSingletonToken, isSocialMediaProfileUrl, isSocialMediaUrl, isSouthKoreanNewsUrl, isSpanishNewsUrl, isSpecificConstant, isSpeedMetric, isSpeedUom, isString, isStringArray, isSwissNewsUrl, isSymbol, isTailwindColor, isTailwindColorClass, isTailwindColorName, isTailwindColorTarget, isTailwindColorWithLuminosity, isTailwindColorWithLuminosityAndOpacity, isTailwindModifier, isTargetUrl, isTemperatureMetric, isTemperatureUom, isThenable, isThisMonth, isThisWeek, isThisYear, isTimeMetric, isTimeUom, isToday, isTomorrow, isTrimable, isTrue, isTruthy, isTuple, isTupleToken, isTurkishNewsUrl, isTypeOf, isTypeSubtype, isTypeToken, isTypeTokenKind, isTypeTuple, isUkNewsUrl, isUndefined, isUnset, isUom, isUri, isUrl, isUrlPath, isUrlSource, isUsNewsUrl, isUsStateAbbreviation, isUsStateName, isVariable, isVoltageMetric, isVoltageUom, isVolumeMetric, isVolumeUom, isVueRef, isWalgreensUrl, isWalmartUrl, isWayfairUrl, isWholeFoodsUrl, isYesterday, isYouTubeCreatorUrl, isYouTubeFeedHistoryUrl, isYouTubeFeedUrl, isYouTubePlaylistUrl, isYouTubePlaylistsUrl, isYouTubeShareUrl, isYouTubeSubscriptionsUrl, isYouTubeTrendingUrl, isYouTubeUrl, isYouTubeVideoUrl, isYouTubeVideosInPlaylist, isZaraUrl, isZipCode, isZipCode5, isZipPlus4, joinWith, jsonValue, jsonValues, keysOf, kindLiteral, last, list, literal, logicalReturns, lookupCountryAlpha2, lookupCountryAlpha3, lookupCountryCode, lookupCountryName, lowercase, mergeObjects, mergeScalars, mergeTuples, nameLiteral, narrow, narrowObjectTo, narrowObjectToType, never, objectToApi, objectValues, omit, optional, optionalOrNull, or, orNull, pathJoin, pluralize, removePhoneCountryCode, removeTailwindModifiers, removeUrlProtocol, result, retain, retainAfter, retainAfterInclusive, retainChars, retainUntil, retainUntilInclusive, retainWhile, reverse, rightWhitespace, shape, sharedKeys, shift, simpleContainerToken, simpleContainerTokenToTypeToken, simpleContainerType, simpleScalarToken, simpleScalarTokenToTypeToken, simpleScalarType, simpleToken, simpleType, simpleUnionTokenToTypeToken, slice, split, startsWith, stripAfter, stripBefore, stripChars, stripLeading, stripParenthesis, stripSurround, stripTrailing, stripUntil, stripWhile, surround, takeNumericCharacters, takeProp, toCamelCase, toKebabCase, toKeyValue, toNumber, toNumericArray, toPascalCase, toSnakeCase, toString, toUppercase, trim, trimEnd, trimLeft, trimRight, trimStart, truncate, tuple, twColor, unbox, uncapitalize, union, unionize, unique, uniqueKeys, unset, uppercase, urlMeta, valuesOf, widen, withDefaults, withKeys, withValue, withoutKeys, withoutValue, wrapFn, youtubeEmbed, youtubeMeta };
|
|
15478
|
+
export { type AsClassSelector, type AsList, type BoxValue, type BoxedFnParams, type ConfigRestApi, type CssKeyframeCallback, type CssSelectorOptions, type CsvFormat, type DictionaryWithValueFilter, type DictionaryWithoutValueFilter, type DoesExtendTypeguard, type EndingWithTypeGuard, type EndpointGenerator, type EqualTo, type Finder, type FnParam, type FnParams, type GenParam, type GenParams, type GetEachOptions, type GetInference, type GetInferenceProps, type GetOptions, type Joiner, type KeyframeApi, type Mapper, type Rtn, ShapeApiImplementation, type SingletonClosure, type StartingWithTypeGuard, type StripSurroundConfigured, type SurroundWith, type ToKeyValueSort, type TokenContainerClosure, type TokenFunctionClosure, type TokenSetClosure, type TypeOfTypeGuard, type Unbox, type UndefinedArrayIsUnknown, type UnionClosure, type UrlMeta, type YouTubeMeta, addFnToProps, addPropsToFn, and, asApi, asArray, asChars, asDate, asEscapeFunction, asIsoDate, asOptionalParamFunction, asPhoneFormat, asRecord, asString, asStringLiteral, asType, asTypeToken, asVueRef, box, boxDictionaryValues, capitalize, choices, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFixedLengthArray, createFnWithProps, createFnWithPropsExplicit, createLifoQueue, createMapper, createObjectMap, createTypeToken, cssColor, csv, defineCss, defineObj, defineObject, defineObjectApi, defineTuple, doesExtend, endsWith, ensureLeading, ensureSurround, ensureTrailing, entries, errCondition, filter, find, fnMeta, fromDefineObject, fromKeyValue, get, getDaysBetween, getEach, getPhoneCountryCode, getTailwindModifiers, getToday, getTokenKind, getTomorrow, getTypeSubtype, getUrlBase, getUrlDefaultPort, getUrlDynamics, getUrlPath, getUrlPort, getUrlProtocol, getUrlQueryParams, getUrlSource, getWeekNumber, getYesterday, getYouTubePageType, handleDoneFn, hasCountryCode, hasDefaultValue, hasIndexOf, hasKeys, hasOverlappingKeys, hasProtocol, hasProtocolPrefix, hasUrlPort, hasUrlQueryParameter, hasWhiteSpace, idLiteral, idTypeGuard, identity, ifArray, ifArrayPartial, ifBoolean, ifChar, ifContainer, ifDefined, ifFalse, ifFunction, ifHasKey, ifLength, ifLowercaseChar, ifNotNull, ifNull, ifNumber, ifObject, ifSameType, ifScalar, ifString, ifTrue, ifUndefined, ifUppercaseChar, indexOf, infer, intersect, intersection, ip6GroupExpansion, ip6Prefix, isAccelerationMetric, isAccelerationUom, isAlpha, isAmazonUrl, isAmericanExpress, isApi, isApiSurface, isAppleUrl, isAreaMetric, isAreaUom, isArray, isArrayToken, isAtomicKind, isAtomicToken, isAustralianNewsUrl, isBelgiumNewsUrl, isBestBuyUrl, isBitbucketUrl, isBoolean, isBooleanLike, isBox, isCanadianNewsUrl, isChineseNewsUrl, isCodeCommitUrl, isConstant, isContainer, isContainerToken, isCostCoUrl, isCountryAbbrev, isCountryCode2, isCountryCode3, isCountryName, isCreditCard, isCssAspectRatio, isCsv, isCurrentMetric, isCurrentUom, isCvsUrl, isDanishNewsUrl, isDate, isDefineObject, isDefined, isDellUrl, isDistanceMetric, isDistanceUom, isDomainName, isDoneFn, isDutchNewsUrl, isEbayUrl, isEmail, isEmpty, isEnergyMetric, isEnergyUom, isEqual, isErrorCondition, isEscapeFunction, isEtsyUrl, isFalse, isFalsy, isFnBasedKind, isFnBasedToken, isFnWithParams, isFrenchNewsUrl, isFrequencyMetric, isFrequencyUom, isFunction, isGermanNewsUrl, isGithubIssueUrl, isGithubIssuesListUrl, isGithubOrgUrl, isGithubProjectUrl, isGithubProjectsListUrl, isGithubReleaseTagUrl, isGithubReleasesListUrl, isGithubRepoReleaseTagUrl, isGithubRepoReleasesUrl, isGithubRepoUrl, isGithubUrl, isHexadecimal, isHmUrl, isHomeDepotUrl, isHtmlElement, isIkeaUrl, isIndexable, isIndianNewsUrl, isInlineSvg, isIp4Address, isIp6Address, isIpAddress, isIso3166Alpha2, isIso3166Alpha3, isIso3166CountryCode, isIso3166CountryName, isIsoDate, isIsoDateTime, isIsoExplicitDate, isIsoExplicitTime, isIsoImplicitDate, isIsoImplicitTime, isIsoTime, isIsoYear, isItalianNewsUrl, isJapaneseNewsUrl, isKrogersUrl, isLeapYear, isLength, isLikeRegExp, isLowesUrl, isLuminosityMetric, isLuminosityUom, isLuxonDateTime, isMacysUrl, isMap, isMapToken, isMassMetric, isMassUom, isMetric, isMexicanNewsUrl, isMoment, isNarrowableObject, isNever, isNewsUrl, isNikeUrl, isNorwegianNewsUrl, isNotNull, isNothing, isNull, isNumber, isNumberLike, isNumericArray, isNumericString, isObject, isObjectToken, isOptionalParamFunction, isPhoneNumber, isPowerMetric, isPowerUom, isPressureMetric, isPressureUom, isProtocol, isProtocolPrefix, isReadonlyArray, isRecordToken, isRef, isRegExp, isRepoSource, isRepoUrl, isResistance, isResistanceUom, isRetailUrl, isSameTypeOf, isScalar, isSemanticVersion, isSet, isSetBasedKind, isSetBasedToken, isSetContainer, isSetToken, isShape, isShapeCallback, isSimpleContainerToken, isSimpleContainerTokenTuple, isSimpleScalarToken, isSimpleScalarTokenTuple, isSimpleToken, isSimpleTokenTuple, isSingletonKind, isSingletonToken, isSocialMediaProfileUrl, isSocialMediaUrl, isSouthKoreanNewsUrl, isSpanishNewsUrl, isSpecificConstant, isSpeedMetric, isSpeedUom, isString, isStringArray, isSwissNewsUrl, isSymbol, isTailwindColor, isTailwindColorClass, isTailwindColorName, isTailwindColorTarget, isTailwindColorWithLuminosity, isTailwindColorWithLuminosityAndOpacity, isTailwindModifier, isTargetUrl, isTemperatureMetric, isTemperatureUom, isThenable, isThisMonth, isThisWeek, isThisYear, isTimeMetric, isTimeUom, isToday, isTomorrow, isTrimable, isTrue, isTruthy, isTuple, isTupleToken, isTurkishNewsUrl, isTypeOf, isTypeSubtype, isTypeToken, isTypeTokenKind, isTypeTuple, isUkNewsUrl, isUndefined, isUnset, isUom, isUri, isUrl, isUrlPath, isUrlSource, isUsNewsUrl, isUsPhoneNumber, isUsStateAbbreviation, isUsStateName, isVariable, isVisaMastercard, isVoltageMetric, isVoltageUom, isVolumeMetric, isVolumeUom, isVueRef, isWalgreensUrl, isWalmartUrl, isWayfairUrl, isWholeFoodsUrl, isYesterday, isYouTubeCreatorUrl, isYouTubeFeedHistoryUrl, isYouTubeFeedUrl, isYouTubePlaylistUrl, isYouTubePlaylistsUrl, isYouTubeShareUrl, isYouTubeSubscriptionsUrl, isYouTubeTrendingUrl, isYouTubeUrl, isYouTubeVideoUrl, isYouTubeVideosInPlaylist, isZaraUrl, isZipCode, isZipCode5, isZipPlus4, joinWith, jsonValue, jsonValues, keysOf, kindLiteral, last, list, literal, logicalReturns, lookupCountryAlpha2, lookupCountryAlpha3, lookupCountryCode, lookupCountryName, lowercase, maybePhoneNumber, mergeObjects, mergeScalars, mergeTuples, nameLiteral, narrow, narrowObjectTo, narrowObjectToType, never, objectToApi, objectValues, omit, optional, optionalOrNull, or, orNull, pathJoin, pluralize, removePhoneCountryCode, removeTailwindModifiers, removeUrlProtocol, result, retain, retainAfter, retainAfterInclusive, retainChars, retainUntil, retainUntilInclusive, retainWhile, reverse, rightWhitespace, shape, sharedKeys, shift, simpleContainerToken, simpleContainerTokenToTypeToken, simpleContainerType, simpleScalarToken, simpleScalarTokenToTypeToken, simpleScalarType, simpleToken, simpleType, simpleUnionTokenToTypeToken, slice, split, startsWith, stripAfter, stripBefore, stripChars, stripLeading, stripParenthesis, stripSurround, stripTrailing, stripUntil, stripWhile, surround, takeNumericCharacters, takeProp, toCamelCase, toKebabCase, toKeyValue, toNumber, toNumericArray, toPascalCase, toSnakeCase, toString, toUppercase, trim, trimEnd, trimLeft, trimRight, trimStart, truncate, tuple, twColor, unbox, uncapitalize, union, unionize, unique, uniqueKeys, unset, uppercase, urlMeta, valuesOf, widen, withDefaults, withKeys, withValue, withoutKeys, withoutValue, wrapFn, youtubeEmbed, youtubeMeta };
|
|
@@ -1105,6 +1105,257 @@ var NUMERIC_CHAR = [
|
|
|
1105
1105
|
"8",
|
|
1106
1106
|
"9"
|
|
1107
1107
|
];
|
|
1108
|
+
var PHONE_COUNTRY_CODES = [
|
|
1109
|
+
["886", "TWN", "TW"],
|
|
1110
|
+
["93", "AFG", "AF"],
|
|
1111
|
+
["355", "ALB", "AL"],
|
|
1112
|
+
["213", "DZA", "DZ"],
|
|
1113
|
+
["1-684", "ASM", "AS"],
|
|
1114
|
+
["376", "AND", "AD"],
|
|
1115
|
+
["244", "AGO", "AO"],
|
|
1116
|
+
["1-264", "AIA", "AI"],
|
|
1117
|
+
["672", "ATA", "AQ"],
|
|
1118
|
+
["1-268", "ATG", "AG"],
|
|
1119
|
+
["54", "ARG", "AR"],
|
|
1120
|
+
["374", "ARM", "AM"],
|
|
1121
|
+
["297", "ABW", "AW"],
|
|
1122
|
+
["61", "AUS", "AU"],
|
|
1123
|
+
["43", "AUT", "AT"],
|
|
1124
|
+
["994", "AZE", "AZ"],
|
|
1125
|
+
["1-242", "BHS", "BS"],
|
|
1126
|
+
["973", "BHR", "BH"],
|
|
1127
|
+
["880", "BGD", "BD"],
|
|
1128
|
+
["1-246", "BRB", "BB"],
|
|
1129
|
+
["375", "BLR", "BY"],
|
|
1130
|
+
["32", "BEL", "BE"],
|
|
1131
|
+
["501", "BLZ", "BZ"],
|
|
1132
|
+
["229", "BEN", "BJ"],
|
|
1133
|
+
["1-441", "BMU", "BM"],
|
|
1134
|
+
["975", "BTN", "BT"],
|
|
1135
|
+
["591", "BOL", "BO"],
|
|
1136
|
+
["599", "BES", "BQ"],
|
|
1137
|
+
["387", "BIH", "BA"],
|
|
1138
|
+
["267", "BWA", "BW"],
|
|
1139
|
+
["47", "BVT", "BV"],
|
|
1140
|
+
["55", "BRA", "BR"],
|
|
1141
|
+
["246", "IOT", "IO"],
|
|
1142
|
+
["1-284", "VGB", "VG"],
|
|
1143
|
+
["673", "BRN", "BN"],
|
|
1144
|
+
["359", "BGR", "BG"],
|
|
1145
|
+
["226", "BFA", "BF"],
|
|
1146
|
+
["257", "BDI", "BI"],
|
|
1147
|
+
["238", "CPV", "CV"],
|
|
1148
|
+
["855", "KHM", "KH"],
|
|
1149
|
+
["237", "CMR", "CM"],
|
|
1150
|
+
["1", "CAN", "CA"],
|
|
1151
|
+
["1-345", "CYM", "KY"],
|
|
1152
|
+
["236", "CAF", "CF"],
|
|
1153
|
+
["235", "TCD", "TD"],
|
|
1154
|
+
["56", "CHL", "CL"],
|
|
1155
|
+
["86", "CHN", "CN"],
|
|
1156
|
+
["852", "HKG", "HK"],
|
|
1157
|
+
["853", "MAC", "MO"],
|
|
1158
|
+
["61", "CXR", "CX"],
|
|
1159
|
+
["61", "CCK", "CC"],
|
|
1160
|
+
["57", "COL", "CO"],
|
|
1161
|
+
["269", "COM", "KM"],
|
|
1162
|
+
["242", "COG", "CG"],
|
|
1163
|
+
["682", "COK", "CK"],
|
|
1164
|
+
["506", "CRI", "CR"],
|
|
1165
|
+
["385", "HRV", "HR"],
|
|
1166
|
+
["53", "CUB", "CU"],
|
|
1167
|
+
["599", "CUW", "CW"],
|
|
1168
|
+
["357", "CYP", "CY"],
|
|
1169
|
+
["420", "CZE", "CZ"],
|
|
1170
|
+
["225", "CIV", "CI"],
|
|
1171
|
+
["850", "PRK", "KP"],
|
|
1172
|
+
["243", "COD", "CD"],
|
|
1173
|
+
["45", "DNK", "DK"],
|
|
1174
|
+
["253", "DJI", "DJ"],
|
|
1175
|
+
["1-767", "DMA", "DM"],
|
|
1176
|
+
["1-809", "DOM", "DO"],
|
|
1177
|
+
["1-829", "DOM", "DO"],
|
|
1178
|
+
["1-849", "DOM", "DO"],
|
|
1179
|
+
["593", "ECU", "EC"],
|
|
1180
|
+
["20", "EGY", "EG"],
|
|
1181
|
+
["503", "SLV", "SV"],
|
|
1182
|
+
["240", "GNQ", "GQ"],
|
|
1183
|
+
["291", "ERI", "ER"],
|
|
1184
|
+
["372", "EST", "EE"],
|
|
1185
|
+
["268", "SWZ", "SZ"],
|
|
1186
|
+
["251", "ETH", "ET"],
|
|
1187
|
+
["500", "FLK", "FK"],
|
|
1188
|
+
["298", "FRO", "FO"],
|
|
1189
|
+
["679", "FJI", "FJ"],
|
|
1190
|
+
["358", "FIN", "FI"],
|
|
1191
|
+
["33", "FRA", "FR"],
|
|
1192
|
+
["594", "GUF", "GF"],
|
|
1193
|
+
["689", "PYF", "PF"],
|
|
1194
|
+
["262", "ATF", "TF"],
|
|
1195
|
+
["241", "GAB", "GA"],
|
|
1196
|
+
["220", "GMB", "GM"],
|
|
1197
|
+
["995", "GEO", "GE"],
|
|
1198
|
+
["49", "DEU", "DE"],
|
|
1199
|
+
["233", "GHA", "GH"],
|
|
1200
|
+
["350", "GIB", "GI"],
|
|
1201
|
+
["30", "GRC", "GR"],
|
|
1202
|
+
["299", "GRL", "GL"],
|
|
1203
|
+
["1-473", "GRD", "GD"],
|
|
1204
|
+
["590", "GLP", "GP"],
|
|
1205
|
+
["1-671", "GUM", "GU"],
|
|
1206
|
+
["502", "GTM", "GT"],
|
|
1207
|
+
["44", "GGY", "GG"],
|
|
1208
|
+
["224", "GIN", "GN"],
|
|
1209
|
+
["245", "GNB", "GW"],
|
|
1210
|
+
["592", "GUY", "GY"],
|
|
1211
|
+
["509", "HTI", "HT"],
|
|
1212
|
+
["672", "HMD", "HM"],
|
|
1213
|
+
["39-06", "VAT", "VA"],
|
|
1214
|
+
["504", "HND", "HN"],
|
|
1215
|
+
["36", "HUN", "HU"],
|
|
1216
|
+
["354", "ISL", "IS"],
|
|
1217
|
+
["91", "IND", "IN"],
|
|
1218
|
+
["62", "IDN", "ID"],
|
|
1219
|
+
["98", "IRN", "IR"],
|
|
1220
|
+
["964", "IRQ", "IQ"],
|
|
1221
|
+
["353", "IRL", "IE"],
|
|
1222
|
+
["44", "IMN", "IM"],
|
|
1223
|
+
["972", "ISR", "IL"],
|
|
1224
|
+
["39", "ITA", "IT"],
|
|
1225
|
+
["1-876", "JAM", "JM"],
|
|
1226
|
+
["81", "JPN", "JP"],
|
|
1227
|
+
["44", "JEY", "JE"],
|
|
1228
|
+
["962", "JOR", "JO"],
|
|
1229
|
+
["7", "KAZ", "KZ"],
|
|
1230
|
+
["254", "KEN", "KE"],
|
|
1231
|
+
["686", "KIR", "KI"],
|
|
1232
|
+
["965", "KWT", "KW"],
|
|
1233
|
+
["996", "KGZ", "KG"],
|
|
1234
|
+
["856", "LAO", "LA"],
|
|
1235
|
+
["371", "LVA", "LV"],
|
|
1236
|
+
["961", "LBN", "LB"],
|
|
1237
|
+
["266", "LSO", "LS"],
|
|
1238
|
+
["231", "LBR", "LR"],
|
|
1239
|
+
["218", "LBY", "LY"],
|
|
1240
|
+
["423", "LIE", "LI"],
|
|
1241
|
+
["370", "LTU", "LT"],
|
|
1242
|
+
["352", "LUX", "LU"],
|
|
1243
|
+
["261", "MDG", "MG"],
|
|
1244
|
+
["265", "MWI", "MW"],
|
|
1245
|
+
["60", "MYS", "MY"],
|
|
1246
|
+
["960", "MDV", "MV"],
|
|
1247
|
+
["223", "MLI", "ML"],
|
|
1248
|
+
["356", "MLT", "MT"],
|
|
1249
|
+
["692", "MHL", "MH"],
|
|
1250
|
+
["596", "MTQ", "MQ"],
|
|
1251
|
+
["222", "MRT", "MR"],
|
|
1252
|
+
["230", "MUS", "MU"],
|
|
1253
|
+
["262", "MYT", "YT"],
|
|
1254
|
+
["52", "MEX", "MX"],
|
|
1255
|
+
["691", "FSM", "FM"],
|
|
1256
|
+
["377", "MCO", "MC"],
|
|
1257
|
+
["976", "MNG", "MN"],
|
|
1258
|
+
["382", "MNE", "ME"],
|
|
1259
|
+
["1-664", "MSR", "MS"],
|
|
1260
|
+
["212", "MAR", "MA"],
|
|
1261
|
+
["258", "MOZ", "MZ"],
|
|
1262
|
+
["95", "MMR", "MM"],
|
|
1263
|
+
["264", "NAM", "NA"],
|
|
1264
|
+
["674", "NRU", "NR"],
|
|
1265
|
+
["977", "NPL", "NP"],
|
|
1266
|
+
["31", "NLD", "NL"],
|
|
1267
|
+
["687", "NCL", "NC"],
|
|
1268
|
+
["64", "NZL", "NZ"],
|
|
1269
|
+
["505", "NIC", "NI"],
|
|
1270
|
+
["227", "NER", "NE"],
|
|
1271
|
+
["234", "NGA", "NG"],
|
|
1272
|
+
["683", "NIU", "NU"],
|
|
1273
|
+
["672", "NFK", "NF"],
|
|
1274
|
+
["1-670", "MNP", "MP"],
|
|
1275
|
+
["47", "NOR", "NO"],
|
|
1276
|
+
["968", "OMN", "OM"],
|
|
1277
|
+
["92", "PAK", "PK"],
|
|
1278
|
+
["680", "PLW", "PW"],
|
|
1279
|
+
["507", "PAN", "PA"],
|
|
1280
|
+
["675", "PNG", "PG"],
|
|
1281
|
+
["595", "PRY", "PY"],
|
|
1282
|
+
["51", "PER", "PE"],
|
|
1283
|
+
["63", "PHL", "PH"],
|
|
1284
|
+
["870", "PCN", "PN"],
|
|
1285
|
+
["48", "POL", "PL"],
|
|
1286
|
+
["351", "PRT", "PT"],
|
|
1287
|
+
["974", "QAT", "QA"],
|
|
1288
|
+
["82", "KOR", "KR"],
|
|
1289
|
+
["373", "MDA", "MD"],
|
|
1290
|
+
["40", "ROU", "RO"],
|
|
1291
|
+
["7", "RUS", "RU"],
|
|
1292
|
+
["250", "RWA", "RW"],
|
|
1293
|
+
["262", "REU", "RE"],
|
|
1294
|
+
["590", "BLM", "BL"],
|
|
1295
|
+
["290", "SHN", "SH"],
|
|
1296
|
+
["1-869", "KNA", "KN"],
|
|
1297
|
+
["1-758", "LCA", "LC"],
|
|
1298
|
+
["590", "MAF", "MF"],
|
|
1299
|
+
["508", "SPM", "PM"],
|
|
1300
|
+
["1-784", "VCT", "VC"],
|
|
1301
|
+
["685", "WSM", "WS"],
|
|
1302
|
+
["378", "SMR", "SM"],
|
|
1303
|
+
["239", "STP", "ST"],
|
|
1304
|
+
["966", "SAU", "SA"],
|
|
1305
|
+
["221", "SEN", "SN"],
|
|
1306
|
+
["381", "SRB", "RS"],
|
|
1307
|
+
["248", "SYC", "SC"],
|
|
1308
|
+
["232", "SLE", "SL"],
|
|
1309
|
+
["65", "SGP", "SG"],
|
|
1310
|
+
["1-721", "SXM", "SX"],
|
|
1311
|
+
["421", "SVK", "SK"],
|
|
1312
|
+
["386", "SVN", "SI"],
|
|
1313
|
+
["677", "SLB", "SB"],
|
|
1314
|
+
["252", "SOM", "SO"],
|
|
1315
|
+
["27", "ZAF", "ZA"],
|
|
1316
|
+
["500", "SGS", "GS"],
|
|
1317
|
+
["211", "SSD", "SS"],
|
|
1318
|
+
["34", "ESP", "ES"],
|
|
1319
|
+
["94", "LKA", "LK"],
|
|
1320
|
+
["970", "PSE", "PS"],
|
|
1321
|
+
["249", "SDN", "SD"],
|
|
1322
|
+
["597", "SUR", "SR"],
|
|
1323
|
+
["47", "SJM", "SJ"],
|
|
1324
|
+
["46", "SWE", "SE"],
|
|
1325
|
+
["41", "CHE", "CH"],
|
|
1326
|
+
["963", "SYR", "SY"],
|
|
1327
|
+
["992", "TJK", "TJ"],
|
|
1328
|
+
["66", "THA", "TH"],
|
|
1329
|
+
["389", "MKD", "MK"],
|
|
1330
|
+
["670", "TLS", "TL"],
|
|
1331
|
+
["228", "TGO", "TG"],
|
|
1332
|
+
["690", "TKL", "TK"],
|
|
1333
|
+
["676", "TON", "TO"],
|
|
1334
|
+
["1-868", "TTO", "TT"],
|
|
1335
|
+
["216", "TUN", "TN"],
|
|
1336
|
+
["90", "TUR", "TR"],
|
|
1337
|
+
["993", "TKM", "TM"],
|
|
1338
|
+
["1-649", "TCA", "TC"],
|
|
1339
|
+
["688", "TUV", "TV"],
|
|
1340
|
+
["256", "UGA", "UG"],
|
|
1341
|
+
["380", "UKR", "UA"],
|
|
1342
|
+
["971", "ARE", "AE"],
|
|
1343
|
+
["44", "GBR", "GB"],
|
|
1344
|
+
["255", "TZA", "TZ"],
|
|
1345
|
+
["1-340", "VIR", "VI"],
|
|
1346
|
+
["1", "USA", "US"],
|
|
1347
|
+
["598", "URY", "UY"],
|
|
1348
|
+
["998", "UZB", "UZ"],
|
|
1349
|
+
["678", "VUT", "VU"],
|
|
1350
|
+
["58", "VEN", "VE"],
|
|
1351
|
+
["84", "VNM", "VN"],
|
|
1352
|
+
["681", "WLF", "WF"],
|
|
1353
|
+
["212", "ESH", "EH"],
|
|
1354
|
+
["967", "YEM", "YE"],
|
|
1355
|
+
["260", "ZMB", "ZM"],
|
|
1356
|
+
["263", "ZWE", "ZW"],
|
|
1357
|
+
["358", "ALA", "AX"]
|
|
1358
|
+
];
|
|
1108
1359
|
var PLURAL_EXCEPTIONS = {
|
|
1109
1360
|
photo: "photos",
|
|
1110
1361
|
piano: "pianos",
|
|
@@ -2495,8 +2746,8 @@ function shift(list2) {
|
|
|
2495
2746
|
}
|
|
2496
2747
|
|
|
2497
2748
|
// src/lists/slice.ts
|
|
2498
|
-
function slice(list2,
|
|
2499
|
-
return list2.slice(
|
|
2749
|
+
function slice(list2, start2, end) {
|
|
2750
|
+
return list2.slice(start2, end);
|
|
2500
2751
|
}
|
|
2501
2752
|
|
|
2502
2753
|
// src/lists/unique.ts
|
|
@@ -3952,6 +4203,27 @@ function isYesterday(test) {
|
|
|
3952
4203
|
return false;
|
|
3953
4204
|
}
|
|
3954
4205
|
|
|
4206
|
+
// src/type-guards/finance/CreditCards.ts
|
|
4207
|
+
function isVisaMastercard(val) {
|
|
4208
|
+
if (isString(val)) {
|
|
4209
|
+
const parts = val.split(" ");
|
|
4210
|
+
return parts.length === 4 && parts.every((i) => isNumberLike(i) && i.length === 4);
|
|
4211
|
+
}
|
|
4212
|
+
return false;
|
|
4213
|
+
}
|
|
4214
|
+
function isAmericanExpress(val) {
|
|
4215
|
+
if (isString(val)) {
|
|
4216
|
+
const parts = val.split(" ");
|
|
4217
|
+
return parts.length === 3 && parts.every(
|
|
4218
|
+
(i) => isNumberLike(i) && parts[0].length === 4 && parts[1].length === 6
|
|
4219
|
+
);
|
|
4220
|
+
}
|
|
4221
|
+
return false;
|
|
4222
|
+
}
|
|
4223
|
+
function isCreditCard(val) {
|
|
4224
|
+
return isVisaMastercard(val) || isAmericanExpress(val);
|
|
4225
|
+
}
|
|
4226
|
+
|
|
3955
4227
|
// src/type-guards/isString.ts
|
|
3956
4228
|
function isString(value) {
|
|
3957
4229
|
return typeof value === "string";
|
|
@@ -4255,7 +4527,7 @@ function isNull(value) {
|
|
|
4255
4527
|
}
|
|
4256
4528
|
|
|
4257
4529
|
// src/type-guards/isPhoneNumber.ts
|
|
4258
|
-
function
|
|
4530
|
+
function maybePhoneNumber(val) {
|
|
4259
4531
|
const svelte = String(val).trim();
|
|
4260
4532
|
const chars = svelte.split("");
|
|
4261
4533
|
const numeric = retainChars(svelte, ...NUMERIC_CHAR);
|
|
@@ -4271,6 +4543,36 @@ function isPhoneNumber(val) {
|
|
|
4271
4543
|
]);
|
|
4272
4544
|
return chars.every((i) => valid2.includes(i)) && svelte.startsWith(`+`) ? numeric.length >= 8 : svelte.startsWith(`00`) ? numeric.length >= 10 : numeric.length >= 7 && nothing === "";
|
|
4273
4545
|
}
|
|
4546
|
+
var start = PHONE_COUNTRY_CODES.map((i) => `+${i[0]} `);
|
|
4547
|
+
function hasCountryCode(val) {
|
|
4548
|
+
if (isString(val)) {
|
|
4549
|
+
return start.some((i) => val.trimStart().startsWith(i));
|
|
4550
|
+
}
|
|
4551
|
+
return false;
|
|
4552
|
+
}
|
|
4553
|
+
function isUsPhoneNumber(val) {
|
|
4554
|
+
if (isString(val)) {
|
|
4555
|
+
return maybePhoneNumber(val) && val.trimStart().startsWith(`+1 `);
|
|
4556
|
+
}
|
|
4557
|
+
return false;
|
|
4558
|
+
}
|
|
4559
|
+
function isPhoneNumber(val) {
|
|
4560
|
+
if (isString(val) && maybePhoneNumber(val) && [" ", "-", "."].some((i) => val.includes(i))) {
|
|
4561
|
+
const cc = getPhoneCountryCode(val);
|
|
4562
|
+
const without = cc === "" ? retainChars(val, ...NUMERIC_CHAR) : retainChars(val.trimStart().replace(`+${cc} `, ""), ...NUMERIC_CHAR);
|
|
4563
|
+
switch (cc) {
|
|
4564
|
+
case "1":
|
|
4565
|
+
return without.length === 10;
|
|
4566
|
+
case "44":
|
|
4567
|
+
return !![10, 11].includes(without.length);
|
|
4568
|
+
case "":
|
|
4569
|
+
return without.length <= 10;
|
|
4570
|
+
default:
|
|
4571
|
+
return without.length <= 11;
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4574
|
+
return false;
|
|
4575
|
+
}
|
|
4274
4576
|
|
|
4275
4577
|
// src/type-guards/isReadonlyArray.ts
|
|
4276
4578
|
function isReadonlyArray(value) {
|
|
@@ -5353,6 +5655,7 @@ export {
|
|
|
5353
5655
|
getYesterday,
|
|
5354
5656
|
getYouTubePageType,
|
|
5355
5657
|
handleDoneFn,
|
|
5658
|
+
hasCountryCode,
|
|
5356
5659
|
hasDefaultValue,
|
|
5357
5660
|
hasIndexOf,
|
|
5358
5661
|
hasKeys,
|
|
@@ -5396,6 +5699,7 @@ export {
|
|
|
5396
5699
|
isAccelerationUom,
|
|
5397
5700
|
isAlpha,
|
|
5398
5701
|
isAmazonUrl,
|
|
5702
|
+
isAmericanExpress,
|
|
5399
5703
|
isApi,
|
|
5400
5704
|
isApiSurface,
|
|
5401
5705
|
isAppleUrl,
|
|
@@ -5423,6 +5727,7 @@ export {
|
|
|
5423
5727
|
isCountryCode2,
|
|
5424
5728
|
isCountryCode3,
|
|
5425
5729
|
isCountryName,
|
|
5730
|
+
isCreditCard,
|
|
5426
5731
|
isCssAspectRatio,
|
|
5427
5732
|
isCsv,
|
|
5428
5733
|
isCurrentMetric,
|
|
@@ -5607,9 +5912,11 @@ export {
|
|
|
5607
5912
|
isUrlPath,
|
|
5608
5913
|
isUrlSource,
|
|
5609
5914
|
isUsNewsUrl,
|
|
5915
|
+
isUsPhoneNumber,
|
|
5610
5916
|
isUsStateAbbreviation,
|
|
5611
5917
|
isUsStateName,
|
|
5612
5918
|
isVariable,
|
|
5919
|
+
isVisaMastercard,
|
|
5613
5920
|
isVoltageMetric,
|
|
5614
5921
|
isVoltageUom,
|
|
5615
5922
|
isVolumeMetric,
|
|
@@ -5649,6 +5956,7 @@ export {
|
|
|
5649
5956
|
lookupCountryCode,
|
|
5650
5957
|
lookupCountryName,
|
|
5651
5958
|
lowercase,
|
|
5959
|
+
maybePhoneNumber,
|
|
5652
5960
|
mergeObjects,
|
|
5653
5961
|
mergeScalars,
|
|
5654
5962
|
mergeTuples,
|