inferred-types 0.55.16 → 0.55.18
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/constants/dist/index.cjs +120 -0
- package/modules/constants/dist/index.cjs.map +1 -1
- package/modules/constants/dist/index.d.ts +10 -1
- package/modules/constants/dist/index.js +118 -0
- package/modules/constants/dist/index.js.map +1 -1
- package/modules/inferred-types/dist/index.cjs +326 -0
- package/modules/inferred-types/dist/index.cjs.map +1 -1
- package/modules/inferred-types/dist/index.d.ts +174 -77
- package/modules/inferred-types/dist/index.js +318 -0
- package/modules/inferred-types/dist/index.js.map +1 -1
- package/modules/runtime/dist/index.cjs +214 -0
- package/modules/runtime/dist/index.cjs.map +1 -1
- package/modules/runtime/dist/index.d.ts +84 -39
- package/modules/runtime/dist/index.js +208 -0
- package/modules/runtime/dist/index.js.map +1 -1
- package/modules/types/dist/index.d.ts +82 -39
- package/package.json +1 -1
|
@@ -8981,33 +8981,6 @@ type JsonValues<T extends Tuple> = {
|
|
|
8981
8981
|
[K in keyof T]: JsonValue<T[K]>;
|
|
8982
8982
|
};
|
|
8983
8983
|
|
|
8984
|
-
/**
|
|
8985
|
-
* **Replace**`<TText,TFind,TReplace>`
|
|
8986
|
-
*
|
|
8987
|
-
* Type utility which takes a string `TText` and finds the first instance of
|
|
8988
|
-
* `TFind` and replaces it with `TReplace`.
|
|
8989
|
-
*
|
|
8990
|
-
* ```ts
|
|
8991
|
-
* const fooy = "fooy";
|
|
8992
|
-
* // "Foo"
|
|
8993
|
-
* type Foo = Replace<typeof fooy, "y", "">;
|
|
8994
|
-
* ```
|
|
8995
|
-
*
|
|
8996
|
-
* **Related:** `ReplaceAll`
|
|
8997
|
-
*/
|
|
8998
|
-
type Replace<TText extends string, TFind extends string, TReplace extends string> = TText extends "" ? If<IsEqual<TFind, "">, TReplace, ""> : TFind extends "" ? TText : TText extends `${infer F}${TFind}${infer E}` ? `${F}${TReplace}${E}` : TText;
|
|
8999
|
-
|
|
9000
|
-
/**
|
|
9001
|
-
* Trims off whitespace on left of string
|
|
9002
|
-
* ```ts
|
|
9003
|
-
* // "foobar "
|
|
9004
|
-
* type T = TrimLeft<"\n\t foobar ">;
|
|
9005
|
-
* // string
|
|
9006
|
-
* type T = TrimLeft<string>;
|
|
9007
|
-
* ```
|
|
9008
|
-
*/
|
|
9009
|
-
type TrimLeft<S extends string> = string extends S ? string : S extends `${Whitespace}${infer Right}` ? TrimLeft<Right> : S;
|
|
9010
|
-
|
|
9011
8984
|
/**
|
|
9012
8985
|
* Provides the _left_ whitespace of a string
|
|
9013
8986
|
* ```ts
|
|
@@ -9133,6 +9106,22 @@ type RemoveIndex<T extends Record<any, any>> = {
|
|
|
9133
9106
|
[P in keyof T as string extends P ? never : number extends P ? never : symbol extends P ? never : P]: T[P];
|
|
9134
9107
|
};
|
|
9135
9108
|
|
|
9109
|
+
/**
|
|
9110
|
+
* **Replace**`<TText,TFind,TReplace>`
|
|
9111
|
+
*
|
|
9112
|
+
* Type utility which takes a string `TText` and finds the first instance of
|
|
9113
|
+
* `TFind` and replaces it with `TReplace`.
|
|
9114
|
+
*
|
|
9115
|
+
* ```ts
|
|
9116
|
+
* const fooy = "fooy";
|
|
9117
|
+
* // "Foo"
|
|
9118
|
+
* type Foo = Replace<typeof fooy, "y", "">;
|
|
9119
|
+
* ```
|
|
9120
|
+
*
|
|
9121
|
+
* **Related:** `ReplaceAll`
|
|
9122
|
+
*/
|
|
9123
|
+
type Replace<TText extends string, TFind extends string, TReplace extends string> = TText extends "" ? If<IsEqual<TFind, "">, TReplace, ""> : TFind extends "" ? TText : TText extends `${infer F}${TFind}${infer E}` ? `${F}${TReplace}${E}` : TText;
|
|
9124
|
+
|
|
9136
9125
|
type Process$J<TText extends string, TFind extends string, TReplace extends string> = Replace<TText, TFind, TReplace> extends `${string}${TFind}${string}` ? Process$J<Replace<TText, TFind, TReplace>, TFind, TReplace> : Replace<TText, TFind, TReplace>;
|
|
9137
9126
|
type Iterate$2<TText extends string, TFind extends readonly string[], TReplace extends string> = [] extends TFind ? TText : Iterate$2<Process$J<TText, First<TFind>, TReplace>, AfterFirst<TFind>, TReplace>;
|
|
9138
9127
|
type Singular<TText extends string, TFind extends string, TReplace extends string> = IsStringLiteral<TText> extends true ? IsStringLiteral<TFind> extends true ? IsUnion<TFind> extends true ? UnionToTuple$1<TFind> extends readonly string[] ? Iterate$2<TText, UnionToTuple$1<TFind>, TReplace> : never : Process$J<TText, TFind, TReplace> : string : string;
|
|
@@ -9171,17 +9160,6 @@ type Process$I<TChars extends readonly string[], TRetain extends string> = Remov
|
|
|
9171
9160
|
*/
|
|
9172
9161
|
type RetainChars<TContent extends string, TRetain extends string> = Or<[IsWideType<TContent>, IsWideType<TRetain>]> extends true ? string : Process$I<Chars<TContent>, TRetain> extends readonly string[] ? Join<Process$I<Chars<TContent>, TRetain>> : never;
|
|
9173
9162
|
|
|
9174
|
-
/**
|
|
9175
|
-
* Trims off whitespace on left of string
|
|
9176
|
-
* ```ts
|
|
9177
|
-
* // "\n foobar"
|
|
9178
|
-
* type T = TrimRight<"\n foobar \t">;
|
|
9179
|
-
* // string
|
|
9180
|
-
* type T = TrimRight<string>;
|
|
9181
|
-
* ```
|
|
9182
|
-
*/
|
|
9183
|
-
type TrimRight<S extends string> = string extends S ? string : S extends `${infer Right}${Whitespace}` ? TrimRight<Right> : S;
|
|
9184
|
-
|
|
9185
9163
|
/**
|
|
9186
9164
|
* Provides the _left_ whitespace of a string
|
|
9187
9165
|
* ```ts
|
|
@@ -9260,6 +9238,28 @@ type Process$G<S extends string> = string extends S ? string : S extends `${Whit
|
|
|
9260
9238
|
*/
|
|
9261
9239
|
type Trim<S extends string> = Process$G<S> extends string ? Process$G<S> : never;
|
|
9262
9240
|
|
|
9241
|
+
/**
|
|
9242
|
+
* Trims off whitespace on left of string
|
|
9243
|
+
* ```ts
|
|
9244
|
+
* // "foobar "
|
|
9245
|
+
* type T = TrimLeft<"\n\t foobar ">;
|
|
9246
|
+
* // string
|
|
9247
|
+
* type T = TrimLeft<string>;
|
|
9248
|
+
* ```
|
|
9249
|
+
*/
|
|
9250
|
+
type TrimLeft<S extends string> = string extends S ? string : S extends `${Whitespace}${infer Right}` ? TrimLeft<Right> : S;
|
|
9251
|
+
|
|
9252
|
+
/**
|
|
9253
|
+
* Trims off whitespace on left of string
|
|
9254
|
+
* ```ts
|
|
9255
|
+
* // "\n foobar"
|
|
9256
|
+
* type T = TrimRight<"\n foobar \t">;
|
|
9257
|
+
* // string
|
|
9258
|
+
* type T = TrimRight<string>;
|
|
9259
|
+
* ```
|
|
9260
|
+
*/
|
|
9261
|
+
type TrimRight<S extends string> = string extends S ? string : S extends `${infer Right}${Whitespace}` ? TrimRight<Right> : S;
|
|
9262
|
+
|
|
9263
9263
|
/**
|
|
9264
9264
|
* **ElementOf**`<T>`
|
|
9265
9265
|
*
|
|
@@ -14530,6 +14530,51 @@ type StartingWithTypeGuard<TStartsWith extends string> = <TValue extends Narrowa
|
|
|
14530
14530
|
*/
|
|
14531
14531
|
declare function startsWith<TStartsWith extends string>(startingWith: TStartsWith): StartingWithTypeGuard<TStartsWith>;
|
|
14532
14532
|
|
|
14533
|
+
/**
|
|
14534
|
+
* Tests whether the passed in `val` contains some HTML-like tags in it.
|
|
14535
|
+
*
|
|
14536
|
+
* **Related:** `hasValidHtml()`, `isHtml()`, `hasValidHtml()`
|
|
14537
|
+
*/
|
|
14538
|
+
declare function hasHtml(val: unknown): val is string;
|
|
14539
|
+
/**
|
|
14540
|
+
* Tests that the passed in string _does_ have HTML tags in it and that
|
|
14541
|
+
* those tags are valid HTML tags.
|
|
14542
|
+
*
|
|
14543
|
+
* **Related:** `hasHtml()`, `isHtml()`, `isValidHtml()`
|
|
14544
|
+
*/
|
|
14545
|
+
declare function hasValidHtml(val: unknown): val is string;
|
|
14546
|
+
|
|
14547
|
+
/**
|
|
14548
|
+
* tests whether the `val` passed in is the name of a valid
|
|
14549
|
+
* HTML block tag (e.g., "div", "span", etc.)
|
|
14550
|
+
*/
|
|
14551
|
+
declare function isValidBlockTag(val: unknown): val is string;
|
|
14552
|
+
/**
|
|
14553
|
+
* test whetehr the `val` pass in is a the name of a valid HTML
|
|
14554
|
+
* atomic tag (e.g., "br", "meta", etc.)
|
|
14555
|
+
*/
|
|
14556
|
+
declare function isValidAtomicTag(val: unknown): val is string;
|
|
14557
|
+
|
|
14558
|
+
/**
|
|
14559
|
+
* **isHtml**`(val)`
|
|
14560
|
+
*
|
|
14561
|
+
* Tests whether the passed in `val` is an HTML string which:
|
|
14562
|
+
*
|
|
14563
|
+
* - starts and ends with an HTML-like tag
|
|
14564
|
+
* - leading and trailing whitespace is ignored
|
|
14565
|
+
*/
|
|
14566
|
+
declare function isHtml(val: unknown): val is string;
|
|
14567
|
+
/**
|
|
14568
|
+
* **isValidHtml**`(val)`
|
|
14569
|
+
*
|
|
14570
|
+
* Tests whether the passed in `val` is an HTML string which:
|
|
14571
|
+
*
|
|
14572
|
+
* - starts and ends with a valid HTML tag
|
|
14573
|
+
* - all block tags are _balanced_ between open and close variants
|
|
14574
|
+
* - leading and trailing whitespace is ignored in the match
|
|
14575
|
+
*/
|
|
14576
|
+
declare function isValidHtml(val: unknown): val is string;
|
|
14577
|
+
|
|
14533
14578
|
/**
|
|
14534
14579
|
* **isHtmlElement**`(val)`
|
|
14535
14580
|
*
|
|
@@ -15805,4 +15850,4 @@ declare function isVueRef(val: unknown): val is VueRef;
|
|
|
15805
15850
|
*/
|
|
15806
15851
|
declare function asVueRef<T extends Narrowable>(value: T): VueRef<T>;
|
|
15807
15852
|
|
|
15808
|
-
export { type AsClassSelector, type AsList, type BoxValue, type BoxedFnParams, type ConfigRestApi, type CssFromDefnOption, 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 MetricTypeGuard, 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 UomTypeGuard, type UrlMeta, type YouTubeMeta, addFnToProps, addPropsToFn, and, asApi, asArray, asChars, asDate, asEscapeFunction, asIsoDate, asOptionalParamFunction, asPhoneFormat, asRecord, asString, asStringLiteral, asType, asTypeToken, asVueRef, box, boxDictionaryValues, capitalize, cardType, choices, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFixedLengthArray, createFnWithProps, createFnWithPropsExplicit, createLifoQueue, createMapper, createObjectMap, createTypeToken, cssColor, cssFromDefinition, csv, defineCss, defineObj, defineObject, defineObjectApi, defineTuple, doesExtend, endsWith, ensureLeading, ensureSurround, ensureTrailing, entries, errCondition, filter, filterEmpty, filterUndefined, 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, isMastercard, isMetric, isMetricCategory, isMexicanNewsUrl, isMoment, isNarrowableObject, isNever, isNewsUrl, isNikeUrl, isNorwegianNewsUrl, isNotEmpty, isNotNull, isNothing, isNull, isNumber, isNumberLike, isNumericArray, isNumericString, isObject, isObjectToken, isOptionalParamFunction, isPhoneNumber, isPowerMetric, isPowerUom, isPressureMetric, isPressureUom, isProtocol, isProtocolPrefix, isReadonlyArray, isRecordToken, isRef, isRegExp, isRepoSource, isRepoUrl, isResistanceMetric, 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, isUomCategory, isUri, isUrl, isUrlPath, isUrlSource, isUsNewsUrl, isUsPhoneNumber, isUsStateAbbreviation, isUsStateName, isVariable, isVisa, 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 };
|
|
15853
|
+
export { type AsClassSelector, type AsList, type BoxValue, type BoxedFnParams, type ConfigRestApi, type CssFromDefnOption, 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 MetricTypeGuard, 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 UomTypeGuard, type UrlMeta, type YouTubeMeta, addFnToProps, addPropsToFn, and, asApi, asArray, asChars, asDate, asEscapeFunction, asIsoDate, asOptionalParamFunction, asPhoneFormat, asRecord, asString, asStringLiteral, asType, asTypeToken, asVueRef, box, boxDictionaryValues, capitalize, cardType, choices, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFixedLengthArray, createFnWithProps, createFnWithPropsExplicit, createLifoQueue, createMapper, createObjectMap, createTypeToken, cssColor, cssFromDefinition, csv, defineCss, defineObj, defineObject, defineObjectApi, defineTuple, doesExtend, endsWith, ensureLeading, ensureSurround, ensureTrailing, entries, errCondition, filter, filterEmpty, filterUndefined, 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, hasHtml, hasIndexOf, hasKeys, hasOverlappingKeys, hasProtocol, hasProtocolPrefix, hasUrlPort, hasUrlQueryParameter, hasValidHtml, 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, isHtml, 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, isMastercard, isMetric, isMetricCategory, isMexicanNewsUrl, isMoment, isNarrowableObject, isNever, isNewsUrl, isNikeUrl, isNorwegianNewsUrl, isNotEmpty, isNotNull, isNothing, isNull, isNumber, isNumberLike, isNumericArray, isNumericString, isObject, isObjectToken, isOptionalParamFunction, isPhoneNumber, isPowerMetric, isPowerUom, isPressureMetric, isPressureUom, isProtocol, isProtocolPrefix, isReadonlyArray, isRecordToken, isRef, isRegExp, isRepoSource, isRepoUrl, isResistanceMetric, 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, isUomCategory, isUri, isUrl, isUrlPath, isUrlSource, isUsNewsUrl, isUsPhoneNumber, isUsStateAbbreviation, isUsStateName, isValidAtomicTag, isValidBlockTag, isValidHtml, isVariable, isVisa, 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 };
|
|
@@ -329,6 +329,120 @@ var HASH_TABLE_CHAR = {
|
|
|
329
329
|
...HASH_TABLE_ALPHA_UPPER,
|
|
330
330
|
...HASH_TABLE_SPECIAL
|
|
331
331
|
};
|
|
332
|
+
var HTML_BLOCK_TAGS = [
|
|
333
|
+
"a",
|
|
334
|
+
"abbr",
|
|
335
|
+
"address",
|
|
336
|
+
"article",
|
|
337
|
+
"aside",
|
|
338
|
+
"b",
|
|
339
|
+
"bdi",
|
|
340
|
+
"bdo",
|
|
341
|
+
"blockquote",
|
|
342
|
+
"body",
|
|
343
|
+
"button",
|
|
344
|
+
"canvas",
|
|
345
|
+
"caption",
|
|
346
|
+
"cite",
|
|
347
|
+
"code",
|
|
348
|
+
"colgroup",
|
|
349
|
+
"data",
|
|
350
|
+
"datalist",
|
|
351
|
+
"dd",
|
|
352
|
+
"del",
|
|
353
|
+
"details",
|
|
354
|
+
"dfn",
|
|
355
|
+
"dialog",
|
|
356
|
+
"div",
|
|
357
|
+
"dl",
|
|
358
|
+
"dt",
|
|
359
|
+
"em",
|
|
360
|
+
"fieldset",
|
|
361
|
+
"figcaption",
|
|
362
|
+
"figure",
|
|
363
|
+
"footer",
|
|
364
|
+
"form",
|
|
365
|
+
"h1",
|
|
366
|
+
"h2",
|
|
367
|
+
"h3",
|
|
368
|
+
"h4",
|
|
369
|
+
"h5",
|
|
370
|
+
"h6",
|
|
371
|
+
"head",
|
|
372
|
+
"header",
|
|
373
|
+
"html",
|
|
374
|
+
"i",
|
|
375
|
+
"iframe",
|
|
376
|
+
"ins",
|
|
377
|
+
"kbd",
|
|
378
|
+
"label",
|
|
379
|
+
"legend",
|
|
380
|
+
"li",
|
|
381
|
+
"main",
|
|
382
|
+
"map",
|
|
383
|
+
"mark",
|
|
384
|
+
"menu",
|
|
385
|
+
"meter",
|
|
386
|
+
"nav",
|
|
387
|
+
"noscript",
|
|
388
|
+
"object",
|
|
389
|
+
"ol",
|
|
390
|
+
"optgroup",
|
|
391
|
+
"option",
|
|
392
|
+
"output",
|
|
393
|
+
"p",
|
|
394
|
+
"picture",
|
|
395
|
+
"pre",
|
|
396
|
+
"progress",
|
|
397
|
+
"q",
|
|
398
|
+
"rp",
|
|
399
|
+
"rt",
|
|
400
|
+
"ruby",
|
|
401
|
+
"s",
|
|
402
|
+
"samp",
|
|
403
|
+
"script",
|
|
404
|
+
"section",
|
|
405
|
+
"select",
|
|
406
|
+
"small",
|
|
407
|
+
"span",
|
|
408
|
+
"strong",
|
|
409
|
+
"style",
|
|
410
|
+
"sub",
|
|
411
|
+
"summary",
|
|
412
|
+
"sup",
|
|
413
|
+
"svg",
|
|
414
|
+
"table",
|
|
415
|
+
"tbody",
|
|
416
|
+
"td",
|
|
417
|
+
"template",
|
|
418
|
+
"textarea",
|
|
419
|
+
"tfoot",
|
|
420
|
+
"th",
|
|
421
|
+
"thead",
|
|
422
|
+
"time",
|
|
423
|
+
"title",
|
|
424
|
+
"tr",
|
|
425
|
+
"u",
|
|
426
|
+
"ul",
|
|
427
|
+
"var",
|
|
428
|
+
"video"
|
|
429
|
+
];
|
|
430
|
+
var HTML_ATOMIC_TAGS = [
|
|
431
|
+
"area",
|
|
432
|
+
"base",
|
|
433
|
+
"br",
|
|
434
|
+
"col",
|
|
435
|
+
"embed",
|
|
436
|
+
"hr",
|
|
437
|
+
"img",
|
|
438
|
+
"input",
|
|
439
|
+
"link",
|
|
440
|
+
"meta",
|
|
441
|
+
"param",
|
|
442
|
+
"source",
|
|
443
|
+
"track",
|
|
444
|
+
"wbr"
|
|
445
|
+
];
|
|
332
446
|
var ISO3166_1 = [
|
|
333
447
|
{ name: "Afghanistan", alpha2: "AF", countryCode: "004", alpha3: "AFG" },
|
|
334
448
|
{ name: "Albania", alpha2: "AL", countryCode: "008", alpha3: "ALB" },
|
|
@@ -3377,6 +3491,94 @@ function startsWith(startingWith) {
|
|
|
3377
3491
|
};
|
|
3378
3492
|
}
|
|
3379
3493
|
|
|
3494
|
+
// src/type-guards/html/hasHtml.ts
|
|
3495
|
+
function hasHtml(val) {
|
|
3496
|
+
if (typeof val !== "string")
|
|
3497
|
+
return false;
|
|
3498
|
+
const htmlTagRegex = /.*<(\w+)>.*/;
|
|
3499
|
+
return !!htmlTagRegex.test(val);
|
|
3500
|
+
}
|
|
3501
|
+
function hasValidHtml(val) {
|
|
3502
|
+
if (typeof val !== "string")
|
|
3503
|
+
return false;
|
|
3504
|
+
const trimmedVal = val.trim();
|
|
3505
|
+
const tagRegex = /<\/?(\w+)([^>]*)>/g;
|
|
3506
|
+
const stack = [];
|
|
3507
|
+
let match;
|
|
3508
|
+
match = tagRegex.exec(trimmedVal);
|
|
3509
|
+
while (match !== null) {
|
|
3510
|
+
const [, tagName] = match;
|
|
3511
|
+
const isClosingTag = match[0].startsWith("</");
|
|
3512
|
+
const isAtomicTag = HTML_ATOMIC_TAGS.includes(tagName);
|
|
3513
|
+
if (isAtomicTag) {
|
|
3514
|
+
match = tagRegex.exec(trimmedVal);
|
|
3515
|
+
continue;
|
|
3516
|
+
}
|
|
3517
|
+
if (isClosingTag) {
|
|
3518
|
+
const lastTag = stack.pop();
|
|
3519
|
+
if (lastTag !== tagName) {
|
|
3520
|
+
return false;
|
|
3521
|
+
}
|
|
3522
|
+
} else {
|
|
3523
|
+
if (!HTML_BLOCK_TAGS.includes(tagName)) {
|
|
3524
|
+
return false;
|
|
3525
|
+
}
|
|
3526
|
+
stack.push(tagName);
|
|
3527
|
+
}
|
|
3528
|
+
match = tagRegex.exec(trimmedVal);
|
|
3529
|
+
}
|
|
3530
|
+
return stack.length === 0 && tagRegex.test(trimmedVal);
|
|
3531
|
+
}
|
|
3532
|
+
|
|
3533
|
+
// src/type-guards/html/html-tags.ts
|
|
3534
|
+
function isValidBlockTag(val) {
|
|
3535
|
+
return isString(val) && HTML_BLOCK_TAGS.includes(val.toLowerCase());
|
|
3536
|
+
}
|
|
3537
|
+
function isValidAtomicTag(val) {
|
|
3538
|
+
return isString(val) && HTML_ATOMIC_TAGS.includes(val.toLowerCase());
|
|
3539
|
+
}
|
|
3540
|
+
|
|
3541
|
+
// src/type-guards/html/isHtml.ts
|
|
3542
|
+
function isHtml(val) {
|
|
3543
|
+
if (typeof val !== "string")
|
|
3544
|
+
return false;
|
|
3545
|
+
const trimmedVal = val.trim();
|
|
3546
|
+
const fullHtmlRegex = /^<(\w+).*<\/\1>$/;
|
|
3547
|
+
return fullHtmlRegex.test(trimmedVal);
|
|
3548
|
+
}
|
|
3549
|
+
function isValidHtml(val) {
|
|
3550
|
+
if (typeof val !== "string")
|
|
3551
|
+
return false;
|
|
3552
|
+
const trimmedVal = val.trim();
|
|
3553
|
+
const tagRegex = /<\/?(\w+)([^>]*)>/g;
|
|
3554
|
+
const stack = [];
|
|
3555
|
+
let match = tagRegex.exec(trimmedVal);
|
|
3556
|
+
while (match !== null) {
|
|
3557
|
+
const [, tagName] = match;
|
|
3558
|
+
const isClosingTag = match[0].startsWith("</");
|
|
3559
|
+
const isAtomicTag = HTML_ATOMIC_TAGS.includes(tagName);
|
|
3560
|
+
if (isAtomicTag) {
|
|
3561
|
+
match = tagRegex.exec(trimmedVal);
|
|
3562
|
+
continue;
|
|
3563
|
+
}
|
|
3564
|
+
if (isClosingTag) {
|
|
3565
|
+
const lastTag = stack.pop();
|
|
3566
|
+
if (lastTag !== tagName) {
|
|
3567
|
+
return false;
|
|
3568
|
+
}
|
|
3569
|
+
} else {
|
|
3570
|
+
if (!HTML_BLOCK_TAGS.includes(tagName)) {
|
|
3571
|
+
return false;
|
|
3572
|
+
}
|
|
3573
|
+
stack.push(tagName);
|
|
3574
|
+
}
|
|
3575
|
+
match = tagRegex.exec(trimmedVal);
|
|
3576
|
+
}
|
|
3577
|
+
const isBalanced = stack.length === 0;
|
|
3578
|
+
const validStructureRegex = /^<(\w+)[^>]*>[\s\S]*<\/\1>$/;
|
|
3579
|
+
return isBalanced && validStructureRegex.test(trimmedVal);
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3380
3582
|
// src/type-guards/html/isHtmlElement.ts
|
|
3381
3583
|
function isHtmlElement(val) {
|
|
3382
3584
|
return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
|
|
@@ -5840,6 +6042,7 @@ export {
|
|
|
5840
6042
|
handleDoneFn,
|
|
5841
6043
|
hasCountryCode,
|
|
5842
6044
|
hasDefaultValue,
|
|
6045
|
+
hasHtml,
|
|
5843
6046
|
hasIndexOf,
|
|
5844
6047
|
hasKeys,
|
|
5845
6048
|
hasOverlappingKeys,
|
|
@@ -5847,6 +6050,7 @@ export {
|
|
|
5847
6050
|
hasProtocolPrefix,
|
|
5848
6051
|
hasUrlPort,
|
|
5849
6052
|
hasUrlQueryParameter,
|
|
6053
|
+
hasValidHtml,
|
|
5850
6054
|
hasWhiteSpace,
|
|
5851
6055
|
idLiteral,
|
|
5852
6056
|
idTypeGuard,
|
|
@@ -5959,6 +6163,7 @@ export {
|
|
|
5959
6163
|
isHexadecimal,
|
|
5960
6164
|
isHmUrl,
|
|
5961
6165
|
isHomeDepotUrl,
|
|
6166
|
+
isHtml,
|
|
5962
6167
|
isHtmlElement,
|
|
5963
6168
|
isIkeaUrl,
|
|
5964
6169
|
isIndexable,
|
|
@@ -6102,6 +6307,9 @@ export {
|
|
|
6102
6307
|
isUsPhoneNumber,
|
|
6103
6308
|
isUsStateAbbreviation,
|
|
6104
6309
|
isUsStateName,
|
|
6310
|
+
isValidAtomicTag,
|
|
6311
|
+
isValidBlockTag,
|
|
6312
|
+
isValidHtml,
|
|
6105
6313
|
isVariable,
|
|
6106
6314
|
isVisa,
|
|
6107
6315
|
isVisaMastercard,
|