Socket
Socket
Sign inDemoInstall

@cheprasov/url-query-params

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cheprasov/url-query-params - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "@cheprasov/url-query-params",
"version": "1.0.0",
"version": "1.0.1",
"author": "Alexander Cheprasov",

@@ -5,0 +5,0 @@ "description": "The URLQueryParams class defines utility methods to work with the query string of a URL. It is a good replacement for standard URLSearchParams class",

@@ -18,6 +18,6 @@ [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)

```bash
> npm install @cheprasov/url-query-params
> npm i @cheprasov/url-query-params
```
Import in you **.js / .ts** file:
Import in **.js / .ts** file:
```javascript

@@ -40,61 +40,75 @@ import { URLQueryParams } from '@chepraspv/url-query-params';

#### 3.1 Constructor
> new **URLQueryParams** (`string[][] | Record<string, string> | string | URLSearchParams | URLQueryParams`)
```typescript
// Returns a URLSearchParams object instance.
new URLQueryParams(init?: string[][] | Record<string, string> | string | URLSearchParams | URLQueryParams)
```
Returns a URLSearchParams object instance.
#### 3.2 Methods
> **URLSearchParams.append** (`name: string, value: string`): void
```typescript
// Appends a specified key/value pair as a new search parameter.
URLQueryParams.append(name: string, value: string): void
```
Appends a specified key/value pair as a new search parameter.
```typescript
// Deletes the given search parameter, and its associated value, from the list of all search parameters.
URLQueryParams.delete(name: string): void
```
> **URLSearchParams.delete** (`name: string`): void
```typescript
// Returns an iterator allowing iteration through all key/value pairs contained in this object.
URLQueryParams.entries(): IterableIterator<[string, string]>
```
Deletes the given search parameter, and its associated value, from the list of all search parameters.
```typescript
// Allows iteration through all values contained in this object via a callback function.
URLQueryParams.forEach(callbackfn: (value: string, key: string, parent: URLQueryParams) => void, thisArg?: any): void
```
> **URLSearchParams.entries** (): IterableIterator<[string, string]>
```typescript
// Returns the first value associated with the given search parameter.
URLQueryParams.get(name: string): string | null
```
Returns an iterator allowing iteration through all key/value pairs contained in this object.
```typescript
// Returns all the values associated with a given search parameter.
URLQueryParams.getAll(name: string): string[]
```
> **URLSearchParams.forEach** (`callbackfn: (value: string, key: string, parent: URLQueryParams) => void, thisArg?: any`): void
Allows iteration through all values contained in this object via a callback function.
```typescript
// Returns a boolean value indicating if such a given parameter exists.
URLQueryParams.has(name: string): boolean
```
> **URLSearchParams.get** (`name: string`): string | null
```typescript
// Returns an iterator allowing iteration through all keys of the key/value pairs contained in this object.
URLQueryParams.keys(): IterableIterator<string>
```
Returns the first value associated with the given search parameter.
```typescript
// Sets the value associated with a given search parameter to the given value. If there are several values, the others are deleted.
URLQueryParams.set(name: string, value: string): void
```
> **URLSearchParams.getAll** (`name: string`): string[]
```typescript
// Sorts all key/value pairs, if any, by their keys.
URLQueryParams.sort(): void
```
Returns all the values associated with a given search parameter.
```typescript
// Returns new object created from key/values params.
URLQueryParams.toObject(): Record<string, string>
```
> **URLSearchParams.has** (`name: string`): boolean
```typescript
// Returns a string containing a query string suitable for use in a URL.
URLQueryParams.toString(): string
```
Returns a boolean value indicating if such a given parameter exists.
```typescript
// Returns an iterator allowing iteration through all values of the key/value pairs contained in this object.
URLQueryParams.values(): IterableIterator<string>
```
> **URLSearchParams.keys** (): IterableIterator<string>
Returns an iterator allowing iteration through all keys of the key/value pairs contained in this object.
> **URLSearchParams.set** (`name: string, value: string`): void
Sets the value associated with a given search parameter to the given value. If there are several values, the others are deleted.
> **URLSearchParams.sort** (): void
Sorts all key/value pairs, if any, by their keys.
> **URLSearchParams.toObject** (): Record<string, string>
Returns new object created from key/values params.
> **URLSearchParams.toString** (): string
Returns a string containing a query string suitable for use in a URL.
> **URLSearchParams.values** (): IterableIterator<string>
Returns an iterator allowing iteration through all values of the key/value pairs contained in this object.
## Something does not work
Feel free to fork project, fix bugs, write tests and finally request for pull
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc