6.0.0 • Published 9 years ago

metadatio v6.0.0

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

npm version Build Status Coverage Status Dependency Status devDependency Status npm Inline docs

        super.addField(new Field({
            name: 'name',
            dataType: DataTypes.string,
            validators: {
                'pattern': new Validator(ValidatorTypes.regex, /^_?(\d|[a-zA-Z]|_|-)$/i),
                'lengths': new Validator(ValidatorTypes.lengths, { min: 2, max: 64 }
            }
        }));
    }

    static getInstance() {
        Foo.instance = new Foo();
        return Foo.instance;
    }
}

        ...
    }

    ...
}

        super.addField(new Field({
            name: 'foo',
            dataType: Foo.getInstance(),
            multiplicity: 'many'
        }));
    }

    ...
}

module.exports = {
    Foo: Foo.getInstance(),
    Bar: Bar.getInstance()
};
# and include it on your consumer projects
npm install --save my-project-metadata

let testItem = {
    name: 'test-value';
}
Foo.validate(testItem); // Returns true

testItem.name = '123n';
Foo.validate(testItem); // Returns false

There are several ongoing projects for building up some extensions of Metadatio core:
6.0.0

9 years ago

3.0.0

9 years ago

2.0.0

9 years ago

0.7.54

10 years ago

0.7.53

10 years ago

0.7.51

10 years ago

0.7.50

10 years ago

0.0.10

10 years ago

0.7.23

10 years ago

0.7.20

10 years ago

0.7.19

10 years ago

0.6.1

10 years ago

0.7.0

10 years ago

0.6.0

10 years ago

0.5.0

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago