mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-05 23:42:25 +03:00
Merge pull request #298 from manniL/smooth-package-size
fix: replace lodash.uniqby with internal fn
This commit is contained in:
Generated
-5
@@ -6595,11 +6595,6 @@
|
||||
"integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.uniqby": {
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz",
|
||||
"integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI="
|
||||
},
|
||||
"lodash.uniqueid": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.uniqueid/-/lodash.uniqueid-4.0.1.tgz",
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
"dependencies": {
|
||||
"deepmerge": "^3.0.0",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.uniqby": "^4.7.0",
|
||||
"lodash.uniqueid": "^4.0.1",
|
||||
"object-assign": "^4.1.1"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import deepmerge from 'deepmerge'
|
||||
import uniqBy from 'lodash.uniqby'
|
||||
import uniqBy from './uniqBy'
|
||||
import uniqueId from 'lodash.uniqueid'
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ export default function getComponentOption (opts, result = {}) {
|
||||
return metaObject
|
||||
})
|
||||
result.meta = uniqBy(
|
||||
result.meta.reverse(),
|
||||
result.meta,
|
||||
metaObject => metaObject.hasOwnProperty(tagIDKeyName) ? metaObject[tagIDKeyName] : uniqueId()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
export default function uniqBy (inputArray, predicate) {
|
||||
return inputArray
|
||||
.filter((x, i, arr) => i === arr.length - 1
|
||||
? true
|
||||
: predicate(x) !== predicate(arr[i + 1])
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user