Giter Site home page Giter Site logo

fast-decode-uri-component's Introduction

fast-decode-uri-component

js-standard-style Build Status

Decodes strings encoded by encodeURI and encodeURIComponent, without throwing errors on invalid escapes, instead, it returns null.

Installation

npm install fast-decode-uri-component

Usage

const fastDecode = require('fast-decode-uri-component')

console.log(fastDecode('test')) // 'test'
console.log(fastDecode('%25')) // '%'
console.log(fastDecode('/test/hel%2Flo')) // '/test/hel/lo'

console.log(fastDecode('/test/hel%"Flo')) // null
console.log(fastDecode('%7B%ab%7C%de%7D')) // null
console.log(fastDecode('%ab')) // null

Benchmarks

You can find the benchmark file here.

# fast-decode-uri-component
ok ~539 ms (0 s + 539114308 ns)

# decodeURIComponent
ok ~6.06 s (6 s + 62305153 ns)

Acknowledgements

This project has been forked from jridgewell/safe-decode-uri-component because I wanted to change the behaviour of the library on invalid inputs, plus change some internals.
All the credits before the commit 53000fe goes to the jridgewell/safe-decode-uri-component project contributors.
Since the commit 9673ab7 the project will be maintained by @delvedor.

License

Licensed under MIT.

fast-decode-uri-component's People

Contributors

delvedor avatar jridgewell avatar kensnyder avatar

Watchers

 avatar

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.