不要怂,就是干,撸起袖子干!

Commit 4fda57ac by Sascha Depold

some helpers

1 parent b4d0b9bd
Showing with 22 additions and 1 deletions
...@@ -142,12 +142,32 @@ SequelizeHelper = { ...@@ -142,12 +142,32 @@ SequelizeHelper = {
}) })
return result return result
}, },
without: function(array, func) { reject: function(array, func) {
var result = [] var result = []
array.forEach(function(element) { array.forEach(function(element) {
if(!func(element)) result.push(element) if(!func(element)) result.push(element)
}) })
return result return result
},
select: function(array, func) {
var result = []
array.forEach(function(element) {
if(func(element)) result.push(element)
})
return result
},
without: function(array, withouts) {
var result = []
array.forEach(function(e) {
if(withouts.indexOf(e) == -1) result.push(e)
})
return result
},
join: function(arr1, arr2) {
var result = []
arr1.forEach(function(e) { result.push(e) })
arr2.forEach(function(e) { result.push(e) })
return result
} }
} }
} }
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!