hyperformula
Version:
HyperFormula is a JavaScript engine for efficient processing of spreadsheet-like data and formulas
32 lines • 815 B
JavaScript
/**
* @license
* Copyright (c) 2025 Handsoncode. All rights reserved.
*/
import { EmptyValue } from "../InterpreterValue.mjs";
import { FunctionArgumentType, FunctionPlugin } from "./FunctionPlugin.mjs";
/**
* Interpreter plugin containing MEDIAN function
*/
export class CountBlankPlugin extends FunctionPlugin {
countblank(ast, state) {
return this.runFunction(ast.args, state, this.metadata('COUNTBLANK'), (...args) => {
let counter = 0;
args.forEach(arg => {
if (arg === EmptyValue) {
counter++;
}
});
return counter;
});
}
}
CountBlankPlugin.implementedFunctions = {
'COUNTBLANK': {
method: 'countblank',
parameters: [{
argumentType: FunctionArgumentType.SCALAR
}],
repeatLastArgs: 1,
expandRanges: true
}
};