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

react-native-url-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-url-polyfill

A lightweight and trustworthy URL polyfill for React Native

2.0.0
latest
Source
npm
Version published
Weekly downloads
861K
-0.19%
Maintainers
1
Weekly downloads
 
Created

What is react-native-url-polyfill?

The react-native-url-polyfill package provides a polyfill for the URL and URLSearchParams classes in React Native environments. This is particularly useful for ensuring compatibility with web standards and APIs that rely on these classes.

What are react-native-url-polyfill's main functionalities?

URL Polyfill

This feature provides a polyfill for the URL class, allowing you to create and manipulate URL objects in a React Native environment just as you would in a web browser.

import 'react-native-url-polyfill/auto';

const url = new URL('https://example.com/path?name=ReactNative');
console.log(url.hostname); // 'example.com'
console.log(url.pathname); // '/path'
console.log(url.searchParams.get('name')); // 'ReactNative'

URLSearchParams Polyfill

This feature provides a polyfill for the URLSearchParams class, enabling you to work with query string parameters in a React Native environment.

import 'react-native-url-polyfill/auto';

const params = new URLSearchParams('name=ReactNative&version=0.64');
console.log(params.get('name')); // 'ReactNative'
console.log(params.get('version')); // '0.64'
params.append('platform', 'iOS');
console.log(params.toString()); // 'name=ReactNative&version=0.64&platform=iOS'

Other packages similar to react-native-url-polyfill

Keywords

URL

FAQs

Package last updated on 13 Jul 2023

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