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

Version Path
immosquare-cleaner-0.1.62 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.61 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.60 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.59 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.58 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.57 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.56 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.55 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.54 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.53 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.52 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.51 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.50 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.49 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.48 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.47 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.46 node_modules/jsx-ast-utils/lib/values/Literal.js
immosquare-cleaner-0.1.45 node_modules/jsx-ast-utils/lib/values/Literal.js
decidim-0.26.8 packages/eslint-config/node_modules/jsx-ast-utils/lib/values/Literal.js
govuk_publishing_components-18.0.0 node_modules/jsx-ast-utils/lib/values/Literal.js