gzuncompress
|
Server IP : 172.19.0.2 / Your IP : 216.73.216.178 Web Server : Apache/2.4 System : Linux 880f91b28fd7 5.15.0-117-generic #127~20.04.1-Ubuntu SMP Thu Jul 11 15:36:12 UTC 2024 x86_64 User : tomlinde ( 155017) PHP Version : 5.6.40 Disable Function : dl, syslog, opcache_get_status MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/../lib/node_modules/npm/../npm/node_modules/normalize-package-data/lib/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] | [ Lock Shell ] | [ Logout ] |
|---|
module.exports = normalize
var fixer = require('./fixer')
normalize.fixer = fixer
var makeWarning = require('./make_warning')
var fieldsToFix = ['name', 'version', 'description', 'repository', 'modules', 'scripts',
'files', 'bin', 'man', 'bugs', 'keywords', 'readme', 'homepage', 'license']
var otherThingsToFix = ['dependencies', 'people', 'typos']
var thingsToFix = fieldsToFix.map(function (fieldName) {
return ucFirst(fieldName) + 'Field'
})
// two ways to do this in CoffeeScript on only one line, sub-70 chars:
// thingsToFix = fieldsToFix.map (name) -> ucFirst(name) + "Field"
// thingsToFix = (ucFirst(name) + "Field" for name in fieldsToFix)
thingsToFix = thingsToFix.concat(otherThingsToFix)
function normalize (data, warn, strict) {
if (warn === true) {
warn = null
strict = true
}
if (!strict) {
strict = false
}
if (!warn || data.private) {
warn = function () { /* noop */ }
}
if (data.scripts &&
data.scripts.install === 'node-gyp rebuild' &&
!data.scripts.preinstall) {
data.gypfile = true
}
fixer.warn = function () {
warn(makeWarning.apply(null, arguments))
}
thingsToFix.forEach(function (thingName) {
fixer['fix' + ucFirst(thingName)](data, strict)
})
data._id = data.name + '@' + data.version
}
function ucFirst (string) {
return string.charAt(0).toUpperCase() + string.slice(1)
}