Sha256: 1ac1f029ffa607ffa3c53af01a5bd493116d8a352fcea62361eb40acf79d7bed

Contents?: true

Size: 1.33 KB

Versions: 42

Compression:

Stored size: 1.33 KB

Contents

(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));

Version data entries

42 entries across 41 versions & 14 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/atob/browser-atob.js
disco_app-0.18.0 test/dummy/node_modules/atob/browser-atob.js
disco_app-0.18.2 test/dummy/node_modules/atob/browser-atob.js
epuber-stylus-source-0.56.0 vendor/node_modules/atob/browser-atob.js
disco_app-0.16.1 test/dummy/node_modules/atob/browser-atob.js
disco_app-0.15.2 test/dummy/node_modules/atob/browser-atob.js
disco_app-0.18.4 test/dummy/node_modules/atob/browser-atob.js
disco_app-0.18.1 test/dummy/node_modules/atob/browser-atob.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/atob/browser-atob.js
disco_app-0.14.0 test/dummy/node_modules/atob/browser-atob.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/atob/browser-atob.js
epuber-stylus-source-0.54.8 vendor/node_modules/atob/browser-atob.js
tang-0.2.1 spec/tang_app/node_modules/atob/browser-atob.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/atob/browser-atob.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/atob/browser-atob.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/atob/browser-atob.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/atob/browser-atob.js
tang-0.2.0 spec/tang_app/node_modules/atob/browser-atob.js
tang-0.1.0 spec/tang_app/node_modules/atob/browser-atob.js
tang-0.0.9 spec/tang_app/node_modules/atob/browser-atob.js