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

selectn

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

selectn - npm Package Compare versions

Comparing version 0.8.0 to 0.8.2

LICENSE

2

component.json

@@ -5,3 +5,3 @@ {

"description": "N-levels deep object access via dot/bracket-notation property access string.",
"version": "0.8.0",
"version": "0.8.2",
"keywords": [

@@ -8,0 +8,0 @@ "object",

0.8.2 / 2013-08-02
==================
* [bugfix] correctly support nested array syntax.
0.6.0 / 2013-06-28
==================
* [feature] optional partial application (via currying)
* [feature] optional partial application (via currying).
* [feature] access global object if no object reference is given.

@@ -7,0 +12,0 @@

@@ -32,3 +32,3 @@

// normalize query to `.property` access (i.e. `a.b[0]` becomes `a.b.0`)
query = query.replace(/\[(\d+)\]/, '.$1');
query = query.replace(/\[(\d+)\]/g, '.$1');
parts = query.split('.');

@@ -35,0 +35,0 @@

@@ -5,3 +5,3 @@ {

"description": "N-levels deep object access via dot/bracket-notation property access string.",
"version": "0.8.0",
"version": "0.8.2",
"keywords": [

@@ -29,3 +29,12 @@ "object",

"chai": "*"
},
"jam": {
"include": [
"selectn.js",
"Readme.md"
]
},
"volo": {
"url": "https://raw.github.com/wilmoore/selectn/v{version}/selectn.js"
}
}

@@ -12,2 +12,3 @@ # selectn

- Avoids `if (obj && obj.a && obj.a.b && obj.a.b.c) { return obj.a.b.c; }`.
- Supports multiple levels of array nesting (i.e. `group[0].section.a.seat[3]`).
- Partial application supported.

@@ -38,2 +39,14 @@ - Functions generated by `selectn` can be passed to applicative functors like [Array.prototype.map][map] and [Array.prototype.filter][filter].

[jam](http://jamjs.org/packages/#/details/selectn)
$ jam install selectn
[volo](http://volojs.org)
$ volo add wilmoore/selectn
[global][]
<script src="https://raw.github.com/wilmoore/selectn/master/selectn.js"></script>
## Example (immediate access)

@@ -174,2 +187,3 @@

[filter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
[global]: http://yuiblog.com/blog/2006/06/01/global-domination/

@@ -15,2 +15,8 @@ var select = require('..');

var books = {
part: [
{ chapter: [ { title: 'getting started' }, { title: 'going with the flow' } ] }
]
};
it('returns an accessor function', function() {

@@ -71,2 +77,7 @@ var accessor = select('a.b.c');

it('supports nested array indexes', function() {
var out = select('part[0].chapter[1]', books);
expect(out.title).to.equal('going with the flow');
});
});
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