Socket
Socket
Sign inDemoInstall

left-phalange-api

Package Overview
Dependencies
30
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    left-phalange-api

CommonJS, ESModule, INI, JSON, JSON5, TOML, YAML data loader, parser and stringifier


Version published
Weekly downloads
33
increased by73.68%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

left-phalange-api

CommonJS, ESModule, INI, JSON, JSON5, TOML, YAML data loader, parser and stringifier

Install

yarn add left-phalange-api

Usage

import {parse, load, stringify} from 'left-phalange-api'

load(file[, options])

  • file
    • Data file path to load
  • options
    • Optional
    • Type Object | String
    • Default {}
  • options(String)
    • options.type
  • options.type
    • Data type of file
    • Should be one of cjs, esm, ini, js, json, json5, toml, yaml

examples:

load('path/to/data.json')

load('path/to/data', 'yaml')

load('path/to/data', {type: 'toml'})

parse(string[, options])

  • string
    • type: String
    • string to parse
  • options
    • Optional
    • Type Object | String
    • Default {}
  • options(String)
    • options.type
  • options.type
    • Data type of string
    • Default yaml
    • Should be one of ini, json, json5, toml, yaml
  • options.filename
    • Filename displayed in the error message.

examples:

parse('{"left": "phalange"}')

parse('{"left": "phalange"}', 'json')

parse('left = "phalange"', {type: 'toml'})

parse('left = phalange', {filename: 'path/to/data.yml'})

stringify(data[, options])

  • data
    • Data to stringify
  • options
    • Optional
    • Type Object | String | Boolean
    • Default {}
  • options(String)
    • options.type
  • options(Boolean)
    • options.pretty
  • options.type
    • Data type of string
    • Default json
    • Should be one of cjs, esm, ini, json, json5
  • options.pretty
    • Pretty output
    • Default false

examples:

stringify({left: 'phalange'})
// {"left": "phalange"}

stringify({left: 'phalange'}, 'toml')
// left = "phalange"

stringify({left: 'phalange'}, true)
// {
//   "left": "phalange"
// }

stringify({left: 'phalange'}, {type: 'json5', pretty: true})
// {
//   left: 'phalange',
// }
  • left-phalange - CLI for this module

License

MIT © fisker Cheung

Keywords

FAQs

Last updated on 27 Oct 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc