refactored out manual flattening to .flat(..)

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-11-15 00:42:16 +03:00
parent 9cb7bd589a
commit 6cd18e0eff
4 changed files with 7 additions and 12 deletions

View File

@ -847,7 +847,7 @@ var CollectionActions = actions.Actions({
: [ that.data.getImage(gid)
// check base data for image gid...
|| that.collections[MAIN_COLLECTION_TITLE].data.getImage(gid) ] })
.reduce(function(a, b){ return a.concat(b) }, [])
.flat()
this.ensureCollection(collection)
.then((function(c){
@ -1040,7 +1040,7 @@ var CollectionActions = actions.Actions({
// when adding a ribbon gid expand to images...
that.data.ribbons[gid].compact()
: [that.data.getImage(gid)] })
.reduce(function(a, b){ return a.concat(b) }, [])
.flat()
// remove from the loaded state...
this.collection == collection

View File

@ -136,8 +136,7 @@ module.SortActions = actions.Actions({
.filter(function(e){
return e && e.trim() != '' && !/['"]/.test(e) })
: [])
.reduce(function(r, e){
return r.concat(e instanceof Array ? e : [e]) }, []) }
.flat() }
var get = function(name){
// normalize name...
name = name
@ -196,9 +195,7 @@ module.SortActions = actions.Actions({
: a instanceof Array ?
a
: method })
// merge...
.reduce(function(r, e){
return r.concat(e instanceof Array ? e : [e]) }, []) }],
.flat() }],
// Custom sort methods...
//
@ -783,8 +780,7 @@ var SortUIActions = actions.Actions({
function(e){
return expandMethods(e)[0] || [] }
: expandMethods)
.reduce(function(r, e){
return r.concat(e instanceof Array ? e : [e]) }, [])
.flat()
.map(function(e){
return indent + e })
: typeof(methods) == typeof('str') ?

View File

@ -223,8 +223,7 @@ var TagUIActions = actions.Actions({
gids = gids
.map(function(gid){
return gid == 'marked' ? that.marked : gid })
.reduce(function(res, cur){
return res.concat(cur instanceof Array ? cur : [cur]) }, [])
.flat()
.unique()
// XXX

View File

@ -1144,7 +1144,7 @@ var UIIntrospectionActions = actions.Actions({
.html('Handlers: '
+ (feature.handlers || [['-']])
.map(function(h){ return h[0] instanceof Array ? h[0] : [h[0]] })
.reduce(function(a, b){ return a.concat(b) }, [])
.flat()
.unique()
.map(function(n){
return n == '-' ? n : action2lnk(n) })