This repository has been archived by the owner on Jan 22, 2021. It is now read-only.
forked from ro31337/libretaxi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ro31337#309 Improve select locale menu action (ro31337#312)
- Loading branch information
Showing
10 changed files
with
89 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Condition from './condition'; | ||
|
||
/** | ||
* In Condition. | ||
* Accepts value and array. Returns true when array includes value. | ||
* | ||
* @author Roman Pushkin ([email protected]) | ||
* @date 2016-11-11 | ||
* @extends {Condition} | ||
* @version 1.1 | ||
* @since 0.1.0 | ||
*/ | ||
export default class In extends Condition { | ||
constructor(value, arr) { | ||
super({ type: 'in' }); | ||
this.value = value; | ||
this.arr = arr; | ||
} | ||
|
||
/** | ||
* Entry point for condition. | ||
* | ||
* @returns {boolean} result - `true` if array includes value, `false` otherwise. | ||
*/ | ||
call() { | ||
return this.arr.includes(this.value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import Condition from './condition'; | |
|
||
/** | ||
* Not In Condition. | ||
* Accepts value and array. Returns true if value is not in array. | ||
* Accepts value and array. Returns true if array doesn't include value. | ||
* | ||
* @author Roman Pushkin ([email protected]) | ||
* @date 2016-09-11 | ||
|
@@ -20,8 +20,7 @@ export default class NotIn extends Condition { | |
/** | ||
* Entry point for condition. | ||
* | ||
* @returns {boolean} result - returns `true` if actual equals expected, otherwise | ||
* returns `false`. | ||
* @returns {boolean} result - `true` if array doesn't include value, `false` otherwise. | ||
*/ | ||
call() { | ||
return !this.arr.includes(this.value); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* eslint-disable no-new */ | ||
import test from 'ava'; | ||
import In from '../../src/conditions/in'; | ||
|
||
test('can be constructed with default parameters', t => { | ||
const c1 = new In(2, [2, 4, 6]); | ||
t.is(c1.type, 'in'); | ||
}); | ||
|
||
test('should be truthy when element in', t => { | ||
const c1 = new In(1, [1, 4, 6]); | ||
const c2 = new In('one', ['one', 'four', 'six']); | ||
t.truthy(c1.call()); | ||
t.truthy(c2.call()); | ||
}); | ||
|
||
test('should be falsy when element not in', t => { | ||
const c1 = new In(1, [2, 4, 6]); | ||
const c2 = new In('one', ['two', 'four', 'six']); | ||
t.falsy(c1.call()); | ||
t.falsy(c2.call()); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.