aboutsummaryrefslogtreecommitdiff
path: root/ucd/api.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-11-28 00:37:03 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-11-28 13:53:18 +0900
commitcb9d92f0b4e0097579f6e5da1dc6e2f063b532a9 (patch)
tree3d43aa9f3463f93451532d6dec9442a664d2d0a9 /ucd/api.go
parentMove all UCD-related processes to ucd package (diff)
downloadtre-cb9d92f0b4e0097579f6e5da1dc6e2f063b532a9.tar.gz
tre-cb9d92f0b4e0097579f6e5da1dc6e2f063b532a9.tar.xz
Make contributory properties unavailable except internal use
This change follows [UAX #44 5.13 Property APIs]. > The following subtypes of Unicode character properties should generally not be exposed in APIs, > except in limited circumstances. They may not be useful, particularly in public API collections, > and may instead prove misleading to the users of such API collections. > > * Contributory properties are not recommended for public APIs. > ... https://unicode.org/reports/tr44/#Property_APIs
Diffstat (limited to 'ucd/api.go')
-rw-r--r--ucd/api.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/ucd/api.go b/ucd/api.go
index 6451f39..0212e01 100644
--- a/ucd/api.go
+++ b/ucd/api.go
@@ -39,6 +39,19 @@ func NormalizeCharacterProperty(propName, propVal string) (string, error) {
return b.String(), nil
}
+func IsContributoryProperty(propName string) bool {
+ if propName == "" {
+ return false
+ }
+
+ for _, p := range contributoryProperties {
+ if propName == p {
+ return true
+ }
+ }
+ return false
+}
+
func FindCodePointRanges(propName, propVal string) ([]*CodePointRange, bool, error) {
if propName == "" {
propName = "gc"