namespace Jint.Runtime.Modules;
public static class ModuleRequestExtensions
{
///
/// Returns true if the provided
/// is a json module, otherwise false.
///
///
/// The following JavaScript import statement imports a JSON module
/// for which this method would return true.
///
/// import value from 'config.json' with { type: 'json' }
///
///
public static bool IsJsonModule(this ModuleRequest request)
{
return request.Attributes != null
&& Array.Exists(request.Attributes, x => string.Equals(x.Key, "type", StringComparison.Ordinal) && string.Equals(x.Value, "json", StringComparison.Ordinal));
}
}