From b773c17cb29d45131f445b1d1a3cc416397f0ec7 Mon Sep 17 00:00:00 2001 From: Haruaki OTAKE Date: Mon, 9 Nov 2020 07:06:43 +0900 Subject: [PATCH] docs(src/cache): update JSDoc comments (#846) --- src/cache.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/cache.js b/src/cache.js index 2fbf3418..5a375ffe 100644 --- a/src/cache.js +++ b/src/cache.js @@ -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" : "")); @@ -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) { @@ -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) { - * * }); */