node.mjs 405 B

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