timespan-js
Advanced tools
Comparing version 0.0.3 to 0.1.1
@@ -188,2 +188,4 @@ # Timespanjs API | ||
减时间差值。value可以是number类型、Timespan类型。 | ||
###get() | ||
获取timespan对象的毫秒数值。 | ||
###set(value, unit) | ||
@@ -190,0 +192,0 @@ 设置时间差值。该方法重新设置时间差对象的时间差值。value可以是number类型、Timespan类型。比如: |
# 开发日志 | ||
## v0.1.1 | ||
1. 增加get方法; | ||
## v0.1.0 | ||
1. 扩展add、substract、set方法功能,支持传递timespan对象作为参数。 | ||
2. 增加nodejs支持,发布到npm。地址:[timespan-js](https://www.npmjs.org/package/timespan-js) | ||
@@ -6,0 +8,0 @@ |
@@ -9,5 +9,5 @@ { | ||
"author":"houyhea", | ||
"version": "0.0.3", | ||
"version": "0.1.1", | ||
"dependencies": {}, | ||
"main": "timespan.js" | ||
} |
@@ -34,3 +34,13 @@ #timespanjs | ||
####node.js下的引用 | ||
安装nodejs,通过npm命令安装timespanjs(注意:由于timespanjs被抢注,这里采用timespan-js作为nodejs中的包名)。npm地址:[timespan-js](https://www.npmjs.org/package/timespan-js) | ||
```js | ||
npm install timespan-js | ||
``` | ||
调用方法: | ||
```js | ||
var Timespan=require("timespan-js"); | ||
var ts=new Timespan(85,"m"); | ||
console.log(ts.humanize()); | ||
``` | ||
@@ -37,0 +47,0 @@ ####调用示例: |
@@ -8,3 +8,3 @@ /** | ||
'use strict'; | ||
var VERSION = "0.1.0", | ||
var VERSION = "0.1.1", | ||
globalScope = typeof global !== 'undefined' ? global : this, | ||
@@ -135,3 +135,5 @@ oldGlobalMoment, | ||
var Timespan = function (value, unit, config) { | ||
if (!(value instanceof Number)) { | ||
throw new Error("value must be a number"); | ||
} | ||
unit = unit || "ms"; | ||
@@ -252,2 +254,6 @@ this.msec = getMilliseconds(value, unit); | ||
}, | ||
get:function() | ||
{ | ||
return this.msec; | ||
}, | ||
set: function (value, unit) { | ||
@@ -254,0 +260,0 @@ if (!value) |
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
127765
758
76