https://github.com/sindresorhus/npm-name
npm에서 패키지 이름을 사용할 수 있는지 확인하십시오.
const npmName = require('npm-name'); (async () => { console.log(await npmName('chalk')); //=> false const result = await npmName.many(['chalk', '@sindresorhus/is', 'abc123']); console.log(result.get('chalk')); //=> false console.log(result.get('@sindresorhus/is')); //=> false console.log(result.get('abc123')); //=> true try { await npmName('_ABC'); } catch (error) { console.log(error.message); // Invalid package name: _ABC // - name cannot start with an underscore // - name can no longer contain capital letters } })();
등록된 댓글이 없습니다.