jsesc - Given some data, jsesc returns the shortest possible stringified & ASCII-safe representation of that data

  •        23

For any input, jsesc generates the shortest possible valid printable-ASCII-only output. Here’s an online demo.jsesc’s output can be used instead of JSON.stringify’s to avoid mojibake and other encoding issues, or even to avoid errors when passing JSON-formatted data (which may contain U+2028 LINE SEPARATOR, U+2029 PARAGRAPH SEPARATOR, or lone surrogates) to a JavaScript parser or an UTF-8 encoder.

https://mths.be/jsesc
https://github.com/mathiasbynens/jsesc

Tags
Implementation
License
Platform

   




Related Projects

Fluent NHibernate - Fluent mapping for model

  •    CSharp

Fluent, XML-less, compile safe, automated, convention-based mappings for NHibernate. Fluent NHibernate offers an alternative to NHibernate's standard XML mapping files. Rather than writing XML documents, you write mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code.

gnostic - A compiler for APIs described by the OpenAPI Specification with plugins for code generation and other API support tasks

  •    Swift

This repository contains a Go command line tool which converts JSON and YAML OpenAPI descriptions to and from equivalent Protocol Buffer representations. Protocol Buffers provide a language-neutral, platform-neutral, extensible mechanism for serializing structured data. gnostic's Protocol Buffer models for the OpenAPI Specification can be used to generate code that includes data structures with explicit fields for the elements of an OpenAPI description. This makes it possible for developers to work with OpenAPI descriptions in type-safe ways, which is particularly useful in strongly-typed languages like Go and Swift.

transit-js - Transit for JavaScript

  •    Javascript

Transit is a data format and a set of libraries for conveying values between applications written in different languages. This library provides support for marshalling Transit data to/from JavaScript. transit-js will work with any ECMAScript-262 Edition 3 or newer JavaScript implementation provided that a JSON module that supplies parse and stringify methods is present. transit-js does not currently support encoding to MessagePack. Unlike the Java and Clojure implementations it relies on the non-streaming JSON parsing mechanism of the host JavaScript environment. This implementation's major.minor version number corresponds to the version of the Transit specification it supports.

fast-json-stringify - 2x faster than JSON.stringify()

  •    Javascript

fast-json-stringify is significantly faster than JSON.stringify() for small payloads. Its performance advantage shrinks as your payload grows. It pairs well with flatstr, which triggers a V8 optimization that improves performance when eventually converting the string to a Buffer. Build a stringify() function based on jsonschema.

colorama - Simple cross-platform colored terminal text in Python

  •    Python

Makes ANSI escape character sequences (for producing colored terminal text and cursor positioning) work under MS Windows. ANSI escape character sequences have long been used to produce colored terminal text and cursor positioning on Unix and Macs. Colorama makes this work on Windows, too, by wrapping stdout, stripping ANSI sequences it finds (which would appear as gobbledygook in the output), and converting them into the appropriate win32 calls to modify the state of the terminal. On other platforms, Colorama does nothing.


FiraCode - Monospaced font with programming ligatures

  •    Clojure

Programmers use a lot of symbols, often encoded with several characters. For the human brain, sequences like ->, <= or := are single logical tokens, even if they take two or three characters on the screen. Your eye spends a non-zero amount of energy to scan, parse and join multiple characters into a single logical one. Ideally, all programming languages should be designed with full-fledged Unicode symbols for operators, but that’s not the case yet. Fira Code is an extension of the Fira Mono font containing a set of ligatures for common programming multi-character combinations. This is just a font rendering feature: underlying code remains ASCII-compatible. This helps to read and understand code faster. For some frequent sequences like .. or //, ligatures allow us to correct spacing.

ansicon - Process ANSI escape sequences for Windows console programs.

  •    C

Process ANSI escape sequences for Windows console programs.

term-ansicolor - Ruby library that colors strings using ANSI escape sequences

  •    Ruby

Ruby library that colors strings using ANSI escape sequences

colorette - Node.js library for colorizing text using ANSI escape sequences

  •    Javascript

Colorette is a Node.js library for colorizing text using ANSI escape sequences. Import the style functions you want to use.

bytebuf - Example of how CL133375 can be utilized to mitigate Go escape analysis limitations.

  •    Go

Example of how CL133375 cmd/compile/internal/gc: handle array slice self-assign in esc.go can be utilized to mitigate Go escape analysis limitations. It shows how to fix problem described in cmd/compile, bytes: bootstrap array causes bytes.Buffer to always be heap-allocated using brand new escape analysis pattern.

pastel - Terminal output styling with intuitive and clean API.

  •    Ruby

Terminal output styling with intuitive and clean API that doesn't monkey patch String class. Pastel is minimal and focused to work in all terminal emulators.

gif-for-cli

  •    Python

Takes in a GIF, short video, or a query to the Tenor GIF API and converts it to animated ASCII art. Animation and color support are performed using ANSI escape sequences. Requires Python 3 (with setuptools and pip), zlib, libjpeg, and ffmpeg, other dependencies are installed by setup.py.

voca - The ultimate JavaScript string library

  •    Javascript

The Voca library offers helpful functions to make string manipulations comfortable: change case, trim, pad, slugify, latinise, sprintf'y, truncate, escape and much more. The modular design allows to load the entire library, or individual functions to minimize the application builds. The library is fully tested, well documented and long-term supported. Voca can be used in various environments.

pixd - 🔍 Colourful visualization tool for binary files

  •    C

pixd is a tool for visualizing binary data using a colour palette. It is in a lot of ways akin to a hexdump tool, except using coloured squares to represent each octet. pixd uses 24-bit color SGR escape sequences. For a list of terminal emulators with support for these, see XVilka's list of supporting terminal emulators.

json-stringify-safe - Like JSON.stringify, but doesn't throw on circular references

  •    Javascript

Like JSON.stringify, but doesn't throw on circular references. Takes the same arguments as JSON.stringify.

Escape-K

  •    Scala

Escape-K is an open-source IT management platform. It is designed to be used by IT services and provides a complete set of features for both technical and user services management. Using a single user interface, Escape-K lets you manage your whole IT inf

string.js - Extra JavaScript string methods.

  •    Javascript

string.js, or simply S is a lightweight (< 5 kb minified and gzipped) JavaScript library for the browser or for Node.js that provides extra String methods. Originally, it modified the String prototype. But I quickly learned that in JavaScript, this is considered poor practice.Personally, I prefer the cleanliness of the way code looks when it appears to be native methods. i.e. when you modify native JavaScript prototypes. However, if any app dependency required string.js, then the app's string prototype would be modified in every module. This could be troublesome. So I settled on creating a wrapper a la jQuery style. For those of you prototype hatin' fools, there is the method extendPrototype().