Skip to content

Using an array as custom transformations doesn't work as expected #124

Description

@atomrc

Hi guys,

Two problems:

  • it considers the array as an object and replace number with the value at the index of the array;
  • it mutates the array and starts adding properties to it.

Here is a test case:

var getSlug = require('speakingurl');
const custom = ['b'];

const slug = getSlug('0', { custom });
console.log(slug); // => 'b', '0' has been replaced with the custom char at index 0

console.log(custom); // => [ 'b', b: 'b' ] the array has been mutated and now have a `b` property

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions