# babel-plugin-transform-lazy

> Allow swift-like `lazy` keyword before class properties.

Latest version **0.0.2** (published 2019-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-transform-lazy
pnpm add babel-plugin-transform-lazy
yarn add babel-plugin-transform-lazy
bun add babel-plugin-transform-lazy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-03-18 |
| First published | 2019-03-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6 |
| Dependencies | 0 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | kaelzhang |
| Maintainers | kael |
| Keywords | babel-plugin-transform-lazy, lazy, babel-plugin, babel, lazy initialize |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-transform-lazy
- Repository: https://github.com/kaelzhang/babel-plugin-transform-lazy
- Homepage: https://github.com/kaelzhang/babel-plugin-transform-lazy#readme
- Issues: https://github.com/kaelzhang/babel-plugin-transform-lazy/issues
- npm.io page: https://npm.io/package/babel-plugin-transform-lazy

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2019-03-18
- 0.0.1 — 2019-03-18
- 0.0.0 — 2019-03-18

## README

[![Build Status](https://travis-ci.org/kaelzhang/babel-plugin-transform-lazy.svg?branch=master)](https://travis-ci.org/kaelzhang/babel-plugin-transform-lazy)
[![Coverage](https://codecov.io/gh/kaelzhang/babel-plugin-transform-lazy/branch/master/graph/badge.svg)](https://codecov.io/gh/kaelzhang/babel-plugin-transform-lazy)
<!-- optional appveyor tst
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/kaelzhang/babel-plugin-transform-lazy?branch=master&svg=true)](https://ci.appveyor.com/project/kaelzhang/babel-plugin-transform-lazy)
-->
<!-- optional npm version
[![NPM version](https://badge.fury.io/js/babel-plugin-transform-lazy.svg)](http://badge.fury.io/js/babel-plugin-transform-lazy)
-->
<!-- optional npm downloads
[![npm module downloads per month](http://img.shields.io/npm/dm/babel-plugin-transform-lazy.svg)](https://www.npmjs.org/package/babel-plugin-transform-lazy)
-->
<!-- optional dependency status
[![Dependency Status](https://david-dm.org/kaelzhang/babel-plugin-transform-lazy.svg)](https://david-dm.org/kaelzhang/babel-plugin-transform-lazy)
-->

# babel-plugin-transform-lazy

(WORKING IN PROGRESS, DO NOT USE) Allow swift-like `lazy` keyword before class properties.

## Install

```sh
$ npm i babel-plugin-transform-lazy
```

## Usage

```js
class Foo {
  lazy x = createX(this.bar)

  constructor (bar) {
    this.bar = bar
  }
}
```

Out:

```js
const X = Symbol('private:x')

class Foo {
  constructor (bar) {
    this.bar = bar
  }

  get x () {
    if (X in this) {
      return this[X]
    }

    const x = (() => createX(this.bar))()
    this[X] = x
    return x
  }

  set x (value) {
    this[X] = value
  }
}
```

## License

MIT

---
_Source: https://npm.io/package/babel-plugin-transform-lazy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
