Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More โ†’
Socket
Sign inDemoInstall
Socket

properties-file

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

properties-file - npm Package Compare versions

Comparing version 3.2.1 to 3.2.2

9

lib/editor/index.js

@@ -27,4 +27,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PropertiesEditor=exports.DEFAULT_SEPARATOR=exports.DEFAULT_COMMENT_DELIMITER=void 0;var _escape=require("../escape"),_properties=require("../properties");/** The default separator between keys and values. */const DEFAULT_SEPARATOR="=";/** The default character used as comment delimiter. */exports.DEFAULT_SEPARATOR="=";const DEFAULT_COMMENT_DELIMITER="#";/** Characters that can be used as key-value pair separators. */ /** Characters that can be used as comment delimiters. */ /** Options on the `Properties.insert` method. */ /** Options on the `Properties.insertComment` method. */ /** Options on the `Properties.update` method. */ /** Options on the `Properties.upsert` method. */exports.DEFAULT_COMMENT_DELIMITER="#";/**

* @returns True if the comment was inserted, otherwise false.
*/insertComment(a,b){const c=null===b||void 0===b?void 0:b.referenceKey,d=(null===b||void 0===b?void 0:b.position)||"after",e="".concat((null===b||void 0===b?void 0:b.commentDelimiter)||DEFAULT_COMMENT_DELIMITER," "),f="".concat(e).concat(a)// eslint-disable-next-line unicorn/prefer-string-replace-all
.replace(/\r?\n/g,"\n".concat(e)).split(/\n/);// Allow multiline comments.
*/insertComment(a,b){const c=null===b||void 0===b?void 0:b.referenceKey,d=(null===b||void 0===b?void 0:b.position)||"after",e="".concat((null===b||void 0===b?void 0:b.commentDelimiter)||DEFAULT_COMMENT_DELIMITER," "),f="".concat(e).concat(a).replace(/\r?\n/g,"\n".concat(e)).split(/\n/);// Allow multiline comments.
if(void 0===c)return this.lines.push(...f),this.parseLines(),!0;else{// Find the last occurrence of the reference key.

@@ -47,4 +46,3 @@ const a=[...this.collection].reverse().find(a=>a.key===c);// Insert the new comment when a reference key defined only when found.

*/getKeyWithNewlines(a){return 0===a.newlinePositions.length?a.key:// eslint-disable-next-line unicorn/no-array-reduce
[...a.key].reduce((b,c,d)=>// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
"".concat(b).concat(a.newlinePositions.includes(d)?"\n":"").concat(c),"")}/**
[...a.key].reduce((b,c,d)=>"".concat(b).concat(a.newlinePositions.includes(d)?"\n":"").concat(c),"")}/**
* Restore the original newline characters of a value.

@@ -56,4 +54,3 @@ *

*/getValueWithNewlines(a){return 0===a.newlinePositions.length||a.valuePosition===void 0?a.value:// eslint-disable-next-line unicorn/no-array-reduce
[...a.value].reduce((b,c,d)=>"".concat(b).concat(a.newlinePositions.includes(d+a.valuePosition)?"\n":""// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
).concat(c),"")}/**
[...a.value].reduce((b,c,d)=>"".concat(b).concat(a.newlinePositions.includes(d+a.valuePosition)?"\n":"").concat(c),"")}/**
* Update the last occurrence of a given key from the existing object.

@@ -60,0 +57,0 @@ *

@@ -52,4 +52,2 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getFirstEolCharacter=exports.Properties=exports.KeyCollisions=exports.DEFAULT_END_OF_LINE_CHARACTER=exports.BOM_CODE_POINT=exports.BOM=void 0;var _property=require("./property"),_propertyLine=require("./property-line");function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _toPrimitive(a,b){if("object"!=typeof a||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}/**

* Get the number of the line from which the value will be used.
*/getApplicableLineNumber(){// return this.startingLineNumbers.at(-1)
// eslint-disable-next-line unicorn/prefer-at
return this.startingLineNumbers.slice(-1)[0]}}exports.KeyCollisions=KeyCollisions;
*/getApplicableLineNumber(){return this.startingLineNumbers.slice(-1)[0]}}exports.KeyCollisions=KeyCollisions;
{
"name": "properties-file",
"version": "3.2.1",
"version": "3.2.2",
"description": ".properties file parser, editor, formatter and Webpack loader.",

@@ -72,4 +72,4 @@ "keywords": [

"@types/jest": "29.5.1",
"@typescript-eslint/eslint-plugin": "5.59.2",
"@typescript-eslint/parser": "5.59.2",
"@typescript-eslint/eslint-plugin": "5.59.5",
"@typescript-eslint/parser": "5.59.5",
"babel-preset-minify": "^0.5.2",

@@ -76,0 +76,0 @@ "check-node-version": "^4.2.1",

@@ -13,3 +13,3 @@ # properties-file

> โš  In April 2023, we released version 3 of this package, which includes breaking changes. Please refer to the [migration guide](./V2-TO-V3-MIGRATION-GUIDE.md) before upgrading.
> โš  In April 2023, we released version 3 of this package, which includes breaking changes. Please refer to the [upgrade guide](./V2-TO-V3-UPGRADE-GUIDE.md) before upgrading.

@@ -16,0 +16,0 @@ Add the package as a dependency:

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