private static IWhitespaceNode[] CreateWhitespaces([NotNull] this IEnumerable<string> wsTexts)
{
if (wsTexts == null)
{
throw new ArgumentNullException("wsTexts");
}
return wsTexts.Where(text => !text.IsEmpty()).Select(
text =>
{
if (text.IsNewLine())
{
return CreateNewLine("\r\n");
}
// consistency check (remove in release?)
if (!NTriplesLexer.IsWhitespace(text))
{
throw new ApplicationException("Inconsistent space structure");
}
return CreateSpace(text);
}).ToArray();
}