Browse Source

separate node use case from browser use case

master
AJ ONeal 8 years ago
parent
commit
518859983e
  1. 12
      bin/atob.js
  2. 2
      browser-atob.js
  3. 9
      index.js
  4. 7
      node-atob.js
  5. 7
      package.json

12
bin/atob.js

@ -1,10 +1,6 @@
#!/usr/bin/env node
/*jshint strict:true node:true es5:true onevar:true laxcomma:true laxbreak:true eqeqeq:true immed:true latedef:true*/
(function () {
"use strict";
'use strict';
var atob = require('../index')
;
console.log(atob(process.argv[2]));
}());
var atob = require('../node-atob');
var str = process.argv[2];
console.log(atob(str));

2
browser-atob.js

@ -0,0 +1,2 @@
// do nothing window.atob already exists
// NOTE: iOS Web Worker and other weird environments may not have atob

9
index.js

@ -1,9 +0,0 @@
(function () {
"use strict";
function atob(str) {
return new Buffer(str, 'base64').toString('binary');
}
module.exports = atob;
}());

7
node-atob.js

@ -0,0 +1,7 @@
"use strict";
function atob(str) {
return new Buffer(str, 'base64').toString('binary');
}
module.exports = atob.atob = atob;

7
package.json

@ -4,17 +4,18 @@
"description": "atob for Node.JS and Linux / Mac / Windows CLI (it's a one-liner)",
"repository": {
"type": "git",
"url": "git://github.com/coolaj86/node-browser-compat.git"
"url": "git://github.com/coolaj86/node-browser-compat/atob.git"
},
"keywords": [
"atob",
"browser"
],
"author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.info)",
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com)",
"engines": {
"node": ">= 0.4.0"
},
"main": "index",
"main": "node-atob.js",
"browser": "browser-atob.js",
"bin": {
"atob": "bin/atob.js"
},

Loading…
Cancel
Save