Skip to content

Commit d2ba77e

Browse files
committed
Add new APIs
1 parent c2b143e commit d2ba77e

27 files changed

+435
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Home](./index) > [@microsoft/node-core-library](./node-core-library.md) > [IParsedPackageName](./node-core-library.iparsedpackagename.md)
2+
3+
# IParsedPackageName interface
4+
5+
A package name that has been separated into its scope and unscoped name.
6+
7+
## Properties
8+
9+
| Property | Type | Description |
10+
| --- | --- | --- |
11+
| [`scope`](./node-core-library.iparsedpackagename.scope.md) | `string` | The parsed NPM scope, or an empty string if there was no scope. The scope value will always include the at-sign. |
12+
| [`unscopedName`](./node-core-library.iparsedpackagename.unscopedname.md) | `string` | The parsed NPM package name without the scope. |
13+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Home](./index) > [@microsoft/node-core-library](./node-core-library.md) > [IParsedPackageName](./node-core-library.iparsedpackagename.md) > [scope](./node-core-library.iparsedpackagename.scope.md)
2+
3+
# IParsedPackageName.scope property
4+
5+
The parsed NPM scope, or an empty string if there was no scope. The scope value will always include the at-sign.
6+
7+
**Signature:**
8+
```javascript
9+
scope: string
10+
```
11+
12+
## Remarks
13+
14+
For example, if the parsed input was "@scope/example", then scope would be "\\@scope".
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Home](./index) > [@microsoft/node-core-library](./node-core-library.md) > [IParsedPackageName](./node-core-library.iparsedpackagename.md) > [unscopedName](./node-core-library.iparsedpackagename.unscopedname.md)
2+
3+
# IParsedPackageName.unscopedName property
4+
5+
The parsed NPM package name without the scope.
6+
7+
**Signature:**
8+
```javascript
9+
unscopedName: string
10+
```
11+
12+
## Remarks
13+
14+
For example, if the parsed input was "@scope/example", then the name would be "example".
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Home](./index) > [@microsoft/node-core-library](./node-core-library.md) > [IParsedPackageNameOrError](./node-core-library.iparsedpackagenameorerror.md) > [error](./node-core-library.iparsedpackagenameorerror.error.md)
2+
3+
# IParsedPackageNameOrError.error property
4+
5+
If the input string could not be parsed, then this string will contain a nonempty error message. Otherwise it will be an empty string.
6+
7+
**Signature:**
8+
```javascript
9+
error: string
10+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Home](./index) > [@microsoft/node-core-library](./node-core-library.md) > [IParsedPackageNameOrError](./node-core-library.iparsedpackagenameorerror.md)
2+
3+
# IParsedPackageNameOrError interface
4+
5+
Result object returned by [PackageName.tryParse](./node-core-library.packagename.tryparse.md)
6+
7+
## Properties
8+
9+
| Property | Type | Description |
10+
| --- | --- | --- |
11+
| [`error`](./node-core-library.iparsedpackagenameorerror.error.md) | `string` | If the input string could not be parsed, then this string will contain a nonempty error message. Otherwise it will be an empty string. |
12+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Home](./index) > [@microsoft/node-core-library](./node-core-library.md) > [IProtectableMapParameters](./node-core-library.iprotectablemapparameters.md)
2+
3+
# IProtectableMapParameters interface
4+
5+
Constructor parameters for [ProtectableMap](./node-core-library.protectablemap.md)
6+
7+
## Properties
8+
9+
| Property | Type | Description |
10+
| --- | --- | --- |
11+
| [`onClear`](./node-core-library.iprotectablemapparameters.onclear.md) | `(source: ProtectableMap<K, V>) => void` | An optional hook that will be invoked before Map.clear() is performed. |
12+
| [`onDelete`](./node-core-library.iprotectablemapparameters.ondelete.md) | `(source: ProtectableMap<K, V>, key: K) => void` | An optional hook that will be invoked before Map.delete() is performed. |
13+
| [`onSet`](./node-core-library.iprotectablemapparameters.onset.md) | `(source: ProtectableMap<K, V>, key: K, value: V) => V` | An optional hook that will be invoked before Map.set() is performed. |
14+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Home](./index) &gt; [@microsoft/node-core-library](./node-core-library.md) &gt; [IProtectableMapParameters](./node-core-library.iprotectablemapparameters.md) &gt; [onClear](./node-core-library.iprotectablemapparameters.onclear.md)
2+
3+
# IProtectableMapParameters.onClear property
4+
5+
An optional hook that will be invoked before Map.clear() is performed.
6+
7+
**Signature:**
8+
```javascript
9+
onClear: (source: ProtectableMap<K, V>) => void
10+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Home](./index) &gt; [@microsoft/node-core-library](./node-core-library.md) &gt; [IProtectableMapParameters](./node-core-library.iprotectablemapparameters.md) &gt; [onDelete](./node-core-library.iprotectablemapparameters.ondelete.md)
2+
3+
# IProtectableMapParameters.onDelete property
4+
5+
An optional hook that will be invoked before Map.delete() is performed.
6+
7+
**Signature:**
8+
```javascript
9+
onDelete: (source: ProtectableMap<K, V>, key: K) => void
10+
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Home](./index) &gt; [@microsoft/node-core-library](./node-core-library.md) &gt; [IProtectableMapParameters](./node-core-library.iprotectablemapparameters.md) &gt; [onSet](./node-core-library.iprotectablemapparameters.onset.md)
2+
3+
# IProtectableMapParameters.onSet property
4+
5+
An optional hook that will be invoked before Map.set() is performed.
6+
7+
**Signature:**
8+
```javascript
9+
onSet: (source: ProtectableMap<K, V>, key: K, value: V) => V
10+
```
11+
12+
## Remarks
13+
14+
If this hook is provided, the function MUST return the \`value\` parameter. This provides the opportunity to modify the value before it is added to the map.

api/node-core-library.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ Core libraries that every NodeJS toolchain project should use.
1313
| [`JsonSchema`](./node-core-library.jsonschema.md) | Represents a JSON schema that can be used to validate JSON data files loaded by the JsonFile class. |
1414
| [`LockFile`](./node-core-library.lockfile.md) | A helper utility for working with file-based locks. This class should only be used for locking resources across processes, but should not be used for attempting to lock a resource in the same process. |
1515
| [`PackageJsonLookup`](./node-core-library.packagejsonlookup.md) | This class provides methods for finding the nearest "package.json" for a folder and retrieving the name of the package. The results are cached. |
16+
| [`PackageName`](./node-core-library.packagename.md) | Various functions for working with package names that may include scopes. |
1617
| [`Path`](./node-core-library.path.md) | Common operations for manipulating file and directory paths. |
18+
| [`ProtectableMap`](./node-core-library.protectablemap.md) | The ProtectableMap provides an easy way for an API to expose a Map&lt;K, V&gt; property while intercepting and validating any write operations that are performed by consumers of the API. |
1719
| [`Text`](./node-core-library.text.md) | Operations for working with strings that contain text. |
1820

1921
## Interfaces
@@ -30,6 +32,9 @@ Core libraries that every NodeJS toolchain project should use.
3032
| [`IPackageJsonLookupParameters`](./node-core-library.ipackagejsonlookupparameters.md) | Constructor parameters for [PackageJsonLookup](./node-core-library.packagejsonlookup.md) |
3133
| [`IPackageJsonScriptTable`](./node-core-library.ipackagejsonscripttable.md) | This interface is part of the IPackageJson file format. It is used for the "scripts" field. |
3234
| [`IPackageJsonTsdocConfiguration`](./node-core-library.ipackagejsontsdocconfiguration.md) | **_(BETA)_** This interface is part of the IPackageJson file format. It is used for the "tsdoc" field. |
35+
| [`IParsedPackageName`](./node-core-library.iparsedpackagename.md) | A package name that has been separated into its scope and unscoped name. |
36+
| [`IParsedPackageNameOrError`](./node-core-library.iparsedpackagenameorerror.md) | Result object returned by [PackageName.tryParse](./node-core-library.packagename.tryparse.md) |
37+
| [`IProtectableMapParameters`](./node-core-library.iprotectablemapparameters.md) | Constructor parameters for [ProtectableMap](./node-core-library.protectablemap.md) |
3338

3439
## Enumerations
3540

0 commit comments

Comments
 (0)