trousse 3.5.0 → 3.6.0
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/objects.js +1 -1
- package/dist/urls.d.ts +5 -3
- package/dist/urls.js +4 -0
- package/package.json +2 -2
package/dist/objects.js
CHANGED
|
@@ -14,7 +14,7 @@ const setKey = (object, key, value) => {
|
|
|
14
14
|
};
|
|
15
15
|
const pick = (object, keys) => {
|
|
16
16
|
const result = {};
|
|
17
|
-
for (const key of keys) if (key
|
|
17
|
+
for (const key of keys) if (Object.hasOwn(object, key)) setKey(result, key, object[key]);
|
|
18
18
|
return result;
|
|
19
19
|
};
|
|
20
20
|
const omit = (object, keys) => {
|
package/dist/urls.d.ts
CHANGED
|
@@ -18,8 +18,9 @@ export declare const hasFragmentParam: (source: ParamSource | undefined, name: s
|
|
|
18
18
|
export declare const getFragmentParamValues: (source: ParamSource | undefined, name: string, options?: ParamOptions) => Array<string>;
|
|
19
19
|
export declare const getFragmentParam: (source: ParamSource | undefined, name: string, options?: ParamOptions) => string | undefined;
|
|
20
20
|
export declare const getFragmentParams: (source: ParamSource | undefined, names: ReadonlyArray<string>, options?: ParamOptions) => Record<string, string>;
|
|
21
|
-
|
|
22
|
-
export declare const
|
|
21
|
+
type QueryValue = string | number | true;
|
|
22
|
+
export declare const composeQuery: (params?: Record<string, QueryValue>) => string;
|
|
23
|
+
export declare const composeFragment: (params?: Record<string, QueryValue>) => string;
|
|
23
24
|
export declare const fixMalformedScheme: (url: string) => string;
|
|
24
25
|
export declare const fixMalformedQuery: (url: string) => string;
|
|
25
26
|
export declare const trimUrlValues: (url: string) => string;
|
|
@@ -40,4 +41,5 @@ export declare const resolveFeedProtocol: typeof resolveFeedScheme;
|
|
|
40
41
|
/** @deprecated Use `addMissingScheme` instead. */
|
|
41
42
|
export declare const addMissingProtocol: typeof addMissingScheme;
|
|
42
43
|
/** @deprecated Use `upgradeScheme` instead. */
|
|
43
|
-
export declare const upgradeProtocol: typeof upgradeScheme;
|
|
44
|
+
export declare const upgradeProtocol: typeof upgradeScheme;
|
|
45
|
+
export {};
|
package/dist/urls.js
CHANGED
|
@@ -183,6 +183,10 @@ const composePairs = (params) => {
|
|
|
183
183
|
};
|
|
184
184
|
const pairs = [];
|
|
185
185
|
for (const [name, value] of Object.entries(params ?? {})) {
|
|
186
|
+
if (value === true) {
|
|
187
|
+
pairs.push(escapePart(name));
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
186
190
|
const text = String(value);
|
|
187
191
|
if (!text) continue;
|
|
188
192
|
pairs.push(`${escapePart(name)}=${escapePart(text)}`);
|
package/package.json
CHANGED