zowe / zowe-common-c

C Libraries for various OS & Networking needs
Eclipse Public License 2.0
10 stars 30 forks source link

Return null for no output #494

Closed Martin-Zeithaml closed 2 months ago

Martin-Zeithaml commented 2 months ago

Proposed changes

zos.dsinfo is returning null for empty string, object with empty array for invalid input and object with data for valid input. This is not a good practice. Return null when no data otherwise return object.

This PR addresses Issue: #493

Type of change

Please delete options that are not relevant.

PR Checklist

Please delete options that are not relevant.

Testing

Without fix, see #493

With fix

zos.dslist()=null
zos.dslist(null)=null
zos.dslist(undefined)=null
zos.dslist(0)=null
zos.dslist(apple,banana,orange)=null
zos.dslist(false)=null
zos.dslist(sys1.maclib)=null
zos.dslist(SYS1.PARMLIB)={"datasets":[{"dsn":"SYS1.PARMLIB","entryType":"A"}]}
zos.dslist(SYS1.MACLIB)={"datasets":[{"dsn":"SYS1.MACLIB","entryType":"A"}]}

Additional information

The zos.dslist(sys1.maclib)=null is questionable. Do we want to be so strict is javascript?