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

clubhouse-cli

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clubhouse-cli - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

package.json
{
"name": "clubhouse-cli",
"version": "1.0.0",
"version": "1.1.0",
"description": "A command line tool for viewing, creating and updating clubhouse.io stories",

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

@@ -67,2 +67,3 @@ # clubhouse-cli

-f, --format [template] Format each story output by template
-r, --sort [field] Sort stories by field (accessor[:asc|desc][,next])
-h, --help output usage information

@@ -112,2 +113,6 @@ ~~~

#### Story Output Sorting
The default sorting for stories found is `state.position:asc,id:asc`, which translates to "sort by associated state position ascending, then by story id ascending within the same state."
### Story

@@ -114,0 +119,0 @@

@@ -27,3 +27,4 @@ const chalk = require('chalk');

return a.concat(b);
}, []);
}, [])
.sort(sortStories(program));
};

@@ -96,2 +97,34 @@ const fetchStories = async (project) => {

};};
const sortStories = (program) => {
const fields = program.sort
.split(',')
.map(s => {
return s.split(':')
.map(ss => ss.split('.'));
});
const pluck = (acc, val) => {
if (acc[val] === undefined)
return {};
return acc[val];
};
return (a, b) => {
return fields.reduce((acc, field) => {
if (acc !== 0)
return acc;
const ap = field[0].reduce(pluck, a);
const bp = field[0].reduce(pluck, b);
if (ap === bp)
return 0;
const direction = (field[1] || [''])[0].match(/des/i) ? 1 : -1;
if (ap > bp) {
if (direction > 0)
return -1;
} else {
if (direction < 0)
return -1;
}
return 1;
}, 0);
};
};

@@ -98,0 +131,0 @@ const printStory = (program) => { return (story) => {

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