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 1.1.1 to 1.2.0

.nyc_output/07871c9dc9bbad79012940bc2208051b.json

52

index.js

@@ -1,10 +0,44 @@

'use strict';
require('coffee-script/register');
var typeOf = require('fn-typeof');
var sort = require('./lib/SortRecursive');
'use strict'
module.exports = function(something, compareFn) {
var type = typeOf(something);
if (sort[type]) return sort[type](something, compareFn);
return something;
};
var sortKeys = require('sort-keys')
var kindOf = require('kind-of')
function sortObjectKeys (obj, compare) {
return sortKeys(obj, compare)
}
function sortArray (arr, compare) {
return arr.slice().sort(compare)
}
function sortObject (obj, compare) {
var result = sortObjectKeys(obj, compare)
Object.keys(obj).forEach(function (key) {
var current = result[key]
var type = kindOf(current)
if (type === 'object') {
result[key] = sortObject(current, compare)
return
}
if (type === 'array') {
result[key] = sortArray(current)
return
}
})
return result
}
function sort (something, compareFn) {
var type = kindOf(something)
if (sort[type]) return sort[type](something, compareFn)
return something
}
sort.array = sortArray
sort.object = sortObject
module.exports = sort

41

package.json

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

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

@@ -13,3 +13,6 @@ "author": {

},
"repository": "Kikobeats/sort-keys-recursive",
"repository": {
"type": "git",
"url": "git+https://github.com/kikobeats/sort-keys-recursive.git"
},
"bugs": {

@@ -19,2 +22,5 @@ "url": "https://github.com/Kikobeats/sort-keys-recursive/issues"

"keywords": [
"array",
"deep",
"deterministic",
"key",

@@ -25,28 +31,27 @@ "keys",

"recursive",
"sort"
"recursively",
"sort",
"stable"
],
"dependencies": {
"fn-typeof": "*",
"sort-keys": "*"
"kind-of": "~3.1.0",
"sort-keys": "~1.1.2"
},
"devDependencies": {
"browserify": "*",
"coffee-script": "*",
"coffeeify": "*",
"gulp": "*",
"gulp-header": "*",
"gulp-uglify": "*",
"gulp-util": "*",
"mocha": "*",
"should": "*",
"vinyl-buffer": "*",
"vinyl-source-stream": "*"
"ava": "latest",
"coveralls": "latest",
"nyc": "latest",
"standard": "latest",
"standard-markdown": "latest"
},
"engines": {
"node": "*"
"node": ">=4"
},
"scripts": {
"test": "sh test/test.sh"
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"lint": "standard-markdown && standard",
"pretest": "npm run lint",
"test": "nyc ava"
},
"license": "MIT"
}
# sort-keys-recursive
[![Build Status](http://img.shields.io/travis/Kikobeats/sort-keys-recursive/master.svg?style=flat)](https://travis-ci.org/Kikobeats/sort-keys-recursive)
[![Dependency status](http://img.shields.io/david/Kikobeats/sort-keys-recursive.svg?style=flat)](https://david-dm.org/Kikobeats/sort-keys-recursive)
[![Dev Dependencies Status](http://img.shields.io/david/dev/Kikobeats/sort-keys-recursive.svg?style=flat)](https://david-dm.org/Kikobeats/sort-keys-recursive#info=devDependencies)
[![NPM Status](http://img.shields.io/npm/dm/sort-keys-recursive.svg?style=flat)](https://www.npmjs.org/package/sort-keys-recursive)
[![Gittip](http://img.shields.io/gittip/Kikobeats.svg?style=flat)](https://www.gittip.com/Kikobeats/)
![Last version](https://img.shields.io/github/tag/Kikobeats/sort-keys-recursive.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/Kikobeats/sort-keys-recursive/master.svg?style=flat-square)](https://travis-ci.org/Kikobeats/sort-keys-recursive)
[![Coverage Status](https://img.shields.io/coveralls/Kikobeats/sort-keys-recursive.svg?style=flat-square)](https://coveralls.io/github/Kikobeats/sort-keys-recursive)
[![Dependency status](https://img.shields.io/david/Kikobeats/sort-keys-recursive.svg?style=flat-square)](https://david-dm.org/Kikobeats/sort-keys-recursive)
[![Dev Dependencies Status](https://img.shields.io/david/dev/Kikobeats/sort-keys-recursive.svg?style=flat-square)](https://david-dm.org/Kikobeats/sort-keys-recursive#info=devDependencies)
[![NPM Status](https://img.shields.io/npm/dm/str-match.svg?style=flat-square)](https://www.npmjs.org/package/str-match)
[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square)](https://paypal.me/Kikobeats)

@@ -22,13 +24,6 @@ > Sort the keys of an object recursively

```
and later link in your HTML:
```html
<script src="bower_components/sort-keys-recursive/dist/sort-keys-recursive.js"></script>
```
## Usage
```js
recursive = require('sort-keys-recursive');
var sort = require('sort-keys-recursive')

@@ -43,6 +38,8 @@ var object = {

b: 0
};
}
console.log(recursive(object));
var output = sort(object)
console.log(output)
// {

@@ -63,3 +60,1 @@ // a: {

MIT © [Kiko Beats](http://www.kikobeats.com)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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