https://github.com/peopledoc/ember-cp-buffered-validations
ember-cp-validations + ember-buffered-proxy
https://github.com/peopledoc/ember-cp-buffered-validations
approved-public archived-marked-for-deletion ember ember-addon ghec-mig-migrated legacy tribe-js
Last synced: 2 months ago
JSON representation
ember-cp-validations + ember-buffered-proxy
- Host: GitHub
- URL: https://github.com/peopledoc/ember-cp-buffered-validations
- Owner: peopledoc
- License: mit
- Created: 2018-11-29T14:47:32.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-28T02:31:21.000Z (over 1 year ago)
- Last Synced: 2025-03-22T20:38:27.835Z (3 months ago)
- Topics: approved-public, archived-marked-for-deletion, ember, ember-addon, ghec-mig-migrated, legacy, tribe-js
- Language: JavaScript
- Homepage:
- Size: 686 KB
- Stars: 0
- Watchers: 37
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
ember-cp-buffered-validations
==============================================================================So far, using ember-cp-validations require to inject validations in the to-be-validated object.
This may be useful, but when working with DS.Model, it imposes a single validation abstraction.This addon proposes to:
* decouple the validator from the "validatee"
* Applies changes to a proxy object that will carry the validation model
* Keep using ember-cp-validations```js
export default DS.Model.extend(buildValidations(...), {
// ...
})//
// what we currently have
//
let model = this.store.findRecord('my-type', myId);
console.log(model.isValid)// or
export default Component.extend({
model: null // will be given at runtime
isEverythingOk: reads('model.isValid')
})//
// What we want
//function doYourMagic() {
this === ?
}let ThingValidations = buildValidations(...)
export default Component.extend({
model: null // will be given at runtime
validatedModel2: computed('thingTobeValidated', function () {
return doYourMagic(this, 'thingTobeValidated', ThingValidations) // <== a proxy with validations
})
})```
Installation
------------------------------------------------------------------------------```
ember install ember-cp-buffered-validations
```Usage
------------------------------------------------------------------------------[Longer description of how to use the addon in apps.]
Contributing
------------------------------------------------------------------------------### Installation
* `git clone `
* `cd ember-cp-buffered-validations`
* `yarn install`### Linting
* `yarn lint:hbs`
* `yarn lint:js`
* `yarn lint:js --fix`### Running tests
* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions### Running the dummy application
* `ember serve`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
License
------------------------------------------------------------------------------This project is licensed under the [MIT License](LICENSE.md).