0.9.2 • Published 4 years ago

monolite v0.9.2

Weekly downloads
516
License
MIT
Repository
-
Last release
4 years ago

Install

yarn add monolite

Babel Plugin

Monolite by default makes usage of ES2015 Proxy, which permits to transform accessor functions to accessor chains.

// Using accessor function
set(state, (_) => _.nested.prop, 42)

// Using accessor chain
set(state, ['nested', 'prop'], 42)

To target older runtimes, which do not support Proxy, a Babel plugin is available, doing these transformations statically, at compile-time.

Setup

yarn add --dev babel-plugin-monolite

In babel.config.js, simply add:

module.exports = (api) => {
  return {
    presets: [
      // ...
    ],
    plugins: ['babel-plugin-monolite'],
  }
}

Voilà, all your accessor functions will be transformed to accessor chains during transpilation.

TypeScript

The main motivation of this library is to preserve static-typing, type-inference and completion provided by TypeScript, which is not supported by Immutable.js when working on trees.

Monolite takes Plain-Old JavaScript Objects and returns Plain-Old JavaScript Objects. Accessors permit TypeScript to understand the types you're dealing with and to provide completion and linting as if you were working directly on these objects.

0.9.2

4 years ago

0.9.0

4 years ago

0.9.1

4 years ago

0.8.0

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.3

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.4.6

6 years ago

0.4.5

7 years ago

0.4.4

7 years ago

0.4.3

7 years ago

0.4.2

7 years ago

0.4.0

7 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago