ts_routes 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2063328f3c6c947ffda87c9b1a85b9305424115
4
- data.tar.gz: 172ff30d43086c79a87e4182117e4c272ebdb698
3
+ metadata.gz: 83884b340a2d1a221f2b76bccb12806c0700de37
4
+ data.tar.gz: 469bc903d770a8785026770570dd033dd743de53
5
5
  SHA512:
6
- metadata.gz: 339ea4f1bc85714c6873f6adb01b2e5d0e7d3d903ebbba68c1633f0a876c8da06797acbba694030934bda9f5f871e8cc2224f3a8db6ea1533ef97c84b84eddb5
7
- data.tar.gz: 728d1e2d68e395f6ecdebe8425f2a3c45fab9bfb79ad770c31c8d6dbe3b53232b26ce0f9049add053d4fa34691107bab357ea8fbb484a44ae3421322459bb464
6
+ metadata.gz: edca793080e36504208e99bdc1aa7f67e4098dfa43c9765afb08eba93184d1c0915ec7ce953e0b644da4ad02f13f0c2242b9ba8d0786d5795bab8621805a169e
7
+ data.tar.gz: 65126dbef060562c1998a6b78433b0f3a474d1b2a96f050b3fe5da1d2719f3a5d1020507c05b65c83f77f121c7253f89a9d0d7b26f748c58024acf5cdeae2ab5
@@ -16,18 +16,8 @@ function $buildOptions(options: any, names: string[]): string {
16
16
 
17
17
  if (key === "anchor") {
18
18
  anchor = `#${$encode(value)}`;
19
- } else if ($isScalarType(value)) {
20
- q.push(`${$encode(key)}=${$encode(value)}`);
21
- } else if (Array.isArray(value)) {
22
- for (const v of value) {
23
- const k = `${key}[]`;
24
- q.push(`${$encode(k)}=${$encode(v)}`);
25
- }
26
- } else if($isNotNull(value)) { // i.e. non-null, non-scalar, non-array type
27
- for (const k of Object.keys(value)) {
28
- const hk = `${key}[${k}]`;
29
- q.push(`${$encode(hk)}=${$encode(value[k])}`);
30
- }
19
+ } else {
20
+ $buildQuery(q, key, value);
31
21
  }
32
22
  }
33
23
  return (q.length > 0 ? "?" + q.join("&") : "") + anchor;
@@ -36,6 +26,20 @@ function $buildOptions(options: any, names: string[]): string {
36
26
  }
37
27
  }
38
28
 
29
+ function $buildQuery(q: string[], key: string, value: any) {
30
+ if ($isScalarType(value)) {
31
+ q.push(`${$encode(key)}=${$encode(value)}`);
32
+ } else if (Array.isArray(value)) {
33
+ for (const v of value) {
34
+ $buildQuery(q, `${key}[]`, v);
35
+ }
36
+ } else if ($isNotNull(value)) { // i.e. non-null, non-scalar, non-array type
37
+ for (const k of Object.keys(value)) {
38
+ $buildQuery(q, `${key}[${k}]`, value[ k ]);
39
+ }
40
+ }
41
+ }
42
+
39
43
  function $encode(value: any): string {
40
44
  return encodeURIComponent(value);
41
45
  }
@@ -53,5 +57,5 @@ function $isPresent(value: any): boolean {
53
57
  }
54
58
 
55
59
  function $hasPresentOwnProperty(options: any, key: string): boolean {
56
- return options && options.hasOwnProperty(key) && $isPresent(options[key]);
60
+ return options && options.hasOwnProperty(key) && $isPresent(options[ key ]);
57
61
  }
@@ -1,3 +1,3 @@
1
1
  module TsRoutes
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -4,6 +4,10 @@
4
4
  ],
5
5
  "defaultSeverity": "error",
6
6
  "rules": {
7
- "strict-type-predicates": true
7
+ "strict-type-predicates": true,
8
+ "cyclomatic-complexity": [
9
+ true,
10
+ 10
11
+ ]
8
12
  }
9
13
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ts_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - FUJI Goro (gfx)