ramda-extension icon indicating copy to clipboard operation
ramda-extension copied to clipboard

sortByProp, sortByPath, sortByDotPath, sortByLens

Open tommmyy opened this issue 6 years ago • 0 comments

sortByProp("foo")([{ foo: 2 }, {  foo: -2 }]) 
// [{ foo: -2 }, {  foo: 2 }]

sortByPath(["foo", "bar"])([{ foo: { bar: 2 } }, {  foo: { bar: -2 } }]) 
// [{ foo: { bar: -2 } }, {  foo: { bar: 2 } }]
 
sortByDotPath("foo.bar")([{ foo: { bar: 2 } }, {  foo: { bar: -2 } }]) 
// [{ foo: { bar: -2 } }, {  foo: { bar: 2 } }]

sortByLens(lensPath(["foo", "bar"]))([{ foo: { bar: 2 } }, {  foo: { bar: -2 } }]) 
// [{ foo: { bar: -2 } }, {  foo: { bar: 2 } }]

tommmyy avatar Jun 29 '18 08:06 tommmyy