Skip to content

Commit

Permalink
docs(src/cache): update JSDoc comments (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaharu committed Nov 8, 2020
1 parent a92949a commit b773c17
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const makeDir = require("make-dir");
*
* @async
* @params {String} filename
* @params {Boolean} compress
*/
const read = async function(filename, compress) {
const data = await readFile(filename + (compress ? ".gz" : ""));
Expand All @@ -43,6 +44,7 @@ const read = async function(filename, compress) {
*
* @async
* @params {String} filename
* @params {Boolean} compress
* @params {String} result
*/
const write = async function(filename, compress, result) {
Expand Down Expand Up @@ -130,31 +132,23 @@ const handleCache = async function(directory, params) {
*
* @async
* @param {Object} params
* @param {String} params.directory Directory to store cached files
* @param {String} params.identifier Unique identifier to bust cache
* @param {String} params.cacheDirectory Directory to store cached files
* @param {String} params.cacheIdentifier Unique identifier to bust cache
* @param {Boolean} params.cacheCompression Whether compressing cached files
* @param {String} params.source Original contents of the file to be cached
* @param {Object} params.options Options to be given to the transform fn
* @param {Function} params.transform Function that will transform the
* original file and whose result will be
* cached
*
* @example
*
* cache({
* directory: '.tmp/cache',
* identifier: 'babel-loader-cachefile',
* const result = await cache({
* cacheDirectory: '.tmp/cache',
* cacheIdentifier: 'babel-loader-cachefile',
* cacheCompression: false,
* source: *source code from file*,
* options: {
* experimental: true,
* runtime: true
* },
* transform: function(source, options) {
* var content = *do what you need with the source*
* return content;
* }
* }, function(err, result) {
*
* });
*/

Expand Down

0 comments on commit b773c17

Please sign in to comment.