separate node use case from browser use case
This commit is contained in:
parent
566cbf77b8
commit
518859983e
12
bin/atob.js
12
bin/atob.js
|
@ -1,10 +1,6 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
/*jshint strict:true node:true es5:true onevar:true laxcomma:true laxbreak:true eqeqeq:true immed:true latedef:true*/
|
'use strict';
|
||||||
(function () {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var atob = require('../index')
|
var atob = require('../node-atob');
|
||||||
;
|
var str = process.argv[2];
|
||||||
|
console.log(atob(str));
|
||||||
console.log(atob(process.argv[2]));
|
|
||||||
}());
|
|
||||||
|
|
|
@ -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
9
index.js
|
@ -1,9 +0,0 @@
|
||||||
(function () {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
function atob(str) {
|
|
||||||
return new Buffer(str, 'base64').toString('binary');
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = atob;
|
|
||||||
}());
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function atob(str) {
|
||||||
|
return new Buffer(str, 'base64').toString('binary');
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = atob.atob = atob;
|
|
@ -4,17 +4,18 @@
|
||||||
"description": "atob for Node.JS and Linux / Mac / Windows CLI (it's a one-liner)",
|
"description": "atob for Node.JS and Linux / Mac / Windows CLI (it's a one-liner)",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/coolaj86/node-browser-compat.git"
|
"url": "git://github.com/coolaj86/node-browser-compat/atob.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"atob",
|
"atob",
|
||||||
"browser"
|
"browser"
|
||||||
],
|
],
|
||||||
"author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.info)",
|
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com)",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4.0"
|
"node": ">= 0.4.0"
|
||||||
},
|
},
|
||||||
"main": "index",
|
"main": "node-atob.js",
|
||||||
|
"browser": "browser-atob.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
"atob": "bin/atob.js"
|
"atob": "bin/atob.js"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue