Skip to main content

isModuleName

Callable

  • isModuleName(name: string): boolean

  • Returns true if a string is a valid Node module package name, according to the rules defined in validate-npm-package-name. Will return false for native builtin modules, like fs, and for the old name format.

    import { isModuleName } from '@boost/common';

    isModuleName('boost'); // true
    isModuleName('@boost/common'); // true
    isModuleName('fs'); // false