Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

skava / chain-able-deps   js

Repository URL to install this package:

Version: 6.0.4 

/ src / loop / __tests__ / sort / sortBy.ts

var C = require('../../../exports')

var albums = [
  {title: 'Art of the Fugue', artist: 'Glenn Gould', genre: 'Baroque'},
  {title: 'A Farewell to Kings', artist: 'Rush', genre: 'Rock'},
  {title: 'Timeout', artist: 'Dave Brubeck Quartet', genre: 'Jazz'},
  {title: 'Fly By Night', artist: 'Rush', genre: 'Rock'},
  {title: 'Goldberg Variations', artist: 'Daniel Barenboim', genre: 'Baroque'},
  {title: 'New World Symphony', artist: 'Leonard Bernstein', genre: 'Romantic'},
  {title: 'Romance with the Unseen', artist: 'Don Byron', genre: 'Jazz'},
  {title: 'Somewhere In Time', artist: 'Iron Maiden', genre: 'Metal'},
  {title: 'In Times of Desparation', artist: 'Danny Holt', genre: 'Modern'},
  {title: 'Evita', artist: 'Various', genre: 'Broadway'},
  {title: 'Five Leaves Left', artist: 'Nick Drake', genre: 'Folk'},
  {title: 'The Magic Flute', artist: 'John Eliot Gardiner', genre: 'Classical'},
]


test.skip('sortBy', function() {
  // test('sorts by a simple property of the objects', function() {
  //   var sortedAlbums = C.sortBy(C.prop('title'), albums)
  //   eq(sortedAlbums.length, albums.length)
  //   eq(sortedAlbums[0].title, 'A Farewell to Kings')
  //   eq(sortedAlbums[11].title, 'Timeout')
  // })
  //
  // test('is curried', function() {
  //   var sorter = C.sortBy(C.prop('title'))
  //   var sortedAlbums = sorter(albums)
  //   eq(sortedAlbums.length, albums.length)
  //   eq(sortedAlbums[0].title, 'A Farewell to Kings')
  //   eq(sortedAlbums[11].title, 'Timeout')
  // })
  //
  // test('preserves object identity', function() {
  //   var a = {value: 'a'}
  //   var b = {value: 'b'}
  //   var result = C.sortBy(C.prop('value'), [b, a])
  //   eq(result[0], a)
  //   eq(result[1], b)
  // })
  //
  // test('sorts array-like object', function() {
  //   var args = (function() { return arguments })('c', 'a', 'b')
  //   var result = C.sortBy(C.identity, args)
  //   eq(result[0], 'a')
  //   eq(result[1], 'b')
  //   eq(result[2], 'c')
  // })
})