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

@iteam/config

Package Overview
Dependencies
Maintainers
7
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iteam/config - npm Package Compare versions

Comparing version 10.0.1 to 12.0.0

src/utils/copy.js

33

package.json
{
"name": "@iteam/config",
"version": "10.0.1",
"version": "12.0.0",
"main": "src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/Iteam1337/config.git"
},
"license": "ISC",
"scripts": {

@@ -11,18 +16,18 @@ "lint": "eslint 'src/**/*.js'",

"dependencies": {
"camelcase": "^5.3.1",
"constant-case": "^2.0.0",
"dot-prop": "^5.1.0"
"camelcase": "5.3.1",
"constant-case": "2.0.0",
"dot-prop": "5.1.0"
},
"devDependencies": {
"chai": "^4.2.0",
"eslint": "^6.0.1",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"mocha": "^6.1.4",
"sinon": "^7.3.2",
"sinon-chai": "^3.3.0"
"chai": "4.2.0",
"eslint": "6.0.1",
"eslint-config-standard": "12.0.0",
"eslint-plugin-import": "2.18.0",
"eslint-plugin-node": "9.1.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-standard": "4.0.0",
"mocha": "6.1.4",
"sinon": "7.3.2",
"sinon-chai": "3.3.0"
}
}

@@ -84,3 +84,3 @@ const utils = require('./utils')

get (value) {
const { mergeDeep, changeCase, identifier } = utils
const { mergeDeep, changeCase, identifier, copy, isObject } = utils

@@ -104,8 +104,21 @@ const key = value

const out = mergeDeep(defaults, mergeDeep(env, file))
const merged = mergeDeep(copy(defaults), mergeDeep(copy(env), file))
return changeCase(
secrets ? mergeDeep(out, secrets) : out,
const out = changeCase(
secrets ? mergeDeep(copy(merged), secrets) : merged,
'camel'
)
const cast = utils.type.cast(out, changeCase(defaults, 'camel'))
if (
!isObject(out) &&
!isObject(cast) &&
!Array.isArray(out) &&
!Array.isArray(cast)
) {
return cast
}
return mergeDeep(out, cast)
}

@@ -112,0 +125,0 @@ }

const fs = require('fs')
const path = require('path')
const camelCase = require('camelcase')

@@ -18,8 +19,21 @@ const dotProp = require('dot-prop')

fileNames.forEach(fileName => {
const resolved = path.resolve(dir, fileName)
const pathParts = fileName.split(separator).map(key => camelCase(key))
let stat
try {
stat = fs.statSync(resolved)
} catch (_) {
return
}
if (stat.isDirectory()) {
return
}
dotProp.set(
output,
pathParts.join('.'),
fs.readFileSync(`${dir}${fileName}`, 'utf8').replace(/[\r\n]+$/, '')
fs.readFileSync(resolved, 'utf8').replace(/[\r\n]+$/, '')
)

@@ -35,9 +49,8 @@ })

return Array.isArray(keys)
? keys
.reduce((result, key) => {
const data = dotProp.get(obj, key.replace(/:/g, '.'))
return data || result
}, false)
? keys.reduce((result, key) => {
const data = dotProp.get(obj, key.replace(/:/g, '.'))
return data || result
}, false)
: dotProp.get(obj, keys)
}
}
const identifier = require('./identifier')
module.exports = function changeCase (keys, casing = 'snake') {
const changeCase = (keys, casing = 'snake') => {
if (keys === null) {

@@ -27,1 +27,3 @@ return null

}
module.exports = changeCase
const constant = require('constant-case')
const camel = require('camelcase')
const snake = key => {
return constant(`${key}`).toLowerCase()
}
const snake = key =>
constant(`${key}`).toLowerCase()
module.exports = function identifier (key, casing = 'snake') {
return casing.toLowerCase() === 'snake' ? snake(key) : camel(key)
}
const identifier = (key, casing = 'snake') =>
casing.toLowerCase() === 'snake' ? snake(key) : camel(key)
module.exports = identifier
module.exports = {
Config: require('./Config'),
changeCase: require('./changeCase'),
Config: require('./Config'),
isObject: require('./isObject'),
copy: require('./copy'),
identifier: require('./identifier'),
mergeDeep: require('./mergeDeep'),
identifier: require('./identifier')
type: require('./type'),
castString: require('./type/castString'),
isObject: require('./type/isObject'),
toBoolean: require('./type/toBoolean'),
toJSON: require('./type/toJSON')
}

@@ -1,5 +0,7 @@

const isObject = require('./isObject')
module.exports = function mergeDeep (writeObject, toCopyFrom) {
const isObject = require('./type/isObject')
const mergeDeep = (writeObject, toCopyFrom) => {
if (!isObject(toCopyFrom) && !isObject(writeObject)) {
return toCopyFrom || writeObject
return typeof toCopyFrom === 'undefined'
? writeObject : toCopyFrom
}

@@ -17,3 +19,3 @@

if (isObject(toCopyFrom[key])) {
if (!writeObject[key]) {
if (typeof writeObject[key] === 'undefined') {
Object.assign(writeObject, {

@@ -32,1 +34,3 @@ [key]: {}

}
module.exports = mergeDeep
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