Socket
Book a DemoInstallSign in
Socket

metric

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metric

metric (distance) and other related functions

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

metric

Metric is a set of metric (distance) functions, along with assorted related functions such as similarity and preference functions, with a variety of interfaces.

Metric Functions

.rd1 (x,y)

.rd2 (x,y)

.similar (other,self)

other and self are floating point, returns 0 to 1, 1 being the most similar

.similarKey (other, self, key)

other and self are objects, executes similarityFn on the key

example:

john = { score: 24, name: "John Doe" };
bill = { score: 20, name: "Bill Smith" };

var sim = require('metric').similarityFnKey;

console.log(sim(john,bill,'score'));

>> 0.8 // 80% similar

FAQs

Package last updated on 15 Aug 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts