Sha256: a0931597590e64e4a861403bf81a02cd15e7a56cf4431dbb69d522b8c122c273

Contents?: true

Size: 868 Bytes

Versions: 6

Compression:

Stored size: 868 Bytes

Contents

const AbstractHandler = require("./AbstractHandler")

class GetGlobalStaticFieldHandler extends AbstractHandler {
    constructor() {
        super()
    }

    requiredParametersCount = 1

    process(command) {
        try {
            if (command.payload.length < this.requiredParametersCount) {
                throw new Error("Get global static field parameters mismatch")
            }
            const {payload} = command
            const splitted = payload[0].split(".")
            let fieldToGet

            for (let i = 0; i < splitted.length; i++) {
                fieldToGet = !fieldToGet ? global[splitted[i]] : fieldToGet[splitted[i]]
            }
            return fieldToGet

        } catch (error) {
            throw this.process_stack_trace(error, this.constructor.name)
        }
    }
}

module.exports = new GetGlobalStaticFieldHandler()

Version data entries

6 entries across 3 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.1.10 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/GetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.10 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/GetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.9 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/GetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.9 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/GetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.8 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/GetGlobalStaticFieldHandler.js
javonet-ruby-sdk-2.1.8 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/GetGlobalStaticFieldHandler.js