ascertain 0.12.18 → 0.12.19

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.
Files changed (2) hide show
  1. package/build/index.js +9 -18
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -59,34 +59,29 @@ function And(schema) {
59
59
  function Or(schema) {
60
60
  this.schema = schema;
61
61
  }
62
- var optional = function optional(schema) {
62
+ var optional = exports.optional = function optional(schema) {
63
63
  return new Optional(schema);
64
64
  };
65
- exports.optional = optional;
66
- var and = function and() {
65
+ var and = exports.and = function and() {
67
66
  for (var _len = arguments.length, schema = new Array(_len), _key = 0; _key < _len; _key++) {
68
67
  schema[_key] = arguments[_key];
69
68
  }
70
69
  return new And(schema);
71
70
  };
72
- exports.and = and;
73
- var or = function or() {
71
+ var or = exports.or = function or() {
74
72
  for (var _len2 = arguments.length, schema = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
75
73
  schema[_key2] = arguments[_key2];
76
74
  }
77
75
  return new Or(schema);
78
76
  };
79
- exports.or = or;
80
- var $keys = Symbol.for('@@keys');
81
- exports.$keys = $keys;
82
- var $values = Symbol.for('@@values');
83
- exports.$values = $values;
77
+ var $keys = exports.$keys = Symbol.for('@@keys');
78
+ var $values = exports.$values = Symbol.for('@@values');
84
79
  var fromBase64 = typeof Buffer === 'undefined' ? function (value) {
85
80
  return atob(value);
86
81
  } : function (value) {
87
82
  return Buffer.from(value, 'base64').toString('utf-8');
88
83
  };
89
- var as = {
84
+ var as = exports.as = {
90
85
  string: function string(value) {
91
86
  return typeof value === "string" ? value : undefined;
92
87
  },
@@ -116,12 +111,10 @@ var as = {
116
111
  }
117
112
  }
118
113
  };
119
- exports.as = as;
120
- var toggle = function toggle(key, cases, defaultKey) {
114
+ var toggle = exports.toggle = function toggle(key, cases, defaultKey) {
121
115
  var _ref, _cases$key;
122
116
  return (_ref = (_cases$key = cases[key]) !== null && _cases$key !== void 0 ? _cases$key : cases[defaultKey]) !== null && _ref !== void 0 ? _ref : undefined;
123
117
  };
124
- exports.toggle = toggle;
125
118
  function certain(target, schema, path, optional) {
126
119
  if (schema === null || typeof schema === 'undefined') {
127
120
  return new AssertError(schema, 'any value', path, 'schema value');
@@ -206,13 +199,11 @@ function certain(target, schema, path, optional) {
206
199
  return new AssertError(target, schema, path);
207
200
  }
208
201
  }
209
- var ascertain = function ascertain(schema, data) {
202
+ var ascertain = exports.ascertain = function ascertain(schema, data) {
210
203
  var rootName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '[root]';
211
204
  var result = certain(data, schema, rootName);
212
205
  if (result instanceof AssertError) {
213
206
  throw new TypeError(result.toString());
214
207
  }
215
208
  };
216
- exports.ascertain = ascertain;
217
- var _default = ascertain;
218
- exports.default = _default;
209
+ var _default = exports.default = ascertain;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ascertain",
3
- "version": "0.12.18",
3
+ "version": "0.12.19",
4
4
  "description": "0-Deps, simple, fast, for browser and node js object schema validator",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",