Skip to content

Commit

Permalink
Merge d333e29 into 3db0b90
Browse files Browse the repository at this point in the history
  • Loading branch information
milosbugarinovic committed Apr 9, 2024
2 parents 3db0b90 + d333e29 commit 1258611
Show file tree
Hide file tree
Showing 11 changed files with 643 additions and 642 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Lint-Test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

Expand Down
4 changes: 2 additions & 2 deletions .ncurc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"reject": [
"semantic-release",
"date-fns"
"eslint",
"eslint-config-prettier"
]
}
2 changes: 1 addition & 1 deletion dist/class-factory-pattern.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ export type ClassType<T = object> = new (...args: T extends {
* // using
* const someClassInstance = someClassFactory({ a: 'test' })
*/
export declare const classFactoryPattern: <C extends ClassType<object>>(classType: C) => (...args: ConstructorParameters<C>) => InstanceType<C>;
export declare const classFactoryPattern: <C extends ClassType<object>>(classType: C) => ((...args: ConstructorParameters<C>) => InstanceType<C>);
//# sourceMappingURL=class-factory-pattern.d.ts.map
2 changes: 1 addition & 1 deletion dist/class-factory-pattern.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions dist/time-util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/class-factory-pattern.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ export type ClassType<T = object> = new (...args: T extends {
* // using
* const someClassInstance = someClassFactory({ a: 'test' })
*/
export declare const classFactoryPattern: <C extends ClassType<object>>(classType: C) => (...args: ConstructorParameters<C>) => InstanceType<C>;
export declare const classFactoryPattern: <C extends ClassType<object>>(classType: C) => ((...args: ConstructorParameters<C>) => InstanceType<C>);
//# sourceMappingURL=class-factory-pattern.d.ts.map
2 changes: 1 addition & 1 deletion lib/class-factory-pattern.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions lib/time-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TimeUtil = exports.DurationUnit = void 0;
var _index = _interopRequireDefault(require("date-fns/add/index.js"));
var _index2 = _interopRequireDefault(require("date-fns/addMilliseconds/index.js"));
var _index3 = _interopRequireDefault(require("date-fns/format/index.js"));
var _index4 = _interopRequireDefault(require("date-fns/parse/index.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _add2 = require("date-fns/add");
var _addMilliseconds = require("date-fns/addMilliseconds");
var _format = require("date-fns/format");
var _parse = require("date-fns/parse");
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
Expand Down Expand Up @@ -56,7 +55,7 @@ var TimeUtil = exports.TimeUtil = /*#__PURE__*/function () {
}, {
key: "dateToUnix",
value: function dateToUnix(date) {
return +(0, _index3["default"])(date, 'T');
return +(0, _format.format)(date, 'T');
}

/**
Expand All @@ -71,7 +70,7 @@ var TimeUtil = exports.TimeUtil = /*#__PURE__*/function () {
}, {
key: "dateToUnixSec",
value: function dateToUnixSec(date) {
return +(0, _index3["default"])(date, 't');
return +(0, _format.format)(date, 't');
}

/**
Expand All @@ -85,7 +84,7 @@ var TimeUtil = exports.TimeUtil = /*#__PURE__*/function () {
}, {
key: "unixToDate",
value: function unixToDate(unix) {
return (0, _index4["default"])(unix.toString(), 'T', this.now());
return (0, _parse.parse)(unix.toString(), 'T', this.now());
}

/**
Expand All @@ -99,7 +98,7 @@ var TimeUtil = exports.TimeUtil = /*#__PURE__*/function () {
}, {
key: "unixSecToDate",
value: function unixSecToDate(unix) {
return (0, _index4["default"])(unix.toString(), 't', this.now());
return (0, _parse.parse)(unix.toString(), 't', this.now());
}

/**
Expand All @@ -119,9 +118,9 @@ var TimeUtil = exports.TimeUtil = /*#__PURE__*/function () {
unit = params.unit,
value = params.value;
if ("".concat(unit) === 'MILLISECOND') {
return (0, _index2["default"])(date, value);
return (0, _addMilliseconds.addMilliseconds)(date, value);
}
return (0, _index["default"])(date, _defineProperty({}, "".concat(unit.toLowerCase(), "s"), value));
return (0, _add2.add)(date, _defineProperty({}, "".concat(unit.toLowerCase(), "s"), value));
}
}]);
}();

0 comments on commit 1258611

Please sign in to comment.