@powfix/core-js 0.25.0 → 0.25.1

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.
@@ -1 +1,10 @@
1
1
  'use strict';
2
+ var utils = require('./utils');
3
+ Object.keys(utils).forEach(function(k) {
4
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
+ enumerable: true,
6
+ get: function get() {
7
+ return utils[k];
8
+ }
9
+ });
10
+ });
@@ -1 +1 @@
1
- export {};
1
+ export * from './utils/index.js';
@@ -0,0 +1 @@
1
+ export * from './utils/index.js';
@@ -0,0 +1,103 @@
1
+ 'use strict';
2
+ function _class_call_check(instance, Constructor) {
3
+ if (!(instance instanceof Constructor)) {
4
+ throw new TypeError("Cannot call a class as a function");
5
+ }
6
+ }
7
+ function _defineProperties(target, props) {
8
+ for(var i = 0; i < props.length; i++){
9
+ var descriptor = props[i];
10
+ descriptor.enumerable = descriptor.enumerable || false;
11
+ descriptor.configurable = true;
12
+ if ("value" in descriptor) descriptor.writable = true;
13
+ Object.defineProperty(target, descriptor.key, descriptor);
14
+ }
15
+ }
16
+ function _create_class(Constructor, protoProps, staticProps) {
17
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
18
+ if (staticProps) _defineProperties(Constructor, staticProps);
19
+ return Constructor;
20
+ }
21
+ var chunkJE77HYXB_cjs = require('../../chunk-JE77HYXB.cjs');
22
+ var uuid = require('@powfix/uuid');
23
+ var _searchParams;
24
+ var _SearchParamsUtils = /*#__PURE__*/ function() {
25
+ function _SearchParamsUtils(searchParams) {
26
+ _class_call_check(this, _SearchParamsUtils);
27
+ chunkJE77HYXB_cjs.__privateAdd(this, _searchParams);
28
+ chunkJE77HYXB_cjs.__privateSet(this, _searchParams, searchParams);
29
+ }
30
+ _create_class(_SearchParamsUtils, [
31
+ {
32
+ key: "getString",
33
+ value: function getString(key) {
34
+ return _SearchParamsUtils.getString(chunkJE77HYXB_cjs.__privateGet(this, _searchParams), key);
35
+ }
36
+ },
37
+ {
38
+ key: "getStrings",
39
+ value: function getStrings(key) {
40
+ return _SearchParamsUtils.getStrings(chunkJE77HYXB_cjs.__privateGet(this, _searchParams), key);
41
+ }
42
+ }
43
+ ], [
44
+ {
45
+ key: "urlSearchParams",
46
+ get: function get() {
47
+ return new URL(window.location.href).searchParams;
48
+ }
49
+ },
50
+ {
51
+ key: "getString",
52
+ value: function getString(searchParams, key) {
53
+ if (!searchParams.has(key)) {
54
+ return null;
55
+ }
56
+ return searchParams.get(key);
57
+ }
58
+ },
59
+ {
60
+ key: "getStrings",
61
+ value: function getStrings(searchParams, key) {
62
+ if (!searchParams.has(key)) {
63
+ return null;
64
+ }
65
+ return searchParams.getAll(key);
66
+ }
67
+ },
68
+ {
69
+ key: "getUuid",
70
+ value: function getUuid(searchParams, key) {
71
+ var value = this.getString(searchParams, key);
72
+ if (!uuid.UUID.isValid(value)) {
73
+ return null;
74
+ }
75
+ return uuid.UUID.from(value);
76
+ }
77
+ },
78
+ {
79
+ key: "getUuids",
80
+ value: function getUuids(searchParams, key) {
81
+ var values = this.getStrings(searchParams, key);
82
+ if (values == null) {
83
+ return null;
84
+ }
85
+ return values.filter(function(value) {
86
+ return uuid.UUID.isValid(value);
87
+ }).map(function(value) {
88
+ return uuid.UUID.from(value);
89
+ });
90
+ }
91
+ },
92
+ {
93
+ key: "from",
94
+ value: function from(searchParams) {
95
+ return new _SearchParamsUtils(searchParams);
96
+ }
97
+ }
98
+ ]);
99
+ return _SearchParamsUtils;
100
+ }();
101
+ _searchParams = new WeakMap();
102
+ var SearchParamsUtils = _SearchParamsUtils;
103
+ exports.SearchParamsUtils = SearchParamsUtils;
@@ -0,0 +1,13 @@
1
+ import { UUID } from "@powfix/uuid";
2
+ export declare class SearchParamsUtils {
3
+ #private;
4
+ private static get urlSearchParams();
5
+ static getString(searchParams: URLSearchParams, key: string): string | null;
6
+ static getStrings(searchParams: URLSearchParams, key: string): string[] | null;
7
+ static getUuid(searchParams: URLSearchParams, key: string): UUID | null;
8
+ static getUuids(searchParams: URLSearchParams, key: string): UUID[] | null;
9
+ static from(searchParams: URLSearchParams): SearchParamsUtils;
10
+ constructor(searchParams: URLSearchParams);
11
+ getString(key: string): string | null;
12
+ getStrings(key: string): string[] | null;
13
+ }
@@ -0,0 +1,103 @@
1
+ function _class_call_check(instance, Constructor) {
2
+ if (!(instance instanceof Constructor)) {
3
+ throw new TypeError("Cannot call a class as a function");
4
+ }
5
+ }
6
+ function _defineProperties(target, props) {
7
+ for(var i = 0; i < props.length; i++){
8
+ var descriptor = props[i];
9
+ descriptor.enumerable = descriptor.enumerable || false;
10
+ descriptor.configurable = true;
11
+ if ("value" in descriptor) descriptor.writable = true;
12
+ Object.defineProperty(target, descriptor.key, descriptor);
13
+ }
14
+ }
15
+ function _create_class(Constructor, protoProps, staticProps) {
16
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17
+ if (staticProps) _defineProperties(Constructor, staticProps);
18
+ return Constructor;
19
+ }
20
+ import { __privateAdd, __privateSet, __privateGet } from '../../chunk-AQ5VUG5P.js';
21
+ import { UUID } from '@powfix/uuid';
22
+ var _searchParams;
23
+ var _SearchParamsUtils = /*#__PURE__*/ function() {
24
+ "use strict";
25
+ function _SearchParamsUtils(searchParams) {
26
+ _class_call_check(this, _SearchParamsUtils);
27
+ __privateAdd(this, _searchParams);
28
+ __privateSet(this, _searchParams, searchParams);
29
+ }
30
+ _create_class(_SearchParamsUtils, [
31
+ {
32
+ key: "getString",
33
+ value: function getString(key) {
34
+ return _SearchParamsUtils.getString(__privateGet(this, _searchParams), key);
35
+ }
36
+ },
37
+ {
38
+ key: "getStrings",
39
+ value: function getStrings(key) {
40
+ return _SearchParamsUtils.getStrings(__privateGet(this, _searchParams), key);
41
+ }
42
+ }
43
+ ], [
44
+ {
45
+ key: "urlSearchParams",
46
+ get: function get() {
47
+ return new URL(window.location.href).searchParams;
48
+ }
49
+ },
50
+ {
51
+ key: "getString",
52
+ value: function getString(searchParams, key) {
53
+ if (!searchParams.has(key)) {
54
+ return null;
55
+ }
56
+ return searchParams.get(key);
57
+ }
58
+ },
59
+ {
60
+ key: "getStrings",
61
+ value: function getStrings(searchParams, key) {
62
+ if (!searchParams.has(key)) {
63
+ return null;
64
+ }
65
+ return searchParams.getAll(key);
66
+ }
67
+ },
68
+ {
69
+ key: "getUuid",
70
+ value: function getUuid(searchParams, key) {
71
+ var value = this.getString(searchParams, key);
72
+ if (!UUID.isValid(value)) {
73
+ return null;
74
+ }
75
+ return UUID.from(value);
76
+ }
77
+ },
78
+ {
79
+ key: "getUuids",
80
+ value: function getUuids(searchParams, key) {
81
+ var values = this.getStrings(searchParams, key);
82
+ if (values == null) {
83
+ return null;
84
+ }
85
+ return values.filter(function(value) {
86
+ return UUID.isValid(value);
87
+ }).map(function(value) {
88
+ return UUID.from(value);
89
+ });
90
+ }
91
+ },
92
+ {
93
+ key: "from",
94
+ value: function from(searchParams) {
95
+ return new _SearchParamsUtils(searchParams);
96
+ }
97
+ }
98
+ ]);
99
+ return _SearchParamsUtils;
100
+ }();
101
+ _searchParams = new WeakMap();
102
+ var SearchParamsUtils = _SearchParamsUtils;
103
+ export { SearchParamsUtils };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+ var SearchParamsUtils = require('./SearchParamsUtils');
3
+ Object.keys(SearchParamsUtils).forEach(function(k) {
4
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
+ enumerable: true,
6
+ get: function get() {
7
+ return SearchParamsUtils[k];
8
+ }
9
+ });
10
+ });
@@ -0,0 +1 @@
1
+ export * from './SearchParamsUtils.js';
@@ -0,0 +1 @@
1
+ export * from './SearchParamsUtils.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powfix/core-js",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "description": "core package",
5
5
  "author": "Kwon Kyung-Min <powfix@gmail.com>",
6
6
  "private": false,
@@ -62,7 +62,7 @@
62
62
  "uuid": "9.0.1"
63
63
  },
64
64
  "devDependencies": {
65
- "@powfix/uuid": "^0.2.12",
65
+ "@powfix/uuid": "^0.2.17",
66
66
  "@swc/core": "^1.13.5",
67
67
  "@types/base-64": "1.0.2",
68
68
  "@types/node": "^24.5.1",