source: trip-planner-front/node_modules/hpack.js/lib/hpack/utils.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 511 bytes
Line 
1exports.assert = function assert(cond, text) {
2 if (!cond)
3 throw new Error(text);
4};
5
6exports.stringify = function stringify(arr) {
7 var res = '';
8 for (var i = 0; i < arr.length; i++)
9 res += String.fromCharCode(arr[i]);
10 return res;
11};
12
13exports.toArray = function toArray(str) {
14 var res = [];
15 for (var i = 0; i < str.length; i++) {
16 var c = str.charCodeAt(i);
17 var hi = c >>> 8;
18 var lo = c & 0xff;
19 if (hi)
20 res.push(hi, lo);
21 else
22 res.push(lo);
23 }
24 return res;
25};
Note: See TracBrowser for help on using the repository browser.