Skip to content

0.2.0

Latest
Compare
Choose a tag to compare
@nberlette nberlette released this 27 Nov 04:40
· 1 commit to main since this release
0.2.0
de688c7

🆕 Typechecks + Assertions

Note - each of these new checks has an accompanying assert.{x} method of the same name.

  • is.entry: for singleton pairs - [key, value]
  • is.entries: for groups of pairs - [key, value][]
  • is.key: ensure key exists in object/array/collection
  • is.value: ensure value exists in object/array/collection
  • is.propertyDescriptor: generic PropertyDescriptor type
  • is.accessorDescriptor: accessor props with getters/setters
  • is.dataDescriptor: standard props with value
  • is.request: HTTP Request
  • is.response: HTTP Response
  • is.headers: HTTP Headers
  • is.url: URL string / URL instance
  • is.every: alias to is.all
  • is.some: alias to is.any
  • is.none: negated version of is.any/is.all
  • is.sparseArray: arrays where [].filter(Boolean).length != [].length

Assertions now available as is.assert

All of the new methods above are accompanied by an assertion counterpart. Furthermore, all assertions have been aliased under the assert property of the main is export., meaning you can now use all of this module's features with a single import statement:

import is from "https://deno.land/x/dis@0.2.0/mod.ts";

is("deno911") // => "string"

is.numericString("100") // => true

is.assert.numericString("oh no!") // => TypeError

🚧 Deprecated Methods

  • is.function_
  • is.null_
  • is.class_
  • is.NaN

🐛 Bug Fixes

  • enumerability issue w/ is.function, is.null, and is.class
  • enumerability issue w/ is.assert (mirror of the assert export)
  • compilerOptions conundrum with keyOfStringsOnly >_>
  • some other stuff...