Skip to content

Commit

Permalink
better docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rochars committed Dec 6, 2017
1 parent e27a9de commit d42e26b
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 32 deletions.
18 changes: 9 additions & 9 deletions dist/riff-chunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,9 @@ const chr = byteData.chr;
* @param {Object} chunks A structure like the return of riffChunks.read().
* @param {boolean} bigEndian if the bytes should be big endian.
* "RIFX" chunkId will always set bigEndian to true.
* @return {Array<number>|Uint8Array} The:
* - file bytes as Uint8Array when chunkId is "RIFF" or "RIFX" or
* - chunk bytes as Array<number> if chunkId is "LIST".
* @return {Array<number>|Uint8Array} The file bytes as Uint8Array when
* chunkId is "RIFF" or "RIFX" or the chunk bytes as Array<number>
* when chunkId is "LIST".
*/
function write(chunks, bigEndian=false) {
if (!bigEndian) {
Expand All @@ -433,7 +433,7 @@ function write(chunks, bigEndian=false) {
/**
* Get the chunks of a RIFF/RIFX file.
* @param {Uint8Array|!Array<number>} buffer The file bytes.
* @return {Object}
* @return {Object} The chunk.
*/
function read(buffer) {
buffer = [].slice.call(buffer);
Expand All @@ -451,7 +451,7 @@ function read(buffer) {
* Write the sub chunks of a RIFF file.
* @param {Array<Object>} chunks The chunks.
* @param {boolean} bigEndian true if its RIFX.
* @return {Array<number>}
* @return {Array<number>} The chunk bytes.
*/
function writeSubChunks(chunks, bigEndian) {
let subChunks = [];
Expand All @@ -474,7 +474,7 @@ function writeSubChunks(chunks, bigEndian) {
/**
* Get the sub chunks of a RIFF file.
* @param {Uint8Array|!Array<number>} buffer the RIFF file bytes.
* @return {Object}
* @return {Object} The subchunks of a RIFF/RIFX or LIST chunk.
*/
function getSubChunks(buffer) {
let chunks = [];
Expand All @@ -490,7 +490,7 @@ function getSubChunks(buffer) {
* Get a sub chunk from a RIFF file.
* @param {Uint8Array|!Array<number>} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {Object}
* @return {Object} A subchunk of a RIFF/RIFX or LIST chunk.
*/
function getSubChunk(buffer, index) {
let chunk = {
Expand All @@ -511,7 +511,7 @@ function getSubChunk(buffer, index) {
* Return the FourCC of a chunk.
* @param {Uint8Array|!Array<number>} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {string}
* @return {string} The id of the chunk.
*/
function getChunkId(buffer, index) {
return byteData.unpackArray(buffer.slice(index, index + 4), chr);
Expand All @@ -521,7 +521,7 @@ function getChunkId(buffer, index) {
* Return the size of a chunk.
* @param {Uint8Array|!Array<number>} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {number}
* @return {number} The size of the chunk without the id and size fields.
*/
function getChunkSize(buffer, index) {
return byteData.unpack(buffer.slice(index + 4, index + 8), uInt32);
Expand Down
28 changes: 26 additions & 2 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ <h5>Parameters:</h5>
<h5>Returns:</h5>


<div class="param-desc">
The id of the chunk.
</div>



<dl class="param-type">
Expand Down Expand Up @@ -447,6 +451,10 @@ <h5>Parameters:</h5>
<h5>Returns:</h5>


<div class="param-desc">
The size of the chunk without the id and size fields.
</div>



<dl class="param-type">
Expand Down Expand Up @@ -624,6 +632,10 @@ <h5>Parameters:</h5>
<h5>Returns:</h5>


<div class="param-desc">
A subchunk of a RIFF/RIFX or LIST chunk.
</div>



<dl class="param-type">
Expand Down Expand Up @@ -778,6 +790,10 @@ <h5>Parameters:</h5>
<h5>Returns:</h5>


<div class="param-desc">
The subchunks of a RIFF/RIFX or LIST chunk.
</div>



<dl class="param-type">
Expand Down Expand Up @@ -932,6 +948,10 @@ <h5>Parameters:</h5>
<h5>Returns:</h5>


<div class="param-desc">
The chunk.
</div>



<dl class="param-type">
Expand Down Expand Up @@ -1119,7 +1139,7 @@ <h5>Returns:</h5>


<div class="param-desc">
The: - file bytes as Uint8Array when chunkId is "RIFF" or "RIFX" or - chunk bytes as Array<number> if chunkId is "LIST".
The file bytes as Uint8Array when chunkId is "RIFF" or "RIFX" or the chunk bytes as Array<number> when chunkId is "LIST".
</div>


Expand Down Expand Up @@ -1299,6 +1319,10 @@ <h5>Parameters:</h5>
<h5>Returns:</h5>


<div class="param-desc">
The chunk bytes.
</div>



<dl class="param-type">
Expand Down Expand Up @@ -1334,7 +1358,7 @@ <h5>Returns:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Dec 06 2017 05:02:32 GMT-0200 (Horário brasileiro de verão) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Dec 06 2017 05:29:20 GMT-0200 (Horário brasileiro de verão) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ <h2>riffChunks.write()</h2><pre class="prettyprint source lang-javascript"><code
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Dec 06 2017 05:02:32 GMT-0200 (Horário brasileiro de verão) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Dec 06 2017 05:29:20 GMT-0200 (Horário brasileiro de verão) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
20 changes: 10 additions & 10 deletions docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ <h1 class="page-title">index.js</h1>
* @param {Object} chunks A structure like the return of riffChunks.read().
* @param {boolean} bigEndian if the bytes should be big endian.
* "RIFX" chunkId will always set bigEndian to true.
* @return {Array&lt;number>|Uint8Array} The:
* - file bytes as Uint8Array when chunkId is "RIFF" or "RIFX" or
* - chunk bytes as Array&lt;number> if chunkId is "LIST".
* @return {Array&lt;number>|Uint8Array} The file bytes as Uint8Array when
* chunkId is "RIFF" or "RIFX" or the chunk bytes as Array&lt;number>
* when chunkId is "LIST".
*/
function write(chunks, bigEndian=false) {
if (!bigEndian) {
Expand All @@ -77,7 +77,7 @@ <h1 class="page-title">index.js</h1>
/**
* Get the chunks of a RIFF/RIFX file.
* @param {Uint8Array|!Array&lt;number>} buffer The file bytes.
* @return {Object}
* @return {Object} The chunk.
*/
function read(buffer) {
buffer = [].slice.call(buffer);
Expand All @@ -95,7 +95,7 @@ <h1 class="page-title">index.js</h1>
* Write the sub chunks of a RIFF file.
* @param {Array&lt;Object>} chunks The chunks.
* @param {boolean} bigEndian true if its RIFX.
* @return {Array&lt;number>}
* @return {Array&lt;number>} The chunk bytes.
*/
function writeSubChunks(chunks, bigEndian) {
let subChunks = [];
Expand All @@ -118,7 +118,7 @@ <h1 class="page-title">index.js</h1>
/**
* Get the sub chunks of a RIFF file.
* @param {Uint8Array|!Array&lt;number>} buffer the RIFF file bytes.
* @return {Object}
* @return {Object} The subchunks of a RIFF/RIFX or LIST chunk.
*/
function getSubChunks(buffer) {
let chunks = [];
Expand All @@ -134,7 +134,7 @@ <h1 class="page-title">index.js</h1>
* Get a sub chunk from a RIFF file.
* @param {Uint8Array|!Array&lt;number>} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {Object}
* @return {Object} A subchunk of a RIFF/RIFX or LIST chunk.
*/
function getSubChunk(buffer, index) {
let chunk = {
Expand All @@ -155,7 +155,7 @@ <h1 class="page-title">index.js</h1>
* Return the FourCC of a chunk.
* @param {Uint8Array|!Array&lt;number>} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {string}
* @return {string} The id of the chunk.
*/
function getChunkId(buffer, index) {
return byteData.unpackArray(buffer.slice(index, index + 4), chr);
Expand All @@ -165,7 +165,7 @@ <h1 class="page-title">index.js</h1>
* Return the size of a chunk.
* @param {Uint8Array|!Array&lt;number>} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {number}
* @return {number} The size of the chunk without the id and size fields.
*/
function getChunkSize(buffer, index) {
return byteData.unpack(buffer.slice(index + 4, index + 8), uInt32);
Expand All @@ -185,7 +185,7 @@ <h1 class="page-title">index.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Dec 06 2017 05:02:32 GMT-0200 (Horário brasileiro de verão) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Dec 06 2017 05:29:20 GMT-0200 (Horário brasileiro de verão) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
18 changes: 9 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const chr = byteData.chr;
* @param {Object} chunks A structure like the return of riffChunks.read().
* @param {boolean} bigEndian if the bytes should be big endian.
* "RIFX" chunkId will always set bigEndian to true.
* @return {Array<number>|Uint8Array} The:
* - file bytes as Uint8Array when chunkId is "RIFF" or "RIFX" or
* - chunk bytes as Array<number> if chunkId is "LIST".
* @return {Array<number>|Uint8Array} The file bytes as Uint8Array when
* chunkId is "RIFF" or "RIFX" or the chunk bytes as Array<number>
* when chunkId is "LIST".
*/
function write(chunks, bigEndian=false) {
if (!bigEndian) {
Expand All @@ -38,7 +38,7 @@ function write(chunks, bigEndian=false) {
/**
* Get the chunks of a RIFF/RIFX file.
* @param {Uint8Array|!Array<number>} buffer The file bytes.
* @return {Object}
* @return {Object} The chunk.
*/
function read(buffer) {
buffer = [].slice.call(buffer);
Expand All @@ -56,7 +56,7 @@ function read(buffer) {
* Write the sub chunks of a RIFF file.
* @param {Array<Object>} chunks The chunks.
* @param {boolean} bigEndian true if its RIFX.
* @return {Array<number>}
* @return {Array<number>} The chunk bytes.
*/
function writeSubChunks(chunks, bigEndian) {
let subChunks = [];
Expand All @@ -79,7 +79,7 @@ function writeSubChunks(chunks, bigEndian) {
/**
* Get the sub chunks of a RIFF file.
* @param {Uint8Array|!Array<number>} buffer the RIFF file bytes.
* @return {Object}
* @return {Object} The subchunks of a RIFF/RIFX or LIST chunk.
*/
function getSubChunks(buffer) {
let chunks = [];
Expand All @@ -95,7 +95,7 @@ function getSubChunks(buffer) {
* Get a sub chunk from a RIFF file.
* @param {Uint8Array|!Array<number>} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {Object}
* @return {Object} A subchunk of a RIFF/RIFX or LIST chunk.
*/
function getSubChunk(buffer, index) {
let chunk = {
Expand All @@ -116,7 +116,7 @@ function getSubChunk(buffer, index) {
* Return the FourCC of a chunk.
* @param {Uint8Array|!Array<number>} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {string}
* @return {string} The id of the chunk.
*/
function getChunkId(buffer, index) {
return byteData.unpackArray(buffer.slice(index, index + 4), chr);
Expand All @@ -126,7 +126,7 @@ function getChunkId(buffer, index) {
* Return the size of a chunk.
* @param {Uint8Array|!Array<number>} buffer the RIFF file bytes.
* @param {number} index The start index of the chunk.
* @return {number}
* @return {number} The size of the chunk without the id and size fields.
*/
function getChunkSize(buffer, index) {
return byteData.unpack(buffer.slice(index + 4, index + 8), uInt32);
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": "riff-chunks",
"version": "3.0.4",
"version": "3.0.5",
"description": "Get and set the chunks of RIFF and RIFX files.",
"homepage": "https://github.com/rochars/riff-chunks",
"author": "Rafael da Silva Rocha <[email protected]>",
Expand Down

0 comments on commit d42e26b

Please sign in to comment.