UNPKG

es-arraybuffer-base64

Version:

An ES-spec-compliant shim/polyfill/replacement for ArrayBuffer base64 methods that works as far down as ES3

19 lines (14 loc) 411 B
'use strict'; var getPolyfill = require('./polyfill'); var define = require('define-properties'); module.exports = function shimUint8ArrayPrototypeToBase64() { var polyfill = getPolyfill(); if (typeof Uint8Array === 'function') { define( Uint8Array.prototype, { toBase64: polyfill }, { toBase64: function () { return Uint8Array.prototype.toBase64 !== polyfill; } } ); } return polyfill; };