1. 08 Oct, 2018 1 commit
    • Stefan Cameron's avatar
      Hardening, clean-up, but fixes, improvements · 0197ceff
      Stefan Cameron authored
      While updating the README,
      
      - found a few minor issues which I fixed
      
      - updated the API docs
      
      - added more integration tests (to verify README examples)
      
      - added support for regexp testing to STRING_args, fixing issue
        #2
      
      - custom validators can now return truthy values (or nothing) to
        pass verification, or either throw errors or return falsy values
        to fail verification
      
      - renamed 'FlagSpec' to 'Flags' in various argument properties
        since that seemed more intuitive, and it's closer to
        `RegExp`'s `flags` argument, which is what it relates to
      0197ceff
  2. 26 Sep, 2018 1 commit
    • Stefan Cameron's avatar
      Fix some bugs with ARRAY, OBJECT, ANY_OBJECT, PLAIN_OBJECT, CLASS_OBJECT · 47fc256b
      Stefan Cameron authored
      There were some linguering bugs with these types from the recent change
      to require object type args with the '$' for the shape, as well as
      array with args.ts with the typeset still around that existing tests
      were skirting around. Added more tests to make tests more robust!
      
      These were found thanks to a new 'integration.test.js' test suite
      I added. It's already proving its usefulness!
      
      This commit also removes the value from RtvError's message property
      in case it happens to contain sensitive information. Please see the
      note on the `RtvError#path` property.
      47fc256b
  3. 22 Sep, 2018 1 commit
    • Stefan Cameron's avatar
      Beautify and fix the API documentation · 42a42cff
      Stefan Cameron authored
      *   Fix INT -> SAFE_INT
      
      *   Remove completed TODOs
      
      *   Clarify example titles
      
      *   Fix missing rtvref.validation and rtvref.validator docs
      
          Also rename `validation/isValidator -> validation/isCustomValidator`
          to avoid confusion between custom validators in typesets, and
          type validators in the library.
      
      *   Clarify rtv.t and rtv.q enumerations
      
      *   Clean-up the rtv interface
      42a42cff
  4. 19 Sep, 2018 1 commit
    • Stefan Cameron's avatar
      Refactor object type args to place shape in '$' property · ee77ad56
      Stefan Cameron authored
      With this change, all object types (ANY_OBJECT, OBJECT, PLAIN_OBJECT,
      CLASS_OBJECT) now expect type args with a special '$' property that
      specifies the shape, rather than all but CLASS_OBJECT assuming that
      the type args are the shape itself. The only exception is when
      providing a shape as the typeset itself, as the first element in
      an Array typeset, or as the second element if a qualifier is used:
      
      ```javascript
      // shape as typeset:
      {...}
      
      // first element in Array typeset:
      [{...}]
      
      // second element with a qualifier:
      [OPTIONAL, {...}]
      ```
      
      In the three cases above, the DEFAULT_OBJECT_TYPE is implied.
      Otherwise, the shape must be specified in the type args:
      
      ```javascript
      [PLAIN_OBJECT, {$: {...}}]
      [OBJECT, {$: {...}}]
      ```
      
      This change makes the type system, and the library, more extensible
      going forward.
      
      Coverage: 100%
      ee77ad56
  5. 15 Sep, 2018 2 commits
  6. 14 Sep, 2018 1 commit
    • Stefan Cameron's avatar
      Add FLOAT type, change 'exact' to 'oneOf' in STRING and numeric types · a761f9cb
      Stefan Cameron authored
      FLOAT type was missing its validation and validator!
      
      STRING, NUMBER, FINITE, INT, SAFE_INT, and FLOAT now support, in
      their arguments, a 'oneOf' property (replacing 'exact') which can
      either be a single value or a list of values. If a list, then the
      value being checked must find an exact match (`===`) in the list.
      Empty lists are ignored.
      
      Coverage: 100%
      a761f9cb
  7. 11 Sep, 2018 1 commit
  8. 09 Sep, 2018 1 commit
    • Stefan Cameron's avatar
      Get publishing-ready, remove dist from git, add pre-commit hooks · 755f01c1
      Stefan Cameron authored
      With this commit, the built distro is no longer committed to the
      repo. It's generated post-install and pre-publish with the
      npm 'prepare' script. Tests are run pre-publish. Linting and API
      documentation are run pre-commit. API docs have moved to API.md
      in the repo root so that they're available online. They are also
      included in the distro that will be published to npm sometime in
      the near future.
      
      Also, I discovered that test code wasn't being linted! So I added
      those source files and got rid of the accumulated lint.
      755f01c1
  9. 08 Sep, 2018 2 commits
  10. 06 Sep, 2018 1 commit
  11. 05 Sep, 2018 1 commit
  12. 03 Sep, 2018 1 commit
    • Stefan Cameron's avatar
      Add DATE, ERROR, PROMISE types · 0ca8b0ea
      Stefan Cameron authored
      Also refine OBJECT definition to exclude `new String()`, `new Number()`,
      and `new Boolean()` since it didn't make sense to include these
      (they're still included in ANY_OBJECT) based on the way that OBJECT
      is meant to be used.
      
      Coverage remains at 100%!
      0ca8b0ea
  13. 01 Sep, 2018 1 commit
  14. 19 Aug, 2018 1 commit
    • Stefan Cameron's avatar
      Added Null validator, validators now handle null/undefined, 100% coverage · 2ffe570e
      Stefan Cameron authored
      For properties/values that are expected to be `null`, the `valNull`
      validator will now handle it.
      
      Validators must now also handle `null` and `undefined` values according
      to the specified qualifier, returning success if the given value is
      one or the other, as long as the qualifier permits those values. For
      example, if the qualifier is EXPECTED and the value is `null`, then
      any validator would return success for that value. Given the same
      qualifier, but a value of `undefined`, all validators (except for
      the ANY type which is somewhat of an exception) would return an error
      because that value is not permitted given that qualifier.
      
      To help with `null` and `undefined` values, a new `nilPermitted()`
      method is provided by the `qualifiers` module.
      
      Finally, test coverage is back to 100%!!
      2ffe570e
  15. 06 Aug, 2018 2 commits
    • Stefan Cameron's avatar
      Fix isString Validation to disallow empty strings by default · e91f6706
      Stefan Cameron authored
      Validations should always implement the REQUIRED qualifier type
      rules when there's different behavior according to the qualifier.
      
      For strings, it's really handy to test for strings even when they're
      empty, so an option is added to the Validation to permit empty
      strings (default behavior disallows them).
      e91f6706
    • Stefan Cameron's avatar
      MAJOR REFACTORING: ARRAY args, validations, and validators · d399830e
      Stefan Cameron authored
      All tests are passing, however coverage has dropped and needs
      some attention.
      
      - ARRAY type: In fully-qualified notation, the typeset must now
        be specified in the `typeset` property of the args object. The
        shorthand notation is no longer supported in fully-qualified
        typesets (i.e. an element with a JavaScript type of Array directly
        inside an Array typeset is no longer valid). This makes Arrays
        no longer a syntactical exception, keeping things more consistent.
      
        Shorthand: [[STRING]], array (possibly empty) of non-empty strings.
      
        Fully-qualified: [ARRAY, {typeset: STRING}], equivalent to above.
      
      - Validations and Validators:
      
        The primary motivation behind this major change was to get to the
        point where the Validators could return RtvSuccess/RtvError objects
        without causing cyclical dependency issues within the library.
      
        Validations (e.g. is<Type>() or is<Pseudo-Type>()) are now stictly
        used to check a value as being one of the types defined in this
        library. They do not consider type arguments, if applicable, and
        always validate assuming the REQUIRED qualifier. They are meant
        to be leaf modules. See /src/lib/validation/validation.jsdoc for
        more details. For example, isString() checks that a value is a
        non-empty string (which is the REQUIRED qualifier rule).
      
        Validators (e.g. val<Type>()) now use their pertaining Validations,
        consider the qualifier and args (as before), and now return an
        RtvSuccess object if validation passes, or an RtvError object if
        validation fails. This allows for better identification of errors
        in deeply-nested values (e.g. a shape that includes an array of
        shapes where the nested shape causes the failure). For example,
        valString() uses isString() and considers the qualifier (to permit
        an empty string in the non-REQUIRED case) and arguments, if any.
      d399830e
  16. 16 Jul, 2018 1 commit
    • Stefan Cameron's avatar
      Progressing but need to make BIG change to Array · 0681e185
      Stefan Cameron authored
      In the full notation, the typeset for the array
      elements must be moved into args so that calling
      the isArray() validator can behave the same as
      isMap() and call impl.check() on the typeset
      for each element in the array. This is the
      same as CLASS_OBJECT's validator which will
      need to get the shape from args and check
      each own-property...
      0681e185
  17. 14 Jul, 2018 2 commits
  18. 02 Jul, 2018 1 commit
    • Stefan Cameron's avatar
      Finished implementing impl.check*() functions · 6e2f3e9d
      Stefan Cameron authored
      Very preliminary/cursory check: it works!!!
      
      For example, this validates successful:
      
      ```javascript
      rtv.check({
        finite: 5,
        string: ''
      }, {
        finite: rtv.t.FINITE,
        string: [rtv.q.EXPECTED, rtv.t.STRING]
      });
      ```
      
      Unit tests remain now, to get back to 100% coverage.
      6e2f3e9d
  19. 14 Jun, 2018 1 commit
  20. 09 Jun, 2018 2 commits
  21. 03 Jun, 2018 1 commit
  22. 31 May, 2018 1 commit
  23. 29 May, 2018 1 commit
  24. 28 May, 2018 1 commit
  25. 25 May, 2018 2 commits
  26. 21 May, 2018 2 commits
  27. 14 Apr, 2018 1 commit
    • Stefan Cameron's avatar
      Return RtvSuccess success indicator on check/verify success · c3d1d818
      Stefan Cameron authored
      When rtv.check() or rtv.verify() succeeds, return an RtvSuccess
      object with a 'valid: true' property that compliments RtvError's
      'valid: false' property. This way, it's easy to do a conditional
      operation based on a successful/failed check (if you don't care
      about any error details):
      
          if (rtv.check('str', rtv.t.STRING).valid) {...} else {...}
      
      Also, a new rtv.c() shortcut to rtv.check() is added, to compliment
      rtv.v() -> rtv.verify().
      c3d1d818
  28. 13 Apr, 2018 1 commit
    • Stefan Cameron's avatar
      Implement impl.fullyQualify() · 956d1d9a
      Stefan Cameron authored
      Refined documentation on typesets and what constitutes a valid
      typeset.
      
      Coverage is still below 100%, but it'll eventually get back there
      as implementation continues.
      956d1d9a
  29. 08 Apr, 2018 1 commit
  30. 07 Apr, 2018 1 commit
    • Stefan Cameron's avatar
      Starting move to validation.js · fed0f7ff
      Stefan Cameron authored
      This module will abstract Lodash away from the rest of the library
      and add more validation logic where needed.
      
      This change also paves the way to return RtvError objects from
      check() methods when checks fail, and to throw them from rtv.verify()
      when verification fails.
      
      Unfortunately, some tests had to be disabled for now and coverage
      is less than 100%. :(
      fed0f7ff
  31. 26 Mar, 2018 1 commit
    • Stefan Cameron's avatar
      Really get to 100% test coverage · 99816957
      Stefan Cameron authored
      - discovered that istanbul was just reporting on Enumeration.js:
        had to install the babel-plugin-istanbul for test env and now
        it's reporting on everything
      - had to implement a few more tests to get to 100%...
      - completed rtv.config documentation (mostly)
      99816957
  32. 24 Mar, 2018 1 commit
  33. 17 Mar, 2018 1 commit