@antora/playbook-builder
Advanced tools
Comparing version 3.0.3 to 3.1.0
'use strict' | ||
const camelCaseKeys = require('camelcase-keys') | ||
const convict = require('./solitary-convict') | ||
@@ -71,2 +70,14 @@ const defaultSchema = require('./config/schema') | ||
function camelCaseKeys (o, stopPaths = [], p = '') { | ||
if (Array.isArray(o)) return o.map((it) => camelCaseKeys(it, stopPaths, p)) | ||
if (o == null || o.constructor !== Object) return o | ||
const pathPrefix = p && p + '.' | ||
const accum = {} | ||
for (const [k, v] of Object.entries(o)) { | ||
const camelKey = k.toLowerCase().replace(/[_-]([a-z0-9])/g, (_, l, idx) => (idx ? l.toUpperCase() : l)) | ||
accum[camelKey] = ~stopPaths.indexOf(pathPrefix + camelKey) ? v : camelCaseKeys(v, stopPaths, pathPrefix + camelKey) | ||
} | ||
return accum | ||
} | ||
function getModel (name) { | ||
@@ -81,3 +92,3 @@ let config = this | ||
config.validate({ allowed: 'strict' }) | ||
const model = camelCaseKeys(data, { deep: true, stopPaths: getStopPaths(schema._cvtProperties) }) | ||
const model = camelCaseKeys(data, getStopPaths(schema._cvtProperties)) | ||
if (!name) { | ||
@@ -84,0 +95,0 @@ model.dir = model.playbook ? ospath.dirname((model.file = model.playbook)) : process.cwd() |
{ | ||
"name": "@antora/playbook-builder", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "Builds a playbook object from user input for configuring successive documentation components in an Antora pipeline.", | ||
@@ -18,5 +18,11 @@ "license": "MPL-2.0", | ||
"main": "lib/index.js", | ||
"exports": { | ||
".": "./lib/index.js", | ||
"./config/schema": "./lib/config/schema.js", | ||
"./lib/solitary-convict": "./lib/solitary-convict.js", | ||
"./solitary-convict": "./lib/solitary-convict.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"dependencies": { | ||
"@iarna/toml": "~2.2", | ||
"camelcase-keys": "~7.0", | ||
"convict": "~6.2", | ||
@@ -27,3 +33,3 @@ "js-yaml": "~4.1", | ||
"engines": { | ||
"node": ">=12.21.0" | ||
"node": ">=16.0.0" | ||
}, | ||
@@ -30,0 +36,0 @@ "files": [ |
23756
4
627
- Removedcamelcase-keys@~7.0
- Removedcamelcase@6.3.0(transitive)
- Removedcamelcase-keys@7.0.2(transitive)
- Removedmap-obj@4.3.0(transitive)
- Removedquick-lru@5.1.1(transitive)
- Removedtype-fest@1.4.0(transitive)