@flowio/web-sdk
v2.1.13
Published
Libraries and utilities for working in the browser
Downloads
138
Keywords
Readme
Overview
A module for common web development tasks when working with @flowio platform. Supports tree-shaking, so only the functions you use will be included in your bundle. No other dependencies.
stringify(object: object)
Stringify a JavaScript object into the format used by @flowio APIs. Can be used for formatting
querystring parameters in the same format as the querystring
Node module.
Example
import { stringify } from '@flowio/web-sdk';
const parameters = {
foo: 'bar',
baz: [
'baz1',
'baz2',
],
};
stringify(parameters);
// returns:
// foo=bar&baz[0]=baz1&baz[1]=baz2
parseQueryString(querystring: string)
Parse querystring is the same format as the output from stringify
above.
JavaScript Example
import { parseQueryString } from '@flowio/web-sdk';
parseQueryString('foo=bar&baz[0]=baz1&baz[1]=baz2');
// returns:
// {
// foo: 'bar',
// baz: [
// 'baz1',
// 'baz2',
// ],
// }
TypeScript Example
import { parseQueryString } from '@flowio/web-sdk';
type Parameters = {
foo: string,
baz: Array<string>,
};
parseQueryString<Parameters>('foo=bar&baz[0]=baz1&baz[1]=baz2');
// returns:
// {
// foo: 'bar',
// baz: [
// 'baz1',
// 'baz2',
// ],
// }
appendQueryParameters(url: url, parameters: object)
Append querystring parameters to a URL.
Example
import { appendQueryParameters } from '@flowio/web-sdk';
const parameters = {
foo: 'bar',
baz: [
'baz1',
'baz2',
],
};
appendQueryParameters('https://example.com', parameters);
// returns:
// https://example.com?foo=bar&baz[0]=baz1&baz[1]=baz2
appendQueryParameters('https://example.com?existing=true', parameters);
// returns:
// https://example.com?existing=true&foo=bar&baz[0]=baz1&baz[1]=baz2