Comparing version 0.0.3 to 0.0.4
"use strict"; | ||
exports.__esModule = true; | ||
exports["default"] = void 0; | ||
/* eslint no-invalid-this: 0*/ | ||
var ExcludedClassProperties = ['__super__']; | ||
var ExcludedPrototypeProperties = ['constructor']; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ExcludedClassProperties = ['__super__']; | ||
const ExcludedPrototypeProperties = ['constructor']; | ||
function mix(from, to, exclude) { | ||
for (var _iterator = Object.getOwnPropertyNames(from), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
for (const name of Object.getOwnPropertyNames(from)) { | ||
if (exclude.indexOf(name) === -1) { | ||
if (!to.hasOwnProperty(name)) { | ||
const descriptor = Object.getOwnPropertyDescriptor(from, name); | ||
Object.defineProperty(to, name, descriptor); | ||
} | ||
} | ||
} | ||
var name = _ref; | ||
if (exclude.indexOf(name) === -1) { | ||
if (!to.hasOwnProperty(name)) { | ||
var descriptor = Object.getOwnPropertyDescriptor(from, name); | ||
Object.defineProperty(to, name, descriptor); | ||
} | ||
} | ||
class Mixin { | ||
static includeInto(constructor) { | ||
// include static properties | ||
mix(this, constructor, ExcludedClassProperties); | ||
// include instance properties | ||
mix(this.prototype, constructor.prototype, ExcludedPrototypeProperties); | ||
if (this.included) { | ||
this.included(constructor); | ||
} | ||
} | ||
} | ||
} | ||
var Mixin = | ||
/*#__PURE__*/ | ||
function () { | ||
function Mixin() {} | ||
Mixin.includeInto = function includeInto(constructor) { | ||
// include static properties | ||
mix(this, constructor, ExcludedClassProperties); // include instance properties | ||
mix(this.prototype, constructor.prototype, ExcludedPrototypeProperties); | ||
if (this.included) { | ||
this.included(constructor); | ||
exports.default = Mixin; | ||
for (const name in Mixin) { | ||
if (Mixin.hasOwnProperty(name)) { | ||
ExcludedClassProperties.push(name); | ||
} | ||
}; | ||
return Mixin; | ||
}(); | ||
exports["default"] = Mixin; | ||
for (var name in Mixin) { | ||
if (Mixin.hasOwnProperty(name)) { | ||
ExcludedClassProperties.push(name); | ||
} | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "mixmatch", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Yet Another Mixin", | ||
@@ -8,10 +8,9 @@ "homepage": "http://github.com/fulcrumapp/mixmatch", | ||
"scripts": { | ||
"test": "npm run lint && node_modules/.bin/mocha ./test/setup.js ./test/test.js", | ||
"test": "npm run lint && mocha -r ts-node/register test/test.js", | ||
"prepublish": "npm run lint && npm run clean && npm run build", | ||
"lint": "node_modules/.bin/eslint src", | ||
"build": "node_modules/.bin/babel src --out-dir dist --source-maps", | ||
"watch": "node_modules/.bin/babel src --out-dir dist --source-maps --watch", | ||
"lint": "eslint src", | ||
"build": "tsc", | ||
"clean": "rm -rf dist" | ||
}, | ||
"author": "Zac McCormick <zac.mccormick@gmail.com> (http://github.com/zhm)", | ||
"author": "Fulcrum", | ||
"license": "BSD-3-Clause", | ||
@@ -23,9 +22,12 @@ "repository": { | ||
"devDependencies": { | ||
"@babel/cli": "^7.5.5", | ||
"@babel/core": "^7.5.5", | ||
"@babel/preset-env": "^7.5.5", | ||
"chai": "^3.4.1", | ||
"eslint": "^1.10.1", | ||
"mocha": "^2.3.3", | ||
"source-map-support": "^0.4.0" | ||
"@typescript-eslint/eslint-plugin": "^5.33.0", | ||
"@typescript-eslint/parser": "^5.33.0", | ||
"chai": "^4.3.6", | ||
"eslint": "^8.21.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"mocha": "^10.0.0", | ||
"source-map-support": "^0.5.21", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.7.4" | ||
}, | ||
@@ -32,0 +34,0 @@ "dependencies": {}, |
@@ -1,2 +0,2 @@ | ||
## mixmatch [![Build Status](https://secure.travis-ci.org/fulcrumapp/mixmatch.svg)](http://travis-ci.org/fulcrumapp/mixmatch) | ||
## mixmatch | ||
@@ -3,0 +3,0 @@ Yet another mixin. |
@@ -1,8 +0,6 @@ | ||
/* eslint no-invalid-this: 0*/ | ||
const ExcludedClassProperties = [ '__super__']; | ||
const ExcludedClassProperties = ['__super__']; | ||
const ExcludedPrototypeProperties = ['constructor']; | ||
function mix(from, to, exclude) { | ||
for (let name of Object.getOwnPropertyNames(from)) { | ||
for (const name of Object.getOwnPropertyNames(from)) { | ||
if (exclude.indexOf(name) === -1) { | ||
@@ -32,3 +30,3 @@ if (!to.hasOwnProperty(name)) { | ||
for (let name in Mixin) { | ||
for (const name in Mixin) { | ||
if (Mixin.hasOwnProperty(name)) { | ||
@@ -35,0 +33,0 @@ ExcludedClassProperties.push(name); |
@@ -0,3 +1,6 @@ | ||
import chai from 'chai'; | ||
import Mixin from '../src'; | ||
chai.should(); | ||
class HasHeight extends Mixin { | ||
@@ -4,0 +7,0 @@ get height() { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
158
0
7144
10
9