Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@gotamedia/shapeshifter

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gotamedia/shapeshifter

Shapeshifter is a general format converter. It converts strings of one format (shape) into a string of another.

latest
Source
npmnpm
Version
0.10.0
Version published
Maintainers
3
Created
Source

Shapeshifter

Shapeshifter is a general format converter. It converts strings of one format (shape) into a string of another.

  • Installation
  • Usage
  • License

Installation

npm install @gotamedia/shapeshifter

Usage

API

const { OpenContentShapeProvider, ShapeBuilder } = require("@gotamedia/shapeshifter");

const shape = await new ShapeBuilder()
    .useShapeProvider(new OpenContentShapeProvider())
    .useInput(inputString)
    .build();

console.log(shape.shift());

That's it! You can use any number of shape providers or plug in your own. To enable all available shape providers you can use a shape provider resolver.

const { ShapeBuilder, ShapeProviderResolver } = require("@gotamedia/shapeshifter");

const shape = await new ShapeBuilder()
    .useShapeProviderResolver(new ShapeProviderResolver("/path/to/shape/providers/"))
    .useInput(inputString)
    .build();

console.log(shape.shift());

This saves you from updating the code anytime you want to use additional shape providers.

CLI

Shapeshifter also comes with a convenient CLI tool. You can use it to convert shapes in npm scripts or simply on the command line.

The shapeshifter command accepts input as stdin. This makes it easy to use with pipes. Here is a simple example using curl on the command line to fetch and convert an article from Open Content.

curl --silent --user [credentials] http://xlibris.oc.gota.infomaker.io:8080/opencontent/objects/[uuid] | shapeshifter

And here is an example of converting an article in a file.

shapeshifter < [path/to/article].xml

License

Shapeshifter is released under the MIT License.

FAQs

Package last updated on 15 Nov 2022

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