@neovici/cosmoz-utils 6.6.0 → 6.7.0

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/dist/memoize.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export function memize(fn: any): () => any;
1
2
  export function memoize(fn: any): (arg: any) => any;
2
3
  export function memooize(fn: any): (arg1: any, arg2: any) => any;
3
4
  export function memoooize(fn: any): (arg1: any, arg2: any, arg3: any) => any;
package/dist/memoize.js CHANGED
@@ -1,4 +1,15 @@
1
- export const memoize = fn => {
1
+ export const memize = (fn) => {
2
+ let called = false, lastResult;
3
+ return function () {
4
+ if (called) {
5
+ return lastResult;
6
+ }
7
+ const result = fn();
8
+ lastResult = result;
9
+ called = true;
10
+ return result;
11
+ };
12
+ }, memoize = (fn) => {
2
13
  let lastArg, lastResult;
3
14
  return function (arg) {
4
15
  if (lastArg === arg) {
@@ -9,7 +20,7 @@ export const memoize = fn => {
9
20
  lastArg = arg;
10
21
  return result;
11
22
  };
12
- }, memooize = fn => {
23
+ }, memooize = (fn) => {
13
24
  let lastArg1, lastArg2, lastResult;
14
25
  return function (arg1, arg2) {
15
26
  if (lastArg1 === arg1 && lastArg2 === arg2) {
@@ -21,7 +32,7 @@ export const memoize = fn => {
21
32
  lastArg2 = arg2;
22
33
  return result;
23
34
  };
24
- }, memoooize = fn => {
35
+ }, memoooize = (fn) => {
25
36
  let lastArg1, lastArg2, lastArg3, lastResult;
26
37
  return function (arg1, arg2, arg3) {
27
38
  if (lastArg1 === arg1 && lastArg2 === arg2 && lastArg3 === arg3) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-utils",
3
- "version": "6.6.0",
3
+ "version": "6.7.0",
4
4
  "description": "Date, money and template management functions commonly needed in Cosmoz views.",
5
5
  "keywords": [
6
6
  "polymer",