Skip to content

Commit

Permalink
fix(deps): add semantic release plugins;
Browse files Browse the repository at this point in the history
fix(readme): array.reduce is no more needed;
  • Loading branch information
xobotyi committed Feb 16, 2020
1 parent e5567f5 commit 62f987c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ It is written with power of [TypeScript](http://www.typescriptlang.org) and it's

As already said - API is the same with `classnames` pkg, and due to my laziness - i'll just copy-past their usage documentation (with small additions)😅😱

The `classNames` function takes any number of arguments which can be a string, array or object.
The `cnb` function takes any number of arguments which can be a string, array or object. Any other input will be ignored.
The argument `'foo'` is short for `{ foo: true }` or `['foo']`. If the value associated with a given key is falsy, that key won't be included in the output.

```js
Expand Down Expand Up @@ -103,7 +103,7 @@ cnb("a", arr); // => 'a b c'

- it does not generate useless spaces:
```javascript
classnames("test", [], { a: false }); // => "test " (4 chars with space at the end)
classnames("test", [], { a: false }); // => "test " (5 chars with space at the end)
cnb("test", [], { a: false }); // => "test" (just 4 chars)
```
- it skips fully numeric classnames, due to classnames starting with digit are illegal, but it **can't** skip strings starting with digit, cause it would impact the performance, so that part is left for the end developer
Expand All @@ -124,7 +124,6 @@ cnb({ [`btn-${buttonType}`]: true });
### Polyfills needed to support older browsers

`Array.isArray`: see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray) for details about unsupported older browsers (e.g. <= IE8) and a simple polyfill.
`Array.reduce`: see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) for details about unsupported older browsers (e.g. <= IE10) and a simple polyfill.

### Performance (recent benchmarks results)

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"license": "MIT",
"dependencies": {},
"devDependencies": {
"@semantic-release/changelog": "^3.0.6",
"@semantic-release/git": "^8.0.0",
"@semantic-release/npm": "^6.0.0",
"@types/jest": "^25.1.2",
"@xobotyi/eslint-config": "^1.3.1",
"@xobotyi/preset-typescript": "^1.0.0",
Expand Down

0 comments on commit 62f987c

Please sign in to comment.