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

synonomous

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

synonomous - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

20

index.js

@@ -5,3 +5,3 @@ 'use strict';

var optionNames = ['transformations', 'propPath', 'dictPath'];
var optionNames = ['transformations', 'propPath', 'dictPath', 'force'];

@@ -14,5 +14,6 @@ /**

* @param {object} [options]
* @param {string[]} [transformations] - If omitted, {@link Synonomous.prototype.transformations} serves as a default.
* @param {string} [propPath] - If omitted, {@link Synonomous.prototype.propPath} serves as a default.
* @param {string} [dictPath] - If omitted, {@link Synonomous.prototype.dictPath} serves as a default.
* @param {string[]} [options.transformations] - If omitted, {@link Synonomous.prototype.transformations} serves as a default.
* @param {string} [options.propPath] - If omitted, {@link Synonomous.prototype.propPath} serves as a default.
* @param {string} [options.dictPath] - If omitted, {@link Synonomous.prototype.dictPath} serves as a default.
* @param {boolean} [options.force=false] - If truthy, new property values override existing values; else new values are discarded.
* @constructor

@@ -141,8 +142,11 @@ */

decorate: function(obj, propNames, item) {
var drilldownContext = drilldown(obj, this.dictPath);
var drilldownContext = drilldown(obj, this.dictPath),
force = this.force;
propNames.forEach(function(propName) {
if (!(propName in drilldownContext)) {
if (force || !(propName in drilldownContext)) {
drilldownContext[propName] = item;
}
});
return obj;

@@ -240,3 +244,5 @@ },

drillDownContext[propName] = transformer(value);
if (this.force || !(propName in drillDownContext)) {
drillDownContext[propName] = transformer(value);
}
}

@@ -243,0 +249,0 @@

{
"name": "synonomous",
"version": "2.1.0",
"version": "2.1.1",
"description": "Decorate an array instance with synonyms of its elements",

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

@@ -239,2 +239,3 @@ # synonomous

* **2.1.1** — Added `force` property to force overwriting existing property values with new values. Otherwise new values are discarded.
* **2.1.0** — `transformations` property can now be an object as well an array of strings. The keys of the object name the transformers. The values are not used by `decorateObject` but are used by `decorateArray` to add new string properties to each element.

@@ -241,0 +242,0 @@ * **2.0.1**

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