> Common JavaScript utility functions for Date, File, Number, String, Array, Object, Function, Browser and more. > Lightweight, TypeScript ready, and easy to use in both Vue and plain JS projects.
npm install @mckou/utils> Common JavaScript utility functions for Date, File, Number, String, Array, Object, Function, Browser and more.
> Lightweight, TypeScript ready, and easy to use in both Vue and plain JS projects.


---
- Installation
- Usage
- Date Utils
- File Utils
- Number Utils
- License
---
``bash`
npm install @mckou/utils
or
`bash`
yarn add @mckou/utils
`javascript
import { mDate } from '@mckou/utils'
const now = new Date()
// Format date
mDate.format(now, 'YYYY-MM-DD') // "2026-02-02"
// Add days
mDate.addDays(now, 7) // Date object 7 days later
// Calculate difference in days
mDate.diffDays('2026-02-02', '2026-02-10') // 8
`
`javascript
import { mFile } from '@mckou/utils'
// Download a file by URL
mFile.downloadByUrl('https://example.com/file.pdf', 'example.pdf')
// Download a file as Blob from API
mFile.downloadByBlob('/api/file/123', 'report.docx')
`
`javascript
import { mNumber } from '@mckou/utils'
// Validate numbers. VueValidate 再方法后面追加Rule即可 mNumber.isIntGtZeroRule
mNumber.isIntGtZero(10) // true
mNumber.isIntGteZero(0) // true
mNumber.isInteger(-5) // true
mNumber.isNumberGteZero(0.5) // true
mNumber.isNumberInRange(5, 1, 10) // true
mNumber.isDecimalPlaces(3.14, 2) // true
mNumber.isPercent(99.99) // true
``