others/minkowski-distance

The Minkowski distance between two points gets generalized metric distance when p === 1, this becomes same as Manhattan Distance when p === 2, this becomes same as Euclidean Distance when p === Positive or Negative Infinity, this becomes chebyshev distance
Source:
Parameters:
Name Type Description
x Array source point
y Array target point
p Number order of Minkowski distance
Returns:
Type:
Number
distance between two points, if distance is NaN, then this returns 0
Example
var dist = require('path-to-algorithms/src/others/' +
'minkowski-distance').minkowskiDistance;
console.log(dist([0, 1], [1, 1], 2)); // 1