🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@toolz/get-url-parameters

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

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

1.0.3
latest
Source
npm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
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

url

FAQs

Package last updated on 24 Mar 2021

Did you know?

Socket

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