From 79f10b3b0aa09404c0a05b4b6eeec4fa92956682 Mon Sep 17 00:00:00 2001 From: Justin Calleja Date: Sun, 26 Feb 2017 04:16:53 +0100 Subject: [PATCH] docs: Write demo, add --no-cache to doc generation, remove 'lib/index.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) --- .gitignore | 2 ++ README.md | 75 +++++++++++++-------------------------------------- doc/conf.json | 1 - package.json | 2 +- readmeTpl.hbs | 21 +++++++++++++-- 5 files changed, 41 insertions(+), 60 deletions(-) diff --git a/.gitignore b/.gitignore index ac7dc5b..3b037fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/tmp + # generated documentation doc/tutorials diff --git a/README.md b/README.md index 6f7a7bb..6543a8b 100644 --- a/README.md +++ b/README.md @@ -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
@justinc/no-dups-validator
-
@justinc/no-dups-validator
-
@justinc/jsdocs

This module houses JSDoc 3 type definitions which can be re-used in different packages.

@@ -28,58 +43,6 @@ const noDups = require('@justinc/no-dups-validator') ## @justinc/no-dups-validator - -* [@justinc/no-dups-validator](#module_@justinc/no-dups-validator) - * [~noDups(iterable, errMsgPrefix)](#module_@justinc/no-dups-validator..noDups) ⇒ Tuple.<Boolean, Array.<Error>> - * [~noDups(iterable, errMsgPrefix)](#module_@justinc/no-dups-validator..noDups) ⇒ Tuple.<Boolean, Array.<Error>> - - - -### @justinc/no-dups-validator~noDups(iterable, errMsgPrefix) ⇒ Tuple.<Boolean, Array.<Error>> -This function is curried. - -**Kind**: inner method of [@justinc/no-dups-validator](#module_@justinc/no-dups-validator) -**See**: [Tuple](#module_@justinc/jsdocs.Tuple) - -| Param | Type | Description | -| --- | --- | --- | -| iterable | Iterable | The iterable whose elements are checked for duplicates | -| errMsgPrefix | String | A string to prefix any found duplicates in the error message | - - - -### @justinc/no-dups-validator~noDups(iterable, errMsgPrefix) ⇒ Tuple.<Boolean, Array.<Error>> -This function is curried. - -**Kind**: inner method of [@justinc/no-dups-validator](#module_@justinc/no-dups-validator) -**See**: [Tuple](#module_@justinc/jsdocs.Tuple) - -| Param | Type | Description | -| --- | --- | --- | -| iterable | Iterable | The iterable whose elements are checked for duplicates | -| errMsgPrefix | String | A string to prefix any found duplicates in the error message | - - - -## @justinc/no-dups-validator - -* [@justinc/no-dups-validator](#module_@justinc/no-dups-validator) - * [~noDups(iterable, errMsgPrefix)](#module_@justinc/no-dups-validator..noDups) ⇒ Tuple.<Boolean, Array.<Error>> - * [~noDups(iterable, errMsgPrefix)](#module_@justinc/no-dups-validator..noDups) ⇒ Tuple.<Boolean, Array.<Error>> - - - -### @justinc/no-dups-validator~noDups(iterable, errMsgPrefix) ⇒ Tuple.<Boolean, Array.<Error>> -This function is curried. - -**Kind**: inner method of [@justinc/no-dups-validator](#module_@justinc/no-dups-validator) -**See**: [Tuple](#module_@justinc/jsdocs.Tuple) - -| Param | Type | Description | -| --- | --- | --- | -| iterable | Iterable | The iterable whose elements are checked for duplicates | -| errMsgPrefix | String | A string to prefix any found duplicates in the error message | - ### @justinc/no-dups-validator~noDups(iterable, errMsgPrefix) ⇒ Tuple.<Boolean, Array.<Error>> diff --git a/doc/conf.json b/doc/conf.json index 0d5f597..39ad74f 100644 --- a/doc/conf.json +++ b/doc/conf.json @@ -4,7 +4,6 @@ }, "source": { "include": [ - "lib/index.js", "node_modules/@justinc/jsdocs/typedefs/index.jsdoc", "node_modules/@justinc/jsdocs/typedefs/Tuple.jsdoc" ] diff --git a/package.json b/package.json index 24afb36..139d37c 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/readmeTpl.hbs b/readmeTpl.hbs index e5e9496..0a7f3e4 100644 --- a/readmeTpl.hbs +++ b/readmeTpl.hbs @@ -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