@naturalcycles/js-lib 15.2.0 → 15.3.0

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.
@@ -10,7 +10,7 @@ export async function loadGTag(gtagId, enabled = true) {
10
10
  window.dataLayer ||= [];
11
11
  window.gtag ||= function gtag() {
12
12
  // biome-ignore lint/complexity/useArrowFunction: ok
13
- // biome-ignore lint/style/noArguments: ok
13
+ // biome-ignore lint/complexity/noArguments: ok
14
14
  window.dataLayer.push(arguments);
15
15
  };
16
16
  window.gtag('js', new Date());
@@ -39,7 +39,7 @@ export function loadHotjar(hjid) {
39
39
  h.hj =
40
40
  h.hj ||
41
41
  function hj() {
42
- // biome-ignore lint/style/noArguments: ok
42
+ // biome-ignore lint/complexity/noArguments: ok
43
43
  ;
44
44
  (h.hj.q = h.hj.q || []).push(arguments);
45
45
  };
@@ -16,7 +16,7 @@ import { _getArgsSignature, _getMethodSignature } from './decorator.util.js';
16
16
  */
17
17
  // eslint-disable-next-line @typescript-eslint/naming-convention
18
18
  export function _LogMethod(opt = {}) {
19
- return (target, key, descriptor) => {
19
+ return (_target, key, descriptor) => {
20
20
  _assert(typeof descriptor.value === 'function', '@_LogMethod can be applied only to methods');
21
21
  const originalFn = descriptor.value;
22
22
  const keyStr = String(key);
@@ -3,7 +3,7 @@ import { pTimeout } from '../promise/pTimeout.js';
3
3
  import { _getMethodSignature } from './decorator.util.js';
4
4
  // eslint-disable-next-line @typescript-eslint/naming-convention
5
5
  export function _Timeout(opt) {
6
- return (target, key, descriptor) => {
6
+ return (_target, key, descriptor) => {
7
7
  _assert(typeof descriptor.value === 'function', '@_Timeout can be applied only to methods');
8
8
  if (!opt.timeout)
9
9
  return descriptor;
@@ -93,7 +93,6 @@ export function _assertIsNumber(v, message) {
93
93
  _assertTypeOf(v, 'number', message);
94
94
  }
95
95
  export function _assertTypeOf(v, expectedType, message) {
96
- // biome-ignore lint/suspicious/useValidTypeof: ok
97
96
  if (typeof v !== expectedType) {
98
97
  const msg = message || `Expected typeof ${expectedType}, actual typeof: ${typeof v}`;
99
98
  throw new AssertionError(msg);
@@ -17,7 +17,6 @@ export function _slugify(s, opt = {}) {
17
17
  // based on https://stackoverflow.com/a/23633850/4919972
18
18
  // Combining Diacritical Marks
19
19
  // https://www.unicode.org/charts/PDF/U0300.pdf
20
- // biome-ignore lint/suspicious/noMisleadingCharacterClass: ok
21
20
  s = s.normalize('NFKD').replaceAll(/[\u0300-\u036F]/g, '');
22
21
  // Detect contractions/possessives by looking for any word followed by a `'t`
23
22
  // or `'s` in isolation and then remove it.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
3
  "type": "module",
4
- "version": "15.2.0",
4
+ "version": "15.3.0",
5
5
  "dependencies": {
6
6
  "tslib": "^2",
7
7
  "zod": "^3"
@@ -9,11 +9,16 @@
9
9
  "devDependencies": {
10
10
  "@naturalcycles/dev-lib": "*",
11
11
  "@types/crypto-js": "^4",
12
- "@types/node": "^22",
12
+ "@types/node": "^24",
13
13
  "@types/semver": "^7",
14
14
  "crypto-js": "^4",
15
15
  "dayjs": "^1"
16
16
  },
17
+ "exports": {
18
+ "./cfg/frontend/tsconfig.json": "./cfg/frontend/tsconfig.json",
19
+ ".": "./dist/index.js",
20
+ "./zod": "./dist/zod/index.js"
21
+ },
17
22
  "files": [
18
23
  "dist",
19
24
  "cfg",
@@ -51,8 +56,9 @@
51
56
  "test": "dev-lib test",
52
57
  "lint": "dev-lib lint",
53
58
  "bt": "dev-lib bt",
54
- "lbt": "dev-lib lbt",
55
- "check": "dev-lib lbt",
59
+ "typecheck": "dev-lib typecheck",
60
+ "check": "dev-lib check",
61
+ "clean": "dev-lib clean",
56
62
  "test-tz1": "TZ=Europe/Stockholm yarn test local",
57
63
  "test-tz2": "TZ=JST-9 yarn test local",
58
64
  "test-ny": "TZ=GMT-0500 yarn test localTime"
package/readme.md CHANGED
@@ -10,7 +10,7 @@
10
10
  [![Test Coverage](https://api.codeclimate.com/v1/badges/c2dc8d53bd79f79b1d8b/test_coverage)](https://codeclimate.com/github/NaturalCycles/js-lib/test_coverage)
11
11
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
12
12
 
13
- # [Documentation](https://naturalcycles.github.io/js-lib/)
13
+ # [Documentation](https://naturalcycles.github.io/js-libs/)
14
14
 
15
15
  # Packaging
16
16
 
@@ -19,7 +19,7 @@ export async function loadGTag(gtagId: string, enabled = true): Promise<void> {
19
19
  window.dataLayer ||= []
20
20
  window.gtag ||= function gtag() {
21
21
  // biome-ignore lint/complexity/useArrowFunction: ok
22
- // biome-ignore lint/style/noArguments: ok
22
+ // biome-ignore lint/complexity/noArguments: ok
23
23
  window.dataLayer.push(arguments)
24
24
  }
25
25
  window.gtag('js', new Date())
@@ -54,7 +54,7 @@ export function loadHotjar(hjid: number): void {
54
54
  h.hj =
55
55
  h.hj ||
56
56
  function hj() {
57
- // biome-ignore lint/style/noArguments: ok
57
+ // biome-ignore lint/complexity/noArguments: ok
58
58
  ;(h.hj.q = h.hj.q || []).push(arguments)
59
59
  }
60
60
  h._hjSettings = { hjid, hjsv: 6 }
@@ -71,7 +71,7 @@ export interface LogMethodOptions {
71
71
  */
72
72
  // eslint-disable-next-line @typescript-eslint/naming-convention
73
73
  export function _LogMethod(opt: LogMethodOptions = {}): MethodDecorator {
74
- return (target, key, descriptor) => {
74
+ return (_target, key, descriptor) => {
75
75
  _assert(typeof descriptor.value === 'function', '@_LogMethod can be applied only to methods')
76
76
 
77
77
  const originalFn = descriptor.value
@@ -97,7 +97,7 @@ export function _LogMethod(opt: LogMethodOptions = {}): MethodDecorator {
97
97
  const sma = avg ? new SimpleMovingAverage(avg) : undefined
98
98
  let count = 0
99
99
 
100
- descriptor.value = function (this: typeof target, ...args: any[]) {
100
+ descriptor.value = function (this: typeof _target, ...args: any[]) {
101
101
  const started = Date.now()
102
102
  const ctx = this
103
103
 
@@ -5,7 +5,7 @@ import { _getMethodSignature } from './decorator.util.js'
5
5
 
6
6
  // eslint-disable-next-line @typescript-eslint/naming-convention
7
7
  export function _Timeout(opt: PTimeoutOptions): MethodDecorator {
8
- return (target, key, descriptor) => {
8
+ return (_target, key, descriptor) => {
9
9
  _assert(typeof descriptor.value === 'function', '@_Timeout can be applied only to methods')
10
10
 
11
11
  if (!opt.timeout) return descriptor
@@ -13,7 +13,7 @@ export function _Timeout(opt: PTimeoutOptions): MethodDecorator {
13
13
  const originalFn = descriptor.value
14
14
  const keyStr = String(key)
15
15
 
16
- descriptor.value = async function (this: typeof target, ...args: any[]) {
16
+ descriptor.value = async function (this: typeof _target, ...args: any[]) {
17
17
  const ctx = this
18
18
  opt.name ||= _getMethodSignature(ctx, keyStr)
19
19
  return await pTimeout(() => originalFn.apply(this, args), opt)
@@ -137,7 +137,6 @@ export function _assertIsNumber(v: any, message?: string): asserts v is number {
137
137
  }
138
138
 
139
139
  export function _assertTypeOf<T>(v: any, expectedType: string, message?: string): asserts v is T {
140
- // biome-ignore lint/suspicious/useValidTypeof: ok
141
140
  if (typeof v !== expectedType) {
142
141
  const msg = message || `Expected typeof ${expectedType}, actual typeof: ${typeof v}`
143
142
  throw new AssertionError(msg)
@@ -41,7 +41,6 @@ export function _slugify(s: string, opt: SlugifyOptions = {}): string {
41
41
  // based on https://stackoverflow.com/a/23633850/4919972
42
42
  // Combining Diacritical Marks
43
43
  // https://www.unicode.org/charts/PDF/U0300.pdf
44
- // biome-ignore lint/suspicious/noMisleadingCharacterClass: ok
45
44
  s = s.normalize('NFKD').replaceAll(/[\u0300-\u036F]/g, '')
46
45
 
47
46
  // Detect contractions/possessives by looking for any word followed by a `'t`