1.1.0 • Published 7 years ago

reload-form v1.1.0

Weekly downloads
1
License
Unlicense
Repository
-
Last release
7 years ago
Implements the RELOAD (Really Efficient List Of Arbitrary Data) format as
used in OHRRPGCE (but you may use it in other programs too). Currently
version 1 of RELOAD is implemented. (If you want to read or write OHRRPGCE
files, you should look at my "hamarc" package too.)

This program is public domain.

This module exports a constructor called RELOAD, which constructs a RELOAD
document object. It takes one optional argument which is a buffer which
contains a serialized RELOAD document (possibly read from a file or from a
Hamster archive), which will then be loaded.

The properties of the instance are:

.add([name],[value],[enc])
  Add a new child node with the given name and value; return new node. You
  can specify a string as a value; if you do, it will automatically
  convert the string into a buffer; default encoding is "binary".

.append(doc)
  Append a child node, which must be one that already exists (you can use
  new RELOAD() to create one) that is not currently attached.

.children
  An array of child elements. You can alter the contents of this array; if
  you do you should ensure the parent is going to be set properly.

.delete()
  Delete this node. Cannot delete the root node. After it is deleted from
  the document it belongs to, you may append it as a child to another node
  in the same or a different document.

.evaluate([rpath])
  Evaluate a RPath expression. Returns a generator that yields them. Will
  yield all nodes (including the root) if the RPath expression is omitted.
  If you pass in numbers or strings for each next() call, then the final
  return value will be the sum of these number or concatenate of strings.
  Warning: The specification of RPath is not yet written and there is
  currently no guarantee of what the implementation will return if any
  argument is given at all!

.name
  The name of this element (a string).

.parent
  The parent node (null if it is the root node). Set this if you are
  adding a child node by altering the children array by yourself.

.serialize()
  Serialize this document into a buffer.

.value
  The value of this element, which is null, a number, or a buffer.

Note: The full range of 64-bit integers is not supported in JavaScript.
When writing a number that can't fit as a 32-bit integer, codes as a
double-precision floating-point number. Loading a 64-bit integer may
result in an improper value if the number to load is greater than
9007199254740991 or less than -9007199254740991.
1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago