Socket
Socket
Sign inDemoInstall

@flowio/web-sdk

Package Overview
Dependencies
2
Maintainers
6
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @flowio/web-sdk

Libraries and utilities for working in the browser


Version published
Maintainers
6
Created

Readme

Source

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

FAQs

Last updated on 09 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc