UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

27 lines (24 loc) 489 B
/*! * @techmely/utils * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com> * MIT Licensed */ "use strict"; (() => { // src/fromString2Primitive.ts function fromStringToPrimitives(value) { if (typeof value !== "string") { return value; } if (value.match(/^[+-]?(?:\d*\.)?\d+$/)) { return Number(value); } if (value === "true") { return true; } if (value === "false") { return false; } return value; } })();