separate node use case from browser use case

This commit is contained in:
AJ ONeal 2015-12-11 16:52:45 -08:00
parent 566cbf77b8
commit 518859983e
5 changed files with 17 additions and 20 deletions

View File

@ -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 Normal file
View File

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

View File

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

7
node-atob.js Normal file
View File

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

View File

@ -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"
},