Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsx-ast-utils

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsx-ast-utils - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

lib/values/expressions/ArrayExpression.js

20

__tests__/src/getPropLiteralValue-test.js

@@ -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 @@ ==================

15

lib/values/expressions/index.js

@@ -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 @@

5

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc