-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure tags must fit pattern before adding them #21
base: master
Are you sure you want to change the base?
Conversation
@developit any reason why we can't merge this yet? Would be awesome to have this functionality working! |
|
src/tags-input.js
Outdated
@@ -45,15 +45,26 @@ export default function tagsInput(input) { | |||
// Return false if no need to add a tag | |||
function addTag(text) { | |||
// Add multiple tags if the user pastes in data with SEPERATOR already in it | |||
if (~text.indexOf(SEPERATOR)) text = text.split(SEPERATOR); | |||
if (Array.isArray(text)) return text.forEach(addTag); | |||
if ( text.includes(SEPERATOR) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems a shame to give up IE compat here
We could just add a polyfill for legacy browsers. This keeps the code clean and can be deleted quickly when you finally drop IE. :^) |
I'm too obsessed with file size to go that route 😜 |
Developit: it's literally only a few characters
See https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/includes . It's also way more readable than ye olde "if index is greater than or equal to zero". |
…s of module can pick their own build tools) Make index.js just an npm module. Nobody cares about UMD, AMD, or TC39 modules.
Fix 'base' and just use document
Update README.md
Fixes #20