New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

mol_text_distance

Package Overview
Dependencies
Maintainers
1
Versions
1483
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mol_text_distance

Calculates the lexicographical distance between two texts.

latest
npmnpm
Version
0.0.1483
Version published
Maintainers
1
Created
Source

$mol_text_distance

Calculates the lexicographical distance between two texts.

Algorithm

  • A simple and fast.
  • Text profile based.
  • Normalized from 0 (equal) to 1 (different).
  • Rearrangement of words gives short distance.
  • Different texts length support.
  • Independent of changes position.
  • Complexity O(n).
  • Memory usage O(log n).
  • For equal length texts it's a metric.

Usage

// 0.18
$mol_text_distance(
	`little meerkat jumps over big elephant`,
	`over little elephant jumps big meerkat`,
)

// 0.66
$mol_text_distance(
	`A structural comparison of arbitrary objects is discussed.`,
	`Application of caching for correct comparison of cyclic references is disclosed.`,
)
const profile1 = $mol_text_profile( `profile` )
const profile2 = $mol_text_profile( `prodir` )
const distance = $mol_text_profile_distance( profile1, profile2 ) // 0.54

NPM Bundle

npm install mol_text_distance

1KB

import { $mol_text_distance } from 'mol_text_distance'

Keywords

$mol_text_distance

FAQs

Package last updated on 02 Apr 2026

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