# astraia

> A library traversing AST

Latest version **0.0.2** (published 2019-01-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install astraia
pnpm add astraia
yarn add astraia
bun add astraia
```

## 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-01-25 |
| First published | 2018-08-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Yuichiro MORIGUCHI |
| Maintainers | ymoriguchi |
| Keywords | astraia, AST |

## Links

- npm: https://www.npmjs.com/package/astraia
- Repository: https://github.com/y-moriguchi/astraia
- Homepage: https://github.com/y-moriguchi/astraia#readme
- Issues: https://github.com/y-moriguchi/astraia/issues
- npm.io page: https://npm.io/package/astraia

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2019-01-25
- 0.0.1 — 2018-08-24
- 0.0.0 — 2018-08-15

## README

# Astraia
Astraia is a library of traversing objects.  
Astraia can be used by traversing abstract syntax tree (AST).

## How to use

### node.js
Install Astraia:
```
npm install astraia
```

Use module:
```js
var R = require('astraia');
```

### Browser
```html
<script src="astraia.js"></script>
```

## Examples

### Traversing AST of addtion or subtraction of constant
```js
var rules = [{
    	pattern: {
		    "type": A.eqv("add"),
	    	"left": A.number,
    	    "right": A.number
	    },
    	action: function(obj) {
	    	return obj.left + obj.right;
    	}
	}, {
		pattern: {
			"type": A.eqv("sub"),
			"left": A.number,
			"right": A.number
		},
		action: function(obj) {
			return obj.left - obj.right;
		}
    }];

// outputs 2
A.scan(rules, {
	"type": "add",
	"left": {
		"type": "add",
		"left": 1,
		"right": 2
	},
	"right": {
		"type": "sub",
		"left": 3,
		"right": 4
	}
});
```

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