🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@ninjakttty/dynamodb-object-normalizer

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ninjakttty/dynamodb-object-normalizer

Normalize objects for easy dynamodb insertion

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Dynamodb object normalizer

Build Status License: MIT

Normalize JS objects for dynamodb insertion

Dynamodb doesn't like empty string, this will recursively drill through all the props with empty strings and remove them by default or replace them with a user defined string

Usage


const { normalize } = require('@ninjakttty/dynamodb-object-normalizer');

const item = {
  firstName: 'Yuri',
  lastName: '',
  age: 23,
  job: {
    title: 'developer',
    eprop: '',
    rank: 10,
    coworkers: ['Frank', 'Gary', 'Mark'],
  },
};

console.log(normalize(item));
/*
{ firstName: 'Yuri',
  age: 23,
  job:
   { title: 'developer',
     rank: 10,
     coworkers: [ 'Frank', 'Gary', 'Mark' ] } }
*/

console.log(normalize(item, { replaceWith: 'empty' }));
/*
{ firstName: 'Yuri',
  lastName: 'empty',
  age: 23,
  job:
   { title: 'developer',
     eprop: 'empty',
     rank: 10,
     coworkers: [ 'Frank', 'Gary', 'Mark' ] } }
*/

Installation

npm i @ninjakttty/dynamodb-object-normalizer

License

MIT © Yuri Parsons

Keywords

dynamodb

FAQs

Package last updated on 07 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts