
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
reed-richards
Advanced tools
You initialize a counter with the ordered column keys of your data.
If you try to count data that is missing any of these values the counter will throw.
Function accepts a order list of column names. If you attempt
to set() a row w/o one of the required columns it will throw.
const { collection, counter, quarter } = require('./')
const c = counter('first', 'second', 'third')
const data = { first: 'one', second: 'two', third: 3 }
c.count(data)
const rows = Array.from(c.rows())
rows === [['one', 'two', 3, 1]])
Returns a generator that yields an array for every line in the counter.
const c = counter('first', 'second', 'third')
const data = { first: 'one', second: 'two', third: 3 }
c.count(data)
c.count(data)
c.count(data)
data.second = 'test'
c.count(data)
const row = Array.from(c.rows())
row === [['one', 'two', 3, 3], ['one', 'test', 3, 1]])
Returns a generator of objects the gives the counts of unique keys rather than the counter values.
const c = counter('first', 'second', 'third')
const data = { first: 'one', second: 'two', third: 3 }
c.count(data)
c.count(data)
data.third = 'test'
c.count(data)
data.second = 'foo'
c.count(data)
const row = Array.from(c.unique())
row === [
{ first: 'one', second: 'two', third: 2 },
{ first: 'one', second: 'foo', third: 1 }
]
A generator that yields objects for every row in the counter.
const c = counter('first', 'second', 'third')
const data = { first: 'one', second: 'two', third: 3 }
c.count(data)
c.count(data)
data.third = 'test'
c.count(data)
data.second = 'foo'
c.count(data)
const rows = Array.from(c.objects())
rows === [
{ first: 'one', second: 'two', third: 3, count: 2 },
{ first: 'one', second: 'two', third: 'test', count: 1 },
{ first: 'one', second: 'foo', third: 'test', count: 1 }
]
Function accepts a order list of column names. If you attempt
to set() a row w/o one of the required columns it will throw.
const c = collection('quarter', 'lang', 'count')
c.set({ quarter: 'q1', lang: 'ruby', count: 1000 })
c.set({ quarter: 'q1', lang: 'ruby', count: 2000 })
c.set({ quarter: 'q1', lang: 'js', count: 1000 })
c.set({ quarter: 'q2', lang: 'ruby', count: 3000 })
c.set({ quarter: 'q2', lang: 'js', count: 2000 })
const red = (prev, data) => {
if (prev) t.ok(data.count - prev === 1000)
t.ok(data)
return data.count
}
const rows = Array.from(c.reduce(red))
t.same(rows, [2000, 1000, 3000, 2000])
Accepts a datetime object and returns a string for the year and quarter the time falls under.
assert.equal(quarter(new Date('2018-01-02')), '2018 Q1')
assert.equal(quarter(new Date('2018-04-02')), '2018 Q2')
assert.equal(quarter(new Date('2018-08-02')), '2018 Q3')
assert.equal(quarter(new Date('2018-12-02')), '2018 Q4')
FAQs
Utilities for metrics processing
We found that reed-richards demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.