Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alsotang/sortobj

I can sort Object in JavaScript
https://github.com/alsotang/sortobj

Last synced: 13 days ago
JSON representation

I can sort Object in JavaScript

Awesome Lists containing this project

README

        

# sortobj

[![Build Status](https://travis-ci.org/alsotang/sortobj.png?branch=master)](https://travis-ci.org/alsotang/sortobj)

Convert Object to corresponding sorted-key Array.

## Installation

```shell
$ npm install sortobj
```

## Examples

```js
var sortobj = require('sortobj');

obj = {b: {z: 1, y: 2}, c: 3, a: 1};
arr = [['a', 1], ['b', [['y', 2], ['z', 1]]], ['c', 3]];
sortobj(obj).should.eql(arr);
```