SOLFIND
Web Lens
Portal home

@babel/plugin-proposal-partial-application · Babel

https://babeljs.io/docs/babel-plugin-proposal-partial-application • 45 KB fetched
Open original page


@babel/plugin-proposal-partial-application · Babel Skip to main content Docs Setup Try it out Videos Blog Search Donate Team GitHub * Modules * TC39 Proposals * Stage 3 * Early stages * async-do-expressions * destructuring-private * discard-binding * do-expressions * export-default-from * function-bind * function-sent * import-defer * optional-chaining-assign * partial-application * pipeline-operator * record-and-tuple * throw-expressions * syntax-module-blocks * Web Compatibility * * TC39 Proposals * Early stages * partial-application On this page @babel/plugin-proposal-partial-application Example ​ (examples are from proposal) JavaScript function add ( x , y ) { return x + y ; } const addOne = add ( 1 , ? ) ; // apply from the left addOne ( 2 ) ; // 3 const addTen = add ( ? , 10 ) ; // apply from the right addTen ( 2 ) ; // 12 let newScore = player . score | > add ( 7 , ? ) | > clamp ( 0 , 100 , ? ) ; // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. Valid Usage ​ JavaScript f ( x , ? ) // partial application from left f ( ? , x ) // partial application from right f ( ? , x , ? ) // partial application for any arg o . f ( x , ? ) // partial application from left o . f ( ? , x ) // partial application from right o . f ( ? , x , ? ) // partial application for any arg super . f ( ? ) // partial application allowed for call on |SuperProperty| Invalid Usage ​ JavaScript f ( x + ? ) // `?` not in top-level Arguments of call x + ? // `?` not in top-level Arguments of call ?. f ( ) // `?` not in top-level Arguments of call new f ( ? ) // `?` not supported in `new` super ( ? ) // `?` not supported in |SuperCall| Installation ​ * npm * Yarn * pnpm * Bun npm install --save-dev @babel/plugin-proposal-partial-application yarn add --dev @babel/plugin-proposal-partial-application pnpm add --save-dev @babel/plugin-proposal-partial-application bun add --dev @babel/plugin-proposal-partial-application Usage ​ With a configuration file (Recommended) ​ babel.config.json { "plugins" : [ [ "@babel/plugin-proposal-partial-application" , { "version" : "2018-07" } ] ] } Via Node API ​ JavaScript require ( "@babel/core" ) . transformSync ( "code" , { plugins : [ [ "@babel/plugin-proposal-partial-application" , { version : "2018-07" } ] ] , } ) ; Options ​ History Version Changes v8.0.0 Added the version option with support for "2018-07" version (required) ​ There is only one version currently supported: * "2018-07" is the proposal version after the updates that was discussed in the July 2018 TC39 meeting. References ​ * Proposal: Partial Application Edit this page Previous optional-chaining-assign Next pipeline-operator * Example * Valid Usage * Invalid Usage * Installation * Usage * With a configuration file (Recommended) * Via Node API * Options * version (required) * References Docs * Learn ES2015 Community * Videos * User Showcase * Stack Overflow * Slack Channel * X (Twitter) * Bluesky More * Blog * GitHub Org * GitHub Repo * Website Repo * Old 7.x Site * Old 6.x Site * Old 5.x Site

Links found on this page

  1. Skip to main content [direct]
  2. Docs [direct]
  3. Setup [direct]
  4. Try it out [direct]
  5. Videos [direct]
  6. Blog [direct]
  7. Donate [direct]
  8. Team [direct]
  9. GitHub [direct]
  10. Modules [direct]
  11. TC39 Proposals [direct]
  12. Early stages [direct]
  13. destructuring-private [direct]
  14. discard-binding [direct]
  15. do-expressions [direct]
  16. export-default-from [direct]
  17. function-bind [direct]
  18. function-sent [direct]
  19. import-defer [direct]
  20. optional-chaining-assign [direct]
  21. pipeline-operator [direct]
  22. record-and-tuple [direct]
  23. throw-expressions [direct]
  24. syntax-module-blocks [direct]
  25. Web Compatibility [direct]
  26. Proposal: Partial Application [direct]
  27. Edit this page [direct]
  28. Learn ES2015 [direct]
  29. User Showcase [direct]
  30. Stack Overflow [direct]
  31. Slack Channel [direct]
  32. X (Twitter) [direct]
  33. Bluesky [direct]
  34. GitHub Org [direct]
  35. Website Repo [direct]
  36. Old 7.x Site [direct]
  37. Old 6.x Site [direct]
  38. Old 5.x Site [direct]