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

Feature request: toSnakeCase / underscored #15

Closed
vorillaz opened this issue Oct 20, 2019 · 8 comments
Closed

Feature request: toSnakeCase / underscored #15

vorillaz opened this issue Oct 20, 2019 · 8 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@vorillaz
Copy link
Contributor

Converts the input text to snake case.

Example usage

import toSnakeCase from '@plexis/to-snake-case';

toSnakeCase('Cool');
// => 'cool'

toSnakeCase('cool mate');
// => 'cool_mate'

toSnakeCase('Hey how are you today?');
// => 'hey_how_are_you_today'

toSnakeCase('PascalCase');
// => 'pascal_case'

toSnakeCase('kebab-case');
// => kebab_case

Aliases

import toSnakeCase from '@plexis/to-snake-case';
import {toSnakeCase, underscored} from 'plexis';
@vorillaz vorillaz added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Oct 20, 2019
@bgopikrishna
Copy link
Contributor

@vorillaz Can I work on this?

@vorillaz
Copy link
Contributor Author

@bgopikrishna Sure thing.

@bgopikrishna
Copy link
Contributor

I'm getting an error
lerna: command not found

@vorillaz
Copy link
Contributor Author

@bgopikrishna Have you tried using yarn install?

@bgopikrishna
Copy link
Contributor

@bgopikrishna Have you tried using yarn install?

I already did it. Somehow restarting PC solved it.

@bgopikrishna
Copy link
Contributor

How to generate the dist folder for the new package?

@bgopikrishna
Copy link
Contributor

When I tried to run yarn test -u, I'm getting this error

gk@Shallan:~/Workspace/opensource/plexis(master)$ yarn test -u
yarn run v1.19.1                                                                                                                                                          
$ jest -u                                                                                                                                                                 
 PASS  packages/toPred/test/index.js
 PASS  packages/withoutDiacritics/test/index.js
 PASS  packages/compose/test/index.js
 PASS  packages/toTitle/test/index.js
 PASS  packages/toSucc/test/index.js
 PASS  packages/toChicago/test/index.js
 PASS  packages/isLowerCase/test/index.js
 PASS  packages/toSnakeCase/test/index.js
 PASS  packages/toLower/test/index.js
 PASS  packages/isUpperCase️/test/index.js
 FAIL  packages/plexis/test/index.js
  ● Test suite failed to run

    Cannot find module '@plexis/to-snake-case' from 'index.js'

    However, Jest was able to find:
    	'../src/index.js'

    You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].

    See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

      21 |   default as toChicagoTitle
      22 | } from '@plexis/to-chicago';
    > 23 | export {
         | ^
      24 |   default as toSnakeCase,
      25 |   default as snakeCase
      26 | } from '@plexis/to-snake-case';

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:259:17)
      at Object.<anonymous> (packages/plexis/src/index.js:23:1)

Test Suites: 1 failed, 10 passed, 11 total
Tests:       32 passed, 32 total
Snapshots:   0 total
Time:        1.522s
Ran all test suites.
error Command failed with exit code 1.                                                                                                                                    
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.                                                                                      

@vorillaz
Copy link
Contributor Author

@bgopikrishna You don't have to generate the dist folder, that's the bundle folder generated by babel.
You also need to use yarn bootstrap in order to link your packages, especially a new one like yours. You can find more infos at the docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants