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 0.2.8 to 0.2.9

14

CHANGELOG.json

@@ -5,2 +5,16 @@ {

{
"version": "0.2.9",
"tag": "@microsoft/node-core-library_v0.2.9",
"date": "Fri, 08 Sep 2017 13:04:00 GMT",
"comments": {
"patch": [
{
"author": "pgonzal <pgonzal@users.noreply.github.com>",
"commit": "15489abe9063eb522c0adaff0f17ba7f9400c074",
"comment": "Improve error reporting for JsonFile.validateNoUndefinedMembers()"
}
]
}
},
{
"version": "0.2.8",

@@ -7,0 +21,0 @@ "tag": "@microsoft/node-core-library_v0.2.8",

9

CHANGELOG.md
# Change Log - @microsoft/node-core-library
This log was last generated on Fri, 08 Sep 2017 01:28:04 GMT and should not be manually modified.
This log was last generated on Fri, 08 Sep 2017 13:04:00 GMT and should not be manually modified.
## 0.2.9
Fri, 08 Sep 2017 13:04:00 GMT
### Patches
- Improve error reporting for JsonFile.validateNoUndefinedMembers()
## 0.2.8

@@ -6,0 +13,0 @@ Fri, 08 Sep 2017 01:28:04 GMT

@@ -64,2 +64,4 @@ import { JsonSchema, IJsonSchemaErrorInfo, IJsonSchemaValidateOptions } from './JsonSchema';

static validateNoUndefinedMembers(jsonObject: Object): void;
private static _validateNoUndefinedMembers(jsonObject, keyPath);
private static _formatKeyPath(keyPath);
/**

@@ -66,0 +68,0 @@ * Returns the same thing as targetString.replace(searchValue, replaceValue), except that

@@ -110,2 +110,6 @@ "use strict";

JsonFile.validateNoUndefinedMembers = function (jsonObject) {
return JsonFile._validateNoUndefinedMembers(jsonObject, []);
};
// Private implementation of validateNoUndefinedMembers()
JsonFile._validateNoUndefinedMembers = function (jsonObject, keyPath) {
if (!jsonObject) {

@@ -117,11 +121,42 @@ return;

var key = _a[_i];
keyPath.push(key);
// tslint:disable-next-line:no-any
var value = jsonObject[key];
if (value === undefined) {
throw new Error("The key \"" + key + "\" is undefined");
var fullPath = JsonFile._formatKeyPath(keyPath);
throw new Error("The value for " + fullPath + " is undefined");
}
JsonFile.validateNoUndefinedMembers(value);
JsonFile._validateNoUndefinedMembers(value, keyPath);
keyPath.pop();
}
}
};
// Given this input: ['items', '4', 'syntax', 'parameters', 'string "with" symbols", 'type']
// Return this string: items[4].syntax.parameters["string \"with\" symbols"].type
JsonFile._formatKeyPath = function (keyPath) {
var result = '';
for (var _i = 0, keyPath_1 = keyPath; _i < keyPath_1.length; _i++) {
var key = keyPath_1[_i];
if (/^[0-9]+$/.test(key)) {
// It's an integer, so display like this: parent[123]
result += "[" + key + "]";
}
else if (/^[a-z_][a-z_0-9]*$/i.test(key)) {
// It's an alphanumeric identifier, so display like this: parent.name
if (result) {
result += '.';
}
result += "" + key;
}
else {
// It's a freeform string, so display like this: parent["A path: \"C:\\file\""]
// Convert this: A path: "C:\file"
// To this: A path: \"C:\\file\"
var escapedKey = key.replace(/[\\]/g, '\\\\') // escape backslashes
.replace(/["]/g, '\\'); // escape quotes
result += "[\"" + escapedKey + "\"]";
}
}
return result;
};
/**

@@ -128,0 +163,0 @@ * Returns the same thing as targetString.replace(searchValue, replaceValue), except that

2

package.json
{
"name": "@microsoft/node-core-library",
"version": "0.2.8",
"version": "0.2.9",
"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

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