Socket
Socket
Sign inDemoInstall

arrayiffy-if-string

Package Overview
Dependencies
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arrayiffy-if-string

Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.


Version published
Weekly downloads
18K
increased by0.24%
Maintainers
1
Weekly downloads
 
Created
Source

arrayiffy-if-string

ESLint on airbnb-base with caveats

Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.

Minimum Node version required Link to npm page Build Status Coverage bitHound Overall Score bitHound Dependencies View dependencies as 2D chart bitHound Dev Dependencies Known Vulnerabilities Downloads/Month Test in browser MIT License

Table of Contents

Install

npm i arrayiffy-if-string
// consume as CommonJS require:
const arrayiffy = require('require arrayiffy-if-string')
// or as an ES module:
import arrayiffy from 'arrayiffy-if-string'

Here's what you'll get:

TypeKey in package.jsonPathSize
Main export - CommonJS version, transpiled to ES5, contains require and module.exportsmaindist/arrayiffy-if-string.cjs.js303 B
ES module build that Webpack/Rollup understands. Untranspiled ES6 code with import/export.moduledist/arrayiffy-if-string.esm.js286 B
UMD build for browsers, transpiled, minified, containing iife's and has all dependencies baked-inbrowserdist/arrayiffy-if-string.umd.js257 B

⬆  back to top

Idea

  • If it's a non-empty string, put it into an array and return it.
  • If it's empty string, return an empty array.
  • If it's anything else, just return it.
const arrayiffy = require('arrayiffy-if-string')
var res = arrayiffy('aaa')
console.log('res = ' + JSON.stringify(res, null, 4))
// => ['aaa']
const arrayiffy = require('arrayiffy-if-string')
var res = arrayiffy('')
console.log('res = ' + JSON.stringify(res, null, 4))
// => []
const arrayiffy = require('arrayiffy-if-string')
var res = arrayiffy(true)
console.log('res = ' + JSON.stringify(res, null, 4))
// => true

It's meant for working with settings objects. Check out check-types-mini.

⬆  back to top

Contributing

Hi! 99% of people in the society are passive - consumers. They wait for others to take action, they prefer to blend in. The remaining 1% are proactive citizens who will do something rather than wait. If you are one of that 1%, you're in luck because I am the same and together we can make something happen.

  • If you want a new feature in this package or you would like to change some of its functionality, raise an issue on this repo. Also, you can email me. Just let it out.

  • If you tried to use this library but it misbehaves, or you need an advice setting it up, and its readme doesn't make sense, just document it and raise an issue on this repo. Alternatively, you can email me.

  • If you don't like the code in here and would like to give advice about how something could be done better, please do. Same drill - GitHub issues or email, your choice.

  • If you would like to add or change some features, just fork it, hack away, and file a pull request. I'll do my best to merge it quickly. Code style is airbnb-base, only without semicolons. If you use a good code editor, it will pick up the established ESLint setup.

⬆  back to top

Licence

MIT License (MIT)

Copyright © 2017 Codsen Ltd, Roy Revelt

Keywords

FAQs

Package last updated on 24 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc