Skip to content

Commit c162664

Browse files
committed
deprecate -big parameter
1 parent 93b78ea commit c162664

File tree

3 files changed

+2
-25
lines changed

3 files changed

+2
-25
lines changed

.github/workflows/node-tests.yml

-9
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@ jobs:
3737
echo "got: '${got}'"
3838
[[ "${got}" == "${exp}" ]]
3939
40-
- name: Run json-to-go with -big using stdin
41-
shell: bash
42-
run: |
43-
set -eEuo pipefail
44-
got=$(node json-to-go.js -big < tests/double-nested-objects.json)
45-
exp=$(cat tests/double-nested-objects.go)
46-
echo "got: '${got}'"
47-
[[ "${got}" == "${exp}" ]]
48-
4940
- name: Run json-to-go with a file
5041
shell: bash
5142
run: |

README.md

-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ Contributions are welcome! Open a pull request to fix a bug, or open an issue to
2727
cat sample.json | node json-to-go.js
2828
```
2929

30-
- Read large JSON file from stdin:
31-
32-
```sh
33-
node json-to-go.js --big < sample.json
34-
cat sample.json | node json-to-go.js --big
35-
```
36-
3730
### Credits
3831

3932
JSON-to-Go is brought to you by Matt Holt ([mholt6](https://twitter.com/mholt6)).

json-to-go.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,6 @@ function jsonToGo(json, typename, flatten = true, example = false, allOmitempty
495495

496496
if (typeof module != 'undefined') {
497497
if (!module.parent) {
498-
let bigstdin = false
499498
let filename = null
500499

501500
function jsonToGoWithErrorHandling(json) {
@@ -518,7 +517,7 @@ if (typeof module != 'undefined') {
518517

519518
const argument = val.replace(/-/g, '')
520519
if (argument === "big")
521-
bigstdin = true
520+
console.warn(`Warning: The argument '${argument}' has been deprecated and has no effect anymore`)
522521
else {
523522
console.error(`Unexpected argument ${val} received`)
524523
process.exit(1)
@@ -532,7 +531,7 @@ if (typeof module != 'undefined') {
532531
return
533532
}
534533

535-
if (bigstdin) {
534+
if (!filename) {
536535
bufs = []
537536
process.stdin.on('data', function(buf) {
538537
bufs.push(buf)
@@ -543,12 +542,6 @@ if (typeof module != 'undefined') {
543542
})
544543
return
545544
}
546-
547-
// read from stdin
548-
process.stdin.on('data', function(buf) {
549-
const json = buf.toString('utf8')
550-
jsonToGoWithErrorHandling(json)
551-
})
552545
} else {
553546
module.exports = jsonToGo
554547
}

0 commit comments

Comments
 (0)