@neos-project/positional-array-sorter

9.0.0-beta8 • Public • Published

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.

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i @neos-project/positional-array-sorter

    Weekly Downloads

    408

    Version

    9.0.0-beta8

    License

    GNU GPLv3

    Unpacked Size

    45.5 kB

    Total Files

    6

    Last publish

    Collaborators

    • neos-project