vdata-parser
Version:
Parse vdata (ics, vcal, vcard) to javscript objects.
85 lines (54 loc) • 1.99 kB
Markdown
Parse vdata (ics, vcal, vcard) to javscript objects.
## Getting Started
Install the module with: `npm install vdata-parser`
```javascript
var parser = require('vdata-parser');
```
Parse a string and return a object which contains the data which parsed.
Return: `Object` - The parsed data
* Type: `String`
The string contains the vdata which should be parsed.
Parse the file and execute the given callback.
* Type: `String`
The file which should be parsed.
* Type: `Function`
The function which is called if file is successful finished or an error was occurred. The callback is called with two arguments: `err` and `data`. The argument `err` is `null` and `data` is an `object` if no error is occurred.
Parse a file synchronic.
Return: `Object` - The parsed data
* Type: `String`
The file which should be parsed.
```javascript
var parser = require('vdata-parser');
// ... define variable `string` ...
var data = parser.fromString(string);
console.dir(data);
```
```javascript
var parser = require('vdata-parser');
parser.fromFile(__dirname + '/file', function (err, data) {
if (err) throw err;
console.dir(data);
});
```
```javascript
var parser = require('vdata-parser');
var data = parser.fromFileSync(__dirname + '/file');
console.dir(data);
```
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
Copyright (c) 2014 Florian Goße. Licensed under the MIT license.