@contrail/util 1.0.11 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './object-util/object-util';
2
- export * from './string-util/string-util';
1
+ export * from './object-util/object-util';
2
+ export * from './string-util/string-util';
package/lib/index.js CHANGED
@@ -1,14 +1,14 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./object-util/object-util"), exports);
14
- __exportStar(require("./string-util/string-util"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./object-util/object-util"), exports);
14
+ __exportStar(require("./string-util/string-util"), exports);
@@ -1 +1 @@
1
- export declare function cloneDeep(obj: any): any;
1
+ export declare function cloneDeep(obj: any): any;
@@ -1,10 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cloneDeep = void 0;
4
- function cloneDeep(obj) {
5
- if (!obj) {
6
- return null;
7
- }
8
- return JSON.parse(JSON.stringify(obj));
9
- }
10
- exports.cloneDeep = cloneDeep;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cloneDeep = void 0;
4
+ function cloneDeep(obj) {
5
+ if (!obj) {
6
+ return null;
7
+ }
8
+ return JSON.parse(JSON.stringify(obj));
9
+ }
10
+ exports.cloneDeep = cloneDeep;
@@ -0,0 +1,7 @@
1
+ export interface ObjectDiff {
2
+ propertyName: string;
3
+ oldValue: any;
4
+ newValue: any;
5
+ }
6
+ export declare function getObjectDiffs(before: any, after: any, prefix: string): ObjectDiff[];
7
+ export declare function getObjectDiff(before: any, after: any, name: any): ObjectDiff;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getObjectDiff = exports.getObjectDiffs = void 0;
4
+ function getObjectDiffs(before, after, prefix) {
5
+ const diffs = [];
6
+ if (!before || !after) {
7
+ return diffs;
8
+ }
9
+ const beforeProperties = Object.getOwnPropertyNames(before);
10
+ const afterProperties = Object.getOwnPropertyNames(after);
11
+ const addedProperties = afterProperties.filter(value => !beforeProperties.includes(value));
12
+ const deletedProperties = beforeProperties.filter(value => !afterProperties.includes(value));
13
+ const commonProperties = beforeProperties.filter(value => afterProperties.includes(value));
14
+ addedProperties.forEach(addedProperty => {
15
+ diffs.push(getObjectDiff(null, after[addedProperty], prefix + addedProperty));
16
+ });
17
+ deletedProperties.forEach(deletedProperty => {
18
+ diffs.push(getObjectDiff(before[deletedProperty], null, prefix + deletedProperty));
19
+ });
20
+ commonProperties.forEach(commonProperty => {
21
+ const beforeVal = before[commonProperty];
22
+ const afterVal = after[commonProperty];
23
+ if (beforeVal === afterVal) {
24
+ return;
25
+ }
26
+ if (beforeVal === null || afterVal === null) {
27
+ diffs.push(getObjectDiff(beforeVal, afterVal, prefix + commonProperty));
28
+ return;
29
+ }
30
+ if (typeof beforeVal !== typeof afterVal) {
31
+ diffs.push(getObjectDiff(beforeVal, afterVal, prefix + commonProperty));
32
+ return;
33
+ }
34
+ if (isObject(beforeVal)) {
35
+ if (isDate(beforeVal)) {
36
+ if (!datesEqual(beforeVal, afterVal)) {
37
+ diffs.push(getObjectDiff(beforeVal, afterVal, prefix + commonProperty));
38
+ }
39
+ }
40
+ else if (Array.isArray(beforeVal)) {
41
+ const beforeArray = [...beforeVal].sort(sortFunc);
42
+ const afterArray = [...afterVal].sort(sortFunc);
43
+ if (JSON.stringify(beforeArray) !== JSON.stringify(afterArray)) {
44
+ diffs.push(getObjectDiff(beforeVal, afterVal, prefix + commonProperty));
45
+ }
46
+ }
47
+ else {
48
+ const nestedObjectDiffs = getObjectDiffs(beforeVal, afterVal, prefix + commonProperty + '.');
49
+ diffs.push(...nestedObjectDiffs);
50
+ }
51
+ }
52
+ else {
53
+ if (beforeVal !== afterVal) {
54
+ diffs.push(getObjectDiff(beforeVal, afterVal, prefix + commonProperty));
55
+ }
56
+ }
57
+ });
58
+ return diffs;
59
+ }
60
+ exports.getObjectDiffs = getObjectDiffs;
61
+ function getObjectDiff(before, after, name) {
62
+ const diff = {
63
+ propertyName: name,
64
+ oldValue: before,
65
+ newValue: after,
66
+ };
67
+ return diff;
68
+ }
69
+ exports.getObjectDiff = getObjectDiff;
70
+ function sortFunc(x, y) {
71
+ const pre = ['string', 'number', 'bool'];
72
+ if (typeof x !== typeof y)
73
+ return pre.indexOf(typeof y) - pre.indexOf(typeof x);
74
+ if (x === y)
75
+ return 0;
76
+ else
77
+ return (x > y) ? 1 : -1;
78
+ }
79
+ function isObject(object) {
80
+ return object != null && typeof object === 'object';
81
+ }
82
+ function isDate(object) {
83
+ return object != null && object instanceof Date;
84
+ }
85
+ function datesEqual(date1, date2) {
86
+ return date1.getTime() === date2.getTime();
87
+ }
@@ -0,0 +1,88 @@
1
+ export declare const item1Assortment1: {
2
+ id: string;
3
+ stringProperty: string;
4
+ intProperty: number;
5
+ boolProperty: boolean;
6
+ dateProperty: Date;
7
+ arrayProperty: string[];
8
+ };
9
+ export declare const item1Assortment2: {
10
+ id: string;
11
+ stringProperty: string;
12
+ intProperty: number;
13
+ boolProperty: boolean;
14
+ dateProperty: Date;
15
+ arrayProperty: string[];
16
+ };
17
+ export declare const item1Assortment3: {
18
+ id: string;
19
+ stringProperty: string;
20
+ intProperty: number;
21
+ boolProperty: boolean;
22
+ dateProperty: Date;
23
+ arrayProperty: any;
24
+ };
25
+ export declare const item2Assortment1: {
26
+ id: string;
27
+ stringProperty: string;
28
+ intProperty: number;
29
+ boolProperty: boolean;
30
+ dateProperty: Date;
31
+ arrayProperty: string[];
32
+ };
33
+ export declare const item2Assortment2ScalarChange: {
34
+ id: string;
35
+ stringProperty: string;
36
+ intProperty: number;
37
+ boolProperty: boolean;
38
+ dateProperty: Date;
39
+ arrayProperty: string[];
40
+ };
41
+ export declare const item2Assortment2ArrayChange: {
42
+ id: string;
43
+ stringProperty: string;
44
+ intProperty: number;
45
+ boolProperty: boolean;
46
+ dateProperty: Date;
47
+ arrayProperty: string[];
48
+ };
49
+ export declare const item2Assortment2DateChange: {
50
+ id: string;
51
+ stringProperty: string;
52
+ intProperty: number;
53
+ boolProperty: boolean;
54
+ dateProperty: Date;
55
+ arrayProperty: string[];
56
+ };
57
+ export declare const item3Assortment1: {
58
+ id: string;
59
+ stringProperty: string;
60
+ intProperty: number;
61
+ boolProperty: boolean;
62
+ dateProperty: Date;
63
+ arrayProperty: string[];
64
+ nestedProperties: {
65
+ nestedBoolProperty: boolean;
66
+ nestedDateProperty: Date;
67
+ nestedArrayProperty: string[];
68
+ nestedObject: {
69
+ nestedBoolProperty: boolean;
70
+ };
71
+ };
72
+ };
73
+ export declare const item3Assortment2NestedChanges: {
74
+ id: string;
75
+ stringProperty: string;
76
+ intProperty: number;
77
+ boolProperty: boolean;
78
+ dateProperty: Date;
79
+ arrayProperty: string[];
80
+ nestedProperties: {
81
+ nestedBoolProperty: boolean;
82
+ nestedDateProperty: Date;
83
+ nestedArrayProperty: string[];
84
+ nestedObject: {
85
+ nestedBoolProperty: boolean;
86
+ };
87
+ };
88
+ };
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.item3Assortment2NestedChanges = exports.item3Assortment1 = exports.item2Assortment2DateChange = exports.item2Assortment2ArrayChange = exports.item2Assortment2ScalarChange = exports.item2Assortment1 = exports.item1Assortment3 = exports.item1Assortment2 = exports.item1Assortment1 = void 0;
4
+ exports.item1Assortment1 = {
5
+ id: 'id1',
6
+ stringProperty: 'stringProperty1',
7
+ intProperty: 1,
8
+ boolProperty: false,
9
+ dateProperty: new Date('12/22/1994'),
10
+ arrayProperty: ['A', 'B', 'C'],
11
+ };
12
+ exports.item1Assortment2 = {
13
+ id: 'id1',
14
+ stringProperty: 'stringProperty1',
15
+ intProperty: 1,
16
+ boolProperty: false,
17
+ dateProperty: new Date('12/22/1994'),
18
+ arrayProperty: ['A', 'B', 'C'],
19
+ };
20
+ exports.item1Assortment3 = {
21
+ id: 'id1',
22
+ stringProperty: 'stringProperty1',
23
+ intProperty: 1,
24
+ boolProperty: false,
25
+ dateProperty: new Date('12/22/1994'),
26
+ arrayProperty: null,
27
+ };
28
+ exports.item2Assortment1 = {
29
+ id: 'id2',
30
+ stringProperty: 'stringProperty2',
31
+ intProperty: 2,
32
+ boolProperty: false,
33
+ dateProperty: new Date('12/23/1994'),
34
+ arrayProperty: ['A', 'B'],
35
+ };
36
+ exports.item2Assortment2ScalarChange = {
37
+ id: 'id2',
38
+ stringProperty: 'stringProperty3Update',
39
+ intProperty: 4,
40
+ boolProperty: true,
41
+ dateProperty: new Date('12/23/1994'),
42
+ arrayProperty: ['A', 'B'],
43
+ };
44
+ exports.item2Assortment2ArrayChange = {
45
+ id: 'id2',
46
+ stringProperty: 'stringProperty2',
47
+ intProperty: 2,
48
+ boolProperty: false,
49
+ dateProperty: new Date('12/23/1994'),
50
+ arrayProperty: ['A', 'B', 'D'],
51
+ };
52
+ exports.item2Assortment2DateChange = {
53
+ id: 'id2',
54
+ stringProperty: 'stringProperty2',
55
+ intProperty: 2,
56
+ boolProperty: false,
57
+ dateProperty: new Date('12/23/1995'),
58
+ arrayProperty: ['A', 'B'],
59
+ };
60
+ exports.item3Assortment1 = {
61
+ id: 'id3',
62
+ stringProperty: 'stringProperty2',
63
+ intProperty: 2,
64
+ boolProperty: false,
65
+ dateProperty: new Date('12/23/1994'),
66
+ arrayProperty: ['A', 'B'],
67
+ nestedProperties: {
68
+ nestedBoolProperty: false,
69
+ nestedDateProperty: new Date('12/22/1994'),
70
+ nestedArrayProperty: ['C', 'D'],
71
+ nestedObject: {
72
+ nestedBoolProperty: false,
73
+ },
74
+ },
75
+ };
76
+ exports.item3Assortment2NestedChanges = {
77
+ id: 'id3',
78
+ stringProperty: 'stringProperty2',
79
+ intProperty: 2,
80
+ boolProperty: true,
81
+ dateProperty: new Date('12/23/1994'),
82
+ arrayProperty: ['A', 'B'],
83
+ nestedProperties: {
84
+ nestedBoolProperty: false,
85
+ nestedDateProperty: new Date('12/23/1995'),
86
+ nestedArrayProperty: ['C', 'D', 'A'],
87
+ nestedObject: {
88
+ nestedBoolProperty: true,
89
+ },
90
+ },
91
+ };
@@ -1 +1 @@
1
- export declare function isObject(item: any): boolean;
1
+ export declare function isObject(item: any): boolean;
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isObject = void 0;
4
- function isObject(item) {
5
- return (item && typeof item === 'object' && !Array.isArray(item));
6
- }
7
- exports.isObject = isObject;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isObject = void 0;
4
+ function isObject(item) {
5
+ return (item && typeof item === 'object' && !Array.isArray(item));
6
+ }
7
+ exports.isObject = isObject;
@@ -1 +1 @@
1
- export declare function mergeDeep(target: any, ...sources: any[]): any;
1
+ export declare function mergeDeep(target: any, ...sources: any[]): any;
@@ -1,23 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeDeep = void 0;
4
- const isObject_1 = require("../isObject/isObject");
5
- function mergeDeep(target, ...sources) {
6
- if (!sources.length)
7
- return target;
8
- const source = sources.shift();
9
- if (isObject_1.isObject(target) && isObject_1.isObject(source)) {
10
- for (const key in source) {
11
- if (isObject_1.isObject(source[key])) {
12
- if (!target[key])
13
- Object.assign(target, { [key]: {} });
14
- mergeDeep(target[key], source[key]);
15
- }
16
- else {
17
- Object.assign(target, { [key]: source[key] });
18
- }
19
- }
20
- }
21
- return mergeDeep(target, ...sources);
22
- }
23
- exports.mergeDeep = mergeDeep;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeDeep = void 0;
4
+ const isObject_1 = require("../isObject/isObject");
5
+ function mergeDeep(target, ...sources) {
6
+ if (!sources.length)
7
+ return target;
8
+ const source = sources.shift();
9
+ if (isObject_1.isObject(target) && isObject_1.isObject(source)) {
10
+ for (const key in source) {
11
+ if (isObject_1.isObject(source[key])) {
12
+ if (!target[key])
13
+ Object.assign(target, { [key]: {} });
14
+ mergeDeep(target[key], source[key]);
15
+ }
16
+ else {
17
+ Object.assign(target, { [key]: source[key] });
18
+ }
19
+ }
20
+ }
21
+ return mergeDeep(target, ...sources);
22
+ }
23
+ exports.mergeDeep = mergeDeep;
@@ -1,10 +1,13 @@
1
- import { cloneDeep } from './cloneDeep/cloneDeep';
2
- import { isObject } from './isObject/isObject';
3
- import { mergeDeep } from './mergeDeep/mergeDeep';
4
- export declare class ObjectUtil {
5
- static getByPath(obj: any, path: string, def?: any): any;
6
- static setByPath(obj: any, path: string, value: any): void;
7
- static isObject: typeof isObject;
8
- static mergeDeep: typeof mergeDeep;
9
- static cloneDeep: typeof cloneDeep;
10
- }
1
+ import { cloneDeep } from './cloneDeep/cloneDeep';
2
+ import { isObject } from './isObject/isObject';
3
+ import { mergeDeep } from './mergeDeep/mergeDeep';
4
+ import { getObjectDiffs } from './compareDeep/compareDeep';
5
+ export { ObjectDiff } from './compareDeep/compareDeep';
6
+ export declare class ObjectUtil {
7
+ static getByPath(obj: any, path: string, def?: any): any;
8
+ static setByPath(obj: any, path: string, value: any): void;
9
+ static isObject: typeof isObject;
10
+ static mergeDeep: typeof mergeDeep;
11
+ static cloneDeep: typeof cloneDeep;
12
+ static compareDeep: typeof getObjectDiffs;
13
+ }
@@ -1,38 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObjectUtil = void 0;
4
- const cloneDeep_1 = require("./cloneDeep/cloneDeep");
5
- const isObject_1 = require("./isObject/isObject");
6
- const mergeDeep_1 = require("./mergeDeep/mergeDeep");
7
- class ObjectUtil {
8
- static getByPath(obj, path, def = null) {
9
- const pathUnits = path
10
- .replace(/\[/g, '.')
11
- .replace(/]/g, '')
12
- .split('.');
13
- pathUnits.forEach((level) => {
14
- if (obj) {
15
- obj = obj[level];
16
- }
17
- });
18
- if (obj === undefined) {
19
- return def;
20
- }
21
- return obj;
22
- }
23
- static setByPath(obj, path, value) {
24
- const a = path.split('.');
25
- let o = obj;
26
- while (a.length - 1) {
27
- const n = a.shift();
28
- if (!(n in o))
29
- o[n] = {};
30
- o = o[n];
31
- }
32
- o[a[0]] = value;
33
- }
34
- }
35
- exports.ObjectUtil = ObjectUtil;
36
- ObjectUtil.isObject = isObject_1.isObject;
37
- ObjectUtil.mergeDeep = mergeDeep_1.mergeDeep;
38
- ObjectUtil.cloneDeep = cloneDeep_1.cloneDeep;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObjectUtil = void 0;
4
+ const cloneDeep_1 = require("./cloneDeep/cloneDeep");
5
+ const isObject_1 = require("./isObject/isObject");
6
+ const mergeDeep_1 = require("./mergeDeep/mergeDeep");
7
+ const compareDeep_1 = require("./compareDeep/compareDeep");
8
+ class ObjectUtil {
9
+ static getByPath(obj, path, def = null) {
10
+ const pathUnits = path
11
+ .replace(/\[/g, '.')
12
+ .replace(/]/g, '')
13
+ .split('.');
14
+ pathUnits.forEach((level) => {
15
+ if (obj) {
16
+ obj = obj[level];
17
+ }
18
+ });
19
+ if (obj === undefined) {
20
+ return def;
21
+ }
22
+ return obj;
23
+ }
24
+ static setByPath(obj, path, value) {
25
+ const a = path.split('.');
26
+ let o = obj;
27
+ while (a.length - 1) {
28
+ const n = a.shift();
29
+ if (!(n in o))
30
+ o[n] = {};
31
+ o = o[n];
32
+ }
33
+ o[a[0]] = value;
34
+ }
35
+ }
36
+ exports.ObjectUtil = ObjectUtil;
37
+ ObjectUtil.isObject = isObject_1.isObject;
38
+ ObjectUtil.mergeDeep = mergeDeep_1.mergeDeep;
39
+ ObjectUtil.cloneDeep = cloneDeep_1.cloneDeep;
40
+ ObjectUtil.compareDeep = compareDeep_1.getObjectDiffs;
@@ -1,3 +1,5 @@
1
- export declare class StringUtil {
2
- static convertToHyphenCase(entityName: string, transformToLowerCase?: boolean): string;
3
- }
1
+ export declare class StringUtil {
2
+ static convertToHyphenCase(entityName: string, transformToLowerCase?: boolean): string;
3
+ static parseVariables(variableString: string, data: any, quoteStrings?: boolean): string;
4
+ static isString(value: any): boolean;
5
+ }
@@ -1,13 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StringUtil = void 0;
4
- class StringUtil {
5
- static convertToHyphenCase(entityName, transformToLowerCase = true) {
6
- const slugName = entityName === null || entityName === void 0 ? void 0 : entityName.split(/(?=[A-Z])/).join('-');
7
- if (slugName && transformToLowerCase) {
8
- return slugName.toLowerCase();
9
- }
10
- return slugName;
11
- }
12
- }
13
- exports.StringUtil = StringUtil;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StringUtil = void 0;
4
+ class StringUtil {
5
+ static convertToHyphenCase(entityName, transformToLowerCase = true) {
6
+ const slugName = entityName === null || entityName === void 0 ? void 0 : entityName.split(/(?=[A-Z])/).join('-');
7
+ if (slugName && transformToLowerCase) {
8
+ return slugName.toLowerCase();
9
+ }
10
+ return slugName;
11
+ }
12
+ static parseVariables(variableString, data, quoteStrings = false) {
13
+ const regExp = /\{([^}]+)\}/;
14
+ let done = false;
15
+ let currentVariableString = variableString;
16
+ while (!done) {
17
+ const match = regExp.exec(currentVariableString);
18
+ if (!match) {
19
+ done = true;
20
+ break;
21
+ }
22
+ const variableLevels = match[1].split('.');
23
+ let replacementValue = data;
24
+ for (let i = 0; i < variableLevels.length; i++) {
25
+ replacementValue = replacementValue[variableLevels[i]];
26
+ }
27
+ if (quoteStrings && StringUtil.isString(replacementValue)) {
28
+ replacementValue = JSON.stringify(replacementValue);
29
+ }
30
+ currentVariableString = currentVariableString.replace(match[0], replacementValue);
31
+ }
32
+ return currentVariableString;
33
+ }
34
+ static isString(value) {
35
+ return typeof value === 'string' || value instanceof String;
36
+ }
37
+ }
38
+ exports.StringUtil = StringUtil;
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
- {
2
- "name": "@contrail/util",
3
- "version": "1.0.11",
4
- "description": "General javascript utilities",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "scripts": {
8
- "build": "tsc",
9
- "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
10
- "lint": "tslint -p tsconfig.json",
11
- "test:watch": "jest --watch",
12
- "test": "jest"
13
- },
14
- "keywords": [],
15
- "author": "",
16
- "license": "ISC",
17
- "devDependencies": {
18
- "@types/jest": "^23.3.14",
19
- "jest": "^23.6.0",
20
- "prettier": "^1.19.1",
21
- "ts-jest": "^23.10.5",
22
- "tslint": "^5.11.0",
23
- "tslint-config-prettier": "^1.18.0",
24
- "typescript": "^3.0.1"
25
- },
26
- "jest": {
27
- "moduleFileExtensions": [
28
- "js",
29
- "json",
30
- "ts"
31
- ],
32
- "rootDir": "src",
33
- "testRegex": ".spec.ts$",
34
- "transform": {
35
- "^.+\\.(t|j)s$": "ts-jest"
36
- },
37
- "coverageDirectory": "../coverage",
38
- "testEnvironment": "node"
39
- },
40
- "dependencies": {}
41
- }
1
+ {
2
+ "name": "@contrail/util",
3
+ "version": "1.0.15",
4
+ "description": "General javascript utilities",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
10
+ "lint": "tslint -p tsconfig.json",
11
+ "test:watch": "jest --watch",
12
+ "test": "jest"
13
+ },
14
+ "keywords": [],
15
+ "author": "",
16
+ "license": "ISC",
17
+ "devDependencies": {
18
+ "@types/jest": "^23.3.14",
19
+ "jest": "^23.6.0",
20
+ "prettier": "^1.19.1",
21
+ "ts-jest": "^23.10.5",
22
+ "tslint": "^5.11.0",
23
+ "tslint-config-prettier": "^1.18.0",
24
+ "typescript": "^3.0.1"
25
+ },
26
+ "jest": {
27
+ "moduleFileExtensions": [
28
+ "js",
29
+ "json",
30
+ "ts"
31
+ ],
32
+ "rootDir": "src",
33
+ "testRegex": ".spec.ts$",
34
+ "transform": {
35
+ "^.+\\.(t|j)s$": "ts-jest"
36
+ },
37
+ "coverageDirectory": "../coverage",
38
+ "testEnvironment": "node"
39
+ },
40
+ "dependencies": {}
41
+ }