diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 585dc91..b6146e0 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: [pedroelhumano] +github: [wotanCode] patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username diff --git a/.gitignore b/.gitignore index 32b2f5a..2d20eec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,12 @@ +# Folders /node_modules /dist-browser /dist-node /dist /coverage + +# Files package-lock.json + +# OS Files +.DS_Store \ No newline at end of file diff --git a/.npmignore b/.npmignore index c9d7a47..3249a5e 100644 --- a/.npmignore +++ b/.npmignore @@ -13,5 +13,8 @@ eslint.config.mjs package-lock.json .prettierrc +# OS Files +.DS_Store + # Include !dist \ No newline at end of file diff --git a/README.md b/README.md index 93f798c..803dfb2 100644 --- a/README.md +++ b/README.md @@ -25,95 +25,99 @@ const { format, calculateDv, isValidRut, isFormat } = require('rutility'); import { format, calculateDv, isValidRut, isFormat } from 'rutility'; ``` -## Formatting Functions -`format.dot(rut: string): string` -Formats a RUT by adding dots. - -```javascript -console.log(format.dot('12345678')); // '12.345.678' -console.log(format.dot('12345678-K')); // '12.345.678-K' -``` - -`format.dash(rut: string): string` -Formats a RUT by adding a dash. - -```javascript -console.log(format.dash('123456780')); // '12345678-0' -console.log(format.dash('12.345.6780')); // '12.345.678-0' -console.log(format.dash('12')); // '1-2' -``` - -`format.dotDash(rut: string): string` -Formats a RUT by adding dots and a dash. - -```javascript -console.log(format.dotDash('123456780')); // '12.345.678-0' -console.log(format.dotDash('12345678-K')); // '12.345.678-K' -``` - -`format.notDot(rut: string): string` -Removes dots from a RUT. - -```javascript -console.log(format.notDot('12.345.678-0')); // '12345678-0' -console.log(format.notDot('12.345.678')); // '12345678' -``` - -`format.notDash(rut: string): string` -Removes the dash and check digit from a RUT. - -```javascript -console.log(format.notDash('12.345.678-0')); // '12.345.678' -console.log(format.notDash('12345678-0')); // '12345678' -``` - -`format.notDotDash(rut: string): string` -Removes dots and the dash from a RUT. - -```javascript -console.log(format.notDotDash('12.345.678-9')); // '12345678' -console.log(format.notDotDash('12.345.678')); // '12345678' -``` - -## Validation Functions -`calculateDv(rut: string | number): string` -Calculates the check digit of a Chilean RUT. - -```javascript -console.log(calculateDv('12.345.678')); // '5' -console.log(calculateDv('12345678')); // '5' -console.log(calculateDv(12345678)); // '5' -``` - -`isValidRut(rut: string): boolean` -Validates if a Chilean RUT is valid. - -```javascript -console.log(isValidRut('12.345.678-5')); // true -console.log(isValidRut('12345678-5')); // true -``` +### Formatting Functions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionDescriptionExample
format.dot(rut: string): stringFormats a RUT by adding dots.console.log(format.dot('12345678')); // '12.345.678'
format.dash(rut: string): stringFormats a RUT by adding a dash.console.log(format.dash('123456780')); // '12345678-0'
format.dotDash(rut: string): stringFormats a RUT by adding dots and a dash.console.log(format.dotDash('123456780')); // '12.345.678-0'
format.notDot(rut: string): stringRemoves dots from a RUT.console.log(format.notDot('12.345.678-0')); // '12345678-0'
format.notDash(rut: string): stringRemoves the dash and check digit from a RUT.console.log(format.notDash('12.345.678-0')); // '12.345.678'
format.notDotDash(rut: string): stringRemoves dots and the dash from a RUT.console.log(format.notDotDash('12.345.678-9')); // '12345678'
+ +### Validation Functions + + + + + + + + + + + + + + + + + + + + +
FunctionDescriptionExample
calculateDv(rut: string | number): stringCalculates the check digit of a Chilean RUT.console.log(calculateDv('12.345.678')); // '5'
isValidRut(rut: string): booleanValidates if a Chilean RUT is valid.console.log(isValidRut('12.345.678-5')); // true
### Format Validations -`isFormat.dot(rut: string): boolean` -Checks if a RUT has the correct format with dots. - -``` javascript -console.log(isFormat.dot('12.345.678')); // true -``` - -isFormat.dash(rut: string): boolean -Checks if a RUT has the correct format with a dash. - -``` javascript -console.log(isFormat.dash('12345678-9')); // true -``` - -`isFormat.dotDash(rut: string): boolean` -Checks if a RUT has the correct format with dots and a dash. - -```javascript -console.log(isFormat.dotDash('12.345.678-9')); // true -``` + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionDescriptionExample
isFormat.dot(rut: string): booleanChecks if a RUT has the correct format with dots.console.log(isFormat.dot('12.345.678')); // true
isFormat.dash(rut: string): booleanChecks if a RUT has the correct format with a dash.console.log(isFormat.dash('12345678-9')); // true
isFormat.dotDash(rut: string): booleanChecks if a RUT has the correct format with dots and a dash.console.log(isFormat.dotDash('12.345.678-9')); // true
## Contributing If you wish to contribute to this project, please open an issue or submit a pull request. diff --git a/changelog.md b/changelog.md index 20a2279..8879d67 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +### 1.0.17 Better documentation +- Add `public-npm` script in `package.json`. +- Update `.gitignore` and `npmignore`. +- Update `FUNDING.yml`. +- Update `README.md`. + ### 1.0.16 Fix build compilation ### 1.0.15 Update Repository and readme diff --git a/package.json b/package.json index c36dcac..31f0b60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rutility", - "version": "1.0.16", + "version": "1.0.17", "main": "dist/index.js", "browser": "dist/index.js", "module": "dist/index.js", @@ -10,9 +10,12 @@ "test:coverage": "npx jest --coverage --collectCoverageFrom='src/**/*.ts'", "test:lint": "eslint --fix", "test": "npm run test:unit & npm run test:coverage & npm run test:lint & npm run prettier-format", - "build": "tsc --project tsconfig.json" + "build": "npm run test && tsc --project tsconfig.json", + "public-npm": "npm run build && npm publish --access public" }, - "files": ["dist"], + "files": [ + "dist" + ], "exports": { ".": { "import": "./dist/index.js", @@ -55,4 +58,4 @@ "typescript-eslint": "^7.17.0", "undici-types": "^6.19.4" } -} +} \ No newline at end of file