Socket
Socket
Sign inDemoInstall

css-to-react-native

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-to-react-native - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

dist/transforms/border.js

3

dist/tokenTypes.js

@@ -31,3 +31,4 @@ 'use strict';

var numberRe = /^([+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?)$/;
var lengthRe = /^([+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?)px$/;
// Note lengthRe is sneaky: you can omit units for 0
var lengthRe = /^(0$|(?:[+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?)(?=px$))/;
var angleRe = /^([+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?(?:deg|rad))$/;

@@ -34,0 +35,0 @@ var percentRe = /^([+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?%)$/;

@@ -39,3 +39,7 @@ 'use strict';

});
var borderColor = directionFactory({ type: 'word', prefix: 'border', suffix: 'Color' });
var borderColor = directionFactory({
types: [WORD],
prefix: 'border',
suffix: 'Color'
});
var borderRadius = directionFactory({

@@ -42,0 +46,0 @@ directions: ['TopRight', 'BottomRight', 'BottomLeft', 'TopLeft'],

@@ -5,2 +5,4 @@ 'use strict';

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var _require = require('../tokenTypes'),

@@ -15,3 +17,5 @@ tokens = _require.tokens;

module.exports.directionFactory = function (_ref) {
var _ref$directions = _ref.directions,
var _ref$types = _ref.types,
types = _ref$types === undefined ? [LENGTH, PERCENT] : _ref$types,
_ref$directions = _ref.directions,
directions = _ref$directions === undefined ? ['Top', 'Right', 'Bottom', 'Left'] : _ref$directions,

@@ -28,7 +32,7 @@ _ref$prefix = _ref.prefix,

// borderWidth doesn't currently allow a percent value, but may do in the future
values.push(tokenStream.expect(LENGTH, PERCENT));
values.push(tokenStream.expect.apply(tokenStream, _toConsumableArray(types)));
while (values.length < 4 && tokenStream.hasTokens()) {
tokenStream.expect(SPACE);
values.push(tokenStream.expect(LENGTH, PERCENT));
values.push(tokenStream.expect.apply(tokenStream, _toConsumableArray(types)));
}

@@ -35,0 +39,0 @@

{
"name": "css-to-react-native",
"version": "2.0.0",
"version": "2.0.1",
"description": "Convert CSS text to a React Native stylesheet object",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -64,2 +64,20 @@ /* global jest it, expect */

it('allows color values in transformed border-color values', () => runTest([
['border-color', 'red'],
], {
borderTopColor: 'red',
borderRightColor: 'red',
borderBottomColor: 'red',
borderLeftColor: 'red',
}));
it('allows omitting units for 0', () => runTest([
['margin', '10px 0'],
], {
marginTop: 10,
marginRight: 0,
marginBottom: 10,
marginLeft: 0,
}));
it('transforms strings', () => runTest([

@@ -66,0 +84,0 @@ ['color', 'red'],

@@ -29,3 +29,4 @@ const { stringify } = require('postcss-value-parser');

const numberRe = /^([+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?)$/;
const lengthRe = /^([+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?)px$/;
// Note lengthRe is sneaky: you can omit units for 0
const lengthRe = /^(0$|(?:[+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?)(?=px$))/;
const angleRe = /^([+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?(?:deg|rad))$/;

@@ -32,0 +33,0 @@ const percentRe = /^([+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?%)$/;

@@ -25,3 +25,7 @@ const { regExpToken, tokens } = require('../tokenTypes');

});
const borderColor = directionFactory({ type: 'word', prefix: 'border', suffix: 'Color' });
const borderColor = directionFactory({
types: [WORD],
prefix: 'border',
suffix: 'Color',
});
const borderRadius = directionFactory({

@@ -28,0 +32,0 @@ directions: ['TopRight', 'BottomRight', 'BottomLeft', 'TopLeft'],

@@ -6,2 +6,3 @@ const { tokens } = require('../tokenTypes');

module.exports.directionFactory = ({
types = [LENGTH, PERCENT],
directions = ['Top', 'Right', 'Bottom', 'Left'],

@@ -14,7 +15,7 @@ prefix = '',

// borderWidth doesn't currently allow a percent value, but may do in the future
values.push(tokenStream.expect(LENGTH, PERCENT));
values.push(tokenStream.expect(...types));
while (values.length < 4 && tokenStream.hasTokens()) {
tokenStream.expect(SPACE);
values.push(tokenStream.expect(LENGTH, PERCENT));
values.push(tokenStream.expect(...types));
}

@@ -21,0 +22,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