0.0.11 • Published 9 years ago

m-util v0.0.11

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

m-util

npm total download npm version License

インストール - Install

$ npm i -S m-util

使い方 - Usage

Functions

    // ヒアドキュメント用
    String.prototype.uHereDoc = function() {…}
--
    // スラッシュ挿入
    String.prototype.uAddslashes = function(s) {…}
--
    // 文字列の繰り返し
    String.prototype.uRepeat = function(i) {…}
--
    // パスからファイル情報返す @return ['ファイル名','拡張子','拡張子抜きファイル名']
    String.prototype.uGetFileInfo = function() {…}
--
    // パスからファイル名を返す
    String.prototype.uGetFileNameExt = function() {…}
--
    // パスから拡張子を返す
    String.prototype.uGetFileExt = function() {…}
--
    // パスから拡張子抜きファイル名を返す
    String.prototype.uGetFileName = function() {…}
--
    // Math.floor(x)小数点以下指定
    Math.uFloor = function(x, scale) {…}
--
    // Math.ceil(x)小数点以下指定
    Math.uCeil = function(x, scale) {…}
--
    // Math.round(x)小数点以下指定
    Math.uRound = function(x, scale) {…}
--
    // 左空白詰め(右寄せ)
    uLpad = function(txt, pad) {…}
--
    // 右空白詰め(左寄せ)
    uRpad = function(txt, pad) {…}

NodeJS

// Here Documents var t = (function() {/ <script> $("").css("border", "3px solid red"); </script> */}).toString().uHereDoc(); console.log(t); console.log(hr);

var path = 'test.png'; console.log(path.uGetFileInfo()); console.log(path.uGetFileNameExt()); console.log(path.uGetFileExt()); console.log(path.uGetFileName()); console.log(path); console.log(hr);

var path2 = '/Users/mac/Documents/vhosts/m-util/index.js'; console.log(path2.uGetFileInfo()); console.log(path2.uGetFileNameExt()); console.log(path2.uGetFileExt()); console.log(path2.uGetFileName()); console.log(path2); console.log(hr);

console.log(Math.uFloor(124.456, 1)); console.log(Math.uCeil(124.456, 1)); console.log(Math.uRound(124.454, 1)); console.log(Math.uRound(124.455, 1)); console.log(hr);

console.log(Math.uFloor(232.456, 2)); console.log(Math.uCeil(232.456, 2)); console.log(Math.uRound(232.454, 2)); console.log(Math.uRound(232.455, 2)); console.log(hr);

console.log('' +uRpad("hoge") + ''); console.log('' +uLpad("hoge") + ''); console.log(hr);

console.log('' +uRpad("fuga", 10) + ''); console.log('' +uLpad("fuga", 10) + ''); console.log(hr);

console.log('' +escapeHtml('<>`"') + ''); console.log(hr);

</pre>

<script> $("*").css("border", "3px solid red"); </script>


'test.png', 'png', 'test' test.png png test test.png


'index.js', 'js', 'index' index.js js index /Users/mac/Documents/vhosts/m-util/index.js


124.4 124.5 124.5 124.5


232.45 232.46 232.45 232.46


hoge


fuga


<>`"


ライセンス - License

MIT License

作者 - Author

0.0.11

9 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago