m-util
インストール - 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
Code |
Result |
---|---|
require('./m-util.js');
var hr = "_".uRepeat(20);
|
# node example.js |
ライセンス - License
MIT License
作者 - Author
- (C)Misaki Shibata misaki.pink@gmail.com