给金额数字用逗号分组

node v8.17.0
version: master
endpointsharetweet
可以继续优化
const R = require("ramda") const groupByWithIdx = R.addIndex(R.groupBy); const main = R.pipe( String, R.split(''), R.reverse, groupByWithIdx((s, i) => Math.floor(i / 3)), R.values, R.reverse, R.map(R.reverse), R.map(R.join('')), R.join(',')) main(1234567)
Loading…

no comments

    sign in to comment