joelnet / MojiScript

MojiScript is an async-first, opinionated, and functional library

Home Page:https://mojiscript.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhance type/is is to detect Map and Set

joelnet opened this issue · comments

Enhance type/is is to detect Map and Set

Expected:

import is from 'mojiscript/type/is'

const map = new Map()
const set = new Set()

is (Map) (map) //=> true
is (Set) (set) //=> true

You can find some info on this here: https://stackoverflow.com/questions/35298314/check-if-a-javascript-object-is-map-or-set-ecmascript-2015

Acceptance Criteria

  • Map detects Maps
  • Set detects Sets
  • Update documentation to include Map and Set.
  • Include unit tests.

Hey @joelnet I've added unit tests for Map and Set and it looks like the current code already supports them. Also, where should the documentation be updated? I don't see mention of is() anywhere in the README or in the examples.

Oh I was just in that section (be sure to checkout the develop branch) #195

I wouldn't be surprised if it already detects it. I just added so many cases. Some basic tests would be a good idea.

You can find the docs here: https://github.com/joelnet/MojiScript/blob/master/API.md#is

Oh ok. I hadn't checked the API documentation.