Skip to content

Commit c18d158

Browse files
authored
Merge pull request #2 from kristerkari/bugfix/replace-for-of-with-for-in
Replace "for of" with "for in" to avoid needing Symbol
2 parents c586f8a + 54b3200 commit c18d158

File tree

4 files changed

+49
-3
lines changed

4 files changed

+49
-3
lines changed

.travis.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
language: node_js
2+
sudo: false
3+
git:
4+
depth: 1
5+
cache:
6+
directories:
7+
- $HOME/.npm
8+
- node_modules
9+
matrix:
10+
include:
11+
- node_js: '8'
12+
script: npm test
13+
env: CI=test
14+
- node_js: '6'
15+
script: npm test
16+
env: CI=tests 6
17+
- node_js: '4'
18+
script: npm test
19+
env: CI=tests 4
20+
sudo: required
21+
before_install:
22+
- npm install -g npm@latest

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# css-to-react-native-transform
22

3+
[![Build Status](https://travis-ci.org/kristerkari/css-to-react-native-transform.svg?branch=master)](https://travis-ci.org/kristerkari/css-to-react-native-transform)
4+
[![Build status](https://ci.appveyor.com/api/projects/status/75s8ls2m47by8b1x/branch/master?svg=true)](https://ci.appveyor.com/project/kristerkari/css-to-react-native-transform/branch/master)
5+
36
A lightweight wrapper on top of
47
[css-to-react-native](https://github.com/styled-components/css-to-react-native)
58
to allow valid CSS to be turned into React Native Stylesheet objects.

appveyor.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# http://www.appveyor.com/docs/appveyor-yml
2+
3+
environment:
4+
matrix:
5+
- nodejs_version: 5
6+
7+
version: "{build}"
8+
build: off
9+
deploy: off
10+
11+
install:
12+
- ps: Install-Product node $env:nodejs_version
13+
- npm install
14+
15+
test_script:
16+
- node --version
17+
- npm --version
18+
- cmd: "npm test"

src/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@ const transform = css => {
1616

1717
const result = {};
1818

19-
for (const rule of stylesheet.rules) {
20-
for (let selector of rule.selectors) {
19+
for (const r in stylesheet.rules) {
20+
const rule = stylesheet.rules[r];
21+
for (const s in rule.selectors) {
22+
let selector = rule.selectors[s];
2123
selector = selector.replace(/\.|#/g, "");
2224

2325
let styles;
2426

2527
styles = result[selector] = result[selector] || {};
2628

27-
for (const declaration of rule.declarations) {
29+
for (const d in rule.declarations) {
30+
const declaration = rule.declarations[d];
2831
if (declaration.type !== "declaration") continue;
2932

3033
const property = declaration.property;

0 commit comments

Comments
 (0)