UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

24 lines (19 loc) 472 B
'use strict'; /*! * @techmely/utils * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com> * MIT Licensed */ // src/firstUniqueChar.ts function firstUniqueChar(value) { if (!value) return void 0; const charLength = value.length; for (let i = 0; i < charLength; i++) { const letter = value[i]; if (value.indexOf(letter) === value.lastIndexOf(letter)) return letter; } return void 0; } exports.firstUniqueChar = firstUniqueChar;