xgqfrms / learning

learning : A collection of all kinds of resources, videos, pdf, blogs, codes... 📚 + 💻 + ❤
https://learning.xgqfrms.xyz
MIT License
16 stars 12 forks source link

lodash invert #83

Open xgqfrms opened 4 years ago

xgqfrms commented 4 years ago

lodash invert

lodash/invert

http://lodash.think2011.net/invert https://www.lodashjs.com/docs/lodash.invert


var object = { 'a': 1, 'b': 2, 'c': 1 };

_.invert(object);
// => { '1': 'c', '2': 'b' }

https://stackoverflow.com/questions/35175409/lodash-method-for-reversing-key-values-in-object

xgqfrms commented 4 years ago

import lInvert from 'lodash/invert'

export const DeliverType = {
  1: 'deliver',
  2: 'selfget',
  3: 'onsite',
  4: 'eticket',
  5: 'eticket-epass',
}

export const DeliverTypeByName = lInvert(DeliverType)
xgqfrms commented 4 years ago

overwrite

? override

image