No description, website, or topics provided.
JavaScript HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
addon
app
config
tests
vendor
.bowerrc
.editorconfig
.ember-cli
.gitignore
.jshintrc
.npmignore
.travis.yml
.watchmanconfig
LICENSE.md
README.md
bower.json
ember-cli-build.js
index.js
package.json
testem.js

README.md

Ember-improved-cp

An addon to provide and experiment with different computed property patterns.

readOnly by default

In most cases, we likely actually want our computed properties to be readOnly. This was discussed for ember 2.0.0, but due to the potential upgrade pain it was decided against. In the future this may be reconsidered, but in the interim we can still benefit from this convention.

Today, we can easily mark any computed property as readOnly, but wouldn't it be nicer if it was the default?

You're in luck, simply import your computed properties and computed macros from the ember-improved-cp/read-only module, and you live in a readOnly by default world.

import computed, {
  readOnly
  empty
  notEmpty
  none
  not
  bool
  match
  equal
  gt
  gte
  lt
  lte
  and
  or
  any
  sum
  min
  max
  map
  sort
  setDiff
  mapBy
  filter
  filterBy
  uniq
  uniqBy
  union
  intersect
  collect
} from 'ember-improved-cp/read-only'

One example is providing defaults to components via attributes.

{{blog-component author=user.name}}
import Ember from 'ember';
import { or } from 'ember-improved-cp/read-only';

export default Ember.Component.extend({
  _defaultName: 'Anonymous Coward',
  _name: or('author', '_defaultName')
})

Installation

  • git clone <repository-url> this repository
  • cd ember-improved-cp
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://ember-cli.com/.