Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

filepond-plugin-file-rename

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filepond-plugin-file-rename - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

32

dist/filepond-plugin-file-rename.esm.js
/*
* FilePondPluginFileRename 1.0.1
* FilePondPluginFileRename 1.1.0
* Licensed under MIT, https://opensource.org/licenses/MIT

@@ -31,12 +31,22 @@ * Please visit https://pqina.nl/filepond for details.

resolve(
renameFile(
file,
renameFunction({
name: file.name,
basename: getFilenameWithoutExtension(file.name),
extension: `.${getExtensionFromFilename(file.name)}`
})
)
);
// can either return a name or a promise
const newFilename = renameFunction({
name: file.name,
basename: getFilenameWithoutExtension(file.name),
extension: `.${getExtensionFromFilename(file.name)}`
});
// renames the file and resolves
const rename = name => {
resolve(renameFile(file, name));
};
// has returned new filename immidiately
if (typeof newFilename === 'string') {
rename(newFilename);
return;
}
// is promise
newFilename.then(rename);
})

@@ -43,0 +53,0 @@ );

/*
* FilePondPluginFileRename 1.0.1
* FilePondPluginFileRename 1.1.0
* Licensed under MIT, https://opensource.org/licenses/MIT
* Please visit https://pqina.nl/filepond for details.
*/
var plugin$1=({addFilter:e,utils:n})=>{const{Type:i,renameFile:t,isFile:a,getExtensionFromFilename:l,getFilenameWithoutExtension:o}=n;return e("LOAD_FILE",(e,{query:n})=>new Promise((i,m)=>{const u=n("GET_ALLOW_FILE_RENAME"),E=n("GET_FILE_RENAME_FUNCTION");i(a(e)&&u&&E?t(e,E({name:e.name,basename:o(e.name),extension:`.${l(e.name)}`})):e)})),{options:{allowFileRename:[!0,i.BOOLEAN],fileRenameFunction:[null,i.FUNCTION]}}};"undefined"!=typeof navigator&&document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:plugin$1}));export default plugin$1;
var plugin$1=({addFilter:e,utils:n})=>{const{Type:t,renameFile:i,isFile:o,getExtensionFromFilename:a,getFilenameWithoutExtension:l}=n;return e("LOAD_FILE",(e,{query:n})=>new Promise((t,u)=>{const m=n("GET_ALLOW_FILE_RENAME"),s=n("GET_FILE_RENAME_FUNCTION");if(!o(e)||!m||!s)return void t(e);const E=s({name:e.name,basename:l(e.name),extension:`.${a(e.name)}`}),F=n=>{t(i(e,n))};"string"!=typeof E?E.then(F):F(E)})),{options:{allowFileRename:[!0,t.BOOLEAN],fileRenameFunction:[null,t.FUNCTION]}}};"undefined"!=typeof navigator&&document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:plugin$1}));export default plugin$1;
/*
* FilePondPluginFileRename 1.0.1
* FilePondPluginFileRename 1.1.0
* Licensed under MIT, https://opensource.org/licenses/MIT

@@ -41,12 +41,22 @@ * Please visit https://pqina.nl/filepond for details.

resolve(
renameFile(
file,
renameFunction({
name: file.name,
basename: getFilenameWithoutExtension(file.name),
extension: '.' + getExtensionFromFilename(file.name)
})
)
);
// can either return a name or a promise
var newFilename = renameFunction({
name: file.name,
basename: getFilenameWithoutExtension(file.name),
extension: '.' + getExtensionFromFilename(file.name)
});
// renames the file and resolves
var rename = function rename(name) {
resolve(renameFile(file, name));
};
// has returned new filename immidiately
if (typeof newFilename === 'string') {
rename(newFilename);
return;
}
// is promise
newFilename.then(rename);
});

@@ -53,0 +63,0 @@ });

/*
* FilePondPluginFileRename 1.0.1
* FilePondPluginFileRename 1.1.0
* Licensed under MIT, https://opensource.org/licenses/MIT
* Please visit https://pqina.nl/filepond for details.
*/
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.FilePondPluginFileRename=n()}(this,function(){"use strict";var e=function(e){var n=e.addFilter,i=e.utils,t=i.Type,o=i.renameFile,u=i.isFile,a=i.getExtensionFromFilename,d=i.getFilenameWithoutExtension;return n("LOAD_FILE",function(e,n){var i=n.query;return new Promise(function(n,t){var l=i("GET_ALLOW_FILE_RENAME"),r=i("GET_FILE_RENAME_FUNCTION");return u(e)&&l&&r?void n(o(e,r({name:e.name,basename:d(e.name),extension:"."+a(e.name)}))):void n(e)})}),{options:{allowFileRename:[!0,t.BOOLEAN],fileRenameFunction:[null,t.FUNCTION]}}};return"undefined"!=typeof navigator&&document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:e})),e});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.FilePondPluginFileRename=n()}(this,function(){"use strict";var e=function(e){var n=e.addFilter,t=e.utils,i=t.Type,o=t.renameFile,u=t.isFile,a=t.getExtensionFromFilename,r=t.getFilenameWithoutExtension;return n("LOAD_FILE",function(e,n){var t=n.query;return new Promise(function(n,i){var d=t("GET_ALLOW_FILE_RENAME"),l=t("GET_FILE_RENAME_FUNCTION");if(!u(e)||!d||!l)return void n(e);var f=l({name:e.name,basename:r(e.name),extension:"."+a(e.name)}),m=function(t){n(o(e,t))};return"string"==typeof f?void m(f):void f.then(m)})}),{options:{allowFileRename:[!0,i.BOOLEAN],fileRenameFunction:[null,i.FUNCTION]}}};return"undefined"!=typeof navigator&&document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:e})),e});
{
"name": "filepond-plugin-file-rename",
"version": "1.0.1",
"version": "1.1.0",
"description": "File Rename Plugin for FilePond",

@@ -5,0 +5,0 @@ "homepage": "https://pqina.nl/filepond",

@@ -5,2 +5,4 @@ # File Rename plugin for FilePond

https://pqina.nl/filepond
https://pqina.nl/filepond/docs/patterns/plugins/file-rename/
Using the File Rename plugin we can automatically rename files before the are added to FilePond.
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