Socket
Socket
Sign inDemoInstall

@microsoft/node-core-library

Package Overview
Dependencies
Maintainers
2
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/node-core-library - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

lib/MapExtensions.d.ts

12

CHANGELOG.json

@@ -5,2 +5,14 @@ {

{
"version": "1.2.0",
"tag": "@microsoft/node-core-library_v1.2.0",
"date": "Tue, 03 Apr 2018 16:05:29 GMT",
"comments": {
"minor": [
{
"comment": "Add a new API \"MapExtensions.mergeFromMap\""
}
]
}
},
{
"version": "1.1.0",

@@ -7,0 +19,0 @@ "tag": "@microsoft/node-core-library_v1.1.0",

9

CHANGELOG.md
# Change Log - @microsoft/node-core-library
This log was last generated on Mon, 02 Apr 2018 16:05:24 GMT and should not be manually modified.
This log was last generated on Tue, 03 Apr 2018 16:05:29 GMT and should not be manually modified.
## 1.2.0
Tue, 03 Apr 2018 16:05:29 GMT
### Minor changes
- Add a new API "MapExtensions.mergeFromMap"
## 1.1.0

@@ -6,0 +13,0 @@ Mon, 02 Apr 2018 16:05:24 GMT

@@ -506,2 +506,18 @@ /**

/**
* Helper functions for working with the Map<K,V> data type.
*
* @public
*/
export declare class MapExtensions {
/**
* Adds all the (key, value) pairs from the source map into the target map.
* @remarks
* This function modifies targetMap. Any existing keys will be overwritten.
* @param targetMap - The map that entries will be added to
* @param sourceMap - The map containing the entries to be added
*/
static mergeFromMap<K, V>(targetMap: Map<K, V>, sourceMap: Map<K, V>): void;
}
/**
* This class provides methods for finding the nearest "package.json" for a folder

@@ -617,2 +633,6 @@ * and retrieving the name of the package. The results are cached.

/**
* Throws an exception if the specified name is not a valid package name.
*/
static validate(packageName: string): void;
/**
* Combines an optional package scope with an unscoped root name.

@@ -619,0 +639,0 @@ * @param scope - Must be either an empty string, or a scope name such as "\@example"

@@ -12,2 +12,3 @@ /**

export { LockFile } from './LockFile';
export { MapExtensions } from './MapExtensions';
export { ProtectableMap, IProtectableMapParameters } from './ProtectableMap';

@@ -14,0 +15,0 @@ export { IPackageJsonLookupParameters, PackageJsonLookup } from './PackageJsonLookup';

@@ -13,2 +13,4 @@ "use strict";

exports.LockFile = LockFile_1.LockFile;
var MapExtensions_1 = require("./MapExtensions");
exports.MapExtensions = MapExtensions_1.MapExtensions;
var ProtectableMap_1 = require("./ProtectableMap");

@@ -15,0 +17,0 @@ exports.ProtectableMap = ProtectableMap_1.ProtectableMap;

@@ -69,2 +69,6 @@ /**

/**
* Throws an exception if the specified name is not a valid package name.
*/
static validate(packageName: string): void;
/**
* Combines an optional package scope with an unscoped root name.

@@ -71,0 +75,0 @@ * @param scope - Must be either an empty string, or a scope name such as "\@example"

20

lib/PackageName.js

@@ -34,3 +34,3 @@ "use strict";

// Don't attempt to parse a ridiculously long input
result.error = 'A package name cannot be longer than 214 characters';
result.error = 'The package name cannot be longer than 214 characters';
return result;

@@ -42,3 +42,3 @@ }

result.scope = input;
result.error = 'The scope must be followed by a slash';
result.error = `Error parsing "${packageName}": The scope must be followed by a slash`;
return result;

@@ -52,3 +52,3 @@ }

if (result.scope === '@') {
result.error = 'The scope name cannot be empty';
result.error = `Error parsing "${packageName}": The scope name cannot be empty`;
return result;

@@ -63,3 +63,3 @@ }

if (result.unscopedName[0] === '.' || result.unscopedName[0] === '_') {
result.error = 'The package name starts with an invalid character';
result.error = `The package name "${packageName}" starts with an invalid character`;
return result;

@@ -72,3 +72,3 @@ }

if (nameWithoutScopeSymbols !== nameWithoutScopeSymbols.toLowerCase()) {
result.error = 'The package name must not contain upper case characters';
result.error = `The package name "${packageName}" must not contain upper case characters`;
return result;

@@ -80,3 +80,3 @@ }

if (match) {
result.error = `The package name contains an invalid character: "${match[0]}"`;
result.error = `The package name "${packageName}" contains an invalid character: "${match[0]}"`;
return result;

@@ -119,2 +119,8 @@ }

/**
* Throws an exception if the specified name is not a valid package name.
*/
static validate(packageName) {
PackageName.parse(packageName);
}
/**
* Combines an optional package scope with an unscoped root name.

@@ -148,3 +154,3 @@ * @param scope - Must be either an empty string, or a scope name such as "\@example"

// Make sure the result is a valid package name
PackageName.parse(result);
PackageName.validate(result);
return result;

@@ -151,0 +157,0 @@ }

@@ -36,3 +36,3 @@ "use strict";

unscopedName: '',
error: 'The scope must be followed by a slash'
error: 'Error parsing "@microsoft": The scope must be followed by a slash'
});

@@ -42,3 +42,3 @@ chai_1.assert.deepEqual(PackageName_1.PackageName.tryParse('@/node-core-library'), {

unscopedName: 'node-core-library',
error: 'The scope name cannot be empty'
error: 'Error parsing "@/node-core-library": The scope name cannot be empty'
});

@@ -48,3 +48,3 @@ chai_1.assert.deepEqual(PackageName_1.PackageName.tryParse('@Microsoft/node-core-library'), {

unscopedName: 'node-core-library',
error: 'The package name must not contain upper case characters'
error: 'The package name "@Microsoft/node-core-library" must not contain upper case characters'
});

@@ -54,3 +54,3 @@ chai_1.assert.deepEqual(PackageName_1.PackageName.tryParse('@micro!soft/node-core-library'), {

unscopedName: 'node-core-library',
error: 'The package name contains an invalid character: \"!\"'
error: 'The package name "@micro!soft/node-core-library" contains an invalid character: \"!\"'
});

@@ -60,3 +60,3 @@ chai_1.assert.deepEqual(PackageName_1.PackageName.tryParse('@microsoft/node-co~re-library'), {

unscopedName: 'node-co~re-library',
error: 'The package name contains an invalid character: \"~\"'
error: 'The package name "@microsoft/node-co~re-library" contains an invalid character: \"~\"'
});

@@ -66,3 +66,3 @@ chai_1.assert.deepEqual(PackageName_1.PackageName.tryParse('@microsoft/node-core-library/path'), {

unscopedName: 'node-core-library/path',
error: 'The package name contains an invalid character: \"/\"'
error: 'The package name "@microsoft/node-core-library/path" contains an invalid character: \"/\"'
});

@@ -80,3 +80,3 @@ });

chai_1.assert.throws(() => { PackageName_1.PackageName.combineParts('', '@microsoft/node-core-library'); }, 'The unscopedName cannot start with an "@" character');
chai_1.assert.throws(() => { PackageName_1.PackageName.combineParts('@micr!osoft', 'node-core-library'); }, 'The package name contains an invalid character: "!"');
chai_1.assert.throws(() => { PackageName_1.PackageName.combineParts('@micr!osoft', 'node-core-library'); }, 'The package name "@micr!osoft/node-core-library" contains an invalid character: "!"');
chai_1.assert.throws(() => { PackageName_1.PackageName.combineParts('', ''); }, 'The package name must not be empty');

@@ -83,0 +83,0 @@ });

{
"name": "@microsoft/node-core-library",
"version": "1.1.0",
"version": "1.2.0",
"description": "Core libraries that every NodeJS toolchain project should use",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc