Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

valid-filename

sindresorhus284.5kMIT4.0.0TypeScript support: included

Check if a string is a valid filename

regex, regexp, filename, valid, validate, check, detect, is, string

readme

valid-filename

Check if a string is a valid filename

Install

$ npm install valid-filename

Usage

import isValidFilename from 'valid-filename';

isValidFilename('foo/bar');
//=> false

isValidFilename('foo-bar');
//=> true

API

isValidFilename(input)

Returns a boolean of whether input is a valid filename.

input

Type: string

The string to check.

  • filenamify - Convert a string to a valid safe filename