diff --git a/README.md b/README.md index afb90de..baf4c15 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,8 @@ Generate an ESM `import type` statement. Serialize an array to a string. +Values are not escaped or quoted. + **Example:** ```js @@ -127,10 +129,12 @@ genArrayFromRaw([1, 2, 3]) Serialize an object to a string. +Values are not escaped or quoted. + **Example:** ```js -genObjectFromValues({ foo: "bar", test: '() => import("pkg")' }) +genObjectFromRaw({ foo: "bar", test: '() => import("pkg")' }) // ~> `{ foo: bar, test: () => import("pkg") }` ``` @@ -138,10 +142,14 @@ genObjectFromValues({ foo: "bar", test: '() => import("pkg")' }) Serialize an array of key-value pairs to a string. +Values are not escaped or quoted. + ### `genObjectFromValues(obj, indent, options)` Serialize an object to a string. +Values are escaped and quoted if necessary. + **Example:** ```js diff --git a/src/object.ts b/src/object.ts index a194f44..86c93e9 100644 --- a/src/object.ts +++ b/src/object.ts @@ -8,10 +8,12 @@ export interface GenObjectOptions extends CodegenOptions { /** * Serialize an object to a string. * + * Values are not escaped or quoted. + * * @example * * ```js - * genObjectFromValues({ foo: "bar", test: '() => import("pkg")' }) + * genObjectFromRaw({ foo: "bar", test: '() => import("pkg")' }) * // ~> `{ foo: bar, test: () => import("pkg") }` * ``` * @@ -28,6 +30,8 @@ export function genObjectFromRaw( /** * Serialize an object to a string. * + * Values are escaped and quoted if necessary. + * * @example * * ```js @@ -48,6 +52,8 @@ export function genObjectFromValues( /** * Serialize an array to a string. * + * Values are not escaped or quoted. + * * @example * * ```js @@ -73,6 +79,8 @@ export function genArrayFromRaw( /** * Serialize an array of key-value pairs to a string. * + * Values are not escaped or quoted. + * * @group serialization */ export function genObjectFromRawEntries(