Comparing version 0.12.3 to 0.12.4
57
kc.js
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -6,2 +6,12 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.mapStrToId = exports.mapIdToStr = exports.splitMapId = exports.canEquipDLC = undefined; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _lodash = require('lodash'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var SType = { | ||
@@ -78,2 +88,45 @@ DE: 1, DD: 2, CL: 3, CLT: 4, | ||
exports.canEquipDLC = canEquipDLC; | ||
/* | ||
split a mapId into "area" and "num" | ||
a mapId is a Number from api_id of map master data | ||
*/ | ||
var splitMapId = function splitMapId(mapId) { | ||
return { | ||
area: Math.floor(mapId / 10), | ||
num: mapId % 10 | ||
}; | ||
}; | ||
/* | ||
convert mapId to str, e.g. 12 -> "1-2", 401 -> "40-1" | ||
*/ | ||
var mapIdToStr = function mapIdToStr(mapId) { | ||
var _splitMapId = splitMapId(mapId), | ||
area = _splitMapId.area, | ||
num = _splitMapId.num; | ||
return area + '-' + num; | ||
}; | ||
/* | ||
convert mapStr, which are strings like "1-1", "40-1", | ||
to mapId, returns null upon failure | ||
*/ | ||
var mapStrToId = function mapStrToId(mapStr) { | ||
var matchResult = /^(\d+)-(\d+)$/.exec(mapStr); | ||
if (matchResult) { | ||
var _matchResult = _slicedToArray(matchResult, 3), | ||
_ignored = _matchResult[0], | ||
areaS = _matchResult[1], | ||
numS = _matchResult[2]; | ||
return Number(areaS) * 10 + Number(numS); | ||
} else { | ||
return null; | ||
} | ||
}; | ||
exports.canEquipDLC = canEquipDLC; | ||
exports.splitMapId = splitMapId; | ||
exports.mapIdToStr = mapIdToStr; | ||
exports.mapStrToId = mapStrToId; |
{ | ||
"name": "subtender", | ||
"version": "0.12.3", | ||
"version": "0.12.4", | ||
"description": "Javran's utility functions", | ||
@@ -9,3 +9,3 @@ "main": "index.js", | ||
"test": "mocha --compilers js:babel-core/register --recursive", | ||
"lint": "eslint 'src/**' 'test/**'", | ||
"lint": "eslint 'src/**' 'test/**' || true", | ||
"clear-dist": "rm -rf dist/", | ||
@@ -12,0 +12,0 @@ "check": "npm test && npm run lint", |
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
55403
1171