@8ms/helpers 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/string/getUnescaped.d.ts +10 -0
- package/string/getUnescaped.js +13 -0
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare type GetUnescaped = {
|
|
2
|
+
input: any;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Convert escaped copy into unescaped.
|
|
6
|
+
* E.g. there's => there's
|
|
7
|
+
* https://stackoverflow.com/a/42182294/2664955
|
|
8
|
+
*/
|
|
9
|
+
declare const getUnescaped: ({ input }: GetUnescaped) => string;
|
|
10
|
+
export default getUnescaped;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Convert escaped copy into unescaped.
|
|
5
|
+
* E.g. there's => there's
|
|
6
|
+
* https://stackoverflow.com/a/42182294/2664955
|
|
7
|
+
*/
|
|
8
|
+
const getUnescaped = ({ input }) => {
|
|
9
|
+
let el = document.createElement("textarea");
|
|
10
|
+
el.innerHTML = input;
|
|
11
|
+
return el.value;
|
|
12
|
+
};
|
|
13
|
+
exports.default = getUnescaped;
|