How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • assert.isOk('everything', 'everything is ok');
    assert.isOk(false, 'this will fail');
    
    Docs
  • const assert = require('assert/strict');
    
    assert.ok(true);
    // OK
    assert.ok(1);
    // OK
    
    assert.ok();
    // AssertionError: No value argument passed to `assert.ok()`
    
    assert.ok(false, 'it\'s false');
    // AssertionError: it's false
    
    // In the repl:
    assert.ok(typeof 123 === 'string');
    // AssertionError: false == true
    
    // In a file (e.g. test.js):
    assert.ok(typeof 123 === 'string');
    // AssertionError: The expression evaluated to a falsy value:
    //
    //   assert.ok(typeof 123 === 'string')
    
    assert.ok(false);
    // AssertionError: The expression evaluated to a falsy value:
    //
    //   assert.ok(false)
    
    assert.ok(0);
    // AssertionError: The expression evaluated to a falsy value:
    //
    //   assert.ok(0)
    Docs
  • function bufNEquals(a, b, n) {
        assert.ok(a.length >= n, format(
            'buffer "a" length (%d) is shorter than "n" (%d)', a.length, n));
        assert.ok(b.length >= n, format(
            'buffer "b" length (%d) is shorter than "n" (%d)', b.length, n));
    
        for (var i = 0; i < n; i++) {
            if (a[i] !== b[i]) {
                return false;
            }
        }
        return true;
    }
    
    
    /joyent/eng mpl-2.0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples