trousse 3.12.0 → 3.12.1
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/index.d.ts +2 -2
- package/dist/locales.d.ts +2 -1
- package/dist/locales.js +3 -2
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ import { anyWordMatchesAnyOf, endsWithAnyOf, escapeRegex, getAnyOf, includesAnyO
|
|
|
8
8
|
import { createAcceptHeader, feedMimeTypes, genericFeedMimeTypes, genericHtmlMimeTypes, htmlMimeTypes } from "./mimes.js";
|
|
9
9
|
import { omit, pick, toMap, trimObject } from "./objects.js";
|
|
10
10
|
import { sleep } from "./timers.js";
|
|
11
|
-
import { AnyOf, DeepOmit, IsPlainObject, MaybePromise, NormalizeOptions, Nullish, ParamOptions, ParamSource, PartialNullish, Pattern, RegistrableDomainOptions, WeightedMimeType } from "./types.js";
|
|
11
|
+
import { AnyOf, DeepOmit, IsPlainObject, LocaleSegmentOptions, MaybePromise, NormalizeOptions, Nullish, ParamOptions, ParamSource, PartialNullish, Pattern, RegistrableDomainOptions, WeightedMimeType } from "./types.js";
|
|
12
12
|
import { addMissingProtocol, addMissingScheme, composeFragment, composeQuery, createUrlSpellings, createUrlVariants, decodeBase64, decodeBase64Binary, decodeBase64Url, decodeBase64UrlBinary, decodePercent, decodeSegment, encodePathSegment, fixMalformedProtocol, fixMalformedQuery, fixMalformedScheme, getFragmentParam, getFragmentParamValues, getFragmentParams, getOrigin, getPathSegments, getQueryParam, getQueryParamValues, getQueryParams, getRegistrableDomain, getSubdomain, hasFragmentParam, hasQueryParam, isHostOf, isHostOrSubdomainOf, isHostname, isHttpUrl, isIpAddress, isSubdomainOf, isUtf8Binary, normalizeUrl, parseUrl, resolveFeedProtocol, resolveFeedScheme, resolveUrl, stripWww, trimUrlValues, upgradeProtocol, upgradeScheme } from "./urls.js";
|
|
13
|
-
export { type AnyOf, type DeepOmit, type IsPlainObject, type MaybePromise, type NormalizeOptions, type Nullish, type ParamOptions, type ParamSource, type PartialNullish, type Pattern, type RegistrableDomainOptions, type WeightedMimeType, addMissingProtocol, addMissingScheme, anyWordMatchesAnyOf, archiveExtensions, audioExtensions, codeExtensions, coerceArray, coerceBoolean, coerceDate, coerceNumber, coerceSingular, coerceString, composeFragment, composeQuery, createAcceptHeader, createUrlSpellings, createUrlVariants, decodeBase64, decodeBase64Binary, decodeBase64Url, decodeBase64UrlBinary, decodePercent, decodeSegment, documentExtensions, encodePathSegment, endsWithAnyOf, escapeHtml, escapeRegex, feedMimeTypes, fixMalformedProtocol, fixMalformedQuery, fixMalformedScheme, flashExtensions, fontExtensions, genericFeedMimeTypes, genericHtmlMimeTypes, getAnyOf, getFragmentParam, getFragmentParamValues, getFragmentParams, getOrigin, getPathSegments, getQueryParam, getQueryParamValues, getQueryParams, getRegistrableDomain, getSubdomain, hasFragmentParam, hasQueryParam, htmlMimeTypes, imageExtensions, includesAnyOf, installerExtensions, isAnyOf, isBoolean, isFiniteNumber, isFunction, isHostOf, isHostOrSubdomainOf, isHostname, isHttpUrl, isInteger, isIpAddress, isJsonLike, isLocaleSegment, isNonEmptyString, isNullish, isNumber, isObject, isParseableJson, isPlainObject, isPresent, isRegionSegment, isSameText, isString, isSubdomainOf, isUtf8Binary, isValidDate, normalizeUrl, omit, omitEmpty, parseJson, parseUrl, pick, resolveFeedProtocol, resolveFeedScheme, resolveUrl, sleep, startsWithAnyOf, stripWww, subtitleExtensions, t, toMap, trimObject, trimUrlValues, tx, upgradeProtocol, upgradeScheme, videoExtensions, webAudioExtensions, webImageExtensions, webVideoExtensions };
|
|
13
|
+
export { type AnyOf, type DeepOmit, type IsPlainObject, type LocaleSegmentOptions, type MaybePromise, type NormalizeOptions, type Nullish, type ParamOptions, type ParamSource, type PartialNullish, type Pattern, type RegistrableDomainOptions, type WeightedMimeType, addMissingProtocol, addMissingScheme, anyWordMatchesAnyOf, archiveExtensions, audioExtensions, codeExtensions, coerceArray, coerceBoolean, coerceDate, coerceNumber, coerceSingular, coerceString, composeFragment, composeQuery, createAcceptHeader, createUrlSpellings, createUrlVariants, decodeBase64, decodeBase64Binary, decodeBase64Url, decodeBase64UrlBinary, decodePercent, decodeSegment, documentExtensions, encodePathSegment, endsWithAnyOf, escapeHtml, escapeRegex, feedMimeTypes, fixMalformedProtocol, fixMalformedQuery, fixMalformedScheme, flashExtensions, fontExtensions, genericFeedMimeTypes, genericHtmlMimeTypes, getAnyOf, getFragmentParam, getFragmentParamValues, getFragmentParams, getOrigin, getPathSegments, getQueryParam, getQueryParamValues, getQueryParams, getRegistrableDomain, getSubdomain, hasFragmentParam, hasQueryParam, htmlMimeTypes, imageExtensions, includesAnyOf, installerExtensions, isAnyOf, isBoolean, isFiniteNumber, isFunction, isHostOf, isHostOrSubdomainOf, isHostname, isHttpUrl, isInteger, isIpAddress, isJsonLike, isLocaleSegment, isNonEmptyString, isNullish, isNumber, isObject, isParseableJson, isPlainObject, isPresent, isRegionSegment, isSameText, isString, isSubdomainOf, isUtf8Binary, isValidDate, normalizeUrl, omit, omitEmpty, parseJson, parseUrl, pick, resolveFeedProtocol, resolveFeedScheme, resolveUrl, sleep, startsWithAnyOf, stripWww, subtitleExtensions, t, toMap, trimObject, trimUrlValues, tx, upgradeProtocol, upgradeScheme, videoExtensions, webAudioExtensions, webImageExtensions, webVideoExtensions };
|
package/dist/locales.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { LocaleSegmentOptions } from "./types.js";
|
|
1
2
|
export declare const escapeHtml: (value: string) => string;
|
|
2
3
|
export declare const t: (template: string, params: Record<string, string | number>) => string;
|
|
3
4
|
export declare const tx: (template: string, params: Record<string, string | number>) => string;
|
|
4
|
-
export declare const isLocaleSegment: (segment: string) => boolean;
|
|
5
|
+
export declare const isLocaleSegment: (segment: string, options?: LocaleSegmentOptions) => boolean;
|
|
5
6
|
export declare const isRegionSegment: (segment: string) => boolean;
|
package/dist/locales.js
CHANGED
|
@@ -32,10 +32,11 @@ const specialPurposeCodes = [
|
|
|
32
32
|
"mul",
|
|
33
33
|
"zxx"
|
|
34
34
|
];
|
|
35
|
-
const isLocaleSegment = (segment) => {
|
|
35
|
+
const isLocaleSegment = (segment, options) => {
|
|
36
36
|
if (isAnyOf(segment, specialPurposeCodes)) return false;
|
|
37
|
+
const tag = options?.underscore ? segment.replaceAll("_", "-") : segment;
|
|
37
38
|
try {
|
|
38
|
-
return languageNames.of(
|
|
39
|
+
return languageNames.of(tag) !== void 0;
|
|
39
40
|
} catch {
|
|
40
41
|
return false;
|
|
41
42
|
}
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED