UNPKG

poligloz

Version:

Poligloz is a library dedicated to translating text content from different languages.

16 lines (14 loc) 341 B
'use strict'; module.exports = function toCapitalizeText(text) { if(text.match(/[a-z]/ig).length >= 1){ text = text.toUpperCase(); } if(text.match(/[A-Z]/ig).length >= 1){ text = text.toUpperCase(); } if(text.match(/[a-zA-Z]+/ig).length >= 1){ text = text.toLowerCase(); } return text; }