fix: expose if necessary

This commit is contained in:
Miwa / Ensan
2025-06-15 19:38:46 +09:00
parent 14be26541d
commit c2c7cbf031
2 changed files with 20 additions and 20 deletions

View File

@@ -18,7 +18,7 @@ package extension Sequence {
}
}
package extension Collection {
public extension Collection {
/// Returns a `Set` containing the elements of this sequence with transformed values.
/// - Parameters:
/// - transform: A closure that transforms each element of this sequence into a value that can be hashed.
@@ -60,7 +60,7 @@ package extension Collection {
}
}
package extension MutableCollection {
public extension MutableCollection {
/// Calls the given closure with a pointer to the array's mutable contiguous storage.
/// - Parameter
/// - transform: A closure that takes a pointer to the array's mutable contiguous storage.
@@ -71,7 +71,7 @@ package extension MutableCollection {
}
}
package extension Collection {
public extension Collection {
/// Returns a SubSequence containing the elements of this sequence up to the first element that does not satisfy the given predicate.
/// - Parameters:
/// - condition: A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element should be included.
@@ -85,7 +85,7 @@ package extension Collection {
}
}
package extension Collection where Self.Element: Equatable {
public extension Collection where Self.Element: Equatable {
/// Returns a Bool value indicating whether the collection has the given prefix.
/// - Parameters:
/// - prefix: A collection to search for at the start of this collection.

View File

@@ -6,26 +6,26 @@
// Copyright © 2020 ensan. All rights reserved.
//
import Foundation
public import Foundation
package extension StringProtocol {
extension StringProtocol {
///
/// - note: `false`
@usableFromInline
var onlyRomanAlphabetOrNumber: Bool {
@inlinable
package var onlyRomanAlphabetOrNumber: Bool {
!isEmpty && range(of: "[^a-zA-Z0-9]", options: .regularExpression) == nil
}
///
/// - note: `false`
@usableFromInline
var onlyRomanAlphabet: Bool {
@inlinable
package var onlyRomanAlphabet: Bool {
!isEmpty && range(of: "[^a-zA-Z]", options: .regularExpression) == nil
}
///
/// - note: `false`
/// 40
@inlinable
var containsRomanAlphabet: Bool {
package var containsRomanAlphabet: Bool {
for value in self.utf8 {
if (UInt8(ascii: "a") <= value && value <= UInt8(ascii: "z")) || (UInt8(ascii: "A") <= value && value <= UInt8(ascii: "Z")) {
return true
@@ -35,21 +35,21 @@ package extension StringProtocol {
}
///
/// - note: `false`
@usableFromInline
var isEnglishSentence: Bool {
@inlinable
public var isEnglishSentence: Bool {
!isEmpty && range(of: "[^0-9a-zA-Z\n !'_<>\\[\\]{}*@`\\^|~=\"#$%&\\+\\(\\),\\-\\./:;?\\\\]", options: .regularExpression) == nil
}
///
@usableFromInline
var isKana: Bool {
package var isKana: Bool {
!isEmpty && range(of: "[^ぁ-ゖァ-ヶ]", options: .regularExpression) == nil
}
/// Returns a String value in which Hiraganas are all converted to Katakana.
/// - Returns: A String value in which Hiraganas are all converted to Katakana.
@usableFromInline
func toKatakana() -> String {
@inlinable
public func toKatakana() -> String {
// utf162utf16
let result = self.utf16.map { scalar -> UInt16 in
if 0x3041 <= scalar && scalar <= 0x3096 {
@@ -63,8 +63,8 @@ package extension StringProtocol {
/// Returns a String value in which Katakana are all converted to Hiragana.
/// - Returns: A String value in which Katakana are all converted to Hiragana.
@usableFromInline
func toHiragana() -> String {
@inlinable
public func toHiragana() -> String {
// utf162utf16
let result = self.utf16.map { scalar -> UInt16 in
if 0x30A1 <= scalar && scalar <= 0x30F6 {
@@ -87,7 +87,7 @@ package extension StringProtocol {
" -> \d
*/
// please use these letters in order to avoid user-inputting text crash
func templateDataSpecificEscaped() -> String {
package func templateDataSpecificEscaped() -> String {
var result = self.replacingOccurrences(of: "\\", with: "\\b")
result = result.replacingOccurrences(of: "\0", with: "\\0")
result = result.replacingOccurrences(of: "\n", with: "\\n")
@@ -98,7 +98,7 @@ package extension StringProtocol {
return result
}
func templateDataSpecificUnescaped() -> String {
package func templateDataSpecificUnescaped() -> String {
var result = self.replacingOccurrences(of: "\\d", with: "\"")
result = result.replacingOccurrences(of: "\\s", with: " ")
result = result.replacingOccurrences(of: "\\c", with: ",")