{"id":17298419,"url":"https://github.com/kamranayub/underscoreko","last_synced_at":"2025-04-14T11:12:12.411Z","repository":{"id":2708810,"uuid":"3702921","full_name":"kamranayub/UnderscoreKO","owner":"kamranayub","description":"A tiny library that adds all of the Underscore.js collection/array methods to Knockout observable arrays","archived":false,"fork":false,"pushed_at":"2017-06-24T18:44:08.000Z","size":1492,"stargazers_count":50,"open_issues_count":0,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-01T03:53:10.020Z","etag":null,"topics":["javascript","knockout","typescript","underscore"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kamranayub.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-13T03:32:04.000Z","updated_at":"2022-01-03T00:24:31.000Z","dependencies_parsed_at":"2022-08-30T20:01:05.019Z","dependency_job_id":null,"html_url":"https://github.com/kamranayub/UnderscoreKO","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamranayub%2FUnderscoreKO","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamranayub%2FUnderscoreKO/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamranayub%2FUnderscoreKO/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamranayub%2FUnderscoreKO/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kamranayub","download_url":"https://codeload.github.com/kamranayub/UnderscoreKO/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223629045,"owners_count":17176061,"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":["javascript","knockout","typescript","underscore"],"created_at":"2024-10-15T11:19:00.164Z","updated_at":"2024-11-08T04:02:45.253Z","avatar_url":"https://github.com/kamranayub.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UnderscoreKO\n\n[![npm](https://img.shields.io/npm/v/underscore-ko.svg)](https://github.com/kamranayub/UnderscoreKO) [![npm](https://img.shields.io/npm/dt/underscore-ko.svg)](https://github.com/kamranayub/UnderscoreKO) [![NuGet](https://img.shields.io/nuget/v/UnderscoreKO.svg)](https://github.com/kamranayub/UnderscoreKO) [![NuGet](https://img.shields.io/nuget/dt/UnderscoreKO.svg)](https://github.com/kamranayub/UnderscoreKO) [![Bower](https://img.shields.io/bower/v/underscore-ko.svg)](https://github.com/kamranayub/UnderscoreKO)\n\n## [Underscore.js](http://documentcloud.github.com/underscore/) + [Knockout](http://knockoutjs.com) = Array Happy Fun Time!\n\nThis tiny library (\u003c 1KB) adds all the collection and array methods you've come to love in Underscore.js to your Knockout observable arrays. It will not override any existing functionality (if any exists).\n\nLicensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)\n\n## Install\n\n### Manual\n\nDownload `.\\build\\underscore-ko.min.js` and put it in your project.\n\n### Nuget\n\nInstall the [UnderscoreKO](http://nuget.org/packages/UnderscoreKO) Nuget package.\n\n    PM\u003e Install-Package UnderscoreKO\n\n### bower\n\n    bower install underscore-ko\n    \n### npm ###\n\n    npm install underscore-ko\n\n## TypeScript Declarations\n\nUnderscoreKO ships with built-in TypeScript declarations, see `build\\underscore-ko.d.ts`.\n\n## Usage\n\nUse the Underscore methods just as you normally would, but now you don't need to specify the array to use:\n\n```js\nvar vm = {\n    arr: ko.observableArray([1, 2, 3]);\n};\n\nvm.arr.each(function (x) {\n    // do something\n});\n\n// This returns a raw array, not a ko.observableArray\nvar newArr = vm.arr.union([0, 1]);\n\n// but this will append 0 and 1 to the underlying array and trigger a change notification\nvm.arr.union_([0, 1]);\n```\n\nIn addition, there are several functions you can use that will mutate (change) the underlying array, which are provided as convenient shortcuts.\n\n```js\n// Re-structure the observable array [1, 2, 3]\nvm.arr.without_(2);\n// vm.arr() is now equal to [1, 3]\n\n// Without this, you would need to do:\nvm.arr(vm.arr.without(2));\n```\n\n## Live Demo ##\n\nView the [live jsFiddle demo](http://jsfiddle.net/kamranayub/exnqe/)\n\n## Documentation ##\n\nSee the [Underscore.js](http://underscorejs.org/) documentation for more information on the API. All array and collection methods are supported with the exception of any I felt didn't provide value (`.toArray()` for example).\n\nSee `spec.js` for examples of how to use specific functions, but I'm telling you, it's as you'd expect.\n\n### Mutator Methods\n\nThese methods change the underlying array *instead* of returning a copy of the array.\n\n* `filter_`, `select_`\n* `reject_`\n* `invoke_`\n* `sortBy_`\n* `groupBy_`\n* `shuffle_`\n* `rest_`, `tail_`\n* `compact_`\n* `flatten_`\n* `without_`\n* `union_`\n* `intersection_`\n* `difference_`\n* `uniq_`, `unique_`\n* `zip_`\n* `unzip_`\n\n## Contributing\n\nSee [Contributing](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamranayub%2Funderscoreko","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkamranayub%2Funderscoreko","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamranayub%2Funderscoreko/lists"}