mol_strict
v0.0.1
Published
Makes JS runtime more strict.
Downloads
3
Readme
$mol_strict
Makes JS runtime more strict.
Without $mol_strict
class Foo extends Object {}
const foo = new Foo
`Hello, ${ foo }!`
// "Hello [object Object]!"
`In this month you have earned ${ foo / 1000 } thousand of dollars.`
// "In this month you have earned NaN thousand of dollars."
`Your "${ 'foo'[4] }" goal is finally achieved.`
// "Your "undefined" goal is finally achieved."
`There are still ${ foo.length - 1 } goals left and you will achieve success.`
// "There are still NaN goals left and you will achieve success."
With $mol_strict
class Foo extends Object {}
const foo = new Foo
`Hello, ${ foo }!`
// TypeError: Field "Symbol(Symbol.toPrimitive)" is not defined
`In this month you have earned ${ foo / 1000 } thousand of dollars.`
// TypeError: Field "Symbol(Symbol.toPrimitive)" is not defined
`Your "${ 'foo'[4] }" goal is finally achieved.`
// TypeError: Field "4" is not defined
`There are still ${ foo.length - 1 } goals left and you will achieve success.`
// TypeError: Field "length" is not defined
Usage from MAM
At any *.meta.tree
:
include \/mol/strict
Usage from NPM
import "mol_strict"