Skip to content

Commit

Permalink
Merge pull request #640 from michaelbpaulson/no-more-max
Browse files Browse the repository at this point in the history
getCache was still getting serializable issues
  • Loading branch information
ThePrimeagen committed Dec 1, 2015
2 parents de5dd38 + 5987a2c commit 351a187
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/get/getCache.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var $modelCreated = require("./../internal/model-created");
var clone = require("./util/clone");
var prefix = require("./../internal/prefix");
var isInternalKey = require("./../support/isInternalKey");

/**
* decends and copies the cache.
Expand All @@ -18,7 +18,7 @@ function _copyCache(node, out, fromKey) {
Object.
keys(node).
filter(function(k) {
return k[0] !== prefix && k !== "$size";
return !isInternalKey(k);
}).
forEach(function(key) {
var cacheNext = node[key];
Expand Down
22 changes: 22 additions & 0 deletions lib/support/isInternalKey.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var __parent = require("./../internal/parent");
var __key = require("./../internal/key");
var __version = require("./../internal/version");
var __prev = require("./../internal/prev");
var __next = require("./../internal/next");

/**
* If the key passed in is an internal key. We will use a simple checking to
* prevent infinite recursion on some machines.
*
* @param {String} x -
* @private
* @returns {Boolean}
*/
module.exports = function isInternalKey(x) {
return x === __parent ||
x === __key ||
x === __version ||
x === __prev ||
x === __next ||
x === "$size";
};

0 comments on commit 351a187

Please sign in to comment.