This commit is contained in:
AJ ONeal 2017-12-04 14:00:43 -07:00
parent 49f9469bfd
commit c5a3340a13
4 changed files with 28 additions and 7 deletions

View File

@ -14,9 +14,11 @@ See also
* [TextEncoderLite (based on text-encoding)](https://github.com/coolaj86/TextEncoderLite/tree/lite)
* [Beatgammit's base64-js](https://github.com/beatgammit/base64-js)
Quick Note to Node.js Users
Are you in the right place?
------------------------
Dear Node.js Users:
You SHOULD NOT use this module. You already have [`Buffer`](https://nodejs.org/api/buffer.html) and [`thirty-two`](https://github.com/chrisumbel/thirty-two):
```javascript
@ -28,6 +30,25 @@ buf.toString('utf8');
buf.toString('binary'); // deprecated, do not use
```
Install
-------
You just include the `index.js` in a lovely script tag.
```bash
bower install --save unibabel
```
```html
<script src="/bower_components/unibabel/index.js"></script>
```
Dear WebPack / Broccoli, Gulp / Grunt Users:
I don't know how your build systems work these days,
but Unibabel is exported as `Unibabel`
and you can access it as `window.Unibabel`.
API
===

View File

@ -1,10 +1,10 @@
{
"name": "unibabel",
"main": "index.js",
"version": "2.1.5",
"version": "2.1.7",
"homepage": "https://github.com/coolaj86/unibabel-js",
"authors": [
"AJ ONeal <awesome@coolaj86.com>"
"AJ ONeal <coolaj86@gmail.com>"
],
"description": "Convert between UTF8, TypedArrays, and Base64",
"moduleType": [

View File

@ -1,4 +1,4 @@
(function () {
(function (exports) {
'use strict';
function utf8ToBinaryString(str) {
@ -82,7 +82,7 @@ function base64ToBuffer(base64) {
return buf;
}
window.Unibabel = {
exports.Unibabel = {
utf8ToBinaryString: utf8ToBinaryString
, utf8ToBuffer: utf8ToBuffer
, utf8ToBase64: utf8ToBase64
@ -101,4 +101,4 @@ window.Unibabel = {
, base64ToArr: base64ToBuffer
};
}());
}('undefined' !== typeof exports && exports || 'undefined' !== typeof window && window || global));

View File

@ -1,6 +1,6 @@
{
"name": "unibabel",
"version": "2.1.5",
"version": "2.1.7",
"description": "Base64, TypedArrays, and UTF-8 / Unicode conversions in Browser (and Node) JavaScript",
"main": "node.js",
"browser": {