Skip to content

Conversation

Haroenv
Copy link
Collaborator

@Haroenv Haroenv commented Mar 28, 2017

fixes #33

formatPkg.js Outdated
}

const dependencies = cleaned.dependencies || {};
const charsToSplit = /[-/@_.]+/;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added . to split on here too

formatPkg.js Outdated
name: cleaned.name,
numberOfWordsInName: cleaned.name.split(/[-/@_]+/).length,
concatenatedName,
numberOfWordsInName: cleaned.name.split(charsToSplit).length,
Copy link

@iam4x iam4x Mar 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'r-a-b-c'.split(/[-/@_.]+/g)
-> (4) ["r", "a", "b", "c"]

So you can directly do, instead of calling a new RegExp() constructor 👍

const charsToSplit = /[-/@_.]+/g;
const concatenatedName = cleaned.name.replace(charsToSplit, '');

[..]

numberOfWordsInName: cleaned.name.split(charsToSplit).length

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@Haroenv Haroenv force-pushed the feat/add-concatenated-name branch from e40b71c to 72ab12e Compare March 28, 2017 13:08
@Haroenv
Copy link
Collaborator Author

Haroenv commented Mar 28, 2017

I removed numberOfWordsInName because it's not useful anymore when the concatenated name strategy is used.

@Haroenv Haroenv requested a review from vvo March 28, 2017 13:22
@Haroenv Haroenv merged commit d0ebb97 into master Mar 28, 2017
@Haroenv Haroenv deleted the feat/add-concatenated-name branch March 28, 2017 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add alternative name without dashes
2 participants