Nuclear Power Manager

    postapl-remove-empty

    1.1.0 • Public • Published

    PostAPL Remove Empty

    NPM Version

    PostAPL Remove Empty is a PostAPL plugin that looks for property values that are null, empty string, empty object, and empty array and removes them.

    Input

    {
      "type": "APL",
      "version": "1.7",
      "settings": {},
      "theme": "dark",
      "import": [],
      "resources": [],
      "styles": {},
      "onMount": [],
      "graphics": {},
      "commands": {},
      "layouts": {},
      "mainTemplate": {
        "parameters": [
          "payload"
        ],
        "items": [
          {
            "type": "Container",
            "width": "100vw",
            "height": "100vh",
            "data": [],
            "items": [
              {
                "type": "Frame",
                "backgroundColor": "white",
                "height": "100%",
                "width": "100%",
                "item": {}
              }
            ]
          }
        ]
      }
    }

    Output

    {
      "type": "APL",
      "version": "1.7",
      "theme": "dark",
      "mainTemplate": {
        "parameters": [
          "payload"
        ],
        "items": [
          {
            "type": "Container",
            "width": "100vw",
            "height": "100vh",
            "items": [
              {
                "type": "Frame",
                "backgroundColor": "white",
                "height": "100%",
                "width": "100%"
              }
            ]
          }
        ]
      }
    }

    Usage

    Step 1: Install plugin:

    npm install --save-dev postapl postapl-remove-empty

    Step 2: Use:

    'use strict'
    
    const { postapl } = require('postapl');
    const removeEmpty = require('postapl-remove-empty');
    const fs = require('fs');
    
    fs.readFile('src/screen.json', (err, apl) => {
      postapl([removeEmpty])
        .process(apl, { from: 'src/screen.json', to: 'dest/screen.json' })
        .then(result => {
          fs.writeFile(result.opts.to, result.apl, () => true)
        })
    });

    Options

    None

    Install

    npm i postapl-remove-empty

    DownloadsWeekly Downloads

    2

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    6.04 kB

    Total Files

    6

    Last publish

    Collaborators

    • rmtuckerphx