{"_id":"sort-by-value","_rev":"83452","name":"sort-by-value","description":"Re-order the objects in an array so that values of a specified property match the order of a provided array of values.","dist-tags":{"latest":"0.1.0"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:26:33.000Z","created":"2017-04-27T04:05:05.753Z","0.1.0":"2017-04-27T04:05:05.753Z"},"users":{},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/sort-by-value.git"},"versions":{"0.1.0":{"name":"sort-by-value","description":"Re-order the objects in an array so that values of a specified property match the order of a provided array of values.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/sort-by-value","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/sort-by-value.git"},"bugs":{"url":"https://github.com/jonschlinkert/sort-by-value/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=4"},"scripts":{"test":"mocha"},"keywords":["by","generategenerator","sort","value"],"dependencies":{"extend-shallow":"^2.0.1","isobject":"^3.0.0"},"devDependencies":{"gulp-format-md":"^0.1.12","mocha":"^3.3.0"},"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true}},"gitHead":"e3ba2adb16e5efd28396f97367e19ed4913f74a6","_id":"sort-by-value@0.1.0","_shasum":"d07598927d43d425e51ffa3f6c0b91b708576ba7","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.7.3","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"d07598927d43d425e51ffa3f6c0b91b708576ba7","size":2798,"noattachment":false,"key":"/sort-by-value/-/sort-by-value-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sort-by-value/download/sort-by-value-0.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sort-by-value-0.1.0.tgz_1493265903839_0.6715725215617567"},"directories":{},"publish_time":1493265905753,"_hasShrinkwrap":false,"_cnpm_publish_time":1493265905753}},"readme":"# sort-by-value [![NPM version](https://img.shields.io/npm/v/sort-by-value.svg?style=flat)](https://www.npmjs.com/package/sort-by-value) [![NPM monthly downloads](https://img.shields.io/npm/dm/sort-by-value.svg?style=flat)](https://npmjs.org/package/sort-by-value)  [![NPM total downloads](https://img.shields.io/npm/dt/sort-by-value.svg?style=flat)](https://npmjs.org/package/sort-by-value) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/sort-by-value.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/sort-by-value)\n\n> Re-order the objects in an array so that values of a specified property match the order of a provided array of values.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save sort-by-value\n```\n\nInstall with [yarn](https://yarnpkg.com):\n\n```sh\n$ yarn add sort-by-value\n```\n\n## Usage\n\n```js\nvar sortBy = require('sort-by-value');\nsortBy(array, {\n  prop: 'foo', // the property name to sort by\n  values: ['a', 'b', 'c'] // the property values to sort by\n});\n```\n\n## Example\n\n```js\nvar arr = [\n  {title: 'Foo'},\n  {title: 'Baz'},\n  {title: 'Bar'},\n  {title: 'Qux'},\n  {title: 'Faz'},\n  {title: 'Fez'}\n];\n\nvar res = sortBy(arr, {\n  prop: 'title',\n  values: ['Faz', 'Qux', 'Bar'],\n  normalize: function(val) {\n    return val;\n  }\n});\n\nconsole.log(res);\n// [ { title: 'Faz' },\n//   { title: 'Qux' },\n//   { title: 'Bar' },\n//   { title: 'Foo' },\n//   { title: 'Baz' },\n//   { title: 'Fez' } ]\n```\n\n## About\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\nPlease read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on April 27, 2017._","_attachments":{},"homepage":"https://github.com/jonschlinkert/sort-by-value","bugs":{"url":"https://github.com/jonschlinkert/sort-by-value/issues"},"license":"MIT"}