
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
The primary function of this library is to fill in the gaps in data for charting libraries. Many charting libraries, d3 comes to mind, does handle missing data well when dealing with multi-dimensional data.
By multi-dimensional data I simply mean where there are groups of data which should contain a consistent set of x values.
This may look like:
[
{company: 'acme', x: 1, y: 99},
{company: 'acme', x: 2, y: 70},
{company: 'acme', x: 4, y: 99},
{company: 'foomaker', x: 1, y: 102},
{company: 'foomaker', x: 2, y: 99},
{company: 'foomaker', x: 3, y: 99}
]
In the above example the following data is missing:
[
{company: 'acme', x: 3, y: ?},
{company: 'foomaker', x: 4, y: ?}
]
Keygaps comes to the rescue here and helps fill in the missing data.
npm install keygaps
I suggest using Webpack, Browserify, ect. to provide an environment with require.
fillValues = require('keygaps').fillValues
# Create data with missing keys
data = [
{category: 'a', x: 1, y: 10},
{category: 'b', x: 2, y: 11},
{category: 'c', x: 1, y: 10},
{category: 'd', x: 2, y: 10},
]
# Create a valueFunction to tell how to deserialize the key
# arguments[0] is the ev array passed below
valueFunction = ->
obj = {}
obj['category'] = arguments[0][0]
obj['x'] = arguments[0][1]
obj
output = Keygaps.fillValues({
values: data,
# Create a keyFunction to know how to group the data
keyFunction: (input) -> [input.category, input.x],
valueFunction: valueFunction
})
# object.missingValues
{
"a:2": { "category": "a", "x": 2, "y": 0 },
"b:1": { "category": "b", "x": 1, "y": 0 },
"c:2": { "category": "c", "x": 2, "y": 0 },
"d:1": { "category": "d", "x": 1, "y": 0 }
}
# output.values
[
{ "category": "a", "x": 1, "y": 10 },
{ "category": "b", "x": 2, "y": 11 },
{ "category": "c", "x": 1, "y": 10 },
{ "category": "d", "x": 2, "y": 10 },
{ "category": "a", "x": 2, "y": 0 },
{ "category": "b", "x": 1, "y": 0 },
{ "category": "c", "x": 2, "y": 0 },
{ "category": "d", "x": 1, "y": 0 }
]
npm run test
npm run dev
npm run test
npm run test
gg c <msg>
npm-release patch
gg represents git goodies, it's just nice. The npm-release docs can be found @ https://github.com/phuu/npm-release
FAQs
Fill in key values for time series data
The npm package keygaps receives a total of 0 weekly downloads. As such, keygaps popularity was classified as not popular.
We found that keygaps 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.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.