# all files / keystone/lib/core/ list.js

88.89% Statements 8/9
75% Branches 6/8
100% Functions 1/1
100% Lines 8/8

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

    1×
    38×
    34×
    34×
    34×

    4×
    4×
    4×

     /**
     * Registers or retrieves a list
     */

    module.exports = function list (arg) {
    	if (arg && arg.constructor === this.List) {
    		this.lists[arg.key] = arg;
    		this.paths[arg.path] = arg.key;
    		return arg;
    	}
    	var result = this.lists[arg] || this.lists[this.paths[arg]];
    	Iif (!result) throw new ReferenceError('Unknown keystone list ' + JSON.stringify(arg));
    	return result;
    };