Function basename

  • Parameters

    • filepath: string

      Path

    • ext: string = '.js'

      extname of file

    Returns string

    Description

    Get file basename, with .js ext by default

    Example

    import { path } from '@biorate/tools';
    console.log(path.basename('/www/root/index.js', '.js')); // index
    console.log(path.basename('/www/root/index.js', '')); // index.js
    console.log(path.basename('/www/root/index.html', '.html')); // index
    console.log(path.basename('/www/root/index.html')); // index.html

Generated using TypeDoc