Repository URL to install this package:
Version:
0.14.1 ▾
|
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