New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

modern-map

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modern-map

modern-map is can limit size and save anything

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Modern Map

This is simply, easily, able to limit, similar to pure object

Getting started

# Install via npm
npm install modern-map

# Install via yarn (Recommend)
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()

// getter and setter is same as pure object

// set value
obj.key = value
// or
obj[key] = value

// get value
obj.key
// or
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>() // return type is Partial<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) // ['example']

Compatibility

all browsers that support Proxy

Author

Jungwoo-An

License

MIT

Keywords

FAQs

Package last updated on 20 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc