prefix static method

NDCheckRelative prefix({
  1. String separator = '.',
  2. bool trim = true,
})

Implementation

static NDCheckRelative prefix({
  String separator = '.',
  bool trim = true,
}) {
  return (NDKey lKey, NDKey rKey) {
    Iterable lIt = lKey.split(separator);
    final lLen = lIt.length;
    Iterable rIt = rKey.split(separator);
    final rLen = rIt.length;
    if (trim) {
      lIt = lIt.map((e) => e.trim());
      rIt = rIt.map((e) => e.trim());
    }
    return lLen >= rLen ? lIt.startsWith(rIt) : rIt.startsWith(lIt);
  };
}