Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixed grammatical errors in error reporting

  • Loading branch information...
commit 4c9f2f6a7c91d66ceb93274ce32f4c39b4c5b2d7 1 parent 9a13e73
John Fawcett jrf0110 authored

Showing 1 changed file with 6 additions and 5 deletions. Show diff stats Hide diff stats

  1. +6 5 src/engines/json/errorMessages.js
11 src/engines/json/errorMessages.js
@@ -2,7 +2,8 @@
2 2 * Messages
3 3 * --------------------
4 4 */
5   -var errorMessages = {
  5 +var vowels = "aeiou",
  6 +errorMessages = {
6 7
7 8 /**
8 9 * Maximum
@@ -38,7 +39,7 @@ var errorMessages = {
38 39 */
39 40 maxLength: function(property, propertyValue, attributeValue) {
40 41 return [
41   - 'The ' + property + ' property must not exceed ' + attributeValue + ' characters.',
  42 + 'The ' + property + ' property must not exceed ' + attributeValue + ' character' + (attributeValue > 1 ? 's' : '') + '.',
42 43 'The length of the property is ' + propertyValue.length + '.'
43 44 ].join(' ');
44 45 },
@@ -52,7 +53,7 @@ var errorMessages = {
52 53 */
53 54 length: function(property, propertyValue, attributeValue) {
54 55 return [
55   - 'The ' + property + ' property must be exactly ' + attributeValue + ' characters.',
  56 + 'The ' + property + ' property must be exactly ' + attributeValue + ' character' + (attributeValue > 1 ? 's' : '') + '.',
56 57 'The length of the property is ' + propertyValue.length + '.'
57 58 ].join(' ');
58 59 },
@@ -80,7 +81,7 @@ var errorMessages = {
80 81 */
81 82 type: function(property, propertyValue, attributeValue) {
82 83 return [
83   - 'The ‘' + property + '’ property must be a/an ‘' + attributeValue + '’.',
  84 + 'The ‘' + property + '’ property must be ' + (vowels.indexOf(attributeValue[0]) > -1 ? 'an' : 'a') + ' ‘' + attributeValue + '’.',
84 85 'The type of the property is ‘' + detectType(propertyValue) + '’'
85 86 ].join(' ');
86 87 },
@@ -142,7 +143,7 @@ var errorMessages = {
142 143 * @param {any} propertyValue
143 144 * @param {string} attributeValue
144 145 */
145   - maxItems: function(property, propertyValue, attributeValue) {
  146 + maxItems: function(property, propertyValue, attributeValue) {
146 147 return [
147 148 'The ‘' + property + '’ property must not contain more than ‘' + attributeValue + '’ items.',
148 149 'Currently it contains ‘' + propertyValue.items + '’ items.'

0 comments on commit 4c9f2f6

Please sign in to comment.
Something went wrong with that request. Please try again.