summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/nfvo-utils/getValue.js
diff options
context:
space:
mode:
authorEinav Weiss Keidar <einavw@amdocs.com>2018-03-20 14:45:40 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-03-20 13:52:31 +0000
commit7fdf733a64670fceefc3ded35cfa581e1c458179 (patch)
treeb3623ac9a331473830cb0167c0b487f2a176427c /openecomp-ui/src/nfvo-utils/getValue.js
parentc7916a4e5955ccc5f0f5252307363b791ec5c7b9 (diff)
Adding Prettier and fixing up eslint version
Issue-ID: SDC-1094 Change-Id: Ie83ad95a03899345dd90235daf0323cbe3bc6afd Signed-off-by: Einav Weiss Keidar <einavw@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/nfvo-utils/getValue.js')
-rw-r--r--openecomp-ui/src/nfvo-utils/getValue.js54
1 files changed, 33 insertions, 21 deletions
diff --git a/openecomp-ui/src/nfvo-utils/getValue.js b/openecomp-ui/src/nfvo-utils/getValue.js
index 5ab0c76d73..0cac3cd726 100644
--- a/openecomp-ui/src/nfvo-utils/getValue.js
+++ b/openecomp-ui/src/nfvo-utils/getValue.js
@@ -13,38 +13,50 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
-import {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx';
+import { other as optionInputOther } from 'nfvo-components/input/validation/InputOptions.jsx';
function getValueFromObject(element) {
- return element.choices && element.choices.length > 0 && element.choices[0] !== '' && element.choices[0] !== optionInputOther.OTHER ||
- element.other && element.choices[0] === optionInputOther.OTHER ?
- element : undefined;
+ return (element.choices &&
+ element.choices.length > 0 &&
+ element.choices[0] !== '' &&
+ element.choices[0] !== optionInputOther.OTHER) ||
+ (element.other && element.choices[0] === optionInputOther.OTHER)
+ ? element
+ : undefined;
}
function getValueFromVariable(variable) {
- return variable ? variable : undefined;
+ return variable ? variable : undefined;
}
function getArrayData(variable) {
- return variable.length ? variable : undefined;
+ return variable.length ? variable : undefined;
}
- let getValue = element => {
- return typeof element === 'object' ?
- element instanceof Array ? getArrayData(element) : getValueFromObject(element) :
- getValueFromVariable(element);
- };
+let getValue = element => {
+ return typeof element === 'object'
+ ? element instanceof Array
+ ? getArrayData(element)
+ : getValueFromObject(element)
+ : getValueFromVariable(element);
+};
export function getStrValue(choiceObject) {
- if (!choiceObject) {
- return undefined;
- }
- if (choiceObject.choice && choiceObject.choice !== '' && choiceObject.choice !== optionInputOther.OTHER) {
- return choiceObject.choice;
- }
- else if (choiceObject.other && choiceObject.choice === optionInputOther.OTHER) {
- return choiceObject.other;
- }
+ if (!choiceObject) {
+ return undefined;
+ }
+ if (
+ choiceObject.choice &&
+ choiceObject.choice !== '' &&
+ choiceObject.choice !== optionInputOther.OTHER
+ ) {
+ return choiceObject.choice;
+ } else if (
+ choiceObject.other &&
+ choiceObject.choice === optionInputOther.OTHER
+ ) {
+ return choiceObject.other;
+ }
}
- export default getValue;
+export default getValue;