Skip to content

quarterpast/obj-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

obj-map
Build Status

For mapping objects.

objMap({a: 1, b: 2}, function(k, v) {
	return k == 'b' ? v * 2 : v;
}); //⇒ {a: 1, b: 4}

objMap.async({a: 1, b: 2}, function(k, v, cb) {
	cb(null, k == 'b' ? v * 2 : v);
}, console.log); //⇒ {a: 1, b: 4}

api

objMap :: ∀ a,b. Object a → (a → b) → Object b

Takes an object and a transformation function and does what you expect.

objMap.async :: ∀ a,b. Object a → (a → (Error? → b → ())) → (Error? → Object b → ())

Takes an object and an asynchronous transformation function and does what you expect.

licence

MIT