# c3-linearization

> A package that implements the C3 linearization algorithm

Latest version **0.3.0** (published 2018-05-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install c3-linearization
pnpm add c3-linearization
yarn add c3-linearization
bun add c3-linearization
```

## 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.3.0 |
| Published | 2018-05-01 |
| First published | 2018-03-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | Federico Bond |
| Maintainers | federicobond |
| Keywords | c3, linearization |

## Links

- npm: https://www.npmjs.com/package/c3-linearization
- Repository: https://github.com/federicobond/c3-linearization
- Homepage: https://github.com/federicobond/c3-linearization#readme
- Issues: https://github.com/federicobond/c3-linearization/issues
- npm.io page: https://npm.io/package/c3-linearization

## Recent versions

- 0.3.0 (latest) — 2018-05-01
- 0.2.1 — 2018-04-16
- 0.2.0 — 2018-03-26
- 0.1.0 — 2018-03-23

## README

c3-linearization
================

[![Build Status](https://travis-ci.org/federicobond/c3-linearization.svg?branch=master)](https://travis-ci.org/federicobond/c3-linearization)
![npm version](https://img.shields.io/npm/v/c3-linearization.svg)

A package for doing Python-style C3-linearization in ECMAScript.

## Usage

```javascript
import { linearize } from 'c3-linearization'

linearize({
  'A': ['B', 'C'],
  'B': [],
  'C': ['D'],
  'D': []
})

// {
//   'A': ['A', 'B', 'C', 'D'],
//   'B': ['B'],
//   'C': ['C', 'D'],
//   'D': ['D']
// }
```

### Important notes

*Solidity* does linearization from right to left (you write the parents from most
base-like to most derived). This is exactly the reverse as in Python, where you
put the most derived classes to the left. To get correct results with Solidity,
set the `reverse` option to true.

```javascript
linearize('A': ['B', 'C'], { reverse: true })
```

*Python* is also a bit more strict in the cases that it accepts. For accurate
Python MRO, set the `python` option to true.

```javascript
linearize('A': ['B', 'C'], { python: true })
```

## Author

Federico Bond

## License

MIT

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