UNPKG

akiha-board

Version:

Generate printed wiring board pattern by ASCII art

65 lines (54 loc) 1.2 kB
/* * akiha-board * * Copyright (c) 2019 Yuichiro MORIGUCHI * * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php **/ var undef = void 0; function isArray(anObject) { return Object.prototype.toString.call(anObject) === '[object Array]'; } function deepcopy(anObject) { var result; function copyAll() { var i; for(i in anObject) { if(anObject.hasOwnProperty(i)) { result[i] = deepcopy(anObject[i]); } } } if(isArray(anObject)) { result = []; copyAll(); return result; } else if(typeof anObject === 'object' && anObject !== null) { result = {}; copyAll(); return result; } else { return anObject; } } function extend(base, child) { var result = {}, i; for(i in base) { if(base.hasOwnProperty(i)) { result[i] = base[i]; } } for(i in child) { if(child.hasOwnProperty(i)) { result[i] = child[i]; } } return result; } module.exports = { isArray: isArray, deepcopy: deepcopy, extend: extend };