aynen npm version

Compare camelized/dasherized/underscored strings each other

Install

npm install aynen
yarn add aynen

Usage

import aynen from 'aynen';

aynen('fooBar', 'foo-bar');
//=> true

aynen('foo_bar', 'FOO-BAR');
//=> true

aynen('foo_bar', 'foo bar');
//=> true

aynen('foo', 'bar');
//=> false

Options

Name: rating
Type: boolean
Default: false

Return a object with degree of similarity and comparation between two strings

import aynen from 'aynen';

aynen('fooBar', 'foo-bar', 
    { 
        rating: true
    }
);
//=> { isSame: true, similarityRating: 1 }

aynen('foo-bar', 'bar_FOO',
    { 
        rating: true
    }
);
//=> { isSame: false, similarityRating: 0.8 }

Related

GitHub

View Github