Urara-Blog/node_modules/.pnpm-store/v3/files/ec/9a02de8379dc43e57ace9276a603d4b787ea2fa3fd3c6b473bc405110286bee7b106946da119ce6dc1f90db9cd276730539a25735d529f7d5ef27fc0bb9e79
2022-08-14 01:14:53 +08:00

22 lines
No EOL
1.4 KiB
Text

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNotTokenOfTypeWithConditions = exports.isTokenOfTypeWithConditions = exports.isNodeOfTypeWithConditions = exports.isNodeOfTypes = exports.isNodeOfType = void 0;
const isNodeOfType = (nodeType) => (node) => (node === null || node === void 0 ? void 0 : node.type) === nodeType;
exports.isNodeOfType = isNodeOfType;
const isNodeOfTypes = (nodeTypes) => (node) => !!node && nodeTypes.includes(node.type);
exports.isNodeOfTypes = isNodeOfTypes;
const isNodeOfTypeWithConditions = (nodeType, conditions) => {
const entries = Object.entries(conditions);
return (node) => (node === null || node === void 0 ? void 0 : node.type) === nodeType &&
entries.every(([key, value]) => node[key] === value);
};
exports.isNodeOfTypeWithConditions = isNodeOfTypeWithConditions;
const isTokenOfTypeWithConditions = (tokenType, conditions) => {
const entries = Object.entries(conditions);
return (token) => (token === null || token === void 0 ? void 0 : token.type) === tokenType &&
entries.every(([key, value]) => token[key] === value);
};
exports.isTokenOfTypeWithConditions = isTokenOfTypeWithConditions;
const isNotTokenOfTypeWithConditions = (tokenType, conditions) => (token) => !(0, exports.isTokenOfTypeWithConditions)(tokenType, conditions)(token);
exports.isNotTokenOfTypeWithConditions = isNotTokenOfTypeWithConditions;
//# sourceMappingURL=helpers.js.map