Skip to content

Commit

Permalink
fix this in lazy property callback
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Oct 18, 2015
1 parent da94f92 commit 52feb44
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function defineSetter(target, property, setter, options) {
*/
export function defineLazyProperty(target, property, callback, options) {
defineGetter(target, property, () => {
const value = callback();
const value = callback.call(this);
defineProperty(target, property, value, options);
return value;
}, {
Expand All @@ -116,7 +116,7 @@ export function defineLazyProperty(target, property, callback, options) {
*/
export function defineLazyConstant(target, property, callback, options) {
defineGetter(target, property, () => {
const value = callback();
const value = callback.call(this);
defineConstant(target, property, value, options);
return value;
}, {
Expand Down

0 comments on commit 52feb44

Please sign in to comment.