jsx-ast-utils
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -419,2 +419,22 @@ /* eslint-env mocha */ | ||
}); | ||
describe('Array expression', () => { | ||
it('should evaluate to correct representation of the the array in props', () => { | ||
const prop = extractProp('<div foo={["bar", 42, null]} />'); | ||
const expected = ['bar', 42]; | ||
const actual = getLiteralPropValue(prop); | ||
assert.deepEqual(expected, actual); | ||
}); | ||
}); | ||
it('should return an empty array provided an empty array in props', () => { | ||
const prop = extractProp('<div foo={[]} />'); | ||
const expected = []; | ||
const actual = getLiteralPropValue(prop); | ||
assert.deepEqual(expected, actual); | ||
}); | ||
}); |
@@ -772,2 +772,22 @@ /* eslint-env mocha */ | ||
}); | ||
describe('Array expression', () => { | ||
it('should evaluate to correct representation of the the array in props', () => { | ||
const prop = extractProp('<div foo={["bar", 42, null]} />'); | ||
const expected = ['bar', 42, null]; | ||
const actual = getPropValue(prop); | ||
assert.deepEqual(expected, actual); | ||
}); | ||
}); | ||
it('should return an empty array provided an empty array in props', () => { | ||
const prop = extractProp('<div foo={[]} />'); | ||
const expected = []; | ||
const actual = getPropValue(prop); | ||
assert.deepEqual(expected, actual); | ||
}); | ||
}); |
@@ -0,1 +1,6 @@ | ||
1.3.3 / 2016-10-28 | ||
================== | ||
- [fix] Add support for `ArrayExpression`. | ||
1.3.2 / 2016-10-11 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -77,2 +77,6 @@ 'use strict'; | ||
var _ArrayExpression = require('./ArrayExpression'); | ||
var _ArrayExpression2 = _interopRequireDefault(_ArrayExpression); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -98,3 +102,4 @@ | ||
NewExpression: _NewExpression2.default, | ||
UpdateExpression: _UpdateExpression2.default | ||
UpdateExpression: _UpdateExpression2.default, | ||
ArrayExpression: _ArrayExpression2.default | ||
}; | ||
@@ -137,3 +142,9 @@ | ||
ObjectExpression: noop, | ||
NewExpression: noop | ||
NewExpression: noop, | ||
ArrayExpression: function ArrayExpression(value) { | ||
var extractedVal = TYPES.ArrayExpression.call(undefined, value); | ||
return extractedVal.filter(function (val) { | ||
return val !== null; | ||
}); | ||
} | ||
}); | ||
@@ -140,0 +151,0 @@ |
{ | ||
"name": "jsx-ast-utils", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "AST utility module for statically analyzing JSX", | ||
@@ -13,3 +13,4 @@ "main": "lib/index.js", | ||
"pretest": "npm run lint", | ||
"test": "jest --coverage" | ||
"test": "jest --coverage", | ||
"test:watch": "npm test -- --watch" | ||
}, | ||
@@ -16,0 +17,0 @@ "devDependencies": { |
@@ -18,2 +18,3 @@ import assign from 'object-assign'; | ||
import UpdateExpression from './UpdateExpression'; | ||
import ArrayExpression from './ArrayExpression'; | ||
@@ -39,2 +40,3 @@ // Composition map of types to their extractor functions. | ||
UpdateExpression, | ||
ArrayExpression, | ||
}; | ||
@@ -76,2 +78,6 @@ | ||
NewExpression: noop, | ||
ArrayExpression: (value) => { | ||
const extractedVal = TYPES.ArrayExpression.call(undefined, value); | ||
return extractedVal.filter(val => val !== null); | ||
}, | ||
}); | ||
@@ -78,0 +84,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
230423
76
2801
0