sorted-by

1.0.2 • Public • Published
import {sortedByFunction} from "../index.mjs"

describe("sortedByFunction", () => {
  const peopleWithNames = [
    {
      name: () => "Kasper"
    },
    {
      name: () => "Christina"
    }
  ]

  it("sorts by function", () => {
    const sortedPeopleWithNames = sortedByFunction(peopleWithNames, "name")
    const sortedNames = sortedPeopleWithNames.map((person) => person.name())

    expect(sortedNames).toEqual(["Christina", "Kasper"])
  })
})

Readme

Keywords

Package Sidebar

Install

npm i sorted-by

Weekly Downloads

14

Version

1.0.2

License

ISC

Unpacked Size

2.8 kB

Total Files

7

Last publish

Collaborators

  • kaspernj