@huz-com/slugify
v1.0.3
Published
Slugifies text, array and map
Downloads
4
Maintainers
Readme
Huz.Com > Component > Slugify
Slugifies text, text array and text map
Standards
- Language:
TS
- Eslint:
Yes
- Static Code Analysis:
Yes
IntelliJ Code Inspections - DDD - Document Driven:
Yes
- EDD - Exception Driven:
Yes
- TDD - Test Driven:
Yes
go to test folder - Standards Complied: Huz Standards
Commands
npm run clear
// clears "dist" foldernpm run lint
// runs eslint for static code analysisnpm run test
// runs test files in "test" foldernpm run build
// builds JS files at "dist" foldernpm publish
ornpm run publix
// publishes "dist" folder to npm
Install
npm i @huz-com/slugify
Sample
const {slugify} = require('@huz-com/slugify');
// to build slug, code etc
slugify.dashText('Hello world!'); // =>> 'hello-world'
slugify.dashText('Hello /? world!'); // =>> 'hello-world'
slugify.dashText('!Hello world!'); // =>> 'hello-world'
slugify.dashArray(["€1000","İSTANBUL/TÜRKİYE"]); // =>> '["euro-1000","istanbul-turkiye"]
slugify.dashMap({price: '€1000', place: 'İSTANBUL/TÜRKİYE'}); // =>> '{price: "euro-1000", place: "istanbul-turkiye"}
//dashAny discover input and responses according to type (union of dashText, dashArray, dashMap)
slugify.dashAny('Hello world!'); // =>> 'hello-world'
slugify.dashAny(["€1000","İSTANBUL/TÜRKİYE"]); // =>> '["euro-1000","istanbul-turkiye"]
slugify.dashAny({price: '€1000', place: 'İSTANBUL/TÜRKİYE'}); // =>> '{price: "euro-1000", place: "istanbul-turkiye"}
// to build raw, plain etc
slugify.plainText('Hello world!'); // =>> ''helloworld'
slugify.plainText('Hello /? world!'); // =>> ''helloworld'
slugify.plainText('!Hello world!'); // =>> ''helloworld'
slugify.plainArray(["€1000","İSTANBUL/TÜRKİYE"]); // =>> '["euro1000","istanbulturkiye"]
slugify.plainMap({price: '€1000', place: 'İSTANBUL/TÜRKİYE'}); // =>> '{price: "euro1000", place: "istanbulturkiye"}
//plainAny discover input and responses according to type (union of plainText, plainArray, plainMap)
slugify.plainAny('Hello world!'); // =>> ''helloworld'
slugify.plainAny({price: '€1000', place: 'İSTANBUL/TÜRKİYE'}); // =>> '{price: "euro1000", place: "istanbulturkiye"}
slugify.plainAny({price: '€1000', place: 'İSTANBUL/TÜRKİYE'}); // =>> '{price: "euro1000", place: "istanbulturkiye"}
// to build sql like
slugify.keywordText('Hello world!'); // =>> ''hello%world'
slugify.keywordText('Hello /? world!'); // =>> ''hello%world'
slugify.keywordText('!Hello world!'); // =>> ''hello%world'
slugify.keywordArray(["€1000","İSTANBUL/TÜRKİYE"]); // =>> '["euro%1000","istanbul%turkiye"]
slugify.keywordMap({price: '€1000', place: 'İSTANBUL/TÜRKİYE'}); // =>> '{price: "euro%1000", place: "istanbul%turkiye"}
//keywordAny discover input and responses according to type (union of keywordText, keywordArray, keywordMap)
slugify.keywordAny('Hello world!'); // =>> ''hello%world'
slugify.keywordAny({price: '€1000', place: 'İSTANBUL/TÜRKİYE'}); // =>> '{price: "euro%1000", place: "istanbul%turkiye"}
slugify.keywordAny({price: '€1000', place: 'İSTANBUL/TÜRKİYE'}); // =>> '{price: "euro%1000", place: "istanbul%turkiye"}