qs#ParsedQs TypeScript Examples
The following examples show how to use
qs#ParsedQs.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: hooks.ts From glide-frontend with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency,
},
[Field.OUTPUT]: {
currencyId: outputCurrency,
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient,
}
}
Example #2
Source File: hooks.ts From pancakeswap-testnet with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency,
},
[Field.OUTPUT]: {
currencyId: outputCurrency,
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient,
}
}
Example #3
Source File: hooks.ts From vvs-ui with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency,
},
[Field.OUTPUT]: {
currencyId: outputCurrency,
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient,
}
}
Example #4
Source File: hooks.ts From luaswap-interface with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs, chainId: ChainId): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency, chainId)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency, chainId)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency
},
[Field.OUTPUT]: {
currencyId: outputCurrency
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient
}
}
Example #5
Source File: hooks.ts From sushiswap-exchange with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency
},
[Field.OUTPUT]: {
currencyId: outputCurrency
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient
}
}
Example #6
Source File: hooks.ts From panther-frontend-dex with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency,
},
[Field.OUTPUT]: {
currencyId: outputCurrency,
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient,
}
}
Example #7
Source File: hooks.ts From pancake-swap-interface-v1 with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency,
},
[Field.OUTPUT]: {
currencyId: outputCurrency,
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient,
}
}
Example #8
Source File: saml.ts From node-saml with MIT License | 6 votes |
private async hasValidSignatureForRedirect(
container: ParsedQs,
originalQuery: string
): Promise<boolean | void> {
const tokens = originalQuery.split("&");
const getParam = (key: string) => {
const exists = tokens.filter((t) => {
return new RegExp(key).test(t);
});
return exists[0];
};
if (container.Signature) {
let urlString = getParam("SAMLRequest") || getParam("SAMLResponse");
if (getParam("RelayState")) {
urlString += "&" + getParam("RelayState");
}
urlString += "&" + getParam("SigAlg");
const certs = await this.certsToCheck();
const hasValidQuerySignature = certs.some((cert) => {
return this.validateSignatureForRedirect(
urlString,
container.Signature as string,
container.SigAlg as string,
cert
);
});
if (!hasValidQuerySignature) {
throw new Error("Invalid query signature");
}
} else {
return true;
}
}
Example #9
Source File: saml.ts From node-saml with MIT License | 6 votes |
async validateRedirectAsync(
container: ParsedQs,
originalQuery: string
): Promise<{ profile: Profile | null; loggedOut: boolean }> {
const samlMessageType = container.SAMLRequest ? "SAMLRequest" : "SAMLResponse";
const data = Buffer.from(container[samlMessageType] as string, "base64");
const inflated = await inflateRawAsync(data);
const dom = parseDomFromString(inflated.toString());
const doc: XMLOutput = await parseXml2JsFromString(inflated);
samlMessageType === "SAMLResponse"
? await this.verifyLogoutResponse(doc)
: this.verifyLogoutRequest(doc);
await this.hasValidSignatureForRedirect(container, originalQuery);
return await processValidlySignedSamlLogoutAsync(this, doc, dom);
}
Example #10
Source File: hooks.ts From pancake-swap-testnet with MIT License | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency,
},
[Field.OUTPUT]: {
currencyId: outputCurrency,
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient,
}
}
Example #11
Source File: hooks.ts From pancake-swap-exchange-testnet with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency,
},
[Field.OUTPUT]: {
currencyId: outputCurrency,
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient,
}
}
Example #12
Source File: hooks.ts From mozartfinance-swap-interface with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency,
},
[Field.OUTPUT]: {
currencyId: outputCurrency,
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient,
}
}
Example #13
Source File: hooks.ts From goose-frontend-amm with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency,
},
[Field.OUTPUT]: {
currencyId: outputCurrency,
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient,
}
}
Example #14
Source File: hooks.ts From glide-frontend with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency,
},
[Field.OUTPUT]: {
currencyId: outputCurrency,
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient,
}
}
Example #15
Source File: hooks.ts From dyp with Do What The F*ck You Want To Public License | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency
},
[Field.OUTPUT]: {
currencyId: outputCurrency
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient
}
}
Example #16
Source File: hooks.ts From cheeseswap-interface with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency
},
[Field.OUTPUT]: {
currencyId: outputCurrency
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient
}
}
Example #17
Source File: hooks.ts From interface-v2 with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency);
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency);
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = '';
} else {
outputCurrency = '';
}
}
const recipient = validatedRecipient(parsedQs.recipient);
return {
[Field.INPUT]: {
currencyId: inputCurrency,
},
[Field.OUTPUT]: {
currencyId: outputCurrency,
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient,
};
}
Example #18
Source File: useParsedQueryString.ts From interface-v2 with GNU General Public License v3.0 | 6 votes |
export default function useParsedQueryString(): ParsedQs {
const { search } = useLocation();
return useMemo(
() =>
search && search.length > 1
? parse(search, { parseArrays: false, ignoreQueryPrefix: true })
: {},
[search],
);
}
Example #19
Source File: hooks.ts From cuiswap with GNU General Public License v3.0 | 6 votes |
export function queryParametersToSwapState(parsedQs: ParsedQs): SwapState {
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency)
if (inputCurrency === outputCurrency) {
if (typeof parsedQs.outputCurrency === 'string') {
inputCurrency = ''
} else {
outputCurrency = ''
}
}
const recipient = validatedRecipient(parsedQs.recipient)
return {
[Field.INPUT]: {
currencyId: inputCurrency
},
[Field.OUTPUT]: {
currencyId: outputCurrency
},
typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),
independentField: parseIndependentFieldURLParameter(parsedQs.exactField),
recipient
}
}
Example #20
Source File: FileRequestCriteria.ts From node-experience with MIT License | 5 votes |
constructor(query: ParsedQs, url: string)
{
super(new FileSort(query), new FileFilter(query), new Pagination(query, url));
}
Example #21
Source File: useParsedQueryString.ts From glide-frontend with GNU General Public License v3.0 | 5 votes |
export default function useParsedQueryString(): ParsedQs {
const { search } = useLocation()
return useMemo(
() => (search && search.length > 1 ? parse(search, { parseArrays: false, ignoreQueryPrefix: true }) : {}),
[search],
)
}
Example #22
Source File: useParsedQueryString.ts From cuiswap with GNU General Public License v3.0 | 5 votes |
export default function useParsedQueryString(): ParsedQs {
const { search } = useLocation()
return useMemo(
() => (search && search.length > 1 ? parse(search, { parseArrays: false, ignoreQueryPrefix: true }) : {}),
[search]
)
}
Example #23
Source File: UserRequestCriteria.ts From node-experience with MIT License | 5 votes |
constructor(query: ParsedQs, url: string)
{
super(new UserSort(query), new UserFilter(query), new Pagination(query, url));
}
Example #24
Source File: RoleRequestCriteria.ts From node-experience with MIT License | 5 votes |
constructor(query: ParsedQs, url: string)
{
super(new RoleSort(query), new RoleFilter(query), new Pagination(query, url));
}
Example #25
Source File: ItemRequestCriteria.ts From node-experience with MIT License | 5 votes |
constructor(query: ParsedQs, url: string)
{
super(new ItemSort(query), new ItemFilter(query), new Pagination(query, url));
}