Core libraries and tools part for pro architecture. It's a submodule - use from this perspective http://git.maniak.pro/madmaniak/pro
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
989 B
35 lines
989 B
L.mixin compose: (base, layers...) ->
|
|
L.reduce L.uniq(L.flatten(L.map(layers, L.functions))), (object, method) ->
|
|
object[method] = L.pipe base, L.compact L.map( layers, method )
|
|
object
|
|
, base
|
|
|
|
# namespacer
|
|
L.mixin ns: (path, action) ->
|
|
rm_dots = path.split('../')
|
|
framework = if rm_dots.length == 4 then 'framework/' else ''
|
|
"#{framework}#{rm_dots[rm_dots.length - 1]}/#{action}"
|
|
|
|
L.mixin pipe: (context, methods) ->
|
|
->
|
|
result = arguments
|
|
L.each methods, (method) ->
|
|
if method.length
|
|
result = method.apply(context, result)
|
|
else
|
|
method.call(context)
|
|
result
|
|
|
|
L.mixin reference: (object) -> [object.type, object.id]
|
|
|
|
L.mixin stringify: (hash) ->
|
|
L.reduce(hash, (array, k,v) ->
|
|
array.push "#{k}#{v}"
|
|
array
|
|
, []).sort().join()
|
|
|
|
L.mixin tmp_id: (object) -> /tmp/.exec object.id
|
|
|
|
L.mixin wait_for_real_id: (objects, action) ->
|
|
!if object = L.find objects, L.tmp_id
|
|
Dispatcher.once "#{object.id}_to_id", action
|
|
|