refactor: extract remove util

This commit is contained in:
Evan You
2020-02-18 13:52:59 -05:00
parent fd031490fb
commit 583f9468fa
3 changed files with 12 additions and 9 deletions

View File

@@ -36,6 +36,13 @@ export const extend = <T extends object, U extends object>(
return a as any
}
export const remove = <T>(arr: T[], el: T) => {
const i = arr.indexOf(el)
if (i > -1) {
arr.splice(i, 1)
}
}
const hasOwnProperty = Object.prototype.hasOwnProperty
export const hasOwn = (
val: object,