Created
June 5, 2013 13:00
-
-
Save pagameba/5713679 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jslint node:true, sloppy: true, indent: 2, nomen: true, white: true */ | |
var util = require('util') | |
, response = require('cradle/lib/cradle/response') | |
, mockJSON = { | |
total_rows: 1, | |
offset: 0, | |
rows: [{ | |
id: 'some-id', | |
key: 'some-key', | |
value: { | |
_id: 'some-id', | |
_rev: 'some-rev', | |
live: true, | |
name: 'test', | |
owner: 'some-owner', | |
type: 'Environment', | |
version: 'dev' | |
} | |
}] | |
} | |
, resp = new response.Response(mockJSON, null) | |
; | |
console.log(util.inspect(resp, true, null, true)); | |
var a = resp.map(function (env) { | |
return { | |
id: env._id, | |
active: env.name === 'development', | |
name: env.name, | |
version: env.version, | |
live: env.live | |
}; | |
}); | |
console.log(util.inspect(a, true, null, true)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "array_test", | |
"version": "0.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": "", | |
"author": "", | |
"license": "BSD", | |
"dependencies": { | |
"cradle": "~0.6.6" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment