Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ml-nearest-vector

Package Overview
Dependencies
Maintainers
7
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ml-nearest-vector - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

src/__tests__/test.ts

14

History.md

@@ -0,1 +1,15 @@

<a name="2.0.0"></a>
# [2.0.0](https://github.com/mljs/nearest-vector/compare/v1.0.1...v2.0.0) (2018-08-15)
* convert to typescript ([058976c](https://github.com/mljs/nearest-vector/commit/058976c))
### BREAKING CHANGES
* two functions are now exproted, one that returns the nearest vector's
index, the other the nearest vector itself
<a name="1.0.1"></a>

@@ -2,0 +16,0 @@ ## [1.0.1](https://github.com/mljs/nearest-vector/compare/v1.0.0...v1.0.1) (2016-10-20)

48

package.json
{
"name": "ml-nearest-vector",
"version": "1.0.1",
"version": "2.0.0",
"description": "Find the nearest point to a sample point",

@@ -11,9 +11,27 @@ "main": "./src/index.js",

"scripts": {
"eslint": "eslint src test",
"eslint-fix": "npm run eslint -- --fix",
"test": "npm run test-mocha && npm run eslint",
"test-cov": "istanbul cover node_modules/.bin/_mocha -- --require should --reporter dot --recursive",
"test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- --require should --reporter dot --recursive",
"test-mocha": "mocha --require should --reporter mocha-better-spec-reporter"
"clean": "rimraf lib lib-es6",
"prepublishOnly": "npm run tsc",
"test": "npm run test-only && npm run tslint",
"test-only": "jest",
"tsc": "npm run clean && npm run tsc-es5 && npm run tsc-es6",
"tsc-es5": "tsc",
"tsc-es6": "tsc --project tsconfig.es6.json",
"tslint": "tslint --project tsconfig.base.json",
"tslint-fix": "npm run tslint -- --fix"
},
"jest": {
"testEnvironment": "node",
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
},
"repository": {

@@ -41,13 +59,13 @@ "type": "git",

"devDependencies": {
"eslint": "^3.4.0",
"eslint-config-cheminfo": "^1.2.0",
"eslint-plugin-no-only-tests": "^1.1.0",
"istanbul": "^0.4.4",
"mocha": "^3.0.2",
"mocha-better-spec-reporter": "^3.0.2",
"should": "^11.1.0"
"@types/jest": "^23.3.1",
"jest": "^23.5.0",
"rimraf": "^2.6.2",
"ts-jest": "^23.1.3",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.14.0",
"typescript": "^3.0.1"
},
"dependencies": {
"ml-distance-euclidean": "^1.0.0"
"ml-distance-euclidean": "^2.0.0"
}
}
# nearest-vector
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![David deps][david-image]][david-url]
[![npm download][download-image]][download-url]
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![David deps][david-image]][david-url]
[![npm download][download-image]][download-url]
> Find the nearest point to a sample point

@@ -22,6 +22,12 @@

```js
import nearestVector, {findNearestVector} from 'ml-nearest-vector');
const nearestVector = require('ml-nearest-vector');
let centers = [[1, 2, 1], [-1, -1, -1]];
// returns the index of the nearest vector
nearestVector(centers, [1, 2, 1]) === 0;
// returns the nearest vector itself
findNearstVector(centers, [1, 2, 1]); // [1, 2, 1]
```

@@ -28,0 +34,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc