Check if a
vfile passes a test.
npm install vfile-is
var vfile =var is =// => false// => false// => true// => false// => true// => false// => true// => false// => true// => false// => true// => false// => true// => false
file passes the given test.
test to an assertion, and calls that assertion with
If you’re doing a lot of checks, use
Create a function (the assertion) from
test, that when given something,
returns whether that value is a vfile and whether it passes the given
When given something, returns whether that value is a vfile and whether it passes the bound test.
- If there is no bound test (it’s null or undefined), makes sure
fileis a vfile
- If the bound test is a glob string, checks if that glob matches
- If the bound test is a normal string, checks if that is
- If the bound test is a normal object, checks if the given file matches the Spec
- If the bound test is an array, all tests in it must pass
A spec is an object describing properties to values.
For each property in
spec, if its value is
string, there must be an
equivalent property in the given file matching the value.
If the value is
object, it can have a
suffix key, and the value
in the given file must be a string, and it must start with
prefix and/or end
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.