mongodb-connection-string-url
Advanced tools
Comparing version 2.3.2 to 2.4.0
import { URL } from 'whatwg-url'; | ||
import { redactConnectionString, ConnectionStringRedactionOptions } from './redact'; | ||
export { redactConnectionString, ConnectionStringRedactionOptions }; | ||
declare class CaseInsensitiveMap extends Map<string, string> { | ||
delete(name: any): boolean; | ||
get(name: any): string | undefined; | ||
has(name: any): boolean; | ||
set(name: any, value: any): this; | ||
_normalizeKey(name: any): string; | ||
declare class CaseInsensitiveMap<K extends string = string> extends Map<K, string> { | ||
delete(name: K): boolean; | ||
get(name: K): string | undefined; | ||
has(name: K): boolean; | ||
set(name: K, value: any): this; | ||
_normalizeKey(name: any): K; | ||
} | ||
@@ -38,6 +38,22 @@ declare abstract class URLWithoutHost extends URL { | ||
redact(options?: ConnectionStringRedactionOptions): ConnectionString; | ||
typedSearchParams<T extends Record<string, unknown>>(): { | ||
append(name: keyof T & string, value: any): void; | ||
delete(name: keyof T & string): void; | ||
get(name: keyof T & string): string | null; | ||
getAll(name: keyof T & string): string[]; | ||
has(name: keyof T & string): boolean; | ||
set(name: keyof T & string, value: any): void; | ||
keys(): IterableIterator<keyof T & string>; | ||
values(): IterableIterator<string>; | ||
entries(): IterableIterator<[keyof T & string, string]>; | ||
_normalizeKey(name: keyof T & string): string; | ||
[Symbol.iterator](): IterableIterator<[keyof T & string, string]>; | ||
sort(): void; | ||
forEach<THIS_ARG = void>(callback: (this: THIS_ARG, value: string, name: string, searchParams: any) => void, thisArg?: THIS_ARG | undefined): void; | ||
readonly [Symbol.toStringTag]: "URLSearchParams"; | ||
}; | ||
} | ||
export declare class CommaAndColonSeparatedRecord extends CaseInsensitiveMap { | ||
export declare class CommaAndColonSeparatedRecord<K extends Record<string, unknown> = Record<string, unknown>> extends CaseInsensitiveMap<keyof K & string> { | ||
constructor(from?: string | null); | ||
toString(): string; | ||
} |
@@ -33,25 +33,39 @@ "use strict"; | ||
} | ||
const caseInsenstiveURLSearchParams = (Ctor) => class CaseInsenstiveURLSearchParams extends Ctor { | ||
append(name, value) { | ||
return super.append(this._normalizeKey(name), value); | ||
} | ||
delete(name) { | ||
return super.delete(this._normalizeKey(name)); | ||
} | ||
get(name) { | ||
return super.get(this._normalizeKey(name)); | ||
} | ||
getAll(name) { | ||
return super.getAll(this._normalizeKey(name)); | ||
} | ||
has(name) { | ||
return super.has(this._normalizeKey(name)); | ||
} | ||
set(name, value) { | ||
return super.set(this._normalizeKey(name), value); | ||
} | ||
_normalizeKey(name) { | ||
return CaseInsensitiveMap.prototype._normalizeKey.call(this, name); | ||
} | ||
}; | ||
function caseInsenstiveURLSearchParams(Ctor) { | ||
return class CaseInsenstiveURLSearchParams extends Ctor { | ||
append(name, value) { | ||
return super.append(this._normalizeKey(name), value); | ||
} | ||
delete(name) { | ||
return super.delete(this._normalizeKey(name)); | ||
} | ||
get(name) { | ||
return super.get(this._normalizeKey(name)); | ||
} | ||
getAll(name) { | ||
return super.getAll(this._normalizeKey(name)); | ||
} | ||
has(name) { | ||
return super.has(this._normalizeKey(name)); | ||
} | ||
set(name, value) { | ||
return super.set(this._normalizeKey(name), value); | ||
} | ||
keys() { | ||
return super.keys(); | ||
} | ||
values() { | ||
return super.values(); | ||
} | ||
entries() { | ||
return super.entries(); | ||
} | ||
[Symbol.iterator]() { | ||
return super[Symbol.iterator](); | ||
} | ||
_normalizeKey(name) { | ||
return CaseInsensitiveMap.prototype._normalizeKey.call(this, name); | ||
} | ||
}; | ||
} | ||
class URLWithoutHost extends whatwg_url_1.URL { | ||
@@ -141,2 +155,6 @@ } | ||
} | ||
typedSearchParams() { | ||
const sametype = false && new (caseInsenstiveURLSearchParams(whatwg_url_1.URLSearchParams))(); | ||
return this.searchParams; | ||
} | ||
[Symbol.for('nodejs.util.inspect.custom')]() { | ||
@@ -143,0 +161,0 @@ const { href, origin, protocol, username, password, hosts, pathname, search, searchParams, hash } = this; |
{ | ||
"name": "mongodb-connection-string-url", | ||
"version": "2.3.2", | ||
"version": "2.4.0", | ||
"description": "MongoDB connection strings, based on the WhatWG URL API", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
35911
334