I am trying to understand why the lodash orderBy function is ordering these in incorrectly. (incorrectly in my brain I suppose).
const data = [
{
id: '1',
name: 'FLUoxetine (FLUoxetine 20 mg oral capsule)'
},
{
id: '2',
name: 'ascorbic acid (Vitamin C 25 mg oral tablet, chewable)'
}
];
const orderedData = _.orderBy(data, ["name"], ["asc"]);
console.log("DATA>>>>", orderedData);
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.15/lodash.min.js"></script>
The above code is logging out
DATAZZZZ
[Object, Object]
0: Object
id: "1"
name: "FLUoxetine (FLUoxetine 20 mg oral capsule)"
1: Object
id: "2"
name: "ascorbic acid (Vitamin C 25 mg oral tablet, chewable)"
when I would think it would log out like so
DATAZZZZ
[Object, Object]
0: Object
id: "2"
name: "ascorbic acid (Vitamin C 25 mg oral tablet, chewable)"
1: Object
id: "1"
name: "FLUoxetine (FLUoxetine 20 mg oral capsule)"
Can anyone explain as to why? I am assuming it has to do with the first 3 letters being capitalized. I read the lodash documentation, but I either missed something or do not fully understand it. Any help would be awesome. Thanks!