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

to-path

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

to-path

Converts string to a property path array.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
increased by67.88%
Maintainers
1
Weekly downloads
 
Created
Source

to-path

Converts string to a property path array.

MIT License

build:? coverage:?

Install

$ npm install --save to-path 

Usage

For more use-cases see the tests

var toPath = require('to-path');

toPath('a');          // => ['a']
toPath('a.b.c');      // => ['a', 'b', 'c']
toPath('a[0].b.c');   // => ['a', '0', 'b', 'c']
toPath('a[x].b.c');   // => ['a', 'x', 'b', 'c']
toPath('a["x"].b.c'); // => ['a', 'x', 'b', 'c']
toPath(0);            // => ['0']
toPath([1, 2, 3]);    // => ['1', '2', '3']
  • object-at - Get object's property according to the path.
  • object-has - Checks if path is a direct property of object.
  • object-set - Sets the value at path of object.
  • object-unset - Removes the property at path of object.

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.

Keywords

FAQs

Package last updated on 15 Apr 2016

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