Currently, Wordsmith's trim overrides Twig's core function. (This is intentional.) However, we could make them interoperable by adding some matching params to Wordsmith's trim function.
The new signature of our trim function would be something like:
public function trim($s, $characterMask = null, $side = 'both', $chars = null) : string
Pros:
Affordance for anyone familiar with Twig's trim
Prevent accidentally manifesting bugs in users' templates if they are already using Twig's trim when they install Wordsmith
Cons:
Added complexity because we need to add conditional branches to Wordsmith's trim
Redundancy w/ trimLeft and trimRight — Do we deprecate these?
Documentation options
Silent compatibility (i.e. Stringy params in documentation, Twig's params working silently as a bonus)
Deprecate the Stringy params in favor of documented compatibility with Twig's params
Currently, Wordsmith's
trim
overrides Twig's core function. (This is intentional.) However, we could make them interoperable by adding some matching params to Wordsmith'strim
function.The new signature of our
trim
function would be something like:Pros:
trim
trim
when they install WordsmithCons:
trim
trimLeft
andtrimRight
— Do we deprecate these?Documentation options
I would welcome a PR to
dev
to address this.