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

jints

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jints - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

68

jints.js

@@ -8,5 +8,6 @@ (function (exportName) {

* zswang (http://weibo.com/zswang)
* @version 0.0.4
* @date 2015-11-03
* @version 0.0.5
* @date 2015-11-17
*/
/*<function name="scaleChars">*/
/**

@@ -16,3 +17,5 @@ * 进制字符串

var scaleChars = '0123456789abcdefghijklmnopqrstuvwxyz';
/*</function>*/
var exports = {};
/*<function name="fullZero">*/
/**

@@ -24,2 +27,13 @@ * 向前补零 '1',5 -> '00001'

* @return {string} 返回补零后的字符串
'''<example>'''
* @example fullZero():base
```js
console.log(jints.fullZero('af', 5));
// > 000af
console.log(jints.fullZero('AF', 5));
// > 000AF
console.log(jints.fullZero('abcdef', 5));
// > abcdef
```
'''</example>'''
*/

@@ -29,3 +43,5 @@ function fullZero(n, len) {

}
/*</function>*/
exports.fullZero = fullZero;
/*<function name="format">*/
/**

@@ -36,2 +52,16 @@ * 清理整数前面无效的零 '000000001' -> '1'

* @return {string} 返回格式化后的整数字符串
'''<example>'''
* @example format():base
```js
console.log(jints.format('000af'));
// > af
console.log(jints.format('abcdef'));
// > abcdef
```
* @example format():LowerCase
```js
console.log(jints.format('000AF'));
// > af
```
'''</example>'''
*/

@@ -41,2 +71,5 @@ function format(n) {

}
/*</function>*/
exports.format = format;
/*<function name="compare" depend="fullZero,scaleChars">*/
/**

@@ -48,2 +81,13 @@ * 比较两个整数的大小 '1','0' -> +1

* @return {number} a > b 返回 +1, a === b 返回 0, a < b 返回 -1
'''<example>'''
* @example format():base
```js
console.log(jints.compare('af', '00af'));
// > 0
console.log(jints.compare('af', 'ae'));
// > 1
console.log(jints.compare('ae', 'af'));
// > -1
```
'''</example>'''
*/

@@ -66,4 +110,7 @@ function compare(a, b) {

}
/*</function>*/
exports.compare = compare;
//console.log(compare('01', '1'));
//console.log(compare('0a1', 'ab1'));
/*<function name="add" depend="fullZero,scaleChars,format">*/
/**

@@ -100,4 +147,6 @@ * 无限整数加法

}
/*</function>*/
exports.add = add;
//console.log(add('19', '1234', 10));
/*<function name="byteMul" depend="scaleChars">*/
/**

@@ -125,4 +174,6 @@ * 无限位数乘法函数,单个数乘无限进制整数

}
/*</function>*/
//console.log(byteMul('555', 12, 10));
//console.log(byteMul('25', 8, 10));
/*<function name="mul" depend="scaleChars,byteMul">*/
/**

@@ -152,5 +203,7 @@ * 无限整数乘法

}
/*</function>*/
exports.mul = mul;
//console.log(mul('555', '12', 10)); // 6660
//console.log(mul('25', '8', 10)); // 200
/*<function name="power" depend="format,mul">*/
/**

@@ -177,4 +230,6 @@ * 无限整数的次方

}
/*</function>*/
exports.power = power;
//console.log(power('2', 10, 10)); // 1024
/*<function name="charDigit" depend="compare,add">*/
/**

@@ -197,3 +252,5 @@ * 将一个字符转换为指定进制

}
/*</function>*/
//console.log(charDigit('7', 10, 2)); // 111
/*<function name="digit" depend="charDigit,format,scaleChars,add,mul,power">*/
/**

@@ -232,2 +289,3 @@ * 无限整数进制间的转换

}
/*</function>*/
exports.digit = digit;

@@ -238,2 +296,3 @@ //console.log(digit('1024', 10, 2)); // 10000000000

//console.log(digit(digit('askdjfas91231as', 36, 7), 7, 36)); // askdjfas91231as
/*<function name="sub" depend="fullZero,format,scaleChars">*/
/**

@@ -270,2 +329,3 @@ * 无限整数减法

}
/*</function>*/
exports.sub = sub;

@@ -276,2 +336,3 @@ //console.log(sub('32', '3', 10)); // 29

//console.log(sub('101', '10', 2)); // 11
/*<function name="div" depend="format,compare,sub,add">*/
/**

@@ -308,4 +369,6 @@ * 无限整数除法

}
/*</function>*/
exports.div = div;
//console.log(div('32', '3', 10)); // ['10', '2']
/*<function name="div2" depend="format,div">*/
/**

@@ -347,2 +410,3 @@ * 无限整数除法,如果是循环小数,则在循环部分加上括号

}
/*</function>*/
exports.div2 = div2;

@@ -349,0 +413,0 @@ //console.log(div2(1, 3)); // 0.(3)

9

package.json

@@ -5,3 +5,3 @@ {

"description": "Big Integer",
"version": "0.0.4",
"version": "0.0.5",
"homepage": "http://github.com/zswang/jints",

@@ -35,4 +35,9 @@ "main": "jints.js",

"scripts": {
"_update_version": "jdists version.jdists",
"_dist": "jdists src/jints.js -o jints.js -r debug,test,remove,safe",
"_compress": "uglifyjs jints.js -o jints.min.js -p 5 -c -m",
"example": "jdists example.jdists.js -o test/example.js",
"test": "istanbul cover --hook-run-in-context node_modules/mocha/bin/_mocha -- -R spec",
"dist": "jdists src/jints.js -o jints.js && uglifyjs jints.js -o jints.min.js -p 5 -c -m && npm run test",
"mocha": "jdists example.jdists.js -o test/example.js && mocha",
"dist": "npm run _update_version && npm run example && npm run _dist && npm run _compress && npm run test",
"lint": "jshint src/*.js *.json"

@@ -39,0 +44,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