@neos-project/positional-array-sorter

Flexible array sorter that sorts an array according to a 'position' meta data.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
242160May 26, 2021Dec 5, 2015Minified + gzip package size for @neos-project/positional-array-sorter in KB

Readme

Flexible array sorter that sorts an array according to a "position" meta data.

The expected format for the subject is:

[
    [
        'key' => 'bar'
        'position' => '<position-string>',
    ],
    [
        'key' => 'baz'
        'position' => '<position-string>',
    ],
]

The supports one of the following syntax:

start (<weight>)
end (<weight>)
before <key> (<weight>)
after <key> (<weight>)
<numerical-order>

where "weight" is the priority that defines which of two conflicting positions overrules the other, "key" is a string that references another key in the subject and "numerical-order" is an integer that defines the order independently from the other keys.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.