Skip to content

Commit

Permalink
Merge pull request #54 from Baggz/dev
Browse files Browse the repository at this point in the history
Amanda v0.4.4
  • Loading branch information
František Hába committed Mar 1, 2013
2 parents dc0de36 + 36f13f6 commit c410968
Show file tree
Hide file tree
Showing 19 changed files with 2,178 additions and 126 deletions.
5 changes: 5 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
./docs
./examples
./tests
./tools
40 changes: 40 additions & 0 deletions Hintfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{

// This option prohibits the use of bitwise operators such as ^ (XOR), | (OR) and others. Bitwise operators
// are very rare in JavaScript programs and very often & is simply a mistyped &&.
"bitwise": true,

// This option allows you to force all variable names to use either camelCase
// style or UPPER_CASE with underscores.
"camelcase": false,

// This option requires you to always put curly braces around blocks in loops and conditionals. JavaScript
// allows you to omit curly braces when the block consists of only one statement.
"curly": true,

// This options prohibits the use of == and != in favor of === and !==. The former try to coerce values
// before comparing them which can lead to some unexpected results. The latter don't do any
// coercion so they are generally safer.
"eqeqeq": true,

// (...)

"strict": false,


//"indent": 2,

"browser": false,
"couch": false,
"devel": true,
"dojo": false,
"jquery": false,
"mootools": false,
"node": true,
"prototypejs": false,
"rhino": false,
"worker": false,
"wsh": false,
"yui": false

}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ Releases for the browser are available for download from GitHub.

| **Version** | **Description** | **Size** | **Action** |
|:------------|:----------------|:---------|:-----------|
| `amanda.js` | *uncompressed, with comments* | 36.01 KB (7.11 KB gzipped) | [Download](https://raw.github.com/Baggz/Amanda/master/releases/latest/amanda.js) |
| `amanda.min.js` | *compressed, without comments* | 13.62 KB (3.99 KB gzipped) | [Download](https://raw.github.com/Baggz/Amanda/master/releases/latest/amanda.min.js) |
| `amanda.js` | *uncompressed, with comments* | 36 KB (7.16 KB gzipped) | [Download](https://raw.github.com/Baggz/Amanda/master/releases/latest/amanda.js) |
| `amanda.min.js` | *compressed, without comments* | 13.59 KB (3.95 KB gzipped) | [Download](https://raw.github.com/Baggz/Amanda/master/releases/latest/amanda.min.js) |

Or you can use [JAM](http://jamjs.org/).

Expand Down
31 changes: 0 additions & 31 deletions docs/json/comparison.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Attributes

<a name="type"></a>
## type

This attribute defines what the primitive type or the schema of the instance must be in order to validate. This attribute can take one of two forms:

* [Simple Types](#simpleTypes)
* [Union Types](#unionTypes)

<a name="simpleTypes"></a>
### Simple Types

| Value | **JSON Schema Draft** | **Amanda** |
Expand All @@ -28,7 +26,6 @@ In addition Amanda supports also these types.
|:------|:---------------------:|:-----------|
| `function` |||

<a name="unionTypes"></a>
### Union Types

An array of two or more simple type definitions. Each item in the array MUST be a simple type definition or a schema.
Expand All @@ -43,7 +40,6 @@ An array of two or more simple type definitions. Each item in the array MUST be
{ "type": ["string", "number"] }
```

<a name="properties"></a>
## properties

This attribute is an object with property definitions that define the valid values of instance object property values. When the instance value is an object, the property values of the instance object must conform to the property definitions in this object. In this object, each property definition's value must be a schema, and the property's name must be the name of the instance property that it defines. The instance property value must be valid according to the schema from the property definition. Properties are considered unordered, the order of the instance properties may be in any order.
Expand All @@ -52,7 +48,6 @@ This attribute is an object with property definitions that define the valid valu
|:----------------------|:--:|
| **Amanda** ||

<a name="patternProperties"></a>
## patternProperties

This attribute is an object that defines the schema for a set of property names of an object instance. The name of each property of this attribute's object is a regular expression pattern in the ECMA 262/Perl 5 format, while the value is a schema. If the pattern matches the name of a property on the instance object, the value of the instance's property must be valid against the pattern name's schema value.
Expand All @@ -61,7 +56,6 @@ This attribute is an object that defines the schema for a set of property names
|:----------------------|:--:|
| **Amanda** ||

<a name="patternProperties"></a>
## additionalProperties

This attribute defines a schema for all properties that are not explicitly defined in an object type definition. If specified, the value must be a schema or a boolean. If false is provided, no additional properties are allowed beyond the properties defined in the schema. The default value is an empty schema which allows any value for additional properties.
Expand All @@ -70,7 +64,6 @@ This attribute defines a schema for all properties that are not explicitly defin
|:----------------------|:--:|
| **Amanda** ||

<a name="items"></a>
## items

This attribute defines the allowed items in an instance array, and must be a schema or an array of schemas. The default value is an empty schema which allows any value for items in the instance array. When this attribute value is a schema and the instance value is an array, then all the items in the array must be valid according to the schema.
Expand All @@ -81,7 +74,6 @@ When this attribute value is an array of schemas and the instance value is an ar
|:----------------------|:--:|
| **Amanda** ||

<a name="additionalItems"></a>
## additionalItems

This provides a definition for additional items in an array instance when tuple definitions of the items is provided. This can be false to indicate additional items in the array are not allowed, or it can be a schema that defines the schema of the additional items.
Expand All @@ -90,7 +82,6 @@ This provides a definition for additional items in an array instance when tuple
|:----------------------|:--:|
| **Amanda** ||

<a name="required"></a>
## required

This attribute indicates if the instance must have a value, and not be undefined. This is false by default, making the instance optional.
Expand All @@ -99,7 +90,6 @@ This attribute indicates if the instance must have a value, and not be undefined
|:----------------------|:--:|
| **Amanda** ||

<a name="dependencies"></a>
## dependencies

This attribute is an object that defines the requirements of a property on an instance object. If an object instance has a property with the same name as a property in this attribute's object, then the instance must be valid against the attribute's property value (hereafter referred to as the "dependency value").
Expand All @@ -108,7 +98,6 @@ This attribute is an object that defines the requirements of a property on an in
|:----------------------|:--:|
| **Amanda** ||

<a name="minimum"></a>
## minimum

This attribute defines the minimum value of the instance property when the type of the instance value is a number.
Expand All @@ -117,7 +106,6 @@ This attribute defines the minimum value of the instance property when the type
|:----------------------|:--:|
| **Amanda** ||

<a name="maximum"></a>
## maximum

This attribute defines the maximum value of the instance property when the type of the instance value is a number.
Expand All @@ -126,7 +114,6 @@ This attribute defines the maximum value of the instance property when the type
|:----------------------|:--:|
| **Amanda** ||

<a name="exclusiveMinimum"></a>
## exclusiveMinimum

This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "minimum" attribute. This is false by default, meaning the instance value can be greater then or equal to the minimum value.
Expand All @@ -135,7 +122,6 @@ This attribute indicates if the value of the instance (if the instance is a numb
|:----------------------|:--:|
| **Amanda** ||

<a name="exclusiveMaximum"></a>
## exclusiveMaximum

This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "maximum" attribute. This is false by default, meaning the instance value can be less then or equal to the maximum value.
Expand All @@ -144,7 +130,6 @@ This attribute indicates if the value of the instance (if the instance is a numb
|:----------------------|:--:|
| **Amanda** ||

<a name="minItems"></a>
## minItems

This attribute defines the minimum number of values in an array when the array is the instance value.
Expand All @@ -153,7 +138,6 @@ This attribute defines the minimum number of values in an array when the array i
|:----------------------|:--:|
| **Amanda** ||

<a name="maxItems"></a>
## maxItems

This attribute defines the maximum number of values in an array when the array is the instance value.
Expand All @@ -162,7 +146,6 @@ This attribute defines the maximum number of values in an array when the array i
|:----------------------|:--:|
| **Amanda** ||

<a name="uniqueItems"></a>
## uniqueItems

This attribute indicates that all items in an array instance must be unique (contains no two identical values). Two instance are consider equal if they are both of the same type.
Expand All @@ -171,7 +154,6 @@ This attribute indicates that all items in an array instance must be unique (con
|:----------------------|:--:|
| **Amanda** ||

<a name="pattern"></a>
## pattern

When the instance value is a string, this provides a regular expression that a string instance MUST match in order to be valid.
Expand All @@ -180,7 +162,6 @@ When the instance value is a string, this provides a regular expression that a s
|:----------------------|:--:|
| **Amanda** ||

<a name="minLength"></a>
## minLength

When the instance value is a string, this defines the minimum length of the string.
Expand All @@ -189,7 +170,6 @@ When the instance value is a string, this defines the minimum length of the stri
|:----------------------|:--:|
| **Amanda** ||

<a name="maxLength"></a>
## maxLength

When the instance value is a string, this defines the maximum length of the string.
Expand All @@ -198,7 +178,6 @@ When the instance value is a string, this defines the maximum length of the stri
|:----------------------|:--:|
| **Amanda** ||

<a name="enum"></a>
## enum

This provides an enumeration of all possible values that are valid for the instance property. This MUST be an array, and each item in the array represents a possible value for the instance value.
Expand All @@ -207,7 +186,6 @@ This provides an enumeration of all possible values that are valid for the insta
|:----------------------|:--:|
| **Amanda** ||

<a name="default"></a>
## default

This attribute defines the default value of the instance when the instance is undefined.
Expand All @@ -216,7 +194,6 @@ This attribute defines the default value of the instance when the instance is un
|:----------------------|:--:|
| **Amanda** ||

<a name="title"></a>
## title

This attribute is a string that provides a short description of the instance property.
Expand All @@ -225,7 +202,6 @@ This attribute is a string that provides a short description of the instance pro
|:----------------------|:--:|
| **Amanda** ||

<a name="description"></a>
## description

This attribute is a string that provides a full description of the of purpose the instance property.
Expand All @@ -234,7 +210,6 @@ This attribute is a string that provides a full description of the of purpose th
|:----------------------|:--:|
| **Amanda** ||

<a name="format"></a>
## format

| Value | **JSON Schema Draft** | **Amanda** |
Expand Down Expand Up @@ -278,7 +253,6 @@ Amanda aliases
|:----------------------|:--:|
| **Amanda** ||

<a name="divisibleBy"></a>
## divisibleBy

This attribute defines what value the number instance must be divisible by with no remainder (the result of the division must be an integer). The value of this attribute should not be 0.
Expand All @@ -287,7 +261,6 @@ This attribute defines what value the number instance must be divisible by with
|:----------------------|:--:|
| **Amanda** ||

<a name="disallow"></a>
## disallow

This attribute takes the same values as the "type" attribute, however if the instance matches the type or if this value is an array and the instance matches any type or schema in the array, then this instance is not valid.
Expand All @@ -296,28 +269,24 @@ This attribute takes the same values as the "type" attribute, however if the ins
|:----------------------|:--:|
| **Amanda** ||

<a name="extends"></a>
## extends

| **JSON Schema Draft** ||
|:----------------------|:--:|
| **Amanda** ||

<a name="id"></a>
## id

| **JSON Schema Draft** ||
|:----------------------|:--:|
| **Amanda** ||

<a name="$ref"></a>
## $ref

| **JSON Schema Draft** ||
|:----------------------|:--:|
| **Amanda** ||

<a name="$schema"></a>
## $schema

| **JSON Schema Draft** ||
Expand Down
3 changes: 0 additions & 3 deletions docs/json/methods/addAttribute.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[← Documentation](https://github.com/Baggz/Amanda/tree/master/docs/README.md)

<a name="addAttribute"></a>
# addAttribute

```javascript
Expand Down
Empty file.
3 changes: 0 additions & 3 deletions docs/json/methods/validate.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[← Documentation](https://github.com/Baggz/Amanda/tree/master/docs/README.md)

<a name="validate"></a>
# Validate

```javascript
Expand Down
3 changes: 0 additions & 3 deletions docs/json/objects/error.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[← Documentation](https://github.com/Baggz/Amanda/tree/master/docs/README.md)

<a name="error"></a>
# Error

**Example**
Expand Down
9 changes: 2 additions & 7 deletions docs/json/objects/options.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
[← Documentation](https://github.com/Baggz/Amanda/tree/master/docs/README.md)

<a name="options"></a>
# Options

### Properties

* [singleError](#singleError)
* [messages](#messages)

<a name="singleError"></a>
## singleError [#](#singleError)
## singleError

If you set the `singleError` flag to `false`, validation continues even after a first error occurred. By default the `singleError` flag is set to `true`.

Expand All @@ -23,8 +19,7 @@ amanda.validate(data, schema, { singleError: false }, function(error) {
});
```

<a name="messages"></a>
## messages [#](#messages)
## messages

This property allows you to set custom error messages. If you want to use more ambitious messages, you can pass a function.

Expand Down
Loading

0 comments on commit c410968

Please sign in to comment.