|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
579 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | "use strict";
|
|---|
| 2 | const { percentDecode } = require("whatwg-url");
|
|---|
| 3 | const { atob } = require("abab");
|
|---|
| 4 |
|
|---|
| 5 | exports.stripLeadingAndTrailingASCIIWhitespace = string => {
|
|---|
| 6 | return string.replace(/^[ \t\n\f\r]+/, "").replace(/[ \t\n\f\r]+$/, "");
|
|---|
| 7 | };
|
|---|
| 8 |
|
|---|
| 9 | exports.stringPercentDecode = input => {
|
|---|
| 10 | return percentDecode(Buffer.from(input, "utf-8"));
|
|---|
| 11 | };
|
|---|
| 12 |
|
|---|
| 13 | exports.isomorphicDecode = input => {
|
|---|
| 14 | return input.toString("binary");
|
|---|
| 15 | };
|
|---|
| 16 |
|
|---|
| 17 | exports.forgivingBase64Decode = data => {
|
|---|
| 18 | const asString = atob(data);
|
|---|
| 19 | if (asString === null) {
|
|---|
| 20 | return null;
|
|---|
| 21 | }
|
|---|
| 22 | return Buffer.from(asString, "binary");
|
|---|
| 23 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.