Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ui-component-library / src / forms / input / ReactChain.tsx
Size: Mime:
import React from 'react'
/**
 *
 * @todo should split ReactChain to uxui-modules
 */
class ReactChain<P = any, S = any> extends React.Component<P, S> {
  store: Map<string, any>
  get(key: string) {
    return this.store.get(key)
  }
  has(key: string) {
    return this.store.has(key)
  }
  clear() {
    this.store.clear()
    return this
  }
  set(key: string, value: any) {
    this.store.set(key, value)
    return this
  }
  delete(key: string) {
    this.store.delete(key)
    return this
  }
  merge(obj: Object) {
    Object.keys(obj).forEach(key => {
      let val = obj[key]
      if (this.has(key)) {
        val = [this.get(key), val]
      }
      return this.set(key, val)
    })
    return this
  }
}

export { ReactChain }
export default ReactChain