Socket
Socket
Sign inDemoInstall

adlib

Package Overview
Dependencies
1
Maintainers
11
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.7 to 3.0.8

41

dist/adlib.esm.js
/**
* adlib - v3.0.6 - Thu Dec 17 2020 17:08:08 GMT-0800 (Pacific Standard Time)
* Copyright (c) 2017-2020 Dave Bouwman / Esri
* adlib - v3.0.7 - Tue Oct 04 2022 12:08:15 GMT-0400 (Eastern Daylight Time)
* Copyright (c) 2017-2022 Dave Bouwman / Esri
* Apache-2.0

@@ -359,6 +359,6 @@ */

var param;
if (transformCheck[2]){
if (transformCheck[2]) {
param = transformCheck[2];
}
if(transforms && transforms[fn] && typeof transforms[fn] === 'function') {
if (transforms && transforms[fn] && typeof transforms[fn] === 'function') {
// get the value from the param

@@ -381,3 +381,3 @@ value = getWithDefault(settings, key);

*/
function _propertyPathExists (propertyPath, target) {
function _propertyPathExists(propertyPath, target) {
// remove any transforms

@@ -396,3 +396,3 @@ var cleanPath = propertyPath.split(':')[0];

*/
function _isValue (val) {
function _isValue(val) {
return val || val === '' || val === 0;

@@ -402,3 +402,3 @@ }

// Combine a Template with Settings
function adlib (template, settings, transforms) {
function adlib(template, settings, transforms) {
if ( transforms === void 0 ) transforms = null;

@@ -413,3 +413,3 @@

var res = deepMapValues(template, function(templateValue, templatePath){
var res = deepMapValues(template, function (templateValue, templatePath) {
// Only string templates

@@ -478,4 +478,4 @@ if (!isString$1(templateValue)) {

if (typeof v.value === 'string') {
// and it's numeric-ish
if(!isNaN(v.value) && v.value !== '') {
// and it's numeric-ish and does not have leading 0s
if (!isNaN(v.value) && v.value !== '') {
// and has a . in it...

@@ -485,5 +485,8 @@ if (v.value.indexOf('.') > -1) {

v.value = parseFloat(v.value);
} else {
// parse as an int
v.value = parseInt(v.value);
// if no leading 0s, parse as an int
if (v.value[0] !== '0'){
v.value = parseInt(v.value);
}
}

@@ -523,3 +526,3 @@ }

// read a template and spit out unique values
function listDependencies (template) {
function listDependencies(template) {
if (typeof template !== 'string') {

@@ -535,8 +538,8 @@ template = JSON.stringify(template);

)
.map(function (term) {
return term.replace(/^{{/g, '').replace(/}}$/g, '').replace(/:.+$/, '')
// Node > 10 and browsers support this w/ a lookahead
// won't need to use the replace
// /(?<={{)[\w].*?(?=}})/g
})
.map(function (term) {
return term.replace(/^{{/g, '').replace(/}}$/g, '').replace(/:.+$/, '')
// Node > 10 and browsers support this w/ a lookahead
// won't need to use the replace
// /(?<={{)[\w].*?(?=}})/g
})
} catch (e) {

@@ -543,0 +546,0 @@ console.error(e);

/**
* adlib - v3.0.6 - Thu Dec 17 2020 17:08:10 GMT-0800 (Pacific Standard Time)
* Copyright (c) 2017-2020 Dave Bouwman / Esri
* adlib - v3.0.7 - Tue Oct 04 2022 12:08:16 GMT-0400 (Eastern Daylight Time)
* Copyright (c) 2017-2022 Dave Bouwman / Esri
* Apache-2.0

@@ -365,6 +365,6 @@ */

var param;
if (transformCheck[2]){
if (transformCheck[2]) {
param = transformCheck[2];
}
if(transforms && transforms[fn] && typeof transforms[fn] === 'function') {
if (transforms && transforms[fn] && typeof transforms[fn] === 'function') {
// get the value from the param

@@ -387,3 +387,3 @@ value = getWithDefault(settings, key);

*/
function _propertyPathExists (propertyPath, target) {
function _propertyPathExists(propertyPath, target) {
// remove any transforms

@@ -402,3 +402,3 @@ var cleanPath = propertyPath.split(':')[0];

*/
function _isValue (val) {
function _isValue(val) {
return val || val === '' || val === 0;

@@ -408,3 +408,3 @@ }

// Combine a Template with Settings
function adlib (template, settings, transforms) {
function adlib(template, settings, transforms) {
if ( transforms === void 0 ) transforms = null;

@@ -419,3 +419,3 @@

var res = deepMapValues(template, function(templateValue, templatePath){
var res = deepMapValues(template, function (templateValue, templatePath) {
// Only string templates

@@ -484,4 +484,4 @@ if (!isString$1(templateValue)) {

if (typeof v.value === 'string') {
// and it's numeric-ish
if(!isNaN(v.value) && v.value !== '') {
// and it's numeric-ish and does not have leading 0s
if (!isNaN(v.value) && v.value !== '') {
// and has a . in it...

@@ -491,5 +491,8 @@ if (v.value.indexOf('.') > -1) {

v.value = parseFloat(v.value);
} else {
// parse as an int
v.value = parseInt(v.value);
// if no leading 0s, parse as an int
if (v.value[0] !== '0'){
v.value = parseInt(v.value);
}
}

@@ -529,3 +532,3 @@ }

// read a template and spit out unique values
function listDependencies (template) {
function listDependencies(template) {
if (typeof template !== 'string') {

@@ -541,8 +544,8 @@ template = JSON.stringify(template);

)
.map(function (term) {
return term.replace(/^{{/g, '').replace(/}}$/g, '').replace(/:.+$/, '')
// Node > 10 and browsers support this w/ a lookahead
// won't need to use the replace
// /(?<={{)[\w].*?(?=}})/g
})
.map(function (term) {
return term.replace(/^{{/g, '').replace(/}}$/g, '').replace(/:.+$/, '')
// Node > 10 and browsers support this w/ a lookahead
// won't need to use the replace
// /(?<={{)[\w].*?(?=}})/g
})
} catch (e) {

@@ -549,0 +552,0 @@ console.error(e);

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).adlib={})}(this,function(e){"use strict";var l=function(e,n,r){return void 0===r&&(r=void 0),n.split(".").reduce(function(e,n){return e?e[n]:r},e)};function i(r,t){return Object.keys(r).reduce(function(e,n){return e[n]=t(r[n],n,r),e},{})}var o=function(e){return e instanceof Date},u=function(e){return"function"==typeof e},a=function(e){return"object"==typeof e},f=function(e){return e instanceof RegExp};function c(e,r,t){return t=t||"",Array.isArray(e)?e.map(n):!e||!a(e)||o(e)||f(e)||u(e)?r(e,t):Object.assign({},e,i(e,n));function n(e,n){return c(e,r,t?t+"."+n:n)}}var t=function(e){return"object"==typeof e};function p(e,n){return Array.isArray(e)?s(e.map(r).filter(function(e){return null!=e})):e&&t(e)?v(i(e,r)):d(e);function r(e,n){return p(e)}}function s(e){var n=e,r=e.reduce(function(e,n){if(g(n)&&m(n)){var r=y(n);e<r&&(e=r)}return e},-1);return-1<r&&(n=0===r?[]:"{{delete:"+(r-1)+"}}"),n}function v(i){var e=Object.keys(i).reduce(function(e,n){var r=i[n];if(g(r)&&m(r)){var t=y(r);t>e.maxLevel&&(e.maxLevel=t)}else e.obj[n]=r;return e},{obj:{},maxLevel:-1});return 0<e.maxLevel?1===e.maxLevel?void 0:"{{delete:"+(e.maxLevel-1)+"}}":e.obj}function d(e){var n=e;return"string"==typeof e&&m(e)&&(n=function(e){var n=e,r=y(e);n=0===r?void 0:"{{delete:"+r+"}}";return n}(e)),n}var y=function(e){return parseInt(e.replace(/{|}/g,"").split(":")[1])};function m(e){return!(!e||"string"!=typeof e)&&-1<e.indexOf("{{delete")}var g=function(e){return"string"==typeof e};function n(e,n,r,t){void 0===t&&(t=0);var i=n;return n||(i="{{delete:"+t+"}}"),i}var b=function(e){var n={};if(Array.isArray(e))n=e.map(b);else if("object"==typeof e)for(var r in e)null!=e[r]&&"object"==typeof e[r]?n[r]=b(e[r]):n[r]=e[r];else n=e;return n},x=/{{\s*?[\w].*?}}/g;function h(e){return e||""===e||0===e}e.adlib=function(e,a,f){if(void 0===f&&(f=null),(f=b(f)||{}).optional)throw new Error("Please do not pass in an `optional` transform; adlib provides that internally.");return f.optional=n,p(c(e,function(n,e){if("string"!=typeof n)return n;var r,t=n.match(x);return t&&t.length?(t.map(function(e){var i=!1,n=e.replace(/{|}/g,"").trim();if(-1<n.indexOf("||")){var r=n.split("||").map(function(e){return e.trim()}),o=r.length;n=r.find(function(e,n){var r,t;return r=a,t=e.split(":")[0],null!=l(r,t,null)?e:n+1===o&&(i=!0,isNaN(e)||(e=parseInt(e)),e)})}var t={key:e,value:n};if(!i){var u=function(e,n,r){var t,i=e.split(":");if(1<i.length){var o,u=i[0],a=i[1];if(i[2]&&(o=i[2]),!r||!r[a]||"function"!=typeof r[a])throw new Error("Attempted to apply non-existant transform "+a+" on "+u+" with params "+e);t=l(n,u),t=r[a](u,t,n,o)}else t=l(n,e);return t}(n,a,f);t.value=h(u)?u:e}return t}).forEach(function(e){n===e.key?("string"==typeof e.value&&(isNaN(e.value)||""===e.value||(-1<e.value.indexOf(".")?e.value=parseFloat(e.value):e.value=parseInt(e.value))),r=e.value):n=n.replace(e.key,e.value)}),h(r)?r:n):n}))},e.arborist=p,e.deepMapValues=c,e.getPropertyValue=d,e.getWithDefault=l,e.listDependencies=function(e){"string"!=typeof e&&(e=JSON.stringify(e));try{return Array.from(new Set(e.match(x))).map(function(e){return e.replace(/^{{/g,"").replace(/}}$/g,"").replace(/:.+$/,"")})}catch(e){console.error(e)}},e.mapValues=i,e.optionalTransform=n,e.pruneArray=s,e.pruneObject=v,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).adlib={})}(this,function(e){"use strict";var l=function(e,n,r){return void 0===r&&(r=void 0),n.split(".").reduce(function(e,n){return e?e[n]:r},e)};function i(r,t){return Object.keys(r).reduce(function(e,n){return e[n]=t(r[n],n,r),e},{})}var u=function(e){return e instanceof Date},o=function(e){return"function"==typeof e},a=function(e){return"object"==typeof e},f=function(e){return e instanceof RegExp};function c(e,r,t){return t=t||"",Array.isArray(e)?e.map(n):!e||!a(e)||u(e)||f(e)||o(e)?r(e,t):Object.assign({},e,i(e,n));function n(e,n){return c(e,r,t?t+"."+n:n)}}var t=function(e){return"object"==typeof e};function p(e,n){return Array.isArray(e)?s(e.map(r).filter(function(e){return null!=e})):e&&t(e)?v(i(e,r)):d(e);function r(e,n){return p(e)}}function s(e){var n=e,r=e.reduce(function(e,n){if(g(n)&&m(n)){var r=y(n);e<r&&(e=r)}return e},-1);return-1<r&&(n=0===r?[]:"{{delete:"+(r-1)+"}}"),n}function v(i){var e=Object.keys(i).reduce(function(e,n){var r=i[n];if(g(r)&&m(r)){var t=y(r);t>e.maxLevel&&(e.maxLevel=t)}else e.obj[n]=r;return e},{obj:{},maxLevel:-1});return 0<e.maxLevel?1===e.maxLevel?void 0:"{{delete:"+(e.maxLevel-1)+"}}":e.obj}function d(e){var n=e;return"string"==typeof e&&m(e)&&(n=function(e){var n=e,r=y(e);n=0===r?void 0:"{{delete:"+r+"}}";return n}(e)),n}var y=function(e){return parseInt(e.replace(/{|}/g,"").split(":")[1])};function m(e){return!(!e||"string"!=typeof e)&&-1<e.indexOf("{{delete")}var g=function(e){return"string"==typeof e};function n(e,n,r,t){void 0===t&&(t=0);var i=n;return n||(i="{{delete:"+t+"}}"),i}var b=function(e){var n={};if(Array.isArray(e))n=e.map(b);else if("object"==typeof e)for(var r in e)null!=e[r]&&"object"==typeof e[r]?n[r]=b(e[r]):n[r]=e[r];else n=e;return n},x=/{{\s*?[\w].*?}}/g;function h(e){return e||""===e||0===e}e.adlib=function(e,a,f){if(void 0===f&&(f=null),(f=b(f)||{}).optional)throw new Error("Please do not pass in an `optional` transform; adlib provides that internally.");return f.optional=n,p(c(e,function(n,e){if("string"!=typeof n)return n;var r,t=n.match(x);return t&&t.length?(t.map(function(e){var i=!1,n=e.replace(/{|}/g,"").trim();if(-1<n.indexOf("||")){var r=n.split("||").map(function(e){return e.trim()}),u=r.length;n=r.find(function(e,n){var r,t;return r=a,t=e.split(":")[0],null!=l(r,t,null)?e:n+1===u&&(i=!0,isNaN(e)||(e=parseInt(e)),e)})}var t={key:e,value:n};if(!i){var o=function(e,n,r){var t,i=e.split(":");if(1<i.length){var u,o=i[0],a=i[1];if(i[2]&&(u=i[2]),!r||!r[a]||"function"!=typeof r[a])throw new Error("Attempted to apply non-existant transform "+a+" on "+o+" with params "+e);t=l(n,o),t=r[a](o,t,n,u)}else t=l(n,e);return t}(n,a,f);t.value=h(o)?o:e}return t}).forEach(function(e){n===e.key?("string"==typeof e.value&&(isNaN(e.value)||""===e.value||(-1<e.value.indexOf(".")?e.value=parseFloat(e.value):"0"!==e.value[0]&&(e.value=parseInt(e.value)))),r=e.value):n=n.replace(e.key,e.value)}),h(r)?r:n):n}))},e.arborist=p,e.deepMapValues=c,e.getPropertyValue=d,e.getWithDefault=l,e.listDependencies=function(e){"string"!=typeof e&&(e=JSON.stringify(e));try{return Array.from(new Set(e.match(x))).map(function(e){return e.replace(/^{{/g,"").replace(/}}$/g,"").replace(/:.+$/,"")})}catch(e){console.error(e)}},e.mapValues=i,e.optionalTransform=n,e.pruneArray=s,e.pruneObject=v,Object.defineProperty(e,"__esModule",{value:!0})});
/**
* adlib - v3.0.6 - Thu Dec 17 2020 17:08:08 GMT-0800 (Pacific Standard Time)
* Copyright (c) 2017-2020 Dave Bouwman / Esri
* adlib - v3.0.7 - Tue Oct 04 2022 12:08:15 GMT-0400 (Eastern Daylight Time)
* Copyright (c) 2017-2022 Dave Bouwman / Esri
* Apache-2.0

@@ -365,6 +365,6 @@ */

var param;
if (transformCheck[2]){
if (transformCheck[2]) {
param = transformCheck[2];
}
if(transforms && transforms[fn] && typeof transforms[fn] === 'function') {
if (transforms && transforms[fn] && typeof transforms[fn] === 'function') {
// get the value from the param

@@ -387,3 +387,3 @@ value = getWithDefault(settings, key);

*/
function _propertyPathExists (propertyPath, target) {
function _propertyPathExists(propertyPath, target) {
// remove any transforms

@@ -402,3 +402,3 @@ var cleanPath = propertyPath.split(':')[0];

*/
function _isValue (val) {
function _isValue(val) {
return val || val === '' || val === 0;

@@ -408,3 +408,3 @@ }

// Combine a Template with Settings
function adlib (template, settings, transforms) {
function adlib(template, settings, transforms) {
if ( transforms === void 0 ) transforms = null;

@@ -419,3 +419,3 @@

var res = deepMapValues(template, function(templateValue, templatePath){
var res = deepMapValues(template, function (templateValue, templatePath) {
// Only string templates

@@ -484,4 +484,4 @@ if (!isString$1(templateValue)) {

if (typeof v.value === 'string') {
// and it's numeric-ish
if(!isNaN(v.value) && v.value !== '') {
// and it's numeric-ish and does not have leading 0s
if (!isNaN(v.value) && v.value !== '') {
// and has a . in it...

@@ -491,5 +491,8 @@ if (v.value.indexOf('.') > -1) {

v.value = parseFloat(v.value);
} else {
// parse as an int
v.value = parseInt(v.value);
// if no leading 0s, parse as an int
if (v.value[0] !== '0'){
v.value = parseInt(v.value);
}
}

@@ -529,3 +532,3 @@ }

// read a template and spit out unique values
function listDependencies (template) {
function listDependencies(template) {
if (typeof template !== 'string') {

@@ -541,8 +544,8 @@ template = JSON.stringify(template);

)
.map(function (term) {
return term.replace(/^{{/g, '').replace(/}}$/g, '').replace(/:.+$/, '')
// Node > 10 and browsers support this w/ a lookahead
// won't need to use the replace
// /(?<={{)[\w].*?(?=}})/g
})
.map(function (term) {
return term.replace(/^{{/g, '').replace(/}}$/g, '').replace(/:.+$/, '')
// Node > 10 and browsers support this w/ a lookahead
// won't need to use the replace
// /(?<={{)[\w].*?(?=}})/g
})
} catch (e) {

@@ -549,0 +552,0 @@ console.error(e);

@@ -34,6 +34,6 @@ /* Copyright (c) 2017-2019 Esri Inc.

let param;
if (transformCheck[2]){
if (transformCheck[2]) {
param = transformCheck[2];
}
if(transforms && transforms[fn] && typeof transforms[fn] === 'function') {
if (transforms && transforms[fn] && typeof transforms[fn] === 'function') {
// get the value from the param

@@ -56,3 +56,3 @@ value = getWithDefault(settings, key);

*/
function _propertyPathExists (propertyPath, target) {
function _propertyPathExists(propertyPath, target) {
// remove any transforms

@@ -71,3 +71,3 @@ let cleanPath = propertyPath.split(':')[0];

*/
function _isValue (val) {
function _isValue(val) {
return val || val === '' || val === 0;

@@ -77,3 +77,3 @@ }

// Combine a Template with Settings
export function adlib (template, settings, transforms = null) {
export function adlib(template, settings, transforms = null) {
transforms = cloneObject(transforms) || {};

@@ -86,3 +86,3 @@ if (transforms.optional) {

let res = deepMapValues(template, function(templateValue, templatePath){
let res = deepMapValues(template, function (templateValue, templatePath) {
// Only string templates

@@ -152,4 +152,4 @@ if (!isString(templateValue)) {

if (typeof v.value === 'string') {
// and it's numeric-ish
if(!isNaN(v.value) && v.value !== '') {
// and it's numeric-ish and does not have leading 0s
if (!isNaN(v.value) && v.value !== '') {
// and has a . in it...

@@ -159,5 +159,8 @@ if (v.value.indexOf('.') > -1) {

v.value = parseFloat(v.value);
} else {
// parse as an int
v.value = parseInt(v.value);
// if no leading 0s, parse as an int
if (v.value[0] !== '0'){
v.value = parseInt(v.value);
}
}

@@ -197,3 +200,3 @@ }

// read a template and spit out unique values
export function listDependencies (template) {
export function listDependencies(template) {
if (typeof template !== 'string') {

@@ -209,8 +212,8 @@ template = JSON.stringify(template)

)
.map(term => {
return term.replace(/^{{/g, '').replace(/}}$/g, '').replace(/:.+$/, '')
// Node > 10 and browsers support this w/ a lookahead
// won't need to use the replace
// /(?<={{)[\w].*?(?=}})/g
})
.map(term => {
return term.replace(/^{{/g, '').replace(/}}$/g, '').replace(/:.+$/, '')
// Node > 10 and browsers support this w/ a lookahead
// won't need to use the replace
// /(?<={{)[\w].*?(?=}})/g
})
} catch (e) {

@@ -217,0 +220,0 @@ console.error(e)

{
"name": "adlib",
"version": "3.0.7",
"version": "3.0.8",
"description": "Templating for deep JSON object graphs",

@@ -5,0 +5,0 @@ "main": "dist/adlib.js",

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