1.0.0 • Published 8 years ago

is-valid-path-with-extension v1.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
8 years ago

is-valid-path-with-extension

Returns true if a file path has valid characters and file extension matches.

Based on is-valid-path. Thanks jonschlinkert.

Here is a way to tell if string is a valid path of a particular file type. It's essentially is-valid-path with a second argument for a regex pattern. 🙂

import { default as isValid } from 'is-valid-path-with-extension'

isValid('img.jpg', /\.jpg/) // true
isValid('img.jpg', /\.png/) // null
isValid('img.jpg', /\.jpg|\.jpeg|\.png|\.svg/) // true
isValid('img.jp', /\.jpg|\.jpeg|\.png|\.svg/) // null
1.0.0

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago