0.0.3 • Published 8 years ago

firebase-bolt-validation v0.0.3

Weekly downloads
2
License
ISC
Repository
-
Last release
8 years ago

firebase-bolt-validation

Commonly used firebase type validation rules.

Dependent Project

Using the gulp plugin

Firstly you will need the modified gulp compiler as the root firebase compiler doesn't support import statments yet.

$ npm install gulp-firebase-bold

Secondly just install this module like any npm package

$ npm install firebase-bolt-validation

and finally make sure you include a reference to the specific module in your file. This only needs to be included once as a global import

$ import {'firebase-bolt-validation'}
path /uuid is UUID {
  read() {true}
  write() {auth != null}
}

which should give the following in your JSON.

 "uuid": {
  ".validate": "newData.isString() && newData.val().matches(/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i)",
  ".read": "true"
}

an example usage for validating

Enjoy. As always comments and suggestions are welcome. I have pulled what I can from the npm "validator" javascript plugin and will look at pulling in some more use cases soon.

Jason Turner BrewSoftware

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago