How to use filter with conditionals inside?
up vote
1
down vote
favorite
I tried apply chain of conditionals inside `filter. How to join result from previous conditionals and pass result the next:
this.fltRooms = this.rooms.filter(room => {
let _rule;
if (formValues["auditoryNumber"]) {
_rule = formValues["auditoryNumber"] == room.title;
}
if (formValues["floor"]) {
_rule = formValues["floor"] == room.floor; // Should be AND
}
if (formValues["corpus"]) {
_rule = formValues["corpus"] == room.building; // Should be AND
}
return _rule;
});
So, logic is, if exist formValues["auditoryNumber"]
and formValues["floor"]
and formValues["corpus"]
then filter by all three conditionals with AND
between.
javascript
add a comment |
up vote
1
down vote
favorite
I tried apply chain of conditionals inside `filter. How to join result from previous conditionals and pass result the next:
this.fltRooms = this.rooms.filter(room => {
let _rule;
if (formValues["auditoryNumber"]) {
_rule = formValues["auditoryNumber"] == room.title;
}
if (formValues["floor"]) {
_rule = formValues["floor"] == room.floor; // Should be AND
}
if (formValues["corpus"]) {
_rule = formValues["corpus"] == room.building; // Should be AND
}
return _rule;
});
So, logic is, if exist formValues["auditoryNumber"]
and formValues["floor"]
and formValues["corpus"]
then filter by all three conditionals with AND
between.
javascript
also would great to provide sample array flitrooms
– dganenco
Nov 19 at 14:28
Is it possible that no filters are set? And if no filters set should it return all or none?
– epascarello
Nov 19 at 14:32
Seems like all you need is_rule = _rule && ...
and also initialize_rule
totrue
– Pointy
Nov 19 at 14:32
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I tried apply chain of conditionals inside `filter. How to join result from previous conditionals and pass result the next:
this.fltRooms = this.rooms.filter(room => {
let _rule;
if (formValues["auditoryNumber"]) {
_rule = formValues["auditoryNumber"] == room.title;
}
if (formValues["floor"]) {
_rule = formValues["floor"] == room.floor; // Should be AND
}
if (formValues["corpus"]) {
_rule = formValues["corpus"] == room.building; // Should be AND
}
return _rule;
});
So, logic is, if exist formValues["auditoryNumber"]
and formValues["floor"]
and formValues["corpus"]
then filter by all three conditionals with AND
between.
javascript
I tried apply chain of conditionals inside `filter. How to join result from previous conditionals and pass result the next:
this.fltRooms = this.rooms.filter(room => {
let _rule;
if (formValues["auditoryNumber"]) {
_rule = formValues["auditoryNumber"] == room.title;
}
if (formValues["floor"]) {
_rule = formValues["floor"] == room.floor; // Should be AND
}
if (formValues["corpus"]) {
_rule = formValues["corpus"] == room.building; // Should be AND
}
return _rule;
});
So, logic is, if exist formValues["auditoryNumber"]
and formValues["floor"]
and formValues["corpus"]
then filter by all three conditionals with AND
between.
javascript
javascript
asked Nov 19 at 14:20
OPV
1,35521329
1,35521329
also would great to provide sample array flitrooms
– dganenco
Nov 19 at 14:28
Is it possible that no filters are set? And if no filters set should it return all or none?
– epascarello
Nov 19 at 14:32
Seems like all you need is_rule = _rule && ...
and also initialize_rule
totrue
– Pointy
Nov 19 at 14:32
add a comment |
also would great to provide sample array flitrooms
– dganenco
Nov 19 at 14:28
Is it possible that no filters are set? And if no filters set should it return all or none?
– epascarello
Nov 19 at 14:32
Seems like all you need is_rule = _rule && ...
and also initialize_rule
totrue
– Pointy
Nov 19 at 14:32
also would great to provide sample array flitrooms
– dganenco
Nov 19 at 14:28
also would great to provide sample array flitrooms
– dganenco
Nov 19 at 14:28
Is it possible that no filters are set? And if no filters set should it return all or none?
– epascarello
Nov 19 at 14:32
Is it possible that no filters are set? And if no filters set should it return all or none?
– epascarello
Nov 19 at 14:32
Seems like all you need is
_rule = _rule && ...
and also initialize _rule
to true
– Pointy
Nov 19 at 14:32
Seems like all you need is
_rule = _rule && ...
and also initialize _rule
to true
– Pointy
Nov 19 at 14:32
add a comment |
5 Answers
5
active
oldest
votes
up vote
2
down vote
accepted
Basically you want to say if the filter is not set that it is true. If the filter is set than check out if the value matches.
this.fltRooms = this.rooms.filter(room =>
(!formValues["auditoryNumber"] || formValues["auditoryNumber"] == room.title) &&
(!formValues["floor"] || formValues["floor"] == room.floor) &&
(!formValues["corpus"] || formValues["corpus"] == room.building)
)
Other way with ifs would be using the boolean in each check
this.fltRooms = this.rooms.filter(room => {
let _rule = true
if (formValues["auditoryNumber"]) {
_rule = formValues["auditoryNumber"] == room.title;
}
if (_rule && formValues["floor"]) {
_rule = formValues["floor"] == room.floor; // Should be AND
}
if (_rule && formValues["corpus"]) {
_rule = formValues["corpus"] == room.building; // Should be AND
}
return _rule;
});
I prefer second way with boolean, thnak you
– OPV
Nov 19 at 14:55
add a comment |
up vote
3
down vote
And what if either doesn't exist?
As you describe it, it should be quite straightforward. Something like
this.fltRooms = this.rooms.filter(room =>
formValues["auditoryNumber"] == room.title
&& formValues["floor"] == room.floor
&& formValues["corpus"] == room.building);
1
not exactly what OP is after it appears.
– epascarello
Nov 19 at 14:29
add a comment |
up vote
2
down vote
Alternative to @bipll correct answer, using a defined array of keys to compare
this.filtRooms = this.rooms.filter(x => [
'auditoryNumber',
'floor',
'corpus',
].every(y => x[y] === formValues[y]));
If keys are different on both objects to compare
this.filtRooms = this.rooms.filter(x => [
[
'auditoryNumber',
'title',
],
[
'floor',
'floor',
],
[
'corpus',
'building',
],
].every(([
key1,
key2,
]) => x[key1] === void 0 || x[key1] === formValues[key2]));
1
keys aren't same in each object
– charlietfl
Nov 19 at 14:31
@charlietfl good point! Didn't saw it, add a new example
– Grégory NEUT
Nov 19 at 14:33
@charlietfl If people are reading this : use every if you want all keys to match, use some if you want only one key to match. I think OP want all keys to match
– Grégory NEUT
Nov 19 at 14:41
1
re-reading the key needs to exist informValues
to be considered as filter. So what should also check in every is if it exists. Not well explained in question
– charlietfl
Nov 19 at 14:45
@charlietfl updated!
– Grégory NEUT
Nov 19 at 14:54
add a comment |
up vote
0
down vote
this.filterRooms = this.rooms.filter(meetsSearchParams);
function meetsSearchParams(room){
return room.auditoryNumber == formValues["auditoryNumber"] &&
room.floor == formValues["floor"] &&
room.corpus == formValues["corpus"];
}
For the sake of keeping this as readable as possible.
I will not work, cause I dont have formValues parameters all time
– OPV
Nov 19 at 15:04
Oh sorry I misread that in your question then. Thought you were just trying to check multiple conditions inside a filter. Are the inputs always there, just they don't necessarily have value?
– Katie.Sun
Nov 19 at 15:06
add a comment |
up vote
0
down vote
If you're going to need to extend it, make a map array between the two structures
var fields = [
{f: "auditoryNumber", p: "title"},
{f: "floor", p: "floor"},
{f: "corpus", p: "building"}
];
this.fltRooms = this.rooms.filter(room =>
fields.every(field => !formValues[field.f] || formValues[field.f] == room[field.p]);
)
add a comment |
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Basically you want to say if the filter is not set that it is true. If the filter is set than check out if the value matches.
this.fltRooms = this.rooms.filter(room =>
(!formValues["auditoryNumber"] || formValues["auditoryNumber"] == room.title) &&
(!formValues["floor"] || formValues["floor"] == room.floor) &&
(!formValues["corpus"] || formValues["corpus"] == room.building)
)
Other way with ifs would be using the boolean in each check
this.fltRooms = this.rooms.filter(room => {
let _rule = true
if (formValues["auditoryNumber"]) {
_rule = formValues["auditoryNumber"] == room.title;
}
if (_rule && formValues["floor"]) {
_rule = formValues["floor"] == room.floor; // Should be AND
}
if (_rule && formValues["corpus"]) {
_rule = formValues["corpus"] == room.building; // Should be AND
}
return _rule;
});
I prefer second way with boolean, thnak you
– OPV
Nov 19 at 14:55
add a comment |
up vote
2
down vote
accepted
Basically you want to say if the filter is not set that it is true. If the filter is set than check out if the value matches.
this.fltRooms = this.rooms.filter(room =>
(!formValues["auditoryNumber"] || formValues["auditoryNumber"] == room.title) &&
(!formValues["floor"] || formValues["floor"] == room.floor) &&
(!formValues["corpus"] || formValues["corpus"] == room.building)
)
Other way with ifs would be using the boolean in each check
this.fltRooms = this.rooms.filter(room => {
let _rule = true
if (formValues["auditoryNumber"]) {
_rule = formValues["auditoryNumber"] == room.title;
}
if (_rule && formValues["floor"]) {
_rule = formValues["floor"] == room.floor; // Should be AND
}
if (_rule && formValues["corpus"]) {
_rule = formValues["corpus"] == room.building; // Should be AND
}
return _rule;
});
I prefer second way with boolean, thnak you
– OPV
Nov 19 at 14:55
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Basically you want to say if the filter is not set that it is true. If the filter is set than check out if the value matches.
this.fltRooms = this.rooms.filter(room =>
(!formValues["auditoryNumber"] || formValues["auditoryNumber"] == room.title) &&
(!formValues["floor"] || formValues["floor"] == room.floor) &&
(!formValues["corpus"] || formValues["corpus"] == room.building)
)
Other way with ifs would be using the boolean in each check
this.fltRooms = this.rooms.filter(room => {
let _rule = true
if (formValues["auditoryNumber"]) {
_rule = formValues["auditoryNumber"] == room.title;
}
if (_rule && formValues["floor"]) {
_rule = formValues["floor"] == room.floor; // Should be AND
}
if (_rule && formValues["corpus"]) {
_rule = formValues["corpus"] == room.building; // Should be AND
}
return _rule;
});
Basically you want to say if the filter is not set that it is true. If the filter is set than check out if the value matches.
this.fltRooms = this.rooms.filter(room =>
(!formValues["auditoryNumber"] || formValues["auditoryNumber"] == room.title) &&
(!formValues["floor"] || formValues["floor"] == room.floor) &&
(!formValues["corpus"] || formValues["corpus"] == room.building)
)
Other way with ifs would be using the boolean in each check
this.fltRooms = this.rooms.filter(room => {
let _rule = true
if (formValues["auditoryNumber"]) {
_rule = formValues["auditoryNumber"] == room.title;
}
if (_rule && formValues["floor"]) {
_rule = formValues["floor"] == room.floor; // Should be AND
}
if (_rule && formValues["corpus"]) {
_rule = formValues["corpus"] == room.building; // Should be AND
}
return _rule;
});
answered Nov 19 at 14:39
epascarello
150k13131178
150k13131178
I prefer second way with boolean, thnak you
– OPV
Nov 19 at 14:55
add a comment |
I prefer second way with boolean, thnak you
– OPV
Nov 19 at 14:55
I prefer second way with boolean, thnak you
– OPV
Nov 19 at 14:55
I prefer second way with boolean, thnak you
– OPV
Nov 19 at 14:55
add a comment |
up vote
3
down vote
And what if either doesn't exist?
As you describe it, it should be quite straightforward. Something like
this.fltRooms = this.rooms.filter(room =>
formValues["auditoryNumber"] == room.title
&& formValues["floor"] == room.floor
&& formValues["corpus"] == room.building);
1
not exactly what OP is after it appears.
– epascarello
Nov 19 at 14:29
add a comment |
up vote
3
down vote
And what if either doesn't exist?
As you describe it, it should be quite straightforward. Something like
this.fltRooms = this.rooms.filter(room =>
formValues["auditoryNumber"] == room.title
&& formValues["floor"] == room.floor
&& formValues["corpus"] == room.building);
1
not exactly what OP is after it appears.
– epascarello
Nov 19 at 14:29
add a comment |
up vote
3
down vote
up vote
3
down vote
And what if either doesn't exist?
As you describe it, it should be quite straightforward. Something like
this.fltRooms = this.rooms.filter(room =>
formValues["auditoryNumber"] == room.title
&& formValues["floor"] == room.floor
&& formValues["corpus"] == room.building);
And what if either doesn't exist?
As you describe it, it should be quite straightforward. Something like
this.fltRooms = this.rooms.filter(room =>
formValues["auditoryNumber"] == room.title
&& formValues["floor"] == room.floor
&& formValues["corpus"] == room.building);
answered Nov 19 at 14:25
bipll
7,7991825
7,7991825
1
not exactly what OP is after it appears.
– epascarello
Nov 19 at 14:29
add a comment |
1
not exactly what OP is after it appears.
– epascarello
Nov 19 at 14:29
1
1
not exactly what OP is after it appears.
– epascarello
Nov 19 at 14:29
not exactly what OP is after it appears.
– epascarello
Nov 19 at 14:29
add a comment |
up vote
2
down vote
Alternative to @bipll correct answer, using a defined array of keys to compare
this.filtRooms = this.rooms.filter(x => [
'auditoryNumber',
'floor',
'corpus',
].every(y => x[y] === formValues[y]));
If keys are different on both objects to compare
this.filtRooms = this.rooms.filter(x => [
[
'auditoryNumber',
'title',
],
[
'floor',
'floor',
],
[
'corpus',
'building',
],
].every(([
key1,
key2,
]) => x[key1] === void 0 || x[key1] === formValues[key2]));
1
keys aren't same in each object
– charlietfl
Nov 19 at 14:31
@charlietfl good point! Didn't saw it, add a new example
– Grégory NEUT
Nov 19 at 14:33
@charlietfl If people are reading this : use every if you want all keys to match, use some if you want only one key to match. I think OP want all keys to match
– Grégory NEUT
Nov 19 at 14:41
1
re-reading the key needs to exist informValues
to be considered as filter. So what should also check in every is if it exists. Not well explained in question
– charlietfl
Nov 19 at 14:45
@charlietfl updated!
– Grégory NEUT
Nov 19 at 14:54
add a comment |
up vote
2
down vote
Alternative to @bipll correct answer, using a defined array of keys to compare
this.filtRooms = this.rooms.filter(x => [
'auditoryNumber',
'floor',
'corpus',
].every(y => x[y] === formValues[y]));
If keys are different on both objects to compare
this.filtRooms = this.rooms.filter(x => [
[
'auditoryNumber',
'title',
],
[
'floor',
'floor',
],
[
'corpus',
'building',
],
].every(([
key1,
key2,
]) => x[key1] === void 0 || x[key1] === formValues[key2]));
1
keys aren't same in each object
– charlietfl
Nov 19 at 14:31
@charlietfl good point! Didn't saw it, add a new example
– Grégory NEUT
Nov 19 at 14:33
@charlietfl If people are reading this : use every if you want all keys to match, use some if you want only one key to match. I think OP want all keys to match
– Grégory NEUT
Nov 19 at 14:41
1
re-reading the key needs to exist informValues
to be considered as filter. So what should also check in every is if it exists. Not well explained in question
– charlietfl
Nov 19 at 14:45
@charlietfl updated!
– Grégory NEUT
Nov 19 at 14:54
add a comment |
up vote
2
down vote
up vote
2
down vote
Alternative to @bipll correct answer, using a defined array of keys to compare
this.filtRooms = this.rooms.filter(x => [
'auditoryNumber',
'floor',
'corpus',
].every(y => x[y] === formValues[y]));
If keys are different on both objects to compare
this.filtRooms = this.rooms.filter(x => [
[
'auditoryNumber',
'title',
],
[
'floor',
'floor',
],
[
'corpus',
'building',
],
].every(([
key1,
key2,
]) => x[key1] === void 0 || x[key1] === formValues[key2]));
Alternative to @bipll correct answer, using a defined array of keys to compare
this.filtRooms = this.rooms.filter(x => [
'auditoryNumber',
'floor',
'corpus',
].every(y => x[y] === formValues[y]));
If keys are different on both objects to compare
this.filtRooms = this.rooms.filter(x => [
[
'auditoryNumber',
'title',
],
[
'floor',
'floor',
],
[
'corpus',
'building',
],
].every(([
key1,
key2,
]) => x[key1] === void 0 || x[key1] === formValues[key2]));
edited Nov 19 at 14:54
answered Nov 19 at 14:30
Grégory NEUT
8,19121437
8,19121437
1
keys aren't same in each object
– charlietfl
Nov 19 at 14:31
@charlietfl good point! Didn't saw it, add a new example
– Grégory NEUT
Nov 19 at 14:33
@charlietfl If people are reading this : use every if you want all keys to match, use some if you want only one key to match. I think OP want all keys to match
– Grégory NEUT
Nov 19 at 14:41
1
re-reading the key needs to exist informValues
to be considered as filter. So what should also check in every is if it exists. Not well explained in question
– charlietfl
Nov 19 at 14:45
@charlietfl updated!
– Grégory NEUT
Nov 19 at 14:54
add a comment |
1
keys aren't same in each object
– charlietfl
Nov 19 at 14:31
@charlietfl good point! Didn't saw it, add a new example
– Grégory NEUT
Nov 19 at 14:33
@charlietfl If people are reading this : use every if you want all keys to match, use some if you want only one key to match. I think OP want all keys to match
– Grégory NEUT
Nov 19 at 14:41
1
re-reading the key needs to exist informValues
to be considered as filter. So what should also check in every is if it exists. Not well explained in question
– charlietfl
Nov 19 at 14:45
@charlietfl updated!
– Grégory NEUT
Nov 19 at 14:54
1
1
keys aren't same in each object
– charlietfl
Nov 19 at 14:31
keys aren't same in each object
– charlietfl
Nov 19 at 14:31
@charlietfl good point! Didn't saw it, add a new example
– Grégory NEUT
Nov 19 at 14:33
@charlietfl good point! Didn't saw it, add a new example
– Grégory NEUT
Nov 19 at 14:33
@charlietfl If people are reading this : use every if you want all keys to match, use some if you want only one key to match. I think OP want all keys to match
– Grégory NEUT
Nov 19 at 14:41
@charlietfl If people are reading this : use every if you want all keys to match, use some if you want only one key to match. I think OP want all keys to match
– Grégory NEUT
Nov 19 at 14:41
1
1
re-reading the key needs to exist in
formValues
to be considered as filter. So what should also check in every is if it exists. Not well explained in question– charlietfl
Nov 19 at 14:45
re-reading the key needs to exist in
formValues
to be considered as filter. So what should also check in every is if it exists. Not well explained in question– charlietfl
Nov 19 at 14:45
@charlietfl updated!
– Grégory NEUT
Nov 19 at 14:54
@charlietfl updated!
– Grégory NEUT
Nov 19 at 14:54
add a comment |
up vote
0
down vote
this.filterRooms = this.rooms.filter(meetsSearchParams);
function meetsSearchParams(room){
return room.auditoryNumber == formValues["auditoryNumber"] &&
room.floor == formValues["floor"] &&
room.corpus == formValues["corpus"];
}
For the sake of keeping this as readable as possible.
I will not work, cause I dont have formValues parameters all time
– OPV
Nov 19 at 15:04
Oh sorry I misread that in your question then. Thought you were just trying to check multiple conditions inside a filter. Are the inputs always there, just they don't necessarily have value?
– Katie.Sun
Nov 19 at 15:06
add a comment |
up vote
0
down vote
this.filterRooms = this.rooms.filter(meetsSearchParams);
function meetsSearchParams(room){
return room.auditoryNumber == formValues["auditoryNumber"] &&
room.floor == formValues["floor"] &&
room.corpus == formValues["corpus"];
}
For the sake of keeping this as readable as possible.
I will not work, cause I dont have formValues parameters all time
– OPV
Nov 19 at 15:04
Oh sorry I misread that in your question then. Thought you were just trying to check multiple conditions inside a filter. Are the inputs always there, just they don't necessarily have value?
– Katie.Sun
Nov 19 at 15:06
add a comment |
up vote
0
down vote
up vote
0
down vote
this.filterRooms = this.rooms.filter(meetsSearchParams);
function meetsSearchParams(room){
return room.auditoryNumber == formValues["auditoryNumber"] &&
room.floor == formValues["floor"] &&
room.corpus == formValues["corpus"];
}
For the sake of keeping this as readable as possible.
this.filterRooms = this.rooms.filter(meetsSearchParams);
function meetsSearchParams(room){
return room.auditoryNumber == formValues["auditoryNumber"] &&
room.floor == formValues["floor"] &&
room.corpus == formValues["corpus"];
}
For the sake of keeping this as readable as possible.
answered Nov 19 at 14:40
Katie.Sun
55713
55713
I will not work, cause I dont have formValues parameters all time
– OPV
Nov 19 at 15:04
Oh sorry I misread that in your question then. Thought you were just trying to check multiple conditions inside a filter. Are the inputs always there, just they don't necessarily have value?
– Katie.Sun
Nov 19 at 15:06
add a comment |
I will not work, cause I dont have formValues parameters all time
– OPV
Nov 19 at 15:04
Oh sorry I misread that in your question then. Thought you were just trying to check multiple conditions inside a filter. Are the inputs always there, just they don't necessarily have value?
– Katie.Sun
Nov 19 at 15:06
I will not work, cause I dont have formValues parameters all time
– OPV
Nov 19 at 15:04
I will not work, cause I dont have formValues parameters all time
– OPV
Nov 19 at 15:04
Oh sorry I misread that in your question then. Thought you were just trying to check multiple conditions inside a filter. Are the inputs always there, just they don't necessarily have value?
– Katie.Sun
Nov 19 at 15:06
Oh sorry I misread that in your question then. Thought you were just trying to check multiple conditions inside a filter. Are the inputs always there, just they don't necessarily have value?
– Katie.Sun
Nov 19 at 15:06
add a comment |
up vote
0
down vote
If you're going to need to extend it, make a map array between the two structures
var fields = [
{f: "auditoryNumber", p: "title"},
{f: "floor", p: "floor"},
{f: "corpus", p: "building"}
];
this.fltRooms = this.rooms.filter(room =>
fields.every(field => !formValues[field.f] || formValues[field.f] == room[field.p]);
)
add a comment |
up vote
0
down vote
If you're going to need to extend it, make a map array between the two structures
var fields = [
{f: "auditoryNumber", p: "title"},
{f: "floor", p: "floor"},
{f: "corpus", p: "building"}
];
this.fltRooms = this.rooms.filter(room =>
fields.every(field => !formValues[field.f] || formValues[field.f] == room[field.p]);
)
add a comment |
up vote
0
down vote
up vote
0
down vote
If you're going to need to extend it, make a map array between the two structures
var fields = [
{f: "auditoryNumber", p: "title"},
{f: "floor", p: "floor"},
{f: "corpus", p: "building"}
];
this.fltRooms = this.rooms.filter(room =>
fields.every(field => !formValues[field.f] || formValues[field.f] == room[field.p]);
)
If you're going to need to extend it, make a map array between the two structures
var fields = [
{f: "auditoryNumber", p: "title"},
{f: "floor", p: "floor"},
{f: "corpus", p: "building"}
];
this.fltRooms = this.rooms.filter(room =>
fields.every(field => !formValues[field.f] || formValues[field.f] == room[field.p]);
)
answered Nov 19 at 14:55
James
11.6k21430
11.6k21430
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376611%2fhow-to-use-filter-with-conditionals-inside%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
also would great to provide sample array flitrooms
– dganenco
Nov 19 at 14:28
Is it possible that no filters are set? And if no filters set should it return all or none?
– epascarello
Nov 19 at 14:32
Seems like all you need is
_rule = _rule && ...
and also initialize_rule
totrue
– Pointy
Nov 19 at 14:32