Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

a-calc

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-calc - npm Package Compare versions

Comparing version 0.0.78 to 0.0.79

6

package.json
{
"name": "a-calc",
"version": "0.0.78",
"description": "JavaScript的字符串四则运算库, 支持格式化操作例如: 千分位格式化, 灵活指定小数点位数",
"version": "0.0.79",
"description": "JavaScript的精准四则运算库,支持格式化操作例如: 千分位格式化, 灵活指定小数点位数",
"main": "./cjs/index.cjs",

@@ -26,3 +26,3 @@ "exports": {

"dev:w": "rollup -c -w --environment build:dev",
"build": "rollup -c --environment build:build",
"build": "rollup -c --environment build:build & yarn test",
"build:w": "rollup -c -w --environment build:build",

@@ -29,0 +29,0 @@ "test": "cross-env ava --verbose --tap test/*.mjs"

@@ -160,50 +160,62 @@ # a-calc

```js
import { calc, fmt } from 'a-calc'
import { calc, fmt } from "a-calc";
Vue.mixin({
methods: {
calc (expr, obj) {
let dataArr = [this]
let _fmt = undefined
let _error = undefined
if (obj !== undefined) {
dataArr.unshift(obj)
if (obj._fmt !== undefined) {
_fmt = obj._fmt
}
if (obj._error !== undefined) {
_error = obj._error
}
}
Vue.mixin( {
methods: {
calc ( expr, obj )
{
let dataArr = [this];
let _fmt = undefined;
let _error = undefined;
if ( obj !== undefined )
{
dataArr.unshift( obj );
if ( obj._fmt !== undefined )
{
_fmt = obj._fmt;
}
if ( obj._error !== undefined )
{
_error = obj._error;
}
}
return calc(expr, {
_fillData: dataArr,
_error: _error === undefined ? '-' : _error,
_fmt, // 格式化参数在没有字符串格式化的时候才有用
})
},
fmt (expr, obj) {
// 专门格式化的
let dataArr = [this]
let _fmt = undefined
let _error = undefined
if (obj !== undefined) {
dataArr.unshift(obj)
if (obj._fmt !== undefined) {
_fmt = obj._fmt
}
if (obj._error !== undefined) {
_error = obj._error
}
}
return fmt(expr,
{
_fillData: dataArr,
_error: _error === undefined ? '-' : _error,
_fmt,
_unit: true
})
},
},
})
return calc( expr, {
_fillData: dataArr,
_error: _error === undefined ? "-" : _error,
_fmt, // 格式化参数在没有字符串格式化的时候才有用
} );
},
fmt ( expr, obj )
{
// 专门格式化的
let dataArr = [this];
let _fmt = undefined;
let _error = undefined;
if ( obj !== undefined )
{
dataArr.unshift( obj );
if ( obj._fmt !== undefined )
{
_fmt = obj._fmt;
}
if ( obj._error !== undefined )
{
_error = obj._error;
}
}
return fmt( expr,
{
_fillData: dataArr,
_error: _error === undefined ? "-" : _error,
_fmt,
_unit: true
} );
},
},
} );
```

@@ -213,3 +225,5 @@

* 0.0.76
* 0.0.79
* 更新文档
* 0.0.78
* 支持科学计数法的计算

@@ -216,0 +230,0 @@ * 完整的单元测试

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc