chaining-date
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -0,0 +0,0 @@ { |
/** | ||
* @author TroyTae | ||
* @version 0.8.1 | ||
* @version 0.8.2 | ||
* @name chaining-date | ||
@@ -5,0 +5,0 @@ */ |
{ | ||
"name": "chaining-date", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "A tiny module for using Date with chaining ⏱", | ||
"main": "dist/index.js", | ||
"homepage": "https://github.com/TroyTae/chaining-date", | ||
"module": "dist/index.esm.js", | ||
"types": "dist/index.d.ts", | ||
"homepage": "https://github.com/TroyTae/chaining-date/blob/master/README.md", | ||
"author": { | ||
@@ -20,4 +22,4 @@ "name": "TroyTae", | ||
"devDependencies": { | ||
"rollup": "^1.27.8", | ||
"rollup-plugin-terser": "^5.1.2" | ||
"rollup": "^1.27.14", | ||
"rollup-plugin-terser": "^5.1.3" | ||
}, | ||
@@ -27,5 +29,9 @@ "scripts": { | ||
}, | ||
"directories": { | ||
"lib": "dist", | ||
"test": "test", | ||
"doc": "README.md" | ||
}, | ||
"license": "MIT", | ||
"keywords": [ | ||
"tiny", | ||
"date", | ||
@@ -32,0 +38,0 @@ "time", |
@@ -0,0 +0,0 @@ [![size](https://img.shields.io/github/size/TroyTae/chaining-date/dist/chaining-date.js?style=flat-square)](https://github.com/TroyTae/chaining-date/blob/master/dist/chaining-date.js) |
const pkg = require('./package.json'); | ||
const {terser} = require('rollup-plugin-terser'); | ||
const createConfig = (isNode) => { | ||
const createConfig = (format) => { | ||
const isBrowser = (format === 'iife'); | ||
const file = (function() { | ||
switch (format) { | ||
case 'cjs': return pkg.main; | ||
case 'esm': return pkg.module; | ||
case 'iife': return `dist/${pkg.name}.js`; | ||
} | ||
})(); | ||
return { | ||
@@ -9,9 +17,9 @@ input: 'src/chaining-date.js', | ||
banner: `/**\n * @author ${pkg.author.name}\n * @version ${pkg.version}\n * @name ${pkg.name}\n */`, | ||
compact: !isNode, | ||
strict : isNode, | ||
format: isNode ? 'cjs' : 'iife', | ||
file: isNode ? pkg.main : `dist/${pkg.name}.js`, | ||
compact: isBrowser, | ||
strict : !isBrowser, | ||
format: format, | ||
file: file, | ||
name: pkg.name.split('-').map((v) => v.slice(0, 1).toUpperCase() + v.slice(1)).join(''), | ||
}, | ||
plugins: [isNode ? null : terser()].filter(Boolean) | ||
plugins: [isBrowser ? terser() : null].filter(Boolean) | ||
}; | ||
@@ -21,4 +29,5 @@ }; | ||
module.exports = [ | ||
createConfig(false), | ||
createConfig(true) | ||
createConfig('cjs'), | ||
createConfig('esm'), | ||
createConfig('iife') | ||
]; |
@@ -0,0 +0,0 @@ import { DateMethods, DefaultDateFormat } from './constants'; |
@@ -0,0 +0,0 @@ var DateMethods = [ |
@@ -0,0 +0,0 @@ function fillZero(value, digit) { |
@@ -57,12 +57,21 @@ const ChainingDate = require('../dist/index'); | ||
// test('custom format', () => { | ||
// const chainingDate = new ChainingDate(); | ||
// ChainingDate.setFormat('YY', function () { | ||
// return year % 100; | ||
// }); | ||
// ChainingDate.setFormat('YMD', function () { | ||
// return `${year}-${month}-${date}`; | ||
// }); | ||
// expect(chainingDate.format('YY')).toBe(`${year % 100}`); | ||
// expect(chainingDate.format('YMD')).toBe(`${year}-${month}-${date}`); | ||
// }); | ||
test('custom format', () => { | ||
const customDate = new Date(`${year}-${month}-${date} ${hours}:${minutes}:${seconds}`); | ||
const chainingDate = new ChainingDate(customDate); | ||
ChainingDate.setFormat('dd', function () { | ||
switch (this.date.getDay()) { | ||
case 0: return '일요일'; | ||
case 1: return '월요일'; | ||
case 2: return '화요일'; | ||
case 3: return '수요일'; | ||
case 4: return '목요일'; | ||
case 5: return '금요일'; | ||
case 6: return '토요일'; | ||
} | ||
}); | ||
ChainingDate.setFormat('YMD', function () { | ||
return `${year}-${month}-${date}`; | ||
}); | ||
expect(chainingDate.format('dd')).toBe('월요일'); | ||
expect(chainingDate.format('YMD')).toBe(`${year}-${month}-${date}`); | ||
}); |
@@ -0,0 +0,0 @@ // For a detailed explanation regarding each configuration property, visit: |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
17
565
23761