mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 18:43:21 +08:00
Merge pull request #26451 from ilich/querystringify
Added type definition for https://github.com/unshiftio/querystringify
This commit is contained in:
10
types/querystringify/index.d.ts
vendored
Normal file
10
types/querystringify/index.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// Type definitions for querystringify 2.0
|
||||
// Project: https://github.com/unshiftio/querystringify
|
||||
// Definitions by: Ilya Verbitskiy <https://github.com/ilich>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.2
|
||||
export function parse(query: string): object;
|
||||
|
||||
// TypeScript Version: 2.2
|
||||
export function stringify(obj: object, prefix?: string | boolean): string;
|
||||
11
types/querystringify/querystringify-tests.ts
Normal file
11
types/querystringify/querystringify-tests.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as qs from "querystringify";
|
||||
|
||||
qs.parse('?foo=bar'); // { foo: 'bar' }
|
||||
qs.parse('foo=bar'); // { foo: 'bar' }
|
||||
qs.parse('foo=bar&bar=foo'); // { foo: 'bar', bar: 'foo' }
|
||||
qs.parse('foo&bar=foo'); // { foo: '', bar: 'foo' }
|
||||
|
||||
qs.stringify({ foo: 'bar' }); // foo=bar
|
||||
qs.stringify({ foo: 'bar' }, true); // ?foo=bar
|
||||
qs.stringify({ foo: 'bar' }, '&'); // &foo=bar
|
||||
qs.stringify({ foo: '' }, '&'); // &foo=
|
||||
23
types/querystringify/tsconfig.json
Normal file
23
types/querystringify/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"querystringify-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/querystringify/tslint.json
Normal file
1
types/querystringify/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user