all files / keystone/lib/list/ isReserved.js

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4
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                                            104×      
/**
 * Check whether or not a `path` is a reserved path. This restricts the use
 * of `Object.prototype` method keys as well as internal mongo paths.
 */
 
var reservedPaths = [
	'id',
	'_id',
	'_',
	'prototype',
	'__proto__',
	'hasOwnProperty',
	'toString',
	'__defineGetter__',
	'__defineSetter__',
	'__lookupGetter__',
	'__lookupSetter__',
	'isPrototypeOf',
	'propertyIsEnumerable',
	'toLocaleString',
	'valueOf',
];
 
function isReserved (path) {
	return reservedPaths.indexOf(path) >= 0;
}
 
module.exports = isReserved;