Map
map.js
import { Map } from 'the-simplifier'
let func = () => {
let testMap = new Map()
testMap.set('testKey', 'testValue')
}
func() // Expected: Promise<void>
map.js
import { Map } from 'the-simplifier'
let func = () => {
let testMap = new Map()
testMap.set('testKey', 'testValue')
let getMap = testMap.get('testKey')
console.log(getMap)
}
func() // Expected: testValue
map.js
import { Map } from 'the-simplifier'
let func = () => {
let testMap = new Map()
testMap.set('testKey', 'testValue')
let mapKey = testMap.firstKey()
console.log(mapKey)
}
func() // Expected: testKey
map.js
import { Map } from 'the-simplifier'
let func = () => {
let testMap = new Map()
testMap.set('testKey', 'testValue')
let mapValue = testMap.firstValue()
console.log(mapValue)
}
func() // Expected: testValue
map.js
import { Map } from 'the-simplifier'
let func = () => {
let testMap = new Map()
testMap.set('testKey', 'testValue')
testMap.set('testKeyTwo', 'testValueTwo')
let mapValues = testMap.values()
console.log(mapValues)
}
func() // Expected: All "testMap" values
map.js
import { Map } from 'the-simplifier'
let func = () => {
let testMap = new Map()
testMap.set('testKey', 'testValue')
testMap.set('testKeyTwo', 'testValueTwo')
testMap.write(require('path').resolve(__dirname, 'path/to/json.json'))
}
func() // Expected: Write configured values in json - Promise
map.js
import { Map } from 'the-simplifier'
let func = () => {
let testMap = new Map({ load: require('path').resolve(__dirname, 'path/to/json.json') })
let jsonValue = testMap.get('Message')
console.log(jsonValue)
}
func() // Expected: Hello
Last updated
Was this helpful?