Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-preset-cosmo

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-cosmo

Babel preset for cosmo cli

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

babel-preset-cosmo

Babel preset for Cosmo CLI

If you have bootstrapped your project with cosmo, you are already using this preset. If you would like to configure it, Add .babelrc to your project root. Cosmo will use that as babel config instead of default preset.

To use it in a non-cosmo project, Follow the steps bellow:

Install

$ npm install @babel/core @babel/cli babel-preset-cosmo

$ npm install @babel/runtime --save

Or using yarn:

$ yarn add --dev @babel/core @babel/cli babel-preset-cosmo

$ yarn add @babel/runtime

Usage

In your .babelrc:

{
  "presets": ["cosmo"]
}

ESNext supported features:

  • All the features supported by babel-preset-env

  • Support for flow types:

const add = (x: number, y: number): number => x + y;
  • Class properties
class Dog {
  bark = () => console.log("Wooof!");
}
  • Async/Await
const sleep = ms => new Promise(res => setTimeout(res, ms));

const logAfterTenMs = async () => {
  await sleep(10);
  console.log("This will log after 10ms");
};
  • Object rest-spread
// Rest properties
let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
console.log(x); // 1
console.log(y); // 2
console.log(z); // { a: 3, b: 4 }

// Spread properties
let n = { x, y, ...z };
console.log(n); // { x: 1, y: 2, a: 3, b: 4 }

License

MIT © Sid Doshi

FAQs

Package last updated on 01 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc