MCPcopy Create free account
hub / github.com/DavidWells/analytics / parse

Function parse

packages/analytics-util-storage/src/utils/parse.js:7–22  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

5 * @return {*} parsed input
6 */
7export default function parse(input) {
8 let value = input
9 try {
10 value = JSON.parse(input)
11 if (value === 'true') return true
12 if (value === 'false') return false
13 if (isObject(value)) return value
14 if (parseFloat(value) === value) {
15 value = parseFloat(value)
16 }
17 } catch (e) { }
18 if (value === null || value === "") {
19 return
20 }
21 return value
22}

Callers 3

getItemFunction · 0.50
setItemFunction · 0.50
parse.test.jsFile · 0.50

Calls 1

isObjectFunction · 0.85

Tested by

no test coverage detected