chaining-date
Advanced tools
Comparing version 0.1.1 to 0.1.2
/** | ||
* @author TroyTae | ||
* @version 0.1.1 | ||
* @version 0.1.2 | ||
* @name chaining-date | ||
*/ | ||
(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?module.exports=f():typeof define==='function'&&define.amd?define(f):(g=g||self,g.ChainingDate=f());}(this,(function(){'use strict';var D = Date; | ||
var ChainingDate = (function () { | ||
function ChainingDate(date) { | ||
if (typeof date == 'number') { | ||
this.date = new D(date); | ||
} | ||
else if (typeof date == 'string') { | ||
this.date = new D(D.parse(date)); | ||
} | ||
else { | ||
this.date = date; | ||
} | ||
} | ||
ChainingDate.prototype.add = function () { | ||
return this; | ||
}; | ||
ChainingDate.prototype.set = function () { | ||
return this; | ||
}; | ||
ChainingDate.prototype.get = function () { | ||
return this.date; | ||
}; | ||
ChainingDate.prototype.toString = function (pattern) { | ||
if (pattern) { | ||
return this.date; | ||
} | ||
return this.date.toString(); | ||
}; | ||
return ChainingDate; | ||
}());return ChainingDate;}))); | ||
'use strict'; | ||
var D = Date; | ||
function ChainingDate(date) { | ||
this.date = ( | ||
typeof date == 'number' ? new D(date) : | ||
typeof date == 'string' ? new D(D.parse(date)) : | ||
date ? date : new D() | ||
); | ||
} | ||
var P = ChainingDate.prototype; | ||
P.add = function () { | ||
return this; | ||
}; | ||
P.set = function () { | ||
return this; | ||
}; | ||
P.get = function () { | ||
return this.date; | ||
}; | ||
P.toString = function (pattern) { | ||
var date = this.date; | ||
if (pattern) { | ||
return date; | ||
} | ||
return date.toString(); | ||
}; | ||
module.exports = ChainingDate; |
{ | ||
"name": "chaining-date", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A tiny module for using Date with chaining ⏱", | ||
@@ -20,5 +20,4 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"rollup": "^1.27.5", | ||
"typescript": "^3.7.2", | ||
"rollup-plugin-typescript2": "^0.25.2" | ||
"rollup": "^1.27.8", | ||
"rollup-plugin-terser": "^5.1.2" | ||
}, | ||
@@ -33,4 +32,5 @@ "scripts": { | ||
"time", | ||
"millisecond" | ||
"format", | ||
"chaining" | ||
] | ||
} |
const pkg = require('./package.json'); | ||
const typescript = require('rollup-plugin-typescript2'); | ||
const {terser} = require('rollup-plugin-terser'); | ||
const output = { | ||
name: pkg.name | ||
.split('-') | ||
.map((v) => v.slice(0, 1).toUpperCase() + v.slice(1)) | ||
.join(''), | ||
format: 'umd', | ||
banner: `/**\n * @author ${pkg.author.name}\n * @version ${pkg.version}\n * @name ${pkg.name}\n */` | ||
}; | ||
const createConfig = (isProd) => { | ||
const createConfig = (isNode) => { | ||
return { | ||
input: 'src/index.ts', | ||
input: 'src/chaining-date.js', | ||
output: { | ||
...output, | ||
compact: isProd, | ||
file: pkg.main.replace(isProd ? '' : '.min', '') | ||
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`, | ||
name: pkg.name.split('-').map((v) => v.slice(0, 1).toUpperCase() + v.slice(1)).join(''), | ||
}, | ||
plugins: [ | ||
typescript({ clean: true }) | ||
] | ||
isNode ? null : terser({ | ||
compress: { loops: false } | ||
}) | ||
].filter(Boolean) | ||
}; | ||
@@ -25,0 +21,0 @@ }; |
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
2
5314
9
94