Giter VIP home page Giter VIP logo

unescape-rs's Introduction

crates.io Build Status

unescape

"Unescapes" (JavaScript) strings with escape sequences written out as literal characters.

extern crate unescape;

use unescape::unescape;

fn main() {
  println!("{}", unescape(r"\u0038\u0039").unwrap()); // prints out "89"
}

unescape-rs's People

Contributors

saghm avatar

Stargazers

Akmal avatar pleblira avatar Ehsan avatar Suraj avatar  avatar David Krasnitsky avatar Caleb Bassi avatar  avatar Peter Xu avatar

Watchers

James Cloos avatar  avatar  avatar

unescape-rs's Issues

Suggestion: Add functionality to do the opposite

I found this package while looking for a package that takes a Rust string and spits out an escaped JS string. Being able to go back/forth (or in my case the opposite direction) would be very helpful

failed unescaping

I am currently trying to use this crate to unescape some javascript strings, however the following examples are failing to unescape.

js literal escaped node's value
'\1\00\400\000' "'\\1\\00\\400\\000'" '\u0001\u0000 0\u0000'
'\'\\"\\\b\f\n\r\t\v\0' "'\\'\\\"\\\\\\b\\f\\n\\r\\t\\v\\0'" '\\"\\\b\f\n\r\t\u000b\u0000

In the above table, the first cell represents a valid js string with escape sequences. The next column represents how that would be represented as a &str in Rust. The third column is the anticipated output, however the unescape function this crate exports returns None for both examples.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.