Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Transforms #16

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Add Transforms #16

wants to merge 9 commits into from

Commits on Dec 8, 2019

  1. (feat): simple version of transforms

    - object with `toStorage` and `fromStorage` functions
      - `toStorage` is called after removing whitelist and blacklists and
        before serializing to JSON
      - `fromStorage` is called after deserializing from JSON
    agilgur5 committed Dec 8, 2019
    Configuration menu
    Copy the full SHA
    8bba87c View commit details
    Browse the repository at this point in the history
  2. (refactor): whitelist and blacklist as transforms

    - so that these can work as examples and so that their order is very
      explicit as they're treated like any other transform internally
    
    - create new transforms/ directory that will hold all built-in
      transforms moving forward
      - and export them in transforms/index.ts
    agilgur5 committed Dec 8, 2019
    Configuration menu
    Copy the full SHA
    a4d8f16 View commit details
    Browse the repository at this point in the history
  3. (optim): return early if white|blacklist doesn't exist

    - more importantly, makes the logic a little simpler / easier to read
    agilgur5 committed Dec 8, 2019
    Configuration menu
    Copy the full SHA
    c12fd90 View commit details
    Browse the repository at this point in the history
  4. (docs): transforms usage & example, ordering & visual

    - describe usage, link to MST snapshots, show typings, and link to
      internal examples of whitelist and blacklist transforms
      - use commit permalink for internal transforms so it won't 404 or
        change over time (though ofc will need to be updated if the
        transforms API changes)
    - describe ordering and show a small diagram of it end-to-end
    agilgur5 committed Dec 8, 2019
    Configuration menu
    Copy the full SHA
    86099a1 View commit details
    Browse the repository at this point in the history
  5. (docs): README is not longer than the source anymore :'(

    - more because we added whitespace and split up functionality, not
      because transforms are in any way a big code addition (~15 LoC)
    agilgur5 committed Dec 8, 2019
    Configuration menu
    Copy the full SHA
    ac1bbf3 View commit details
    Browse the repository at this point in the history
  6. (refactor): w/blist transform args shouldn't be optional

    - the array passed into the transforms should be required
      - same for arrToDict function
      - they're now called only when array is defined, and I think that
        behavior is more intuitive -- it should error if the array isn't
        defined
        - (test): in internal usage, they're never undefined, so this was
          reducing coverage because it was dead code
        - if the transforms were to eventually be externally visible /
          import-able, they should definitely throw an error in that case
          too -- if external users pass undefined to it
          - and the typings change means it'll happen at design-time too
          - definitely think it's more intuitive for external users this
            way too
    
    - (docs): use this commit for w/blist transform examples
      - or a variant of this commit -- just one where arr is required
    agilgur5 committed Dec 8, 2019
    Configuration menu
    Copy the full SHA
    6b51a29 View commit details
    Browse the repository at this point in the history
  7. (test): ensure transforms apply and do so in correct order

    - yay back to 100% code coverage now!
      - there's a transform branch missing bc there's no test case where
        there's something in storage and at least one toStorage-only
        transform
        - but covering this else branch doesn't really matter
    
    - create some transform fixtures
    - abstract out a setItem function
    
    - should consider splitting the tests and fixtures into separate files
      soon, esp now that we have a few different test suites here
    agilgur5 committed Dec 8, 2019
    Configuration menu
    Copy the full SHA
    8417f22 View commit details
    Browse the repository at this point in the history
  8. (docs): add link to fixtures as another transform example

    - not necessarily the most useful transforms there, but they are
      examples nonetheless
      - and they show both to and from Storage usage
    agilgur5 committed Dec 8, 2019
    Configuration menu
    Copy the full SHA
    7998213 View commit details
    Browse the repository at this point in the history

Commits on Dec 17, 2019

  1. (docs): add an example of building a custom transform

    - now docs are roughly same size as source
      - and README is getting a bit unwieldy, thinking about splitting the
        Transform docs into their own file
    agilgur5 committed Dec 17, 2019
    Configuration menu
    Copy the full SHA
    a117d91 View commit details
    Browse the repository at this point in the history