index.js 562 B

12345678910111213141516171819
  1. /*!
  2. * is-whitespace <https://github.com/jonschlinkert/is-whitespace>
  3. *
  4. * Copyright (c) 2014-2015, Jon Schlinkert.
  5. * Licensed under the MIT License.
  6. */
  7. 'use strict';
  8. var cache;
  9. module.exports = function isWhitespace(str) {
  10. return (typeof str === 'string') && regex().test(str);
  11. };
  12. function regex() {
  13. // ensure that runtime compilation only happens once
  14. return cache || (cache = new RegExp('^[\\s\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF"]+$'));
  15. }