Merge pull request #26451 from ilich/querystringify

Added type definition for https://github.com/unshiftio/querystringify
This commit is contained in:
Nathan Shively-Sanders
2018-06-19 15:17:14 -07:00
committed by GitHub
4 changed files with 45 additions and 0 deletions

10
types/querystringify/index.d.ts vendored Normal file
View 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;

View 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=

View 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"
]
}

View File

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