elearning/Frontend-Learner/node_modules/on-change/source/ignore-property.js
2026-01-13 10:48:02 +07:00

23 lines
560 B
JavaScript

import isSymbol from './is-symbol.js';
export default function ignoreProperty(cache, options, property) {
if (cache.isUnsubscribed) {
return true;
}
if (options.ignoreSymbols && isSymbol(property)) {
return true;
}
// Only strings can be prefixed with "_"
if (options.ignoreUnderscores && typeof property === 'string' && property.charAt(0) === '_') {
return true;
}
const keys = options.ignoreKeys;
if (keys) {
return Array.isArray(keys) ? keys.includes(property) : (keys instanceof Set ? keys.has(property) : false);
}
return false;
}