Skip to content

Commit

Permalink
docs(readme)
Browse files Browse the repository at this point in the history
  • Loading branch information
FGRibreau committed Dec 28, 2015
1 parent d988eea commit ab05fe5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
match-when - Pattern matching for modern JavaScript
===================================================
### match-when - Pattern matching for modern JavaScript



Expand All @@ -8,7 +7,7 @@ There is a lot more to do but after some late work, that's all for tonight!

*\* well, of course, they are not keywords but simple functions*

### Usage
#### Usage

The setup is pretty simple, simply require the library with `match` and `when` and you are ready to go!

Expand Down Expand Up @@ -49,7 +48,7 @@ Clear and simple, note that `when()` is a catch-all pattern and should always be
// [ 'two', 'many', 'one', 'two' ]
```

#### arrays
##### Arrays


It also works with **arrays**:
Expand All @@ -65,7 +64,7 @@ function length(list){
length([1, 1, 1]); // 3
```

#### OR
##### OR

Sadly JavaScript does not offer us a way to overload operators so we're stuck with `when.or`:

Expand All @@ -81,11 +80,11 @@ function parseArgument(arg){
parseArgument(process.argv.slice(1)); // displayHelp || displayVersion || (binded)unknownArgument
```

#### AND
##### AND



### Supported patterns:
#### Supported patterns:

- `{ x1: pattern1, ..., xn: pattern }` - matches any object with property names `x1` to `xn` matching patterns `pattern1` to `pattern`, respectively. Only the own properties of the pattern are used.
- `when.or()`

0 comments on commit ab05fe5

Please sign in to comment.