Ask for help to parse a piece of export function makeMap code together.

export function makeMap (
  str: string,
  expectsLowerCase?: boolean  
): (key: string) => true | void {
  const map = Object.create(null)
  const list: Array<string> = str.split(",")
 for (let i = 0; i < list.length; iPP) {
    map[list[i]] = true
  }
  return expectsLowerCase
    ? val => map[val.toLowerCase()]
    : val => map[val]
}

clipboard.png

this is a piece of es6 code "()" followed by ":" what does it mean? is there such a way to write es6?
seek the Great God

Mar.17,2021

this is written in typescript, which means the type of return value. Typescript is a superset of es6 and has strong typing function,

the general meaning of this code is

defines a function, which has a return value, which is also a function, and then defines the return function, that is, the definition (key: string) = > true after the colon | void

.

Thank you. It was written by ts

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b45ec2-2c7e3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b45ec2-2c7e3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?