Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ssv.state method #40

Merged
merged 1 commit into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ ssv.xor("mark tom", "travis tom") // "mark travis"
ssv.xor(" mark tom ", " matt tom ") // "mark matt"
ssv.xor(" mark tom tom", "mark mark") // "tom"
ssv.xor("mark mark", "tom tom") // "mark tom"

ssv.state({
"mark travis": true,
"matt": true,
"tom scott": false
}) // "mark travis matt"

ssv.state({
"mark": true,
"mark travis": true,
"travis": false
}) // "mark mark travis"
```

## API
Expand Down Expand Up @@ -88,6 +100,11 @@ ssv.xor("mark mark", "tom tom") // "mark tom"
- Split <var>SSV</var> into compact array of values
- `@return` array

### `ssv.state(state={})`
- Create compact SSV string from <var>state</var> object or string
- Useful for conditional classnames
- `@return` string

### `ssv.union(SSV, SSV2)`
- Get the union of 2 SSV strings (unique values present in either)
- `@return` string
Expand Down
Loading