{"name":"sort-on","version":"1.0.2","keywords":["sort","sorting","array","arr","by","obj","object","prop","property","dot","path","get"],"author":{"url":"sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"sort-on@1.0.2","homepage":"https://github.com/sindresorhus/sort-on","bugs":{"url":"https://github.com/sindresorhus/sort-on/issues"},"dist":{"shasum":"6873099bee6f53d39e24019fb96890848ef04335","tarball":"http://registry-npm.ywwl.com/sort-on/download/sort-on-1.0.2.tgz","integrity":"sha512-Yhj+UiryfgClTBwwrL+6VES+iAWGF1EOguaTlzBlhM+IMVtrE9WKDQ2RXYzDQu5qD7qUKI14jO3gfQC4vENKdQ==","signatures":[{"sig":"MEUCIAxPJYwdo0h2fpKxkUTMsX6hZ8P8F48itPToq+STRjo3AiEAv0OG5iiQkdTmPIQPRY947Y13RBvXcjm/yvfJ2zhapQU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":1188,"noattachment":false,"key":"/sort-on/-/sort-on-1.0.2.tgz"},"_from":".","files":["index.js"],"_shasum":"6873099bee6f53d39e24019fb96890848ef04335","engines":{"node":">=0.10.0"},"gitHead":"94684d7150cc3b11f4b0c06d952f0f1c3762c978","scripts":{"test":"node test.js"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"https://github.com/sindresorhus/sort-on","type":"git"},"_npmVersion":"1.4.28","description":"Sort an array on an object property","directories":{},"dependencies":{"dot-prop":"^1.0.0"},"devDependencies":{"ava":"0.0.4"},"readme":"# sort-on\n\n> Sort an array on an object property\n\n## Install\n\n```sh\nnpm install sort-on\n```\n\n## Usage\n\n```js\nimport sortOn from 'sort-on';\n\n// Sort by an object property\nsortOn([{x: 'b'}, {x: 'a'}, {x: 'c'}], 'x');\n//=> [{x: 'a'}, {x: 'b'}, {x: 'c'}]\n\n// Sort descending by an object property\nsortOn([{x: 'b'}, {x: 'a'}, {x: 'c'}], '-x');\n//=> [{x: 'c'}, {x: 'b'}, {x: 'a'}]\n\n// Sort by a nested object property\nsortOn([{x: {y: 'b'}}, {x: {y: 'a'}}], 'x.y');\n//=> [{x: {y: 'a'}}, {x: {y: 'b'}}]\n\n// Sort descending by a nested object property\nsortOn([{x: {y: 'b'}}, {x: {y: 'a'}}], '-x.y');\n//=> [{x: {y: 'b'}, {x: {y: 'a'}}}]\n\n// Sort by the `x` property, then `y`\nsortOn([{x: 'c', y: 'c'}, {x: 'b', y: 'a'}, {x: 'b', y: 'b'}], ['x', 'y']);\n//=> [{x: 'b', y: 'a'}, {x: 'b', y: 'b'}, {x: 'c', y: 'c'}]\n\n// Sort by the returned value\nsortOn([{x: 'b'}, {x: 'a'}, {x: 'c'}], element => element.x);\n//=> [{x: 'a'}, {x: 'b'}, {x: 'c'}]\n```\n\n## API\n\n### sortOn(array, property, options)\n\nReturns a new sorted version of the given array.\n\n#### array\n\nType: `unknown[]`\n\nThe array to sort.\n\n#### property\n\nType: `string | string[] | Function`\n\nThe string can be a [dot path](https://github.com/sindresorhus/dot-prop) to a nested object property.\n\nPrefix it with `-` to sort it in descending order.\n\n#### options\n\nType: `object`\n\n##### locales\n\nType: `string | string[]`\\\nDefault: The default locale of the JavaScript runtime.\n\nOne or more locales to use when sorting strings.\n\nShould be a locale string or array of locale strings that contain one or more language or locale tags.\n\nIf you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale.\n\nThis parameter must conform to BCP 47 standards. See [`Intl.Collator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator) for more details.\n\n##### localeOptions\n\nType: [`Intl.CollatorOptions`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#options)\n\nComparison options.\n","publish_time":1424402793775,"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_cnpm_publish_time":1424402793775,"dist-tags":{"latest":"7.0.0"}}