express-rest-api-generator
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -0,1 +1,3 @@ | ||
const log = require('debug')('rest:helpers:'); | ||
// sluggify method names from `camelCase` to `camel-case` | ||
@@ -11,3 +13,3 @@ // used for generating endpoints from statics. | ||
if (typeof obj === 'undefined' || typeof key === 'undefined') return obj; | ||
if (typeof prop({ obj, key }) !== 'undefined') prop({ obj, key, remove: true }); | ||
prop({ obj, key, remove: true }); | ||
return obj; | ||
@@ -26,5 +28,5 @@ } | ||
function prop({ obj = {}, str = '', val = undefined, remove = false }) { | ||
str = typeof str === 'string' ? str : `${str}`; | ||
const props = str.indexOf('.') !== -1 ? str.split('.') : [str]; | ||
function prop({ obj = {}, key = '', val, remove = false }) { | ||
key = typeof key === 'string' ? key : `${key}`; | ||
const props = key.indexOf('.') !== -1 ? key.split('.') : [key]; | ||
const final = props.pop(); | ||
@@ -41,3 +43,6 @@ if (props.length) { | ||
} | ||
if (remove === true) return delete obj[final]; | ||
if (remove === true) { | ||
delete obj[final]; | ||
return obj; | ||
} | ||
return typeof val !== 'undefined' ? (obj[final] = val) : obj[final]; | ||
@@ -44,0 +49,0 @@ } |
{ | ||
"name": "express-rest-api-generator", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "express mountable app for mongoose routes with generators for mongoose model embedded statics", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
8954
256
0