1.0.2-alpha • Published 11 years ago

sonata-annotationparser v1.0.2-alpha

Weekly downloads
4
License
-
Repository
-
Last release
11 years ago

sonata-annotationparser

Annotation parser for Node.

Installation

$ npm install sonata-annotationparser

Install from source code repository:

$ git clone git@github.com:eyolas/sonata-annotationparser.git
$ cd sonata-annotationparser
$ npm install

Usage

Parsing without class of annotation

Create a new annotation parser.

var annotationsParser = require('sonata-annotationparser').AnnotationParser;
var parser = new annotationsParser();
var results = parser.extract(fileName, fileDir);

Parsing with annotation's class

Create an annotation

TestAnnotation.js

var AbstractAnnotation = require('sonata-annotationparser').AbstractAnnotation,
    Utils = require('sonata-annotationparser').UtilsAnnotations,
    inherits = require('util').inherits;

function TestAnnotation() {
    TestAnnotation.super_.call(this);
    this.tagName = 'Test';
}

inherits(TestAnnotation, AbstractAnnotation);

TestAnnotation.prototype.run = function(value, target, file, filePath) {
    if (Utils.isString(value) || (value === Object(value) && value.hasOwnProperty('name'))) {
        //...
    }
};

module.exports = ScopeAnnotation;

An object class

/**
 * @Test
 */
function object() {

}

Credits

License

(The MIT License)

Copyright (c) 2013 Touzet David

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.0.2-alpha

11 years ago

1.0.1-alpha

11 years ago

1.0.0-alpha

11 years ago