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

way2web-clone

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

way2web-clone - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

38

js/clone.core.js

@@ -15,3 +15,3 @@ /**

var version = '0.1.2';
var version = '0.1.3';

@@ -112,3 +112,3 @@ var elements = {

var $template = $scope.find(elements.template);
var $template = getTemplate();
var $clone = $template

@@ -150,4 +150,4 @@ .clone(true, true)

if($(elements.removeClone + ':not(.' + classes.hidden + ')') && countOnRemove) {
$count = $($scope).find(elements.removeClone + ':not(.' + classes.hidden + ')').length;
if(getItems() && countOnRemove) {
$count = getItemCount();
}

@@ -200,2 +200,29 @@

/**
* Get all items.
*
* @return {object}
*/
function getItems() {
return $($scope).find(elements.removeClone + ':not(.' + classes.hidden + ')');
}
/**
* Get the template.
*
* @return {object}
*/
function getTemplate() {
return $scope.find(elements.template);
}
/**
* Get the total of items.
*
* @return {integer}
*/
function getItemCount() {
return getItems().length;
}
return {

@@ -210,4 +237,7 @@ init: init,

setCountOnRemove: setCountOnRemove,
getItems: getItems,
getTemplate: getTemplate,
getItemCount: getItemCount,
version: version
};
};

2

package.json
{
"name": "way2web-clone",
"version": "0.1.2",
"version": "0.1.3",
"description": "Clone an element.",

@@ -5,0 +5,0 @@ "files": [

@@ -79,4 +79,113 @@ # Clone

## functions
### init
Get all parameters, and merge it with the default values.
Check the click events.
`return {object}`
### scope
The element used for the clone.
### clone
Clone the element.
This function is called if you click on the clone button.
### remove
When triggered, remove the target element.
This function is called if you click on the remove button of an item.
### setElements
Overrule the default elements.
`param {object} customElements`
`return {object}`
### setClasses
Overrule the default classes.
`@param {object} customClasses`
`@return {object}`
### setEvents
Overrule the default events.
`@param {object} customEvents`
`@return {object}`
### setCountOnRemove
If true, the count will be the amount of items.
The counter will change if you delete an item.
By default the value is false, so it can be used as an unique id.
`@param {boolean} customCountOnRemove`
`@return {object}`
### getItems
Get all item elements.
`return {object}`
### getTemplate
Get the template element.
`@return {object}`
### getItemCount
Get the total of items.
`@return {integer}`
### version
Get the version of the package.
## NPM
Install using npm:
```
$ npm install --save way2web-clone
```
## Test the package.
To test the package, clone the package to your system.
Than run this command.
```
npm run build
```
This will copy the test files to the dist, and also build the package files include the dependencies.
When this script is complete without errors, you can open `dist/index.html` in your browser.
Open the dev tools, tab console, and you see all the results of the tests.
If you only want to check the eslint rules, just run.
```
npm run lint
```
[downloads-image]: https://img.shields.io/npm/dm/way2web-clone.svg
[npm-url]: https://www.npmjs.com/package/way2web-clone
[npm-image]: https://img.shields.io/npm/v/way2web-clone.svg
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