Sha256: 956bd052732392b7b2300ef23fccde912d75a2b7fd306a0679c7c2c7d5301d2e
Contents?: true
Size: 658 Bytes
Versions: 62
Compression:
Stored size: 658 Bytes
Contents
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = extractValueFromLiteral; /** * Extractor function for a Literal type value node. * * @param - value - AST Value object with type `Literal` * @returns { String|Boolean } - The extracted value converted to correct type. */ function extractValueFromLiteral(value) { var extractedValue = value.value; var normalizedStringValue = typeof extractedValue === 'string' && extractedValue.toLowerCase(); if (normalizedStringValue === 'true') { return true; } if (normalizedStringValue === 'false') { return false; } return extractedValue; }
Version data entries
62 entries across 62 versions & 3 rubygems