source: frontend/node_modules/data-urls/lib/utils.js

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
RevLine 
[9af201e]1"use strict";
2const { percentDecode } = require("whatwg-url");
3const { atob } = require("abab");
4
5exports.stripLeadingAndTrailingASCIIWhitespace = string => {
6 return string.replace(/^[ \t\n\f\r]+/, "").replace(/[ \t\n\f\r]+$/, "");
7};
8
9exports.stringPercentDecode = input => {
10 return percentDecode(Buffer.from(input, "utf-8"));
11};
12
13exports.isomorphicDecode = input => {
14 return input.toString("binary");
15};
16
17exports.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.