2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-05 10:32:24 +03:00

fix: replace lodash.uniqby with internal fn

This commit is contained in:
Alexander Lichter
2018-12-18 16:30:51 +00:00
parent 8dd50457cb
commit 9393c54dc8
4 changed files with 10 additions and 8 deletions
-5
View File
@@ -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",
-1
View File
@@ -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"
},
+2 -2
View File
@@ -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()
)
}
+8
View File
@@ -0,0 +1,8 @@
export default function uniqBy (inputArray, predicate) {
return inputArray
.sort((a, b) => predicate(a) > predicate(b))
.filter((x, i, arr) => i === arr.length - 1
? true
: predicate(x) !== predicate(arr[i + 1])
)
}