Nuanced Pumpkin Mavens

    hamming

    0.0.2 • Public • Published

    hamming

    Calculate the Hamming distance between two strings.

    The Hamming distance measures the minimum number of substitutions required to change one string into the other of equal length.

    Demo

    https://lab.miguelmota.com/hamming

    Install

    npm install hamming

    Usage

    const hammingDistance = require('hamming');
     
    console.log(hammingDistance('foo', 'foo')); // 0
    console.log(hammingDistance('for', 'foo')); // 1
    console.log(hammingDistance('foobar', 'fudbaz')); // 3
    console.log(hammingDistance('unequal', 'length')); // null

    Hamming distance requires both strings to have the same length.

    Test

    npm test

    License

    MIT

    Install

    npm i hamming

    DownloadsWeekly Downloads

    360

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • miguelmota