Skip to content
generated from stagas/ts

flatten constructor objects to top level camelcased with reverse access

Notifications You must be signed in to change notification settings

stagas/with-flatten

Repository files navigation

with-flatten

flatten constructor objects to top level camelcased with reverse access

🔧 Install · 🧩 Example · 📜 API docs · 🔥 Releases · 💪🏼 Contribute · 🖐️ Help


Install

$ npm i with-flatten

API

Table of Contents

withFlatten

src/index.ts:67-107

Mixins ctor with parent and camelCase flattens and observes its properties mapping them back to the actual values. Best used in conjuction with https://github.com/stagas/with-properties

const Foo = withFlatten(
  SomeParent,
  class {
    deep = {
      foo: 2,
    }
  }
)
const foo = new Foo()
foo.deepFoo = 4
expect(foo.deep.foo).toBe(4)

Parameters

Contribute

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2022 stagas

About

flatten constructor objects to top level camelcased with reverse access

Resources

Stars

Watchers

Forks

Packages

No packages published