Giter Site home page Giter Site logo

comp-select's People

Contributors

jimbol avatar

Watchers

 avatar  avatar

comp-select's Issues

Write additional selector transformers

.select(...inputSelectors, resultFunc): *

  • Operates on anything
  • Accepts 0 to n inputSelectors
  • Requires a resultFunc as the last argument
    • resultFunc receives selector outputs as arguments, in order
    • resultFunc receives previous output as the last argument
  • returns any value

.map(...inputSelectors, resultFunc): *

  • Operates on an array
  • Accepts 0 to n inputSelectors
  • Requires a resultFunc as the last argument
    • resultFunc receives selector outputs as arguments, in order
    • resultFunc gets called for each item in the previous output
    • resultFunc is expected to return true or false
  • returns any value

.reduce(...inputSelectors, resultFunc, accumulator): *

  • Operates on an array
  • Accepts 0 to n inputSelectors
  • Requires a resultFunc as the second to last argument
    • resultFunc receives selector outputs as arguments, in order
    • resultFunc gets called for each item in the previous output
    • resultFunc is expected to return true or false
  • returns any value

Task builder type checking

When invoking a task builder
Check that the proper arguments are passed

  • A selector task builder should receive a list of arrays
  • A populate task builder should the proper formats

Static tasks can only be type checked at the transformer level.

Allow tests

Testing

const sel = composableSelector(getSelectedFooIds)
  .populate(getFooHash)
  .filter(getBaz, (baz, foo = {}) => foo.id === baz.fooId)
  .getEach('name')
  .create();
it('gets the names for each selected foo on baz', () => {
  const obj = { name: 'Jam' };

  sel.test([1])
    .populate({ 1: obj })
    .filter({
      fooId: 1,
    })
    // Skips over static transformers
    .returns(['Jam']);
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.