1.0.5 • Published 3 years ago

get-flat v1.0.5

Weekly downloads
12
License
ISC
Repository
github
Last release
3 years ago

get-flat

Turn class instances into plain js objects making use of the instance's getters.

Turn this:

class Hat {
  private _hatName: string;

  constructor(hatName: string) {
    this._hatName = hatName;
  }

  public get hatName() {
    return this._hatName;
  }
}

Into this:

{
  hatName: 'name';
}

By doing this:

import { ObjectSerializer } from 'get-flat';

const serializer = new ObjectSerializer();

const hat = new Hat('name');
const flatHat = serializer.toPlainObject(hat);
1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago