diff --git a/CHANGELOG.md b/CHANGELOG.md index f404960..26fb4b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- Improve count words strategy. + ## [1.12.0] ### Added diff --git a/src/molecules/Input/helper.ts b/src/molecules/Input/helper.ts index 29a4930..1f9bfb7 100644 --- a/src/molecules/Input/helper.ts +++ b/src/molecules/Input/helper.ts @@ -8,6 +8,6 @@ * /> */ export const countWordsStrategy = (value: string): number => { - const words = value.split(' '); + const words = value.trim().split(/\s+/).filter(Boolean); return words.length; };