Alinex Format: Readme

GitHub watchers GitHub stars GitHub forks

npm package latest version Travis status Coveralls status Gemnasium status GitHub issues

This package will give you an easy way to serialize and deserialize different data objects into multiple formats.

The major features are:

  • easy to use
  • load format libraries on demand
  • auto detection

It is one of the modules of the Alinex Namespace following the code standards defined in the General Docs.

Install

NPM Downloads

The easiest way is to let npm add the module directly to your modules (from within you node modules directory):

Shell Script
npm install alinex-format --save

And update it to the latest version later:

Shell Script
npm update alinex-format --save

Always have a look at the latest changes.

Usage

To use the format you have to load the module first:

CoffeeScript Code
format = require 'alinex-format'

This gives you back the main format instance which holds two methods to use:

stringify

Serialize data object into string.

Arguments:

  • obj object to be formatted
  • format format to use or filename to read format from
  • options (optional) specific for the format
  • cb callback will be called with (err, text)

parse

Try to parse object from string. Auto detect if no format is given.

Arguments:

  • string text to be parsed
  • format (optional) format to use or filename to read format from
  • cb callback will be called with (err, object)

License

© Copyright 2016 Alexander Schilling

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.