@furystack/rest
Version: 
Generic REST package
14 lines • 570 B
JavaScript
/**
 *
 * Decoding steps: See the encoding steps in reverse order
 * @param value The value to decode
 * @returns The decoded value
 */
export const decode = (value) => JSON.parse(decodeURIComponent(escape(atob(decodeURIComponent(value)))));
export const deserializeQueryString = (fullQueryString) => {
    const params = [...new URLSearchParams(fullQueryString).entries()]
        .filter(([key, value]) => key && value)
        .map(([key, value]) => [key, decode(value)]);
    return Object.fromEntries(params);
};
//# sourceMappingURL=deserialize-query-string.js.map