New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zodash/to-path

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zodash/to-path - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [0.1.7](https://github.com/zcorky/zodash/compare/@zodash/to-path@0.1.6...@zodash/to-path@0.1.7) (2022-01-06)
**Note:** Version bump only for package @zodash/to-path
## [0.1.6](https://github.com/zcorky/zodash/compare/@zodash/to-path@0.1.5...@zodash/to-path@0.1.6) (2021-09-22)

@@ -8,0 +16,0 @@

5

lib/to-path.d.ts

@@ -20,3 +20,6 @@ /**

* // => ['a', '[]', 'b', 'c']
*
* toPath('SERVICE_CONFIG_ID', '_')
* // => ['SERVICE', 'CONFIG', 'ID']
*/
export declare function toPath(pathString: string): string[];
export declare function toPath(pathString: string, separator?: string): string[];

11

lib/to-path.js

@@ -23,11 +23,14 @@ "use strict";

* // => ['a', '[]', 'b', 'c']
*
* toPath('SERVICE_CONFIG_ID', '_')
* // => ['SERVICE', 'CONFIG', 'ID']
*/
function toPath(pathString) {
function toPath(pathString, separator = '.') {
if (!pathString)
return [];
return pathString
.replace(/\[(\w+)\]/g, '.$1')
.replace(/(\[\])/g, '.$1')
.split('.');
.replace(/\[(\w+)\]/g, `${separator}$1`)
.replace(/(\[\])/g, `${separator}$1`)
.split(separator);
}
exports.toPath = toPath;
{
"name": "@zodash/to-path",
"version": "0.1.6",
"version": "0.1.7",
"description": "Transform path string to path array",

@@ -70,3 +70,3 @@ "keywords": [

},
"gitHead": "94dc8d1577cd67a4cf89884b10c23eb9caeef9f7"
"gitHead": "4ec13e4134583b9ce15b6b9b4eb2dbc1dabbc6ee"
}
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