shinkansen-rails 1.0.138 → 1.0.140

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shinkansen-rails",
3
- "version": "1.0.138",
3
+ "version": "1.0.140",
4
4
  "description": "Shinkansen Rails",
5
5
  "keywords": [
6
6
  "Shinkansen",
@@ -10,6 +10,8 @@
10
10
  "Karakuri"
11
11
  ],
12
12
  "main": "./src/index.cjs",
13
+ "type": "module",
14
+ "types": "./src/index.d.cts",
13
15
  "author": {
14
16
  "name": "Jonathan Perry for Modern Poacher Limited",
15
17
  "email": "modernpoacher@modernpoacher.com",
@@ -40,17 +42,17 @@
40
42
  "@babel/eslint-parser": "^7.23.10",
41
43
  "@babel/preset-env": "^7.23.9",
42
44
  "@babel/register": "^7.23.7",
43
- "@modernpoacher/hooks": "^1.0.465",
45
+ "@modernpoacher/hooks": "^1.0.466",
44
46
  "@sequencemedia/sinon-chai": "^0.0.6",
45
- "@typescript-eslint/eslint-plugin": "5.61.0",
46
- "@typescript-eslint/parser": "5.61.0",
47
+ "@typescript-eslint/eslint-plugin": "^7.0.2",
48
+ "@typescript-eslint/parser": "^7.0.2",
47
49
  "babel-plugin-module-resolver": "^5.0.0",
48
50
  "chai": "^5.1.0",
49
51
  "core-js": "^3.36.0",
50
52
  "cross-env": "^7.0.3",
51
- "eslint": "^8.56.0",
53
+ "eslint": "^8.57.0",
52
54
  "eslint-config-standard": "^17.1.0",
53
- "eslint-config-standard-with-typescript": "35.0.0",
55
+ "eslint-config-standard-with-typescript": "^43.0.1",
54
56
  "eslint-import-resolver-babel-module": "^5.3.2",
55
57
  "husky": "^9.0.11",
56
58
  "mocha": "^10.3.0",
package/src/index.d.cts CHANGED
@@ -1,3 +1,20 @@
1
+ declare module 'shinkansen-rails/rails' {
2
+ export function any (o: Record<string, unknown> | undefined): boolean
3
+ export function has (o: Record<string, unknown> | undefined, k: string): boolean
4
+ export function get (o: Record<string, unknown> | undefined, k: string): unknown
5
+
6
+ export function rail (p: string | undefined): string
7
+ export function go (o: Record<string, unknown> | undefined, p: string | undefined): boolean
8
+ export function to (o: Record<string, unknown> | undefined, p: string | undefined): boolean
9
+
10
+ export default class Rails {
11
+ static pattern (p: string | undefined): string
12
+ static rail (p: string | undefined): string
13
+ static go (o: Record<string, unknown> | undefined, p: string | undefined): boolean
14
+ static to (o: Record<string, unknown> | undefined, p: string | undefined): boolean
15
+ }
16
+ }
17
+
1
18
  declare module 'shinkansen-rails' {
2
- export { default as Rails } from './rails/index.mjs'
19
+ export { default as Rails } from 'shinkansen-rails/rails'
3
20
  }
@@ -13,8 +13,21 @@ const PATTERN = '/:alpha/:omega'
13
13
  const CHAR32 = String.fromCharCode(32)
14
14
  const CHAR45 = String.fromCharCode(45)
15
15
 
16
+ /**
17
+ * @param {Record<string, unknown>} o The object containing values
18
+ */
16
19
  export const any = (o) => !!Reflect.ownKeys(o).length
20
+
21
+ /**
22
+ * @param {Record<string, unknown>} o The object containing values
23
+ * @param {string} k The value name
24
+ */
17
25
  export const has = (o, k) => Reflect.has(o, k)
26
+
27
+ /**
28
+ * @param {Record<string, unknown>} o The object containing values
29
+ * @param {string} k The value name
30
+ */
18
31
  export const get = (o, k) => Reflect.get(o, k)
19
32
 
20
33
  /**
@@ -32,7 +45,7 @@ export function rail (p) {
32
45
  /**
33
46
  * Interrogate parameters to determine whether or not components can be created
34
47
  *
35
- * @param {{}} o The object containing values for the 'pattern'
48
+ * @param {Record<string, unknown>} o The object containing values for the 'pattern'
36
49
  * @param {string} p The 'pattern' according to which URLs should be created
37
50
  * @param {boolean} b Whether the Rails can go
38
51
  * @return {boolean}
@@ -65,7 +78,7 @@ export function go (o, p) {
65
78
  /**
66
79
  * Interrogate parameters for object field names
67
80
  *
68
- * @param {{}} o The object containing fields
81
+ * @param {Record<string, unknown>} o The object containing fields
69
82
  * @param {string} p The string containing field names to be found
70
83
  * @return {string}
71
84
  *
@@ -87,7 +100,7 @@ export function to (o, p) {
87
100
 
88
101
  export default class Rails {
89
102
  /**
90
- * @param {string | void} p The 'pattern' according to which URLs should be created
103
+ * @param {string | undefined} p The 'pattern' according to which URLs should be created
91
104
  * @return {string}
92
105
  */
93
106
  static pattern (p) {
@@ -97,7 +110,7 @@ export default class Rails {
97
110
  }
98
111
 
99
112
  /**
100
- * @param {string | void} p The 'pattern' according to which URLs should be created
113
+ * @param {string | undefined} p The 'pattern' according to which URLs should be created
101
114
  * @return {string}
102
115
  */
103
116
  static rail (p = Rails.pattern()) {
@@ -109,8 +122,8 @@ export default class Rails {
109
122
  }
110
123
 
111
124
  /**
112
- * @param {{} | void} o The object containing values for the 'pattern'
113
- * @param {string | void} p The 'pattern' according to which URLs should be created
125
+ * @param {Record<string, unknown> | undefined} o The object containing values for the 'pattern'
126
+ * @param {string | undefined} p The 'pattern' according to which URLs should be created
114
127
  * @return {boolean}
115
128
  */
116
129
  static go (o = {}, p = Rails.pattern()) {
@@ -120,8 +133,8 @@ export default class Rails {
120
133
  }
121
134
 
122
135
  /**
123
- * @param {{} | void} o The object containing values for the 'pattern'
124
- * @param {string | void} p The 'pattern' according to which URLs should be created
136
+ * @param {Record<string, unknown> | undefined} o The object containing values for the 'pattern'
137
+ * @param {string | undefined} p The 'pattern' according to which URLs should be created
125
138
  * @return {boolean}
126
139
  */
127
140
  static to (o = {}, p = Rails.pattern()) {
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "NodeNext",
4
+ "target": "ESNext",
5
+ "moduleResolution": "NodeNext",
6
+ "noEmit": true,
7
+ "strict": true,
8
+ "isolatedModules": true,
9
+ "baseUrl": "."
10
+ }
11
+ }