Test Setup Failed
Push — master ( 982d9a...a2862f )
by
unknown
03:40
created

Select2SalesCustomerComponent   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
define(function(require) {
2
    'use strict';
3
4
    var _ = require('underscore');
5
    var Select2AutocompleteComponent = require('oro/select2-autocomplete-component');
6
7
    var Select2SalesCustomerComponent = Select2AutocompleteComponent.extend({
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable Select2SalesCustomerComponent already seems to be declared on line 11. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
8
        /**
9
         * @inheritDoc
10
         */
11
        constructor: function Select2SalesCustomerComponent() {
12
            Select2SalesCustomerComponent.__super__.constructor.apply(this, arguments);
13
        },
14
15
        setConfig: function(config) {
16
            config.formatContext = function() {
17
                return {
18
                    account: config.accountLabel
19
                };
20
            };
21
            config = Select2SalesCustomerComponent.__super__.setConfig.apply(this, arguments);
22
            if (config.createSearchChoice) {
23
                config.createSearchChoice = _.wrap(config.createSearchChoice, function(original, value) {
24
                    var result = original(value);
25
                    result.icon = config.newAccountIcon || {};
26
27
                    return result;
28
                });
29
            }
30
            return config;
31
        }
32
    });
33
34
    return Select2SalesCustomerComponent;
35
});
36