Modern Map
This is simply, easily, able to limit, similar to pure object
Getting started
npm install modern-map
yarn add modern-map
API Document
Map.create<T>(limitSize?: number): Partial<T>
Initialize function.
Parameters:
- limitSize (optional): Set limit size of modern-map. If not set, will be infinite size.
import Map from 'modern-map'
const obj = Map.create()
obj.key = value
obj[key] = value
obj.key
obj[key]
If you using typescript and want to set type of map.
import Map from 'modern-map'
interface Data {
item1: number
item2: boolean
}
const obj = Map.create<Data>()
obj.item1 = 0
Map.length [number]
Return size of map
obj.length
How to use loop?
same as pure object
import Map from 'modern-map'
const obj = Map.create()
obj['example'] = 1
Object.keys(obj)
Compatibility
all browsers that support Proxy
Author
Jungwoo-An
License
MIT