JSPM

c3-linearization

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1047
  • Score
    100M100P100Q149886F
  • License MIT

A package that implements the C3 linearization algorithm

Package Exports

  • c3-linearization

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (c3-linearization) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

c3-linearization

Build Status npm version

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

Usage

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']
// }

This works well for languages like Solidity, but Python is a bit more strict in the cases that it accepts. For Python-style MRO, set the python option to true.

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

Author

Federico Bond

License

MIT