All Projects → dralletje → Idx.macro

dralletje / Idx.macro

Licence: mit
a 'babel-macros' version of 'babel-plugin-idx'

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Idx.macro

Babel Plugin Optimize Clsx
Babel plugin to optimize the use of clsx, classnames, and other libraries with a compatible API
Stars: ✭ 80 (-11.11%)
Mutual labels:  babel, babel-plugin
Generator Babel Plugin
Babel Plugin generator for Yeoman
Stars: ✭ 88 (-2.22%)
Mutual labels:  babel, babel-plugin
Postjss
Use the power of PostCSS in compiling with JSS
Stars: ✭ 40 (-55.56%)
Mutual labels:  babel, babel-plugin
Modify Babel Preset
💫 Create a modified babel preset based on an an existing preset.
Stars: ✭ 85 (-5.56%)
Mutual labels:  babel, babel-plugin
Catom
A 0 runtime CSS in JS library
Stars: ✭ 84 (-6.67%)
Mutual labels:  babel, babel-plugin
Babel Plugin Styled Components
Improve the debugging experience and add server-side rendering support to styled-components
Stars: ✭ 878 (+875.56%)
Mutual labels:  babel, babel-plugin
Babel Plugin Captains Log
Babel plugin that injects helpful details into console statements
Stars: ✭ 80 (-11.11%)
Mutual labels:  babel, babel-plugin
Faster.js
faster.js is a Babel plugin that compiles idiomatic Javascript to faster, micro-optimized Javascript.
Stars: ✭ 429 (+376.67%)
Mutual labels:  babel, babel-plugin
Tinker.macro
Evaluate Laravel code at build-time, via Laravel Tinker
Stars: ✭ 56 (-37.78%)
Mutual labels:  babel, babel-plugin
Babel Plugin Css Prop
Babel plugin to transpile `css` prop to a styled component. (Experimental)
Stars: ✭ 56 (-37.78%)
Mutual labels:  babel, babel-plugin
Babel Plugin Transform React Remove Prop Types
Remove unnecessary React propTypes from the production build. 🎈
Stars: ✭ 890 (+888.89%)
Mutual labels:  babel, babel-plugin
Sowing Machine
🌱A React UI toolchain & JSX alternative
Stars: ✭ 64 (-28.89%)
Mutual labels:  babel, babel-plugin
Htm
Hyperscript Tagged Markup: JSX alternative using standard tagged templates, with compiler support.
Stars: ✭ 7,299 (+8010%)
Mutual labels:  babel, babel-plugin
Compiled
A familiar and performant compile time CSS-in-JS library for React.
Stars: ✭ 1,235 (+1272.22%)
Mutual labels:  babel, babel-plugin
Babel Plugin Sitrep
Log all assignments and the return value of a function with a simple comment
Stars: ✭ 442 (+391.11%)
Mutual labels:  babel, babel-plugin
Xwasm
[Work In Progress] WebAssembly Packager and WASM tooling for modern frontend
Stars: ✭ 45 (-50%)
Mutual labels:  babel, babel-plugin
Babel Plugin React Remove Properties
Babel plugin for removing React properties. 💨
Stars: ✭ 327 (+263.33%)
Mutual labels:  babel, babel-plugin
I18nize React
Internationalize react apps within a lunch break
Stars: ✭ 389 (+332.22%)
Mutual labels:  babel, babel-plugin
Babel Plugin Root Import
Add the opportunity to import modules by the root path
Stars: ✭ 1,084 (+1104.44%)
Mutual labels:  babel, babel-plugin
Babel Plugin Partial Application
[DEPRECATED] Please use https://github.com/citycide/param.macro
Stars: ✭ 60 (-33.33%)
Mutual labels:  babel, babel-plugin

idx.macro

This is a babel-macros version of the babel plugin idx.

idx is a utility function for traversing properties on objects and arrays.

If an intermediate property is either null or undefined, it is instead returned. The purpose of this function is to simplify extracting properties from a chain of maybe-typed properties.

Usage

With babel-macros and this package installed, you can use it to like idx.

import idx from 'idx.macro';
const fiends_of_friends = idx(props, _ => _.user.friends[0].friends);

The above snippet will be compiled to:

const fiends_of_friends =
  props.user == null ? props.user :
  props.user.friends == null ? props.user.friends :
  props.user.friends[0] == null ? props.user.friends[0] :
  props.user.friends[0].friends

Soon?

Please please please https://github.com/tc39/proposal-optional-chaining

License

idx is MIT licensed. I copied it from the facebook idx license. I have no idea if I am doing this right (what is the PATENTS file?!), so please let me know if you know anything about this.

If the facebook people want to have idx.macro on their idx repo, or want the idx.macro name, just sent me a message :)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].