hapijs / catbox

Multi-strategy object caching service
Other
494 stars 72 forks source link

catbox breaks with 'use strict'; #48

Closed joshua-mcginnis closed 10 years ago

joshua-mcginnis commented 10 years ago

Thanks for building a really cool package. We're building an app with Hapi and we've decided to 'use strict' everywhere.

When doing this, I came across an issue/bug when strict mode is enabled globally which includes our hapi modules:

node_modules/hapi/node_modules/catbox/lib/policy.js:146

SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function.

Here is the offending code:

function timerFunc() {

                if (wasCallbackCalled) {
                    return;
                }

                wasCallbackCalled = true;
                return callback(null, cached.item, cached, report);
}

Strict mode complains because ECMA standards specify that function declarations are not valid within blocks and timerFunc is being declared within another functions block.

Let me know if you need any other help/assistance with getting this fixed.

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.