Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "lawn", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "The environment is dangerous. Your lawn is nice. Stay in your lawn.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,4 +5,3 @@ 'use strict' | ||
internalsSymbol: Symbol('Lawn config'), | ||
validatorsSymbol: Symbol('Lawn validators'), | ||
cloneSymbol: Symbol('Lawn create') | ||
validatorsSymbol: Symbol('Lawn validators') | ||
} |
'use strict' | ||
const { internalsSymbol, validatorsSymbol, cloneSymbol } = require('../symbols') | ||
const { internalsSymbol, validatorsSymbol } = require('../symbols') | ||
@@ -11,19 +11,10 @@ class LawnBase { | ||
[cloneSymbol] (changes, validator, converter) { | ||
const obj = Object.create(Object.getPrototypeOf(this)) | ||
obj[internalsSymbol] = this[internalsSymbol] | ||
obj[validatorsSymbol] = this[validatorsSymbol] | ||
return obj | ||
} | ||
props (props) { | ||
const obj = this[cloneSymbol]() | ||
obj[internalsSymbol] = Object.assign({}, this[internalsSymbol], props) | ||
return obj | ||
this[internalsSymbol] = Object.assign({}, this[internalsSymbol], props) | ||
return this | ||
} | ||
validation (validation) { | ||
const obj = this[cloneSymbol]() | ||
obj[validatorsSymbol] = [...this[validatorsSymbol], validation] | ||
return obj | ||
this[validatorsSymbol].push(validation) | ||
return this | ||
} | ||
@@ -30,0 +21,0 @@ |
@@ -42,2 +42,10 @@ /* global describe it beforeEach */ | ||
it('does not throw when common properties are used first', function () { | ||
assert.doesNotThrow(() => { | ||
lawn.url | ||
.desc('Description first') | ||
.defaultQuery('one', 'two') | ||
}) | ||
}) | ||
describe('.protocol', function () { | ||
@@ -115,3 +123,3 @@ it('succeeds on a text match', function () { | ||
describe('overrideQuery', function () { | ||
describe('.overrideQuery', function () { | ||
it('overrides set values when they are missing', function () { | ||
@@ -118,0 +126,0 @@ const spec = { |
25663
570