Merge pull request #19622 from khell/master

[pg-escape] Initial version
This commit is contained in:
Nathan Shively-Sanders
2017-09-08 09:16:32 -07:00
committed by GitHub
4 changed files with 49 additions and 0 deletions

17
types/pg-escape/index.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
// Type definitions for pg-escape 0.2
// Project: https://github.com/segmentio/pg-escape
// Definitions by: Cameron Yan <https://github.com/khell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
export = escape;
declare function escape(fmt: string, ...args: any[]): string;
declare namespace escape {
function string(val: string): string;
function dollarQuotedString(val: string): string;
function ident(val: string): string;
function literal(val: string): string;
}

View File

@@ -0,0 +1,7 @@
import * as escape from 'pg-escape';
escape('INSERT INTO %I VALUES(%L)', 'books', "O'Reilly");
escape.string("ab'cd");
escape.dollarQuotedString("ab'cd");
escape.ident('1234');
escape.literal('1234');

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"pg-escape-tests.ts"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}