@types/should-format
v3.0.0
Published
TypeScript definitions for should-format
Readme
Installation
npm install --save @types/should-format
Summary
This package contains type definitions for should-format (https://github.com/shouldjs/format).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/should-format.
index.d.ts
/**
* Options for the Formatter.
*/
interface FormatterOptions {
/**
* Custom function to get keys from an object.
*/
keysFunc?: (obj: object) => string[];
/**
* If false, uses Object.getOwnPropertyNames instead of Object.keys.
*/
keys?: boolean;
/**
* Maximum line length before wrapping. Default: 60.
*/
maxLineLength?: number;
/**
* Property separator. Default: ','.
*/
propSep?: string;
/**
* If true, formats dates in UTC.
*/
isUTCdate?: boolean;
}
/**
* Formatter class for converting values to string representations.
*/
declare class Formatter {
constructor(opts?: FormatterOptions);
/**
* Format a value to a string representation.
* @param value - The value to format
* @returns Formatted string representation
*/
format(value: unknown): string;
}
/**
* Default format function that creates a Formatter and formats the value.
*
* @param value - The value to format
* @param opts - Optional formatter options
* @returns Formatted string representation
*
* @example
* ```javascript
* const format = require('should-format');
*
* format({ a: 1, b: 2 }); // => "{ a: 1, b: 2 }"
* format([1, 2, 3]); // => "[ 1, 2, 3 ]"
* format(null); // => "null"
* ```
*/
declare function format(value: unknown, opts?: FormatterOptions): string;
declare namespace format {
export { Formatter, FormatterOptions };
}
export = format;
Additional Details
- Last updated: Thu, 05 Feb 2026 08:45:22 GMT
- Dependencies: none
Credits
These definitions were written by gaspard.
