node.cjs 443 B

12345678910111213141516171819202122
  1. /* eslint-env node */
  2. "use strict";
  3. const { inspect } = require("util");
  4. /**
  5. * @example
  6. * ```
  7. * Float16Array.prototype[Symbol.for("nodejs.util.inspect.custom")] = customInspect;
  8. * ```
  9. */
  10. exports.customInspect = function customInspect(_deps, options) {
  11. const length = this.length;
  12. const array = [];
  13. for (let i = 0; i < length; ++i) {
  14. array[i] = this[i];
  15. }
  16. return `Float16Array(${length}) ${inspect(array, options)}`;
  17. };