@aegenet/belt-obj-to-map
v2.3.0
Published
Object to Map
Downloads
84
Readme
@aegenet/belt-obj-to-map
Object to Map
💾 Installation
yarn add @aegenet/belt-obj-to-map@^2.0.0
# or
npm i @aegenet/belt-obj-to-map@^2.0.0
📝 Usage
import { objectToMap } from '@aegenet/belt-obj-to-map';
objectToMap(null).size // 0
objectToMap(undefined).size // 0
objectToMap({}).size // 0
const map = objectToMap({ id: 1 });
// map.size => 1
// map.has('id') => true
// map.get('id') => 1
const instance = new (class {
id = 1;
})();
const map = objectToMap(instance);
// map.size => 1
// map.has('id') => true
// map.get('id') => 1