New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-summary

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-summary - npm Package Compare versions

Comparing version
1.0.0
to
1.0.1
+2
-1
examples/App.js

@@ -10,3 +10,4 @@ import React, { Component } from 'react';

<Summary items={['hey', 'foo', 'bar', 'selam']}
max={2}
max={3}
preventSingleRemaining={false}
onShowOthers={this.showOthers} />

@@ -13,0 +14,0 @@ </div>

{
"name": "react-summary",
"version": "1.0.0",
"version": "1.0.1",
"description": "React summaries",

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

@@ -39,6 +39,9 @@ React-Summary

| text | Object. Explained on the following table. | Translations of visible texts |
| preventSingleRemain | false | Prints the last item instead of `and 1 more` text |
| onShowOthers | No-op function | Callback function for `show others` link |
| preventSingleRemaining | false | Prints the last item instead of `and 1 more` text |
| onShowOthers | No-op | Callback function for `show others` link |
| itemRenderer | Identity (returns given parameter) | A wrapper function for styling items |
To styling items, you can provide react components instead of using itemRenderer.
Translation strings:

@@ -45,0 +48,0 @@

@@ -13,4 +13,5 @@ import React, { Component } from 'react';

},
onShowOthers() {},
preventSingleRemain: false
onShowOthers: () => {},
itemRenderer: (item) => item,
preventSingleRemaining: false
};

@@ -26,13 +27,14 @@

let {items, text, max,
preventSingleRemain} = this.props;
itemRenderer,
preventSingleRemaining} = this.props;
switch (items.length) {
case 0:
return text.none;
return itemRenderer(text.none);
case 1:
return items[0];
return itemRenderer(items[0]);
case 2:
case max:
case preventSingleRemain && max + 1:
case preventSingleRemaining && max + 1:

@@ -45,3 +47,3 @@ return (

{i > 0 ? ', ' : null}
{item}
{itemRenderer(item)}
</span>

@@ -59,3 +61,3 @@ ) : null

{i > 0 && i < max ? ', ': null}
{i < max ? item : null}
{i < max ? itemRenderer(item) : null}
{i === max && (

@@ -62,0 +64,0 @@ <span>