Sha256: 098c6bf4f33cfec16d1b2abcf597fa9c2d8aa20a46813cc61a2a702eeb4b0f36
Contents?: true
Size: 751 Bytes
Versions: 2
Compression:
Stored size: 751 Bytes
Contents
const AbstractHandler = require('./AbstractHandler') class ArrayGetRankHandler extends AbstractHandler { requiredParametersCount = 1 constructor() { super() } process(command) { try { if (command.payload.length < this.requiredParametersCount) { throw new Error('Array Get Rank parameters mismatch') } let array = command.payload[0] let rank = 0 while (Array.isArray(array)) { rank = rank + 1 array = array[0] } return rank } catch (error) { throw this.process_stack_trace(error, this.constructor.name) } } } module.exports = new ArrayGetRankHandler()
Version data entries
2 entries across 2 versions & 1 rubygems