考虑以下来自我的package.json的片段
"dependencies": {
"@types/lodash.camelcase": "^4.3.6",
"@types/lodash.kebabcase": "^4.1.6",
"@types/lodash.lowercase": "^4.3.6",
"@types/lodash.upperfirst": "^4.3.6",
"@types/mime": "^2.0.3",
"@types/swagger-jsdoc": "^6.0.1",
"async": "^3.2.2",
"aws-arn": "^1.0.1",
}
从这里,我想生成下面的字符串-
@types/lodash.camelcase@^4.3.6 @types/lodash.kebabcase@^4.1.6 @types/lodash.lowercase@^4.3.6 @types/lodash.upperfirst@^4.3.6 @types/mime@^2.0.3 @types/swagger-jsdoc@^6.0.1 async@^3.2.2 aws-arn@^1.0.1
你知道怎么做吗?
2条答案
按热度按时间bis0qfac1#
如
jq
标记:创建一个有效的JSON,然后用to_entries
和join
反汇编两次:Demo
bvjxkvbb2#
假设实际上是有效的JSON,你可以使用字符串插值)和
join
:与使用两次join.YMMV相比,字符串插值提供了更多的灵活性,对于示例情况,join就足够了。