UNPKG

@technobuddha/library

Version:
16 lines (15 loc) 464 B
import removeDiacritics from '../removeDiacritics'; import matchCase from '../matchCase'; /** * Determine the possessive form of a word * * @param input the word * @returns the posessive form of the word */ export function possessive(input) { const last = removeDiacritics(input[input.length - 1]); if (last === 's' || last === 'S') return matchCase(`${input}'`, input); return matchCase(`${input}'s`, input); } export default possessive;