Socket
Socket
Sign inDemoInstall

resource-schema

Package Overview
Dependencies
Maintainers
4
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 0.17.1 to 0.17.2

lib/key_checker.js

17

lib/index.js
// Generated by CoffeeScript 1.9.2
var ObjectId, RESERVED_KEYWORDS, ResourceSchema, _, boom, deepExtend, dot, err, q,
var ObjectId, ResourceSchema, _, boom, deepExtend, dot, err, keyChecker, q,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

@@ -25,3 +25,3 @@ slice = [].slice,

RESERVED_KEYWORDS = require('./reserved_keywords');
keyChecker = require('./key_checker');

@@ -757,7 +757,14 @@ module.exports = ResourceSchema = (function() {

Collapse all nested fields to dot format. Ignore Reserved Keywords on schema.
@param {Object} obj - object to convert to dot strings
@param {Function} [shouldIgnore] - optional function to check if you should ignore the key for dot stringifying
@example {a: {b: 1}} -> {'a.b': 1}
*/
ResourceSchema.prototype._convertKeysToDotStrings = function(obj) {
ResourceSchema.prototype._convertKeysToDotStrings = function(obj, shouldIgnore) {
var dotKeys, dotStringify;
if (shouldIgnore == null) {
shouldIgnore = function() {
return false;
};
}
dotKeys = {};

@@ -770,3 +777,3 @@ dotStringify = function(obj, current) {

newKey = current ? current + "." + key : key;
if (indexOf.call(RESERVED_KEYWORDS, key) >= 0) {
if (shouldIgnore(key, value)) {
if (dotKeys[current] == null) {

@@ -840,3 +847,3 @@ dotKeys[current] = {};

var config, key, normalizedSchema;
schema = this._convertKeysToDotStrings(schema);
schema = this._convertKeysToDotStrings(schema, keyChecker.isReserved);
normalizedSchema = {};

@@ -843,0 +850,0 @@ for (key in schema) {

{
"name": "resource-schema",
"version": "0.17.1",
"version": "0.17.2",
"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