bfj 6.1.1 → 6.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/HISTORY.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # History
2
2
 
3
+ ## 6.1.2
4
+
5
+ ### Bug fixes
6
+
7
+ * eventify: escape object keys (910ad08)
8
+
9
+ ### Other changes
10
+
11
+ * package: update deps (aafb4ff)
12
+
3
13
  ## 6.1.1
4
14
 
5
15
  ### Bug fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfj",
3
- "version": "6.1.1",
3
+ "version": "6.1.2",
4
4
  "description": "Big-friendly JSON. Asynchronous streaming functions for large JSON data sets.",
5
5
  "homepage": "https://gitlab.com/philbooth/bfj",
6
6
  "bugs": "https://gitlab.com/philbooth/bfj/issues",
@@ -29,19 +29,19 @@
29
29
  "node": ">= 6.0.0"
30
30
  },
31
31
  "dependencies": {
32
- "bluebird": "^3.5.1",
33
- "check-types": "^7.3.0",
34
- "hoopy": "^0.1.2",
35
- "tryer": "^1.0.0"
32
+ "bluebird": "^3.5.5",
33
+ "check-types": "^8.0.3",
34
+ "hoopy": "^0.1.4",
35
+ "tryer": "^1.0.1"
36
36
  },
37
37
  "devDependencies": {
38
- "chai": "4.1.x",
39
- "eslint": "4.19.x",
40
- "mocha": "5.0.x",
41
- "please-release-me": "^2.0.2",
42
- "proxyquire": "1.8.x",
43
- "request": "2.85.x",
44
- "spooks": "2.0.x"
38
+ "chai": "^4.2.0",
39
+ "eslint": "^6.0.1",
40
+ "mocha": "^6.1.4",
41
+ "please-release-me": "^2.1.2",
42
+ "proxyquire": "^2.1.0",
43
+ "request": "^2.88.0",
44
+ "spooks": "^2.0.0"
45
45
  },
46
46
  "scripts": {
47
47
  "lint": "eslint src",
package/src/eventify.js CHANGED
@@ -297,7 +297,7 @@ function eventify (data, options = {}) {
297
297
  return Promise.resolve()
298
298
  }
299
299
 
300
- return emit(events.property, key)
300
+ return emit(events.property, escapeString(key))
301
301
  .then(() => proceed(item))
302
302
  })
303
303
  }
@@ -1052,6 +1052,61 @@ suite('eventify:', () => {
1052
1052
  })
1053
1053
  })
1054
1054
 
1055
+ suite('object with keys containing special characters:', () => {
1056
+ setup(done => {
1057
+ const emitter = eventify({ 'foo\n"bar"': 42 })
1058
+
1059
+ Object.keys(events).forEach(key => {
1060
+ emitter.on(events[key], spooks.fn({
1061
+ name: key,
1062
+ log: log
1063
+ }))
1064
+ })
1065
+
1066
+ emitter.on(events.end, done)
1067
+ })
1068
+
1069
+ test('object event occurred once', () => {
1070
+ assert.strictEqual(log.counts.object, 1)
1071
+ })
1072
+
1073
+ test('property event occurred once', () => {
1074
+ assert.strictEqual(log.counts.property, 1)
1075
+ })
1076
+
1077
+ test('property event was dispatched correctly', () => {
1078
+ assert.strictEqual(log.args.property[0][0], 'foo\\n\\"bar\\"')
1079
+ })
1080
+
1081
+ test('number event occurred once', () => {
1082
+ assert.strictEqual(log.counts.number, 1)
1083
+ })
1084
+
1085
+ test('number event was dispatched correctly', () => {
1086
+ assert.strictEqual(log.args.number[0][0], 42)
1087
+ })
1088
+
1089
+ test('endObject event occurred once', () => {
1090
+ assert.strictEqual(log.counts.endObject, 1)
1091
+ })
1092
+
1093
+ test('end event occurred once', () => {
1094
+ assert.strictEqual(log.counts.end, 1)
1095
+ })
1096
+
1097
+ test('literal event did not occur', () => {
1098
+ assert.strictEqual(log.counts.literal, 0)
1099
+ })
1100
+
1101
+ test('error event did not occur', () => {
1102
+ assert.strictEqual(log.counts.error, 0)
1103
+ })
1104
+
1105
+ test('dataError event did not occur', () => {
1106
+ assert.strictEqual(log.counts.dataError, 0)
1107
+ })
1108
+ })
1109
+
1055
1110
  suite('nested array:', () => {
1056
1111
  setup(done => {
1057
1112
  const emitter = eventify([ 'foo', [ 'bar', [ 'baz', 'qux' ] ] ])