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"])
})
})
sorted-by
1.0.2 • Public • PublishedPackage Sidebar
Install
npm i sorted-by
Repository
Weekly Downloads
14
Version
1.0.2
License
ISC
Unpacked Size
2.8 kB
Total Files
7