npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wtf-8

v1.0.1

Published

A well-tested WTF-8 encoder/decoder written in JavaScript.

Downloads

1,191,636

Readme

wtf-8 Build status Dependency status

wtf-8 is a well-tested WTF-8 encoder/decoder written in JavaScript. WTF-8 is a superset of UTF-8: it can encode/decode any given Unicode code point, including those of (unpaired) surrogates. Here’s an online demo.

Feel free to fork if you see possible improvements!

Installation

Via npm:

npm install wtf-8

Via Bower:

bower install wtf-8

Via Component:

component install mathiasbynens/wtf-8

In a browser:

<script src="wtf-8.js"></script>

In Narwhal, Node.js, and RingoJS ≥ v0.8.0:

var wtf8 = require('wtf-8');

In Rhino:

load('wtf-8.js');

Using an AMD loader like RequireJS:

require(
  {
    'paths': {
      'wtf-8': 'path/to/wtf-8'
    }
  },
  ['wtf-8'],
  function(wtf8) {
    console.log(wtf8);
  }
);

API

wtf8.encode(string)

Encodes any given JavaScript string (string) as WTF-8, and returns the WTF-8-encoded version of the string.

// U+00A9 COPYRIGHT SIGN; see http://codepoints.net/U+00A9
wtf8.encode('\xA9');
// → '\xC2\xA9'
// U+10001 LINEAR B SYLLABLE B038 E; see http://codepoints.net/U+10001
wtf8.encode('\uD800\uDC01');
// → '\xF0\x90\x80\x81'

wtf8.decode(byteString)

Decodes any given WTF-8-encoded string (byteString) as WTF-8, and returns the WTF-8-decoded version of the string. It throws an error when malformed WTF-8 is detected.

wtf8.decode('\xC2\xA9');
// → '\xA9'

wtf8.decode('\xF0\x90\x80\x81');
// → '\uD800\uDC01'
// → U+10001 LINEAR B SYLLABLE B038 E

wtf8.version

A string representing the semantic version number.

Support

wtf-8 has been tested in (at least) the latest versions of Chrome, Opera, Firefox, Safari, IE, Node.js, Narwhal, RingoJS, PhantomJS, and Rhino.

Author

| twitter/mathias | |---| | Mathias Bynens |

License

wtf-8 is available under the MIT license.