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

dot-wild

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot-wild - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## v2.2.0 (2017-05-23)
* Add helper methods
- `buildPath()`
## v2.1.0 (2017-05-18)

@@ -2,0 +8,0 @@

4

lib/index.d.ts

@@ -41,4 +41,8 @@ /**

/**
* Build path from Tokens like array
*/
export declare const buildPath: (tokens: (string | number)[]) => string;
/**
* Check contains of wildcard syntax
*/
export declare const containWildcardToken: (path: string) => boolean;

@@ -397,4 +397,8 @@ "use strict";

/**
* Build path from Tokens like array
*/
exports.buildPath = function (tokens) { return (tokens.map(function (token) { return exports.escapePath("" + token); }).join('.')); };
/**
* Check contains of wildcard syntax
*/
exports.containWildcardToken = function (path) { return (!isString(path) ? false : exports.tokenize(path).some(function (p) { return p === '*'; })); };
exports.containWildcardToken = function (path) { return (!isString(path) ? false : exports.tokenize(path).indexOf('*') > -1); };

2

package.json
{
"name": "dot-wild",
"version": "2.1.0",
"version": "2.2.0",
"description": "Use powerful dot notation (dot path + wildcard) to manipulate properties of JSON",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -1,3 +0,2 @@

dot-wild
========
# dot-wild

@@ -209,2 +208,12 @@ [![Build Status](http://img.shields.io/travis/tsuyoshiwada/dot-wild.svg?style=flat-square)](https://travis-ci.org/tsuyoshiwada/dot-wild)

/**
* Build path from Tokens like array
*/
dot.buildPath(['foo', 'bar', 'baz']);
// => 'foo.bar.baz'
dot.buildPath([1, '[2]', 3, '["foo"]', 'bar.baz']);
// => '1.2.3.foo.bar\\.baz'
/**
* Check contains wildcard token

@@ -236,4 +245,7 @@ */

* `map(data, path, iteratee): any[]`
* `tokenize(path): string[]`
* `matchPath(pathA, pathB): boolean`
* `escapePath(path): string`
* `buildPath(tokens)[]): string`
* `containWilcardToken(path): boolean`

@@ -265,4 +277,11 @@

#### tokens
**type: `(string | number)[]`**
An array of tokens that make up the path.
## Contribute

@@ -283,1 +302,2 @@

[MIT © tsuyoshiwada](./LICENSE)

@@ -525,2 +525,15 @@ import * as assert from 'power-assert';

it('buildPath()', () => {
assert(dot.buildPath([]) === '');
assert(dot.buildPath(['foo']) === 'foo');
assert(dot.buildPath(['foo', 'bar', 'baz']) === 'foo.bar.baz');
assert(dot.buildPath(['foo.bar', 'baz']) === 'foo\\.bar.baz');
assert(dot.buildPath(['foo.bar.baz']) === 'foo\\.bar\\.baz');
assert(dot.buildPath([1, 2, 3]) === '1.2.3');
assert(dot.buildPath(['[1]', '[20]', '[300]']) === '1.20.300');
assert(dot.buildPath(['foo', '[\'bar\']', '["baz"]']) === 'foo.bar.baz');
assert(dot.buildPath(['foo', 1, 2, '[1]', '*', '["bar"]', 'baz.*']) === 'foo.1.2.1.*.bar.baz\\.*');
});
it('containWildcardToken()', () => {

@@ -527,0 +540,0 @@ assert(dot.containWildcardToken('foo.*.bar'));

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