Skip to content

Commit

Permalink
feat(util): isolate lodash instance on collection
Browse files Browse the repository at this point in the history
util manages an isolated instance of lodash to wrap collections and exposes a method to add mixins
to the same instance.
  • Loading branch information
thetutlage committed Jul 16, 2017
1 parent e96a16a commit 1778c19
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/unit/util.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

/* global describe, it*/
const util = require('../../lib/util')
const _ = require('lodash')
const chai = require('chai')
const expect = chai.expect

Expand Down Expand Up @@ -112,4 +113,11 @@ describe('Utils', function () {
const meta = util.makePaginateMeta(20, 1, 10)
expect(meta).deep.equal({total: 20, perPage: 10, currentPage: 1, lastPage: 2, data: []})
})

it('should add a mixin to lodash isolated instance', function () {
const foo = function () {}
util.addMixin('foo', foo)
expect(_.isFunction(_.foo)).to.equal(false)
expect(_.isFunction(util.lodash().foo)).to.equal(true)
})
})

0 comments on commit 1778c19

Please sign in to comment.