0.1.7 • Published 12 years ago

piton-entity v0.1.7

Weekly downloads
82
License
-
Repository
github
Last release
12 years ago

piton-entity - Common functions to work with data entities

Tools for managing objects that represent business entities

Installation

$ npm install piton-entity

Usage

var EntityDefinition = require('piton-entity');

var entityDefinition = EntityDefinition.createEntityDefinition({
	name: {
		tag: ['update'],
		name: 'Full Name'
	},
	age: {
		type: 'number',
		defaultValue: 0
	},
	active: {
		type: 'boolean',
		defaultValue: true
	},
	phoneNumber: {
		tag: ['update']
	}
});

var blank = entityDefinition.makeBlank();
// blank is now equal to:
//	{
//		name: null,
//		age: null,
//		active: null,
//		phoneNumber: null
//	}

var default = entityDefinition.makeDefault();
// default is now equal to:
//	{
//		name: null,
//		age: 0,
//		active: true,
//		phoneNumber: null
//	}

var stripped = entityDefinition.stripUnknownProperties({
	name: 'Dom',
	extra: 'This should not be here'
});
// stripped is now equal to:
//	{
//		name: 'Dom'
//	}

Credits

Paul Serby Dom Harrington

Licence

Licenced under the New BSD License

0.1.7

12 years ago

0.1.6

12 years ago

0.1.5

12 years ago

0.1.4

12 years ago

0.1.3

12 years ago

0.1.2

13 years ago

0.1.1

13 years ago

0.1.0

13 years ago

0.0.12

13 years ago

0.0.11

13 years ago

0.0.10

13 years ago

0.0.9

13 years ago

0.0.8

13 years ago

0.0.7

13 years ago

0.0.6

13 years ago

0.0.5

13 years ago

0.0.4

13 years ago

0.0.3

13 years ago

0.0.2

13 years ago

0.0.1

13 years ago