UNPKG

better-npm-init

Version:

A better version of npm init, with templates and more. Usage: better-npm-init <template> [--yarn] [--install] [--git] [--yes] [--help]

12 lines (9 loc) 306 B
'use strict'; var escapeStringRegexp = require('escape-string-regexp'); module.exports = function (str, sub) { if (typeof str !== 'string' || typeof sub !== 'string') { throw new TypeError(); } sub = escapeStringRegexp(sub); return str.replace(new RegExp('^' + sub + '|' + sub + '$', 'g'), ''); };