mol_strict
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

$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"

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i mol_strict

    Weekly Downloads

    0

    Version

    0.0.1

    License

    none

    Unpacked Size

    737 kB

    Total Files

    23

    Last publish

    Collaborators

    • jin