Use any of the ways below to import
import sortObjectList from 'sort-object-list'
var sortObjectList = require('sort-object-list/es5').default
<script type="text/javascript" src="@node_modules/sort-object-list/es5/index.js"></script>
import sortObjectList from 'sort-object-list'
sortObjectList(
[ 'B', 2, null, 1, undefined ],
{ sortBy: 'key' }
)
// [ 'B', 2, null, 1, undefined ]
sortObjectList(
[ { key: 2 }, { key: 1 }, { key: 100 }, { key: 0 } ],
{ sortBy: 'key', isDecreasing: true }
)
// [ { key: 100 }, { key: 2 }, { key: 1 }, { key: 0 } ]
sortObjectList(
[ { key: 'Z' }, { key: 'G' }, { key: 'B' }, { key: 'A' } ],
{ sortBy: 'key' }
)
// [ { key: 'A' }, { key: 'B' }, { key: 'G' }, { key: 'Z' } ]
sortObjectList(
[
{ key: { something: 3 } },
{ key: { something: 1 } },
{ key: { something: 4 } },
{ key: { something: 0 } },
],
{ sortBy(object) { return object.key.something } }
)
// [
// { key: { something: 0 } },
// { key: { something: 1 } },
// { key: { something: 3 } },
// { key: { something: 4 } },
// ]
import { Sorter } from 'sort-object-list/react-native'
<Sorter style={{...}}>
<Text order={3}>B</Text>
<Text order={0}>A</Text>
<Text>C</Text>
</Sorter>