0.0.5 • Published 4 months ago

@wasm-fmt/zig_fmt v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Test npm

Install

npm install @wasm-fmt/zig_fmt

Usage

import init, { format } from "@wasm-fmt/zig_fmt";

await init();

const input = `
const std = @import("std");

pub fn main() !void 
{
  const stdout = std.io.getStdOut().writer();
  var i: usize = 1;
  while (i <= 16) : (i += 1) 
    {
        if (i % 15 == 0) 
      {
        try stdout.writeAll("ZiggZagg\\n");
      } else 
        if (i % 3 == 0) 
      {
        try stdout.writeAll("Zigg\\n");
      } else 
        if (i % 5 == 0) 
      {
        try stdout.writeAll("Zagg\\n");
      }
        else 
      {
        try stdout.print("{d}\\n", .{i});
      }
    }
}
`;

const formatted = format(input);
console.log(formatted);

For Vite users:

import init, { format } from "@wasm-fmt/zig_fmt/vite";

// ...
0.0.5

4 months ago

0.0.4

4 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

9 months ago