README.md

Varname case detector/converter

Samples

PHP

//require('/path/to/vendor/autoload.php');

use Jzucen\VarnameCase as JVC;

$jvc     = new JVC\Varname();
$varname = 'TestName';

var_dump($varname);
var_dump(decbin($jvc->detect($varname)));
var_dump($jvc->isCamelCase($varname));
var_dump($jvc->isCamelCaseUpper($varname));
var_dump($jvc->convert($varname, JVC\KEBAB_CASE_UPPER));
var_dump($jvc->convert($varname, 'SCREAMING_UNDERSCORE'));

JS

import {default as JVC} from '/path/to/varname-case.js';

const varname = 'testName';

console.log(JVC.detect(varname).toString(2));
console.log(JVC.isCamelCase(varname));
console.log(JVC.isCamelCaseUpper(varname));
console.log(JVC.convert(varname, JVC.KEBAB_CASE_UPPER));

…or…

import '/path/to/varname-extends.js';

const varname = 'TestName';

console.log(varname);
console.log(varname.jvcDetect().toString(2));
console.log(varname.jvcIsCamelCase());
console.log(varname.jvcIsCamelCaseUpper());
console.log(varname.jvcConvert('KEBAB-CASE-UPPER'));

Instead of constants like JVC.KEBAB_CASE_UPPER it is available to use string as format sample: “camelCase”, “something-like-that”, “SCREAMING_UNDERSCORE” and so on.

Описание

Varname case detector/converter for PHP/JS

Конвейеры
0 успешных
0 с ошибкой