transcode-kz
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

transcode-kz

🇰🇿 A library for transcoding Kazakh between Cyrillic and Latin encodings.

Exports

/**
 * Transcodes a plain text.
 * @param text - source text.
 * @param direction - transcoding direction ('cyr2lat' | 'lat2cyr').
 * @returns transcoded text.
 */
export function transcodeText(text: string, direction: string = 'cyr2lat'): string {
    ...
}
/**
 * Creates an object from a JSON string and transcodes only string values (deeply nested) in the object.
 * @param json - source JSON string.
 * @param direction - transcoding direction ('cyr2lat' | 'lat2cyr').
 * @param indent - number of spaces used for indentation.
 * @returns transcoded JSON string.
 */
export function transcodeJson(json: string, direction: string = 'cyr2lat', indent: number = 2): string {
    ...
}

Usage examples

Transcode a plain text:

import { transcodeText } from 'transcode-kz';

const srcText = "Қазақша мәтін";
const dstText = transcodeText(srcText);

Transcode only string values in a JSON:

import { transcodeJson } from 'transcode-kz';

const srcJson = "{ \"city\": \"Қала\" }";
const dstJson = transcodeJson(srcJson);

License

LICENSE (MIT)

See also

  • transcode-kz-cli    – Command line utility for transcoding Kazakh between Cyrillic and Latin encodings.

Package Sidebar

Install

npm i transcode-kz

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

65.9 kB

Total Files

13

Last publish

Collaborators

  • ardaqs