v3.0
sylvainpolletvillard
released this
29 Jun 18:11
·
415 commits
to master
since this release
New features in v3
- ES6 Proxies are used everywhere instead of ES5 property getters
- New models: Map models and Set models
- A custom devtool formatter in Chrome
sealed
mode for object models to prevent undeclared properties- usable as ES Module:
import { ObjectModel } from "objectmodel"
to enable tree shaking
Breaking changes in v3
- since v3 relies on ES6 Proxies, it is only usable on modern browsers: Edge 14+ / Firefox 47+ / Chrome 50+ / Node 6+
- All the possible operations on objects, including special ones like
delete
,defineProperty
orObject.keys
, are now checked against the model definition. Consequently, new type errors could be found after upgrading. Model.conventionForPrivate
andModel.conventionForConstant
have been moved toModel.prototype
so that you can change these conventions specifically by model- Private properties are now private for real: you cannot use them outside of the model's own methods
Notes
This is almost a full rewrite of the library that I have been working on for over a year. ObjectModel is now written in ES6, has solid unit testing with over 400 assertions, and overall has much better mechanics to validate and cast your models. Enjoy !