mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
31 lines
700 B
TypeScript
31 lines
700 B
TypeScript
import * as R from 'ramda';
|
|
import { TOTAL_NODE_TYPES } from './constants';
|
|
|
|
export const ProfitLossSheetBase = (Base) =>
|
|
class extends Base {
|
|
/**
|
|
*
|
|
* @param type
|
|
* @param node
|
|
* @returns
|
|
*/
|
|
public isNodeType = R.curry((type: string, node) => {
|
|
return node.nodeType === type;
|
|
});
|
|
|
|
protected isNodeTypeIn = R.curry((types: string[], node) => {
|
|
return types.indexOf(node.nodeType) !== -1;
|
|
});
|
|
|
|
/**
|
|
*
|
|
*/
|
|
protected findNodeById = R.curry((id, nodes) => {
|
|
return this.findNodeDeep(nodes, (node) => node.id === id);
|
|
});
|
|
|
|
isNodeTotal = (node) => {
|
|
return this.isNodeTypeIn(TOTAL_NODE_TYPES, node);
|
|
}
|
|
};
|