Skip to content

Commit

Permalink
reorders readme
Browse files Browse the repository at this point in the history
  • Loading branch information
krambuhl committed Feb 8, 2016
1 parent 75ec01c commit e0b4a46
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
41 changes: 23 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ ___as___

String. Defines the local variable for accessing each element in `data`. Defaults to `@item`.

## If
## Defined

Returns it's children if `data` to `value` are equal. If the `<Else />` branch is defined, it will be returned when `data` and `value` are not equal.
Returns children if `data` is an non-empty Array or Object (`[0, 1]`, `{x:1,y:3}`) or defined variable. If the `<Else />` branch is defined, it will be returned when `data` is empty or undefined.

```html
<If data={loggedIn} value="true"><Dashboard /></If>
<Defined data={searchResults}><Results /></Defined>
```

__Attributes__
Expand All @@ -37,16 +37,12 @@ ___data___

Variable or Expression.

___value___

Variable or Expression.

## Unless
## Empty

Returns it's children if `data` to `value` are __not__ equal. If the `<Else />` branch is defined, it will be returned when `data` and `value` are equal.
Returns children if `data` is an empty Array or Object (`[]`, `{}`) or undefined variable. If the `<Else />` branch is defined, it will be returned when `data` is non-empty and defined.

```html
<Unless data={loggedIn} value="true"><LoginForm /></Unless>
<Empty data={searchResults}>No results.</Empty>
```

__Attributes__
Expand All @@ -55,16 +51,15 @@ ___data___

Variable or Expression.

___value___

Variable or Expression.
## If

## Defined
Returns it's children if `data` to `value` are equal. If the `<Else />` branch is defined, it will be returned when `data` and `value` are not equal.

Returns children if `data` is an non-empty Array or Object (`[0, 1]`, `{x:1,y:3}`) or defined variable. If the `<Else />` branch is defined, it will be returned when `data` is empty or undefined.
If `value` is not defined, `Unless` will have the same behavior as `Defined`.

```html
<Defined data={searchResults}><Results /></Defined>
<If data={loggedIn} value="true"><Dashboard /></If>
```

__Attributes__
Expand All @@ -73,12 +68,18 @@ ___data___

Variable or Expression.

## Empty
___value___

Returns children if `data` is an empty Array or Object (`[]`, `{}`) or undefined variable. If the `<Else />` branch is defined, it will be returned when `data` is non-empty and defined.
Variable or Expression. Optional.

## Unless

Returns it's children if `data` to `value` are __not__ equal. If the `<Else />` branch is defined, it will be returned when `data` and `value` are equal.

If `value` is not defined, `Unless` will have the same behavior as `Empty`.

```html
<Empty data={searchResults}>No results.</Empty>
<Unless data={loggedIn} value="true"><LoginForm /></Unless>
```

__Attributes__
Expand All @@ -87,6 +88,10 @@ ___data___

Variable or Expression.

___value___

Variable or Expression. Optional.

## Range

Returns children if `data` is between `min` and `max`. If the `<Else />` branch is defined, it will be returned when `data` is out of range.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rogain-core-helpers",
"version": "0.1.1",
"version": "0.1.2",
"description": "Core helpers for Rogain templates.",
"main": "dist/index.js",
"scripts": {
Expand Down

0 comments on commit e0b4a46

Please sign in to comment.