Skip to content

nsuite v2.2.1


nsuite / limitJsonStringLength

Function: limitJsonStringLength() ​

limitJsonStringLength<T>(str, len): JSONString<T>

Defined in: UtilsString.ts:110

Proportionally limit string values in a typed JSON string

Type Parameters ​

T ​

T extends Record<string, string>

Parameters ​

str ​

JSONString<T>

len ​

number

Returns ​

JSONString<T>

Example ​

ts
import { limitJsonStringLength, stringifyToJsonString } from 'nsuite'
console.log(limitJsonStringLength(stringifyToJsonString({ text: 'nsuite' }), 20))

Released under the Apache-2.0 License.