Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sort-keys-recursive

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sort-keys-recursive - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

16

CHANGELOG.md

@@ -0,1 +1,17 @@

<a name="2.0.1"></a>
## 2.0.1 (2017-07-18)
* Fix interface ([883ae34](https://github.com/kikobeats/sort-keys-recursive/commit/883ae34))
* Fix linter ([81b0cd3](https://github.com/kikobeats/sort-keys-recursive/commit/81b0cd3))
* Fix linter ([1792395](https://github.com/kikobeats/sort-keys-recursive/commit/1792395))
* Little Refactor ([0a40c2c](https://github.com/kikobeats/sort-keys-recursive/commit/0a40c2c))
* Update README.md ([f986868](https://github.com/kikobeats/sort-keys-recursive/commit/f986868))
* Update travis builds ([0a949fe](https://github.com/kikobeats/sort-keys-recursive/commit/0a949fe))
* docs(readme): add Greenkeeper badge ([14b62b8](https://github.com/kikobeats/sort-keys-recursive/commit/14b62b8))
* chore(package): update dependencies ([2dcdb49](https://github.com/kikobeats/sort-keys-recursive/commit/2dcdb49))
* chore(package): update kind-of to version 3.2.2 ([39b9d7f](https://github.com/kikobeats/sort-keys-recursive/commit/39b9d7f))
* chore(package): update kind-of to version 4.0.0 ([4cedab2](https://github.com/kikobeats/sort-keys-recursive/commit/4cedab2))
<a name="2.0.0"></a>

@@ -2,0 +18,0 @@ # 2.0.0 (2017-02-26)

50

index.js
'use strict'
var sortKeys = require('sort-keys')
var kindOf = require('kind-of')
const sortKeys = require('sort-keys')
const kindOf = require('kind-of')
function inArray (value, arr) {
if (!arr || kindOf(arr) !== 'array') return false
const inArray = (value, arr) => (
!arr || kindOf(arr) !== 'array'
? false
: arr.indexOf(value) > -1
)
return arr.indexOf(value) > -1
}
const sortObjectKeys = (obj, compare) => sortKeys(obj, {compare})
function sortObjectKeys (obj, compare) {
return sortKeys(obj, compare)
}
function sortArray (arr, options) {
const compareFunction = options && options.compareFunction
const sortArray = (arr, opts) => {
const compareFunction = opts && opts.compareFunction
return arr.slice().sort(compareFunction)
}
function sortObject (obj, options) {
const compareFunction = options && options.compareFunction
var result = sortObjectKeys(obj, compareFunction)
function sortObject (obj, opts) {
const compareFunction = opts && opts.compareFunction
const result = sortObjectKeys(obj, compareFunction)
Object.keys(obj).forEach(function (key) {
var current = result[key]
var type = kindOf(current)
const current = result[key]
const type = kindOf(current)
if (type === 'object') {
if (!options || !inArray(key, options.ignoreObjectAtKeys)) {
result[key] = sortObject(current, options)
if (!opts || !inArray(key, opts.ignoreObjectAtKeys)) {
result[key] = sortObject(current, opts)
}

@@ -38,6 +35,5 @@ return

if (type === 'array') {
if (!options || !inArray(key, options.ignoreArrayAtKeys)) {
result[key] = sortArray(current, options)
if (!opts || !inArray(key, opts.ignoreArrayAtKeys)) {
result[key] = sortArray(current, opts)
}
return
}

@@ -49,7 +45,5 @@ })

function sort (something, opts) {
var type = kindOf(something)
if (sort[type]) return sort[type](something, opts)
return something
const sort = (something, opts) => {
const type = kindOf(something)
return sort[type] ? sort[type](something, opts) : something
}

@@ -56,0 +50,0 @@

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/Kikobeats/sort-keys-recursive",
"version": "2.0.0",
"version": "2.0.1",
"main": "./index.js",

@@ -34,4 +34,4 @@ "author": {

"dependencies": {
"kind-of": "~3.1.0",
"sort-keys": "~1.1.2"
"kind-of": "~5.0.0",
"sort-keys": "~2.0.0"
},

@@ -55,5 +55,5 @@ "devDependencies": {

"pretest": "npm run lint",
"test": "nyc ava"
"test": "nyc ava --verbose"
},
"license": "MIT"
}

@@ -47,3 +47,2 @@ # sort-keys-recursive

// };
```

@@ -122,3 +121,2 @@

// }
```

@@ -162,3 +160,2 @@

// }
```

@@ -165,0 +162,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc