0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/core/client/utils/word-counter.js
Manuel Mitasch 47bfd046bb Add admin prototype
issue #2270

- from https://github.com/manuelmitasch/ghost-admin-ember-demo
- Not working properly: added ic-ajax mock in app.js but promise not resolving => loading route always active
2014-03-07 14:01:26 +00:00

6 lines
No EOL
276 B
JavaScript

export default function (s) {
s = s.replace(/(^\s*)|(\s*$)/gi, ""); // exclude start and end white-space
s = s.replace(/[ ]{2,}/gi, " "); // 2 or more space to 1
s = s.replace(/\n /, "\n"); // exclude newline with a start spacing
return s.split(' ').length;
}