ember-bp-cpv

1.0.4 • Public • Published

ember-bp-cpv

Build Status npm version Ember Observer Score

ember-bp-cpv is a small wrapper around ember-buffered-proxy that reduces the boilerplate of creating a validated buffer.

Why?

Because most of the time, you don't want to change the underlying model directly. Also because you don't want so much boilerplate.

ember install ember-bp-cpv

Usage

The intended usage is with ember-cp-validations (not included in this addon):

import Ember from 'ember';
import createBuffer from 'ember-bp-cpv';
import { validator, buildValidations } from 'ember-cp-validations';
 
const Validations = buildValidations({
  email: {
    validators: [
      validator('presence', true)
    ]
  }
});
 
export default Ember.Controller.extend({
  buffer: createBuffer('model', Validations)
});

Now in you have access to a validated buffer that you can use wherever you please.

You can also use the buffer without validations:

import Ember from 'ember';
import createBuffer from 'ember-bp-cpv';
 
export default Ember.Controller.extend({
  buffer: createBuffer('model')
});

Contributing

Any contribution, be it an issue, a feature or a bugfix is greatly appreciated ❤️

Also, if your feature or bugfix is tested, I will give you commit rights.

Credits / Inspiration

Package Sidebar

Install

npm i ember-bp-cpv

Weekly Downloads

3

Version

1.0.4

License

MIT

Last publish

Collaborators

  • shuriu