Skip to content

Instantly share code, notes, and snippets.

View sudoku-validator.js
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));
View ko.transform.js
/**
* 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"));