Skip to content

Commit

Permalink
docs(readme): fix variable in code block and describe lint:dts
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Nov 7, 2019
1 parent 4b097d4 commit 2377cb0
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
Parses inline style to object:

```js
var parser = require('style-to-object');
parser('color: #C0FFEE; background: #BADA55;');
var parse = require('style-to-object');
parse('color: #C0FFEE; background: #BADA55;');
```

Output:
Expand Down Expand Up @@ -129,7 +129,7 @@ parse('color: #f00', function() {}); // null
But the function will iterate through each declaration:

```js
parser('color: #f00', function(name, value, declaration) {
parse('color: #f00', function(name, value, declaration) {
console.log(name); // 'color'
console.log(value); // '#f00'
console.log(declaration); // { type: 'declaration', property: 'color', value: '#f00' }
Expand All @@ -144,9 +144,11 @@ const style = `
background: blue;
`;
const output = [];

function iterator(name, value) {
output.push([name, value]);
}

parse(style, iterator);
console.log(output); // [['color', 'red'], ['background', 'blue']]
```
Expand All @@ -169,7 +171,9 @@ Run tests with coverage:

```sh
$ npm run test:coverage
# npm run test:coverage:report

# generate html report
$ npm run test:coverage:report
```

Lint files:
Expand All @@ -184,6 +188,12 @@ Fix lint errors:
$ npm run lint:fix
```

Test TypeScript declaration file for style and correctness:

```sh
$ npm run lint:dts
```

## Release

Only collaborators with credentials can release and publish:
Expand Down

0 comments on commit 2377cb0

Please sign in to comment.