Skip to content

Commit

Permalink
docs: Write demo, add --no-cache to doc generation, remove 'lib/index…
Browse files Browse the repository at this point in the history
….js' from doc conf.json

'lib/index.js' was removed from doc conf.json as '--files' must be provided (see
jsdoc2md/jsdoc-to-markdown#115)
  • Loading branch information
justin-calleja committed Feb 26, 2017
1 parent 2c1a17a commit 79f10b3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 60 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/tmp

# generated documentation
doc/tutorials

Expand Down
75 changes: 19 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,35 @@ Checks for duplicates given an [Iterable](https://developer.mozilla.org/en/docs/

`npm i @justinc/no-dups-validator`

### Example of usage
### Demo

(see tests for more examples)

```js
const noDups = require('@justinc/no-dups-validator')
// TODO:
noDups([1, 2, 3])()
// [ true, [] ]

noDups([1, 2, 3, 2, 1])('Found the following duplicates: ')
// [ false, [ new Error('Found the following duplicates: 2, 1) ] ]
```

### [combine-validations](https://github.com/justin-calleja/combine-validations)

If you're OK with using [Folktale Validations](http://docs.folktalejs.org/en/latest/api/data/validation/Validation.html) you might be interested in [combine-validations](https://github.com/justin-calleja/combine-validations).

### Tutorials

TODO: A JSDoc 3 tutorial (re currying) needs to be injected in this README.md. For now there's only a link:

* tutorial: [curry.md](https://github.com/justin-calleja/jsdocs/blob/master/tutorials/curry.md)
* issue: jsdoc2md/jsdoc-to-markdown#115

## Modules

<dl>
<dt><a href="#module_@justinc/no-dups-validator">@justinc/no-dups-validator</a></dt>
<dd></dd>
<dt><a href="#module_@justinc/no-dups-validator">@justinc/no-dups-validator</a></dt>
<dd></dd>
<dt><a href="#module_@justinc/jsdocs">@justinc/jsdocs</a></dt>
<dd><p>This module houses JSDoc 3 type definitions which can be re-used in different packages.</p>
</dd>
Expand All @@ -28,58 +43,6 @@ const noDups = require('@justinc/no-dups-validator')
<a name="module_@justinc/no-dups-validator"></a>

## @justinc/no-dups-validator

* [@justinc/no-dups-validator](#module_@justinc/no-dups-validator)
* [~noDups(iterable, errMsgPrefix)](#module_@justinc/no-dups-validator..noDups) ⇒ <code>Tuple.&lt;Boolean, Array.&lt;Error&gt;&gt;</code>
* [~noDups(iterable, errMsgPrefix)](#module_@justinc/no-dups-validator..noDups) ⇒ <code>Tuple.&lt;Boolean, Array.&lt;Error&gt;&gt;</code>

<a name="module_@justinc/no-dups-validator..noDups"></a>

### @justinc/no-dups-validator~noDups(iterable, errMsgPrefix) ⇒ <code>Tuple.&lt;Boolean, Array.&lt;Error&gt;&gt;</code>
This function is curried.

**Kind**: inner method of <code>[@justinc/no-dups-validator](#module_@justinc/no-dups-validator)</code>
**See**: [Tuple](#module_@justinc/jsdocs.Tuple)

| Param | Type | Description |
| --- | --- | --- |
| iterable | <code>Iterable</code> | The iterable whose elements are checked for duplicates |
| errMsgPrefix | <code>String</code> | A string to prefix any found duplicates in the error message |

<a name="module_@justinc/no-dups-validator..noDups"></a>

### @justinc/no-dups-validator~noDups(iterable, errMsgPrefix) ⇒ <code>Tuple.&lt;Boolean, Array.&lt;Error&gt;&gt;</code>
This function is curried.

**Kind**: inner method of <code>[@justinc/no-dups-validator](#module_@justinc/no-dups-validator)</code>
**See**: [Tuple](#module_@justinc/jsdocs.Tuple)

| Param | Type | Description |
| --- | --- | --- |
| iterable | <code>Iterable</code> | The iterable whose elements are checked for duplicates |
| errMsgPrefix | <code>String</code> | A string to prefix any found duplicates in the error message |

<a name="module_@justinc/no-dups-validator"></a>

## @justinc/no-dups-validator

* [@justinc/no-dups-validator](#module_@justinc/no-dups-validator)
* [~noDups(iterable, errMsgPrefix)](#module_@justinc/no-dups-validator..noDups) ⇒ <code>Tuple.&lt;Boolean, Array.&lt;Error&gt;&gt;</code>
* [~noDups(iterable, errMsgPrefix)](#module_@justinc/no-dups-validator..noDups) ⇒ <code>Tuple.&lt;Boolean, Array.&lt;Error&gt;&gt;</code>

<a name="module_@justinc/no-dups-validator..noDups"></a>

### @justinc/no-dups-validator~noDups(iterable, errMsgPrefix) ⇒ <code>Tuple.&lt;Boolean, Array.&lt;Error&gt;&gt;</code>
This function is curried.

**Kind**: inner method of <code>[@justinc/no-dups-validator](#module_@justinc/no-dups-validator)</code>
**See**: [Tuple](#module_@justinc/jsdocs.Tuple)

| Param | Type | Description |
| --- | --- | --- |
| iterable | <code>Iterable</code> | The iterable whose elements are checked for duplicates |
| errMsgPrefix | <code>String</code> | A string to prefix any found duplicates in the error message |

<a name="module_@justinc/no-dups-validator..noDups"></a>

### @justinc/no-dups-validator~noDups(iterable, errMsgPrefix) ⇒ <code>Tuple.&lt;Boolean, Array.&lt;Error&gt;&gt;</code>
Expand Down
1 change: 0 additions & 1 deletion doc/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
},
"source": {
"include": [
"lib/index.js",
"node_modules/@justinc/jsdocs/typedefs/index.jsdoc",
"node_modules/@justinc/jsdocs/typedefs/Tuple.jsdoc"
]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"copy:tutorials": "cp node_modules/@justinc/jsdocs/tutorials/curry.md doc/tutorials",
"clean:readme": "rimraf README.md && rimraf doc/tutorials && mkdirp doc/tutorials",
"prereadme": "npm run clean:readme && npm run copy:tutorials",
"readme": "jsdoc2md --template readmeTpl.hbs -c doc/conf.json --files lib/* >> README.md",
"readme": "jsdoc2md --template readmeTpl.hbs --no-cache -c doc/conf.json --files lib/* >> README.md",
"test": "ava",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
Expand Down
21 changes: 19 additions & 2 deletions readmeTpl.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,30 @@ Checks for duplicates given an [Iterable](https://developer.mozilla.org/en/docs/

`npm i @justinc/no-dups-validator`

### Example of usage
### Demo

(see tests for more examples)

```js
const noDups = require('@justinc/no-dups-validator')
// TODO:
noDups([1, 2, 3])()
// [ true, [] ]

noDups([1, 2, 3, 2, 1])('Found the following duplicates: ')
// [ false, [ new Error('Found the following duplicates: 2, 1) ] ]
```

### [combine-validations](https://github.com/justin-calleja/combine-validations)

If you're OK with using [Folktale Validations](http://docs.folktalejs.org/en/latest/api/data/validation/Validation.html) you might be interested in [combine-validations](https://github.com/justin-calleja/combine-validations).

### Tutorials

TODO: A JSDoc 3 tutorial (re currying) needs to be injected in this README.md. For now there's only a link:

* tutorial: [curry.md](https://github.com/justin-calleja/jsdocs/blob/master/tutorials/curry.md)
* issue: jsdoc2md/jsdoc-to-markdown#115

{{>main}}

[version-image]: https://img.shields.io/npm/v/@justinc/no-dups-validator.svg?style=flat-square
Expand Down

0 comments on commit 79f10b3

Please sign in to comment.