Skip to content

Commit 0a797f2

Browse files
schindldbevacqua
authored andcommitted
Fixes 'Uncaught ReferenceError: prefix is not defined' in an example in chapter 6 (last example in section 6.1.2). (mjavascript#14)
* Fixes 'Uncaught ReferenceError: prefix is not defined' in an example in chapter 6 (last example in section 6.1.2). * Moving invariant function inside concealWithPrefix instead of adding prefix parameters everywhere. * Moving invariant function below the return.
1 parent b96be0b commit 0a797f2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

chapters/ch06.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ function concealWithPrefix (original, prefix='_') {
168168
}
169169
}
170170
return new Proxy(original, handler)
171-
}
172-
function invariant (key, action) {
173-
if (key.startsWith(prefix)) {
174-
throw new Error(`Invalid attempt to ${ action } private "${ key }" property`)
171+
function invariant (key, action) {
172+
if (key.startsWith(prefix)) {
173+
throw new Error(`Invalid attempt to ${ action } private "${ key }" property`)
174+
}
175175
}
176176
}
177177
const target = {

0 commit comments

Comments
 (0)