This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

preact-cli-unassert

1.0.4 • Public • Published

preact-cli-unassert

Plugin for ⚛️ preact-cli to remove assertions in production.

npm David license

Getting Started

Install it with npm:

npm i -D preact-cli-unassert

or with yarn:

yarn add preact-cli-unassert --dev

This will also install:

And include in your project by creating or adding to preact.config.js.

export default function customWebpackConfiguration(config, env, helpers) {
  // Along with other customizations and plugin...
  require('preact-cli-unassert')(config, env);
}

Example

Use console.assert calls to check your inputs:

import { h } from 'preact';

const Asserted = ({ name }) => {
  console.assert(name != null);
  return <p>Hi {name}!</p>;
}

export default Asserted;

or the usual assert APIs:

import assert from 'assert';

function add (a, b) {
    assert(!isNaN(a));
    assert.equal(typeof b, 'number');
    assert.ok(!isNaN(b));
    return a + b;
}

Related

See also preact-cli-power-assert.

Thanks

Many thanks to Jason Miller for creating ⚛️ Preact, much of the related ecosystem and lots of useful stuff.

Heavily inspired by preact-cli-lodash from Sara Vieira.

License

MIT

Package Sidebar

Install

npm i preact-cli-unassert

Weekly Downloads

5

Version

1.0.4

License

MIT

Last publish

Collaborators

  • marcodeltongo