1- # jk-schema
1+ # Schema
22
33This package allows you to validate complex objects using schemas.
44
@@ -18,7 +18,7 @@ to check if the data is valid or not.
1818You can use any of the given properties to define a field.
1919
2020``` js
21- import { Schema } from " jk-schema/dist /schema" ;
21+ import Schema from " @jalik /schema" ;
2222
2323const ExampleSchema = new Schema ({
2424
@@ -204,7 +204,7 @@ Almost all properties (excepted `type`) accept a function instead of the usual v
204204The given function is called with a single argument representing the current context (data) being validated by the schema.
205205
206206``` js
207- import { Schema } from " jk-schema/dist /schema" ;
207+ import Schema from " @jalik /schema" ;
208208
209209const isPublishing = function (context ) {
210210 // context refers to the data being validated
@@ -254,8 +254,8 @@ PostSchema.validate({
254254To create a schema, use the ` Schema ` class.
255255
256256``` js
257- import RegEx from " jk- schema/dist/regex" ;
258- import { Schema } from " jk-schema/dist /schema" ;
257+ import RegEx from " @jalik/ schema/dist/regex" ;
258+ import Schema from " @jalik /schema" ;
259259
260260const PersonSchema = new Schema ({
261261 name: {
@@ -291,7 +291,7 @@ const PersonSchema = new Schema({
291291The extend operation creates a new schema based on the current one.
292292
293293``` js
294- import { Schema } from " jk-schema/dist /schema" ;
294+ import Schema from " @jalik /schema" ;
295295
296296const PersonSchema = new Schema ({
297297 age: {type: Number },
@@ -313,7 +313,7 @@ const ParentSchema = PersonSchema.extend({
313313## Cloning a schema
314314
315315``` js
316- import { Schema } from " jk-schema/dist /schema" ;
316+ import Schema from " @jalik /schema" ;
317317
318318const PersonSchema = new Schema ({
319319 name: {
@@ -331,7 +331,7 @@ The update creates fields that do not exist, but only modifies existing properti
331331so you can keep properties that have already been defined.
332332
333333``` js
334- import { Schema } from " jk-schema/dist /schema" ;
334+ import Schema from " @jalik /schema" ;
335335
336336const PersonSchema = new Schema ({
337337 name: {
@@ -359,8 +359,8 @@ To validate data using a schema, use the method `schema.validate(obj)`.
359359If the validation fails, it will throw a ` SchemaError ` containing information about the error.
360360
361361``` js
362- import RegEx from " jk- schema/dist/regex" ;
363- import { Schema } from " jk-schema/dist /schema" ;
362+ import RegEx from " @jalik/ schema/dist/regex" ;
363+ import Schema from " @jalik /schema" ;
364364
365365const AddressSchema = new Schema ({
366366 city: {
@@ -455,6 +455,11 @@ catch (err) {
455455
456456## Changelog
457457
458+ ### v1.0.0
459+ - Exports ` Schema ` using ES6 default export
460+ - Exports ` SchemaError ` using ES6 default export
461+ - Exports ` SchemaField ` using ES6 default export
462+
458463### v0.5.1
459464- Makes ` type ` field option optional
460465
0 commit comments