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
      - 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
  2. 29 Sep, 2018 1 commit
  3. 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.
  4. 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
  5. 19 Sep, 2018 2 commits
    • Stefan Cameron's avatar
      Update some TODO items · d2391fc3
      Stefan Cameron authored
    • 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:
      // 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:
      [PLAIN_OBJECT, {$: {...}}]
      [OBJECT, {$: {...}}]
      This change makes the type system, and the library, more extensible
      going forward.
      Coverage: 100%
  6. 15 Sep, 2018 2 commits
  7. 14 Sep, 2018 2 commits
  8. 11 Sep, 2018 1 commit
  9. 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.
  10. 08 Sep, 2018 2 commits
  11. 06 Sep, 2018 1 commit
  12. 05 Sep, 2018 1 commit
  13. 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%!
  14. 01 Sep, 2018 1 commit
  15. 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%!!
  16. 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).
    • 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.
  17. 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...
  18. 14 Jul, 2018 2 commits
  19. 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:
        finite: 5,
        string: ''
      }, {
        finite: rtv.t.FINITE,
        string: [rtv.q.EXPECTED, rtv.t.STRING]
      Unit tests remain now, to get back to 100% coverage.
  20. 14 Jun, 2018 1 commit
  21. 09 Jun, 2018 3 commits
  22. 03 Jun, 2018 1 commit
  23. 31 May, 2018 1 commit
  24. 29 May, 2018 1 commit
  25. 28 May, 2018 1 commit
  26. 25 May, 2018 2 commits
  27. 22 May, 2018 1 commit
  28. 21 May, 2018 3 commits
  29. 14 Apr, 2018 1 commit