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

hapi-dribble

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-dribble - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

13

lib/dribble.js

@@ -6,3 +6,3 @@ 'use strict';

const _ = require('lodash');
const { isEmpty, forEach } = require('lodash');

@@ -66,3 +66,5 @@ const removeInferredItems = (arr) =>

const prevObj = objToBuild;
if (!child) return;
if (!child) {
return;
}

@@ -91,2 +93,3 @@ let newObj;

}
walkAndAddProps(tail, currentProp, objToBuild, visited);

@@ -99,2 +102,3 @@ if (remaining.length) {

};
iter(0);

@@ -141,3 +145,3 @@ visited.push(head);

currentProp.forEach((current) => {
if (_.isEmpty(current)) {
if (isEmpty(current)) {
previousProp.forEach(previous => {

@@ -215,3 +219,2 @@ if (Array.isArray(previous)) {

if (head === '[]') {
// eslint-disable-next-line no-return-assign
currentProp.forEach(prop => prop.length = 0);

@@ -221,3 +224,3 @@ } else {

const clean = (properyNames, predicate) => {
_.forEach(
forEach(
omit(prop, properyNames, predicate),

@@ -224,0 +227,0 @@ (value, key) => { delete prop[key]; }

{
"name": "hapi-dribble",
"version": "1.0.0",
"version": "1.0.1",
"description": "dynamically filter api responses",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

# hapi-dribble
`hapi-dribble` allows api responses to be filtered dynamically based upon the `server.request` state.
`hapi-dribble` allows api responses to be filtered dynamically based upon a `request` state.

@@ -23,3 +23,4 @@ ## Install

hasAdminScope: {
rule: (request) => request.auth.credentials.scope.includes('admin')
rule: (request) =>
request.auth.credentials.scope.includes('admin'),
filter: {

@@ -33,3 +34,4 @@ omit: ['user.id']

hasSuperAdminScope: {
rule: (request) => request.auth.credentials.scope.includes('super-admin')
rule: (request) =>
request.auth.credentials.scope.includes('super-admin'),
filter: {

@@ -186,8 +188,4 @@ keep: ['user', 'meta']

```
A filter which specifies: `Keep: ['a.b.c', 'a.b']`
A filter which specifies: `Keep: ['a.b.c', 'a.b']` is reduced to: `Keep: ['a.b']` as pointing to path `'a.b'` will keep all of the properties in object `b` (`'c'` here is inferred).
is reduced to: `Keep: ['a.b']`
as pointing to path `'a.b'` will keep all of the properties in object `b` (`'c'` here is inferred).
- If the path contains an array property, it is assumed each item in the array has a consistent schema.
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