GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — want `assert.integer` · Issue #5 · TritonDataCenter/node-assert-plus

want assert.integer #5

New issue
Copy link
New issue
Copy link
Open
Open
want assert.integer#5
Copy link

Description

@trentm
trentm
opened on Oct 30, 2012
Issue body actions

"number" isn't specific enough sometimes.

Reacted by Julien Gilli and Tashi D. Gyeltshen

Activity

  1. trentm commented on Oct 30, 2012

    @trentm
    trentm
    on Oct 30, 2012
    ContributorAuthor
    More actions

    Maybe this is featuritis. Dunno. E.g. would want to specify if it is a positive int. Anyway, just noting this here.

  2. bahamas10 commented on Sep 8, 2015

    @bahamas10
    bahamas10
    on Sep 8, 2015
    Contributor
    More actions

    +1 I could see benefit to this. They way I see assert-plus is as a library that adds certainty to variable types that compiled languages get for free... for example:

    void func(int a, char *b) {
    }

    When func is called, you know 100% you have an int and char pointer. whereas with javascript, we can emulate it with:

    function func(a, b) {
      assert.integer(a);
      assert.string(b);
    }

    I still maintain, however, that NDEBUG is key here, and a proper development cycle should render it that, in production, these assertions are unnecessary.

    Regardless, I'm +1 on assert.integer and assert.positiveInteger

    function isInteger(i) {
      return typeof (i) === 'number' && i % 1 === 0;
    }
    function isPositiveInteger(i) {
      return isInteger(i) && i >= 0;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.