Skip to content

Instantly share code, notes, and snippets.

/**
* Transform for Knockout 3+
* (c) Denis Gulin
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
!function (factory) {
// Support three module loading scenarios
if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
// [1] CommonJS or Node: hard-coded dependency on "knockout"
factory(require("knockout"));
@vamp
vamp / sudoku-validator.js
Created March 14, 2018 11:31
sudoku validator
function validate(board) {
const input = getArray(board);
const predicates = [
hasValidStructure,
createDataValidator([9, 1]),
createDataValidator([1, 9]),
createDataValidator([3, 3])
];
const isValid = predicates.every(fn => fn(input));