Skip to content

Instantly share code, notes, and snippets.

@mrios
Created November 23, 2012 21:30
Show Gist options
  • Save mrios/4137392 to your computer and use it in GitHub Desktop.
Save mrios/4137392 to your computer and use it in GitHub Desktop.
Browser Portable test
steal(
'sigma/hal/store.js'
, 'sigma/hal/transformer.js'
).then(
function()
{
can.when(
can.ajax("/SGM/sigma/hal/mappings.json")
, can.ajax("/SGM/sigma/hal/transforms.json")
, Sigma.fixtures
.store
.get(
"hal/fixtures/instituciones-univ.csv"
)
, Sigma.fixtures
.store
.get(
"hal/fixtures/provincias.csv"
)
).then(
function(mapps, trans, iu, pr){
var mappings
= mapps[0]
, transforms
= trans[0]
var sources
= {}
, buffer
= []
, store
= {}
, store_filter
= function(what,by_key,by_id)
{
return _(buffer[what])
.filter(
function(item)
{
return item[by_key]==by_id
}
)
}
, store_find
= function(what,by_key,id_to_find)
{
return _(buffer[what])
.find(
function(item)
{
return item[by_key]==id_to_find
}
)
}
sources['provincias']
= pr[0]
sources['instituciones-univ']
= iu[0]
var fw
= can
var transformers
= _ns.Transform.doTransform(fw,store_find,store_filter,transforms)
console.log("sources",sources)
}
)
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment