UNPKG

@nethesis/phone-island

Version:
3 lines (2 loc) 909 B
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./globalThis.browser.js");const i=e.globalThisShim.setTimeout,t=e.globalThisShim.clearTimeout;exports.byteLength=function(e){return"string"==typeof e?function(e){let i=0,t=0;for(let o=0,r=e.length;o<r;o++)i=e.charCodeAt(o),i<128?t+=1:i<2048?t+=2:i<55296||i>=57344?t+=3:(o++,t+=4);return t}(e):Math.ceil(1.33*(e.byteLength||e.size))},exports.installTimerFunctions=function(o,r){r.useNativeTimers?(o.setTimeoutFn=i.bind(e.globalThisShim),o.clearTimeoutFn=t.bind(e.globalThisShim)):(o.setTimeoutFn=e.globalThisShim.setTimeout.bind(e.globalThisShim),o.clearTimeoutFn=e.globalThisShim.clearTimeout.bind(e.globalThisShim))},exports.pick=function(e){for(var i=arguments.length,t=new Array(i>1?i-1:0),o=1;o<i;o++)t[o-1]=arguments[o];return t.reduce(((i,t)=>(e.hasOwnProperty(t)&&(i[t]=e[t]),i)),{})}; //# sourceMappingURL=util.js.map