New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ng-current

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-current - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

22

ng-current.js

@@ -110,3 +110,3 @@ ;(function(angular) {

*
* @param {String} name service name
* @param {string} name service name
*/

@@ -129,10 +129,16 @@ this.clear = function(name) {

*
* @param {String} name service name
* @param {string} name service name
* @param {*} data arbitrary data to select
* @param {boolean} [applyModel] whether or not to apply model function against data
* @param {Object} object to use as representation of current state
*/
this.select = function(name, data) {
this.select = function(name, data, applyModel) {
var old = $rootScope.current[name]
// only publish update if the current value has changed
if (!angular.equals(data, old)) {
if (applyModel) {
data = this.contexts[name].model(data)
}
$rootScope.current[name] = data

@@ -154,3 +160,3 @@

*
* @param {String} name service name
* @param {string} name service name
* @returns {Object} currently current state representation of the service

@@ -166,3 +172,3 @@ */

*
* @param {String} name service name
* @param {string} name service name
* @param {Object} none object to use as initial context when none exists yet

@@ -193,3 +199,3 @@ * @returns {Object} current service context or `none` if it doesn't exist

*
* @param {String} rel relation to subscribe to
* @param {string} rel relation to subscribe to
* @param {Function} on behavior to invoke on publication

@@ -213,3 +219,3 @@ * @returns {Promise}

*
* @param {String} rel the relation
* @param {string} rel the relation
* @param {Object} data

@@ -216,0 +222,0 @@ */

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

!function(a){"use strict";var b=a.module("ng-current",[]);b.service("Contexts",["$log","$rootScope","$q",function(b,c,d){var e=this;this.contexts={},c.current={},this.register=function(a){this.contexts[a.name]=a.rels||[],a.refresh=e.refreshing(a),a.use=e.using(a),a.$$hasContext=!0,c.current[name]={}},this.refreshing=function(a){return function(c,e){var f=a[c];a.model||function(a){return a};f instanceof Function?d.when(f.call(a)).then(function(b){e(b instanceof Array?b.map(a.model,a):a.model(b))})["catch"](function(a){b.error("[ng-current.refreshing] failed to refresh Service integration point",a)}):b.error("[ng-current.refreshing] failed to find method on service",c)}},this.using=function(a){return function(c,d){a.$$hasContext?(a.refresh(c,d),e.subscribe(a.name,function(b){a.refresh(c,d),a.rels&&a.rels.length&&a.rels.forEach(function(a){e.publish(a,b)})})):b.error("[ng-current.using] malformed Service context, please ensure you have added `Contexts.register(this)` at the end of this service",a)}},this.clear=function(a){(e.contexts[a]||[]).forEach(function(a){delete c.current[a];var b=e.contexts[a];b instanceof Array&&b.length&&b.forEach(e.clear)})},this.select=function(b,d){var f=c.current[b];return a.equals(d,f)||(c.current[b]=d,e.clear(b),e.publish(b,d)),d},this.current=function(a){return c.current[a]},this.currentOr=function(b,c){var d=this.current(b);return a.isObject(d)||a.isUndefined(c)?d:c},this.get=e.current,this.getOr=e.currentOr,this.subscribe=function(a,b){return d(function(d,e){c.$on(a,function(a,c){d(b(c||{},a))})})},this.publish=function(a,b){var d=e.contexts[a],f=d?[a].concat(d):[a];return f.forEach(function(a){if(a.constructor!==String)throw"rels must be Strings";c.$broadcast(a,b)}),b}}])}(angular),module&&exports&&module.exports===exports&&(module.exports="ng-current");
!function(a){"use strict";var b=a.module("ng-current",[]);b.service("Contexts",["$log","$rootScope","$q",function(b,c,d){var e=this;this.contexts={},c.current={},this.register=function(a){this.contexts[a.name]=a.rels||[],a.refresh=e.refreshing(a),a.use=e.using(a),a.$$hasContext=!0,c.current[name]={}},this.refreshing=function(a){return function(c,e){var f=a[c];a.model||function(a){return a};f instanceof Function?d.when(f.call(a)).then(function(b){e(b instanceof Array?b.map(a.model,a):a.model(b))})["catch"](function(a){b.error("[ng-current.refreshing] failed to refresh Service integration point",a)}):b.error("[ng-current.refreshing] failed to find method on service",c)}},this.using=function(a){return function(c,d){a.$$hasContext?(a.refresh(c,d),e.subscribe(a.name,function(b){a.refresh(c,d),a.rels&&a.rels.length&&a.rels.forEach(function(a){e.publish(a,b)})})):b.error("[ng-current.using] malformed Service context, please ensure you have added `Contexts.register(this)` at the end of this service",a)}},this.clear=function(a){(e.contexts[a]||[]).forEach(function(a){delete c.current[a];var b=e.contexts[a];b instanceof Array&&b.length&&b.forEach(e.clear)})},this.select=function(b,d,f){var g=c.current[b];return a.equals(d,g)||(f&&(d=this.contexts[b].model(d)),c.current[b]=d,e.clear(b),e.publish(b,d)),d},this.current=function(a){return c.current[a]},this.currentOr=function(b,c){var d=this.current(b);return a.isObject(d)||a.isUndefined(c)?d:c},this.get=e.current,this.getOr=e.currentOr,this.subscribe=function(a,b){return d(function(d,e){c.$on(a,function(a,c){d(b(c||{},a))})})},this.publish=function(a,b){var d=e.contexts[a],f=d?[a].concat(d):[a];return f.forEach(function(a){if(a.constructor!==String)throw"rels must be Strings";c.$broadcast(a,b)}),b}}])}(angular),module&&exports&&module.exports===exports&&(module.exports="ng-current");
{
"name": "ng-current",
"version": "1.0.6",
"version": "1.0.7",
"description": "Relational context manager for Angular",

@@ -5,0 +5,0 @@ "main": "ng-current.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc