mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
[next] Embed: Defer login/logout until ready (#2123)
* feat: Embed defer login/-out until ready * fix: make remove work with lazy render * fix: typo * fix: another typo * fix: test * chore: replace query-string for querystringify * fix: types * chore: small refactor * feat: added webpack analzyer * chore: rename compile -> generate * fix: fix scripts and improve bundle size * fix: lodash webpack plugin
This commit is contained in:
@@ -5,3 +5,5 @@ export { default as oncePerFrame } from "./oncePerFrame";
|
||||
export { default as isBeforeDate } from "./isBeforeDate";
|
||||
export { default as ensureEndSlash } from "./ensureEndSlash";
|
||||
export { default as ensureNoEndSlash } from "./ensureNoEndSlash";
|
||||
export { default as parseQuery } from "./parseQuery";
|
||||
export { default as stringifyQuery } from "./stringifyQuery";
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* From the `querystringify` project:
|
||||
* The parse method transforms a given query string in to an object.
|
||||
* Parameters without values are set to empty strings.
|
||||
* It does not care if your query string is prefixed with a ? or not.
|
||||
* It just extracts the parts between the = and &:
|
||||
*/
|
||||
export { parse as default } from "querystringify";
|
||||
@@ -0,0 +1,24 @@
|
||||
import qs from "querystringify";
|
||||
|
||||
/**
|
||||
* From the `querystringify` project:
|
||||
* This transforms a given object in to a query string.
|
||||
* By default we return the query string without a ? prefix.
|
||||
* If you want to prefix it by default simply supply true as second argument.
|
||||
* If it should be prefixed by something else simply supply a string with the
|
||||
* prefix value as second argument.
|
||||
*
|
||||
* In addition keys that have an undefined value are removed from the query.
|
||||
*/
|
||||
export default function stringifyQuery(
|
||||
obj: object,
|
||||
prefix?: string | boolean
|
||||
): string {
|
||||
const copy: any = { ...obj };
|
||||
Object.keys(copy).forEach(key => {
|
||||
if (copy[key] === undefined) {
|
||||
delete copy[key];
|
||||
}
|
||||
});
|
||||
return qs.stringify(copy, prefix);
|
||||
}
|
||||
Reference in New Issue
Block a user