Skip to content

Commit

Permalink
Refactor docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jun 14, 2023
1 parent c6c4b17 commit d322b55
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* @typedef SpecAffix
* Define prepending and/or appending.
* @property {string | null | undefined} [prefix]
* Substring to prepend in front of the field.
* Substring to prepend before the field.
* @property {string | null | undefined} [suffix]
* Substring to append after the field.
*/
Expand Down
55 changes: 29 additions & 26 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`rename(file, renames)`](#renamefile-renames)
* [`convert(renames)`](#convertrenames)
* [`rename(file, renames)`](#renamefile-renames)
* [`Move`](#move)
* [`Renames`](#renames)
* [`Spec`](#spec)
Expand All @@ -41,7 +41,7 @@ support for renaming files to end users.
## Install

This package is [ESM only][esm].
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
In Node.js (version 16+), install with [npm][]:

```sh
npm install vfile-rename
Expand Down Expand Up @@ -97,37 +97,37 @@ This package exports the identifiers [`convert`][api-convert] and
[`rename`][api-rename].
There is no default export.

### `rename(file, renames)`

Rename a file.
### `convert(renames)`

When given something, returns a vfile from that, and changes its path
properties.
Create a function (the move) from `renames`, that when given a file changes
its path properties.

###### Parameters

* `file` (`VFile`)
— file to rename
* `renames` ([`Renames`][api-renames], optional)
— rename instructions

###### Returns

Nothing (`undefined`).
A move ([`Move`][api-move]).

### `convert(renames)`
### `rename(file, renames)`

Create a function (the move) from `renames`, that when given a file changes
its path properties.
Rename a file.

When given something, returns a vfile from that, and changes its path
properties.

###### Parameters

* `file` (`VFile`)
— file to rename
* `renames` ([`Renames`][api-renames], optional)
— rename instructions

###### Returns

A move ([`Move`][api-move]).
Nothing (`undefined`).

### `Move`

Expand Down Expand Up @@ -171,15 +171,15 @@ the path property on the given file is prefixed and/or suffixed.
###### Fields
* `basename` (`string` or [`SpecAffix`][api-spec-affix], optional)
* `basename` ([`SpecAffix`][api-spec-affix] or `string`, optional)
— change basename (`'index.min.js'`).
* `dirname` (`string` or [`SpecAffix`][api-spec-affix], optional)
* `dirname` ([`SpecAffix`][api-spec-affix] or `string`, optional)
— change dirname (`'~'`).
* `extname` (`string` or [`SpecAffix`][api-spec-affix], optional)
* `extname` ([`SpecAffix`][api-spec-affix] or `string`, optional)
— change extname (`'.js'`).
* `path` (`string`, `URL` or [`SpecAffix`][api-spec-affix], optional)
* `path` ([`SpecAffix`][api-spec-affix], `URL`, or `string`, optional)
— change file path (`'~/index.min.js'`).
* `stem` (`string` or [`SpecAffix`][api-spec-affix], optional)
* `stem` ([`SpecAffix`][api-spec-affix] or `string`, optional)
— change stem (`'index.min'`).
### `SpecAffix`
Expand All @@ -189,7 +189,7 @@ Define prepending and/or appending (TypeScript type).
###### Fields
* `prefix` (`string`, optional)
— substring to prepend in front of the field
— substring to prepend before the field
* `suffix` (`string`, optional)
— substring to append after the field.
Expand All @@ -201,14 +201,17 @@ It exports the types [`Move`][api-move], [`Renames`][api-renames],
## Compatibility
Projects maintained by the unified collective are compatible with all maintained
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
As of now, that is Node.js 14.14+ and 16.0+.
Our projects sometimes work with older versions, but this is not guaranteed.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, `vfile-rename@^2`,
compatible with Node.js 12.
## Security
Use of `vfile-rename` is safe by default.
Use of `vfile-rename` is safe.
## Contribute
Expand Down Expand Up @@ -238,9 +241,9 @@ abide by its terms.
[downloads]: https://www.npmjs.com/package/vfile-rename
[size-badge]: https://img.shields.io/bundlephobia/minzip/vfile-rename.svg
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=vfile-rename
[size]: https://bundlephobia.com/result?p=vfile-rename
[size]: https://bundlejs.com/?q=vfile-rename
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
Expand Down

0 comments on commit d322b55

Please sign in to comment.