Merge branch 'master' into 'yaml-ns-refactoring'

# Conflicts:
#   src/test/cljc/dda/c4k_common/common_test.cljc
This commit is contained in:
Pat Dyn 2022-11-08 13:28:36 +00:00
commit 070e794981
3 changed files with 46 additions and 31 deletions

View file

@ -1,32 +1,32 @@
{ {
"name": "c4k-common-cljs", "name": "c4k-common-cljs",
"description": "Contains predicates and tools for c4k", "description": "Contains predicates and tools for c4k",
"author": "meissa GmbH", "author": "meissa GmbH",
"version": "0.2.0-SNAPSHOT", "version": "0.2.0-SNAPSHOT",
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-common#readme", "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-common#readme",
"repository": "https://www.npmjs.com/package/c4k-common", "repository": "https://www.npmjs.com/package/c4k-common",
"license": "APACHE2", "license": "APACHE2",
"main": "c4k-common.js", "main": "c4k-common.js",
"bin": { "bin": {
"c4k-common": "./c4k-common.js" "c4k-common": "./c4k-common.js"
}, },
"keywords": [ "keywords": [
"cljs", "cljs",
"k8s", "k8s",
"c4k", "c4k",
"deployment", "deployment",
"yaml", "yaml",
"convention4kubernetes" "convention4kubernetes"
], ],
"bugs": { "bugs": {
"url": "https://gitlab.com/domaindrivenarchitecture/c4k-common/issues" "url": "https://gitlab.com/domaindrivenarchitecture/c4k-common/issues"
}, },
"dependencies": { "dependencies": {
"js-base64": "^3.6.1", "js-base64": "^3.7.2",
"js-yaml": "^4.0.0" "js-yaml": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"shadow-cljs": "^2.11.18", "shadow-cljs": "^2.11.18",
"source-map-support": "^0.5.19" "source-map-support": "^0.5.19"
} }
} }

View file

@ -44,6 +44,12 @@
(fqdn-string? (first split-string)) (fqdn-string? (first split-string))
(port-number? (edn/read-string (second split-string))))))) (port-number? (edn/read-string (second split-string)))))))
(defn integer-string?
[input]
(and (string? input)
(some? (re-matches #"^\d+$" input))
(integer? (edn/read-string input))))
(defn string-sequence? (defn string-sequence?
[input] [input]
(and (sequential? input) (and (sequential? input)

View file

@ -51,6 +51,15 @@
(is (false? (cut/host-and-port-string? "test.123:1234"))) (is (false? (cut/host-and-port-string? "test.123:1234")))
(is (false? (cut/host-and-port-string? "test.de:abc")))) (is (false? (cut/host-and-port-string? "test.de:abc"))))
(deftest test-integer-string?
(is (true? (cut/integer-string? "1")))
(is (true? (cut/integer-string? "42")))
(is (false? (cut/integer-string? 42)))
(is (false? (cut/integer-string? "42.2")))
(is (false? (cut/integer-string? "4 2")))
(is (false? (cut/integer-string? "1e2")))
(is (false? (cut/integer-string? true))))
(deftest test-string-sequence? (deftest test-string-sequence?
(is (true? (cut/string-sequence? ["hallo" "welt" "!"]))) (is (true? (cut/string-sequence? ["hallo" "welt" "!"])))
(is (false? (cut/string-sequence? ["hallo" 1 "welt" "!"]))) (is (false? (cut/string-sequence? ["hallo" 1 "welt" "!"])))