-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi.
Thanks for this library.
I have a suggestion for an additional feature which I think will be useful.
Right now you have to pass in an array of arrays.
That means that if I have an object that contains a property for the "value" and another property for the "weight", I would have to transform it to that temporary array.
What if instead I could do this:
let input = [
{
somePropertyNameForValue: 100,
somePropertyNameForWeight: 2,
someOtherPropertyNotRelevant: 'Foo'
},
{
somePropertyNameForValue: 50,
somePropertyNameForWeight: 4,
someOtherPropertyNotRelevant: 'Bar'
},
{
somePropertyNameForValue: 25,
somePropertyNameForWeight: 1,
someOtherPropertyNotRelevant: 'Baz'
},
];
let mean = weightedMean(input, x => somePropertyNameForValue, x => x.somePropertyNameForWeight);Thanks!
Metadata
Metadata
Assignees
Labels
No labels