API/api.medcify.app/node_modules/snyk/dist/elixirsrc/lib/common.ex

22 lines
448 B
Elixir
Raw Normal View History

2022-09-26 06:11:44 +00:00
defmodule Snyk.MixProject.Common do
def save_to_file(file_path, content) do
file = case File.open(file_path, [:write]) do
{:ok, file} -> file
{:error, error_msg} -> error(error_msg)
end
IO.binwrite(file, JSON.encode!(content))
end
def error(msg) do
Mix.shell().error(msg)
System.halt(1)
end
end
defimpl JSON.Encoder, for: Regex do
def encode(_), do: {:ok, "\"regex\""}
def typeof(_), do: :string
end