Skip to content

Instantly share code, notes, and snippets.

@bendavies
Created February 20, 2014 22:06
Show Gist options
  • Save bendavies/2d3d9e3c7b5d0b925259 to your computer and use it in GitHub Desktop.
Save bendavies/2d3d9e3c7b5d0b925259 to your computer and use it in GitHub Desktop.
jmes bug
<?php
// data[?start_date == `2014-02`]|[0]
function jmespath_9326e1bbd5d5f072d89fb1f6b627aa45(JmesPath\Runtime\RuntimeInterface $runtime, $value)
{
$current = $value;
// Visiting projection node
$value = is_array($value) && isset($value['data']) ? $value['data'] : null;
if (!is_array($value)) {
$value = null;
} elseif ($value) {
$collected_530677dda6f6e = array();
foreach ($value as $key => $v530677dda6f58) {
$value = $v530677dda6f58;
// Visiting projection node
// Visiting comparator node
$val_530677dda7017 = $value;
$cur_530677dda7020 = $current;
$value = is_array($value) && isset($value['start_date']) ? $value['start_date'] : null;
$left_530677dda7026 = $value;
$value = $val_530677dda7017;
$value = '2014-02';
$right_530677dda702d = $value;
$result = $left_530677dda7026 === $right_530677dda702d;
$value = $result === true ? $val_530677dda7017 : null;
$current = $cur_530677dda7020;
if ($value !== null) {
// Visiting current node (no-op)
}
if ($value !== null) {
$collected_530677dda6f6e[] = $value;
}
}
$value = $collected_530677dda6f6e;
}
$current = $value;
$value = is_array($value) && isset($value[0]) ? $value[0] : null;
return $value;
}
<?php
// data[?start_date == `2014-02`]|[0]
function jmespath_9326e1bbd5d5f072d89fb1f6b627aa45(JmesPath\Runtime\RuntimeInterface $runtime, $value)
{
$current = $value;
// Visiting projection node
$value = is_array($value) && isset($value['data']) ? $value['data'] : null;
if (!is_array($value)) {
$value = null;
} elseif ($value) {
$collected_530677968631f = array();
foreach ($value as $key => $v53067796862a6) {
$value = $v53067796862a6;
// Visiting projection node
// Visiting comparator node
$val_53067796863cb = $value;
$cur_5306779686446 = $current;
$value = is_array($value) && isset($value['start_date']) ? $value['start_date'] : null;
$left_53067796864bd = $value;
$value = $val_53067796863cb;
$value = 2014;
$right_5306779686532 = $value;
$result = $left_53067796864bd === $right_5306779686532;
$value = $result === true ? $val_53067796863cb : null;
$current = $cur_5306779686446;
if ($value !== null) {
// Visiting current node (no-op)
}
if ($value !== null) {
$collected_530677968631f[] = $value;
}
}
$value = $collected_530677968631f;
}
$current = $value;
$value = is_array($value) && isset($value[0]) ? $value[0] : null;
return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment