Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

ascii-json

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ascii-json

Generates ASCII-only JSON with escaped non-ASCII chracters.


Version published
Weekly downloads
641
increased by87.98%
Maintainers
1
Weekly downloads
 
Created
Source

Generates ASCII-only JSON with escaped non-ASCII chracters.

Install

    npm install ascii-json

Examples

    var asciiJSON = require('ascii-json');

See if a string is all ASCII or not

    asciiJSON.isAscii("this is all ASCII"); // true
    asciiJSON.isAscii("this is not 에스키"); // false

Escape non-ASCII strings

    console.log(asciiJSON.escapeNonAsciis('this is not 에스키'));

    // output: this is not \uc5d0\uc2a4\ud0a4"

Stringify object with non-ASCII property value

    troublemaker = {
      ascii: "hello world",
      nonascii: "안녕하세요"
    };
    asciiOnly = asciiJSON.stringify(troublemaker);
    console.log(asciiOnly);

    // output: {"ascii":"hello world","nonascii":"\uc548\ub155\ud558\uc138\uc694"}

Keywords

FAQs

Package last updated on 05 Apr 2013

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