
Security News
curl Shuts Down Bug Bounty Program After Flood of AI Slop Reports
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.
namespace-data
Advanced tools
Read data files and extend the data from each onto an object or objects named using the given string or [propstring].

Read data files and extend the data from each onto an object or objects named using the given string or [propstring].
Install with npm:
npm i namespace-data --save-dev
var namespace = require('namespace-data');
console.log(namespace(':basename', 'package.json'));
//=> {"package": {"name": "namespace-data", "version": "0.1.0" ...}}
namespace(':propstring', [glob], {context: {}});
:propstring A variable, like a template, which will be replaced with the
value of any matching property on the context. You can use any prop strings that
match properties on the context. The default context consists of all the method
names from the node.js path module, (e.g. :basename, :extname, etc.)glob: File path, paths or glob patterns for data files to read.context: Extend the context to enable additional values to be used as propstrings.Read data files and extend the data from each onto an object or objects named using the given string or propstring.
Given you have two JSON files, a.json and b.json, with the following contents:
// a.json
{
"foo": "I'm a.json!"
}
// b.json
{
"bar": "I'm b.json!"
}
propstrings
You can namespace the data from each file onto an object where the object name is
dynamically generated using :propstrings.
data.namespace(':basename', ['a.json', 'b.json']);
//=> '{ "a": {"foo": "I'm a.json!"}, "b": {"bar": "I'm b.json!"} }'
// if a single argument is passed, `basename` is used by default, so this:
data.namespace(['a.json', 'b.json']);
// also results in '{ "a": {"foo": "I'm a.json!"}, "b": {"bar": "I'm b.json!"} }'
Same data but namespaced using :ext (file extension) instead:
data.namespace(':ext', ['a.json', 'b.json']);
{ "json": {"foo": "I'm a.json!", "bar": "I'm b.json!"} }
patterns {*}: Filepaths or glob patterns.return {null}Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on July 19, 2014.
FAQs
Read data files and extend the data from each onto an object or objects named using the given string or [propstring].
We found that namespace-data 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
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.