Passed
Push — master ( 746cb5...4ed6ec )
by Alberto
47s queued 11s
created

lib/Resource.js   A

Complexity

Total Complexity 14
Complexity/F 2.33

Size

Lines of Code 36
Function Count 6

Duplication

Duplicated Lines 11
Ratio 30.56 %

Importance

Changes 0
Metric Value
wmc 14
eloc 28
mnd 8
bc 8
fnc 6
dl 11
loc 36
bpm 1.3333
cpm 2.3333
noi 12
c 0
b 0
f 0
rs 10

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
"use strict";
2
var __assign = (this && this.__assign) || function () {
3
    __assign = Object.assign || function(t) {
4
        for (var s, i = 1, n = arguments.length; i < n; i++) {
5
            s = arguments[i];
6
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
                t[p] = s[p];
8
        }
9
        return t;
10
    };
11
    return __assign.apply(this, arguments);
12
};
13
var __rest = (this && this.__rest) || function (s, e) {
14
    var t = {};
15
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
        t[p] = s[p];
17
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
                t[p[i]] = s[p[i]];
21
        }
22
    return t;
23
};
24
Object.defineProperty(exports, "__esModule", { value: true });
25
var monocle_ts_1 = require("monocle-ts");
26
exports.Resource = {
27
    lens: {
28
        identifier: new monocle_ts_1.Lens(function (_a) {
29
            var type = _a.type, id = _a.id, _ = __rest(_a, ["type", "id"]);
30
            return ({ type: type, id: id });
31
        }, function (_a) {
32
            var type = _a.type, id = _a.id, _ = __rest(_a, ["type", "id"]);
33
            return function (s) { return (__assign(__assign({}, s), { type: type, id: id })); };
34
        })
35
    }
36
};
37