0.1.1 • Published 10 years ago

argminmax v0.1.1

Weekly downloads
2
License
-
Repository
github
Last release
10 years ago

argminmax.js

Often you have an array and you want to find, not the maximum or minimum element but its index (so that you can remove it later, use it in another array, etc.).

This tiny module supplies two functions that do just this.

The functions are added to the "underscore.js" package.

== EXAMPLE ==

var = require("underscore"); .mixin(require("argminmax"));

var array = "b","aa","ddd","cccc";

console.log(.argmin(array)) // 1 console.log(.argmin(array, function(x){return x.length})) // 0