mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
update(stringify-object): v3.3 update (#44530)
- minor changes in param names to align with documented usage (input/prop/etc) - defaults documentation added - add public, non-documented `pad` parameter - remove TS vresion pragma which is now no-op (DT defaults to 2.8 or newer by default) - maintainer added https://github.com/yeoman/stringify-object/releases/tag/v3.3.0 Thanks!
This commit is contained in:
parent
bd7891509e
commit
ca45b805d5
31
types/stringify-object/index.d.ts
vendored
31
types/stringify-object/index.d.ts
vendored
@ -1,17 +1,36 @@
|
||||
// Type definitions for stringify-object 3.2
|
||||
// Type definitions for stringify-object 3.3
|
||||
// Project: https://github.com/yeoman/stringify-object
|
||||
// Definitions by: Chris Khoo <https://github.com/khoomeister>
|
||||
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
declare namespace stringifyObject { }
|
||||
|
||||
declare function stringifyObject(o: any, options?: {
|
||||
declare function stringifyObject(input: any, options?: {
|
||||
/**
|
||||
* Preferred indentation
|
||||
* @default '\t'
|
||||
*/
|
||||
indent?: string,
|
||||
/**
|
||||
* Set to false to get double-quoted strings
|
||||
* @default true
|
||||
*/
|
||||
singleQuotes?: boolean,
|
||||
filter?(o: any, prop: string | symbol): boolean,
|
||||
/**
|
||||
* Expected to return a boolean of whether to include the property property of the object object in the output.
|
||||
*/
|
||||
filter?(input: any, prop: string | symbol): boolean,
|
||||
/**
|
||||
* When set, will inline values up to inlineCharacterLimit length for the sake of more terse output.
|
||||
*/
|
||||
inlineCharacterLimit?: number,
|
||||
transform?: (val: any[] | object, i: number | string | symbol, value: string) => string,
|
||||
}): string;
|
||||
/**
|
||||
* Expected to return a string that transforms the string that resulted from stringifying object[property].
|
||||
* This can be used to detect special types of objects that need to be stringified in a particular way.
|
||||
* The transform function might return an alternate string in this case, otherwise returning the originalResult.
|
||||
*/
|
||||
transform?: (input: any[] | object, prop: number | string | symbol, originalResult: string) => string,
|
||||
}, pad?: string): string;
|
||||
|
||||
export = stringifyObject;
|
||||
|
||||
@ -28,3 +28,8 @@ stringifyObject([1, 2, 3], {
|
||||
stringifyObject([1, 2, 3], {
|
||||
transform: (val, key, value) => value
|
||||
});
|
||||
|
||||
/** pad */
|
||||
stringifyObject([1, 2, 3], {
|
||||
indent: ' ',
|
||||
}, ' ');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user