JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q32985F
  • License MIT

Array Class Extension for Records

Package Exports

  • recordarray
  • recordarray/lib/RecordArray.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (recordarray) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

RecordArray

Zero Dependency Extension of Javascript Array class with record data handling capabilities

Note: Further information on recordarray.js.ie or recordarray.com

Installation

npm install recordarray

CDN

https://unpkg.com/recordarray/src/RecordArray.js

Usage:

const RecordArray = require('recordarray');

const users = new RecordArray([
   {id: 1, name: 'Admin', type: 'admin'},
   {id: 2, name: 'Bob', type: 'guest'},
   {id: 3, name: 'Sam', type: 'guest'}
]);

console.log( 'User with ID 1 = ', users.findOneByID(1).name );
// Output: "Admin"

console.log( 'Guest Users Reverse Alphabetically = ', users
   .findBy('type', 'guest')
   .sortBy('name','DESC')
   .listValues('name')
   .join(', ')
);
// Output: "Sam, Bob"

class methods

  • compare
  • compareRecords

compare

compareRecords

object methods

As this class extends the base Array class it inherits all methods from that class, but may need these alternatives to work with an array of records via their fields.

Retrieval methods

Record Retrieval

  • findBy
  • findByID
  • findByTag
  • findOne
  • findOneByID
  • findOneByTag
  • matchBy
  • matchByID
  • matchByTag
  • unique
  • uniqueBy
  • clone
  • toArray
  • listValues
  • getName
  • getNameByTag
  • indexBy
  • indexByID
  • indexByTag

Mutation methods

  • sortBy
  • sortASC
  • sortDESC
  • extend
  • merge

CRUD methods

  • create
  • read
  • update
  • delete
  • list