Comparing version 0.0.4 to 0.0.5
@@ -18,2 +18,5 @@ /* ================================================================ | ||
//static | ||
var EMPTY = ''; | ||
function _touch(){ | ||
@@ -31,8 +34,37 @@ | ||
function _chmod(p, mode){ | ||
fs.chmodSync(p, mode); | ||
} | ||
function _readFile(p, encoding) { | ||
return fs.readFileSync(p, encoding); | ||
} | ||
function _writeFile(p, data){ | ||
if(p === EMPTY) return false; | ||
fs.writeFileSync(p, data); | ||
} | ||
function _isExistedFile(p){ | ||
if(p === EMPTY) return false; | ||
return fs.existsSync(p) && fs.statSync(p).isFile(); | ||
} | ||
function _isExistedDir(p){ | ||
if(p === EMPTY) return false; | ||
return fs.existsSync(p) && fs.statSync(p).isDirectory(); | ||
} | ||
var File = { | ||
touch: _touch, | ||
rm: _rm, | ||
mkdir :_mkdir | ||
mkdir :_mkdir, | ||
chmod: _chmod, | ||
isExistedFile: _isExistedFile, | ||
isExistedDir: _isExistedDir, | ||
readFile: _readFile, | ||
writeFile: _writeFile | ||
}; | ||
module.exports = File; | ||
@@ -16,5 +16,2 @@ /* ================================================================ | ||
function _trim(){ | ||
} | ||
/** | ||
@@ -32,4 +29,8 @@ * escape | ||
function _trim(str){ | ||
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); | ||
} | ||
var Str = { | ||
trim: _touch, | ||
trim: _trim, | ||
escape: _escape | ||
@@ -39,1 +40,2 @@ }; | ||
module.exports = Str; | ||
@@ -31,1 +31,2 @@ /* ================================================================ | ||
module.exports = Type; | ||
@@ -101,2 +101,14 @@ /* ================================================================ | ||
/** | ||
* remove | ||
*/ | ||
function _remove(arr, n) { | ||
if(n<0){ | ||
return arr; | ||
} | ||
arr = arr.slice(0,n).concat(arr.slice(n+1,arr.length)); | ||
return arr; | ||
} | ||
/** | ||
* indexOf | ||
@@ -142,2 +154,3 @@ */ | ||
slice: _slice, | ||
remove: _remove, | ||
indexOf: _indexOf, | ||
@@ -163,1 +176,2 @@ decode: _decode, | ||
{ | ||
"name": "xutil", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "xutil", | ||
@@ -5,0 +5,0 @@ "bin": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9632
265