Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

read-package-json

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-package-json - npm Package Compare versions

Comparing version 1.1.7 to 1.1.8

test/fixtures/readmes/package.json

2

package.json
{
"name": "read-package-json",
"version": "1.1.7",
"version": "1.1.8",
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",

@@ -5,0 +5,0 @@ "description": "The thing npm uses to read package.json files with semantics and defaults and validation",

@@ -234,3 +234,3 @@ // vim: set softtabstop=16 shiftwidth=16:

var globOpts = { cwd: dir, nocase: true, mark: true }
glob("README?(.*)", globOpts, function (er, files) {
glob("{README,README.*}", globOpts, function (er, files) {
if (er) return cb(er);

@@ -242,6 +242,20 @@ // don't accept directories.

if (!files.length) return cb();
var rm = path.resolve(dir, files[0])
var fn = preferMarkdownReadme(files)
var rm = path.resolve(dir, fn)
readme_(file, data, rm, cb)
})
}
function preferMarkdownReadme(files) {
var fallback = 0;
var re = /\.m?a?r?k?d?o?w?n?$/i
for (var i = 0; i < files.length; i++) {
if (files[i].match(re))
return files[i]
else if (files[i].match(/README$/))
fallback = i
}
// prefer README.md, followed by README; otherwise, return
// the first filename (which could be README)
return files[fallback];
}
function readme_(file, data, rm, cb) {

@@ -248,0 +262,0 @@ var rmfn = path.basename(rm);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc