Skip to content

Commit

Permalink
Move to @types, use default generic property
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Jun 27, 2017
1 parent f05652d commit aa862ac
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ coverage/
node_modules/
npm-debug.log
dist/
typings/
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"LICENSE"
],
"scripts": {
"lint": "tslint \"src/**/*.ts\"",
"lint": "tslint \"src/**/*.ts\" --project tsconfig.json --type-check",
"build": "rm -rf dist && tsc",
"test-spec": "blue-tape 'dist/**/*.spec.js' | tap-spec",
"test-cov": "istanbul cover --print none -x '*.spec.js' node_modules/blue-tape/bin/blue-tape.js -- 'dist/**/*.spec.js' | tap-spec",
"test": "npm run build && npm run lint && npm run test-cov",
"prepublish": "typings install && npm run build"
"prepublish": "npm run build"
},
"repository": {
"type": "git",
Expand All @@ -40,12 +40,13 @@
},
"homepage": "https://github.com/blakeembrey/setvalue",
"devDependencies": {
"@types/blue-tape": "^0.1.31",
"@types/node": "^8.0.4",
"blue-tape": "^1.0.0",
"istanbul": "^0.4.4",
"tap-spec": "^4.1.1",
"tslint": "^5.2.0",
"tslint-config-standard": "^6.0.0",
"typescript": "^2.2.1",
"typings": "^2.1.0"
"typescript": "^2.2.1"
}
}
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const _hasOwnProperty = Object.prototype.hasOwnProperty

export type Path = Array<string | number | symbol>

export function set (obj: any, path: Path, value: any) {
export function set <T = any> (obj: any, path: Path, value: T): void | T {
if (path.length === 0) {
return
return undefined
}

let res = obj
Expand All @@ -15,7 +15,7 @@ export function set (obj: any, path: Path, value: any) {
return res[last] = value
}

return
return undefined
}

for (let i = 0; i < path.length - 1; i++) {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"declaration": true,
"noImplicitAny": true,
"removeComments": true,
"strictNullChecks": true,
"sourceMap": true,
"inlineSources": true
}
Expand Down
8 changes: 0 additions & 8 deletions typings.json

This file was deleted.

0 comments on commit aa862ac

Please sign in to comment.