UNPKG

str2buf

Version:

isomorphic string <=> buffer in 183 bytes

3 lines (2 loc) 519 B
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.str2buf={})}(this,function(n){function r(n){return n.reduce(function(n,r){return n+String.fromCharCode(r)},"")}function t(n){return new Uint8Array(n.length).map(function(r,t){return n.charCodeAt(t)})}n.fromUint8Array=r,n.toUint8Array=t,n.fromBuffer=function(n){return r(new Uint8Array(n))},n.toBuffer=function(n){return t(n).buffer}}); //# sourceMappingURL=str2buf.umd.js.map