mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
refactored out manual flattening to .flat(..)
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9cb7bd589a
commit
6cd18e0eff
@ -847,7 +847,7 @@ var CollectionActions = actions.Actions({
|
|||||||
: [ that.data.getImage(gid)
|
: [ that.data.getImage(gid)
|
||||||
// check base data for image gid...
|
// check base data for image gid...
|
||||||
|| that.collections[MAIN_COLLECTION_TITLE].data.getImage(gid) ] })
|
|| that.collections[MAIN_COLLECTION_TITLE].data.getImage(gid) ] })
|
||||||
.reduce(function(a, b){ return a.concat(b) }, [])
|
.flat()
|
||||||
|
|
||||||
this.ensureCollection(collection)
|
this.ensureCollection(collection)
|
||||||
.then((function(c){
|
.then((function(c){
|
||||||
@ -1040,7 +1040,7 @@ var CollectionActions = actions.Actions({
|
|||||||
// when adding a ribbon gid expand to images...
|
// when adding a ribbon gid expand to images...
|
||||||
that.data.ribbons[gid].compact()
|
that.data.ribbons[gid].compact()
|
||||||
: [that.data.getImage(gid)] })
|
: [that.data.getImage(gid)] })
|
||||||
.reduce(function(a, b){ return a.concat(b) }, [])
|
.flat()
|
||||||
|
|
||||||
// remove from the loaded state...
|
// remove from the loaded state...
|
||||||
this.collection == collection
|
this.collection == collection
|
||||||
|
|||||||
@ -136,8 +136,7 @@ module.SortActions = actions.Actions({
|
|||||||
.filter(function(e){
|
.filter(function(e){
|
||||||
return e && e.trim() != '' && !/['"]/.test(e) })
|
return e && e.trim() != '' && !/['"]/.test(e) })
|
||||||
: [])
|
: [])
|
||||||
.reduce(function(r, e){
|
.flat() }
|
||||||
return r.concat(e instanceof Array ? e : [e]) }, []) }
|
|
||||||
var get = function(name){
|
var get = function(name){
|
||||||
// normalize name...
|
// normalize name...
|
||||||
name = name
|
name = name
|
||||||
@ -196,9 +195,7 @@ module.SortActions = actions.Actions({
|
|||||||
: a instanceof Array ?
|
: a instanceof Array ?
|
||||||
a
|
a
|
||||||
: method })
|
: method })
|
||||||
// merge...
|
.flat() }],
|
||||||
.reduce(function(r, e){
|
|
||||||
return r.concat(e instanceof Array ? e : [e]) }, []) }],
|
|
||||||
|
|
||||||
// Custom sort methods...
|
// Custom sort methods...
|
||||||
//
|
//
|
||||||
@ -783,8 +780,7 @@ var SortUIActions = actions.Actions({
|
|||||||
function(e){
|
function(e){
|
||||||
return expandMethods(e)[0] || [] }
|
return expandMethods(e)[0] || [] }
|
||||||
: expandMethods)
|
: expandMethods)
|
||||||
.reduce(function(r, e){
|
.flat()
|
||||||
return r.concat(e instanceof Array ? e : [e]) }, [])
|
|
||||||
.map(function(e){
|
.map(function(e){
|
||||||
return indent + e })
|
return indent + e })
|
||||||
: typeof(methods) == typeof('str') ?
|
: typeof(methods) == typeof('str') ?
|
||||||
|
|||||||
@ -223,8 +223,7 @@ var TagUIActions = actions.Actions({
|
|||||||
gids = gids
|
gids = gids
|
||||||
.map(function(gid){
|
.map(function(gid){
|
||||||
return gid == 'marked' ? that.marked : gid })
|
return gid == 'marked' ? that.marked : gid })
|
||||||
.reduce(function(res, cur){
|
.flat()
|
||||||
return res.concat(cur instanceof Array ? cur : [cur]) }, [])
|
|
||||||
.unique()
|
.unique()
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
|
|||||||
@ -1144,7 +1144,7 @@ var UIIntrospectionActions = actions.Actions({
|
|||||||
.html('Handlers: '
|
.html('Handlers: '
|
||||||
+ (feature.handlers || [['-']])
|
+ (feature.handlers || [['-']])
|
||||||
.map(function(h){ return h[0] instanceof Array ? h[0] : [h[0]] })
|
.map(function(h){ return h[0] instanceof Array ? h[0] : [h[0]] })
|
||||||
.reduce(function(a, b){ return a.concat(b) }, [])
|
.flat()
|
||||||
.unique()
|
.unique()
|
||||||
.map(function(n){
|
.map(function(n){
|
||||||
return n == '-' ? n : action2lnk(n) })
|
return n == '-' ? n : action2lnk(n) })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user