Skip to content
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

Consider removing default mappings #2

Open
michaelhogg opened this issue Jan 5, 2017 · 2 comments
Open

Consider removing default mappings #2

michaelhogg opened this issue Jan 5, 2017 · 2 comments

Comments

@michaelhogg
Copy link

Thank you @mcfarljw for creating this nice plugin!

I encountered an issue regarding the default mappings (date and timestamp). I've set replacePrefix and replaceSuffix to empty strings in my config, and I then found that all occurrences of the words date and timestamp were being replaced in my files – rather unexpected!

A workaround is for the user to set date and timestamp to null in their config:

mappings: {
    date:      null,
    timestamp: null
},
replacePrefix: '',
replaceSuffix: ''

But couldn't the default mappings just be removed from the plugin? Is there a reason why the plugin has these default mappings?

@djelic
Copy link

djelic commented Nov 9, 2017

Definitely agree, there shouldn't be any default mappings here.
Workaround if you want avoid replacing date and timestamp:

mappings: {
  date: 'date',
  timestamp: 'timestamp'
},

@mcfarljw
Copy link
Owner

Interesting, I'd never really considered using it without a prefix and suffix because that seemed a bit risky in terms of unexpected behavior, but I suppose if you're replacing in a 3rd party library then it might not be possible.

I could have it disable the default mappings when the prefix and suffix are set to falsey or empty string values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants