Negatively Proportional Model

    assert-file
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    assert-file

    assert file utilities

    NPM version build status Test coverage David deps Known Vulnerabilities NPM download

    Installation

    npm i --save assert-file

    Usage

    const assertFile = require('assert-file');
     
    // `ok()` is alias of `assertFile()`, `fail()` is the opposite of `assertFile()`
    const { ok, fail } = assertFile;
     
    // check whether file exists
    assertFile(`${fixtures}/package.json`);
     
    // check string includes
    assertFile(`${fixtures}/README.md`, 'hello');
     
    // check with regex
    assertFile(`${fixtures}/README.md`, /hello/);
     
    // check json includes
    assertFile(`${fixtures}/package.json`, { name: 'rule_file' });
     
    // support multiple rule
    assertFile(`${fixtures}/README.md`, [ 'hello', /world/ ]);
     
    // opposite assertion
    assertFile.fail(`${fixtures}/package.json`);
    assertFile.fail(`${fixtures}/package.json`, { name: 'example' });
    assertFile.fail(`${fixtures}/README`, /x = y/);
    assertFile.fail(`${fixtures}/README`, [ 'abc', /\d+/ ]);

    Keywords

    none

    Install

    npm i assert-file

    DownloadsWeekly Downloads

    833

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    8.05 kB

    Total Files

    5

    Last publish

    Collaborators

    • atian25