Skip to content
🔦 because kodash was already taken.
JavaScript
Branch: master
Clone or download
Latest commit 2afa697 Oct 25, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist thin deps, refactor build Jun 17, 2016
src use ava and fix bug with non-chainable funcs that return undefined Jun 17, 2016
.eslintignore
.eslintrc remove codeclimate May 12, 2016
.gitignore use ava and fix bug with non-chainable funcs that return undefined Jun 17, 2016
.hound.yml
.npmignore thin deps, refactor build Jun 17, 2016
.travis.yml remove travis ff plugin Jun 17, 2016
README.md Update README.md Oct 25, 2017
bower.json
package.json chore(package): update ava to version 0.23.0 Oct 24, 2017
test.js
webpack.config.js thin deps, refactor build Jun 17, 2016

README.md

ko-projections

NPM WTFPL Travis Coverage Status Dependency Status Peer Dependency Status Greenkeeper badge NPM Downloads

Usage

const foos = ko.observableArray([
  { id: 1, text: 'foo' },
  { id: 2, text: 'bar' },
  { id: 3, text: 'baz' },
  { id: 4, text: 'qux' }
]).extend({
  _: true
})

const wantsOdds = ko.observable(true)

const flippedAndFilteredFoos = foos
  ._.map((foo) => {
    foo.text = foo.text.split('').reverse().join('')
    return foo
  })
  ._.filter((foo) =>
    foo.id % 2 === (wantsOdds() ? 1 : 0))

flippedAndFilteredFoos()
// { id: 1, text: 'oof' },
// { id: 3, text: 'zab' }

wantsOdds(false)

flippedAndFilteredFoos()
// { id: 2, text: 'rab' },
// { id: 4, text: 'xuq' }
You can’t perform that action at this time.