New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unicode-to-lfs

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unicode-to-lfs

Convert Unicode messages to LFS

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25
Maintainers
2
Weekly downloads
 
Created
Source

Unicode to LFS

NPM Version Node.js CI

Convert a Unicode string to Live for Speed

This module is designed to be used with NodeJS on the server with an InSim library or as middleware for other LFS InSim applications. This module will parse a Unicode string, converting each character to its respective encoding supported by LFS. This module leaves message colour encodings intact for processing later.

Install

# Install with Yarn
yarn add unicode-to-lfs

# Install with NPM
npm i unicode-to-lfs

Usage Example

import unicodeToLfs from "unicode-to-lfs";

const encodedString1 = unicodeToLfs("ě ш");
const encodedString2 = unicodeToLfs("マ");

console.log(encodedString1);
// Output: ^Eì ^Cø

console.log(encodedString2);
// Output: ^JÏ

Options

length

To specify the maximum output byte length, use the length option. If the output string would be trimmed in the middle of an encoded character, that character will not be included and the string will be padded with NULL bytes up to the specified length.

import unicodeToLfs from "unicode-to-lfs";

const encodedString1 = unicodeToLfs("ě ш", { length: 4 });
const encodedString2 = unicodeToLfs("ě ш", { length: 7 });

console.log(encodedString1);
// Output: ^Eì\0

console.log(encodedString2);
// Output: ^Eì ^Cø
isNullTerminated

If set to true, the output string will always end with a NULL byte.

The default value is false.

import unicodeToLfs from "unicode-to-lfs";

const encodedString1 = unicodeToLfs("ě ш", { isNullTerminated: true });
const encodedString2 = unicodeToLfs("ě ш", {
  isNullTerminated: true,
  length: 7,
});

console.log(encodedString1);
// Output: ^Eì ^Cø\0

console.log(encodedString2);
// Output: ^Eì \0\0\0

Keywords

FAQs

Package last updated on 14 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc