Socket
Socket
Sign inDemoInstall

resource-schema

Package Overview
Dependencies
Maintainers
5
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resource-schema - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

src/deep_extend.coffee~

28

lib/deep_extend.js
// Generated by CoffeeScript 1.10.0
/*
Extends two levels deep, so that we can extend query configuration objects without overwritting previous queries for the same property
* deep extend so that we can add multiple queries to any given property
Extends in such a way that we can merge query configuration objects without
clobbering any queries for the same property - when in doubt, `AND` the queries.
* e.g. {'day': $gt: '2014-10-1'}, {day: $lt: '2014-11-1'} =>
* {'day': $gt: '2014-10-1', $lt: '2014-11-1'}
* {'day': $and: [{$gt: '2014-10-1'}, {$lt: '2014-11-1'}]}
*/
module.exports = function(obj, obj2) {
var config, key, newKey, newValue;
var config, key, obj1, obj3, ref;
for (key in obj2) {
config = obj2[key];
if ((obj[key] != null) && typeof config === 'object') {
for (newKey in config) {
newValue = config[newKey];
obj[key][newKey] = newValue;
if (obj[key] != null) {
if (key !== '$and') {
obj.$and = [
(
obj1 = {},
obj1["" + key] = config,
obj1
), (
obj3 = {},
obj3["" + key] = obj[key],
obj3
)
];
delete obj[key];
} else {
(ref = obj.$and).push.apply(ref, config);
}

@@ -18,0 +30,0 @@ } else {

{
"name": "resource-schema",
"version": "1.1.0",
"version": "1.2.0",
"description": "Define schemas for RESTful resources from mongoose models, and generate middleware to GET, POST, PUT, and DELETE to those resources.",

@@ -5,0 +5,0 @@ "author": "Good Eggs <open-source@goodeggs.com>",

Sorry, the diff of this file is not supported yet

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