<commit_before>// Map Functions
// =============


// Truncate List
// -------------
// Return a list, truncated to a given length
@function _truncate-list(
  $list,
  $length
) {
  $_return: ();

  @for $i from 1 through length($list) {
    $_return: if($i <= $length, append($_return, nth($list, $i)), $_return);
  }

  @return $_return;
}


// Deep Get
// --------
// Return a value deep in nested maps
@function deep-get(
  $map,
  $keys...
) {
  $_return: $map;

  @each $key in $keys {
    @if type-of($_return) == map {
      $_return: map-get($_return, $key);
    }
  }

  @return $_return;
}


// Deep Set
// --------
// Set a value deep in nested maps
@function deep-set(
  $map,
  $keys-value...
) {
  $_value: nth($keys-value, -1);
  $_keys: _truncate-list($keys-value, length($keys-value) - 1);
  $_length: length($_keys);
  $_return: ();

  @for $i from 1 through $_length {
    $_n: 0 - $i;
    $_level: _truncate-list($_keys, $_length + $_n);
    $_level: deep-get($map, $_level...);
    $_merge: (nth($_keys, $_n): $_value);
    $_return: if($_level, map-merge($_level, $_merge), $_merge);
    $_value: $_return;
  }

  @return $_return;
}


// Deep Has-Key
// ------------
// Return true if a deep key exists
@function deep-has-key(
  $map,
  $keys...
) {
  $_return: null;
  $_stop: false;

  @each $key in $keys {
    @if not $_stop {
      $_return: map-has-key($map, $key);
    }

    @if $_return {
      $map: map-get($map, $key);
    } @else {
      $_stop: true;
    }
  }

  @return $_return;
}


// Render
// ------
@mixin render(
  $css
) {
  @each $key, $value in $css {
    @if type-of($value) == map {
      #{$key} {
        @include render($value);<commit_msg>Added deep-merge from Su to Accoutrement-maps<commit_after>// Map Functions
// =============


// Truncate List
// -------------
// Return a list, truncated to a given length
@function _truncate-list(
  $list,
  $length
) {
  $_return: ();

  @for $i from 1 through length($list) {
    $_return: if($i <= $length, append($_return, nth($list, $i)), $_return);
  }

  @return $_return;
}


// Deep Get
// --------
// Return a value deep in nested maps
@function deep-get(
  $map,
  $keys...
) {
  $_return: $map;

  @each $key in $keys {
    @if type-of($_return) == map {
      $_return: map-get($_return, $key);
    }
  }

  @return $_return;
}


// Deep Set
// --------
// Set a value deep in nested maps
@function deep-set(
  $map,
  $keys-value...
) {
  $_value: nth($keys-value, -1);
  $_keys: _truncate-list($keys-value, length($keys-value) - 1);
  $_length: length($_keys);
  $_return: ();

  @for $i from 1 through $_length {
    $_n: 0 - $i;
    $_level: _truncate-list($_keys, $_length + $_n);
    $_level: deep-get($map, $_level...);
    $_merge: (nth($_keys, $_n): $_value);
    $_return: if($_level, map-merge($_level, $_merge), $_merge);
    $_value: $_return;
  }

  @return $_return;
}


// Deep Has-Key
// ------------
// Return true if a deep key exists
@function deep-has-key(
  $map,
  $keys...
) {
  $_return: null;
  $_stop: false;

  @each $key in $keys {
    @if not $_stop {
      $_return: map-has-key($map, $key);
    }

    @if $_return {
      $map: map-get($map, $key);
    } @else {
      $_stop: true;
    }
  }

  @return $_return;
}


// Deep Merge
// ----------
// Return 2 objects of any depth, merged
@function deep-merge(
  $map1,
  $map2
) {

  @if type-of($map1) != map or type-of($map2) != map {
    $map1: $map2;
  } @else {
    @each $key, $value in $map2 {
      $_new: ($key: _susy_deep-merge(map-get($map1, $key), $value));
      $map1: map-merge($map1, $_new);
    }
  }

  @return $map1;
}


// Render
// ------
@mixin render(
  $css
) {
  @each $key, $value in $css {
    @if type-of($value) == map {
      #{$key} {
        @include render($value);
{'fraction_non_alphanumeric': 0.2271168557108942, 'fraction_numerical': 0.005803218148245845, 'mean_word_length': 2.285961871750433, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2681671', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1411, 'n_words': 369}