UNPKG

hyperformula

Version:

HyperFormula is a JavaScript engine for efficient processing of spreadsheet-like data and formulas

48 lines 1.3 kB
/** * @license * Copyright (c) 2025 Handsoncode. All rights reserved. */ import { FunctionArgumentType, FunctionPlugin } from "./FunctionPlugin.mjs"; export class BitwiseLogicOperationsPlugin extends FunctionPlugin { bitand(ast, state) { return this.runFunction(ast.args, state, this.metadata('BITAND'), (left, right) => left & right); } bitor(ast, state) { return this.runFunction(ast.args, state, this.metadata('BITOR'), (left, right) => left | right); } bitxor(ast, state) { return this.runFunction(ast.args, state, this.metadata('BITXOR'), (left, right) => left ^ right); } } BitwiseLogicOperationsPlugin.implementedFunctions = { 'BITAND': { method: 'bitand', parameters: [{ argumentType: FunctionArgumentType.INTEGER, minValue: 0 }, { argumentType: FunctionArgumentType.INTEGER, minValue: 0 }] }, 'BITOR': { method: 'bitor', parameters: [{ argumentType: FunctionArgumentType.INTEGER, minValue: 0 }, { argumentType: FunctionArgumentType.INTEGER, minValue: 0 }] }, 'BITXOR': { method: 'bitxor', parameters: [{ argumentType: FunctionArgumentType.INTEGER, minValue: 0 }, { argumentType: FunctionArgumentType.INTEGER, minValue: 0 }] } };