Small library which removes empty data from the object.
1. Install the package
npm i ts-trim-object --save
2. Import module
import 'ts-trim-object';
3. Define yor object
const myObject1 = { property: 'MyProperty', blankProperty:'', array: [] };
const myObject2 = { property: ' ' };
const myObject3 = { property: 'MyProperty', array: [{ prop: 'PropText', prop2: ''}] };
// remove empty properties
const result1 = myObject1.trimProps();
const result2 = myObject2.trimProps();
const result3 = myObject3.trimProps();
{ property: 'MyProperty' }
{ }
{ property: 'MyProperty', array: [{ prop: 'PropText' }] }