Skip to content

Instantly share code, notes, and snippets.

View rjdmacedo's full-sized avatar
🐛
I am bug

Rafael Macedo rjdmacedo

🐛
I am bug
View GitHub Profile
/**
* Assigns to a given base object on the provided path the value.
*
* @example
* assign({}, 'consent.advertising', true) = {
* value: true,
* updatedAt: Date.now()
* }
* @param obj {Object} - Base object that will hold the value.
* @param path {string} - Path to be created, if non existent, on the base object. Format is § string using the dot notation.
interface Consumer<T> {
(...data: T[]): void
}
type Listener<T> = Consumer<T>
export interface Emittable<T> {
/**
* Removes all listeners and all events.
*/