Adapt authoring tool UI documentation

v1.0.0-rc.4

adapt-authoring-core/lib/Utils.js

  1. import minimist from 'minimist'
  2. /**
  3. * Miscellaneous utility functions for use throughout the application
  4. * @memberof core
  5. */
  6. class Utils {
  7. /**
  8. * The name of the file used for defining Adapt authoring tool metadata
  9. * @return {String}
  10. */
  11. static get metadataFileName () {
  12. return 'adapt-authoring.json'
  13. }
  14. /**
  15. * The name of the Node.js package file
  16. * @return {String}
  17. */
  18. static get packageFileName () {
  19. return 'package.json'
  20. }
  21. /**
  22. * Returns the passed arguments, parsed by minimist for easy access
  23. * @return {Object} The parsed arguments
  24. * @see {@link https://github.com/substack/minimist#readme}
  25. */
  26. static getArgs () {
  27. const args = minimist(process.argv)
  28. args.params = args._.slice(2)
  29. return args
  30. }
  31. /**
  32. * Determines if param is a Javascript object (note: returns false for arrays, functions and null)
  33. * @return {Boolean}
  34. */
  35. static isObject (o) {
  36. return typeof o === 'object' && o !== null && !Array.isArray(o)
  37. }
  38. }
  39. export default Utils