dumper.js 600 B

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. var yaml = require('../lib/js-yaml');
  3. var object = require('./dumper.json');
  4. console.log(yaml.dump(object, {
  5. flowLevel: 3,
  6. styles: {
  7. '!!int' : 'hexadecimal',
  8. '!!null' : 'camelcase'
  9. }
  10. }));
  11. // Output:
  12. //==============================================================================
  13. // name: Wizzard
  14. // level: 0x11
  15. // sanity: Null
  16. // inventory:
  17. // - name: Hat
  18. // features: [magic, pointed]
  19. // traits: {}
  20. // - name: Staff
  21. // features: []
  22. // traits: {damage: 0xA}
  23. // - name: Cloak
  24. // features: [old]
  25. // traits: {defence: 0x0, comfort: 0x3}