1. 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.
  2. 22 Sep, 2018 2 commits
    • Stefan Cameron's avatar
    • 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
  3. 19 Sep, 2018 3 commits
    • Stefan Cameron's avatar
      Do not publish package-lock.json · 843493cc
      Stefan Cameron authored
      Commit it, but don't publish it, since it'll be ignored anyway:
      "One key detail about package-lock.json is that it cannot be
      published, and it will be ignored if found in any place other
      than the toplevel package."
    • 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%
  4. 15 Sep, 2018 2 commits
  5. 14 Sep, 2018 2 commits
  6. 11 Sep, 2018 1 commit
  7. 10 Sep, 2018 1 commit
  8. 09 Sep, 2018 2 commits
    • Stefan Cameron's avatar
      Use prepublishOnly only, not prepare · 7a3d5aca
      Stefan Cameron authored
      Since prepare scripts are run both after install and before publish,
      use prepublishOnly to run the build and generate the built source for
      publishing. Don't use prepare because it's not necessary to do any
      build steps post-install (since the built source and API docs are
      provided in the published bundle).
    • 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.
  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%!
  13. 01 Sep, 2018 2 commits
  14. 19 Aug, 2018 2 commits
    • Stefan Cameron's avatar
      Remove completed items · 811a4839
      Stefan Cameron authored
    • 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%!!
  15. 06 Aug, 2018 3 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
      The build from previous commit · fada480b
      Stefan Cameron authored
    • 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.
  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...
  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:
        finite: 5,
        string: ''
      }, {
        finite: rtv.t.FINITE,
        string: [rtv.q.EXPECTED, rtv.t.STRING]
      Unit tests remain now, to get back to 100% coverage.
  19. 14 Jun, 2018 1 commit
  20. 09 Jun, 2018 3 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