@bedrockio/yada 1.0.35 → 1.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ var _errors = require("./errors");
8
8
  var _localization = require("./localization");
9
9
  function getFullMessage(error, options) {
10
10
  const {
11
- delimiter
11
+ delimiter = '\n'
12
12
  } = options;
13
13
  if (error.details) {
14
14
  return error.details.map(error => {
@@ -41,11 +41,14 @@ function getInnerPath(error, options) {
41
41
  }
42
42
  }
43
43
  function getLabeledMessage(error, options) {
44
+ const {
45
+ type
46
+ } = error;
44
47
  const {
45
48
  path = []
46
49
  } = options;
47
50
  const base = getBase(error.message);
48
- if (path.length) {
51
+ if (type !== 'custom' && path.length) {
49
52
  const msg = `{field} ${downcase(base)}`;
50
53
  return (0, _localization.localize)(msg, {
51
54
  field: getFieldLabel(options)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/yada",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "Validation library inspired by Joi.",
5
5
  "scripts": {
6
6
  "test": "jest",
package/src/messages.js CHANGED
@@ -2,7 +2,7 @@ import { isSchemaError } from './errors';
2
2
  import { localize } from './localization';
3
3
 
4
4
  export function getFullMessage(error, options) {
5
- const { delimiter } = options;
5
+ const { delimiter = '\n' } = options;
6
6
  if (error.details) {
7
7
  return error.details
8
8
  .map((error) => {
@@ -34,9 +34,10 @@ function getInnerPath(error, options) {
34
34
  }
35
35
 
36
36
  function getLabeledMessage(error, options) {
37
+ const { type } = error;
37
38
  const { path = [] } = options;
38
39
  const base = getBase(error.message);
39
- if (path.length) {
40
+ if (type !== 'custom' && path.length) {
40
41
  const msg = `{field} ${downcase(base)}`;
41
42
  return localize(msg, {
42
43
  field: getFieldLabel(options),