parseValue<T> method

T parseValue <T>(T toParse)

toParse = Declaration | List

Implementation

T parseValue<T>(T toParse) {
  if (toParse is Declaration) {
    return transformDeclaration(toParse) as T;
  }

  if (toParse is List<Declaration>) {
    final List<Declaration> nodes = <Declaration>[];
    toParse.forEach((Declaration n) {
      nodes.add(transformDeclaration(n));
    });
    return nodes as T;
  }

  return null;

//3.0.0 20160718
// Ruleset.prototype.parseValue = function(toParse) {
//     var self = this;
//     if (!Array.isArray(toParse)) {
//         return transformDeclaration.call(self, toParse);
//     }
//     else {
//         var nodes = [];
//         toParse.forEach(function(n) {
//             nodes.push(transformDeclaration.call(self, n));
//         });
//         return nodes;
//     }
// };
}