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

ui-router-metatags

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ui-router-metatags - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

0

bower.json

@@ -0,0 +0,0 @@ {

5

CHANGELOG.md

@@ -1,2 +0,5 @@

# 0.0.7
# 1.0.1
* Fixed a bug when using numbers in the prerender.statusCode
# 1.0.0
* Fixes [#2](https://github.com/tinusn/ui-router-metatags/issues/2)

@@ -3,0 +6,0 @@ * Added a sample

@@ -76,3 +76,3 @@ /**

try {
this.properties = this.UIRouterMetatags.staticProperties;
this.properties = angular.extend({}, this.UIRouterMetatags.staticProperties);
if (this.UIRouterMetatags.enableOGURL) {

@@ -82,8 +82,8 @@ this.properties['og:url'] = this.$location.absUrl();

if (tags) {
this.title = tags.title ? this.UIRouterMetatags.prefix + (this.getValue(tags.title) || '') + this.UIRouterMetatags.suffix : this.UIRouterMetatags.defaultTitle;
this.description = tags.description ? this.getValue(tags.description) : this.UIRouterMetatags.defaultDescription;
this.keywords = tags.keywords ? this.getValue(tags.keywords) : this.UIRouterMetatags.defaultKeywords;
this.title = tags.title ? this.UIRouterMetatags.prefix + (this.getValue('title', tags.title) || '') + this.UIRouterMetatags.suffix : this.UIRouterMetatags.defaultTitle;
this.description = tags.description ? this.getValue('description', tags.description) : this.UIRouterMetatags.defaultDescription;
this.keywords = tags.keywords ? this.getValue('keywords', tags.keywords) : this.UIRouterMetatags.defaultKeywords;
angular.forEach(tags.properties, function (value, key) {
var v = _this.getValue(value);
if (v && v.trim().length > 0) {
var v = _this.getValue(key, value);
if (v) {
_this.properties[key] = v;

@@ -99,4 +99,4 @@ }

if (tags && tags.prerender) {
this.prerender.statusCode = tags.prerender.statusCode ? this.getValue(tags.prerender.statusCode) : 200;
this.prerender.header = tags.prerender.header ? this.getValue(tags.prerender.header) : null;
this.prerender.statusCode = tags.prerender.statusCode ? this.getValue('prerender.statusCode', tags.prerender.statusCode) : 200;
this.prerender.header = tags.prerender.header ? this.getValue('rerender.header', tags.prerender.header) : null;
}

@@ -112,9 +112,24 @@ else {

}
this.$log.debug('prerender..', this.prerender);
};
MetaTags.prototype.getValue = function (tag) {
MetaTags.prototype.getValue = function (tagType, tag) {
try {
return angular.isFunction(tag) ? this.$injector.invoke(tag, this, this.$state.$current.locals.globals) : this.$interpolate(tag)(this.$state.$current.locals.globals);
if (!tag) {
return null;
}
else if (typeof tag === 'number') {
return tag;
}
else if (typeof tag === 'string' && tag.trim().length === 0) {
return null;
}
else if (angular.isFunction(tag) || Array.isArray(tag)) {
return this.$injector.invoke(tag, this, this.$state.$current.locals.globals);
}
else {
return this.$interpolate(tag)(this.$state.$current.locals.globals);
}
}
catch (err) {
this.$log.error('error occured when trying to get the value of tag:', tag, err);
this.$log.error('error occured when trying to get the value of tag:', tagType, err);
return null;

@@ -121,0 +136,0 @@ }

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

var uiroutermetatags;!function(t){function e(t,e,r,i){function s(t,e,r,s,o){i.prerenderReady=!1}function o(e,i){i.metaTags||t.debug('MetaTags - route: "'+i.name+'" does not contain any metatags'),r.update(i.metaTags)}function a(t,e,s,o,a,n){r.prerender.statusCode=500,i.prerenderReady=!0}function n(t,e,s){r.prerender.statusCode=404,i.prerenderReady=!0}e.MetaTags=r,e.$on("$stateChangeStart",s),e.$on("$stateChangeSuccess",o),e.$on("$stateChangeError",a),e.$on("$stateNotFound",n)}var r=angular.module("ui.router.metatags",["ui.router"]),i=function(){function t(){this.prefix="",this.suffix="",this.defaultTitle="",this.defaultDescription="",this.defaultKeywords="",this.staticProperties={},this.enableOGURL=!1}return t.prototype.setTitlePrefix=function(t){return this.prefix=t,this},t.prototype.setTitleSuffix=function(t){return this.suffix=t,this},t.prototype.setDefaultTitle=function(t){return this.defaultTitle=t,this},t.prototype.setDefaultDescription=function(t){return this.defaultDescription=t,this},t.prototype.setDefaultKeywords=function(t){return this.defaultKeywords=t,this},t.prototype.setStaticProperties=function(t){return this.staticProperties=t,this},t.prototype.setOGURL=function(t){return this.enableOGURL=t,this},t.prototype.$get=function(){return{prefix:this.prefix,suffix:this.suffix,defaultTitle:this.defaultTitle,defaultDescription:this.defaultDescription,defaultKeywords:this.defaultKeywords,staticProperties:this.staticProperties,enableOGURL:this.enableOGURL}},t}();r.provider("UIRouterMetatags",i);var s=function(){function t(t,e,r,i,s,o,a){this.$log=t,this.UIRouterMetatags=e,this.$interpolate=r,this.$injector=i,this.$state=s,this.$location=o,this.$window=a,this.prerender={}}return t.$inject=["$log","UIRouterMetatags","$interpolate","$injector","$state","$location","$window"],t.prototype.update=function(t){var e=this;try{this.properties=this.UIRouterMetatags.staticProperties,this.UIRouterMetatags.enableOGURL&&(this.properties["og:url"]=this.$location.absUrl()),t?(this.title=t.title?this.UIRouterMetatags.prefix+(this.getValue(t.title)||"")+this.UIRouterMetatags.suffix:this.UIRouterMetatags.defaultTitle,this.description=t.description?this.getValue(t.description):this.UIRouterMetatags.defaultDescription,this.keywords=t.keywords?this.getValue(t.keywords):this.UIRouterMetatags.defaultKeywords,angular.forEach(t.properties,function(t,r){var i=e.getValue(t);i&&i.trim().length>0&&(e.properties[r]=i)})):(this.title=this.UIRouterMetatags.defaultTitle,this.description=this.UIRouterMetatags.defaultDescription,this.keywords=this.UIRouterMetatags.defaultKeywords),t&&t.prerender?(this.prerender.statusCode=t.prerender.statusCode?this.getValue(t.prerender.statusCode):200,this.prerender.header=t.prerender.header?this.getValue(t.prerender.header):null):(this.prerender.statusCode=200,this.prerender.header=null),this.$window.prerenderReady=!0}catch(r){this.$log.error("error occured when extracting metatags:",r)}},t.prototype.getValue=function(t){try{return angular.isFunction(t)?this.$injector.invoke(t,this,this.$state.$current.locals.globals):this.$interpolate(t)(this.$state.$current.locals.globals)}catch(e){return this.$log.error("error occured when trying to get the value of tag:",t,e),null}},t}();r.service("MetaTags",s),e.$inject=["$log","$rootScope","MetaTags","$window"],r.run(e)}(uiroutermetatags||(uiroutermetatags={}));
var uiroutermetatags;!function(t){function e(t,e,r,i){function s(t,e,r,s,o){i.prerenderReady=!1}function o(e,i){i.metaTags||t.debug('MetaTags - route: "'+i.name+'" does not contain any metatags'),r.update(i.metaTags)}function a(t,e,s,o,a,n){r.prerender.statusCode=500,i.prerenderReady=!0}function n(t,e,s){r.prerender.statusCode=404,i.prerenderReady=!0}e.MetaTags=r,e.$on("$stateChangeStart",s),e.$on("$stateChangeSuccess",o),e.$on("$stateChangeError",a),e.$on("$stateNotFound",n)}var r=angular.module("ui.router.metatags",["ui.router"]),i=function(){function t(){this.prefix="",this.suffix="",this.defaultTitle="",this.defaultDescription="",this.defaultKeywords="",this.staticProperties={},this.enableOGURL=!1}return t.prototype.setTitlePrefix=function(t){return this.prefix=t,this},t.prototype.setTitleSuffix=function(t){return this.suffix=t,this},t.prototype.setDefaultTitle=function(t){return this.defaultTitle=t,this},t.prototype.setDefaultDescription=function(t){return this.defaultDescription=t,this},t.prototype.setDefaultKeywords=function(t){return this.defaultKeywords=t,this},t.prototype.setStaticProperties=function(t){return this.staticProperties=t,this},t.prototype.setOGURL=function(t){return this.enableOGURL=t,this},t.prototype.$get=function(){return{prefix:this.prefix,suffix:this.suffix,defaultTitle:this.defaultTitle,defaultDescription:this.defaultDescription,defaultKeywords:this.defaultKeywords,staticProperties:this.staticProperties,enableOGURL:this.enableOGURL}},t}();r.provider("UIRouterMetatags",i);var s=function(){function t(t,e,r,i,s,o,a){this.$log=t,this.UIRouterMetatags=e,this.$interpolate=r,this.$injector=i,this.$state=s,this.$location=o,this.$window=a,this.prerender={}}return t.$inject=["$log","UIRouterMetatags","$interpolate","$injector","$state","$location","$window"],t.prototype.update=function(t){var e=this;try{this.properties=angular.extend({},this.UIRouterMetatags.staticProperties),this.UIRouterMetatags.enableOGURL&&(this.properties["og:url"]=this.$location.absUrl()),t?(this.title=t.title?this.UIRouterMetatags.prefix+(this.getValue("title",t.title)||"")+this.UIRouterMetatags.suffix:this.UIRouterMetatags.defaultTitle,this.description=t.description?this.getValue("description",t.description):this.UIRouterMetatags.defaultDescription,this.keywords=t.keywords?this.getValue("keywords",t.keywords):this.UIRouterMetatags.defaultKeywords,angular.forEach(t.properties,function(t,r){var i=e.getValue(r,t);i&&(e.properties[r]=i)})):(this.title=this.UIRouterMetatags.defaultTitle,this.description=this.UIRouterMetatags.defaultDescription,this.keywords=this.UIRouterMetatags.defaultKeywords),t&&t.prerender?(this.prerender.statusCode=t.prerender.statusCode?this.getValue("prerender.statusCode",t.prerender.statusCode):200,this.prerender.header=t.prerender.header?this.getValue("rerender.header",t.prerender.header):null):(this.prerender.statusCode=200,this.prerender.header=null),this.$window.prerenderReady=!0}catch(r){this.$log.error("error occured when extracting metatags:",r)}this.$log.debug("prerender..",this.prerender)},t.prototype.getValue=function(t,e){try{return e?"number"==typeof e?e:"string"==typeof e&&0===e.trim().length?null:angular.isFunction(e)||Array.isArray(e)?this.$injector.invoke(e,this,this.$state.$current.locals.globals):this.$interpolate(e)(this.$state.$current.locals.globals):null}catch(r){return this.$log.error("error occured when trying to get the value of tag:",t,r),null}},t}();r.service("MetaTags",s),e.$inject=["$log","$rootScope","MetaTags","$window"],r.run(e)}(uiroutermetatags||(uiroutermetatags={}));
//# sourceMappingURL=ui-router-metatags.min.js.map
{
"name": "ui-router-metatags",
"version": "1.0.0",
"version": "1.0.1",
"description": "Metatags support for the AngularUI Router ",

@@ -5,0 +5,0 @@ "main": "ui-router-metatags",

@@ -124,3 +124,3 @@ /**

try {
this.properties = this.UIRouterMetatags.staticProperties;
this.properties = angular.extend({}, this.UIRouterMetatags.staticProperties);

@@ -132,8 +132,8 @@ if (this.UIRouterMetatags.enableOGURL) {

if (tags) {
this.title = tags.title ? this.UIRouterMetatags.prefix + (this.getValue(tags.title) || '') + this.UIRouterMetatags.suffix : this.UIRouterMetatags.defaultTitle;
this.description = tags.description ? this.getValue(tags.description) : this.UIRouterMetatags.defaultDescription;
this.keywords = tags.keywords ? this.getValue(tags.keywords) : this.UIRouterMetatags.defaultKeywords;
this.title = tags.title ? this.UIRouterMetatags.prefix + (this.getValue('title', tags.title) || '') + this.UIRouterMetatags.suffix : this.UIRouterMetatags.defaultTitle;
this.description = tags.description ? this.getValue('description', tags.description) : this.UIRouterMetatags.defaultDescription;
this.keywords = tags.keywords ? this.getValue('keywords', tags.keywords) : this.UIRouterMetatags.defaultKeywords;
angular.forEach(tags.properties, (value, key) => {
var v = this.getValue(value);
if (v && v.trim().length > 0) {
var v = this.getValue(key, value);
if (v) {
this.properties[key] = v;

@@ -148,4 +148,4 @@ }

if (tags && tags.prerender) {
this.prerender.statusCode = tags.prerender.statusCode ? this.getValue(tags.prerender.statusCode) : 200;
this.prerender.header = tags.prerender.header ? this.getValue(tags.prerender.header) : null;
this.prerender.statusCode = tags.prerender.statusCode ? this.getValue('prerender.statusCode', tags.prerender.statusCode) : 200;
this.prerender.header = tags.prerender.header ? this.getValue('rerender.header', tags.prerender.header) : null;
} else {

@@ -160,9 +160,20 @@ this.prerender.statusCode = 200;

}
this.$log.debug('prerender..', this.prerender);
}
getValue(tag) {
getValue(tagType: string, tag) {
try {
return angular.isFunction(tag) ? this.$injector.invoke(tag, this, this.$state.$current.locals.globals) : this.$interpolate(tag)(this.$state.$current.locals.globals);
if (!tag) {
return null;
} else if (typeof tag === 'number') {
return tag;
} else if (typeof tag === 'string' && tag.trim().length === 0) {
return null;
} else if (angular.isFunction(tag) || Array.isArray(tag)) {
return this.$injector.invoke(tag, this, this.$state.$current.locals.globals);
} else {
return this.$interpolate(tag)(this.$state.$current.locals.globals);
}
} catch (err) {
this.$log.error('error occured when trying to get the value of tag:', tag, err);
this.$log.error('error occured when trying to get the value of tag:', tagType, err);
return null;

@@ -169,0 +180,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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