Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allows memoization of circular structures #23

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

gofreddo
Copy link

allows memoization of circular structures

test('memoize circular JSON', function () {
var circular = {
a: 'foo'
}
circular.b = circular

function circularFunction(a) {
return a.a
}

var memoizedCircularFunction = memoize(circularFunction)

// Assertions

expect(memoizedCircularFunction(circular)).toBe("foo")
expect(memoizedCircularFunction(circular)).toBe("foo")
})

Copy link

@FlorianWendelborn FlorianWendelborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too familiar with the source, so I unfortunately can't comment on the other changes.

@@ -3,3 +3,4 @@ node_modules/
npm-debug.log
.DS_Store
coverage/
.vscode

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline at EOF. Reasoning

delete this.cache[key]
}
}

const cacheDefault = {
create: () => new ObjectWithoutPrototypeCache()
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants