New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

append-to-all-attributes

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

append-to-all-attributes - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

16

index.js
module.exports = (object, stringToAppend) => {
const new_object = {};
for (const [key, value] of Object.entries(object)) {
new_object[`${key}${stringToAppend}`] = value;
if (Array.isArray(object)) {
const new_array = [];
object.forEach((item, index) => {
new_array[index] = module.exports(item, stringToAppend);
});
return new_array;
} else {
const new_object = {};
for (const [key, value] of Object.entries(object)) {
new_object[`${key}${stringToAppend}`] = value;
}
return new_object;
}
return new_object;
};
{
"name": "append-to-all-attributes",
"version": "1.0.2",
"version": "1.0.3",
"description": "Append a string to all attributes in the object passed",

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

@@ -25,1 +25,37 @@ import test from 'ava';

});
test('append _triplet to array', t => {
t.deepEqual(
appendToAllAttributes(
[
{
cms: {
status: 'GOOD',
comment: '',
cause: ''
},
csc: {
status: 'BAD',
comment: '',
cause: ''
}
}
],
'_triplet'
),
[
{
cms_triplet: {
status: 'GOOD',
comment: '',
cause: ''
},
csc_triplet: {
status: 'BAD',
comment: '',
cause: ''
}
}
]
);
});
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