Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$map skipping every other element #427

Closed
jp5525 opened this issue Mar 19, 2020 · 1 comment · Fixed by #428
Closed

$map skipping every other element #427

jp5525 opened this issue Mar 19, 2020 · 1 comment · Fixed by #428
Labels

Comments

@jp5525
Copy link

jp5525 commented Mar 19, 2020

Hello,

I have these 2 transforms that i would expect to be equivalent but they produce different results. Im using this context.

[
  "Felicia Saunders",
  "Jimmy Schultz",
  "Dolores Figueroa",
  "Craig Moreno",
  "Lindsey Hall",
  "Bonnie Russell",
  "Kristin Stewart",
  "Owen Reid",
  "Brenda Sherman",
  "Dwayne Baldwin"
]

The first transform is the one that seems to be buggy.
$map($, $match(?, /^(\w*\s\w*)/))
Results

[
  [
    {
      "match": "Felicia Saunders",
      "index": 0,
      "groups": [
        "Felicia Saunders"
      ]
    }
  ],
  [],
  [
    {
      "match": "Dolores Figueroa",
      "index": 0,
      "groups": [
        "Dolores Figueroa"
      ]
    }
  ],
  [],
  [
    {
      "match": "Lindsey Hall",
      "index": 0,
      "groups": [
        "Lindsey Hall"
      ]
    }
  ],
  [],
  [
    {
      "match": "Kristin Stewart",
      "index": 0,
      "groups": [
        "Kristin Stewart"
      ]
    }
  ],
  [],
  [
    {
      "match": "Brenda Sherman",
      "index": 0,
      "groups": [
        "Brenda Sherman"
      ]
    }
  ],
  []
]

This produces what i would expect
$map($, function($i){ $match($i, /^(\w*\s\w*)/) })
Results

[
  [
    {
      "match": "Felicia Saunders",
      "index": 0,
      "groups": [
        "Felicia Saunders"
      ]
    }
  ],
  [
    {
      "match": "Jimmy Schultz",
      "index": 0,
      "groups": [
        "Jimmy Schultz"
      ]
    }
  ],
  [
    {
      "match": "Dolores Figueroa",
      "index": 0,
      "groups": [
        "Dolores Figueroa"
      ]
    }
  ],
  [
    {
      "match": "Craig Moreno",
      "index": 0,
      "groups": [
        "Craig Moreno"
      ]
    }
  ],
  [
    {
      "match": "Lindsey Hall",
      "index": 0,
      "groups": [
        "Lindsey Hall"
      ]
    }
  ],
  [
    {
      "match": "Bonnie Russell",
      "index": 0,
      "groups": [
        "Bonnie Russell"
      ]
    }
  ],
  [
    {
      "match": "Kristin Stewart",
      "index": 0,
      "groups": [
        "Kristin Stewart"
      ]
    }
  ],
  [
    {
      "match": "Owen Reid",
      "index": 0,
      "groups": [
        "Owen Reid"
      ]
    }
  ],
  [
    {
      "match": "Brenda Sherman",
      "index": 0,
      "groups": [
        "Brenda Sherman"
      ]
    }
  ],
  [
    {
      "match": "Dwayne Baldwin",
      "index": 0,
      "groups": [
        "Dwayne Baldwin"
      ]
    }
  ]
]

Does this seem like a bug or is there something im missing?

Thanks

@andrew-coleman
Copy link
Member

It's a bug - thanks for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants