Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

index.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. var test = require('tape')
  2. var _JSON = require('../')
  3. function clone (o) {
  4. return JSON.parse(JSON.stringify(o))
  5. }
  6. var examples = {
  7. simple: { foo: [], bar: {}, baz: new Buffer('some binary data') },
  8. just_buffer: new Buffer('JUST A BUFFER'),
  9. all_types: {
  10. string:'hello',
  11. number: 3145,
  12. null: null,
  13. object: {},
  14. array: [],
  15. boolean: true,
  16. boolean2: false
  17. },
  18. foo: new Buffer('foo'),
  19. foo2: new Buffer('foo2'),
  20. escape: {
  21. buffer: new Buffer('x'),
  22. string: _JSON.stringify(new Buffer('x'))
  23. },
  24. escape2: {
  25. buffer: new Buffer('x'),
  26. string: ':base64:'+ new Buffer('x').toString('base64')
  27. },
  28. undefined: {
  29. empty: undefined, test: true
  30. },
  31. undefined2: {
  32. first: 1, empty: undefined, test: true
  33. },
  34. undefinedArray: {
  35. array: [undefined, 1, 'two']
  36. },
  37. fn: {
  38. fn: function () {}
  39. },
  40. undefined: undefined
  41. }
  42. for(k in examples)
  43. (function (value, k) {
  44. test(k, function (t) {
  45. var s = _JSON.stringify(value)
  46. console.log('parse', s)
  47. if(JSON.stringify(value) !== undefined) {
  48. console.log(s)
  49. var _value = _JSON.parse(s)
  50. t.deepEqual(clone(_value), clone(value))
  51. }
  52. else
  53. t.equal(s, undefined)
  54. t.end()
  55. })
  56. })(examples[k], k)