{"id":13804222,"url":"https://github.com/profiscience/ko-projections","last_synced_at":"2025-05-13T17:31:39.175Z","repository":{"id":58241260,"uuid":"57356073","full_name":"Profiscience/ko-projections","owner":"Profiscience","description":":flashlight: because kodash was already taken.","archived":true,"fork":false,"pushed_at":"2021-12-28T17:17:32.000Z","size":162,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-02T06:07:41.462Z","etag":null,"topics":["functional","knockoutjs","lodash","underscore"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Profiscience.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-29T05:07:12.000Z","updated_at":"2023-12-05T06:33:44.000Z","dependencies_parsed_at":"2022-08-31T00:40:37.429Z","dependency_job_id":null,"html_url":"https://github.com/Profiscience/ko-projections","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Profiscience%2Fko-projections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Profiscience%2Fko-projections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Profiscience%2Fko-projections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Profiscience%2Fko-projections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Profiscience","download_url":"https://codeload.github.com/Profiscience/ko-projections/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253993060,"owners_count":21996225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["functional","knockoutjs","lodash","underscore"],"created_at":"2024-08-04T01:00:44.029Z","updated_at":"2025-05-13T17:31:38.894Z","avatar_url":"https://github.com/Profiscience.png","language":"JavaScript","readme":"# ko-projections\n\n[![NPM](https://img.shields.io/npm/v/ko-projections.svg)](https://www.npmjs.com/package/ko-projections)\n![WTFPL](https://img.shields.io/npm/l/ko-projections.svg)\n[![Travis](https://img.shields.io/travis/Profiscience/ko-projections.svg)](https://travis-ci.org/Profiscience/ko-projections)\n[![Coverage Status](https://coveralls.io/repos/github/Profiscience/ko-projections/badge.svg?branch=master)](https://coveralls.io/github/Profiscience/ko-projections?branch=master)\n[![Dependency Status](https://img.shields.io/david/Profiscience/ko-projections.svg)](https://david-dm.org/Profiscience/ko-projections)\n[![Peer Dependency Status](https://img.shields.io/david/peer/Profiscience/ko-projections.svg?maxAge=2592000)](https://david-dm.org/Profiscience/ko-projections#info=peerDependencies\u0026view=table)\n[![Greenkeeper badge](https://badges.greenkeeper.io/Profiscience/ko-projections.svg)](https://greenkeeper.io/)\n[![NPM Downloads](https://img.shields.io/npm/dt/ko-projections.svg?maxAge=2592000)](http://npm-stat.com/charts.html?package=ko-projections\u0026author=\u0026from=\u0026to=)\n\n\u003e NOTICE: This repo is deprecated. Prefer the following pattern.\n\u003e\n\u003e ```typescript\n\u003e import { flow } from 'lodash'\n\u003e import { map, filter } from 'lodash/fp'\n\u003e import ko from 'knockout'\n\u003e\n\u003e const flippedAndFilteredFoos = ko.pureComputed(() =\u003e flow(\n\u003e   map((foo) =\u003e {\n\u003e     foo.text = foo.text.split('').reverse().join('')\n\u003e     return foo\n\u003e   }),\n\u003e   filter((foo) =\u003e foo.id % 2 === (wantsOdds() ? 1 : 0))\n\u003e )(foos))\n\u003e ```\n\n#### Usage\n\n```javascript\nconst foos = ko.observableArray([\n  { id: 1, text: 'foo' },\n  { id: 2, text: 'bar' },\n  { id: 3, text: 'baz' },\n  { id: 4, text: 'qux' }\n]).extend({\n  _: true\n})\n\nconst wantsOdds = ko.observable(true)\n\nconst flippedAndFilteredFoos = foos\n  ._.map((foo) =\u003e {\n    foo.text = foo.text.split('').reverse().join('')\n    return foo\n  })\n  ._.filter((foo) =\u003e\n    foo.id % 2 === (wantsOdds() ? 1 : 0))\n\nflippedAndFilteredFoos()\n// { id: 1, text: 'oof' },\n// { id: 3, text: 'zab' }\n\nwantsOdds(false)\n\nflippedAndFilteredFoos()\n// { id: 2, text: 'rab' },\n// { id: 4, text: 'xuq' }\n```\n","funding_links":[],"categories":["Plugins and libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprofiscience%2Fko-projections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprofiscience%2Fko-projections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprofiscience%2Fko-projections/lists"}