Socket
Socket
Sign inDemoInstall

loopback-ds-computed-mixin

Package Overview
Dependencies
4
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

4

lib/computed.js

@@ -0,1 +1,3 @@

'use strict'
const debug = require('debug')('loopback:mixin:computed')

@@ -6,4 +8,2 @@ const _ = require('lodash')

module.exports = (Model, options) => {
'use strict'
// Trigger a warning and remove the property from the watchlist when one of

@@ -10,0 +10,0 @@ // the property is not found on the model or the defined callback is not found

@@ -0,1 +1,3 @@

'use strict'
const deprecate = require('depd')('loopback-ds-computed-mixin')

@@ -5,3 +7,2 @@ const computed = require('./computed')

module.exports = function mixin(app) {
'use strict'
app.loopback.modelBuilder.mixins.define = deprecate.function(app.loopback.modelBuilder.mixins.define,

@@ -8,0 +9,0 @@ 'app.modelBuilder.mixins.define: Use mixinSources instead')

{
"name": "loopback-ds-computed-mixin",
"version": "2.0.0",
"version": "2.0.1",
"description": "A mixin for the LoopBack framework that adds computed properties to a model.",

@@ -36,6 +36,4 @@ "keywords": [

"coveralls": "^2.13.0",
"eslint": "^2.11.1",
"eslint-config-fullcube": "^1.0.46",
"eslint-config-fullcube": "^2.0.0",
"loopback": "^3.6.0",
"loopback-datasource-juggler": "^3.5.0",
"loopback-testing": "^1.4.0",

@@ -42,0 +40,0 @@ "mocha": "^3.3.0",

COMPUTED
================
[![Greenkeeper badge](https://badges.greenkeeper.io/fullcube/loopback-ds-computed-mixin.svg)](https://greenkeeper.io/)
[![CircleCI](https://circleci.com/gh/fullcube/loopback-ds-computed-mixin.svg?style=svg)](https://circleci.com/gh/fullcube/loopback-ds-computed-mixin) [![Coverage Status](https://coveralls.io/repos/github/fullcube/loopback-ds-computed-mixin/badge.svg?branch=master)](https://coveralls.io/github/fullcube/loopback-ds-computed-mixin?branch=master) [![Dependencies](http://img.shields.io/david/fullcube/loopback-ds-computed-mixin.svg?style=flat)](https://david-dm.org/fullcube/loopback-ds-computed-mixin) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

@@ -5,0 +7,0 @@

const loopback = require('loopback')
const lt = require('loopback-testing')
const chai = require('chai')
const expect = chai.expect
const { expect } = chai

@@ -54,7 +54,7 @@ global.Promise = require('bluebird')

new lt.TestDataBuilder()
.define('item1', Item, {
.define('itemOne', Item, {
name: 'Item 1',
status: 'archived',
})
.define('item2', Item, {
.define('itemTwo', Item, {
name: 'Item 2',

@@ -67,5 +67,5 @@ status: 'new',

before(function() {
return Promise.join(Item.findById(this.item1.id), Item.findById(this.item2.id), (item1, item2) => {
this.item1 = item1
this.item2 = item2
return Promise.join(Item.findById(this.itemOne.id), Item.findById(this.itemTwo.id), (itemOne, itemTwo) => {
this.itemOne = itemOne
this.itemTwo = itemTwo
})

@@ -75,12 +75,12 @@ })

it('should set the model property to the value returned by the defined callback', function() {
expect(this.item1.requestedAt.toString()).to.equal(now.toString())
expect(this.item1.readonly).to.equal(true)
expect(this.item2.requestedAt.toString()).to.equal(now.toString())
expect(this.item2.readonly).to.equal(false)
expect(this.itemOne.requestedAt.toString()).to.equal(now.toString())
expect(this.itemOne.readonly).to.equal(true)
expect(this.itemTwo.requestedAt.toString()).to.equal(now.toString())
expect(this.itemTwo.readonly).to.equal(false)
})
it('should set the model property to the value resolved by the defined callback\'s promise', function() {
expect(this.item1.promised).to.equal('Item 1: As promised I get back to you!')
expect(this.item2.promised).to.equal('Item 2: As promised I get back to you!')
expect(this.itemOne.promised).to.equal('Item 1: As promised I get back to you!')
expect(this.itemTwo.promised).to.equal('Item 2: As promised I get back to you!')
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc