GithubHelp home page GithubHelp logo

dphilipson / transducist Goto Github PK

View Code? Open in Web Editor NEW
135.0 5.0 9.0 1.41 MB

Ergonomic JavaScript/TypeScript transducers for beginners and experts.

License: MIT License

TypeScript 99.08% JavaScript 0.09% Shell 0.83%
transducers typescript lazy chain javascript

transducist's People

Contributors

dphilipson avatar teves-castro avatar zhuangya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

transducist's Issues

.flatten() incorrectly typed

TansformationChain.flatten: void

This expression is not callable. Type 'void' has no call signatures.

.flatten appears to be wrongly typed

Code example:

chainFrom(someData)
.filter(({ prop }) => prop)
.map(({ prop }) => prop * 2)
.flatten() // Error
.toArray()

Typescript: filter function does not respect type guards in type inference

If there a type guard function is passed to the filter in the transducer, the resulting inferred type does not respect the type guard, unlike the native filter function. It works with explicit typing, but that is obviously cumbersome in more complex situations.

import { map, filter, transduce, compose, toArray } from 'transducist'

const k: Array<number | undefined> = [1, 2, undefined]

const l = transduce(
  k,
  compose(
    filter((i: number | undefined): i is number => i !== undefined),
    map((i) => i * 2) // Error: i  is possibly undefined
  ),
  toArray()
)

const r = k
  .filter((i: number | undefined): i is number => i !== undefined)
  .map((i) => i * 2) // No error

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.