0.2.2 • Published 3 years ago

getit-js v0.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

npm version

getit-js

This is a small helper package for parsing API Responses. This is still under construction.

Usage

Create classes that extend AbstractModel

Example

class OtherClass extends AbstractModel {
  description!: string

  protected getMappingConfig (): IMappingConfig {
    return {
      mappings: [
        {
          key: 'description'
        }
      ]
    }
  }
}

class User extends AbstractModel {
  loading: false
  reference!: number
  email!: string
  details!: OtherClass

  protected getMappingConfig (): IMappingConfig {
    return {
      mappings: [
        {
          key: 'reference',
          sourceKey: 'id'
        },
        {
          key: 'email'
        },
        {
          key: 'details',
          type: EMappingType.MODEL,
          model: OtherClass
        }
      ]
    }
  }

  public beforeUpdate () {
    this.loading = true
    super.beforeUpdate()
  }
}

Note: snake_case will be parsed to camelCase by default.

Contributions

Feel free to add feedback, and ideas to make this better :)

0.2.1

3 years ago

0.2.0

3 years ago

0.2.2

3 years ago

0.1.14

3 years ago

0.1.12

4 years ago

0.1.13

4 years ago

0.1.10

4 years ago

0.1.11

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.9

4 years ago

0.1.6

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.5

4 years ago

0.1.0

4 years ago