{"_id":"is-string-and-not-blank","_rev":"1747014","name":"is-string-and-not-blank","description":"3x as fast as `is-whitespace` and `whitespace-regex` thanks to `is-string-blank`.  This package is a simple function that accepts an argument and returns `true` if it is a string AND it is not blank.  Supports Node and Browser environments.","dist-tags":{"latest":"0.0.2"},"maintainers":[{"name":"niftylettuce","email":""}],"time":{"modified":"2021-11-29T01:34:18.000Z","created":"2019-09-02T04:28:22.702Z","0.0.2":"2019-09-02T05:15:47.932Z","0.0.1":"2019-09-02T04:28:22.702Z"},"users":{},"author":{"name":"Nick Baugh","email":"niftylettuce@gmail.com","url":"http://niftylettuce.com/"},"repository":{"type":"git","url":"https://github.com/niftylettuce/is-string-and-not-blank"},"versions":{"0.0.2":{"name":"is-string-and-not-blank","description":"3x as fast as `is-whitespace` and `whitespace-regex` thanks to `is-string-blank`.  This package is a simple function that accepts an argument and returns `true` if it is a string AND it is not blank.  Supports Node and Browser environments.","version":"0.0.2","author":{"name":"Nick Baugh","email":"niftylettuce@gmail.com","url":"http://niftylettuce.com/"},"ava":{"failFast":true,"verbose":true},"bugs":{"url":"https://github.com/niftylettuce/is-string-and-not-blank/issues","email":"niftylettuce@gmail.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"contributors":[{"name":"Nick Baugh","email":"niftylettuce@gmail.com","url":"http://niftylettuce.com/"}],"dependencies":{"is-string-blank":"^1.0.1"},"devDependencies":{"@babel/cli":"^7.5.5","@babel/core":"^7.5.5","@babel/preset-env":"^7.5.5","@commitlint/cli":"latest","@commitlint/config-conventional":"latest","ava":"latest","babelify":"^10.0.0","benchmark":"^2.1.4","browserify":"^16.5.0","codecov":"latest","cross-env":"latest","eslint":"latest","eslint-config-xo-lass":"latest","eslint-plugin-compat":"^3.3.0","eslint-plugin-node":"^9.2.0","fixpack":"latest","husky":"latest","jsdom":"^15.1.1","lint-staged":"latest","nyc":"latest","remark-cli":"latest","remark-preset-github":"latest","tinyify":"https://github.com/niftylettuce/tinyify","whitespace-regex":"^0.1.2","xo":"latest"},"engines":{"node":">=6.4.0"},"homepage":"https://github.com/niftylettuce/is-string-and-not-blank","husky":{"hooks":{"pre-commit":"npm test","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"jsdelivr":"dist/is-string-and-not-blank.min.js","keywords":["blank","break","browser","check","empty","ending","expression","is","isblank","isempty","line","lodash","not","null","regex","regexp","regular","str","string","test","underscore","underscore.string","whitespace"],"license":"MIT","lint-staged":{"*.js":["xo --fix","git add"],"*.md":["remark . -qfo","git add"],"package.json":["fixpack","git add"]},"main":"lib/index.js","nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100,"reporter":["lcov","html","text"]},"prettier":{"singleQuote":true,"bracketSpacing":true,"trailingComma":"none"},"remarkConfig":{"plugins":["preset-github"]},"repository":{"type":"git","url":"https://github.com/niftylettuce/is-string-and-not-blank"},"scripts":{"ava":"cross-env NODE_ENV=test ava","browserify":"browserify src/index.js -o dist/is-string-and-not-blank.js -s isSANB -g [ babelify --configFile ./.dist.babelrc ]","build":"npm run build:clean && npm run build:lib && npm run build:dist","build:clean":"rimraf lib dist","build:dist":"npm run browserify && npm run minify","build:lib":"babel --config-file ./.lib.babelrc src --out-dir lib","coverage":"nyc report --reporter=text-lcov > coverage.lcov && codecov","lint":"xo && remark . -qfo && eslint --no-inline-config -c .lib.eslintrc lib && eslint --no-inline-config -c .dist.eslintrc dist","minify":"cross-env NODE_ENV=production browserify src/index.js -o dist/is-string-and-not-blank.min.js -s isSANB -g [ babelify --configFile ./.dist.babelrc ] -p tinyify","nyc":"cross-env NODE_ENV=test nyc ava","test":"npm run build && npm run lint && npm run ava","test-coverage":"npm run build && npm run lint && npm run nyc"},"unpkg":"dist/is-string-and-not-blank.min.js","xo":{"prettier":true,"space":true,"extends":["xo-lass"],"env":["node","browser"]},"licenseText":"MIT License\n\nCopyright (c) 2019 Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"is-string-and-not-blank@0.0.2","dist":{"shasum":"cd19eded2ca4a514f79ca528915f1fb28e5dd38a","size":5209,"noattachment":false,"key":"/is-string-and-not-blank/-/is-string-and-not-blank-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/is-string-and-not-blank/download/is-string-and-not-blank-0.0.2.tgz"},"maintainers":[{"name":"niftylettuce","email":""}],"_npmUser":{"name":"niftylettuce","email":"niftylettuce@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-string-and-not-blank_0.0.2_1567401347754_0.7048117000959777"},"_hasShrinkwrap":false,"publish_time":1567401347932,"_cnpm_publish_time":1567401347932},"0.0.1":{"name":"is-string-and-not-blank","description":"3x as fast as `is-whitespace` and `whitespace-regex` thanks to `is-string-blank`.  This package is a simple function that accepts an argument and returns `true` if it is a string AND it is not blank.","version":"0.0.1","author":{"name":"Nick Baugh","email":"niftylettuce@gmail.com","url":"http://niftylettuce.com/"},"ava":{"failFast":true,"verbose":true},"bugs":{"url":"https://github.com/niftylettuce/is-string-and-not-blank/issues","email":"niftylettuce@gmail.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"contributors":[{"name":"Nick Baugh","email":"niftylettuce@gmail.com","url":"http://niftylettuce.com/"}],"dependencies":{"is-string-blank":"^1.0.1"},"devDependencies":{"@commitlint/cli":"latest","@commitlint/config-conventional":"latest","ava":"latest","benchmark":"^2.1.4","codecov":"latest","cross-env":"latest","eslint":"latest","eslint-config-xo-lass":"latest","fixpack":"latest","husky":"latest","lint-staged":"latest","nyc":"latest","remark-cli":"latest","remark-preset-github":"latest","whitespace-regex":"^0.1.2","xo":"latest"},"engines":{"node":">=8.3"},"homepage":"https://github.com/niftylettuce/is-string-and-not-blank","husky":{"hooks":{"pre-commit":"lint-staged && npm test","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"keywords":["blank","break","check","empty","ending","expression","is","isblank","isempty","line","lodash","not","null","regex","regexp","regular","str","string","test","underscore","underscore.string","whitespace"],"license":"MIT","lint-staged":{"*.js":["xo --fix","git add"],"*.md":["remark . -qfo","git add"],"package.json":["fixpack","git add"]},"main":"index.js","nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100,"reporter":["lcov","html","text"]},"prettier":{"singleQuote":true,"bracketSpacing":true,"trailingComma":"none"},"remarkConfig":{"plugins":["preset-github"]},"repository":{"type":"git","url":"https://github.com/niftylettuce/is-string-and-not-blank"},"scripts":{"ava":"cross-env NODE_ENV=test ava","coverage":"nyc report --reporter=text-lcov > coverage.lcov && codecov","lint":"xo && remark . -qfo","nyc":"cross-env NODE_ENV=test nyc ava","test":"npm run lint && npm run ava","test-coverage":"npm run lint && npm run nyc"},"xo":{"prettier":true,"space":true,"extends":["xo-lass"]},"licenseText":"MIT License\n\nCopyright (c) 2019 Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"is-string-and-not-blank@0.0.1","dist":{"shasum":"50c9ec785f3622e17b2803f96611a4c65dcf53c4","size":3919,"noattachment":false,"key":"/is-string-and-not-blank/-/is-string-and-not-blank-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/is-string-and-not-blank/download/is-string-and-not-blank-0.0.1.tgz"},"maintainers":[{"name":"niftylettuce","email":""}],"_npmUser":{"name":"niftylettuce","email":"niftylettuce@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-string-and-not-blank_0.0.1_1567398502601_0.45791768020005397"},"_hasShrinkwrap":false,"publish_time":1567398502702,"_cnpm_publish_time":1567398502702}},"readme":"# is-string-and-not-blank\n\n[![build status](https://img.shields.io/travis/com/niftylettuce/is-string-and-not-blank.svg)](https://travis-ci.com/niftylettuce/is-string-and-not-blank)\n[![code coverage](https://img.shields.io/codecov/c/github/niftylettuce/is-string-and-not-blank.svg)](https://codecov.io/gh/niftylettuce/is-string-and-not-blank)\n[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)\n[![license](https://img.shields.io/github/license/niftylettuce/is-string-and-not-blank.svg)](LICENSE)\n[![npm downloads](https://img.shields.io/npm/dt/is-string-and-not-blank.svg)](https://npm.im/is-string-and-not-blank)\n\n> 3x as fast as `is-whitespace` and `whitespace-regex` thanks to `is-string-blank`.  This package is a simple function that accepts an argument and returns `true` if it is a string AND it is not blank.  Supports Node and Browser environments.\n\n\n## Table of Contents\n\n* [Install](#install)\n  * [Node](#node)\n  * [Browser](#browser)\n* [Usage](#usage)\n  * [Node](#node-1)\n  * [Browser](#browser-1)\n* [Background](#background)\n* [Benchmark](#benchmark)\n* [Contributors](#contributors)\n* [License](#license)\n\n\n## Install\n\n### Node\n\n[npm][]:\n\n```sh\nnpm install is-string-and-not-blank\n```\n\n[yarn][]:\n\n```sh\nyarn add is-string-and-not-blank\n```\n\n### Browser\n\nSee [Browser](#browser-1) usage below for more information.\n\n\n## Usage\n\n### Node\n\n```js\nconst isSANB = require('is-string-and-not-blank');\n\n// returns false because it's a blank string\nconsole.log(isSANB('    ')); // false\n\n// returns true because it's a string and is not blank\nconsole.log(isSANB('foo')); // true\n\n// returns false because it's not a string\nconsole.log(isSANB([])); // false\n\n// returns false because it's not a string\nconsole.log(isSANB([ 'test', 'test', 'test'])); // false\n\n// returns true because it's a string and it is not blank\nconsole.log(isSANB(' foo ')); // true\n```\n\n### Browser\n\n#### VanillaJS\n\n**The browser-ready bundle is only 566 bytes (minified and gzipped)**.\n\n```html\n<script src=\"https://unpkg.com/is-string-and-not-blank\"></script>\n<script type=\"text/javascript\">\n  (function() {\n    // returns false because it's a blank string\n    console.log(isSANB('    ')); // false\n\n    // returns true because it's a string and is not blank\n    console.log(isSANB('foo')); // true\n\n    // returns false because it's not a string\n    console.log(isSANB([])); // false\n\n    // returns false because it's not a string\n    console.log(isSANB([ 'test', 'test', 'test'])); // false\n\n    // returns true because it's a string and it is not blank\n    console.log(isSANB(' foo ')); // true\n  });\n</script>\n```\n\n#### Bundler\n\nIf you're using something like [browserify][], [webpack][], or [rollup][], then install the package as you would with [Node](#node) above.\n\n\n## Background\n\nI made this after running into a bug with Firefox Klar/Focus, specifically related to `underscore.string` exposing `s` as the global, and that WebView overriding the global variable `s`.  See [mozilla-mobile/focus-android#4295](https://github.com/mozilla-mobile/focus-android/issues/4295), [epeli/underscore.string#523](https://github.com/epeli/underscore.string/issues/523), and [epeli/underscore.string#415](https://github.com/epeli/underscore.string/issues/415).\n\nAlso, using `underscore.string` just for its `s.isBlank` function is not preferable, and `is-whitespace`, and all other solutions did not save me the stress of having to type out `if (typeof foo === 'string' && !isBlank(foo))`.\n\nThis is a simple package that returns `true` if and only if the argument passed is a String and it is not blank, otherwise it returns `false`.  No more false positives for arguments that are Arrays or other types (which for some reason other authors did not consider...?).\n\nOther packages out there solve this problem similarly, however they do not return the same conditional test:\n\n* [is-whitespace](https://github.com/jonschlinkert/is-whitespace) - you would need to further supplement this via `if (typeof str === 'string' && !isWhitespace(str))`\n* [is-string-blank](https://github.com/plotly/is-string-blank) - same as `is-whitespace` above\n* [is-blank](https://www.npmjs.com/package/is-blank) - same as `is-whitespace` and `is-string-blank` above\n\n\n## Benchmark\n\nSee the test folder for a benchmark check integrated with the tests.\n\n```sh\nℹ whitespace-regex  x 44,939,232 ops/sec ±2.44% (85 runs sampled)\nℹ is-string-and-not-blank x 145,034,505 ops/sec ±2.33% (86 runs sampled)\n```\n\n\n## Contributors\n\n| Name           | Website                    |\n| -------------- | -------------------------- |\n| **Nick Baugh** | <http://niftylettuce.com/> |\n\n\n## License\n\n[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)\n\n\n## \n\n[npm]: https://www.npmjs.com/\n\n[yarn]: https://yarnpkg.com/\n\n[browserify]: https://github.com/browserify/browserify\n\n[webpack]: https://github.com/webpack/webpack\n\n[rollup]: https://github.com/rollup/rollup\n","_attachments":{},"homepage":"https://github.com/niftylettuce/is-string-and-not-blank","bugs":{"url":"https://github.com/niftylettuce/is-string-and-not-blank/issues","email":"niftylettuce@gmail.com"},"license":"MIT"}