Socket
Socket
Sign inDemoInstall

@simplysm/sd-core-common

Package Overview
Dependencies
Maintainers
1
Versions
605
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@simplysm/sd-core-common - npm Package Compare versions

Comparing version 3.1.136 to 3.1.137

4

dist/decorator/NotifyPropertyChange.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PropertyGetSetDecoratorBase_1 = require("./PropertyGetSetDecoratorBase");
const PropertyGetSetDecoratorBase_1 = require("./PropertyGetSetDecoratorBase");
function NotifyPropertyChange() {
return PropertyGetSetDecoratorBase_1.PropertyGetSetDecoratorBase({
afterSet: function (target, propertyName, oldValue, newValue) {
afterSet: (target, propertyName, oldValue, newValue) => {
target.onPropertyChange(propertyName, oldValue, newValue);

@@ -8,0 +8,0 @@ }

@@ -6,8 +6,8 @@ "use strict";

var _a, _b;
var prevDescriptor = (inputDescriptor !== null && inputDescriptor !== void 0 ? inputDescriptor : Object.getOwnPropertyDescriptor(target, propertyName));
var prevGetter = (_a = prevDescriptor) === null || _a === void 0 ? void 0 : _a.get;
var prevSetter = (_b = prevDescriptor) === null || _b === void 0 ? void 0 : _b.set;
var _val = target[propertyName];
var getter = function () {
var value = prevGetter ? prevGetter.bind(this)() : _val;
const prevDescriptor = (inputDescriptor !== null && inputDescriptor !== void 0 ? inputDescriptor : Object.getOwnPropertyDescriptor(target, propertyName));
const prevGetter = (_a = prevDescriptor) === null || _a === void 0 ? void 0 : _a.get;
const prevSetter = (_b = prevDescriptor) === null || _b === void 0 ? void 0 : _b.set;
let _val = target[propertyName];
const getter = function () {
const value = prevGetter ? prevGetter.bind(this)() : _val;
if (arg.get) {

@@ -18,7 +18,7 @@ arg.get(this, propertyName, value);

};
var setter = function (value) {
var prevValue = prevGetter ? prevGetter.bind(this)() : _val;
var realValue = value;
const setter = function (value) {
const prevValue = prevGetter ? prevGetter.bind(this)() : _val;
let realValue = value;
if (arg.beforeSet) {
var beforeSetResult = arg.beforeSet(this, propertyName, prevValue, realValue);
const beforeSetResult = arg.beforeSet(this, propertyName, prevValue, realValue);
if (beforeSetResult) {

@@ -25,0 +25,0 @@ realValue = beforeSetResult();

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var CustomError_1 = require("./CustomError");
var ArgumentError = (function (_super) {
tslib_1.__extends(ArgumentError, _super);
function ArgumentError(argObj) {
return _super.call(this, "인수가 잘못되었습니다: " + JSON.stringify(argObj)) || this;
const CustomError_1 = require("./CustomError");
class ArgumentError extends CustomError_1.CustomError {
constructor(argObj) {
super("인수가 잘못되었습니다: " + JSON.stringify(argObj));
}
return ArgumentError;
}(CustomError_1.CustomError));
}
exports.ArgumentError = ArgumentError;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var CustomError = (function (_super) {
tslib_1.__extends(CustomError, _super);
function CustomError(arg1, arg2) {
var _newTarget = this.constructor;
var _this = this;
class CustomError extends Error {
constructor(arg1, arg2) {
if ((arg1 && arg1["message"] && arg1["stack"]) || typeof arg2 === "string") {
_this = _super.call(this, arg2 + (arg1 instanceof Error ? " => " + arg1.message : "")) || this;
super(arg2 + (arg1 instanceof Error ? ` => ${arg1.message}` : ""));
}
else {
_this = _super.call(this, arg1) || this;
super(arg1);
}
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = _newTarget.name;
Object.setPrototypeOf(this, new.target.prototype);
this.name = new.target.name;
if (Error.captureStackTrace) {
Error.captureStackTrace(_this, _newTarget);
Error.captureStackTrace(this, new.target);
}
else {
try {
throw new Error(_this.message);
throw new Error(this.message);
}
catch (err) {
_this.stack = err.stack;
this.stack = err.stack;
}
}
if (arg1 && arg1["message"] && arg1["stack"]) {
_this.stack += "\n-- inner error stack --\n" + arg1["stack"];
this.stack += "\n-- inner error stack --\n" + arg1["stack"];
}
return _this;
}
return CustomError;
}(Error));
}
exports.CustomError = CustomError;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var CustomError_1 = require("./CustomError");
var NotImplementError = (function (_super) {
tslib_1.__extends(NotImplementError, _super);
function NotImplementError(message) {
return _super.call(this, "구현되어있지 않습니다" + (message ? ": " + message : "")) || this;
const CustomError_1 = require("./CustomError");
class NotImplementError extends CustomError_1.CustomError {
constructor(message) {
super("구현되어있지 않습니다" + (message ? ": " + message : ""));
}
return NotImplementError;
}(CustomError_1.CustomError));
}
exports.NotImplementError = NotImplementError;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var CustomError_1 = require("./CustomError");
var TimeoutError = (function (_super) {
tslib_1.__extends(TimeoutError, _super);
function TimeoutError(millisecond, message) {
return _super.call(this, "\uB300\uAE30\uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4" + (millisecond ? "(" + millisecond + "ms)" : "") + (message ? ": " + message : "")) || this;
const CustomError_1 = require("./CustomError");
class TimeoutError extends CustomError_1.CustomError {
constructor(millisecond, message) {
super(`대기시간이 초과되었습니다${millisecond ? `(${millisecond}ms)` : ""}${message ? `: ${message}` : ""}`);
}
return TimeoutError;
}(CustomError_1.CustomError));
}
exports.TimeoutError = TimeoutError;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ObjectUtil_1 = require("../util/ObjectUtil");
const ObjectUtil_1 = require("../util/ObjectUtil");
Array.prototype.single = function (predicate) {
var arr = predicate ? this.filter(predicate.bind(this)) : this;
const arr = predicate ? this.filter(predicate.bind(this)) : this;
if (arr.length > 1) {

@@ -14,3 +13,3 @@ throw new Error("복수의 결과물이 있습니다.");

if (predicate) {
for (var i = this.length - 1; i >= 0; i--) {
for (let i = this.length - 1; i >= 0; i--) {
if (predicate(this[i], i)) {

@@ -27,70 +26,29 @@ return this[i];

Array.prototype.filterExists = function () {
return this.filter(function (item) { return item !== undefined; });
return this.filter((item) => item !== undefined);
};
Array.prototype.ofType = function (type) {
return this.filter(function (item) { var _a; return item instanceof type || ((_a = item) === null || _a === void 0 ? void 0 : _a.constructor) === type; });
return this.filter((item) => { var _a; return item instanceof type || ((_a = item) === null || _a === void 0 ? void 0 : _a.constructor) === type; });
};
Array.prototype.mapMany = function (selector) {
var arr = selector ? this.map(selector) : this;
return arr.reduce(function (p, n) { return p.concat(n); });
const arr = selector ? this.map(selector) : this;
return arr.reduce((p, n) => p.concat(n));
};
Array.prototype.mapAsync = function (selector) {
return tslib_1.__awaiter(this, void 0, Promise, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, Promise.all(this.map(selector))];
case 1: return [2, _a.sent()];
}
});
});
Array.prototype.mapAsync = async function (selector) {
return await Promise.all(this.map(selector));
};
Array.prototype.mapManyAsync = function (selector) {
return tslib_1.__awaiter(this, void 0, Promise, function () {
var arr, _a;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
if (!selector) return [3, 2];
return [4, this.mapAsync(selector)];
case 1:
_a = _b.sent();
return [3, 3];
case 2:
_a = this;
_b.label = 3;
case 3:
arr = _a;
return [2, arr.mapMany()];
}
});
});
Array.prototype.mapManyAsync = async function (selector) {
const arr = selector ? await this.mapAsync(selector) : this;
return arr.mapMany();
};
Array.prototype.parallelAsync = function (fn) {
return tslib_1.__awaiter(this, void 0, Promise, function () {
var _this = this;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, Promise.all(this.map(function (item, index) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, fn(item, index)];
case 1:
_a.sent();
return [2];
}
});
}); }))];
case 1:
_a.sent();
return [2];
}
});
});
Array.prototype.parallelAsync = async function (fn) {
await Promise.all(this.map(async (item, index) => {
await fn(item, index);
}));
};
Array.prototype.groupBy = function (keySelector, valueSelector) {
var result = [];
var _loop_1 = function (i) {
var keyObj = keySelector(this_1[i], i);
var valueObj = valueSelector ? valueSelector(this_1[i], i) : this_1[i];
var existsRecord = result.single(function (item) { return ObjectUtil_1.ObjectUtil.equal(item.key, keyObj); });
const result = [];
for (let i = 0; i < this.length; i++) {
const keyObj = keySelector(this[i], i);
const valueObj = valueSelector ? valueSelector(this[i], i) : this[i];
const existsRecord = result.single((item) => ObjectUtil_1.ObjectUtil.equal(item.key, keyObj));
if (existsRecord) {

@@ -102,6 +60,2 @@ existsRecord.values.push(valueObj);

}
};
var this_1 = this;
for (var i = 0; i < this.length; i++) {
_loop_1(i);
}

@@ -111,9 +65,9 @@ return result;

Array.prototype.toMap = function (keySelector, valueSelector) {
var result = new Map();
for (var i = 0; i < this.length; i++) {
var item = this[i];
var keyObj = keySelector(item, i);
var valueObj = valueSelector ? valueSelector(item, i) : item;
const result = new Map();
for (let i = 0; i < this.length; i++) {
const item = this[i];
const keyObj = keySelector(item, i);
const valueObj = valueSelector ? valueSelector(item, i) : item;
if (result.has(keyObj)) {
throw new Error("\uD0A4\uAC00 \uC911\uBCF5\uB418\uC5C8\uC2B5\uB2C8\uB2E4. (\uC911\uBCF5\uB41C\uD0A4: " + JSON.stringify(keyObj) + ")");
throw new Error(`키가 중복되었습니다. (중복된키: ${JSON.stringify(keyObj)})`);
}

@@ -125,9 +79,9 @@ result.set(keyObj, valueObj);

Array.prototype.toObject = function (keySelector, valueSelector) {
var result = {};
for (var i = 0; i < this.length; i++) {
var item = this[i];
var key = keySelector(item, i);
var valueObj = valueSelector ? valueSelector(item, i) : item;
const result = {};
for (let i = 0; i < this.length; i++) {
const item = this[i];
const key = keySelector(item, i);
const valueObj = valueSelector ? valueSelector(item, i) : item;
if (result[key]) {
throw new Error("\uD0A4\uAC00 \uC911\uBCF5\uB418\uC5C8\uC2B5\uB2C8\uB2E4. (\uC911\uBCF5\uB41C\uD0A4: " + key + ")");
throw new Error(`키가 중복되었습니다. (중복된키: ${key})`);
}

@@ -139,11 +93,7 @@ result[key] = valueObj;

Array.prototype.distinct = function () {
var result = [];
var _loop_2 = function (item) {
if (!result.some(function (item1) { return ObjectUtil_1.ObjectUtil.equal(item1, item); })) {
const result = [];
for (const item of this) {
if (!result.some((item1) => ObjectUtil_1.ObjectUtil.equal(item1, item))) {
result.push(item);
}
};
for (var _i = 0, _a = this; _i < _a.length; _i++) {
var item = _a[_i];
_loop_2(item);
}

@@ -153,5 +103,5 @@ return result;

Array.prototype.orderBy = function (selector) {
return this.concat().sort(function (p, n) {
var pn = selector ? selector(n) : n;
var pp = selector ? selector(p) : p;
return this.concat().sort((p, n) => {
const pn = selector ? selector(n) : n;
const pp = selector ? selector(p) : p;
if ((typeof pn !== "string" && typeof pn !== "number") ||

@@ -165,5 +115,5 @@ (typeof pp !== "string" && typeof pp !== "number")) {

Array.prototype.orderByDesc = function (selector) {
return this.concat().sort(function (p, n) {
var pn = selector ? selector(n) : n;
var pp = selector ? selector(p) : p;
return this.concat().sort((p, n) => {
const pn = selector ? selector(n) : n;
const pp = selector ? selector(p) : p;
if ((typeof pn !== "string" && typeof pn !== "number") ||

@@ -178,13 +128,13 @@ (typeof pp !== "string" && typeof pp !== "number")) {

var _a;
var result = [];
var uncheckedTarget = [].concat(target);
var _loop_3 = function (sourceItem) {
var sameTarget = uncheckedTarget.single(function (targetItem) { var _a, _b; return ObjectUtil_1.ObjectUtil.equal(targetItem, sourceItem, ((_a = options) === null || _a === void 0 ? void 0 : _a.excludes) ? { excludes: (_b = options) === null || _b === void 0 ? void 0 : _b.excludes } : undefined); });
const result = [];
const uncheckedTarget = [].concat(target);
for (const sourceItem of this) {
const sameTarget = uncheckedTarget.single((targetItem) => { var _a, _b; return ObjectUtil_1.ObjectUtil.equal(targetItem, sourceItem, ((_a = options) === null || _a === void 0 ? void 0 : _a.excludes) ? { excludes: (_b = options) === null || _b === void 0 ? void 0 : _b.excludes } : undefined); });
if (!sameTarget) {
if ((_a = options) === null || _a === void 0 ? void 0 : _a.keys) {
var sameKeyTargetItem = uncheckedTarget.single(function (targetItem) { return ObjectUtil_1.ObjectUtil.equal(targetItem, sourceItem, { keys: options.keys }); });
const sameKeyTargetItem = uncheckedTarget.single((targetItem) => ObjectUtil_1.ObjectUtil.equal(targetItem, sourceItem, { keys: options.keys }));
if (sameKeyTargetItem) {
result.push({ source: sourceItem, target: sameKeyTargetItem });
uncheckedTarget.remove(sameKeyTargetItem);
return "continue";
continue;
}

@@ -197,9 +147,4 @@ }

}
};
for (var _i = 0, _b = this; _i < _b.length; _i++) {
var sourceItem = _b[_i];
_loop_3(sourceItem);
}
for (var _c = 0, uncheckedTarget_1 = uncheckedTarget; _c < uncheckedTarget_1.length; _c++) {
var uncheckedTargetItem = uncheckedTarget_1[_c];
for (const uncheckedTargetItem of uncheckedTarget) {
result.push({ target: uncheckedTargetItem });

@@ -210,7 +155,7 @@ }

Array.prototype.merge = function (target, options) {
var diffs = this.diffs(target, options);
var result = ObjectUtil_1.ObjectUtil.clone(this);
var _loop_4 = function (diff) {
const diffs = this.diffs(target, options);
const result = ObjectUtil_1.ObjectUtil.clone(this);
for (const diff of diffs) {
if (diff.source && diff.target) {
var resultSourceItem = result.single(function (item) { return ObjectUtil_1.ObjectUtil.equal(item, diff.source); });
const resultSourceItem = result.single((item) => ObjectUtil_1.ObjectUtil.equal(item, diff.source));
result[result.indexOf(resultSourceItem)] = ObjectUtil_1.ObjectUtil.merge(diff.source, diff.target);

@@ -221,6 +166,2 @@ }

}
};
for (var _i = 0, diffs_1 = diffs; _i < diffs_1.length; _i++) {
var diff = diffs_1[_i];
_loop_4(diff);
}

@@ -230,5 +171,5 @@ return result;

Array.prototype.sum = function (selector) {
var result = 0;
for (var i = 0; i < this.length; i++) {
var item = selector ? selector(this[i], i) : this[i];
let result = 0;
for (let i = 0; i < this.length; i++) {
const item = selector ? selector(this[i], i) : this[i];
if (typeof item !== "number") {

@@ -242,5 +183,5 @@ throw new Error("sum 은 number 에 대해서만 사용할 수 있습니다.");

Array.prototype.min = function (selector) {
var result;
for (var i = 0; i < this.length; i++) {
var item = selector ? selector(this[i], i) : this[i];
let result;
for (let i = 0; i < this.length; i++) {
const item = selector ? selector(this[i], i) : this[i];
if (typeof item !== "number") {

@@ -256,5 +197,5 @@ throw new Error("sum 은 number 에 대해서만 사용할 수 있습니다.");

Array.prototype.max = function (selector) {
var result;
for (var i = 0; i < this.length; i++) {
var item = selector ? selector(this[i], i) : this[i];
let result;
for (let i = 0; i < this.length; i++) {
const item = selector ? selector(this[i], i) : this[i];
if (typeof item !== "number") {

@@ -273,5 +214,5 @@ throw new Error("sum 은 number 에 대해서만 사용할 수 있습니다.");

}
var result = this;
let result = this;
while (true) {
result = result.orderBy(function () { return Math.random(); });
result = result.orderBy(() => Math.random());
if (!ObjectUtil_1.ObjectUtil.equal(result, this)) {

@@ -288,5 +229,4 @@ break;

Array.prototype.remove = function (itemOrSelector) {
var removeItems = typeof itemOrSelector === "function" ? this.filter(itemOrSelector.bind(this)) : [itemOrSelector];
for (var _i = 0, removeItems_1 = removeItems; _i < removeItems_1.length; _i++) {
var removeItem = removeItems_1[_i];
const removeItems = typeof itemOrSelector === "function" ? this.filter(itemOrSelector.bind(this)) : [itemOrSelector];
for (const removeItem of removeItems) {
while (this.indexOf(removeItem) >= 0) {

@@ -299,4 +239,4 @@ this.splice(this.indexOf(removeItem), 1);

Array.prototype.clear = function () {
return this.remove(function () { return true; });
return this.remove(() => true);
};
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ArgumentError_1 = require("../error/ArgumentError");
var DateTimeFormatUtil_1 = require("../util/DateTimeFormatUtil");
var DateOnly = (function () {
function DateOnly(arg1, arg2, arg3) {
const ArgumentError_1 = require("../error/ArgumentError");
const DateTimeFormatUtil_1 = require("../util/DateTimeFormatUtil");
class DateOnly {
constructor(arg1, arg2, arg3) {
if (arg1 === undefined) {
var tick = Date.now();
const tick = Date.now();
this._date = new Date(tick - (tick % (24 * 60 * 60 * 1000)));

@@ -18,79 +18,59 @@ }

}
DateOnly.parse = function (str) {
var parsedTick = Date.parse(str);
static parse(str) {
const parsedTick = Date.parse(str);
if (parsedTick && !Number.isNaN(parsedTick)) {
return new DateOnly(parsedTick);
}
var match1 = str.match(/^[0-9]{8}$/);
const match1 = str.match(/^[0-9]{8}$/);
if (match1) {
return new DateOnly(Number(str.substr(0, 4)), Number(str.substr(4, 2)), Number(str.substr(6, 2)));
}
throw new ArgumentError_1.ArgumentError({ str: str });
};
Object.defineProperty(DateOnly.prototype, "year", {
get: function () {
return this._date.getFullYear();
},
set: function (value) {
this._date.setFullYear(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateOnly.prototype, "month", {
get: function () {
return this._date.getMonth() + 1;
},
set: function (value) {
this._date.setMonth(value - 1);
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateOnly.prototype, "day", {
get: function () {
return this._date.getDate();
},
set: function (value) {
this._date.setDate(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateOnly.prototype, "tick", {
get: function () {
return this._date.getTime();
},
set: function (tick) {
this._date.setTime(tick - (tick % (24 * 60 * 60 * 1000)));
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateOnly.prototype, "week", {
get: function () {
return this._date.getDay();
},
enumerable: true,
configurable: true
});
DateOnly.prototype.setYear = function (year) {
throw new ArgumentError_1.ArgumentError({ str });
}
get year() {
return this._date.getFullYear();
}
set year(value) {
this._date.setFullYear(value);
}
get month() {
return this._date.getMonth() + 1;
}
set month(value) {
this._date.setMonth(value - 1);
}
get day() {
return this._date.getDate();
}
set day(value) {
this._date.setDate(value);
}
get tick() {
return this._date.getTime();
}
set tick(tick) {
this._date.setTime(tick - (tick % (24 * 60 * 60 * 1000)));
}
get week() {
return this._date.getDay();
}
setYear(year) {
return new DateOnly(new Date(this.tick).setFullYear(year));
};
DateOnly.prototype.setMonth = function (month) {
}
setMonth(month) {
return new DateOnly(new Date(this.tick).setMonth(month - 1));
};
DateOnly.prototype.setDay = function (day) {
}
setDay(day) {
return new DateOnly(new Date(this.tick).setDate(day));
};
DateOnly.prototype.addYears = function (years) {
}
addYears(years) {
return this.setYear(this.year + years);
};
DateOnly.prototype.addMonths = function (months) {
}
addMonths(months) {
return this.setMonth(this.month + months);
};
DateOnly.prototype.addDays = function (days) {
}
addDays(days) {
return this.setDay(this.day + days);
};
DateOnly.prototype.toFormatString = function (format) {
}
toFormatString(format) {
return DateTimeFormatUtil_1.DateTimeFormatUtil.format(format, {

@@ -101,9 +81,8 @@ year: this.year,

});
};
DateOnly.prototype.toString = function () {
}
toString() {
return this.toFormatString("yyyy-MM-dd");
};
return DateOnly;
}());
}
}
exports.DateOnly = DateOnly;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ArgumentError_1 = require("../error/ArgumentError");
var DateTimeFormatUtil_1 = require("../util/DateTimeFormatUtil");
var DateTime = (function () {
function DateTime(arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
const ArgumentError_1 = require("../error/ArgumentError");
const DateTimeFormatUtil_1 = require("../util/DateTimeFormatUtil");
class DateTime {
constructor(arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
if (arg1 === undefined) {

@@ -17,158 +17,118 @@ this._date = new Date();

}
DateTime.parse = function (str) {
var parsedTick = Date.parse(str);
static parse(str) {
const parsedTick = Date.parse(str);
if (parsedTick && !Number.isNaN(parsedTick)) {
return new DateTime(parsedTick);
}
var match1 = str.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2}) (오전|오후) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/);
const match1 = str.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2}) (오전|오후) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/);
if (match1) {
return new DateTime(Number(match1[1]), Number(match1[2]), Number(match1[3]), Number(match1[5]) + (match1[4] === "오후" ? 12 : 0), Number(match1[6]), Number(match1[7]));
}
var match2 = str.match(/^[0-9]{14}$/);
const match2 = str.match(/^[0-9]{14}$/);
if (match2) {
return new DateTime(Number(str.substr(0, 4)), Number(str.substr(4, 2)), Number(str.substr(6, 2)), Number(str.substr(8, 2)), Number(str.substr(10, 2)), Number(str.substr(12, 2)));
}
var match3 = str.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]{3}))?$/);
const match3 = str.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]{3}))?$/);
if (match3) {
return new DateTime(Number(match3[1]), Number(match3[2]), Number(match3[3]), Number(match3[4]), Number(match3[5]), Number(match3[6]), match3[7] ? Number(match3[8]) : undefined);
}
throw new ArgumentError_1.ArgumentError({ str: str });
};
Object.defineProperty(DateTime.prototype, "year", {
get: function () {
return this._date.getFullYear();
},
set: function (value) {
this._date.setFullYear(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateTime.prototype, "month", {
get: function () {
return this._date.getMonth() + 1;
},
set: function (value) {
this._date.setMonth(value - 1);
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateTime.prototype, "day", {
get: function () {
return this._date.getDate();
},
set: function (value) {
this._date.setDate(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateTime.prototype, "hour", {
get: function () {
return this._date.getHours();
},
set: function (value) {
this._date.setHours(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateTime.prototype, "minute", {
get: function () {
return this._date.getMinutes();
},
set: function (value) {
this._date.setMinutes(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateTime.prototype, "second", {
get: function () {
return this._date.getSeconds();
},
set: function (value) {
this._date.setSeconds(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateTime.prototype, "millisecond", {
get: function () {
return this._date.getMilliseconds();
},
set: function (value) {
this._date.setMilliseconds(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateTime.prototype, "tick", {
get: function () {
return this._date.getTime();
},
set: function (tick) {
this._date.setTime(tick);
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateTime.prototype, "week", {
get: function () {
return this._date.getDay();
},
enumerable: true,
configurable: true
});
Object.defineProperty(DateTime.prototype, "timezoneOffsetMinutes", {
get: function () {
return -this._date.getTimezoneOffset();
},
enumerable: true,
configurable: true
});
DateTime.prototype.setYear = function (year) {
throw new ArgumentError_1.ArgumentError({ str });
}
get year() {
return this._date.getFullYear();
}
set year(value) {
this._date.setFullYear(value);
}
get month() {
return this._date.getMonth() + 1;
}
set month(value) {
this._date.setMonth(value - 1);
}
get day() {
return this._date.getDate();
}
set day(value) {
this._date.setDate(value);
}
get hour() {
return this._date.getHours();
}
set hour(value) {
this._date.setHours(value);
}
get minute() {
return this._date.getMinutes();
}
set minute(value) {
this._date.setMinutes(value);
}
get second() {
return this._date.getSeconds();
}
set second(value) {
this._date.setSeconds(value);
}
get millisecond() {
return this._date.getMilliseconds();
}
set millisecond(value) {
this._date.setMilliseconds(value);
}
get tick() {
return this._date.getTime();
}
set tick(tick) {
this._date.setTime(tick);
}
get week() {
return this._date.getDay();
}
get timezoneOffsetMinutes() {
return -this._date.getTimezoneOffset();
}
setYear(year) {
return new DateTime(new Date(this.tick).setFullYear(year));
};
DateTime.prototype.setMonth = function (month) {
}
setMonth(month) {
return new DateTime(new Date(this.tick).setMonth(month - 1));
};
DateTime.prototype.setDay = function (day) {
}
setDay(day) {
return new DateTime(new Date(this.tick).setDate(day));
};
DateTime.prototype.setHour = function (hour) {
}
setHour(hour) {
return new DateTime(new Date(this.tick).setHours(hour));
};
DateTime.prototype.setMinute = function (minute) {
}
setMinute(minute) {
return new DateTime(new Date(this.tick).setMinutes(minute));
};
DateTime.prototype.setSecond = function (second) {
}
setSecond(second) {
return new DateTime(new Date(this.tick).setSeconds(second));
};
DateTime.prototype.setMillisecond = function (millisecond) {
}
setMillisecond(millisecond) {
return new DateTime(new Date(this.tick).setMilliseconds(millisecond));
};
DateTime.prototype.addYears = function (years) {
}
addYears(years) {
return this.setYear(this.year + years);
};
DateTime.prototype.addMonths = function (months) {
}
addMonths(months) {
return this.setMonth(this.month + months);
};
DateTime.prototype.addDays = function (days) {
}
addDays(days) {
return this.setDay(this.day + days);
};
DateTime.prototype.addHours = function (hours) {
}
addHours(hours) {
return this.setHour(this.hour + hours);
};
DateTime.prototype.addMinutes = function (minutes) {
}
addMinutes(minutes) {
return this.setMinute(this.minute + minutes);
};
DateTime.prototype.addSeconds = function (seconds) {
}
addSeconds(seconds) {
return this.setSecond(this.second + seconds);
};
DateTime.prototype.addMilliseconds = function (milliseconds) {
}
addMilliseconds(milliseconds) {
return this.setMillisecond(this.millisecond + milliseconds);
};
DateTime.prototype.toFormatString = function (format) {
}
toFormatString(format) {
return DateTimeFormatUtil_1.DateTimeFormatUtil.format(format, {

@@ -184,9 +144,8 @@ year: this.year,

});
};
DateTime.prototype.toString = function () {
}
toString() {
return this.toFormatString("yyyy-MM-ddTHH:mm:ss.fffzzz");
};
return DateTime;
}());
}
}
exports.DateTime = DateTime;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ArgumentError_1 = require("../error/ArgumentError");
var DateTimeFormatUtil_1 = require("../util/DateTimeFormatUtil");
var Time = (function () {
function Time(arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
const ArgumentError_1 = require("../error/ArgumentError");
const DateTimeFormatUtil_1 = require("../util/DateTimeFormatUtil");
class Time {
constructor(arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
if (arg1 === undefined) {
var now = new Date();
const now = new Date();
this._tick = (now.getMilliseconds()

@@ -24,88 +24,68 @@ + now.getSeconds() * 1000

}
Time.parse = function (str) {
var match1 = str.match(/^(오전|오후) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(\.([0-9]{1,3}))?$/);
static parse(str) {
const match1 = str.match(/^(오전|오후) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(\.([0-9]{1,3}))?$/);
if (match1) {
return new Time(Number(match1[2]) + (match1[1] === "오후" ? 12 : 0), Number(match1[3]), Number(match1[4]), Number(match1[5] ? match1[6].padEnd(3, "0") : "0"));
}
var match2 = str.match(/^([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(\.([0-9]{1,3}))?$/);
const match2 = str.match(/^([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(\.([0-9]{1,3}))?$/);
if (match2) {
return new Time(Number(match2[1]), Number(match2[2]), Number(match2[3]), Number(match2[4] ? match2[5].padEnd(3, "0") : "0"));
}
throw new ArgumentError_1.ArgumentError({ str: str });
};
Object.defineProperty(Time.prototype, "hour", {
get: function () {
return Math.floor(this._tick / (60 * 60 * 1000));
},
set: function (value) {
this._tick = (this._tick + ((value - this.hour) * 60 * 60 * 1000)) % (24 * 60 * 60 * 1000);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Time.prototype, "minute", {
get: function () {
return Math.floor(this._tick / (60 * 1000)) % 60;
},
set: function (value) {
this._tick = (this._tick + ((value - this.minute) * 60 * 1000)) % (24 * 60 * 60 * 1000);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Time.prototype, "second", {
get: function () {
return Math.floor(this._tick / 1000) % 60;
},
set: function (value) {
this._tick = (this._tick + ((value - this.second) * 1000)) % (24 * 60 * 60 * 1000);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Time.prototype, "millisecond", {
get: function () {
return this._tick % 1000;
},
set: function (value) {
this._tick = (this._tick + (value - this.millisecond)) % (24 * 60 * 60 * 1000);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Time.prototype, "tick", {
get: function () {
return this._tick;
},
set: function (tick) {
this._tick = tick % (24 * 60 * 60 * 1000);
},
enumerable: true,
configurable: true
});
Time.prototype.setHour = function (hour) {
throw new ArgumentError_1.ArgumentError({ str });
}
get hour() {
return Math.floor(this._tick / (60 * 60 * 1000));
}
set hour(value) {
this._tick = (this._tick + ((value - this.hour) * 60 * 60 * 1000)) % (24 * 60 * 60 * 1000);
}
get minute() {
return Math.floor(this._tick / (60 * 1000)) % 60;
}
set minute(value) {
this._tick = (this._tick + ((value - this.minute) * 60 * 1000)) % (24 * 60 * 60 * 1000);
}
get second() {
return Math.floor(this._tick / 1000) % 60;
}
set second(value) {
this._tick = (this._tick + ((value - this.second) * 1000)) % (24 * 60 * 60 * 1000);
}
get millisecond() {
return this._tick % 1000;
}
set millisecond(value) {
this._tick = (this._tick + (value - this.millisecond)) % (24 * 60 * 60 * 1000);
}
get tick() {
return this._tick;
}
set tick(tick) {
this._tick = tick % (24 * 60 * 60 * 1000);
}
setHour(hour) {
return new Time(hour, this.minute, this.second, this.millisecond);
};
Time.prototype.setMinute = function (minute) {
}
setMinute(minute) {
return new Time(this.hour, minute, this.second, this.millisecond);
};
Time.prototype.setSecond = function (second) {
}
setSecond(second) {
return new Time(this.hour, this.minute, second, this.millisecond);
};
Time.prototype.setMillisecond = function (millisecond) {
}
setMillisecond(millisecond) {
return new Time(this.hour, this.minute, this.second, millisecond);
};
Time.prototype.addHours = function (hours) {
}
addHours(hours) {
return this.setHour(this.hour + hours);
};
Time.prototype.addMinutes = function (minutes) {
}
addMinutes(minutes) {
return this.setMinute(this.minute + minutes);
};
Time.prototype.addSeconds = function (seconds) {
}
addSeconds(seconds) {
return this.setSecond(this.second + seconds);
};
Time.prototype.addMilliseconds = function (milliseconds) {
}
addMilliseconds(milliseconds) {
return this.setMillisecond(this.millisecond + milliseconds);
};
Time.prototype.toFormatString = function (format) {
}
toFormatString(format) {
return DateTimeFormatUtil_1.DateTimeFormatUtil.format(format, {

@@ -117,9 +97,8 @@ hour: this.hour,

});
};
Time.prototype.toString = function () {
}
toString() {
return this.toFormatString("HH:mm:ss.fff");
};
return Time;
}());
}
}
exports.Time = Time;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Uuid = (function () {
function Uuid(uuid) {
class Uuid {
constructor(uuid) {
this._uuid = uuid;
}
Uuid.new = function () {
var fn = function () {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0;
var v = c === "x" ? r : (r & 0x3 | 0x8);
static new() {
const fn = () => {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
const v = c === "x" ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
};
var uuid;
let uuid;
while (true) {
uuid = fn();
if (!Uuid._prevUuids.some(function (item) { return item._uuid === uuid; })) {
if (!Uuid._prevUuids.some((item) => item._uuid === uuid)) {
break;
}
}
var uuidObj = new Uuid(uuid);
const uuidObj = new Uuid(uuid);
Uuid._prevUuids.push(uuidObj);
return uuidObj;
};
Uuid.prototype.toString = function () {
}
toString() {
return this._uuid;
};
Uuid._prevUuids = [];
return Uuid;
}());
}
}
exports.Uuid = Uuid;
Uuid._prevUuids = [];
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DateTimeFormatUtil = (function () {
function DateTimeFormatUtil() {
}
DateTimeFormatUtil.format = function (format, args) {
var year = args.year;
var month = args.month;
var day = args.day;
var hour = args.hour;
var minute = args.minute;
var second = args.second;
var millisecond = args.millisecond;
var offsetHour = args.timezoneOffsetMinutes !== undefined ? Math.floor(args.timezoneOffsetMinutes / 60) : undefined;
var offsetMinute = args.timezoneOffsetMinutes !== undefined ? args.timezoneOffsetMinutes % 60 : undefined;
var week = (year && month && day) ? new Date(year, month - 1, day).getDay() : undefined;
var weekString = week === 0 ? "일" :
class DateTimeFormatUtil {
static format(format, args) {
const year = args.year;
const month = args.month;
const day = args.day;
const hour = args.hour;
const minute = args.minute;
const second = args.second;
const millisecond = args.millisecond;
const offsetHour = args.timezoneOffsetMinutes !== undefined ? Math.floor(args.timezoneOffsetMinutes / 60) : undefined;
const offsetMinute = args.timezoneOffsetMinutes !== undefined ? args.timezoneOffsetMinutes % 60 : undefined;
const week = (year && month && day) ? new Date(year, month - 1, day).getDay() : undefined;
const weekString = week === 0 ? "일" :
week === 1 ? "월" :

@@ -25,3 +23,3 @@ week === 2 ? "화" :

undefined;
var result = format;
let result = format;
if (year !== undefined) {

@@ -68,6 +66,5 @@ result = result.replace(/yyyy/g, year.toString());

return result;
};
return DateTimeFormatUtil;
}());
}
}
exports.DateTimeFormatUtil = DateTimeFormatUtil;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var FunctionUtil = (function () {
function FunctionUtil() {
}
FunctionUtil.parse = function (fn) {
var matches = fn.toString().match(/function\s?\(([^)]*)\)[^{]*{((?!return)(.|\r|\n))*return\s?((.|\r|\n)*);?\s?}$/);
class FunctionUtil {
static parse(fn) {
let matches = fn.toString().match(/function\s?\(([^)]*)\)[^{]*{((?!return)(.|\r|\n))*return\s?((.|\r|\n)*);?\s?}$/);
if (matches === null) {

@@ -17,3 +15,3 @@ matches = fn.toString().match(/^\(?([^)]*)\)?(\s?)=>(\s?)(.*)$/);

if (matches[4].startsWith("{")) {
var newMatch = matches[4].match(/(?!return)(.|\r|\n)*return\s((.|\r|\n)*);/);
const newMatch = matches[4].match(/(?!return)(.|\r|\n)*return\s((.|\r|\n)*);/);
if (newMatch && newMatch[2]) {

@@ -27,4 +25,4 @@ matches[4] = newMatch[2];

}
var params = matches[1].split(",").map(function (item) { return item.trim(); });
var returnContent = matches[4].trim();
const params = matches[1].split(",").map((item) => item.trim());
let returnContent = matches[4].trim();
if (returnContent.endsWith(";")) {

@@ -34,9 +32,8 @@ returnContent = returnContent.slice(0, -1);

return {
params: params,
returnContent: returnContent
params,
returnContent
};
};
return FunctionUtil;
}());
}
}
exports.FunctionUtil = FunctionUtil;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var DateTime_1 = require("../type/DateTime");
var DateOnly_1 = require("../type/DateOnly");
var Time_1 = require("../type/Time");
var Uuid_1 = require("../type/Uuid");
var JsonConvert = (function () {
function JsonConvert() {
}
JsonConvert.stringify = function (obj, options) {
const DateTime_1 = require("../type/DateTime");
const DateOnly_1 = require("../type/DateOnly");
const Time_1 = require("../type/Time");
const Uuid_1 = require("../type/Uuid");
class JsonConvert {
static stringify(obj, options) {
var _a;
function replacer(key, value) {
var _a, _b, _c;
var currValue = ((_a = options) === null || _a === void 0 ? void 0 : _a.replacer) ? options.replacer(key, value) : value;
const currValue = ((_a = options) === null || _a === void 0 ? void 0 : _a.replacer) ? options.replacer(key, value) : value;
if (currValue instanceof Date) {

@@ -34,3 +31,8 @@ return { __type__: "Date", data: currValue.toISOString() };

__type__: "Error",
data: tslib_1.__assign({ message: currValue.message, name: currValue.name, stack: currValue.stack }, currValue)
data: {
message: currValue.message,
name: currValue.name,
stack: currValue.stack,
...currValue
}
};

@@ -43,10 +45,10 @@ }

}
var prevDateToJson = Date.prototype.toJSON;
const prevDateToJson = Date.prototype.toJSON;
delete Date.prototype.toJSON;
var result1 = JSON.stringify(replacer(undefined, obj), replacer, (_a = options) === null || _a === void 0 ? void 0 : _a.space);
const result1 = JSON.stringify(replacer(undefined, obj), replacer, (_a = options) === null || _a === void 0 ? void 0 : _a.space);
Date.prototype.toJSON = prevDateToJson;
return result1;
};
JsonConvert.parse = function (json) {
return json && JSON.parse(json, function (key, value) {
}
static parse(json) {
return json && JSON.parse(json, (key, value) => {
if (value == undefined) {

@@ -71,3 +73,3 @@ return undefined;

else if (typeof value === "object" && value.__type__ === "Error") {
var error = new Error(value.data.message);
const error = new Error(value.data.message);
Object.assign(error, value.data);

@@ -81,6 +83,5 @@ return error;

});
};
return JsonConvert;
}());
}
}
exports.JsonConvert = JsonConvert;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var MathUtil = (function () {
function MathUtil() {
class MathUtil {
static getRandomInt(min, max) {
return Math.floor((Math.random() * (max - min)) + min);
}
MathUtil.getRandomInt = function (min, max) {
return Math.floor((Math.random() * (max - min)) + min);
};
return MathUtil;
}());
}
exports.MathUtil = MathUtil;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var DateTime_1 = require("../type/DateTime");
var DateOnly_1 = require("../type/DateOnly");
var Time_1 = require("../type/Time");
var Uuid_1 = require("../type/Uuid");
var ObjectUtil = (function () {
function ObjectUtil() {
const DateTime_1 = require("../type/DateTime");
const DateOnly_1 = require("../type/DateOnly");
const Time_1 = require("../type/Time");
const Uuid_1 = require("../type/Uuid");
class ObjectUtil {
static clone(source, options) {
return ObjectUtil._clone(source, options);
}
ObjectUtil.clone = function (source, options) {
return ObjectUtil._clone(source, options);
};
ObjectUtil._clone = function (source, options, prevClones) {
static _clone(source, options, prevClones) {
var _a, _b, _c, _d;

@@ -20,3 +17,3 @@ if (source == undefined) {

if (source instanceof Array) {
return source.map(function (item) { return options ? ObjectUtil._clone(item, options) : ObjectUtil._clone(item); });
return source.map((item) => options ? ObjectUtil._clone(item, options) : ObjectUtil._clone(item));
}

@@ -39,7 +36,7 @@ if (source instanceof Date) {

if (typeof source === "object") {
var result = {};
const result = {};
Object.setPrototypeOf(result, source["constructor"].prototype);
var currPrevClones = (prevClones !== null && prevClones !== void 0 ? prevClones : []);
currPrevClones.push({ source: source, clone: result });
var _loop_1 = function (key) {
const currPrevClones = (prevClones !== null && prevClones !== void 0 ? prevClones : []);
currPrevClones.push({ source, clone: result });
for (const key of Object.keys(source).filter((sourceKey) => { var _a, _b; return !((_b = (_a = options) === null || _a === void 0 ? void 0 : _a.excludes) === null || _b === void 0 ? void 0 : _b.includes(sourceKey)); })) {
if (source[key] == undefined) {

@@ -52,3 +49,3 @@ result[key] = undefined;

else {
var matchedPrevClone = (_c = prevClones) === null || _c === void 0 ? void 0 : _c.single(function (item) { return item.source === source[key]; });
const matchedPrevClone = (_c = prevClones) === null || _c === void 0 ? void 0 : _c.single((item) => item.source === source[key]);
if (matchedPrevClone) {

@@ -61,6 +58,2 @@ result[key] = matchedPrevClone.clone;

}
};
for (var _i = 0, _e = Object.keys(source).filter(function (sourceKey) { var _a, _b; return !((_b = (_a = options) === null || _a === void 0 ? void 0 : _a.excludes) === null || _b === void 0 ? void 0 : _b.includes(sourceKey)); }); _i < _e.length; _i++) {
var key = _e[_i];
_loop_1(key);
}

@@ -70,4 +63,4 @@ return result;

return source;
};
ObjectUtil.merge = function (source, target) {
}
static merge(source, target) {
if (source === undefined) {

@@ -88,10 +81,9 @@ return ObjectUtil.clone(target);

}
var result = ObjectUtil.clone(source);
for (var _i = 0, _a = Object.keys(target); _i < _a.length; _i++) {
var key = _a[_i];
const result = ObjectUtil.clone(source);
for (const key of Object.keys(target)) {
result[key] = ObjectUtil.merge(source[key], target[key]);
}
return result;
};
ObjectUtil.equal = function (source, target, options) {
}
static equal(source, target, options) {
var _a, _b;

@@ -114,10 +106,6 @@ if (source === target) {

if ((_a = options) === null || _a === void 0 ? void 0 : _a.ignoreArrayIndex) {
return source.every(function (sourceItem) {
return target.some(function (targetItem) {
return ObjectUtil.equal(targetItem, sourceItem, options);
});
});
return source.every((sourceItem) => target.some((targetItem) => ObjectUtil.equal(targetItem, sourceItem, options)));
}
else {
for (var i = 0; i < source.length; i++) {
for (let i = 0; i < source.length; i++) {
if (!ObjectUtil.equal(source[i], target[i], options)) {

@@ -131,11 +119,10 @@ return false;

if (typeof source === "object" && typeof target === "object") {
var sourceKeys = Object.keys(source)
.filter(function (key) { var _a, _b, _c, _d; return (!((_a = options) === null || _a === void 0 ? void 0 : _a.keys) || ((_b = options) === null || _b === void 0 ? void 0 : _b.keys.includes(key))) && (!((_d = (_c = options) === null || _c === void 0 ? void 0 : _c.excludes) === null || _d === void 0 ? void 0 : _d.includes(key))) && source[key] !== undefined; });
var targetKeys = Object.keys(target)
.filter(function (key) { var _a, _b, _c, _d; return (!((_a = options) === null || _a === void 0 ? void 0 : _a.keys) || ((_b = options) === null || _b === void 0 ? void 0 : _b.keys.includes(key))) && (!((_d = (_c = options) === null || _c === void 0 ? void 0 : _c.excludes) === null || _d === void 0 ? void 0 : _d.includes(key))) && target[key] !== undefined; });
const sourceKeys = Object.keys(source)
.filter((key) => { var _a, _b, _c, _d; return (!((_a = options) === null || _a === void 0 ? void 0 : _a.keys) || ((_b = options) === null || _b === void 0 ? void 0 : _b.keys.includes(key))) && (!((_d = (_c = options) === null || _c === void 0 ? void 0 : _c.excludes) === null || _d === void 0 ? void 0 : _d.includes(key))) && source[key] !== undefined; });
const targetKeys = Object.keys(target)
.filter((key) => { var _a, _b, _c, _d; return (!((_a = options) === null || _a === void 0 ? void 0 : _a.keys) || ((_b = options) === null || _b === void 0 ? void 0 : _b.keys.includes(key))) && (!((_d = (_c = options) === null || _c === void 0 ? void 0 : _c.excludes) === null || _d === void 0 ? void 0 : _d.includes(key))) && target[key] !== undefined; });
if (sourceKeys.length !== targetKeys.length) {
return false;
}
for (var _i = 0, sourceKeys_1 = sourceKeys; _i < sourceKeys_1.length; _i++) {
var key = sourceKeys_1[_i];
for (const key of sourceKeys) {
if (!ObjectUtil.equal(source[key], target[key], { ignoreArrayIndex: (_b = options) === null || _b === void 0 ? void 0 : _b.ignoreArrayIndex })) {

@@ -148,5 +135,5 @@ return false;

return false;
};
ObjectUtil.validate = function (value, def) {
var currDef;
}
static validate(value, def) {
let currDef;
if (def instanceof Array) {

@@ -163,5 +150,8 @@ currDef = {

else {
currDef = tslib_1.__assign(tslib_1.__assign({}, def), { type: def.type ? def.type instanceof Array ? def.type : [def.type] : undefined });
currDef = {
...def,
type: def.type ? def.type instanceof Array ? def.type : [def.type] : undefined
};
}
var invalidateDef = {};
const invalidateDef = {};
if (currDef.notnull && value === undefined) {

@@ -174,3 +164,3 @@ invalidateDef.notnull = currDef.notnull;

if (currDef.type &&
!currDef.type.some(function (type) { var _a; return type === ((_a = value) === null || _a === void 0 ? void 0 : _a.constructor); })) {
!currDef.type.some((type) => { var _a; return type === ((_a = value) === null || _a === void 0 ? void 0 : _a.constructor); })) {
invalidateDef.type = currDef.type;

@@ -185,11 +175,10 @@ }

if (Object.keys(invalidateDef).length > 0) {
return { value: value, invalidateDef: invalidateDef };
return { value, invalidateDef };
}
return undefined;
};
ObjectUtil.validateObject = function (obj, def) {
var result = {};
for (var _i = 0, _a = Object.keys(def); _i < _a.length; _i++) {
var defKey = _a[_i];
var validateResult = ObjectUtil.validate(obj[defKey], def[defKey]);
}
static validateObject(obj, def) {
const result = {};
for (const defKey of Object.keys(def)) {
const validateResult = ObjectUtil.validate(obj[defKey], def[defKey]);
if (validateResult) {

@@ -200,12 +189,12 @@ result[defKey] = validateResult;

return result;
};
ObjectUtil.validateArray = function (arr, def) {
var result = [];
for (var i = 0; i < arr.length; i++) {
var item = arr[i];
var validateObjectResult = ObjectUtil.validateObject(item, typeof def === "function" ? def(item) : def);
}
static validateArray(arr, def) {
const result = [];
for (let i = 0; i < arr.length; i++) {
const item = arr[i];
const validateObjectResult = ObjectUtil.validateObject(item, typeof def === "function" ? def(item) : def);
if (Object.keys(validateObjectResult).length > 0) {
result.push({
index: i,
item: item,
item,
result: validateObjectResult

@@ -216,6 +205,6 @@ });

return result;
};
ObjectUtil.getChainValueByDepth = function (obj, key, depth, optional) {
var result = obj;
for (var i = 0; i < depth; i++) {
}
static getChainValueByDepth(obj, key, depth, optional) {
let result = obj;
for (let i = 0; i < depth; i++) {
if (optional) {

@@ -229,8 +218,7 @@ result = result ? result[key] : undefined;

return result;
};
ObjectUtil.getChainValue = function (obj, chain, optional) {
var split = chain.split(".");
var result = obj;
for (var _i = 0, split_1 = split; _i < split_1.length; _i++) {
var splitItem = split_1[_i];
}
static getChainValue(obj, chain, optional) {
const split = chain.split(".");
let result = obj;
for (const splitItem of split) {
if (optional && result === undefined) {

@@ -244,27 +232,24 @@ result = undefined;

return result;
};
ObjectUtil.setChainValue = function (obj, chain, value) {
var split = chain.split(".");
var curr = obj;
for (var _i = 0, _a = split.slice(0, -1); _i < _a.length; _i++) {
var splitItem = _a[_i];
}
static setChainValue(obj, chain, value) {
const split = chain.split(".");
let curr = obj;
for (const splitItem of split.slice(0, -1)) {
curr = curr[splitItem];
}
curr[split.last()] = value;
};
ObjectUtil.deleteChainValue = function (obj, chain) {
var split = chain.split(".");
var curr = obj;
for (var _i = 0, _a = split.slice(0, -1); _i < _a.length; _i++) {
var splitItem = _a[_i];
}
static deleteChainValue(obj, chain) {
const split = chain.split(".");
let curr = obj;
for (const splitItem of split.slice(0, -1)) {
curr = curr[splitItem];
}
delete curr[split.last()];
};
ObjectUtil.clearUndefined = function (obj) {
}
static clearUndefined(obj) {
if (obj === undefined) {
return obj;
}
for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) {
var key = _a[_i];
for (const key of Object.keys(obj)) {
if (obj[key] === undefined) {

@@ -275,6 +260,5 @@ delete obj[key];

return obj;
};
return ObjectUtil;
}());
}
}
exports.ObjectUtil = ObjectUtil;
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var TimeoutError_1 = require("../error/TimeoutError");
var Wait = (function () {
function Wait() {
const TimeoutError_1 = require("../error/TimeoutError");
class Wait {
static async true(forwarder, milliseconds, timeout) {
let currMs = 0;
while (true) {
if (await forwarder()) {
break;
}
await Wait.time((milliseconds !== null && milliseconds !== void 0 ? milliseconds : 100));
if (timeout) {
currMs += (milliseconds !== null && milliseconds !== void 0 ? milliseconds : 100);
if (currMs >= timeout) {
throw new TimeoutError_1.TimeoutError();
}
}
}
}
Wait.true = function (forwarder, milliseconds, timeout) {
return tslib_1.__awaiter(this, void 0, Promise, function () {
var currMs;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
currMs = 0;
_a.label = 1;
case 1:
if (!true) return [3, 4];
return [4, forwarder()];
case 2:
if (_a.sent()) {
return [3, 4];
}
return [4, Wait.time((milliseconds !== null && milliseconds !== void 0 ? milliseconds : 100))];
case 3:
_a.sent();
if (timeout) {
currMs += (milliseconds !== null && milliseconds !== void 0 ? milliseconds : 100);
if (currMs >= timeout) {
throw new TimeoutError_1.TimeoutError();
}
}
return [3, 1];
case 4: return [2];
}
});
static async time(millisecond) {
await new Promise((resolve) => {
setTimeout(() => {
resolve();
}, millisecond);
});
};
Wait.time = function (millisecond) {
return tslib_1.__awaiter(this, void 0, Promise, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, new Promise(function (resolve) {
setTimeout(function () {
resolve();
}, millisecond);
})];
case 1:
_a.sent();
return [2];
}
});
});
};
return Wait;
}());
}
}
exports.Wait = Wait;
//# sourceMappingURL=module.js.map
{
"name": "@simplysm/sd-core-common",
"version": "3.1.136",
"version": "3.1.137",
"description": "심플리즘 패키지 - 코어 모듈 (browser/node)",

@@ -5,0 +5,0 @@ "author": "김석래",

@@ -10,3 +10,6 @@ {

},
"files": [
"src/index.ts"
],
"compileOnSave": false
}

@@ -9,3 +9,6 @@ {

"declaration": false
}
},
"files": [
"src/index.ts"
]
}

@@ -11,3 +11,6 @@ {

},
"files": [
"src/index.ts"
],
"compileOnSave": false
}

@@ -10,3 +10,6 @@ {

"outDir": "dist"
}
},
"files": [
"src/index.ts"
]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc