@lage-run/format-hrtime 0.1.6 → 0.1.7

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.
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- formatDuration: function() {
12
+ get formatDuration () {
13
13
  return formatDuration;
14
14
  },
15
- hrToSeconds: function() {
15
+ get hrToSeconds () {
16
16
  return hrToSeconds;
17
17
  },
18
- hrtimeDiff: function() {
18
+ get hrtimeDiff () {
19
19
  return hrtimeDiff;
20
20
  }
21
21
  });
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/formatDuration.ts"],"sourcesContent":["export function formatDuration(seconds: string): string {\n const raw = parseFloat(seconds);\n if (raw > 60) {\n const minutes = Math.floor(raw / 60);\n const seconds = (raw - minutes * 60).toFixed(2);\n return `${minutes}m ${seconds}s`;\n } else {\n const seconds = raw.toFixed(2);\n return `${seconds}s`;\n }\n}\n\nexport function hrToSeconds(hrtime: [number, number]): string {\n const raw = hrtime[0] + hrtime[1] / 1e9;\n return raw.toFixed(2);\n}\n\n/**\n * calculates the difference of two hrtime values\n * @param start\n * @param end\n * @returns\n */\nexport function hrtimeDiff(start: [number, number] = [0, 0], end: [number, number] = [0, 0]): [number, number] {\n const sec = end[0] - start[0];\n const nsec = end[1] - start[1];\n\n if (nsec < 0) {\n return [Math.max(0, sec - 1), 1e9 + nsec];\n }\n\n return [sec, nsec];\n}\n"],"names":["formatDuration","hrToSeconds","hrtimeDiff","seconds","raw","parseFloat","minutes","Math","floor","toFixed","hrtime","start","end","sec","nsec","max"],"mappings":";;;;;;;;;;;QAAgBA;eAAAA;;QAYAC;eAAAA;;QAWAC;eAAAA;;;AAvBT,SAASF,eAAeG,OAAe;IAC5C,MAAMC,MAAMC,WAAWF;IACvB,IAAIC,MAAM,IAAI;QACZ,MAAME,UAAUC,KAAKC,KAAK,CAACJ,MAAM;QACjC,MAAMD,UAAU,AAACC,CAAAA,MAAME,UAAU,EAAC,EAAGG,OAAO,CAAC;QAC7C,OAAO,GAAGH,QAAQ,EAAE,EAAEH,QAAQ,CAAC,CAAC;IAClC,OAAO;QACL,MAAMA,UAAUC,IAAIK,OAAO,CAAC;QAC5B,OAAO,GAAGN,QAAQ,CAAC,CAAC;IACtB;AACF;AAEO,SAASF,YAAYS,MAAwB;IAClD,MAAMN,MAAMM,MAAM,CAAC,EAAE,GAAGA,MAAM,CAAC,EAAE,GAAG;IACpC,OAAON,IAAIK,OAAO,CAAC;AACrB;AAQO,SAASP,WAAWS,QAA0B;IAAC;IAAG;CAAE,EAAEC,MAAwB;IAAC;IAAG;CAAE;IACzF,MAAMC,MAAMD,GAAG,CAAC,EAAE,GAAGD,KAAK,CAAC,EAAE;IAC7B,MAAMG,OAAOF,GAAG,CAAC,EAAE,GAAGD,KAAK,CAAC,EAAE;IAE9B,IAAIG,OAAO,GAAG;QACZ,OAAO;YAACP,KAAKQ,GAAG,CAAC,GAAGF,MAAM;YAAI,MAAMC;SAAK;IAC3C;IAEA,OAAO;QAACD;QAAKC;KAAK;AACpB"}
package/lib/index.js CHANGED
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- formatDuration: function() {
12
+ get formatDuration () {
13
13
  return _formatDuration.formatDuration;
14
14
  },
15
- hrToSeconds: function() {
15
+ get hrToSeconds () {
16
16
  return _formatDuration.hrToSeconds;
17
17
  },
18
- hrtimeDiff: function() {
18
+ get hrtimeDiff () {
19
19
  return _formatDuration.hrtimeDiff;
20
20
  }
21
21
  });
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { formatDuration, hrToSeconds, hrtimeDiff } from \"./formatDuration.js\";\n"],"names":["formatDuration","hrToSeconds","hrtimeDiff"],"mappings":";;;;;;;;;;;QAASA;eAAAA,8BAAc;;QAAEC;eAAAA,2BAAW;;QAAEC;eAAAA,0BAAU;;;gCAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/format-hrtime",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "hrtime formatter for Lage",
5
5
  "repository": {
6
6
  "url": "https://github.com/microsoft/lage"
@@ -14,6 +14,9 @@
14
14
  "test": "jest",
15
15
  "lint": "monorepo-scripts lint"
16
16
  },
17
+ "devDependencies": {
18
+ "@lage-run/monorepo-scripts": "^1.0.0"
19
+ },
17
20
  "publishConfig": {
18
21
  "access": "public"
19
22
  },