Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate array.includes and array.excludes, use array.items and allow required and forbidden within #559

Merged
merged 1 commit into from Feb 25, 2015

Conversation

nlf
Copy link
Member

@nlf nlf commented Feb 20, 2015

I think this is ready now..

  • adds array.items() which accepts both .required() and .forbidden() items
  • removes array.includes()
  • removes array.excludes()
  • changes array.describe() output to contain only an items array rather than includes and excludes

description.includes = [];
var inclusions = [].concat(this._inner.inclusions).concat(this._inner.requireds);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concat can take multiple args

@Marsup Marsup added feature New functionality or improvement breaking changes Change that can breaking existing code labels Feb 21, 2015
@Marsup Marsup added this to the 6.0.0 milestone Feb 21, 2015
@Marsup Marsup self-assigned this Feb 21, 2015
@@ -88,6 +89,9 @@ internals.checkItems = function (items, wasArray, state, options) {
var errors = [];
var errored;

var requireds = Hoek.clone(this._inner.requireds);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use slice instead, we don't need a deep clone here

@nlf nlf changed the title WIP: allow for required() in array.includes WIP: deprecate array.includes and array.excludes, use array.items and allow required and forbidden within Feb 25, 2015
@nlf nlf changed the title WIP: deprecate array.includes and array.excludes, use array.items and allow required and forbidden within deprecate array.includes and array.excludes, use array.items and allow required and forbidden within Feb 25, 2015
@@ -422,7 +539,7 @@ describe('array', function () {

it('returns an includes array only if includes are specified', function (done) {

var schema = Joi.array().includes().max(5);
var schema = Joi.array().items().max(5);
var desc = schema.describe();
expect(desc.includes).to.not.exist();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nlf includes -> items

deprecates array.includes and array.excludes
allows for use of required() and forbidden() in items list
Marsup added a commit that referenced this pull request Feb 25, 2015
deprecate array.includes and array.excludes, use array.items and allow required and forbidden within
@Marsup Marsup merged commit 352a5ac into master Feb 25, 2015
@Marsup Marsup deleted the array_includes_required branch February 25, 2015 23:52
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking changes Change that can breaking existing code feature New functionality or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants