Debian Codegraph @

memoizee/test/normalizers/primitive.js

raw
1 /* eslint id-length: 0 */
2
3 "use strict";
4
5 var memoize = require("../..")
6 , join = Array.prototype.join;
7
8 module.exports = function (a) {
9 var i = 0
10 , fn = function () {
11 ++i;
12 return join.call(arguments, "|");
13 }
14 , y = { toString: function () { return "foo"; } }
15 , mfn;
16 mfn = memoize(fn, { primitive: true, length: false });
17 a(mfn(y, "bar", "zeta"), "foo|bar|zeta", "#1");
18 a(mfn("foo", "bar", "zeta"), "foo|bar|zeta", "#2");
19 a(i, 1, "Called once");
20 a(mfn(y, "bar"), "foo|bar", "#3");
21 a(i, 2, "Called twice");
22 a(mfn(y, "bar"), "foo|bar", "#4");
23 a(i, 2, "Called twice #2");
24 };