4.2.0 • Published 6 years ago

amorph v4.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

amorph

Amorphous javascript object: Express truths in many forms

Install

Install with npm

$ npm i amorph --save

Usage

  // Basic Usage

  const Amorph = require('amorph')
  const amorphHex = require('amorph-hex')
  const amorphInt = require('amorph-int')

  const myBalance  = Amorph.from(amorphHex, '0101')

  myBalance.to(amorphInt)
  // >> 257

  myBalance.as(amorphInt, (int) => {
    return int - 2
  }).to(amorphHex)
  // >> 'ff'

  // Custom Converters
  const AmorphConverter = require('amorph/lib/AmorphConverter')
  const amorphAscii = new AmorphConverter((uint8Array) => {
    // Given a uint8Array, returns ascii
    return asciiEncoder.encode(uint8Array)
  }, (ascii) => {
    // Given ascii, returns uint8Array
    return asciiEncoder.decode(ascii)
  })

  Amorph.from(amorphAscii, 'hello world!').to(hexConverter)
  // >> 68656c6c6f20776f726c6421

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

License

Copyright © 2016 Licensed under the MIT license.


This file was generated by readme-generator on November 03, 2016.

4.2.0

6 years ago

4.1.0

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago