@craftercms/utils
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -39,7 +39,23 @@ /* | ||
*/ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
function composeUrl(studioConfigOrBaseUrl, endpoint) { | ||
var base = (typeof studioConfigOrBaseUrl === 'string') | ||
? studioConfigOrBaseUrl | ||
: studioConfigOrBaseUrl.baseUrl; | ||
return (base + "/" + endpoint).replace(/([^:]\/)\/+/g, "$1"); | ||
: (studioConfigOrBaseUrl.baseUrl ? studioConfigOrBaseUrl.baseUrl + '/' : ''); | ||
return ("" + base + endpoint).replace(/([^:]\/)\/+/g, "$1"); | ||
} | ||
@@ -82,2 +98,18 @@ function isPlainObject(obj) { | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
function log(message, type) { | ||
@@ -84,0 +116,0 @@ if (type === void 0) { type = log.DEFAULT; } |
@@ -1,1 +0,1 @@ | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define("@craftercms/utils",["exports"],factory):factory((global.craftercms=global.craftercms||{},global.craftercms.utils={}))}(this,function(exports){"use strict";function isPlainObject(obj){return"object"==typeof obj&&null!==obj&&obj.constructor==Object}function extendDeep(target,source){for(var prop in source)source.hasOwnProperty(prop)&&(prop in target&&isPlainObject(target[prop])&&isPlainObject(source[prop])?extendDeep(target[prop],source[prop]):target[prop]=source[prop]);return target}function nullOrUndefined(value){return null==value}function log(message,type){void 0===type&&(type=log.DEFAULT),console&&(console[type]&&!console[type](message)||console.log&&console.log(message))}!function(log){log.DEFAULT="log",log.ERROR="error",log.WARN="warn"}(log||(log={})),exports.composeUrl=function(studioConfigOrBaseUrl,endpoint){return(("string"==typeof studioConfigOrBaseUrl?studioConfigOrBaseUrl:studioConfigOrBaseUrl.baseUrl)+"/"+endpoint).replace(/([^:]\/)\/+/g,"$1")},exports.isPlainObject=isPlainObject,exports.extendDeep=extendDeep,exports.extendDeepExistingProps=function(target,source){for(var prop in source)prop in target&&source.hasOwnProperty(prop)&&(isPlainObject(target[prop])&&isPlainObject(source[prop])?extendDeep(target[prop],source[prop]):target[prop]=source[prop]);return target},exports.nullOrUndefined=nullOrUndefined,exports.notNullOrUndefined=function(value){return!nullOrUndefined(value)},exports.log=log,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define("@craftercms/utils",["exports"],factory):factory((global.craftercms=global.craftercms||{},global.craftercms.utils={}))}(this,function(exports){"use strict";function isPlainObject(obj){return"object"==typeof obj&&null!==obj&&obj.constructor==Object}function extendDeep(target,source){for(var prop in source)source.hasOwnProperty(prop)&&(prop in target&&isPlainObject(target[prop])&&isPlainObject(source[prop])?extendDeep(target[prop],source[prop]):target[prop]=source[prop]);return target}function nullOrUndefined(value){return null==value}function log(message,type){void 0===type&&(type=log.DEFAULT),console&&(console[type]&&!console[type](message)||console.log&&console.log(message))}!function(log){log.DEFAULT="log",log.ERROR="error",log.WARN="warn"}(log||(log={})),exports.composeUrl=function(studioConfigOrBaseUrl,endpoint){return(""+("string"==typeof studioConfigOrBaseUrl?studioConfigOrBaseUrl:studioConfigOrBaseUrl.baseUrl?studioConfigOrBaseUrl.baseUrl+"/":"")+endpoint).replace(/([^:]\/)\/+/g,"$1")},exports.isPlainObject=isPlainObject,exports.extendDeep=extendDeep,exports.extendDeepExistingProps=function(target,source){for(var prop in source)prop in target&&source.hasOwnProperty(prop)&&(isPlainObject(target[prop])&&isPlainObject(source[prop])?extendDeep(target[prop],source[prop]):target[prop]=source[prop]);return target},exports.nullOrUndefined=nullOrUndefined,exports.notNullOrUndefined=function(value){return!nullOrUndefined(value)},exports.log=log,Object.defineProperty(exports,"__esModule",{value:!0})}); |
@@ -0,2 +1,18 @@ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export * from './utils'; | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,17 @@ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export function log(message, type = log.DEFAULT) { | ||
@@ -2,0 +18,0 @@ console && (console[type] && !console[type](message) || console.log && console.log(message)); |
@@ -0,6 +1,22 @@ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export function composeUrl(studioConfigOrBaseUrl, endpoint) { | ||
const base = (typeof studioConfigOrBaseUrl === 'string') | ||
? studioConfigOrBaseUrl | ||
: studioConfigOrBaseUrl.baseUrl; | ||
return `${base}/${endpoint}`.replace(/([^:]\/)\/+/g, "$1"); | ||
: (studioConfigOrBaseUrl.baseUrl ? studioConfigOrBaseUrl.baseUrl + '/' : ''); | ||
return `${base}${endpoint}`.replace(/([^:]\/)\/+/g, "$1"); | ||
} | ||
@@ -7,0 +23,0 @@ export function isPlainObject(obj) { |
@@ -0,1 +1,17 @@ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
//# sourceMappingURL=types.js.map |
@@ -0,3 +1,19 @@ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export * from './src/misc'; | ||
export * from './src/logging'; | ||
//# sourceMappingURL=utils.js.map |
@@ -0,2 +1,18 @@ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export * from './utils'; | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,17 @@ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export function log(message, type) { | ||
@@ -2,0 +18,0 @@ if (type === void 0) { type = log.DEFAULT; } |
@@ -0,6 +1,22 @@ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export function composeUrl(studioConfigOrBaseUrl, endpoint) { | ||
var base = (typeof studioConfigOrBaseUrl === 'string') | ||
? studioConfigOrBaseUrl | ||
: studioConfigOrBaseUrl.baseUrl; | ||
return (base + "/" + endpoint).replace(/([^:]\/)\/+/g, "$1"); | ||
: (studioConfigOrBaseUrl.baseUrl ? studioConfigOrBaseUrl.baseUrl + '/' : ''); | ||
return ("" + base + endpoint).replace(/([^:]\/)\/+/g, "$1"); | ||
} | ||
@@ -7,0 +23,0 @@ export function isPlainObject(obj) { |
@@ -0,1 +1,17 @@ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
//# sourceMappingURL=types.js.map |
@@ -0,3 +1,19 @@ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export * from './src/misc'; | ||
export * from './src/logging'; | ||
//# sourceMappingURL=utils.js.map |
@@ -17,7 +17,23 @@ /* | ||
*/ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
function composeUrl(studioConfigOrBaseUrl, endpoint) { | ||
const base = (typeof studioConfigOrBaseUrl === 'string') | ||
? studioConfigOrBaseUrl | ||
: studioConfigOrBaseUrl.baseUrl; | ||
return `${base}/${endpoint}`.replace(/([^:]\/)\/+/g, "$1"); | ||
: (studioConfigOrBaseUrl.baseUrl ? studioConfigOrBaseUrl.baseUrl + '/' : ''); | ||
return `${base}${endpoint}`.replace(/([^:]\/)\/+/g, "$1"); | ||
} | ||
@@ -60,2 +76,18 @@ function isPlainObject(obj) { | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
function log(message, type = log.DEFAULT) { | ||
@@ -70,3 +102,20 @@ console && (console[type] && !console[type](message) || console.log && console.log(message)); | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export { composeUrl, isPlainObject, extendDeep, extendDeepExistingProps, nullOrUndefined, notNullOrUndefined, log }; | ||
//# sourceMappingURL=utils.js.map |
@@ -17,7 +17,23 @@ /* | ||
*/ | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
function composeUrl(studioConfigOrBaseUrl, endpoint) { | ||
var base = (typeof studioConfigOrBaseUrl === 'string') | ||
? studioConfigOrBaseUrl | ||
: studioConfigOrBaseUrl.baseUrl; | ||
return (base + "/" + endpoint).replace(/([^:]\/)\/+/g, "$1"); | ||
: (studioConfigOrBaseUrl.baseUrl ? studioConfigOrBaseUrl.baseUrl + '/' : ''); | ||
return ("" + base + endpoint).replace(/([^:]\/)\/+/g, "$1"); | ||
} | ||
@@ -60,2 +76,18 @@ function isPlainObject(obj) { | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
function log(message, type) { | ||
@@ -71,3 +103,20 @@ if (type === void 0) { type = log.DEFAULT; } | ||
/* | ||
* Copyright (C) 2007-2019 Crafter Software Corporation. All rights reserved. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
export { composeUrl, isPlainObject, extendDeep, extendDeepExistingProps, nullOrUndefined, notNullOrUndefined, log }; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@craftercms/utils", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Crafter CMS utility and helper functions", | ||
@@ -5,0 +5,0 @@ "main": "./bundles/utils.umd.js", |
export declare function composeUrl(baseUrl: string, endpoint: string): string; | ||
export declare function composeUrl(studioConfig: { | ||
baseUrl: any; | ||
baseUrl?: any; | ||
}, endpoint: string): string; | ||
@@ -5,0 +5,0 @@ export declare function isPlainObject(obj: any): boolean; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
69656
647