@function __to-list($value) {
  $result: ();

  @if __is-map($value) {
    @if __list-some(map-keys($value), __is-string) {
      @return map-values($value);
    }

    @for $index from 1 through max(map-keys($value) ...) {
      $map-value: __get($value, $index);
      $result: append($result, $map-value);
    }

    @return $result;
  }

  @if __is-string($value) {
    @if str-length($value) >= 1 {
      @for $index from 1 through str-length($value) {
        $result: append($result, unquote(str-slice($value, $index, $index)));
      }
    }

    @return $result;
  }

  @if __is-list-like($value) {
    @each $item in $value {
      $result: append($result, $item);
    }
  }

  @return $result;
}

/// Converts `$value` to a list.
///
///
/// @access public
/// @group Lang
/// @param {*} $value The value to convert.
/// @returns {List} Returns the converted list.
/// @example scss
/// $map: ('a': 1, 'b': 2, 'c': 3);
///
/// $foo: _to-list($map);
/// // => 1, 2, 3

@function _to-list($args...) {
  @return call(get-function("__to-list"), $args...);
}
