From c5a3340a13478a80f0e3d933584d76a1d75c907d Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 4 Dec 2017 14:00:43 -0700 Subject: [PATCH] v2.1.7 --- README.md | 23 ++++++++++++++++++++++- bower.json | 4 ++-- index.js | 6 +++--- package.json | 2 +- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 265a510..df55004 100644 --- a/README.md +++ b/README.md @@ -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 + +``` + +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 === diff --git a/bower.json b/bower.json index 13fdb19..39a1f45 100644 --- a/bower.json +++ b/bower.json @@ -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 " + "AJ ONeal " ], "description": "Convert between UTF8, TypedArrays, and Base64", "moduleType": [ diff --git a/index.js b/index.js index be3001c..a8b3fb5 100644 --- a/index.js +++ b/index.js @@ -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)); diff --git a/package.json b/package.json index 5514f4b..3c27db8 100644 --- a/package.json +++ b/package.json @@ -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": {