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

reftools

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reftools

Utility functions to deal with references in objects

  • 0.0.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4M
decreased by-2.59%
Maintainers
1
Weekly downloads
 
Created

What is reftools?

The reftools npm package is a utility library designed for managing and manipulating JSON references within JavaScript objects. It provides tools for resolving, merging, and cloning JSON references, making it useful for handling complex JSON structures that include internal references.

What are reftools's main functionalities?

resolve

This feature resolves JSON references within the document. It replaces references with the actual data they refer to, simplifying the structure for easier manipulation and access.

const reftools = require('reftools');
let doc = { a: { b: { $ref: '#/c' } }, c: { d: 'hello' } };
let resolved = reftools.resolve(doc);
console.log(resolved);

merge

This feature merges two JavaScript objects, incorporating properties from the source object into the destination object. It's particularly useful for combining configurations or settings.

const reftools = require('reftools');
let src = { a: 1 };
let dst = { b: 2 };
reftools.merge(src, dst);
console.log(dst);

clone

This feature creates a deep clone of an object, including resolving any internal JSON references. This is useful for creating independent copies of complex objects that include references.

const reftools = require('reftools');
let original = { a: { b: { $ref: '#/c' } }, c: { d: 'hello' } };
let cloned = reftools.clone(original);
console.log(cloned);

Other packages similar to reftools

Keywords

FAQs

Package last updated on 31 Oct 2017

Did you know?

Socket

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.

Install

Related posts

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