HEX
Server: Apache
System: Linux www 6.18.6-i1-amd #905 SMP Mon Jan 19 08:49:07 CET 2026 x86_64
User: sws1073755998 (1073755998)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/share/node_modules/require-package-name/index.js
var scopePattern = /^(?:(@[^/]+)[/]+)([^/]+)[/]?/
var basePattern = /^([^/]+)[/]?/

module.exports = extract.bind(null, false)
module.exports.base = extract.bind(null, true)

function extract(isBase, str) {
  if (/^@/.test(str)) {
    var match = scopePattern.exec(str)
    if (!match || !match[1] || !match[2])
      return null
    if (isBase)
      return match[2] || null

    return [ match[1], match[2] ].join('/')
  } else {
    var match = basePattern.exec(str)
    if (!match)
      return null
    return match[1] || null
  }
}