File: main.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 (49 lines) | stat: -rw-r--r-- 1,427 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
 * jsonpickleJS -- interpretation of python jsonpickle in Javascript
 * main.js -- main loader -- this should be the only file that most users care about.
 * 
 * Copyright (c) 2014 Michael Scott Cuthbert and cuthbertLab
 */

if (typeof jsonpickle == 'undefined') {
    jsonpickle = {}; // global for now...
}

define(['./unpickler', './pickler', './util', './tags', './handlers'], 
        function(unpickler, pickler, util, tags, handlers) { 
    jsonpickle.pickler = pickler;
    jsonpickle.unpickler = unpickler;
    jsonpickle.util = util;
    jsonpickle.tags = tags;
    jsonpickle.handlers = handlers;

    jsonpickle.encode = function (value, unpicklable, make_refs,
            keys, max_depth, backend) {
        if (unpicklable === undefined) {
            unpicklable = true;
        }
        if (make_refs === undefined) {
            make_refs = true;
        }
        if (keys === undefined) {
            keys = false;
        }
        var options = {
            unpicklable: unpicklable,
            make_refs: make_refs,
            keys: keys,
            max_depth: max_depth,
            backend: backend,
        };
        return pickler.encode(value, options);
    };
    
    
    jsonpickle.decode = function (string, backend, keys) {
        if (keys === undefined) {
            keys = false;
        }
        return unpickler.decode(string, backend, keys);
    };
    return jsonpickle;
});