@salesflare/optimus

7.2.7 • Public • Published

Optimus

Greenkeeper badge

Transformer for Salesflare filter rules.

Available as a plain transform function, hapi 19 helper functions or client transformer.

The client build supports last 2 versions according to browserslist, see https://browserl.ist/?q=last+2+versions. The client build is transformed through Babel but does not come with polyfills, for that we recommend https://polyfill.io. This means we can use object spread in our transformer, which will be transformed, but something like Set you will have to polyfill yourself.

const Optimus = require('@salesflare/optimus');
const Hapi = require('@hapi/hapi');

const server = new Hapi.Server();

const transformedFilter = Optimus.transform(oldFilter); // plain

// in a route config
{
    ...,
    // this changes the rules in request.payload to the transformed rules
    pre: [Optimus.pre.transformInPlace('payload')],
    ...
}
<script src="./node_modules/@salesflare/optimus/dist/optimus.min.js"></script>
<script>
    var transformedFilter = Optimus.transform(oldFilter);
</script>

/@salesflare/optimus/

    Package Sidebar

    Install

    npm i @salesflare/optimus

    Weekly Downloads

    29

    Version

    7.2.7

    License

    MIT

    Unpacked Size

    52.2 kB

    Total Files

    7

    Last publish

    Collaborators

    • anthony.salesflare
    • lievenjanssen
    • jaspervdk
    • adrivanhoudt
    • kdeclerck