-
Notifications
You must be signed in to change notification settings - Fork 384
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
meta tags manager #123
meta tags manager #123
Conversation
Set engines node: 4.2.0 in all package.jsons' Install node_modules with npm 3.3.6 npm shrinkwrap to create new npm-shinkwrap.json
return meta.getAttribute('content'); | ||
} | ||
} | ||
const token = Array.from(document.getElementsByTagName('meta')) |
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.
@josiasds Let's consider the lodash syntax from this.
Interesting find from @dylangrafmyre on the CI regarding Array.from
.
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.
@justin808 I'm not sure we should add lodash only to replace Array.from
by _.toArray
.
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.
You're right. We don't have lodash in this project.
_.find(document.getElementsByTagName('meta'), tag => tag.name === 'csrf-token')
or
_(document.getElementsByTagName('meta')).find(tag => tag.name === 'csrf-token')
I really like Lodash. I wouldn't suggest this otherwise. That being said, we don't need it give some features in ES6.
Because I want this example to be a real starter kit showing off Webpack/Npm/React integration, I think this is worth considering.
Let's see what @mapreal19, @alexfedoseev, @samnang, @dylangrafmyre Think about this one.
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.
Even better from the lodash source, @jdalton:
_.find(document.querySelectorAll('meta'), 'name', 'csrf-token')
39dbde6
to
3445116
Compare
meta tags manager using ES6 Array.from and upgrade to Node 4.2
@josiasds We can consider adding Lodash in a future PR. |
See #124 |
My decision making chart:
|
@alexfedoseev Why would you avoid lodash if you're using immutable.js? We're already including lodash through a dependency of dependency. |
Because every Immutable instance already has all necessary methods in its prototype to handle the data transformations. |
Btw, in this case it's better to use not |
|
@jdalton 👍 |
@alexfedoseev do wepacks optimizations strip out unnecessary libs? |
If you cherry-pick, then yes. |
@jdalton by cherry pick, you mean with the
and can we include Incidentally, this project is already including lodash as a dependency of a dependency. |
If we'll do import _find from 'lodash/collection/find'; If we'll do import _find from 'lodash.find'; Result will be the same. Only difference is if @jdalton correct me if I'm wrong.
I don't think it's a good idea to rely on such dependency, because we can't control it (it can be changed or removed from this package in the future versions). We should define this dependency implicitly. If lodash packages will be identical, then |
Immutable.js > Lodash if we are talking about going into the future. (I love lodash, that isn't the point) That being said, if we are going to use lodash, we 100% have to explicitly depend on it and not rely on a 3rd party library pulling it in. |
👍 👍 👍 @jdalton it would be nice if there was some way that we could use Lodash API's with immutable objects. We're prefixing the names of our immutable objects with |
No description provided.