Socket
Book a DemoInstallSign in
Socket

ampersand-collection-sort-mixin

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-collection-sort-mixin

A mixin to provide simple ascending/descending sorting

0.0.4
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

ampersand-collection-rest-mixin

A mixin for extending ampersand-collection with the ability to sort by multiple properties, and ascending/descending. The sorting is performed when adding new models to the collection, or when the sort() method is called.

install

npm install ampersand-collection-sort-mixin

usage

The mixin uses two properties stored in session properties:

  • sortProps - Array of strings, or string. An array of the property names to sort the collection by. If just one, it can be just a string.
  • sortDescending - Boolean. Set to true to sort descending. Default is false (ascending)

example

var Collection = require('ampersand-collection');
var sortMixin = require('ampersand-collection-sort-mixin');


module.exports = Collection.extend(sortMixin, {
    session: {
        sortProps: ['lastname', 'firstname'],
        sortDescending: true
    },

});

credits

The main nugget of this code came from the base collection sort() method.

license

MIT

Keywords

collections

FAQs

Package last updated on 15 Dec 2014

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.