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

imito

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imito

copy and transform primitives and single or multiple objects

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

OPEN open source software

imito

NOTE: Currently the eventual structure of the API of this module is being experimented on so please don't rely on it remaining the same from version to version until further note. This also explains the current absense of examples. Hopefully I will nail down enough of this shortly so I'll be able to provide more documentation.

This module will eventually provide functionality for transforming primitives and objects into other objects or primitivs while duplicating them. There are many targeted use cases, so here are some common examples:

  • deep copy - duplicate the entire object
  • mixed copy - duplicate the object while leaving some references pointing to the same sub object as the original
  • deep compare - transform two or more objects (i.e. one array of two or more objects) into a boolean value (true if the objects are the same, false otherwise)
  • remove circular references - duplicate the entire object while replacing circular reference with other values
  • unhide hidden properties - transform an object into one with all the hidden properties unhidden.
  • generate HTML from an object - transform an object into a string containing valid HTML
  • transform XML string into an object

There are many more uses, but importantly imito will support easy customization of these transformations. Transformation configurations can be chained so you only need to specify a changed behavior, not the entire transformation. Thus you can start with a plain "deep copy" transformation and then specify that a property .some.other should be changed to some other value. You can also use chaining to "compose" transformations. For instance, if you have one transformation that can create an object out of XML and another that can convert an object to HTML then you can chain them together to generate HTML from XML. A number of predefined transformations will be provided so you can use them by name rather than having to specify the full syntax. Additionally, you can "register" new custom transformations (including any chanined ones) so that you can refer to them by name as well.

FAQs

Package last updated on 26 Feb 2019

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