@8ms/helpers 1.2.0 → 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.
@@ -4,5 +4,5 @@ declare type ForceUpdate = {
4
4
  /**
5
5
  * Force an update of the cached data
6
6
  */
7
- declare const forceUpdate: ({ key }: ForceUpdate) => Promise<void>;
7
+ declare const forceUpdate: ({ key }: ForceUpdate) => Promise<any>;
8
8
  export default forceUpdate;
@@ -18,5 +18,6 @@ const forceUpdate = async ({ key }) => {
18
18
  value: await global[key].updateFn(),
19
19
  };
20
20
  }
21
+ return global[key];
21
22
  };
22
23
  exports.default = forceUpdate;
package/global/init.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare type Update = {
1
+ declare type Init = {
2
2
  expires: number;
3
3
  key: string;
4
4
  updateFn: Function;
@@ -6,5 +6,5 @@ declare type Update = {
6
6
  /**
7
7
  * Initialise a new global data.
8
8
  */
9
- declare const init: ({ expires, key, updateFn }: Update) => Promise<any>;
9
+ declare const init: ({ expires, key, updateFn }: Init) => Promise<any>;
10
10
  export default init;
package/global/read.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  declare type Update = {
2
- expires: number;
3
2
  key: string;
4
- updateFn: Function;
5
3
  };
6
4
  /**
7
5
  * Retrieve a value from global memory.
package/global/read.js CHANGED
@@ -23,6 +23,6 @@ const read = async ({ key }) => {
23
23
  await (0, forceUpdate_1.default)({ key });
24
24
  }
25
25
  }
26
- return global[key];
26
+ return global[key].value;
27
27
  };
28
28
  exports.default = read;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "1.2.0",
4
+ "version": "1.2.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -0,0 +1,10 @@
1
+ declare type GetUnescaped = {
2
+ input: any;
3
+ };
4
+ /**
5
+ * Convert escaped copy into unescaped.
6
+ * E.g. there&#39;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&#39;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;