modif comtabilite

This commit is contained in:
2019-01-16 16:23:31 +01:00
parent 6b741a9666
commit 9312edc3ae
1844 changed files with 158848 additions and 55874 deletions
+30 -11
View File
@@ -1,30 +1,49 @@
atob
===
| **atob**
| [btoa](https://git.coolaj86.com/coolaj86/btoa.js)
| [unibabel.js](https://git.coolaj86.com/coolaj86/unibabel.js)
| Sponsored by [ppl](https://ppl.family)
Uses `Buffer` to emulate the exact functionality of the browser's atob.
Note: Unicode may be handled incorrectly (like the browser).
It turns base64-encoded <strong>a</strong>scii data back **to** <strong>b</strong>inary.
(function () {
"use strict";
```javascript
(function () {
"use strict";
var atob = require('atob')
, b64 = "SGVsbG8gV29ybGQ="
, bin = atob(b64)
;
var atob = require('atob');
var b64 = "SGVsbG8sIFdvcmxkIQ==";
var bin = atob(b64);
console.log(bin); // "Hello World"
}());
console.log(bin); // "Hello, World!"
}());
```
### Need Unicode and Binary Support in the Browser?
Check out [unibabel.js](https://git.coolaj86.com/coolaj86/unibabel.js)
Changelog
=======
* v2.1.0 address a few issues and PRs, update URLs
* v2.0.0 provide browser version for ios web workers
* v1.2.0 provide (empty) browser version
* v1.1.3 add MIT license
* v1.1.2 node only
LICENSE
=======
Code copyright 2012-2015 AJ ONeal
Code copyright 2012-2018 AJ ONeal
Dual-licensed MIT and Apache-2.0
Docs copyright 2012-2015 AJ ONeal
Docs copyright 2012-2018 AJ ONeal
Docs released under [Creative Commons](https://github.com/node-browser-compat/atob/blob/master/LICENSE.DOCS).
Docs released under [Creative Commons](https://git.coolaj86.com/coolaj86/atob.js/blob/master/LICENSE.DOCS).
+4 -8
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));
+24
View File
@@ -0,0 +1,24 @@
{
"name": "atob",
"description": "atob for isomorphic environments",
"main": "browser-atob.js",
"authors": [
"AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com)"
],
"license": "(MIT OR Apache-2.0)",
"keywords": [
"atob",
"browser"
],
"homepage": "https://github.com/node-browser-compat/atob",
"moduleType": [
"globals"
],
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}
+44
View File
@@ -0,0 +1,44 @@
(function (w) {
"use strict";
function findBest(atobNative) {
// normal window
if ('function' === typeof atobNative) { return atobNative; }
// browserify (web worker)
if ('function' === typeof Buffer) {
return function atobBrowserify(a) {
//!! Deliberately using an API that's deprecated in node.js because
//!! this file is for browsers and we expect them to cope with it.
//!! Discussion: github.com/node-browser-compat/atob/pull/9
return new Buffer(a, 'base64').toString('binary');
};
}
// ios web worker with base64js
if ('object' === typeof w.base64js) {
// bufferToBinaryString
// https://git.coolaj86.com/coolaj86/unibabel.js/blob/master/index.js#L50
return function atobWebWorker_iOS(a) {
var buf = w.base64js.b64ToByteArray(a);
return Array.prototype.map.call(buf, function (ch) {
return String.fromCharCode(ch);
}).join('');
};
}
return function () {
// ios web worker without base64js
throw new Error("You're probably in an old browser or an iOS webworker." +
" It might help to include beatgammit's base64-js.");
};
}
var atobBest = findBest(w.atob);
w.atob = atobBest;
if ((typeof module === 'object') && module && module.exports) {
module.exports = atobBest;
}
}(window));
-9
View File
@@ -1,9 +0,0 @@
(function () {
"use strict";
function atob(str) {
return new Buffer(str, 'base64').toString('binary');
}
module.exports = atob;
}());
+7
View File
@@ -0,0 +1,7 @@
"use strict";
function atob(str) {
return Buffer.from(str, 'base64').toString('binary');
}
module.exports = atob.atob = atob;
+20 -25
View File
@@ -1,58 +1,53 @@
{
"_args": [
[
"atob@1.1.3",
"/mnt/data/Sites/anissabensalah.net/user/themes/anissabensalah"
]
],
"_from": "atob@1.1.3",
"_id": "atob@1.1.3",
"_from": "atob@^2.1.1",
"_id": "atob@2.1.2",
"_inBundle": false,
"_integrity": "sha1-lfE2KbEsOlGl0hWr3OKqnzL4B3M=",
"_integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
"_location": "/atob",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "atob@1.1.3",
"raw": "atob@^2.1.1",
"name": "atob",
"escapedName": "atob",
"rawSpec": "1.1.3",
"rawSpec": "^2.1.1",
"saveSpec": null,
"fetchSpec": "1.1.3"
"fetchSpec": "^2.1.1"
},
"_requiredBy": [
"/source-map-resolve"
],
"_resolved": "https://registry.npmjs.org/atob/-/atob-1.1.3.tgz",
"_spec": "1.1.3",
"_where": "/mnt/data/Sites/anissabensalah.net/user/themes/anissabensalah",
"_resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
"_shasum": "6d9517eb9e030d2436666651e86bd9f6f13533c9",
"_spec": "atob@^2.1.1",
"_where": "/home/kevin/Documents/Sites/anissabensalah.net/user/themes/anissabensalah/node_modules/source-map-resolve",
"author": {
"name": "AJ ONeal",
"email": "coolaj86@gmail.com",
"url": "http://coolaj86.info"
"url": "https://coolaj86.com"
},
"bin": {
"atob": "bin/atob.js"
},
"bugs": {
"url": "https://github.com/coolaj86/node-browser-compat/issues"
},
"browser": "browser-atob.js",
"bundleDependencies": false,
"deprecated": false,
"description": "atob for Node.JS and Linux / Mac / Windows CLI (it's a one-liner)",
"engines": {
"node": ">= 0.4.0"
"node": ">= 4.5.0"
},
"homepage": "https://github.com/coolaj86/node-browser-compat",
"homepage": "https://git.coolaj86.com/coolaj86/atob.js.git",
"keywords": [
"atob",
"browser"
],
"license": "(MIT OR Apache-2.0)",
"main": "index",
"main": "node-atob.js",
"name": "atob",
"repository": {
"type": "git",
"url": "git://github.com/coolaj86/node-browser-compat.git"
"url": "git://git.coolaj86.com/coolaj86/atob.js.git"
},
"version": "1.1.3"
"version": "2.1.2"
}
+3 -5
View File
@@ -1,15 +1,13 @@
/*jshint strict:true node:true es5:true onevar:true laxcomma:true laxbreak:true eqeqeq:true immed:true latedef:true*/
(function () {
"use strict";
var atob = require('./index')
, encoded = "SGVsbG8gV29ybGQ="
, unencoded = "Hello World"
var atob = require('.');
var encoded = "SGVsbG8sIFdvcmxkIQ=="
var unencoded = "Hello, World!";
/*
, encoded = "SGVsbG8sIBZM"
, unencoded = "Hello, 世界"
*/
;
if (unencoded !== atob(encoded)) {
console.log('[FAIL]', unencoded, atob(encoded));