Socket
Socket
Sign inDemoInstall

@toolz/get-url-parameters

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @toolz/get-url-parameters

A utility function that determines whether a given string looks like a valid email address


Version published
Weekly downloads
7
Maintainers
1
Install size
102 kB
Created
Weekly downloads
 

Readme

Source

get-url-parameters

get-url-parameters is a utility that function that retrieves query string variables and attempts to convert them into native JS data types.

Usage

After installation, import the package:

import { getUrlParameters } from '@toolz/get-url-parameters';

getUrlParameters()

The function returns an object containing any query string parameters and attempts to convert those values into native JS data types.

const API = {
   arguments: {
      convertDataTypes: {
         optional,
         format: Boolean,
         defaultValue: true,
      },
   },
   returns: Object,
}

Examples:

// URL = /foo?name=adam&age=42&isKool=true&criminalRecord=null&pi=3.14
const urlParameters = getUrlParameters();
/*
   urlParameters = {
      name: 'adam',
      age: 42,
      isKool: true,
      criminalRecord: null,
      pi: 3.14,
   }
 */
// URL = /foo?name=adam&age=42&isKool=true&criminalRecord=null&pi=3.14
const urlParameters = getUrlParameters(false);
/*
   urlParameters = {
      name: 'adam',
      age: '42',
      isKool: 'true',
      criminalRecord: 'null',
      pi: '3.14',
   }
 */

Keywords

FAQs

Last updated on 24 Mar 2021

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