Strings.ensureUniq()

Make a unique, but still human-readable, version of a string vs. a set of existing strings by adding a number to the end.

Usage

Hover over inputs/exits for more info.

var Strings = require('machinepack-strings');


// Make a unique, but still human-readable, version of a string vs. a set of existing strings by adding a number to the end.

Strings.ensureUniq({

string: 'Siri',

existingStrings: [ 'Siri' ],

caseSensitive: false,

}).execSync();

Inputs

string required

The string to ensure the uniqueness of.

'Siri'
existingStrings required

The set of existing strings to check uniqueness against.

[ 'Siri' ]
caseSensitive

Whether or not the uniqueness check should be case-sensitive (care about uppercase vs. lowercase letters)

false

Exits

error

An unexpected error occurred.

success

OK.

'Siri2'