温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/util/formatWithOptions
点击访问原文链接

Node util.formatWithOptions function | API Reference | Bun

Node util.formatWithOptions function | API Reference | BunBuildDocsReferenceGuidesBlogDiscord/node:util/formatWithOptionsFformatWithOptions

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:util/formatWithOptionsFformatWithOptions

function

util.formatWithOptionsfunction formatWithOptions(inspectOptions: InspectOptions,format?: any,...param: any[]): string;

This function is identical to format, except in that it takes an inspectOptions argument which specifies options that are passed along to inspect.

util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 });
// Returns 'See object { foo: 42 }', where `42` is colored as a number
// when printed to a terminal.
Referenced typesinterface InspectOptions= `1`)." data-algolia-static="false" data-algolia-merged="false" data-type="Property">breakLength?: number

The length at which input values are split across multiple lines. Set to Infinity to format the input as a single line (in combination with compact set to true or any number >= 1).

colors?: boolean

If true, the output is styled with ANSI color codes. Colors are customizable.

compact?: number | boolean

Setting this to false causes each object key to be displayed on a new line. It will also add new lines to text that is longer than breakLength. If set to a number, the most n inner elements are united on a single line as long as all properties fit into breakLength. Short array elements are also grouped together. Note that no text will be reduced below 16 characters, no matter the breakLength size. For more information, see the example below.

customInspect?: boolean

If false, [util.inspect.custom](depth, opts, inspect) functions are not invoked.

depth?: null | number

Specifies the number of times to recurse while formatting object. This is useful for inspecting large objects. To recurse up to the maximum call stack size pass Infinity or null.

getters?: boolean | 'get' | 'set'

If set to true, getters are going to be inspected as well. If set to 'get' only getters without setter are going to be inspected. If set to 'set' only getters having a corresponding setter are going to be inspected. This might cause side effects depending on the getter function.

maxArrayLength?: null | number

Specifies the maximum number of Array, TypedArray, WeakMap, and WeakSet elements to include when formatting. Set to null or Infinity to show all elements. Set to 0 or negative to show no elements.

maxStringLength?: null | number

Specifies the maximum number of characters to include when formatting. Set to null or Infinity to show all elements. Set to 0 or negative to show no characters.

numericSeparator?: boolean

If set to true, an underscore is used to separate every three digits in all bigints and numbers.

showHidden?: boolean

If true, object's non-enumerable symbols and properties are included in the formatted result. WeakMap and WeakSet entries are also included as well as user defined prototype properties (excluding method properties).

showProxy?: boolean

If true, Proxy inspection includes the target and handler objects.

sorted?: boolean | (a: string, b: string) => number

If set to true or a function, all properties of an object, and Set and Map entries are sorted in the resulting string. If set to true the default sort is used. If set to a function, it is used as a compare function.

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

Node util.formatWithOptions function | API Reference | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for function node:util.formatWithOptions | Bun