nestable-quasis
Advanced tools
Comparing version 0.1.0 to 1.0.0
@@ -0,1 +1,7 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = nestableQuasis; | ||
/* | ||
@@ -16,34 +22,14 @@ This program is free software: you can redistribute it and/or modify | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
exports.default = nestableQuasis; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function newNQClass() { | ||
return (function () { | ||
var _class = function (_ref) { | ||
var literals = _ref.literals; | ||
var substitutions = _ref.substitutions; | ||
_classCallCheck(this, _class); | ||
return class { | ||
constructor({ literals, substitutions }) { | ||
this.literals = literals; | ||
this.substitutions = substitutions; | ||
}; | ||
return _class; | ||
})(); | ||
} | ||
}; | ||
} | ||
function nestableQuasis() { | ||
var cl = arguments[0] === undefined ? newNQClass() : arguments[0]; | ||
return function (literals) { | ||
var flatLiterals = [], | ||
function nestableQuasis(cl = newNQClass()) { | ||
return function (literals, ...substitutions) { | ||
let flatLiterals = [], | ||
flatSubstitutions = [], | ||
@@ -54,7 +40,2 @@ i = 0, | ||
nextLiteral += literals[i]; | ||
for (var _len = arguments.length, substitutions = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
substitutions[_key - 1] = arguments[_key]; | ||
} | ||
if (i === substitutions.length) { | ||
@@ -68,6 +49,6 @@ flatLiterals.push(nextLiteral); | ||
} else { | ||
var newLiterals = substitutions[i].literals; | ||
flatLiterals.push.apply(flatLiterals, [nextLiteral + newLiterals[0]].concat(_toConsumableArray(newLiterals.slice(1)))); | ||
let newLiterals = substitutions[i].literals; | ||
flatLiterals.push(nextLiteral + newLiterals[0], ...newLiterals.slice(1)); | ||
nextLiteral = flatLiterals.pop(); | ||
flatSubstitutions.push.apply(flatSubstitutions, _toConsumableArray(substitutions[i].substitutions)); | ||
flatSubstitutions.push(...substitutions[i].substitutions); | ||
} | ||
@@ -79,3 +60,2 @@ i++; | ||
} | ||
module.exports = exports.default; | ||
//# sourceMappingURL=nestable-quasis.js.map |
{ | ||
"name": "nestable-quasis", | ||
"version": "0.1.0", | ||
"version": "1.0.0", | ||
"description": "ES6 quasi tags for flattening nested quasis into single lists of literals and substitutions", | ||
"main": "lib/nestable-quasis.js", | ||
"scripts": { | ||
"build": "babel src --out-dir lib --whitelist es6.classes,es6.modules,es6.blockScoping,es6.properties.shorthand,es6.spread,es6.parameters,es6.destructuring,spec.undefinedToVoid,strict", | ||
"build": "node_modules/.bin/gulp build", | ||
"prepublish": "$npm_package_scripts_build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/rschaosid/node-nestable-quasis.git" | ||
}, | ||
"author": "rschaosid <rschaosid@gmail.com>", | ||
"license": "GPLv3", | ||
"bugs": { | ||
"url": "https://github.com/rschaosid/node-nestable-quasis/issues" | ||
}, | ||
"homepage": "https://github.com/rschaosid/node-nestable-quasis", | ||
"devDependencies": { | ||
"babel": "^5.6.14" | ||
"babel-core": "^6.9.1", | ||
"babel-plugin-transform-async-to-generator": "^6.8.0", | ||
"babel-plugin-transform-class-properties": "^6.9.1", | ||
"babel-plugin-transform-do-expressions": "^6.8.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.8.0", | ||
"babel-plugin-transform-exponentiation-operator": "^6.8.0", | ||
"babel-plugin-transform-export-extensions": "^6.8.0", | ||
"babel-plugin-transform-function-bind": "^6.8.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.8.0", | ||
"babel-plugin-transform-strict-mode": "^6.8.0", | ||
"gulp": "^3.9.1", | ||
"gulp-babel": "^6.1.2", | ||
"gulp-plumber": "^1.1.0", | ||
"gulp-sourcemaps": "^1.6.0", | ||
"gulp-watch": "^4.3.6" | ||
} | ||
} |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
41996
84
1
15
2
0
1