0.5.4 • Published 11 years ago

roole-node v0.5.4

Weekly downloads
29
License
-
Repository
github
Last release
11 years ago

roole-node

A collection of node utility functions for the Roole language

Example

var Node = require('roole-node');
var node = { type: 'null' };
var clone = Node.clone(node);

node !== clone;
clone.type === 'null';

API

Node.clone(node)

Return a cloned version of node.

Node.equal(node1, node2)

Test if the two nodes are of the same type and contain equal children. Both of them can be an array of nodes.

Node.toNumber(node)

Convert node to a number. Return undefined if the convertion is impossible.

Node.toString(node)

Convert node to a string. Return undefined if the convertion is impossible.

Node.toBoolean(node)

Convert node to a boolean. Return undefined if the convertion is impossible.

Node.toArray(node)

Convert node to an array. Return undefined if the convertion is impossible.

Node.toListNode(node)

Convert node to a node of type list. Return undefined if the convertion is impossible.

Node.perform(operator, left, right)

Perform math operation on nodes left and right. operator can be one of '+', '-', '*', '/' and '%'. Throw an error if the operation can not be performed.

Node.toOppositeNode(node)

Convert node denoting a position (e.g., left) to an opposite position (e.g., right). Return original node if the convertion is impossible.

0.5.4

11 years ago

0.5.3

11 years ago

0.5.2

11 years ago

0.5.1

11 years ago

0.5.0

11 years ago

0.4.0

11 years ago

0.3.0

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago