From 8927ab328407469d8b241b09f228b14f78c56544 Mon Sep 17 00:00:00 2001 From: Kevin Van Lierde Date: Tue, 13 Jun 2023 00:09:17 +0200 Subject: [PATCH] Adds JsDoc example usage --- lib/index.d.ts | 6 ++++++ src/index.js | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/lib/index.d.ts b/lib/index.d.ts index 71ca151..a0df8a1 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -7,6 +7,12 @@ export type Options = { /** * A Metalsmith plugin to remove files from the build + * + * @example + * // remove all dotfiles that are direct children of metalsmith.source() + * metalsmith.use(remove('.*')) + * // remove all JSON files + * metalsmith.use(remove(['**\/*.json'])) */ declare function remove( /** One or more [glob patterns](https://en.wikipedia.org/wiki/Glob_(programming)) */ diff --git a/src/index.js b/src/index.js index aca325f..e55ddf2 100644 --- a/src/index.js +++ b/src/index.js @@ -22,6 +22,11 @@ function normalizeOptions(options) { * * @param {String|String[]|Options} [options] One or more [glob patterns](https://en.wikipedia.org/wiki/Glob_(programming)) * @return {import('metalsmith').Plugin} + * @example + * // remove all dotfiles that are direct children of metalsmith.source() + * metalsmith.use(remove('.*')) + * // remove all JSON files + * metalsmith.use(remove(['**\/*.json'])) */ function remove(options) { return function remove(files, metalsmith, done) {