Skip to content

Commit

Permalink
correct some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
deadratfink committed Feb 18, 2018
1 parent d7d4422 commit 819de55
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 39 deletions.
42 changes: 21 additions & 21 deletions API-PUBLIC.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ an (optional) callback function. It executes the transformation logic.
```js
import { transform } from 'jy-transform';
const options = {
src: 'foo/bar.yaml', // From YAML file...
transform: async (object) => { // ...callback with exchanging value...
src: 'foo/bar.yaml', // From YAML file...
transform: async (object) => { // ...callback with exchanging value...
object.foo = 'new value';
return object;
},
target: 'foo/bar-transformed.json', // ...to a new JSON file.
target: 'foo/bar-transformed.json', // ...to a new JSON file.
indent: 4,
};

Expand Down Expand Up @@ -232,8 +232,8 @@ The configuration properties provided to the `read` function.
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| src | <code>string</code> \| <code>Stream.Readable</code> \| <code>object</code> | | The source (if `string` type it is treated as a file path). |
| origin | <code>string</code> | <code>&quot;yaml&quot;</code> | The source origin type. |
| imports | <code>string</code> | | The exports name for reading from JS source files or objects only. |
| [origin] | <code>string</code> | <code>&quot;yaml&quot;</code> | The source origin type. |
| [imports] | <code>string</code> | | The exports name for reading from JS source files or objects only. |

<a name="WriteOptions"></a>

Expand All @@ -247,12 +247,12 @@ The configuration properties provided to the `write` function.
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| dest | <code>string</code> \| <code>Stream.Writable</code> \| <code>object</code> | | The destination (if `string` type it is treated as a file path). |
| target | <code>string</code> | <code>&quot;js&quot;</code> | The destination target type. |
| indent | <code>number</code> | <code>2</code> | The indentation value for pretty-print of output. |
| exports | <code>string</code> | | The exports name for usage in JS destination files only. |
| force | <code>string</code> | <code>false</code> | Force overwriting of existing output files on write phase. |
| no-es6 | <code>boolean</code> | <code>false</code> | Whether not to use ECMAScript6 syntax for JS type output like `module.exports` instead of `export default`, applicable only for JS output. |
| no-single | <code>boolean</code> | <code>false</code> | Whether _not_ to use single-quotes style for values in JS type output (i.e. double-quotes). |
| [target] | <code>string</code> | <code>&quot;js&quot;</code> | The destination target type. |
| [indent] | <code>number</code> | <code>2</code> | The indentation value for pretty-print of output. |
| [exports] | <code>string</code> | | The exports name for usage in JS destination files only. |
| [force] | <code>string</code> | <code>false</code> | Force overwriting of existing output files on write phase. |
| [no-es6] | <code>boolean</code> | <code>false</code> | Whether not to use ECMAScript6 syntax for JS type output like `module.exports` instead of `export default`, applicable only for JS output. |
| [no-single] | <code>boolean</code> | <code>false</code> | Whether _not_ to use single-quotes style for values in JS type output (i.e. double-quotes). |

<a name="TransformOptions"></a>

Expand All @@ -266,14 +266,14 @@ The configuration properties provided to the `transform` function.
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| src | <code>string</code> \| <code>Stream.Readable</code> \| <code>object</code> | | The _read_ source (if `string` type it is treated as a file path). |
| origin | <code>string</code> | <code>&quot;yaml&quot;</code> | The _read_ source origin type. |
| imports | <code>string</code> | | The _read_ exports name for reading from JS source files or objects only. |
| transform | <code>function</code> | | The option is a _transformation_ function with the following signature: <p><p> ``` [async|Promise] function(object) ``` |
| dest | <code>string</code> \| <code>Stream.Writable</code> \| <code>object</code> | | The _write_ destination (if `string` type it is treated as a file path). This property could be optional in case we infer a value from `src` which is then either a string or a file stream where can get the file path from. If this detection process cannot be fulfilled then the property is `undefined` and the transform process will fail with a `ValidationError` on write phase. |
| target | <code>string</code> | <code>&quot;js&quot;</code> | The _write_ target type. |
| indent | <code>number</code> | <code>2</code> | The _write_ indentation value for pretty-print of output. |
| exports | <code>string</code> | | The _write_ exports name for usage in JS destination files only. |
| force | <code>string</code> | <code>false</code> | Force overwriting of existing output files on write phase. |
| no-es6 | <code>boolean</code> | <code>false</code> | Whether not to use ECMAScript6 syntax for JS type output like `module.exports` instead of `export default`, applicable only for JS output. |
| no-single | <code>boolean</code> | <code>false</code> | Whether _not_ to use single-quotes style for values in JS type output (i.e. double-quotes). |
| [origin] | <code>string</code> | <code>&quot;yaml&quot;</code> | The _read_ source origin type. |
| [imports] | <code>string</code> | | The _read_ exports name for reading from JS source files or objects only. |
| [transform] | <code>function</code> | | The option is a _transformation_ function with the following signature: <p><p> ``` [async|Promise] function(object) ``` |
| [dest] | <code>string</code> \| <code>Stream.Writable</code> \| <code>object</code> | | The _write_ destination (if `string` type it is treated as a file path). This property could be optional in case we infer a value from `src` which is then either a string or a file stream where can get the file path from. If this detection process cannot be fulfilled then the property is `undefined` and the transform process will fail with a `ValidationError` on write phase. |
| [target] | <code>string</code> | <code>&quot;js&quot;</code> | The _write_ target type. |
| [indent] | <code>number</code> | <code>2</code> | The _write_ indentation value for pretty-print of output. |
| [exports] | <code>string</code> | | The _write_ exports name for usage in JS destination files only. |
| [force] | <code>string</code> | <code>false</code> | Force overwriting of existing output files on write phase. |
| [no-es6] | <code>boolean</code> | <code>false</code> | Whether not to use ECMAScript6 syntax for JS type output like `module.exports` instead of `export default`, applicable only for JS output. |
| [no-single] | <code>boolean</code> | <code>false</code> | Whether _not_ to use single-quotes style for values in JS type output (i.e. double-quotes). |

31 changes: 16 additions & 15 deletions PACKAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,44 +19,45 @@ npm test
## Dependencies

- [cli](https://github.com/node-js-libs/cli): A tool for rapidly building command line apps
- [is-stream](https://github.com/sindresorhus/is-stream): Check if something is a Node.js stream
- [joi](https://github.com/hapijs/joi): Object schema validation
- [js-yaml](https://github.com/nodeca/js-yaml): YAML 1.2 parser and serializer
- [is-stream](): Check if something is a Node.js stream
- [joi](): Object schema validation
- [js-yaml](): YAML 1.2 parser and serializer
- [json-stringify-safe](https://github.com/isaacs/json-stringify-safe): Like JSON.stringify, but doesn&#39;t blow up on circular refs.
- [mkdirp-then](https://github.com/fs-utils/mkdirp-then): mkdirp as promised
- [mkdirp-then](): mkdirp as promised
- [promisify-es6](https://github.com/manuel-di-iorio/promisify-es6): Promisify callback-style functions to ES6 promises
- [serialize-js](https://github.com/RReverser/serialize-js): User-readable object serialization for JavaScript.

## Dev Dependencies

- [babel-cli](https://github.com/babel/babel/tree/master/packages): Babel command line.
- [babel-cli](): Babel command line.
- [babel-eslint](https://github.com/babel/babel-eslint): Custom parser for ESLint
- [babel-plugin-transform-flow-strip-types](https://github.com/babel/babel/tree/master/packages): Strip flow type annotations from your output code.
- [babel-plugin-transform-runtime](https://github.com/babel/babel/tree/master/packages): Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals
- [babel-preset-env](https://github.com/babel/babel-preset-env): A Babel preset for each environment.
- [babel-plugin-transform-flow-strip-types](): Strip flow type annotations from your output code.
- [babel-plugin-transform-runtime](): Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals
- [babel-preset-env](): A Babel preset for each environment.
- [bithound](https://github.com/bithound/cli.bithound.io): Commands for interacting with bitHound: https://bithound.io
- [chalk](https://github.com/chalk/chalk): Terminal string styling done right
- [chalk](): Terminal string styling done right
- [codacy-coverage](https://github.com/codacy/node-codacy-coverage): Code Coverage reporter for Codacy.com
- [codeclimate-test-reporter](https://github.com/codeclimate/javascript-test-reporter): Code Climate test reporter client for javascript projects
- [codecov](https://github.com/codecov/codecov-node): Uploading report to Codecov: https://codecov.io
- [coveralls](https://github.com/nickmerwin/node-coveralls): takes json-cov output into stdin and POSTs to coveralls.io
- [cwd](https://github.com/jonschlinkert/cwd): Easily get the CWD (current working directory) of a project based on package.json, optionally starting from a given path. (node.js/javascript util)
- [cwd](): Easily get the CWD (current working directory) of a project based on package.json, optionally starting from a given path. (node.js/javascript util)
- [doctoc](https://github.com/thlorenz/doctoc): Generates TOC for markdown files of local git repo.
- [eslint](https://github.com/eslint/eslint): An AST-based pattern checker for JavaScript.
- [eslint](): An AST-based pattern checker for JavaScript.
- [eslint-config-airbnb-base](https://github.com/airbnb/javascript): Airbnb&#39;s base JS ESLint config, following our styleguide
- [eslint-plugin-filenames](https://github.com/selaux/eslint-plugin-filenames): Eslint rule for consistent filenames.
- [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import): Import with sanity.
- [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest): Eslint rules for Jest
- [eslint-plugin-jest](): Eslint rules for Jest
- [eslint-plugin-jest-async](https://github.com/deadratfink/jy-transform.git): ESLint plugin to detect improper Jest test assertions for asynchronous (Promise-based) actions
- [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc): JSDoc linting rules for ESLint.
- [eslint-plugin-json](https://github.com/azeemba/eslint-plugin-json): Lint JSON files
- [fs-extra](https://github.com/jprichardson/node-fs-extra): fs-extra contains methods that aren&#39;t included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
- [inchjs](https://github.com/rrrene/inchjs): JS Wrapper for Inch for JavaScript
- [jest](https://github.com/facebook/jest): Delightful JavaScript Testing.
- [jsdoc-babel](https://github.com/ctumolosus/jsdoc-babel): A JSDoc plugin that transforms ES6 source files with Babel before they are processsed.
- [jsdoc-parse](https://github.com/jsdoc2md/jsdoc-parse): Transforms jsdoc data into something more suitable for use as template input
- [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown): Generates markdown API documentation from jsdoc annotated source code
- [jsdoc-parse](): Transforms jsdoc data into something more suitable for use as template input
- [jsdoc-to-markdown](): Generates markdown API documentation from jsdoc annotated source code
- [nsp](https://github.com/nodesecurity/nsp): The Node Security (nodesecurity.io) command line interface
- [package-json-to-readme](https://github.com/zeke/package-json-to-readme): Generate a README.md from package.json contents
- [package-json-to-readme](): Generate a README.md from package.json contents
- [winston](https://github.com/winstonjs/winston): A multi-transport async logging library for Node.js


Expand Down
6 changes: 3 additions & 3 deletions src/jy-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ import {
* @example
* import { transform } from 'jy-transform';
* const options = {
* src: 'foo/bar.yaml', // From YAML file...
* transform: async (object) => { // ...callback with exchanging value...
* src: 'foo/bar.yaml', // From YAML file...
* transform: async (object) => { // ...callback with exchanging value...
* object.foo = 'new value';
* return object;
* },
* target: 'foo/bar-transformed.json', // ...to a new JSON file.
* target: 'foo/bar-transformed.json', // ...to a new JSON file.
* indent: 4,
* };
*
Expand Down

0 comments on commit 819de55

Please sign in to comment.