the-simplifier
  • ๐Ÿ’šWelcome!
  • ๐Ÿ“ฆInstalling
  • Functions
    • The Simplifier Functions
  • ๐ŸŽซValidators
    • ๐ŸŸขisWebsiteUp
    • #๏ธโƒฃ isValidHexColor
  • ๐ŸŽกConverters
    • โฑ๏ธconvertTime
    • ๐Ÿ”ตconvertColors
  • ๐Ÿ“”Formatters
    • ๐Ÿ”ขNumberFormatter
  • ๐Ÿ“ธOCR
    • ๐Ÿ“‘๐Ÿ“ท readImage
  • โŒFakes
    • ๐ŸงชcreateFakeUser
  • ๐Ÿ”…Modified native functions
    • ๐Ÿ“œMap
  • ๐ŸŒNo category
    • ๐Ÿ”ƒgetRandomFromArray
    • ๐Ÿ” generateChars
    • ๐Ÿ”„getRandomInt
Powered by GitBook
On this page

Was this helpful?

  1. Modified native functions

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

PreviousModified native functionsNextNo category

Last updated 4 years ago

Was this helpful?

๐Ÿ”…
๐Ÿ“œ