Feature request: `toSnakeCase / underscored `
vorillaz opened this issue · comments
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 Can I work on this?
@bgopikrishna Sure thing.
I'm getting an error
lerna: command not found
@bgopikrishna Have you tried using yarn install
?
@bgopikrishna Have you tried using
yarn install
?
I already did it. Somehow restarting PC solved it.
How to generate the dist
folder for the new package?
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.
@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