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

rc

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc - npm Package Compare versions

Comparing version 0.5.5 to 0.6.0

27

index.js

@@ -11,3 +11,3 @@ #! /usr/bin/env node

module.exports = function (name, defaults, argv) {
module.exports = function (name, defaults, argv, parse) {
if('string' !== typeof name)

@@ -22,2 +22,9 @@ throw new Error('rc(name): name *must* be string')

parse = parse || cc.parse
function file () {
var content = cc.file.apply(null, arguments)
return content ? parse(content) : null
}
var local = cc.find('.'+name+'rc')

@@ -29,12 +36,12 @@

defaults,
win ? {} : cc.json(join(etc, name, 'config')),
win ? {} : cc.json(join(etc, name + 'rc')),
home ? cc.json(join(home, '.config', name, 'config')) : {},
home ? cc.json(join(home, '.config', name)) : {},
home ? cc.json(join(home, '.' + name, 'config')) : {},
home ? cc.json(join(home, '.' + name + 'rc')) : {},
cc.json(local),
win ? {} : file(join(etc, name, 'config')),
win ? {} : file(join(etc, name + 'rc')),
home ? file(join(home, '.config', name, 'config')) : {},
home ? file(join(home, '.config', name)) : {},
home ? file(join(home, '.' + name, 'config')) : {},
home ? file(join(home, '.' + name + 'rc')) : {},
file(local),
local ? {config: local} : null,
env.config ? cc.json(env.config) : null,
argv.config ? cc.json(argv.config) : null,
env.config ? file(env.config) : null,
argv.config ? file(argv.config) : null,
env,

@@ -41,0 +48,0 @@ argv

@@ -19,3 +19,3 @@ var fs = require('fs')

var json = exports.json = function () {
var file = exports.file = function () {
var args = [].slice.call(arguments).filter(function (arg) { return arg != null })

@@ -31,9 +31,13 @@

try {
content = fs.readFileSync(file,'utf-8')
return fs.readFileSync(file,'utf-8')
} catch (err) {
return
}
return parse(content)
}
var json = exports.json = function () {
var content = file.apply(null, arguments)
return content ? parse(content) : null
}
var env = exports.env = function (prefix, env) {

@@ -40,0 +44,0 @@ env = env || process.env

{
"name": "rc",
"version": "0.5.5",
"version": "0.6.0",
"description": "hardwired configuration loader",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -120,3 +120,15 @@ # rc

## Pass in your own parser
If you have a special need to use a non-standard parser,
you can do so by passing in the parser as the 4th argument.
(leave the 3rd as null to get the default args parser)
```javascript
require('rc')(appname, defaults, null, parser);
```
This may also be used to force a more strict format,
such as strict, valid JSON only.
## Note on Performance

@@ -123,0 +135,0 @@

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