<commit_before># distance-calc
A JS module for calculating several distances between two (n-dimensional) points
[![Build Status](https://travis-ci.org/pataiadam/distance-calc.svg?branch=master)](https://travis-ci.org/pataiadam/distance-calc)
[![NPM](https://nodei.co/npm/distance-calc.png)](https://npmjs.org/package/distance-calc)

## Installation

```
  npm install distance-calc --save
```

## Usage

### p-norm
```
  var d = require('distance-calc');
  var vector1 = [1, 2, 3, 4];
  var vector2 = [3, 2, 1, 0];

  // to get Euclidean length or size of vectors
  d.norm(vector1);
  d.norm(vector1, 2);

  //p-norm
  d.norm(vector1, 42);
  d.norm(vector1, Number.POSITIVE_INFINITY);
  d.norm(vector1, 'inf');

  //Euclidean distance between two points
  d.norm(vector1, vector2);

  //p-norm dist. between two points
  d.norm(vector1, vector2, 42);

  //different dimensional
  var a2dVector = [5, 5];
  var a4dVector = [5, 5, 0, 0];
  var isEqual = d.norm(a2dVector, vector1) == d.norm(a4dVector, vector1); //true
   isEqual = d.norm(vector1, a2dVector) == d.norm(vector1, a4dVector); //true
```
## Tests
```
  npm test
```
## Release History

* 0.1.0 Initial release<commit_msg>Add npm version badge to readme<commit_after># distance-calc
A JS module for calculating several distances between two (n-dimensional) points
<p align="center">
    <a href="https://npmjs.org/package/distance-calc">
        <img src="https://badge.fury.io/js/distance-calc.svg"
             alt="npm version">
    </a>
    <a href="https://travis-ci.org/badges/distance-calc">
        <img src="https://travis-ci.org/pataiadam/distance-calc.svg?branch=master"
             alt="build status">
    </a>
</p>

[![NPM](https://nodei.co/npm/distance-calc.png)](https://npmjs.org/package/distance-calc)

## Installation

```
  npm install distance-calc --save
```

## Usage

### p-norm
```
  var d = require('distance-calc');
  var vector1 = [1, 2, 3, 4];
  var vector2 = [3, 2, 1, 0];

  // to get Euclidean length or size of vectors
  d.norm(vector1);
  d.norm(vector1, 2);

  //p-norm
  d.norm(vector1, 42);
  d.norm(vector1, Number.POSITIVE_INFINITY);
  d.norm(vector1, 'inf');

  //Euclidean distance between two points
  d.norm(vector1, vector2);

  //p-norm dist. between two points
  d.norm(vector1, vector2, 42);

  //different dimensional
  var a2dVector = [5, 5];
  var a4dVector = [5, 5, 0, 0];
  var isEqual = d.norm(a2dVector, vector1) == d.norm(a4dVector, vector1); //true
   isEqual = d.norm(vector1, a2dVector) == d.norm(vector1, a4dVector); //true
```
## Tests
```
  npm test
```
## Release History

* 0.1.0 Initial release
{'fraction_non_alphanumeric': 0.1768525592055004, 'fraction_numerical': 0.03284950343773873, 'mean_word_length': 3.476923076923077, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2783311', 'n_tokens_mistral': 1048, 'n_tokens_neox': 958, 'n_words': 227}