@ts-common/source-map
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -8,2 +8,6 @@ import { StringMap } from "@ts-common/string-map"; | ||
readonly column: number; | ||
/** | ||
* This optional field can be used by parsers to set directives/pragmas. | ||
*/ | ||
readonly directives?: StringMap<unknown>; | ||
} | ||
@@ -39,3 +43,14 @@ export interface BaseObjectInfo { | ||
export declare const arrayMap: <T extends string | number | boolean | object | null, R extends string | number | boolean | object | null>(source: ReadonlyArray<T> | undefined, f: (v: T, i: number) => R) => ReadonlyArray<R>; | ||
/** | ||
* Transform an object. | ||
* | ||
* @param source | ||
* @param f | ||
*/ | ||
export declare const stringMapMap: <T extends string | number | boolean | object | null, R extends string | number | boolean | object | null>(source: StringMap<T> | undefined, f: (v: T, k: string) => R) => StringMap<R>; | ||
/** | ||
* Merge objects | ||
* | ||
* @param array | ||
*/ | ||
export declare const stringMapMerge: <T extends string | number | boolean | object | null>(...array: (StringMap<T> | undefined)[]) => StringMap<T>; | ||
@@ -46,4 +61,21 @@ export declare const propertySetMap: <T extends sm.PartialStringMap<keyof T & string, string | number | boolean | object | null>>(source: T, f: propertySet.PartialFactory<T>) => T; | ||
export declare const cloneDeep: <T extends string | number | boolean | object | null>(source: T) => T; | ||
/** | ||
* Get a file position | ||
* | ||
* @param value | ||
*/ | ||
export declare const getFilePosition: (value: object) => FilePosition | undefined; | ||
/** | ||
* Get a position of a child. | ||
* | ||
* @param data | ||
* @param index | ||
*/ | ||
export declare const getChildFilePosition: (data: object, index: string | number) => FilePosition | undefined; | ||
/** | ||
* Get a file position of a descendant by path. | ||
* | ||
* @param object | ||
* @param path | ||
*/ | ||
export declare const getDescendantFilePosition: (object: object, path: Iterable<string | number> | undefined) => FilePosition | undefined; |
28
index.js
@@ -66,2 +66,8 @@ "use strict"; | ||
}; | ||
/** | ||
* Transform an object. | ||
* | ||
* @param source | ||
* @param f | ||
*/ | ||
exports.stringMapMap = (source, f) => { | ||
@@ -82,2 +88,7 @@ if (source === undefined) { | ||
}; | ||
/** | ||
* Merge objects | ||
* | ||
* @param array | ||
*/ | ||
exports.stringMapMerge = (...array) => { | ||
@@ -139,2 +150,7 @@ if (array.length === 0) { | ||
}; | ||
/** | ||
* Get a file position | ||
* | ||
* @param value | ||
*/ | ||
exports.getFilePosition = (value) => { | ||
@@ -144,2 +160,8 @@ const info = exports.getInfo(value); | ||
}; | ||
/** | ||
* Get a position of a child. | ||
* | ||
* @param data | ||
* @param index | ||
*/ | ||
exports.getChildFilePosition = (data, index) => { | ||
@@ -159,2 +181,8 @@ const child = data[index]; | ||
}; | ||
/** | ||
* Get a file position of a descendant by path. | ||
* | ||
* @param object | ||
* @param path | ||
*/ | ||
exports.getDescendantFilePosition = (object, path) => { | ||
@@ -161,0 +189,0 @@ if (path === undefined) { |
{ | ||
"name": "@ts-common/source-map", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"description": "Source Map", | ||
@@ -35,9 +35,9 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@types/chai": "^4.1.4", | ||
"@types/chai": "^4.1.5", | ||
"@types/mocha": "^5.2.5", | ||
"chai": "^4.1.2", | ||
"chai": "^4.2.0", | ||
"mocha": "^5.2.0", | ||
"nyc": "^13.0.1", | ||
"tslib": "^1.9.3", | ||
"typescript": "^3.0.1" | ||
"typescript": "^3.1.1" | ||
}, | ||
@@ -47,5 +47,5 @@ "dependencies": { | ||
"@ts-common/json": "0.0.18", | ||
"@ts-common/property-set": "0.0.7", | ||
"@ts-common/property-set": "0.0.8", | ||
"@ts-common/string-map": "0.0.26" | ||
} | ||
} |
# source-map | ||
Source Map | ||
## TypeScript Repository Initialization | ||
1. `npm init` | ||
1. `npm install -D typescript` | ||
1. `package.json`: | ||
```json | ||
"scripts": { | ||
"tsc": "tsc", | ||
"test": "tsc && nyc mocha", | ||
"prepack": "npm install && tsc" | ||
}, | ||
"nyc": { | ||
"reporter": [ | ||
"lcov", | ||
"text" | ||
] | ||
}, | ||
"files": [ | ||
"index.d.ts" | ||
], | ||
``` | ||
1. `npm run tsc -- --init` | ||
1. `tsconfig.json`: | ||
```json | ||
"target": "es2015", | ||
"declaration": true, | ||
"sourceMap": true, | ||
"importHelpers": true | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
``` | ||
1. Create `index.ts` | ||
1. `.gitignore`: | ||
``` | ||
*.js | ||
*.d.ts | ||
*.map | ||
``` | ||
1. `npm install -D nyc` | ||
1. `npm install -D mocha` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
279
22249
4
+ Added@ts-common/property-set@0.0.8(transitive)
- Removed@ts-common/property-set@0.0.7(transitive)