Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

aynen

Compare camelized/dasherized/underscored strings each other

humanize, human, pretty, capitalize, uppercase, case, camelcase, dash, hyphen, underscore, string, text, convert, compare, string compare

readme

aynen

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 }