Skip to content

Commit

Permalink
support older node versions
Browse files Browse the repository at this point in the history
  • Loading branch information
bcherny committed Apr 24, 2017
1 parent 85b83ee commit ef3fcd2
Show file tree
Hide file tree
Showing 9 changed files with 1,654 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
- Use `DEBUG=true npm run tdd` to add logging output to the above command
- Add `export let only=true` to a test in test/e2e to just run that test
- Add `export let exclude=true` to a test in test/e2e to not run that test
- To debug a test, with breakpoints:
1. Install [node-inspector](https://www.npmjs.com/package/node-inspector)
2. Run `node-debug ./node_modules/ava/profile.js ./dist/test/test.js`
7 changes: 6 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
machine:
node:
version: 6.3.0
version: 6.3.0
test:
override:
- nvm i v4.5.0 && rm -rf node_modules && npm i
- nvm i v6.10.2 && rm -rf node_modules && npm i
- nvm i v7.9.0 && rm -rf node_modules && npm i
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"json2ts": "dist/src/cli.js"
},
"typings": "dist/src/index.d.ts",
"engines": {
"node": ">=4.5.0"
},
"scripts": {
"build": "npm run clean && mkdir dist && npm run build:browser && npm run build:server",
"build:browser": "browserify src/index.ts -s jstt -p tsify > dist/bundle.js",
Expand Down
4 changes: 2 additions & 2 deletions src/parser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { whiteBright } from 'cli-color'
import { JSONSchema4Type, JSONSchema4TypeName } from 'json-schema'
import { findKey, isPlainObject, map } from 'lodash'
import { findKey, includes, isPlainObject, map } from 'lodash'
import { typeOfSchema } from './typeOfSchema'
import { AST, T_ANY, T_ANY_ADDITIONAL_PROPERTIES, TInterfaceParam } from './types/AST'
import { JSONSchema, JSONSchemaWithDefinitions, SchemaSchema } from './types/JSONSchema'
Expand Down Expand Up @@ -218,7 +218,7 @@ function parseSchema(

const asts = map(schema.properties, (value, key: string) => ({
ast: parse(value, rootSchema, key, processed),
isRequired: (schema.required || []).includes(key),
isRequired: includes(schema.required || [], key),
keyName: key
}))

Expand Down
Loading

0 comments on commit ef3fcd2

Please sign in to comment.