Git Product home page Git Product logo

change-case-object's People

Stargazers

 avatar  avatar

change-case-object's Issues

Make recursion optional, defaulting to true

  • In individual functions and static methods of CasedObject, the user can specify deep in a second options argument (overlap with #8 & #10)
  • When initializing CasedObject, the user can specify deep in options, which is stored in private _options (overlap with #8 & #10)
  • When interacting with a CasedObject instance, the user can get & set private _options through options (overlap with #8 & #10)

Support options for change-case

  • In individual functions and static methods of CasedObject, the user can specify a second options argument that is passed on to change-case
  • When initializing CasedObject, the user can specify additional properties in options that are stored in private _options to later be passed on to change-case
  • When interacting with a CasedObject instance, the user can get & set private _options through options

Use Proxy for CasedObject getters

Return a Proxy from each getter with something like:

class CasedObject {

  // ...

  public get options() { return this.proxied('_options') }

  // ...

  public get value() { return this.proxied('_value') }

  // ...

  private proxied(p: string) {
    return new Proxy([this[p], {
      get: (_x, k) => this[p][k],
      set: (_x, k, v) => this[p] = { ...this[p], [k]: v }
    }])
  }

  // ...

}

Specify recursion depth

  • In individual functions and static methods of CasedObject, the user can specify depth in a second options argument (overlap with #8 & #9)
  • When initializing CasedObject, the user can specify depth in options, which is stored in private _options (overlap with #8 & #9)
  • When interacting with a CasedObject instance, the user can get & set private _options through options (overlap with #8 & #9)

Use BehaviorSubject for CasedObject

Make a CasedObject instance and its value and options subscribable

Something like...

class CasedObject extends BehaviorSubject {
  private _options = new BehaviorSubject({})
  private _value = new BehaviorSubject({})

  // ...

  constructor(value: any, options: CasedObjectOptions) {
    this.options.next(options)

    const { case: c } = options
    this.value.next(!!case ? changeCase(c, value) : c)
  }

  // ...

  private proxied(p: string) {
    return new Proxy([this[p], {
      get: (_x, k) => this[p].value[k],
      set: (_x, k, v) => this[p].next({ ...this[p].value, [k]: v })
    }])
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.