File: handlers.js

package info (click to toggle)
jsonpickle 3.0.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,184 kB
  • sloc: python: 6,088; javascript: 654; makefile: 90; sh: 17
file content (16 lines) | stat: -rw-r--r-- 513 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
define( function () { 
    // each can define -- flatten; restore; post_restore. Note that if the object has sub objects
    //   in restore, then they MUST be restored just to keep the object count valid. No skipping...
    var handlers = {
      'fractions.Fraction': {
          restore: function(obj) {
              return obj._numerator / obj._denominator;
          }
      },   
    };
    
    if (typeof jsonpickle != 'undefined') {
        jsonpickle.handlers = handlers;
    }
    return handlers;
});