mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Merge pull request #33174 from penumbra1/master
mongo-sanitize: a more accurate export
This commit is contained in:
8
types/mongo-sanitize/index.d.ts
vendored
8
types/mongo-sanitize/index.d.ts
vendored
@@ -1,9 +1,9 @@
|
||||
// Type definitions for mongo-sanitize 1.0
|
||||
// Project: https://github.com/vkarpov15/mongo-sanitize
|
||||
// Definitions by: Cedric Cazin <https://github.com/CedricCazin>
|
||||
// Definitions by: Cedric Cazin <https://github.com/CedricCazin>, Olga Isakova <https://github.com/penumbra1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
export function sanitize<T extends object>(v: T): T;
|
||||
declare function sanitize<T>(v: T): T;
|
||||
|
||||
export as namespace mongoSanitize;
|
||||
export = sanitize;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import * as mongoSanitize from 'mongo-sanitize';
|
||||
import sanitize from "mongo-sanitize";
|
||||
|
||||
const objectSanitized = mongoSanitize.sanitize({ $gt: 5, a: 1 });
|
||||
const objectSanitized = sanitize({ $gt: 5, a: 1 });
|
||||
|
||||
const arraySanitized = mongoSanitize.sanitize([1, 2, 3]);
|
||||
const arraySanitized = sanitize([1, 2, 3]);
|
||||
|
||||
class Clazz {
|
||||
$gt = 5;
|
||||
a = 1;
|
||||
}
|
||||
const classSanitized = mongoSanitize.sanitize(new Clazz());
|
||||
const classSanitized = sanitize(new Clazz());
|
||||
|
||||
Reference in New Issue
Block a user